@selfcommunity/react-core 0.1.7 → 0.1.8-alpha.2
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/{types → cjs}/components/provider/SCAlertMessagesProvider/index.d.ts +0 -0
- package/lib/{types → cjs}/components/provider/SCAlertMessagesProvider/index.d.ts.map +0 -0
- package/lib/cjs/components/provider/SCAlertMessagesProvider/index.js +37 -35
- package/lib/cjs/components/provider/SCAlertMessagesProvider/index.js.map +1 -0
- package/lib/{types → cjs}/components/provider/SCContextProvider/index.d.ts +0 -0
- package/lib/{types → cjs}/components/provider/SCContextProvider/index.d.ts.map +0 -0
- package/lib/cjs/components/provider/SCContextProvider/index.js +74 -81
- package/lib/cjs/components/provider/SCContextProvider/index.js.map +1 -0
- package/lib/{types → cjs}/components/provider/SCLocaleProvider/index.d.ts +0 -0
- package/lib/{types → cjs}/components/provider/SCLocaleProvider/index.d.ts.map +0 -0
- package/lib/cjs/components/provider/SCLocaleProvider/index.js +86 -121
- package/lib/cjs/components/provider/SCLocaleProvider/index.js.map +1 -0
- package/lib/{types → cjs}/components/provider/SCNotificationProvider/index.d.ts +0 -0
- package/lib/{types → cjs}/components/provider/SCNotificationProvider/index.d.ts.map +0 -0
- package/lib/cjs/components/provider/SCNotificationProvider/index.js +41 -41
- package/lib/cjs/components/provider/SCNotificationProvider/index.js.map +1 -0
- package/lib/{types → cjs}/components/provider/SCPreferencesProvider/index.d.ts +0 -0
- package/lib/{types → cjs}/components/provider/SCPreferencesProvider/index.d.ts.map +0 -0
- package/lib/cjs/components/provider/SCPreferencesProvider/index.js +61 -62
- package/lib/cjs/components/provider/SCPreferencesProvider/index.js.map +1 -0
- package/lib/{types → cjs}/components/provider/SCRoutingProvider/index.d.ts +0 -0
- package/lib/{types → cjs}/components/provider/SCRoutingProvider/index.d.ts.map +1 -1
- package/lib/cjs/components/provider/SCRoutingProvider/index.js +104 -111
- package/lib/cjs/components/provider/SCRoutingProvider/index.js.map +1 -0
- package/lib/{types → cjs}/components/provider/SCThemeProvider/index.d.ts +0 -0
- package/lib/{types → cjs}/components/provider/SCThemeProvider/index.d.ts.map +0 -0
- package/lib/cjs/components/provider/SCThemeProvider/index.js +66 -79
- package/lib/cjs/components/provider/SCThemeProvider/index.js.map +1 -0
- package/lib/{types → cjs}/components/provider/SCUserProvider/index.d.ts +0 -0
- package/lib/{types → cjs}/components/provider/SCUserProvider/index.d.ts.map +0 -0
- package/lib/cjs/components/provider/SCUserProvider/index.js +215 -270
- package/lib/cjs/components/provider/SCUserProvider/index.js.map +1 -0
- package/lib/{types → cjs}/components/router/index.d.ts +0 -0
- package/lib/{types → cjs}/components/router/index.d.ts.map +0 -0
- package/lib/cjs/components/router/index.js +48 -49
- package/lib/cjs/components/router/index.js.map +1 -0
- package/lib/{types → cjs}/constants/Actions.d.ts +0 -0
- package/lib/{types → cjs}/constants/Actions.d.ts.map +0 -0
- package/lib/cjs/constants/Actions.js +3 -4
- package/lib/cjs/constants/Actions.js.map +1 -0
- package/lib/{types → cjs}/constants/ContextProviders.d.ts +0 -0
- package/lib/{types → cjs}/constants/ContextProviders.d.ts.map +0 -0
- package/lib/cjs/constants/ContextProviders.js +22 -24
- package/lib/cjs/constants/ContextProviders.js.map +1 -0
- package/lib/{types → cjs}/constants/Device.d.ts +0 -0
- package/lib/{types → cjs}/constants/Device.d.ts.map +0 -0
- package/lib/cjs/constants/Device.js +3 -5
- package/lib/cjs/constants/Device.js.map +1 -0
- package/lib/{types → cjs}/constants/Errors.d.ts +0 -0
- package/lib/{types → cjs}/constants/Errors.d.ts.map +0 -0
- package/lib/cjs/constants/Errors.js +3 -5
- package/lib/cjs/constants/Errors.js.map +1 -0
- package/lib/{types → cjs}/constants/Features.d.ts +0 -0
- package/lib/{types → cjs}/constants/Features.d.ts.map +0 -0
- package/lib/cjs/constants/Features.js +43 -83
- package/lib/cjs/constants/Features.js.map +1 -0
- package/lib/{types → cjs}/constants/Locale.d.ts +0 -0
- package/lib/{types → cjs}/constants/Locale.d.ts.map +0 -0
- package/lib/cjs/constants/Locale.js +10 -17
- package/lib/cjs/constants/Locale.js.map +1 -0
- package/lib/{types → cjs}/constants/Notification.d.ts +0 -0
- package/lib/{types → cjs}/constants/Notification.d.ts.map +0 -0
- package/lib/cjs/constants/Notification.js +44 -53
- package/lib/cjs/constants/Notification.js.map +1 -0
- package/lib/{types → cjs}/constants/Notifications.d.ts +0 -0
- package/lib/{types → cjs}/constants/Notifications.d.ts.map +0 -0
- package/lib/cjs/constants/Notifications.js +11 -25
- package/lib/cjs/constants/Notifications.js.map +1 -0
- package/lib/cjs/constants/Preferences.d.ts +201 -0
- package/lib/cjs/constants/Preferences.d.ts.map +1 -0
- package/lib/cjs/constants/Preferences.js +184 -292
- package/lib/cjs/constants/Preferences.js.map +1 -0
- package/lib/{types → cjs}/constants/Routes.d.ts +0 -0
- package/lib/{types → cjs}/constants/Routes.d.ts.map +0 -0
- package/lib/cjs/constants/Routes.js +38 -59
- package/lib/cjs/constants/Routes.js.map +1 -0
- package/lib/{types → cjs}/constants/Session.d.ts +0 -0
- package/lib/{types → cjs}/constants/Session.d.ts.map +0 -0
- package/lib/cjs/constants/Session.js +12 -21
- package/lib/cjs/constants/Session.js.map +1 -0
- package/lib/{types → cjs}/constants/Theme.d.ts +0 -0
- package/lib/{types → cjs}/constants/Theme.d.ts.map +0 -0
- package/lib/cjs/constants/Theme.js +3 -4
- package/lib/cjs/constants/Theme.js.map +1 -0
- package/lib/cjs/constants/WebSocket.d.ts +4 -0
- package/lib/cjs/constants/WebSocket.d.ts.map +1 -0
- package/lib/cjs/constants/WebSocket.js +6 -9
- package/lib/cjs/constants/WebSocket.js.map +1 -0
- package/lib/{types → cjs}/hooks/useSCAuth.d.ts +0 -0
- package/lib/{types → cjs}/hooks/useSCAuth.d.ts.map +0 -0
- package/lib/cjs/hooks/useSCAuth.js +212 -282
- package/lib/cjs/hooks/useSCAuth.js.map +1 -0
- package/lib/{types → cjs}/hooks/useSCCachingManager.d.ts +0 -0
- package/lib/{types → cjs}/hooks/useSCCachingManager.d.ts.map +0 -0
- package/lib/cjs/hooks/useSCCachingManager.js +37 -51
- package/lib/cjs/hooks/useSCCachingManager.js.map +1 -0
- package/lib/{types → cjs}/hooks/useSCConnectionsManager.d.ts +0 -0
- package/lib/{types → cjs}/hooks/useSCConnectionsManager.d.ts.map +0 -0
- package/lib/cjs/hooks/useSCConnectionsManager.js +190 -254
- package/lib/cjs/hooks/useSCConnectionsManager.js.map +1 -0
- package/lib/{types → cjs}/hooks/useSCFetchAddressingTagList.d.ts +0 -0
- package/lib/{types → cjs}/hooks/useSCFetchAddressingTagList.d.ts.map +0 -0
- package/lib/cjs/hooks/useSCFetchAddressingTagList.js +64 -55
- package/lib/cjs/hooks/useSCFetchAddressingTagList.js.map +1 -0
- package/lib/{types → cjs}/hooks/useSCFetchCategories.d.ts +0 -0
- package/lib/{types → cjs}/hooks/useSCFetchCategories.d.ts.map +0 -0
- package/lib/cjs/hooks/useSCFetchCategories.js +46 -56
- package/lib/cjs/hooks/useSCFetchCategories.js.map +1 -0
- package/lib/{types → cjs}/hooks/useSCFetchCategory.d.ts +0 -0
- package/lib/{types → cjs}/hooks/useSCFetchCategory.d.ts.map +0 -0
- package/lib/cjs/hooks/useSCFetchCategory.js +44 -59
- package/lib/cjs/hooks/useSCFetchCategory.js.map +1 -0
- package/lib/{types → cjs}/hooks/useSCFetchCommentObject.d.ts +0 -0
- package/lib/{types → cjs}/hooks/useSCFetchCommentObject.d.ts.map +0 -0
- package/lib/cjs/hooks/useSCFetchCommentObject.js +44 -59
- package/lib/cjs/hooks/useSCFetchCommentObject.js.map +1 -0
- package/lib/{types → cjs}/hooks/useSCFetchCommentObjects.d.ts +0 -0
- package/lib/{types → cjs}/hooks/useSCFetchCommentObjects.d.ts.map +0 -0
- package/lib/cjs/hooks/useSCFetchCommentObjects.js +157 -254
- package/lib/cjs/hooks/useSCFetchCommentObjects.js.map +1 -0
- package/lib/{types → cjs}/hooks/useSCFetchCustomAdv.d.ts +0 -0
- package/lib/{types → cjs}/hooks/useSCFetchCustomAdv.d.ts.map +0 -0
- package/lib/cjs/hooks/useSCFetchCustomAdv.js +57 -75
- package/lib/cjs/hooks/useSCFetchCustomAdv.js.map +1 -0
- package/lib/{types → cjs}/hooks/useSCFetchFeedObject.d.ts +0 -0
- package/lib/{types → cjs}/hooks/useSCFetchFeedObject.d.ts.map +0 -0
- package/lib/cjs/hooks/useSCFetchFeedObject.js +49 -69
- package/lib/cjs/hooks/useSCFetchFeedObject.js.map +1 -0
- package/lib/{types → cjs}/hooks/useSCFetchIncubator.d.ts +0 -0
- package/lib/{types → cjs}/hooks/useSCFetchIncubator.d.ts.map +0 -0
- package/lib/cjs/hooks/useSCFetchIncubator.js +44 -59
- package/lib/cjs/hooks/useSCFetchIncubator.js.map +1 -0
- package/lib/{types → cjs}/hooks/useSCFetchTag.d.ts +0 -0
- package/lib/{types → cjs}/hooks/useSCFetchTag.d.ts.map +0 -0
- package/lib/cjs/hooks/useSCFetchTag.js +44 -59
- package/lib/cjs/hooks/useSCFetchTag.js.map +1 -0
- package/lib/{types → cjs}/hooks/useSCFetchUser.d.ts +0 -0
- package/lib/{types → cjs}/hooks/useSCFetchUser.d.ts.map +1 -1
- package/lib/cjs/hooks/useSCFetchUser.js +47 -59
- package/lib/cjs/hooks/useSCFetchUser.js.map +1 -0
- package/lib/{types → cjs}/hooks/useSCFollowedCategoriesManager.d.ts +0 -0
- package/lib/{types → cjs}/hooks/useSCFollowedCategoriesManager.d.ts.map +0 -0
- package/lib/cjs/hooks/useSCFollowedCategoriesManager.js +105 -147
- package/lib/cjs/hooks/useSCFollowedCategoriesManager.js.map +1 -0
- package/lib/{types → cjs}/hooks/useSCFollowersManager.d.ts +0 -0
- package/lib/{types → cjs}/hooks/useSCFollowersManager.d.ts.map +0 -0
- package/lib/cjs/hooks/useSCFollowersManager.js +154 -204
- package/lib/cjs/hooks/useSCFollowersManager.js.map +1 -0
- package/lib/{types → cjs}/hooks/useSCMediaClick.d.ts +0 -0
- package/lib/{types → cjs}/hooks/useSCMediaClick.d.ts.map +0 -0
- package/lib/cjs/hooks/useSCMediaClick.js +18 -25
- package/lib/cjs/hooks/useSCMediaClick.js.map +1 -0
- package/lib/{types → cjs}/hooks/useSCSubscribedIncubatorsManager.d.ts +0 -0
- package/lib/{types → cjs}/hooks/useSCSubscribedIncubatorsManager.d.ts.map +0 -0
- package/lib/cjs/hooks/useSCSubscribedIncubatorsManager.js +118 -148
- package/lib/cjs/hooks/useSCSubscribedIncubatorsManager.js.map +1 -0
- package/lib/{types → cjs}/hooks/useSCWebPushMessaging.d.ts +0 -0
- package/lib/{types → cjs}/hooks/useSCWebPushMessaging.d.ts.map +0 -0
- package/lib/cjs/hooks/useSCWebPushMessaging.js +268 -268
- package/lib/cjs/hooks/useSCWebPushMessaging.js.map +1 -0
- package/lib/{types → cjs}/hooks/useSCWebSocket.d.ts +0 -0
- package/lib/{types → cjs}/hooks/useSCWebSocket.d.ts.map +0 -0
- package/lib/cjs/hooks/useSCWebSocket.js +103 -125
- package/lib/cjs/hooks/useSCWebSocket.js.map +1 -0
- package/lib/{types → cjs}/index.d.ts +0 -0
- package/lib/{types → cjs}/index.d.ts.map +0 -0
- package/lib/cjs/index.js +131 -144
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/themes/theme.d.ts +9 -0
- package/lib/cjs/themes/theme.d.ts.map +1 -0
- package/lib/cjs/themes/theme.js +132 -143
- package/lib/cjs/themes/theme.js.map +1 -0
- package/lib/{types → cjs}/types/context.d.ts +0 -0
- package/lib/{types → cjs}/types/context.d.ts.map +0 -0
- package/lib/cjs/types/context.js +2 -2
- package/lib/cjs/types/context.js.map +1 -0
- package/lib/{types → cjs}/types/index.d.ts +0 -0
- package/lib/{types → cjs}/types/index.d.ts.map +0 -0
- package/lib/cjs/types/index.js +2 -21
- package/lib/cjs/types/index.js.map +1 -0
- package/lib/{types → cjs}/utils/errors.d.ts +0 -0
- package/lib/{types → cjs}/utils/errors.d.ts.map +0 -0
- package/lib/cjs/utils/errors.js +138 -149
- package/lib/cjs/utils/errors.js.map +1 -0
- package/lib/{types → cjs}/utils/locale.d.ts +0 -0
- package/lib/{types → cjs}/utils/locale.d.ts.map +0 -0
- package/lib/cjs/utils/locale.js +32 -48
- package/lib/cjs/utils/locale.js.map +1 -0
- package/lib/{types → cjs}/utils/user.d.ts +0 -0
- package/lib/{types → cjs}/utils/user.d.ts.map +0 -0
- package/lib/cjs/utils/user.js +25 -40
- package/lib/cjs/utils/user.js.map +1 -0
- package/lib/{types → cjs}/utils/validator.d.ts +0 -0
- package/lib/{types → cjs}/utils/validator.d.ts.map +0 -0
- package/lib/cjs/utils/validator.js +386 -576
- package/lib/cjs/utils/validator.js.map +1 -0
- package/lib/esm/components/provider/SCAlertMessagesProvider/index.d.ts +37 -0
- package/lib/esm/components/provider/SCAlertMessagesProvider/index.d.ts.map +1 -0
- package/lib/esm/components/provider/SCAlertMessagesProvider/index.js +11 -37
- package/lib/esm/components/provider/SCAlertMessagesProvider/index.js.map +1 -0
- package/lib/esm/components/provider/SCContextProvider/index.d.ts +35 -0
- package/lib/esm/components/provider/SCContextProvider/index.d.ts.map +1 -0
- package/lib/esm/components/provider/SCContextProvider/index.js +48 -83
- package/lib/esm/components/provider/SCContextProvider/index.js.map +1 -0
- package/lib/esm/components/provider/SCLocaleProvider/index.d.ts +42 -0
- package/lib/esm/components/provider/SCLocaleProvider/index.d.ts.map +1 -0
- package/lib/esm/components/provider/SCLocaleProvider/index.js +59 -123
- package/lib/esm/components/provider/SCLocaleProvider/index.js.map +1 -0
- package/lib/esm/components/provider/SCNotificationProvider/index.d.ts +37 -0
- package/lib/esm/components/provider/SCNotificationProvider/index.d.ts.map +1 -0
- package/lib/esm/components/provider/SCNotificationProvider/index.js +12 -43
- package/lib/esm/components/provider/SCNotificationProvider/index.js.map +1 -0
- package/lib/esm/components/provider/SCPreferencesProvider/index.d.ts +38 -0
- package/lib/esm/components/provider/SCPreferencesProvider/index.d.ts.map +1 -0
- package/lib/esm/components/provider/SCPreferencesProvider/index.js +35 -64
- package/lib/esm/components/provider/SCPreferencesProvider/index.js.map +1 -0
- package/lib/esm/components/provider/SCRoutingProvider/index.d.ts +39 -0
- package/lib/esm/components/provider/SCRoutingProvider/index.d.ts.map +1 -0
- package/lib/esm/components/provider/SCRoutingProvider/index.js +78 -113
- package/lib/esm/components/provider/SCRoutingProvider/index.js.map +1 -0
- package/lib/esm/components/provider/SCThemeProvider/index.d.ts +49 -0
- package/lib/esm/components/provider/SCThemeProvider/index.d.ts.map +1 -0
- package/lib/esm/components/provider/SCThemeProvider/index.js +36 -81
- package/lib/esm/components/provider/SCThemeProvider/index.js.map +1 -0
- package/lib/esm/components/provider/SCUserProvider/index.d.ts +38 -0
- package/lib/esm/components/provider/SCUserProvider/index.d.ts.map +1 -0
- package/lib/esm/components/provider/SCUserProvider/index.js +186 -272
- package/lib/esm/components/provider/SCUserProvider/index.js.map +1 -0
- package/lib/esm/components/router/index.d.ts +34 -0
- package/lib/esm/components/router/index.d.ts.map +1 -0
- package/lib/esm/components/router/index.js +24 -50
- package/lib/esm/components/router/index.js.map +1 -0
- package/lib/esm/constants/Actions.d.ts +2 -0
- package/lib/esm/constants/Actions.d.ts.map +1 -0
- package/lib/esm/constants/Actions.js +2 -6
- package/lib/esm/constants/Actions.js.map +1 -0
- package/lib/esm/constants/ContextProviders.d.ts +6 -0
- package/lib/esm/constants/ContextProviders.d.ts.map +1 -0
- package/lib/esm/constants/ContextProviders.js +18 -26
- package/lib/esm/constants/ContextProviders.js.map +1 -0
- package/lib/esm/constants/Device.d.ts +6 -0
- package/lib/esm/constants/Device.d.ts.map +1 -0
- package/lib/esm/constants/Device.js +2 -7
- package/lib/esm/constants/Device.js.map +1 -0
- package/lib/esm/constants/Errors.d.ts +5 -0
- package/lib/esm/constants/Errors.d.ts.map +1 -0
- package/lib/esm/constants/Errors.js +2 -7
- package/lib/esm/constants/Errors.js.map +1 -0
- package/lib/esm/constants/Features.d.ts +41 -0
- package/lib/esm/constants/Features.d.ts.map +1 -0
- package/lib/esm/constants/Features.js +41 -84
- package/lib/esm/constants/Features.js.map +1 -0
- package/lib/esm/constants/Locale.d.ts +8 -0
- package/lib/esm/constants/Locale.d.ts.map +1 -0
- package/lib/esm/constants/Locale.js +8 -18
- package/lib/esm/constants/Locale.js.map +1 -0
- package/lib/esm/constants/Notification.d.ts +55 -0
- package/lib/esm/constants/Notification.d.ts.map +1 -0
- package/lib/esm/constants/Notification.js +42 -54
- package/lib/esm/constants/Notification.js.map +1 -0
- package/lib/esm/constants/Notifications.d.ts +11 -0
- package/lib/esm/constants/Notifications.d.ts.map +1 -0
- package/lib/esm/constants/Notifications.js +9 -26
- package/lib/esm/constants/Notifications.js.map +1 -0
- package/lib/esm/constants/Preferences.d.ts +201 -0
- package/lib/esm/constants/Preferences.d.ts.map +1 -0
- package/lib/esm/constants/Preferences.js +181 -296
- package/lib/esm/constants/Preferences.js.map +1 -0
- package/lib/esm/constants/Routes.d.ts +29 -0
- package/lib/esm/constants/Routes.d.ts.map +1 -0
- package/lib/esm/constants/Routes.js +36 -60
- package/lib/esm/constants/Routes.js.map +1 -0
- package/lib/esm/constants/Session.d.ts +10 -0
- package/lib/esm/constants/Session.d.ts.map +1 -0
- package/lib/esm/constants/Session.js +10 -22
- package/lib/esm/constants/Session.js.map +1 -0
- package/lib/esm/constants/Theme.d.ts +2 -0
- package/lib/esm/constants/Theme.d.ts.map +1 -0
- package/lib/esm/constants/Theme.js +2 -6
- package/lib/esm/constants/Theme.js.map +1 -0
- package/lib/esm/constants/WebSocket.d.ts +4 -0
- package/lib/esm/constants/WebSocket.d.ts.map +1 -0
- package/lib/esm/constants/WebSocket.js +4 -10
- package/lib/esm/constants/WebSocket.js.map +1 -0
- package/lib/esm/hooks/useSCAuth.d.ts +56 -0
- package/lib/esm/hooks/useSCAuth.d.ts.map +1 -0
- package/lib/esm/hooks/useSCAuth.js +185 -285
- package/lib/esm/hooks/useSCAuth.js.map +1 -0
- package/lib/esm/hooks/useSCCachingManager.d.ts +19 -0
- package/lib/esm/hooks/useSCCachingManager.d.ts.map +1 -0
- package/lib/esm/hooks/useSCCachingManager.js +36 -53
- package/lib/esm/hooks/useSCCachingManager.js.map +1 -0
- package/lib/esm/hooks/useSCConnectionsManager.d.ts +40 -0
- package/lib/esm/hooks/useSCConnectionsManager.d.ts.map +1 -0
- package/lib/esm/hooks/useSCConnectionsManager.js +186 -256
- package/lib/esm/hooks/useSCConnectionsManager.js.map +1 -0
- package/lib/esm/hooks/useSCFetchAddressingTagList.d.ts +14 -0
- package/lib/esm/hooks/useSCFetchAddressingTagList.d.ts.map +1 -0
- package/lib/esm/hooks/useSCFetchAddressingTagList.js +39 -56
- package/lib/esm/hooks/useSCFetchAddressingTagList.js.map +1 -0
- package/lib/esm/hooks/useSCFetchCategories.d.ts +17 -0
- package/lib/esm/hooks/useSCFetchCategories.d.ts.map +1 -0
- package/lib/esm/hooks/useSCFetchCategories.js +45 -57
- package/lib/esm/hooks/useSCFetchCategories.js.map +1 -0
- package/lib/esm/hooks/useSCFetchCategory.d.ts +19 -0
- package/lib/esm/hooks/useSCFetchCategory.d.ts.map +1 -0
- package/lib/esm/hooks/useSCFetchCategory.js +42 -60
- package/lib/esm/hooks/useSCFetchCategory.js.map +1 -0
- package/lib/esm/hooks/useSCFetchCommentObject.d.ts +19 -0
- package/lib/esm/hooks/useSCFetchCommentObject.d.ts.map +1 -0
- package/lib/esm/hooks/useSCFetchCommentObject.js +42 -60
- package/lib/esm/hooks/useSCFetchCommentObject.js.map +1 -0
- package/lib/esm/hooks/useSCFetchCommentObjects.d.ts +53 -0
- package/lib/esm/hooks/useSCFetchCommentObjects.d.ts.map +1 -0
- package/lib/esm/hooks/useSCFetchCommentObjects.js +153 -257
- package/lib/esm/hooks/useSCFetchCommentObjects.js.map +1 -0
- package/lib/esm/hooks/useSCFetchCustomAdv.d.ts +19 -0
- package/lib/esm/hooks/useSCFetchCustomAdv.d.ts.map +1 -0
- package/lib/esm/hooks/useSCFetchCustomAdv.js +55 -76
- package/lib/esm/hooks/useSCFetchCustomAdv.js.map +1 -0
- package/lib/esm/hooks/useSCFetchFeedObject.d.ts +21 -0
- package/lib/esm/hooks/useSCFetchFeedObject.d.ts.map +1 -0
- package/lib/esm/hooks/useSCFetchFeedObject.js +47 -70
- package/lib/esm/hooks/useSCFetchFeedObject.js.map +1 -0
- package/lib/esm/hooks/useSCFetchIncubator.d.ts +19 -0
- package/lib/esm/hooks/useSCFetchIncubator.d.ts.map +1 -0
- package/lib/esm/hooks/useSCFetchIncubator.js +42 -60
- package/lib/esm/hooks/useSCFetchIncubator.js.map +1 -0
- package/lib/esm/hooks/useSCFetchTag.d.ts +19 -0
- package/lib/esm/hooks/useSCFetchTag.d.ts.map +1 -0
- package/lib/esm/hooks/useSCFetchTag.js +42 -60
- package/lib/esm/hooks/useSCFetchTag.js.map +1 -0
- package/lib/esm/hooks/useSCFetchUser.d.ts +19 -0
- package/lib/esm/hooks/useSCFetchUser.d.ts.map +1 -0
- package/lib/esm/hooks/useSCFetchUser.js +45 -60
- package/lib/esm/hooks/useSCFetchUser.js.map +1 -0
- package/lib/esm/hooks/useSCFollowedCategoriesManager.d.ts +37 -0
- package/lib/esm/hooks/useSCFollowedCategoriesManager.d.ts.map +1 -0
- package/lib/esm/hooks/useSCFollowedCategoriesManager.js +101 -149
- package/lib/esm/hooks/useSCFollowedCategoriesManager.js.map +1 -0
- package/lib/esm/hooks/useSCFollowersManager.d.ts +37 -0
- package/lib/esm/hooks/useSCFollowersManager.d.ts.map +1 -0
- package/lib/esm/hooks/useSCFollowersManager.js +150 -206
- package/lib/esm/hooks/useSCFollowersManager.js.map +1 -0
- package/lib/esm/hooks/useSCMediaClick.d.ts +4 -0
- package/lib/esm/hooks/useSCMediaClick.d.ts.map +1 -0
- package/lib/esm/hooks/useSCMediaClick.js +17 -27
- package/lib/esm/hooks/useSCMediaClick.js.map +1 -0
- package/lib/esm/hooks/useSCSubscribedIncubatorsManager.d.ts +27 -0
- package/lib/esm/hooks/useSCSubscribedIncubatorsManager.d.ts.map +1 -0
- package/lib/esm/hooks/useSCSubscribedIncubatorsManager.js +114 -150
- package/lib/esm/hooks/useSCSubscribedIncubatorsManager.js.map +1 -0
- package/lib/esm/hooks/useSCWebPushMessaging.d.ts +9 -0
- package/lib/esm/hooks/useSCWebPushMessaging.d.ts.map +1 -0
- package/lib/esm/hooks/useSCWebPushMessaging.js +244 -270
- package/lib/esm/hooks/useSCWebPushMessaging.js.map +1 -0
- package/lib/esm/hooks/useSCWebSocket.d.ts +12 -0
- package/lib/esm/hooks/useSCWebSocket.d.ts.map +1 -0
- package/lib/esm/hooks/useSCWebSocket.js +99 -127
- package/lib/esm/hooks/useSCWebSocket.js.map +1 -0
- package/lib/esm/index.d.ts +73 -0
- package/lib/esm/index.d.ts.map +1 -0
- package/lib/esm/index.js +69 -151
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/themes/theme.d.ts +9 -0
- package/lib/esm/themes/theme.d.ts.map +1 -0
- package/lib/esm/themes/theme.js +128 -144
- package/lib/esm/themes/theme.js.map +1 -0
- package/lib/esm/types/context.d.ts +428 -0
- package/lib/esm/types/context.d.ts.map +1 -0
- package/lib/esm/types/context.js +2 -3
- package/lib/esm/types/context.js.map +1 -0
- package/lib/esm/types/index.d.ts +3 -0
- package/lib/esm/types/index.d.ts.map +1 -0
- package/lib/esm/types/index.js +2 -22
- package/lib/esm/types/index.js.map +1 -0
- package/lib/esm/utils/errors.d.ts +98 -0
- package/lib/esm/utils/errors.d.ts.map +1 -0
- package/lib/esm/utils/errors.js +114 -155
- package/lib/esm/utils/errors.js.map +1 -0
- package/lib/esm/utils/locale.d.ts +10 -0
- package/lib/esm/utils/locale.d.ts.map +1 -0
- package/lib/esm/utils/locale.js +27 -50
- package/lib/esm/utils/locale.js.map +1 -0
- package/lib/esm/utils/user.d.ts +41 -0
- package/lib/esm/utils/user.d.ts.map +1 -0
- package/lib/esm/utils/user.js +23 -46
- package/lib/esm/utils/user.js.map +1 -0
- package/lib/esm/utils/validator.d.ts +239 -0
- package/lib/esm/utils/validator.d.ts.map +1 -0
- package/lib/esm/utils/validator.js +352 -588
- package/lib/esm/utils/validator.js.map +1 -0
- package/lib/umd/react-core.js +1 -1
- package/package.json +9 -11
- package/lib/types/tsconfig.build.tsbuildinfo +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/provider/SCNotificationProvider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkC,MAAM,OAAO,CAAC;AACvD,OAAO,EAAC,yBAAyB,EAAC,MAAM,gBAAgB,CAAC;AAIzD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,qBAAqB,0CAA4E,CAAC;AAE/G;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAAC,QAAe,EAAC,EAAE;IAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAC,GAAG,GAAG,CAAC,OAAO,CAK1G;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,yBAAyB,CAE7D"}
|
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.SCNotificationContext = void 0;
|
|
5
|
-
exports.default = SCNotificationProvider;
|
|
6
|
-
exports.useSCNotification = useSCNotification;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
var _useSCWebSocket = _interopRequireDefault(require("../../../hooks/useSCWebSocket"));
|
|
11
|
-
|
|
12
|
-
var _useSCWebPushMessaging = _interopRequireDefault(require("../../../hooks/useSCWebPushMessaging"));
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
-
|
|
18
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
-
|
|
1
|
+
import React, { createContext, useContext } from 'react';
|
|
2
|
+
import useSCWebSocket from '../../../hooks/useSCWebSocket';
|
|
3
|
+
import useSCWebPushMessaging from '../../../hooks/useSCWebPushMessaging';
|
|
20
4
|
/**
|
|
21
5
|
* Creates Global Context
|
|
22
6
|
*
|
|
@@ -33,7 +17,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
33
17
|
````
|
|
34
18
|
:::
|
|
35
19
|
*/
|
|
36
|
-
const SCNotificationContext =
|
|
20
|
+
export const SCNotificationContext = createContext({});
|
|
37
21
|
/**
|
|
38
22
|
* #### Description:
|
|
39
23
|
* This component makes the notification context available down the React tree.
|
|
@@ -43,31 +27,16 @@ const SCNotificationContext = /*#__PURE__*/(0, _react.createContext)({});
|
|
|
43
27
|
* <SCNotificationContext.Provider value={{wsInstance}}>{children}</SCNotificationContext.Provider>
|
|
44
28
|
* ```
|
|
45
29
|
*/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
children = null
|
|
51
|
-
}) {
|
|
52
|
-
const {
|
|
53
|
-
wsInstance
|
|
54
|
-
} = (0, _useSCWebSocket.default)();
|
|
55
|
-
const {
|
|
56
|
-
wpSubscription
|
|
57
|
-
} = (0, _useSCWebPushMessaging.default)();
|
|
58
|
-
return /*#__PURE__*/_react.default.createElement(SCNotificationContext.Provider, {
|
|
59
|
-
value: {
|
|
60
|
-
wsInstance,
|
|
61
|
-
wpSubscription
|
|
62
|
-
}
|
|
63
|
-
}, children);
|
|
30
|
+
export default function SCNotificationProvider({ children = null }) {
|
|
31
|
+
const { wsInstance } = useSCWebSocket();
|
|
32
|
+
const { wpSubscription } = useSCWebPushMessaging();
|
|
33
|
+
return React.createElement(SCNotificationContext.Provider, { value: { wsInstance, wpSubscription } }, children);
|
|
64
34
|
}
|
|
65
35
|
/**
|
|
66
36
|
* Let's only export the `useSCNotification` hook instead of the context.
|
|
67
37
|
* We only want to use the hook directly and never the context component.
|
|
68
38
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
39
|
+
export function useSCNotification() {
|
|
40
|
+
return useContext(SCNotificationContext);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/provider/SCNotificationProvider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,OAAO,CAAC;AAEvD,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,qBAAqB,MAAM,sCAAsC,CAAC;AAEzE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAA4B,EAA+B,CAAC,CAAC;AAE/G;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAAC,QAAQ,GAAG,IAAI,EAA8B;IAC3F,MAAM,EAAC,UAAU,EAAC,GAAG,cAAc,EAAE,CAAC;IACtC,MAAM,EAAC,cAAc,EAAC,GAAG,qBAAqB,EAAE,CAAC;IAEjD,OAAO,oBAAC,qBAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAC,UAAU,EAAE,cAAc,EAAC,IAAG,QAAQ,CAAkC,CAAC;AAC1H,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,UAAU,CAAC,qBAAqB,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SCPreferencesContextType } from '../../../types/context';
|
|
3
|
+
/**
|
|
4
|
+
* Creates Preferences/Features Context
|
|
5
|
+
*
|
|
6
|
+
:::tipContext can be consumed in one of the following ways:
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
```jsx
|
|
10
|
+
1. <SCPreferencesContext.Consumer>{(preferences) => (...)}</SCPreferencesContext.Consumer>
|
|
11
|
+
```
|
|
12
|
+
```jsx
|
|
13
|
+
2. const scPreferences: SCPreferencesType = usePreferencesContext(SCPreferencesContext);
|
|
14
|
+
```
|
|
15
|
+
```jsx
|
|
16
|
+
3. const scPreferences: SCPreferencesType = useSCPreferences();
|
|
17
|
+
````
|
|
18
|
+
:::
|
|
19
|
+
*/
|
|
20
|
+
export declare const SCPreferencesContext: React.Context<SCPreferencesContextType>;
|
|
21
|
+
/**
|
|
22
|
+
* #### Description:
|
|
23
|
+
* This component imports all preferences and features enabled.
|
|
24
|
+
* @param children
|
|
25
|
+
* @return
|
|
26
|
+
* ```jsx
|
|
27
|
+
* <SCPreferencesContext.Provider value={{preferences, features}}>{!loading && children}</SCPreferencesContext.Provider>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export default function SCPreferencesProvider({ children }: {
|
|
31
|
+
children: React.ReactNode;
|
|
32
|
+
}): JSX.Element;
|
|
33
|
+
/**
|
|
34
|
+
* Let's only export the `useSCPreferences` hook instead of the context.
|
|
35
|
+
* We only want to use the hook directly and never the context component.
|
|
36
|
+
*/
|
|
37
|
+
export declare function useSCPreferences(): SCPreferencesContextType;
|
|
38
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/provider/SCPreferencesProvider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAC,wBAAwB,EAAC,MAAM,wBAAwB,CAAC;AAIhE;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,oBAAoB,yCAA0E,CAAC;AAE5G;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAAC,QAAe,EAAC,EAAE;IAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAC,GAAG,GAAG,CAAC,OAAO,CA4BzG;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,wBAAwB,CAE3D"}
|
|
@@ -1,22 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
exports.default = SCPreferencesProvider;
|
|
6
|
-
exports.useSCPreferences = useSCPreferences;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
var _apiServices = require("@selfcommunity/api-services");
|
|
11
|
-
|
|
12
|
-
var _utils = require("@selfcommunity/utils");
|
|
13
|
-
|
|
14
|
-
var _Errors = require("../../../constants/Errors");
|
|
15
|
-
|
|
16
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
-
|
|
18
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
-
|
|
1
|
+
import React, { createContext, useContext, useEffect, useState } from 'react';
|
|
2
|
+
import { FeatureService, PreferenceService } from '@selfcommunity/api-services';
|
|
3
|
+
import { Logger } from '@selfcommunity/utils';
|
|
4
|
+
import { SCOPE_SC_CORE } from '../../../constants/Errors';
|
|
20
5
|
/**
|
|
21
6
|
* Creates Preferences/Features Context
|
|
22
7
|
*
|
|
@@ -34,7 +19,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
34
19
|
````
|
|
35
20
|
:::
|
|
36
21
|
*/
|
|
37
|
-
const SCPreferencesContext =
|
|
22
|
+
export const SCPreferencesContext = createContext({});
|
|
38
23
|
/**
|
|
39
24
|
* #### Description:
|
|
40
25
|
* This component imports all preferences and features enabled.
|
|
@@ -44,52 +29,38 @@ const SCPreferencesContext = /*#__PURE__*/(0, _react.createContext)({});
|
|
|
44
29
|
* <SCPreferencesContext.Provider value={{preferences, features}}>{!loading && children}</SCPreferencesContext.Provider>
|
|
45
30
|
* ```
|
|
46
31
|
*/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
});
|
|
74
|
-
}, []);
|
|
75
|
-
/**
|
|
76
|
-
* Nesting all necessary providers
|
|
77
|
-
* All child components will use help contexts to works
|
|
78
|
-
*/
|
|
79
|
-
|
|
80
|
-
return /*#__PURE__*/_react.default.createElement(SCPreferencesContext.Provider, {
|
|
81
|
-
value: {
|
|
82
|
-
preferences,
|
|
83
|
-
features
|
|
84
|
-
}
|
|
85
|
-
}, !loading && children);
|
|
32
|
+
export default function SCPreferencesProvider({ children = null }) {
|
|
33
|
+
const [preferences, setPreferences] = useState({});
|
|
34
|
+
const [features, setFeatures] = useState([]);
|
|
35
|
+
const [, setError] = useState();
|
|
36
|
+
const [loading, setLoading] = useState(true);
|
|
37
|
+
/**
|
|
38
|
+
* Load all dynamic preferences and features enabled
|
|
39
|
+
* to manages configurations of the project
|
|
40
|
+
*/
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
Promise.all([PreferenceService.getAllPreferences(), FeatureService.getAllFeatures()])
|
|
43
|
+
.then(function ([preferences, features]) {
|
|
44
|
+
setPreferences(preferences['results'].reduce((obj, p) => (Object.assign(Object.assign({}, obj), { [`${p.section}.${p.name}`]: p })), {}));
|
|
45
|
+
setFeatures(features['results'].map((f) => f.name));
|
|
46
|
+
setLoading(false);
|
|
47
|
+
})
|
|
48
|
+
.catch((_error) => {
|
|
49
|
+
Logger.error(SCOPE_SC_CORE, _error);
|
|
50
|
+
setError(_error);
|
|
51
|
+
});
|
|
52
|
+
}, []);
|
|
53
|
+
/**
|
|
54
|
+
* Nesting all necessary providers
|
|
55
|
+
* All child components will use help contexts to works
|
|
56
|
+
*/
|
|
57
|
+
return React.createElement(SCPreferencesContext.Provider, { value: { preferences, features } }, !loading && children);
|
|
86
58
|
}
|
|
87
59
|
/**
|
|
88
60
|
* Let's only export the `useSCPreferences` hook instead of the context.
|
|
89
61
|
* We only want to use the hook directly and never the context component.
|
|
90
62
|
*/
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
63
|
+
export function useSCPreferences() {
|
|
64
|
+
return useContext(SCPreferencesContext);
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/provider/SCPreferencesProvider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAC,cAAc,EAAE,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAE9E,OAAO,EAAC,MAAM,EAAC,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAC,aAAa,EAAC,MAAM,2BAA2B,CAAC;AAExD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAA2B,EAA8B,CAAC,CAAC;AAE5G;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAAC,QAAQ,GAAG,IAAI,EAA8B;IAC1F,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAsB,EAAE,CAAC,CAAC;IACxE,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAW,EAAE,CAAC,CAAC;IACvD,MAAM,CAAC,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAO,CAAC;IACrC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAU,IAAI,CAAC,CAAC;IAEtD;;;OAGG;IACH,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,CAAC,GAAG,CAAC,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,EAAE,cAAc,CAAC,cAAc,EAAE,CAAC,CAAC;aAClF,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,QAAQ,CAAC;YACrC,cAAc,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,iCAAK,GAAG,KAAE,CAAC,GAAG,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,IAAE,EAAE,EAAE,CAAC,CAAC,CAAC;YACzG,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACpD,UAAU,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE;YAChB,MAAM,CAAC,KAAK,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;YACpC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP;;;OAGG;IACH,OAAO,oBAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAC,WAAW,EAAE,QAAQ,EAAC,IAAG,CAAC,OAAO,IAAI,QAAQ,CAAiC,CAAC;AAC/H,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SCRoutingContextType } from '../../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Creates Global Context
|
|
5
|
+
*
|
|
6
|
+
:::tipContext can be consumed in one of the following ways:
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
```jsx
|
|
10
|
+
1. <SCRoutingContext.Consumer>{(routerLink, routes, url) => (...)}</SCRoutingContext.Consumer>
|
|
11
|
+
```
|
|
12
|
+
```jsx
|
|
13
|
+
2. const scRoutingContext: SCRoutingContextType = useContext(SCRoutingContext);
|
|
14
|
+
```
|
|
15
|
+
```jsx
|
|
16
|
+
3. const scRoutingContext: SCRoutingContextType = useSCRouting();
|
|
17
|
+
````
|
|
18
|
+
|
|
19
|
+
:::
|
|
20
|
+
*/
|
|
21
|
+
export declare const SCRoutingContext: React.Context<SCRoutingContextType>;
|
|
22
|
+
/**
|
|
23
|
+
* #### Description:
|
|
24
|
+
* This component provides routing context.
|
|
25
|
+
* @param children
|
|
26
|
+
* @return
|
|
27
|
+
* ```jsx
|
|
28
|
+
* <SCRoutingContext.Provider value={contextValue}>{children}</SCRoutingContext.Provider>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export default function SCRoutingProvider({ children }: {
|
|
32
|
+
children: React.ReactNode;
|
|
33
|
+
}): JSX.Element;
|
|
34
|
+
/**
|
|
35
|
+
* Let's only export the `useSCTheme` hook instead of the context.
|
|
36
|
+
* We only want to use the hook directly and never the context component.
|
|
37
|
+
*/
|
|
38
|
+
export declare function useSCRouting(): SCRoutingContextType;
|
|
39
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/provider/SCRoutingProvider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAChE,OAAO,EAA0C,oBAAoB,EAAoB,MAAM,gBAAgB,CAAC;AAoBhH;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,gBAAgB,qCAAkE,CAAC;AAEhG;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EAAC,QAAe,EAAC,EAAE;IAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAC,GAAG,GAAG,CAAC,OAAO,CAmFrG;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,oBAAoB,CAEnD"}
|
|
@@ -1,24 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.useSCRouting = useSCRouting;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
var _SCContextProvider = require("../SCContextProvider");
|
|
11
|
-
|
|
12
|
-
var _SCPreferencesProvider = require("../SCPreferencesProvider");
|
|
13
|
-
|
|
14
|
-
var SCPreferences = _interopRequireWildcard(require("../../../constants/Preferences"));
|
|
15
|
-
|
|
16
|
-
var _Routes = require("../../../constants/Routes");
|
|
17
|
-
|
|
18
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
-
|
|
20
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
|
|
1
|
+
import React, { createContext, useContext, useMemo } from 'react';
|
|
2
|
+
import { useSCContext } from '../SCContextProvider';
|
|
3
|
+
import { SCPreferencesContext } from '../SCPreferencesProvider';
|
|
4
|
+
import * as SCPreferences from '../../../constants/Preferences';
|
|
5
|
+
import { CATEGORIES_LIST_ROUTE_NAME, CATEGORY_ROUTE_NAME, COMMENT_ROUTE_NAME, DISCUSSION_ROUTE_NAME, INCUBATOR_ROUTE_NAME, POST_ROUTE_NAME, STATUS_ROUTE_NAME, USER_NOTIFICATIONS_ROUTE_NAME, USER_PRIVATE_MESSAGES_ROUTE_NAME, USER_PROFILE_ROUTE_NAME, USER_PROFILE_SETTINGS_ROUTE_NAME, defaultRoutes, } from '../../../constants/Routes';
|
|
22
6
|
/**
|
|
23
7
|
* Creates Global Context
|
|
24
8
|
*
|
|
@@ -37,7 +21,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
37
21
|
|
|
38
22
|
:::
|
|
39
23
|
*/
|
|
40
|
-
const SCRoutingContext =
|
|
24
|
+
export const SCRoutingContext = createContext({});
|
|
41
25
|
/**
|
|
42
26
|
* #### Description:
|
|
43
27
|
* This component provides routing context.
|
|
@@ -47,100 +31,81 @@ const SCRoutingContext = /*#__PURE__*/(0, _react.createContext)({});
|
|
|
47
31
|
* <SCRoutingContext.Provider value={contextValue}>{children}</SCRoutingContext.Provider>
|
|
48
32
|
* ```
|
|
49
33
|
*/
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const re = /\{([^/]+)?\}/g;
|
|
71
|
-
let match = re.exec(url);
|
|
72
|
-
|
|
73
|
-
while (match) {
|
|
74
|
-
tpl = tpl.replace(match[0], `:${match[1]}`);
|
|
75
|
-
re.lastIndex = 0;
|
|
76
|
-
match = re.exec(tpl);
|
|
34
|
+
export default function SCRoutingProvider({ children = null }) {
|
|
35
|
+
const scPreferencesContext = useContext(SCPreferencesContext);
|
|
36
|
+
const scContext = useSCContext();
|
|
37
|
+
const router = scContext.settings.router ? scContext.settings.router : {};
|
|
38
|
+
const routerLink = router.routerLink ? router.routerLink : null;
|
|
39
|
+
const _routes = Object.assign(getPreferencesRoutes(), defaultRoutes);
|
|
40
|
+
const routes = router.routes ? Object.assign(Object.assign({}, _routes), router.routes) : defaultRoutes;
|
|
41
|
+
/**
|
|
42
|
+
* Normalize template url (preferences)
|
|
43
|
+
*/
|
|
44
|
+
function normalizeUrl(url) {
|
|
45
|
+
let tpl = url;
|
|
46
|
+
const re = /\{([^/]+)?\}/g;
|
|
47
|
+
let match = re.exec(url);
|
|
48
|
+
while (match) {
|
|
49
|
+
tpl = tpl.replace(match[0], `:${match[1]}`);
|
|
50
|
+
re.lastIndex = 0;
|
|
51
|
+
match = re.exec(tpl);
|
|
52
|
+
}
|
|
53
|
+
return tpl;
|
|
77
54
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
return replacer(routes[name], params);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const contextValue = (0, _react.useMemo)(() => ({
|
|
130
|
-
routerLink,
|
|
131
|
-
routes,
|
|
132
|
-
url
|
|
133
|
-
}), [routerLink, routes]);
|
|
134
|
-
return /*#__PURE__*/_react.default.createElement(SCRoutingContext.Provider, {
|
|
135
|
-
value: contextValue
|
|
136
|
-
}, children);
|
|
55
|
+
/**
|
|
56
|
+
* Get override routes from community preferences
|
|
57
|
+
*/
|
|
58
|
+
function getPreferencesRoutes() {
|
|
59
|
+
if (Object.keys(scPreferencesContext.preferences).length) {
|
|
60
|
+
return {
|
|
61
|
+
[POST_ROUTE_NAME]: normalizeUrl(scPreferencesContext.preferences[SCPreferences.CONFIGURATIONS_URL_TEMPLATE_POST].value),
|
|
62
|
+
[DISCUSSION_ROUTE_NAME]: normalizeUrl(scPreferencesContext.preferences[SCPreferences.CONFIGURATIONS_URL_TEMPLATE_DISCUSSION].value),
|
|
63
|
+
[STATUS_ROUTE_NAME]: normalizeUrl(scPreferencesContext.preferences[SCPreferences.CONFIGURATIONS_URL_TEMPLATE_STATUS].value),
|
|
64
|
+
[COMMENT_ROUTE_NAME]: normalizeUrl(scPreferencesContext.preferences[SCPreferences.CONFIGURATIONS_URL_TEMPLATE_COMMENT].value),
|
|
65
|
+
[CATEGORY_ROUTE_NAME]: normalizeUrl(scPreferencesContext.preferences[SCPreferences.CONFIGURATIONS_URL_TEMPLATE_CATEGORY].value),
|
|
66
|
+
[CATEGORIES_LIST_ROUTE_NAME]: normalizeUrl(scPreferencesContext.preferences[SCPreferences.CONFIGURATIONS_URL_TEMPLATE_CATEGORIES_LIST].value),
|
|
67
|
+
[USER_PROFILE_ROUTE_NAME]: normalizeUrl(scPreferencesContext.preferences[SCPreferences.CONFIGURATIONS_URL_TEMPLATE_USER_PROFILE].value),
|
|
68
|
+
[USER_PROFILE_SETTINGS_ROUTE_NAME]: normalizeUrl(scPreferencesContext.preferences[SCPreferences.CONFIGURATIONS_URL_TEMPLATE_USER_PROFILE_SETTINGS].value),
|
|
69
|
+
[USER_NOTIFICATIONS_ROUTE_NAME]: normalizeUrl(scPreferencesContext.preferences[SCPreferences.CONFIGURATIONS_URL_TEMPLATE_USER_NOTIFICATIONS].value),
|
|
70
|
+
[USER_PRIVATE_MESSAGES_ROUTE_NAME]: normalizeUrl(scPreferencesContext.preferences[SCPreferences.CONFIGURATIONS_URL_TEMPLATE_USER_PRIVATE_MESSAGES].value),
|
|
71
|
+
[INCUBATOR_ROUTE_NAME]: normalizeUrl(scPreferencesContext.preferences[SCPreferences.CONFIGURATIONS_URL_TEMPLATE_INCUBATOR].value),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return {};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Generate path
|
|
78
|
+
*/
|
|
79
|
+
function url(name = '', params = {}) {
|
|
80
|
+
const replacer = (tpl, data) => {
|
|
81
|
+
const re = /:([^/|^?|^#]+)?/g;
|
|
82
|
+
let _tpl = tpl;
|
|
83
|
+
let match = re.exec(tpl);
|
|
84
|
+
while (match) {
|
|
85
|
+
_tpl = _tpl.replace(match[0], data[match[1]]);
|
|
86
|
+
re.lastIndex = 0;
|
|
87
|
+
match = re.exec(_tpl);
|
|
88
|
+
}
|
|
89
|
+
if (router.handleRoute) {
|
|
90
|
+
// Handle override url
|
|
91
|
+
return router.handleRoute(name, _tpl, params, tpl);
|
|
92
|
+
}
|
|
93
|
+
return _tpl;
|
|
94
|
+
};
|
|
95
|
+
return replacer(routes[name], params);
|
|
96
|
+
}
|
|
97
|
+
const contextValue = useMemo(() => ({
|
|
98
|
+
routerLink,
|
|
99
|
+
routes,
|
|
100
|
+
url,
|
|
101
|
+
}), [routerLink, routes]);
|
|
102
|
+
return React.createElement(SCRoutingContext.Provider, { value: contextValue }, children);
|
|
137
103
|
}
|
|
138
104
|
/**
|
|
139
105
|
* Let's only export the `useSCTheme` hook instead of the context.
|
|
140
106
|
* We only want to use the hook directly and never the context component.
|
|
141
107
|
*/
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
108
|
+
export function useSCRouting() {
|
|
109
|
+
return useContext(SCRoutingContext);
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/provider/SCRoutingProvider/index.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SCThemeContextType } from '../../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Creates Global Context
|
|
5
|
+
*
|
|
6
|
+
:::tipContext can be consumed in one of the following ways:
|
|
7
|
+
|
|
8
|
+
```jsx
|
|
9
|
+
1. <SCThemeContext.Consumer>{(theme,) => (...)}</SCThemeContext.Consumer>
|
|
10
|
+
```
|
|
11
|
+
```jsx
|
|
12
|
+
2. const scThemeContext: SCThemeContextType = useContext(SCThemeContext);
|
|
13
|
+
```
|
|
14
|
+
```jsx
|
|
15
|
+
3. const scThemeContext: SCThemeContextType = useSCTheme();
|
|
16
|
+
````
|
|
17
|
+
|
|
18
|
+
:::
|
|
19
|
+
|
|
20
|
+
*/
|
|
21
|
+
export declare const SCThemeContext: React.Context<SCThemeContextType>;
|
|
22
|
+
/**
|
|
23
|
+
* #### Description:
|
|
24
|
+
* This component makes the `theme` available down the React tree.
|
|
25
|
+
* It should preferably be used at **the root of your component tree**.
|
|
26
|
+
* See: https://mui.com/system/styled/
|
|
27
|
+
*
|
|
28
|
+
* @param children
|
|
29
|
+
* @return
|
|
30
|
+
* ```jsx
|
|
31
|
+
* <SCThemeContext.Provider value={{theme, setTheme: setCustomTheme}}>
|
|
32
|
+
* <ThemeProvider theme={theme}>{children}</ThemeProvider>
|
|
33
|
+
* </SCThemeContext.Provider>
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export default function SCThemeProvider({ children }: {
|
|
37
|
+
children: React.ReactNode;
|
|
38
|
+
}): JSX.Element;
|
|
39
|
+
/**
|
|
40
|
+
* Export hoc to inject the base theme to components
|
|
41
|
+
* @param Component
|
|
42
|
+
*/
|
|
43
|
+
export declare const withSCTheme: (Component: any) => (props: any) => JSX.Element;
|
|
44
|
+
/**
|
|
45
|
+
* Let's only export the `useSCTheme` hook instead of the context.
|
|
46
|
+
* We only want to use the hook directly and never the context component.
|
|
47
|
+
*/
|
|
48
|
+
export declare function useSCTheme(): SCThemeContextType;
|
|
49
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/provider/SCThemeProvider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAKjE,OAAO,EAAC,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAKlD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,cAAc,mCAA8D,CAAC;AAE1F;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAC,QAAe,EAAC,EAAE;IAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAC,GAAG,GAAG,CAAC,OAAO,CA4BnG;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,iDAOvB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,UAAU,IAAI,kBAAkB,CAE/C"}
|