@selfcommunity/react-core 0.1.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +13 -0
- package/lib/cjs/components/provider/SCAlertMessagesProvider/index.js +67 -0
- package/lib/cjs/components/provider/SCContextProvider/index.js +117 -0
- package/lib/cjs/components/provider/SCLocaleProvider/index.js +158 -0
- package/lib/cjs/components/provider/SCNotificationProvider/index.js +73 -0
- package/lib/cjs/components/provider/SCPreferencesProvider/index.js +93 -0
- package/lib/cjs/components/provider/SCRoutingProvider/index.js +146 -0
- package/lib/cjs/components/provider/SCThemeProvider/index.js +123 -0
- package/lib/cjs/components/provider/SCUserProvider/index.js +310 -0
- package/lib/cjs/components/router/index.js +91 -0
- package/lib/cjs/constants/Actions.js +6 -0
- package/lib/cjs/constants/ContextProviders.js +29 -0
- package/lib/cjs/constants/Device.js +11 -0
- package/lib/cjs/constants/Errors.js +10 -0
- package/lib/cjs/constants/Features.js +84 -0
- package/lib/cjs/constants/Locale.js +19 -0
- package/lib/cjs/constants/Notification.js +67 -0
- package/lib/cjs/constants/Notifications.js +27 -0
- package/lib/cjs/constants/Preferences.js +344 -0
- package/lib/cjs/constants/Routes.js +68 -0
- package/lib/cjs/constants/Session.js +22 -0
- package/lib/cjs/constants/Theme.js +6 -0
- package/lib/cjs/constants/WebSocket.js +10 -0
- package/lib/cjs/hooks/useSCAuth.js +340 -0
- package/lib/cjs/hooks/useSCCachingManager.js +58 -0
- package/lib/cjs/hooks/useSCConnectionsManager.js +285 -0
- package/lib/cjs/hooks/useSCFetchCategories.js +71 -0
- package/lib/cjs/hooks/useSCFetchCategory.js +68 -0
- package/lib/cjs/hooks/useSCFetchCommentObject.js +68 -0
- package/lib/cjs/hooks/useSCFetchCommentObjects.js +296 -0
- package/lib/cjs/hooks/useSCFetchCustomAdv.js +84 -0
- package/lib/cjs/hooks/useSCFetchFeedObject.js +79 -0
- package/lib/cjs/hooks/useSCFetchIncubator.js +68 -0
- package/lib/cjs/hooks/useSCFetchTag.js +68 -0
- package/lib/cjs/hooks/useSCFetchUser.js +68 -0
- package/lib/cjs/hooks/useSCFollowedCategoriesManager.js +162 -0
- package/lib/cjs/hooks/useSCFollowersManager.js +232 -0
- package/lib/cjs/hooks/useSCMediaClick.js +27 -0
- package/lib/cjs/hooks/useSCSubscribedIncubatorsManager.js +165 -0
- package/lib/cjs/hooks/useSCWebPushMessaging.js +286 -0
- package/lib/cjs/hooks/useSCWebSocket.js +120 -0
- package/lib/cjs/index.js +169 -0
- package/lib/cjs/scss/styles.scss +1 -0
- package/lib/cjs/themes/theme.js +165 -0
- package/lib/cjs/types/context.js +3 -0
- package/lib/cjs/types/index.js +22 -0
- package/lib/cjs/utils/errors.js +196 -0
- package/lib/cjs/utils/locale.js +56 -0
- package/lib/cjs/utils/logger.js +32 -0
- package/lib/cjs/utils/object.js +44 -0
- package/lib/cjs/utils/session.js +17 -0
- package/lib/cjs/utils/string.js +57 -0
- package/lib/cjs/utils/url.js +70 -0
- package/lib/cjs/utils/user.js +83 -0
- package/lib/cjs/utils/validator.js +771 -0
- package/lib/cjs/utils/webPushMessaging.js +110 -0
- package/lib/cjs/utils/websocket.js +307 -0
- package/lib/esm/api-services/src/client/index.d.ts +115 -0
- package/lib/esm/api-services/src/client/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/constants/Endpoints.d.ts +10 -0
- package/lib/esm/api-services/src/constants/Endpoints.d.ts.map +1 -0
- package/lib/esm/api-services/src/index.d.ts +24 -0
- package/lib/esm/api-services/src/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/category/index.d.ts +13 -0
- package/lib/esm/api-services/src/services/category/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/feature/index.d.ts +10 -0
- package/lib/esm/api-services/src/services/feature/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/preference/index.d.ts +16 -0
- package/lib/esm/api-services/src/services/preference/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/services/user/index.d.ts +16 -0
- package/lib/esm/api-services/src/services/user/index.d.ts.map +1 -0
- package/lib/esm/api-services/src/utils/http.d.ts +6 -0
- package/lib/esm/api-services/src/utils/http.d.ts.map +1 -0
- package/lib/esm/api-services/src/utils/token.d.ts +16 -0
- package/lib/esm/api-services/src/utils/token.d.ts.map +1 -0
- package/lib/esm/components/provider/SCAlertMessagesProvider/index.js +67 -0
- package/lib/esm/components/provider/SCContextProvider/index.js +117 -0
- package/lib/esm/components/provider/SCLocaleProvider/index.js +158 -0
- package/lib/esm/components/provider/SCNotificationProvider/index.js +73 -0
- package/lib/esm/components/provider/SCPreferencesProvider/index.js +93 -0
- package/lib/esm/components/provider/SCRoutingProvider/index.js +146 -0
- package/lib/esm/components/provider/SCThemeProvider/index.js +123 -0
- package/lib/esm/components/provider/SCUserProvider/index.js +310 -0
- package/lib/esm/components/router/index.js +91 -0
- package/lib/esm/constants/Actions.js +6 -0
- package/lib/esm/constants/ContextProviders.js +29 -0
- package/lib/esm/constants/Device.js +11 -0
- package/lib/esm/constants/Errors.js +10 -0
- package/lib/esm/constants/Features.js +84 -0
- package/lib/esm/constants/Locale.js +19 -0
- package/lib/esm/constants/Notification.js +67 -0
- package/lib/esm/constants/Notifications.js +27 -0
- package/lib/esm/constants/Preferences.js +344 -0
- package/lib/esm/constants/Routes.js +68 -0
- package/lib/esm/constants/Session.js +22 -0
- package/lib/esm/constants/Theme.js +6 -0
- package/lib/esm/constants/WebSocket.js +10 -0
- package/lib/esm/hooks/useSCAuth.js +340 -0
- package/lib/esm/hooks/useSCCachingManager.js +58 -0
- package/lib/esm/hooks/useSCConnectionsManager.js +285 -0
- package/lib/esm/hooks/useSCFetchCategories.js +71 -0
- package/lib/esm/hooks/useSCFetchCategory.js +68 -0
- package/lib/esm/hooks/useSCFetchCommentObject.js +68 -0
- package/lib/esm/hooks/useSCFetchCommentObjects.js +296 -0
- package/lib/esm/hooks/useSCFetchCustomAdv.js +84 -0
- package/lib/esm/hooks/useSCFetchFeedObject.js +79 -0
- package/lib/esm/hooks/useSCFetchIncubator.js +68 -0
- package/lib/esm/hooks/useSCFetchTag.js +68 -0
- package/lib/esm/hooks/useSCFetchUser.js +68 -0
- package/lib/esm/hooks/useSCFollowedCategoriesManager.js +162 -0
- package/lib/esm/hooks/useSCFollowersManager.js +232 -0
- package/lib/esm/hooks/useSCMediaClick.js +27 -0
- package/lib/esm/hooks/useSCSubscribedIncubatorsManager.js +165 -0
- package/lib/esm/hooks/useSCWebPushMessaging.js +286 -0
- package/lib/esm/hooks/useSCWebSocket.js +120 -0
- package/lib/esm/index.js +169 -0
- package/lib/esm/react-core/src/components/provider/SCAlertMessagesProvider/index.d.ts +37 -0
- package/lib/esm/react-core/src/components/provider/SCAlertMessagesProvider/index.d.ts.map +1 -0
- package/lib/esm/react-core/src/components/provider/SCContextProvider/index.d.ts +35 -0
- package/lib/esm/react-core/src/components/provider/SCContextProvider/index.d.ts.map +1 -0
- package/lib/esm/react-core/src/components/provider/SCLocaleProvider/index.d.ts +42 -0
- package/lib/esm/react-core/src/components/provider/SCLocaleProvider/index.d.ts.map +1 -0
- package/lib/esm/react-core/src/components/provider/SCNotificationProvider/index.d.ts +37 -0
- package/lib/esm/react-core/src/components/provider/SCNotificationProvider/index.d.ts.map +1 -0
- package/lib/esm/react-core/src/components/provider/SCPreferencesProvider/index.d.ts +38 -0
- package/lib/esm/react-core/src/components/provider/SCPreferencesProvider/index.d.ts.map +1 -0
- package/lib/esm/react-core/src/components/provider/SCRoutingProvider/index.d.ts +39 -0
- package/lib/esm/react-core/src/components/provider/SCRoutingProvider/index.d.ts.map +1 -0
- package/lib/esm/react-core/src/components/provider/SCThemeProvider/index.d.ts +49 -0
- package/lib/esm/react-core/src/components/provider/SCThemeProvider/index.d.ts.map +1 -0
- package/lib/esm/react-core/src/components/provider/SCUserProvider/index.d.ts +38 -0
- package/lib/esm/react-core/src/components/provider/SCUserProvider/index.d.ts.map +1 -0
- package/lib/esm/react-core/src/components/router/index.d.ts +34 -0
- package/lib/esm/react-core/src/components/router/index.d.ts.map +1 -0
- package/lib/esm/react-core/src/constants/Actions.d.ts +2 -0
- package/lib/esm/react-core/src/constants/Actions.d.ts.map +1 -0
- package/lib/esm/react-core/src/constants/ContextProviders.d.ts +6 -0
- package/lib/esm/react-core/src/constants/ContextProviders.d.ts.map +1 -0
- package/lib/esm/react-core/src/constants/Device.d.ts +6 -0
- package/lib/esm/react-core/src/constants/Device.d.ts.map +1 -0
- package/lib/esm/react-core/src/constants/Errors.d.ts +5 -0
- package/lib/esm/react-core/src/constants/Errors.d.ts.map +1 -0
- package/lib/esm/react-core/src/constants/Features.d.ts +41 -0
- package/lib/esm/react-core/src/constants/Features.d.ts.map +1 -0
- package/lib/esm/react-core/src/constants/Locale.d.ts +8 -0
- package/lib/esm/react-core/src/constants/Locale.d.ts.map +1 -0
- package/lib/esm/react-core/src/constants/Notification.d.ts +55 -0
- package/lib/esm/react-core/src/constants/Notification.d.ts.map +1 -0
- package/lib/esm/react-core/src/constants/Notifications.d.ts +11 -0
- package/lib/esm/react-core/src/constants/Notifications.d.ts.map +1 -0
- package/lib/esm/react-core/src/constants/Routes.d.ts +29 -0
- package/lib/esm/react-core/src/constants/Routes.d.ts.map +1 -0
- package/lib/esm/react-core/src/constants/Session.d.ts +10 -0
- package/lib/esm/react-core/src/constants/Session.d.ts.map +1 -0
- package/lib/esm/react-core/src/constants/Theme.d.ts +2 -0
- package/lib/esm/react-core/src/constants/Theme.d.ts.map +1 -0
- package/lib/esm/react-core/src/hooks/useSCAuth.d.ts +56 -0
- package/lib/esm/react-core/src/hooks/useSCAuth.d.ts.map +1 -0
- package/lib/esm/react-core/src/hooks/useSCCachingManager.d.ts +19 -0
- package/lib/esm/react-core/src/hooks/useSCCachingManager.d.ts.map +1 -0
- package/lib/esm/react-core/src/hooks/useSCConnectionsManager.d.ts +40 -0
- package/lib/esm/react-core/src/hooks/useSCConnectionsManager.d.ts.map +1 -0
- package/lib/esm/react-core/src/hooks/useSCFetchCategories.d.ts +17 -0
- package/lib/esm/react-core/src/hooks/useSCFetchCategories.d.ts.map +1 -0
- package/lib/esm/react-core/src/hooks/useSCFetchCategory.d.ts +19 -0
- package/lib/esm/react-core/src/hooks/useSCFetchCategory.d.ts.map +1 -0
- package/lib/esm/react-core/src/hooks/useSCFetchCommentObject.d.ts +19 -0
- package/lib/esm/react-core/src/hooks/useSCFetchCommentObject.d.ts.map +1 -0
- package/lib/esm/react-core/src/hooks/useSCFetchCommentObjects.d.ts +54 -0
- package/lib/esm/react-core/src/hooks/useSCFetchCommentObjects.d.ts.map +1 -0
- package/lib/esm/react-core/src/hooks/useSCFetchCustomAdv.d.ts +19 -0
- package/lib/esm/react-core/src/hooks/useSCFetchCustomAdv.d.ts.map +1 -0
- package/lib/esm/react-core/src/hooks/useSCFetchFeedObject.d.ts +21 -0
- package/lib/esm/react-core/src/hooks/useSCFetchFeedObject.d.ts.map +1 -0
- package/lib/esm/react-core/src/hooks/useSCFetchIncubator.d.ts +19 -0
- package/lib/esm/react-core/src/hooks/useSCFetchIncubator.d.ts.map +1 -0
- package/lib/esm/react-core/src/hooks/useSCFetchTag.d.ts +19 -0
- package/lib/esm/react-core/src/hooks/useSCFetchTag.d.ts.map +1 -0
- package/lib/esm/react-core/src/hooks/useSCFetchUser.d.ts +19 -0
- package/lib/esm/react-core/src/hooks/useSCFetchUser.d.ts.map +1 -0
- package/lib/esm/react-core/src/hooks/useSCFollowedCategoriesManager.d.ts +37 -0
- package/lib/esm/react-core/src/hooks/useSCFollowedCategoriesManager.d.ts.map +1 -0
- package/lib/esm/react-core/src/hooks/useSCFollowersManager.d.ts +37 -0
- package/lib/esm/react-core/src/hooks/useSCFollowersManager.d.ts.map +1 -0
- package/lib/esm/react-core/src/hooks/useSCMediaClick.d.ts +4 -0
- package/lib/esm/react-core/src/hooks/useSCMediaClick.d.ts.map +1 -0
- package/lib/esm/react-core/src/hooks/useSCSubscribedIncubatorsManager.d.ts +27 -0
- package/lib/esm/react-core/src/hooks/useSCSubscribedIncubatorsManager.d.ts.map +1 -0
- package/lib/esm/react-core/src/hooks/useSCWebPushMessaging.d.ts +9 -0
- package/lib/esm/react-core/src/hooks/useSCWebPushMessaging.d.ts.map +1 -0
- package/lib/esm/react-core/src/hooks/useSCWebSocket.d.ts +12 -0
- package/lib/esm/react-core/src/hooks/useSCWebSocket.d.ts.map +1 -0
- package/lib/esm/react-core/src/index.d.ts +77 -0
- package/lib/esm/react-core/src/index.d.ts.map +1 -0
- package/lib/esm/react-core/src/types/context.d.ts +428 -0
- package/lib/esm/react-core/src/types/context.d.ts.map +1 -0
- package/lib/esm/react-core/src/types/index.d.ts +3 -0
- package/lib/esm/react-core/src/types/index.d.ts.map +1 -0
- package/lib/esm/react-core/src/utils/errors.d.ts +98 -0
- package/lib/esm/react-core/src/utils/errors.d.ts.map +1 -0
- package/lib/esm/react-core/src/utils/locale.d.ts +10 -0
- package/lib/esm/react-core/src/utils/locale.d.ts.map +1 -0
- package/lib/esm/react-core/src/utils/logger.d.ts +11 -0
- package/lib/esm/react-core/src/utils/logger.d.ts.map +1 -0
- package/lib/esm/react-core/src/utils/object.d.ts +13 -0
- package/lib/esm/react-core/src/utils/object.d.ts.map +1 -0
- package/lib/esm/react-core/src/utils/session.d.ts +6 -0
- package/lib/esm/react-core/src/utils/session.d.ts.map +1 -0
- package/lib/esm/react-core/src/utils/string.d.ts +21 -0
- package/lib/esm/react-core/src/utils/string.d.ts.map +1 -0
- package/lib/esm/react-core/src/utils/url.d.ts +22 -0
- package/lib/esm/react-core/src/utils/url.d.ts.map +1 -0
- package/lib/esm/react-core/src/utils/user.d.ts +41 -0
- package/lib/esm/react-core/src/utils/user.d.ts.map +1 -0
- package/lib/esm/react-core/src/utils/validator.d.ts +239 -0
- package/lib/esm/react-core/src/utils/validator.d.ts.map +1 -0
- package/lib/esm/react-core/src/utils/webPushMessaging.d.ts +14 -0
- package/lib/esm/react-core/src/utils/webPushMessaging.d.ts.map +1 -0
- package/lib/esm/react-core/src/utils/websocket.d.ts +177 -0
- package/lib/esm/react-core/src/utils/websocket.d.ts.map +1 -0
- package/lib/esm/react-i18n/src/index.d.ts +815 -0
- package/lib/esm/react-i18n/src/index.d.ts.map +1 -0
- package/lib/esm/scss/styles.scss +1 -0
- package/lib/esm/themes/theme.js +165 -0
- package/lib/esm/types/context.js +3 -0
- package/lib/esm/types/index.js +22 -0
- package/lib/esm/types/src/index.d.ts +9 -0
- package/lib/esm/types/src/index.d.ts.map +1 -0
- package/lib/esm/types/src/types/auth.d.ts +26 -0
- package/lib/esm/types/src/types/auth.d.ts.map +1 -0
- package/lib/esm/types/src/types/broadcastMessage.d.ts +73 -0
- package/lib/esm/types/src/types/broadcastMessage.d.ts.map +1 -0
- package/lib/esm/types/src/types/category.d.ts +100 -0
- package/lib/esm/types/src/types/category.d.ts.map +1 -0
- package/lib/esm/types/src/types/comment.d.ts +97 -0
- package/lib/esm/types/src/types/comment.d.ts.map +1 -0
- package/lib/esm/types/src/types/customAdv.d.ts +53 -0
- package/lib/esm/types/src/types/customAdv.d.ts.map +1 -0
- package/lib/esm/types/src/types/customNotification.d.ts +28 -0
- package/lib/esm/types/src/types/customNotification.d.ts.map +1 -0
- package/lib/esm/types/src/types/embed.d.ts +33 -0
- package/lib/esm/types/src/types/embed.d.ts.map +1 -0
- package/lib/esm/types/src/types/feed.d.ts +208 -0
- package/lib/esm/types/src/types/feed.d.ts.map +1 -0
- package/lib/esm/types/src/types/incubator.d.ts +53 -0
- package/lib/esm/types/src/types/incubator.d.ts.map +1 -0
- package/lib/esm/types/src/types/index.d.ts +22 -0
- package/lib/esm/types/src/types/index.d.ts.map +1 -0
- package/lib/esm/types/src/types/location.d.ts +61 -0
- package/lib/esm/types/src/types/location.d.ts.map +1 -0
- package/lib/esm/types/src/types/media.d.ts +52 -0
- package/lib/esm/types/src/types/media.d.ts.map +1 -0
- package/lib/esm/types/src/types/notification.d.ts +416 -0
- package/lib/esm/types/src/types/notification.d.ts.map +1 -0
- package/lib/esm/types/src/types/poll.d.ts +77 -0
- package/lib/esm/types/src/types/poll.d.ts.map +1 -0
- package/lib/esm/types/src/types/privateMessage.d.ts +109 -0
- package/lib/esm/types/src/types/privateMessage.d.ts.map +1 -0
- package/lib/esm/types/src/types/prize.d.ts +48 -0
- package/lib/esm/types/src/types/prize.d.ts.map +1 -0
- package/lib/esm/types/src/types/tag.d.ts +47 -0
- package/lib/esm/types/src/types/tag.d.ts.map +1 -0
- package/lib/esm/types/src/types/user.d.ts +227 -0
- package/lib/esm/types/src/types/user.d.ts.map +1 -0
- package/lib/esm/utils/errors.js +196 -0
- package/lib/esm/utils/locale.js +56 -0
- package/lib/esm/utils/logger.js +32 -0
- package/lib/esm/utils/object.js +44 -0
- package/lib/esm/utils/session.js +17 -0
- package/lib/esm/utils/src/index.d.ts +7 -0
- package/lib/esm/utils/src/index.d.ts.map +1 -0
- package/lib/esm/utils/src/utils/string.d.ts +21 -0
- package/lib/esm/utils/src/utils/string.d.ts.map +1 -0
- package/lib/esm/utils/src/utils/url.d.ts +22 -0
- package/lib/esm/utils/src/utils/url.d.ts.map +1 -0
- package/lib/esm/utils/string.js +57 -0
- package/lib/esm/utils/url.js +70 -0
- package/lib/esm/utils/user.js +83 -0
- package/lib/esm/utils/validator.js +771 -0
- package/lib/esm/utils/webPushMessaging.js +110 -0
- package/lib/esm/utils/websocket.js +307 -0
- package/lib/umd/react-core.js +2 -0
- package/lib/umd/react-core.js.LICENSE.txt +1 -0
- package/package.json +128 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.urlB64ToUint8Array = exports.loadVersionBrowser = void 0;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Take the application server's public key, which is Base64 URL-safe encoded,
|
|
8
|
+
* and convert it to a UInt8Array, because this is the expected input of the subscribe()
|
|
9
|
+
*/
|
|
10
|
+
const urlB64ToUint8Array = base64String => {
|
|
11
|
+
const padding = '='.repeat((4 - base64String.length % 4) % 4);
|
|
12
|
+
const base64 = (base64String + padding).replace(/-/g, '+').replace(/_/g, '/');
|
|
13
|
+
const rawData = window.atob(base64);
|
|
14
|
+
const outputArray = new Uint8Array(rawData.length);
|
|
15
|
+
|
|
16
|
+
for (let i = 0; i < rawData.length; ++i) {
|
|
17
|
+
outputArray[i] = rawData.charCodeAt(i);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return outputArray;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Get browser version to track on backend
|
|
24
|
+
* @return {{name: string, version: null}|{name: string, version: string}|{name: *, version: *}|{name: string, version}}
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
exports.urlB64ToUint8Array = urlB64ToUint8Array;
|
|
29
|
+
|
|
30
|
+
const loadVersionBrowser = () => {
|
|
31
|
+
if ('userAgentData' in navigator) {
|
|
32
|
+
// navigator.userAgentData is not available in
|
|
33
|
+
// Firefox and Safari
|
|
34
|
+
const uaData = navigator['userAgentData']; // Outputs of navigator.userAgentData.brands[n].brand are e.g.
|
|
35
|
+
// Chrome: 'Google Chrome'
|
|
36
|
+
// Edge: 'Microsoft Edge'
|
|
37
|
+
// Opera: 'Opera'
|
|
38
|
+
|
|
39
|
+
let browsername;
|
|
40
|
+
let browserversion;
|
|
41
|
+
let chromeVersion = null;
|
|
42
|
+
|
|
43
|
+
for (let i = 0; i < uaData['brands'].length; i++) {
|
|
44
|
+
const brand = uaData['brands'][i].brand;
|
|
45
|
+
browserversion = uaData['brands'][i].version;
|
|
46
|
+
|
|
47
|
+
if (brand.match(/opera|chrome|edge|safari|firefox|msie|trident/i) !== null) {
|
|
48
|
+
// If we have a chrome match, save the match, but try to find another match
|
|
49
|
+
// E.g. Edge can also produce a false Chrome match.
|
|
50
|
+
if (brand.match(/chrome/i) !== null) {
|
|
51
|
+
chromeVersion = browserversion;
|
|
52
|
+
} // If this is not a chrome match return immediately
|
|
53
|
+
else {
|
|
54
|
+
browsername = brand.substr(brand.indexOf(' ') + 1);
|
|
55
|
+
return {
|
|
56
|
+
name: browsername,
|
|
57
|
+
version: browserversion
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
} // No non-Chrome match was found. If we have a chrome match, return it.
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
if (chromeVersion !== null) {
|
|
65
|
+
return {
|
|
66
|
+
name: 'chrome',
|
|
67
|
+
version: chromeVersion
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
} // If no userAgentData is not present, or if no match via userAgentData was found,
|
|
71
|
+
// try to extract the browser name and version from userAgent
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
const userAgent = navigator.userAgent;
|
|
75
|
+
let ua = userAgent;
|
|
76
|
+
let tem;
|
|
77
|
+
let M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
|
|
78
|
+
|
|
79
|
+
if (/trident/i.test(M[1])) {
|
|
80
|
+
tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
|
|
81
|
+
return {
|
|
82
|
+
name: 'IE',
|
|
83
|
+
version: tem[1] || ''
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (M[1] === 'Chrome') {
|
|
88
|
+
tem = ua.match(/\bOPR\/(\d+)/);
|
|
89
|
+
|
|
90
|
+
if (tem != null) {
|
|
91
|
+
return {
|
|
92
|
+
name: 'Opera',
|
|
93
|
+
version: tem[1]
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?']; // eslint-disable-next-line @typescript-eslint/prefer-regexp-exec
|
|
99
|
+
|
|
100
|
+
if ((tem = ua.match(/version\/(\d+)/i)) != null) {
|
|
101
|
+
M.splice(1, 1, tem[1]);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
name: M[0],
|
|
106
|
+
version: M[1]
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
exports.loadVersionBrowser = loadVersionBrowser;
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WSClientPropTypes interface
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* WSClient: manage socket connection
|
|
12
|
+
* @param options
|
|
13
|
+
* @constructor
|
|
14
|
+
*/
|
|
15
|
+
class WSClient {
|
|
16
|
+
/**
|
|
17
|
+
* Constructor
|
|
18
|
+
* @param cfg
|
|
19
|
+
*/
|
|
20
|
+
constructor(cfg) {
|
|
21
|
+
this._attempts = 1;
|
|
22
|
+
this._heartbeatInterval = null;
|
|
23
|
+
this._missedHeartbeats = 0;
|
|
24
|
+
|
|
25
|
+
if (!this.isValidOptions(cfg)) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
this._cfg = Object.assign({}, {
|
|
30
|
+
heartbeatMsg: null,
|
|
31
|
+
debug: false,
|
|
32
|
+
mustReconnect: true
|
|
33
|
+
}, cfg);
|
|
34
|
+
this.connect();
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get instance
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
static getInstance(cfg) {
|
|
42
|
+
this._instance = this._instance || new WSClient(cfg);
|
|
43
|
+
return this._instance;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Connect
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
connect() {
|
|
51
|
+
try {
|
|
52
|
+
if (this._ws && (this.isConnecting() || this.isConnected())) {
|
|
53
|
+
// There is already a connection
|
|
54
|
+
this._cfg.debug && console.info('Websocket is connecting or already connected.');
|
|
55
|
+
return;
|
|
56
|
+
} // Callback 'connecting' if exist
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
typeof this._cfg.connecting === 'function' && this._cfg.connecting();
|
|
60
|
+
this._cfg.debug && console.info(`Connecting to ${this._cfg.uri} ...`); // Open the connection
|
|
61
|
+
|
|
62
|
+
this._ws = new WebSocket(this._cfg.uri, this._cfg.protocols);
|
|
63
|
+
this._ws.onopen = this.onOpen.bind(this);
|
|
64
|
+
this._ws.onmessage = this.onMessage.bind(this);
|
|
65
|
+
this._ws.onerror = this.onError.bind(this);
|
|
66
|
+
this._ws.onclose = this.onClose.bind(this);
|
|
67
|
+
this._timer = null;
|
|
68
|
+
} catch (err) {
|
|
69
|
+
console.error(err);
|
|
70
|
+
this.tryToReconnect();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Validate options
|
|
75
|
+
* @param cfg
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
isValidOptions(cfg) {
|
|
80
|
+
let _error = false;
|
|
81
|
+
|
|
82
|
+
if (!cfg) {
|
|
83
|
+
console.error('Invalid WSClient options.');
|
|
84
|
+
return _error;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (!cfg.uri) {
|
|
88
|
+
console.error('Invalid WSClient Uri options.');
|
|
89
|
+
_error = true;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (cfg && cfg.connecting && !(typeof cfg.connecting === 'function')) {
|
|
93
|
+
console.error('Invalid WSClient connecting options.');
|
|
94
|
+
_error = true;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (cfg && cfg.connected && !(typeof cfg.connected === 'function')) {
|
|
98
|
+
console.error('Invalid WSClient connected options.');
|
|
99
|
+
_error = true;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (cfg && cfg.receiveMessage && !(typeof cfg.receiveMessage === 'function')) {
|
|
103
|
+
console.error('Invalid WSClient receiveMessage options.');
|
|
104
|
+
_error = true;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (cfg && cfg.disconnected && !(typeof cfg.disconnected === 'function')) {
|
|
108
|
+
console.error('Invalid WSClient connecting options.');
|
|
109
|
+
_error = true;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (cfg && cfg.heartbeatMsg && !(typeof cfg.heartbeatMsg === 'string')) {
|
|
113
|
+
console.error('Invalid WSClient heartbeatMsg options.');
|
|
114
|
+
_error = true;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (cfg && cfg.debug && !(typeof cfg.debug === 'boolean')) {
|
|
118
|
+
console.error('Invalid WSClient debug options.');
|
|
119
|
+
_error = true;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return !_error;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Try to reconnect if previous connection failed
|
|
126
|
+
* Generate an interval, after that try to reconnect
|
|
127
|
+
*/
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
tryToReconnect() {
|
|
131
|
+
if (this._cfg.mustReconnect && !this._timer) {
|
|
132
|
+
this._cfg.debug && console.info(`Reconnecting...`);
|
|
133
|
+
let interval = this.generateInteval(this._attempts);
|
|
134
|
+
this._timer = setTimeout(this.reconnect.bind(this), interval);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Reestablish the connection
|
|
139
|
+
* Increase the number of attempts
|
|
140
|
+
*/
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
reconnect() {
|
|
144
|
+
this._attempts++;
|
|
145
|
+
this.connect();
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Send heartbeat every 5 seconds
|
|
149
|
+
* If missing more than 3 heartbeats close connection
|
|
150
|
+
*/
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
sendHeartbeat() {
|
|
154
|
+
try {
|
|
155
|
+
this._missedHeartbeats++;
|
|
156
|
+
if (this._missedHeartbeats > 3) throw new Error('Too many missed heartbeats.');
|
|
157
|
+
|
|
158
|
+
this._ws.send(this._cfg.heartbeatMsg);
|
|
159
|
+
} catch (e) {
|
|
160
|
+
clearInterval(this._heartbeatInterval);
|
|
161
|
+
this._heartbeatInterval = null;
|
|
162
|
+
this._cfg.debug && console.warn(`Closing connection. Reason: ${e.message}`);
|
|
163
|
+
|
|
164
|
+
if (!this.isClosing() && !this.isClosed()) {
|
|
165
|
+
this.close();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Established the new connection
|
|
171
|
+
* Reset this._attempts counter
|
|
172
|
+
*/
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
onOpen() {
|
|
176
|
+
this._cfg.debug && console.info('Connected!');
|
|
177
|
+
this._attempts = 1;
|
|
178
|
+
|
|
179
|
+
if (this._cfg.heartbeatMsg && this._heartbeatInterval === null) {
|
|
180
|
+
this._missedHeartbeats = 0;
|
|
181
|
+
this._heartbeatInterval = setInterval(this.sendHeartbeat.bind(this), 5000);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
typeof this._cfg.connected === 'function' && this._cfg.connected();
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Connection closed. Try to reconnect.
|
|
188
|
+
* @param evt
|
|
189
|
+
*/
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
onClose(evt) {
|
|
193
|
+
this._cfg.debug && console.info('Connection closed!');
|
|
194
|
+
typeof this._cfg.disconnected === 'function' && this._cfg.disconnected(evt);
|
|
195
|
+
this.tryToReconnect();
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* An error occured
|
|
199
|
+
* @param evt
|
|
200
|
+
*/
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
onError(evt) {
|
|
204
|
+
this._cfg.debug && console.error('Websocket connection is broken!');
|
|
205
|
+
this._cfg.debug && console.error(evt);
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* A message has arrived.
|
|
209
|
+
* If it is the heartbeat -> reset this._missedHeartbeats
|
|
210
|
+
* If it is data pass data to the callback
|
|
211
|
+
* @param evt
|
|
212
|
+
*/
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
onMessage(evt) {
|
|
216
|
+
if (this._cfg.heartbeatMsg && evt.data === this._cfg.heartbeatMsg) {
|
|
217
|
+
// reset the counter for missed heartbeats
|
|
218
|
+
this._missedHeartbeats = 0;
|
|
219
|
+
} else if (typeof this._cfg.receiveMessage === 'function') {
|
|
220
|
+
return this._cfg.receiveMessage(evt.data);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Generate an interval that is randomly between 0 and 2^k - 1, where k is
|
|
225
|
+
* the number of connection attmpts, with a maximum interval of 30 seconds,
|
|
226
|
+
* so it starts at 0 - 1 seconds and maxes out at 0 - 30 seconds
|
|
227
|
+
*/
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
generateInteval(k) {
|
|
231
|
+
let maxInterval = (Math.pow(2, k) - 1) * 1000; // If the generated interval is more than 30 seconds, truncate it down to 30 seconds.
|
|
232
|
+
|
|
233
|
+
if (maxInterval > 30 * 1000) {
|
|
234
|
+
maxInterval = 30 * 1000;
|
|
235
|
+
} // generate the interval to a random number between 0 and the maxInterval determined from above
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
return Math.random() * maxInterval;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Send message
|
|
242
|
+
* @param message
|
|
243
|
+
*/
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
sendMessage(message) {
|
|
247
|
+
this._ws && this._ws.send(message);
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Get the ws state
|
|
251
|
+
*/
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
getState() {
|
|
255
|
+
return this._ws && this._ws.readyState;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Check if ws is in connecting state
|
|
259
|
+
*/
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
isConnecting() {
|
|
263
|
+
return this._ws && this._ws.readyState === 0;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Check if ws is connected
|
|
267
|
+
*/
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
isConnected() {
|
|
271
|
+
return this._ws && this._ws.readyState === 1;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Check if ws is in closing state
|
|
275
|
+
*/
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
isClosing() {
|
|
279
|
+
return this._ws && this._ws.readyState === 2;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Check if ws is closed
|
|
283
|
+
*/
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
isClosed() {
|
|
287
|
+
return this._ws && this._ws.readyState === 3;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Close the connection
|
|
291
|
+
*/
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
close() {
|
|
295
|
+
clearInterval(this._heartbeatInterval);
|
|
296
|
+
this._cfg.mustReconnect = false;
|
|
297
|
+
|
|
298
|
+
if (!this.isClosing() || !this.isClosed()) {
|
|
299
|
+
this._ws.close();
|
|
300
|
+
|
|
301
|
+
this._cfg.debug && console.error('Websocket closed.');
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
exports.default = WSClient;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
2
|
+
/**
|
|
3
|
+
* List of all Http methods
|
|
4
|
+
*/
|
|
5
|
+
export declare type HttpMethod = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
6
|
+
/**
|
|
7
|
+
* AxiosResponseHeaders interface
|
|
8
|
+
*/
|
|
9
|
+
export declare type AxiosResponseHeaders = Record<string, string> & {
|
|
10
|
+
'set-cookie'?: string[];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* General HttpResponse
|
|
14
|
+
*/
|
|
15
|
+
export interface HttpResponse<T = unknown, D = any> {
|
|
16
|
+
data: T;
|
|
17
|
+
status: number;
|
|
18
|
+
statusText: string;
|
|
19
|
+
headers: AxiosResponseHeaders;
|
|
20
|
+
config: AxiosRequestConfig<D>;
|
|
21
|
+
request?: any;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Interface for the ApiClient
|
|
25
|
+
*/
|
|
26
|
+
export interface ApiClientInterface {
|
|
27
|
+
request<TRequest, TResponse>(config?: any): Promise<HttpResponse<TResponse>>;
|
|
28
|
+
post<TRequest, TResponse>(path: string, object: TRequest, config?: any): Promise<HttpResponse<TResponse>>;
|
|
29
|
+
patch<TRequest, TResponse>(path: string, object: TRequest): Promise<HttpResponse<TResponse>>;
|
|
30
|
+
put<TRequest, TResponse>(path: string, object: TRequest): Promise<HttpResponse<TResponse>>;
|
|
31
|
+
get<TResponse>(path: string): Promise<HttpResponse<TResponse>>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Create an abstraction wrapping of axios
|
|
35
|
+
* Create a sort of interface between axios and the rest of application
|
|
36
|
+
* This makes it easy for instance, to swap axios out for another package,
|
|
37
|
+
* should we choose to do so in the future, without it breaking our app.
|
|
38
|
+
*/
|
|
39
|
+
export declare class ApiClient implements ApiClientInterface {
|
|
40
|
+
static DEFAULT_TIMEOUT: number;
|
|
41
|
+
protected readonly client: AxiosInstance;
|
|
42
|
+
protected createClient(config?: any): AxiosInstance;
|
|
43
|
+
constructor(config?: any);
|
|
44
|
+
/**
|
|
45
|
+
* Get client instance
|
|
46
|
+
*/
|
|
47
|
+
getClientInstance(): AxiosInstance;
|
|
48
|
+
/**
|
|
49
|
+
* Change configuration
|
|
50
|
+
* @param config
|
|
51
|
+
*/
|
|
52
|
+
config(config: any): void;
|
|
53
|
+
/**
|
|
54
|
+
* Set default header
|
|
55
|
+
* @param name
|
|
56
|
+
* @param value
|
|
57
|
+
* @param methods
|
|
58
|
+
*/
|
|
59
|
+
setDefaultHeader: ({ name, value, methods }: {
|
|
60
|
+
name: string;
|
|
61
|
+
value: string;
|
|
62
|
+
methods?: string[];
|
|
63
|
+
}) => void;
|
|
64
|
+
/**
|
|
65
|
+
* setSupportWithCredentials
|
|
66
|
+
* Disable/enable withCredentials
|
|
67
|
+
* Bypass cookie if disabled
|
|
68
|
+
* @param enable
|
|
69
|
+
*/
|
|
70
|
+
setSupportWithCredentials(enable: boolean): void;
|
|
71
|
+
/**
|
|
72
|
+
* setBasePortal
|
|
73
|
+
* Set base path of all http requests
|
|
74
|
+
* @param portal
|
|
75
|
+
*/
|
|
76
|
+
setBasePortal(baseUrl: string): void;
|
|
77
|
+
/**
|
|
78
|
+
* setAuthorizeToken
|
|
79
|
+
* Set authorization header for all http requests
|
|
80
|
+
* @param token
|
|
81
|
+
*/
|
|
82
|
+
setAuthorizeToken(token: string): void;
|
|
83
|
+
/**
|
|
84
|
+
* request wrapper
|
|
85
|
+
* @param config
|
|
86
|
+
*/
|
|
87
|
+
request<TRequest, TResponse>(config: any): Promise<HttpResponse<TResponse>>;
|
|
88
|
+
/**
|
|
89
|
+
* get wrapper
|
|
90
|
+
* @param path
|
|
91
|
+
*/
|
|
92
|
+
get<TResponse>(path: string): Promise<HttpResponse<TResponse>>;
|
|
93
|
+
/**
|
|
94
|
+
* post wrapper
|
|
95
|
+
* @param path
|
|
96
|
+
* @param payload
|
|
97
|
+
* @param config
|
|
98
|
+
*/
|
|
99
|
+
post<TRequest, TResponse>(path: string, payload: TRequest, config?: any): Promise<HttpResponse<TResponse>>;
|
|
100
|
+
/**
|
|
101
|
+
* patch wrapper
|
|
102
|
+
* @param path
|
|
103
|
+
* @param object
|
|
104
|
+
*/
|
|
105
|
+
patch<TRequest, TResponse>(path: string, payload: TRequest): Promise<HttpResponse<TResponse>>;
|
|
106
|
+
/**
|
|
107
|
+
* put wrapper
|
|
108
|
+
* @param path
|
|
109
|
+
* @param payload
|
|
110
|
+
*/
|
|
111
|
+
put<TRequest, TResponse>(path: string, payload: TRequest): Promise<HttpResponse<TResponse>>;
|
|
112
|
+
}
|
|
113
|
+
declare const client: ApiClient;
|
|
114
|
+
export default client;
|
|
115
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../api-services/src/client/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HttpMethod } from '../client';
|
|
2
|
+
export interface EndpointType {
|
|
3
|
+
url: (params?: object) => string;
|
|
4
|
+
method: HttpMethod;
|
|
5
|
+
}
|
|
6
|
+
declare const Endpoints: {
|
|
7
|
+
[key: string]: EndpointType;
|
|
8
|
+
};
|
|
9
|
+
export default Endpoints;
|
|
10
|
+
//# sourceMappingURL=Endpoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Endpoints.d.ts","sourceRoot":"","sources":["../../../../../../api-services/src/constants/Endpoints.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;AAErC,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IACjC,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,QAAA,MAAM,SAAS,EAAE;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAA;CAglB5C,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Axios client wrapper
|
|
3
|
+
*/
|
|
4
|
+
import http, { HttpResponse, HttpMethod } from './client';
|
|
5
|
+
/**
|
|
6
|
+
* Endpoint component
|
|
7
|
+
*/
|
|
8
|
+
import Endpoints, { EndpointType } from './constants/Endpoints';
|
|
9
|
+
/**
|
|
10
|
+
* Utils
|
|
11
|
+
*/
|
|
12
|
+
import { formatHttpError } from './utils/http';
|
|
13
|
+
/**
|
|
14
|
+
* Services
|
|
15
|
+
*/
|
|
16
|
+
import PreferenceService, { PreferenceApiClient, PreferenceApiClientInterface } from './services/preference';
|
|
17
|
+
import UserService, { UserApiClient, UserApiClientInterface } from './services/user';
|
|
18
|
+
import FeatureService, { FeatureApiClient, FeatureApiClientInterface } from './services/feature';
|
|
19
|
+
import CategoryService, { CategoryApiClient, CategoryApiClientInterface } from './services/category';
|
|
20
|
+
/**
|
|
21
|
+
* Export all
|
|
22
|
+
*/
|
|
23
|
+
export { http, HttpResponse, HttpMethod, formatHttpError, Endpoints, EndpointType, PreferenceService, PreferenceApiClient, PreferenceApiClientInterface, UserService, UserApiClient, UserApiClientInterface, FeatureService, FeatureApiClient, FeatureApiClientInterface, CategoryService, CategoryApiClient, CategoryApiClientInterface };
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../api-services/src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,IAAI,EAAE,EAAC,YAAY,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AAExD;;GAEG;AACH,OAAO,SAAS,EAAE,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAE9D;;GAEG;AACH,OAAO,EAAC,eAAe,EAAC,MAAM,cAAc,CAAC;AAG7C;;GAEG;AACH,OAAO,iBAAiB,EAAE,EAAC,mBAAmB,EAAE,4BAA4B,EAAC,MAAM,uBAAuB,CAAC;AAC3G,OAAO,WAAW,EAAE,EAAC,aAAa,EAAE,sBAAsB,EAAC,MAAM,iBAAiB,CAAC;AACnF,OAAO,cAAc,EAAE,EAAC,gBAAgB,EAAE,yBAAyB,EAAC,MAAM,oBAAoB,CAAC;AAC/F,OAAO,eAAe,EAAE,EAAC,iBAAiB,EAAE,0BAA0B,EAAC,MAAM,qBAAqB,CAAC;AAEnG;;GAEG;AACH,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,eAAe,EACf,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,4BAA4B,EAC5B,WAAW,EACX,aAAa,EACb,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EACzB,eAAe,EACf,iBAAiB,EACjB,0BAA0B,EAC3B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface CategoryApiClientInterface {
|
|
2
|
+
getAllCategories(): Promise<any>;
|
|
3
|
+
getSpecificCategory(id: number): Promise<any>;
|
|
4
|
+
}
|
|
5
|
+
export declare class CategoryApiClient {
|
|
6
|
+
static getAllCategories(): Promise<any>;
|
|
7
|
+
static getSpecificCategory(id: number): Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export default class CategoryService {
|
|
10
|
+
static getAllCategories(): Promise<any>;
|
|
11
|
+
static getSpecificCategory(id: number): Promise<any>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../api-services/src/services/category/index.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,0BAA0B;IACzC,gBAAgB,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC;IACjC,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CAC/C;AAED,qBAAa,iBAAiB;IAC5B,MAAM,CAAC,gBAAgB,IAAI,OAAO,CAAC,GAAG,CAAC;IAmBvC,MAAM,CAAC,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAkBrD;AAED,MAAM,CAAC,OAAO,OAAO,eAAe;WACrB,gBAAgB,IAAI,OAAO,CAAC,GAAG,CAAC;WAIhC,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAG3D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface FeatureApiClientInterface {
|
|
2
|
+
getAllFeatures(): Promise<any>;
|
|
3
|
+
}
|
|
4
|
+
export declare class FeatureApiClient {
|
|
5
|
+
static getAllFeatures(): Promise<any>;
|
|
6
|
+
}
|
|
7
|
+
export default class FeatureService {
|
|
8
|
+
static getAllFeatures(): Promise<any>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../api-services/src/services/feature/index.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,yBAAyB;IACxC,cAAc,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC;CAChC;AAED,qBAAa,gBAAgB;IAC3B,MAAM,CAAC,cAAc,IAAI,OAAO,CAAC,GAAG,CAAC;CAmBtC;AAED,MAAM,CAAC,OAAO,OAAO,cAAc;WACpB,cAAc,IAAI,OAAO,CAAC,GAAG,CAAC;CAG5C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface PreferenceApiClientInterface {
|
|
2
|
+
getAllPreferences(): Promise<any>;
|
|
3
|
+
searchPreferences(search?: string, section?: string, keys?: string, ordering?: string): Promise<any>;
|
|
4
|
+
getSpecificPreference(id: number): Promise<any>;
|
|
5
|
+
}
|
|
6
|
+
export declare class PreferenceApiClient {
|
|
7
|
+
static getAllPreferences(): Promise<any>;
|
|
8
|
+
static searchPreferences(search?: string, section?: string, keys?: string, ordering?: string): Promise<any>;
|
|
9
|
+
static getSpecificPreference(id: number): Promise<any>;
|
|
10
|
+
}
|
|
11
|
+
export default class PreferenceService {
|
|
12
|
+
static getAllPreferences(): Promise<any>;
|
|
13
|
+
static searchPreferences(search?: string, section?: string, keys?: string, ordering?: string): Promise<any>;
|
|
14
|
+
static getSpecificPreference(id: number): Promise<any>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../api-services/src/services/preference/index.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,4BAA4B;IAC3C,iBAAiB,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC;IAClC,iBAAiB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACrG,qBAAqB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CACjD;AAED,qBAAa,mBAAmB;IAC9B,MAAM,CAAC,iBAAiB,IAAI,OAAO,CAAC,GAAG,CAAC;IAoBxC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IA0B3G,MAAM,CAAC,qBAAqB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAkBvD;AAED,MAAM,CAAC,OAAO,OAAO,iBAAiB;WACvB,iBAAiB,IAAI,OAAO,CAAC,GAAG,CAAC;WAIjC,iBAAiB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;WAIpG,qBAAqB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAG7D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface UserApiClientInterface {
|
|
2
|
+
getAllUsers(): Promise<any>;
|
|
3
|
+
getSpecificUser(id: number): Promise<any>;
|
|
4
|
+
getCurrentUser(): Promise<any>;
|
|
5
|
+
}
|
|
6
|
+
export declare class UserApiClient {
|
|
7
|
+
static getAllUsers(): Promise<any>;
|
|
8
|
+
static getSpecificUser(id: number): Promise<any>;
|
|
9
|
+
static getCurrentUser(): Promise<any>;
|
|
10
|
+
}
|
|
11
|
+
export default class UserService {
|
|
12
|
+
static getAllUsers(): Promise<any>;
|
|
13
|
+
static getSpecificUser(id: number): Promise<any>;
|
|
14
|
+
static getCurrentUser(): Promise<any>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../api-services/src/services/user/index.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,sBAAsB;IACrC,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5B,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1C,cAAc,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC;CAChC;AAED,qBAAa,aAAa;IACxB,MAAM,CAAC,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC;IAmBlC,MAAM,CAAC,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAmBhD,MAAM,CAAC,cAAc,IAAI,OAAO,CAAC,GAAG,CAAC;CAkBtC;AAED,MAAM,CAAC,OAAO,OAAO,WAAW;WACjB,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC;WAI3B,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;WAIzC,cAAc,IAAI,OAAO,CAAC,GAAG,CAAC;CAG5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../../../../api-services/src/utils/http.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAAC,OAAO,CAAC,EAAE,GAAG,CAAC;IAAC,OAAO,CAAC,EAAE,GAAG,CAAA;CAAC,GAAG,IAAI,CAUxE;AAmBD,wBAAgB,eAAe,CAAC,KAAK,KAAA,OAQpC"}
|