@bigbinary/neeto-commons-frontend 3.0.6 → 3.0.7
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/{constants.cjs.js → cjs/constants/index.js} +11 -10
- package/cjs/constants/index.js.map +1 -0
- package/cjs/cypress-utils/commands.js +276 -0
- package/cjs/cypress-utils/commands.js.map +1 -0
- package/cjs/cypress-utils/constants/index.js +14 -0
- package/cjs/cypress-utils/constants/index.js.map +1 -0
- package/cjs/cypress-utils/constants/routes.js +40 -0
- package/cjs/cypress-utils/constants/routes.js.map +1 -0
- package/cjs/cypress-utils/constants/selectors/common.js +103 -0
- package/cjs/cypress-utils/constants/selectors/common.js.map +1 -0
- package/cjs/cypress-utils/constants/selectors/editor.js +29 -0
- package/cjs/cypress-utils/constants/selectors/editor.js.map +1 -0
- package/cjs/cypress-utils/constants/selectors/ipRestriction.js +19 -0
- package/cjs/cypress-utils/constants/selectors/ipRestriction.js.map +1 -0
- package/cjs/cypress-utils/constants/selectors/login.js +21 -0
- package/cjs/cypress-utils/constants/selectors/login.js.map +1 -0
- package/cjs/cypress-utils/constants/selectors/member.js +65 -0
- package/cjs/cypress-utils/constants/selectors/member.js.map +1 -0
- package/cjs/cypress-utils/constants/selectors/navigation.js +28 -0
- package/cjs/cypress-utils/constants/selectors/navigation.js.map +1 -0
- package/cjs/cypress-utils/constants/selectors/roles.js +24 -0
- package/cjs/cypress-utils/constants/selectors/roles.js.map +1 -0
- package/cjs/cypress-utils/constants/selectors/signUp.js +23 -0
- package/cjs/cypress-utils/constants/selectors/signUp.js.map +1 -0
- package/cjs/cypress-utils/constants/selectors/tags.js +31 -0
- package/cjs/cypress-utils/constants/selectors/tags.js.map +1 -0
- package/cjs/cypress-utils/constants/texts/common.js +40 -0
- package/cjs/cypress-utils/constants/texts/common.js.map +1 -0
- package/cjs/cypress-utils/constants/texts/member.js +68 -0
- package/cjs/cypress-utils/constants/texts/member.js.map +1 -0
- package/cjs/cypress-utils/constants/texts/navigation.js +24 -0
- package/cjs/cypress-utils/constants/texts/navigation.js.map +1 -0
- package/cjs/cypress-utils/constants/texts/roles.js +25 -0
- package/cjs/cypress-utils/constants/texts/roles.js.map +1 -0
- package/cjs/cypress-utils/constants/texts/signUp.js +14 -0
- package/cjs/cypress-utils/constants/texts/signUp.js.map +1 -0
- package/cjs/cypress-utils/constants/texts/tags.js +28 -0
- package/cjs/cypress-utils/constants/texts/tags.js.map +1 -0
- package/cjs/cypress-utils/fixtures/fake.js +177 -0
- package/cjs/cypress-utils/fixtures/fake.js.map +1 -0
- package/cjs/cypress-utils/index.js +226 -0
- package/cjs/cypress-utils/index.js.map +1 -0
- package/cjs/cypress-utils/utils/authentication.js +45 -0
- package/cjs/cypress-utils/utils/authentication.js.map +1 -0
- package/cjs/cypress-utils/utils/common.js +92 -0
- package/cjs/cypress-utils/utils/common.js.map +1 -0
- package/cjs/cypress-utils/utils/date.js +28 -0
- package/cjs/cypress-utils/utils/date.js.map +1 -0
- package/cjs/cypress-utils/utils/email.js +165 -0
- package/cjs/cypress-utils/utils/email.js.map +1 -0
- package/cjs/cypress-utils/utils/member.js +352 -0
- package/cjs/cypress-utils/utils/member.js.map +1 -0
- package/cjs/cypress-utils/utils/navigation.js +208 -0
- package/cjs/cypress-utils/utils/navigation.js.map +1 -0
- package/cjs/cypress-utils/utils/organization.js +109 -0
- package/cjs/cypress-utils/utils/organization.js.map +1 -0
- package/cjs/cypress-utils/utils/validation.js +17 -0
- package/cjs/cypress-utils/utils/validation.js.map +1 -0
- package/cjs/initializers/axios/index.js +199 -0
- package/cjs/initializers/axios/index.js.map +1 -0
- package/cjs/initializers/axios/paramsSerializer.js +27 -0
- package/cjs/initializers/axios/paramsSerializer.js.map +1 -0
- package/cjs/initializers/constants.js +17 -0
- package/cjs/initializers/constants.js.map +1 -0
- package/cjs/initializers/globalProps.js +15 -0
- package/cjs/initializers/globalProps.js.map +1 -0
- package/cjs/initializers/i18n.js +68 -0
- package/cjs/initializers/i18n.js.map +1 -0
- package/cjs/initializers/index.js +51 -0
- package/cjs/initializers/index.js.map +1 -0
- package/cjs/initializers/logger.js +17 -0
- package/cjs/initializers/logger.js.map +1 -0
- package/cjs/initializers/reactDevTools.js +26 -0
- package/cjs/initializers/reactDevTools.js.map +1 -0
- package/cjs/initializers/utils/customFormatters.js +43 -0
- package/cjs/initializers/utils/customFormatters.js.map +1 -0
- package/cjs/initializers/utils/customPostProcessors.js +21 -0
- package/cjs/initializers/utils/customPostProcessors.js.map +1 -0
- package/cjs/initializers/utils.js +37 -0
- package/cjs/initializers/utils.js.map +1 -0
- package/cjs/react-utils/BrowserPushNotifications/devices.js +26 -0
- package/cjs/react-utils/BrowserPushNotifications/devices.js.map +1 -0
- package/cjs/react-utils/BrowserPushNotifications/index.js +19 -0
- package/cjs/react-utils/BrowserPushNotifications/index.js.map +1 -0
- package/cjs/react-utils/BrowserPushNotifications/pushHelper.js +116 -0
- package/cjs/react-utils/BrowserPushNotifications/pushHelper.js.map +1 -0
- package/cjs/react-utils/BrowserPushNotifications/registerServiceWorker.js +146 -0
- package/cjs/react-utils/BrowserPushNotifications/registerServiceWorker.js.map +1 -0
- package/cjs/react-utils/HoneybadgerErrorBoundary/FallbackComponent.js +153 -0
- package/cjs/react-utils/HoneybadgerErrorBoundary/FallbackComponent.js.map +1 -0
- package/cjs/react-utils/HoneybadgerErrorBoundary/constants.js +9 -0
- package/cjs/react-utils/HoneybadgerErrorBoundary/constants.js.map +1 -0
- package/cjs/react-utils/HoneybadgerErrorBoundary/index.js +59 -0
- package/cjs/react-utils/HoneybadgerErrorBoundary/index.js.map +1 -0
- package/cjs/react-utils/HoneybadgerErrorBoundary/utils.js +17 -0
- package/cjs/react-utils/HoneybadgerErrorBoundary/utils.js.map +1 -0
- package/cjs/react-utils/PrivateRoute.js +80 -0
- package/cjs/react-utils/PrivateRoute.js.map +1 -0
- package/cjs/react-utils/constants/constants.js +11 -0
- package/cjs/react-utils/constants/constants.js.map +1 -0
- package/cjs/react-utils/constants/index.js +28 -0
- package/cjs/react-utils/constants/index.js.map +1 -0
- package/cjs/react-utils/constants/query.js +11 -0
- package/cjs/react-utils/constants/query.js.map +1 -0
- package/cjs/react-utils/index.js +242 -0
- package/cjs/react-utils/index.js.map +1 -0
- package/cjs/react-utils/metaClick.js +16 -0
- package/cjs/react-utils/metaClick.js.map +1 -0
- package/cjs/react-utils/useDebounce.js +28 -0
- package/cjs/react-utils/useDebounce.js.map +1 -0
- package/cjs/react-utils/useDisplayErrorPage.js +23 -0
- package/cjs/react-utils/useDisplayErrorPage.js.map +1 -0
- package/cjs/react-utils/useFetchNeetoApps/apis/neeto_apps.js +17 -0
- package/cjs/react-utils/useFetchNeetoApps/apis/neeto_apps.js.map +1 -0
- package/cjs/react-utils/useFetchNeetoApps/index.js +14 -0
- package/cjs/react-utils/useFetchNeetoApps/index.js.map +1 -0
- package/cjs/react-utils/useFetchNeetoApps/useFetchNeetoApps.js +27 -0
- package/cjs/react-utils/useFetchNeetoApps/useFetchNeetoApps.js.map +1 -0
- package/cjs/react-utils/useFieldSubmit.js +33 -0
- package/cjs/react-utils/useFieldSubmit.js.map +1 -0
- package/cjs/react-utils/useFuncDebounce.js +27 -0
- package/cjs/react-utils/useFuncDebounce.js.map +1 -0
- package/cjs/react-utils/useHotKeys/constants.js +36 -0
- package/cjs/react-utils/useHotKeys/constants.js.map +1 -0
- package/cjs/react-utils/useHotKeys/index.js +14 -0
- package/cjs/react-utils/useHotKeys/index.js.map +1 -0
- package/cjs/react-utils/useHotKeys/useHotKeys.js +65 -0
- package/cjs/react-utils/useHotKeys/useHotKeys.js.map +1 -0
- package/cjs/react-utils/useHotKeys/utils.js +37 -0
- package/cjs/react-utils/useHotKeys/utils.js.map +1 -0
- package/cjs/react-utils/useIsElementVisibleInDom/index.js +14 -0
- package/cjs/react-utils/useIsElementVisibleInDom/index.js.map +1 -0
- package/cjs/react-utils/useIsElementVisibleInDom/useForceUpdate.js +23 -0
- package/cjs/react-utils/useIsElementVisibleInDom/useForceUpdate.js.map +1 -0
- package/cjs/react-utils/useIsElementVisibleInDom/useIsElementVisibleInDom.js +34 -0
- package/cjs/react-utils/useIsElementVisibleInDom/useIsElementVisibleInDom.js.map +1 -0
- package/cjs/react-utils/useKeyboardShortcutsPaneState.js +36 -0
- package/cjs/react-utils/useKeyboardShortcutsPaneState.js.map +1 -0
- package/cjs/react-utils/useLocalStorage.js +39 -0
- package/cjs/react-utils/useLocalStorage.js.map +1 -0
- package/cjs/react-utils/useMutationWithInvalidation.js +33 -0
- package/cjs/react-utils/useMutationWithInvalidation.js.map +1 -0
- package/cjs/react-utils/useOnClickOutside.js +32 -0
- package/cjs/react-utils/useOnClickOutside.js.map +1 -0
- package/cjs/react-utils/usePersistedQuery.js +59 -0
- package/cjs/react-utils/usePersistedQuery.js.map +1 -0
- package/cjs/react-utils/usePrevious.js +17 -0
- package/cjs/react-utils/usePrevious.js.map +1 -0
- package/cjs/react-utils/useQueryParams.js +15 -0
- package/cjs/react-utils/useQueryParams.js.map +1 -0
- package/cjs/react-utils/useRegisterNavigationCheckpoint.js +43 -0
- package/cjs/react-utils/useRegisterNavigationCheckpoint.js.map +1 -0
- package/cjs/react-utils/useStateWithDependency.js +23 -0
- package/cjs/react-utils/useStateWithDependency.js.map +1 -0
- package/cjs/react-utils/useTimer.js +51 -0
- package/cjs/react-utils/useTimer.js.map +1 -0
- package/cjs/react-utils/useUpdateEffect.js +21 -0
- package/cjs/react-utils/useUpdateEffect.js.map +1 -0
- package/cjs/react-utils/withImmutableActions.js +29 -0
- package/cjs/react-utils/withImmutableActions.js.map +1 -0
- package/cjs/react-utils/withT.js +14 -0
- package/cjs/react-utils/withT.js.map +1 -0
- package/cjs/react-utils/withTitle.js +44 -0
- package/cjs/react-utils/withTitle.js.map +1 -0
- package/cjs/utils/axios.js +17 -0
- package/cjs/utils/axios.js.map +1 -0
- package/cjs/utils/createSubscription.js +22 -0
- package/cjs/utils/createSubscription.js.map +1 -0
- package/cjs/utils/currencyFormat.js +50 -0
- package/cjs/utils/currencyFormat.js.map +1 -0
- package/cjs/utils/datetime.js +69 -0
- package/cjs/utils/datetime.js.map +1 -0
- package/cjs/utils/general.js +193 -0
- package/cjs/utils/general.js.map +1 -0
- package/cjs/utils/index.js +72 -0
- package/cjs/utils/index.js.map +1 -0
- package/cjs/utils/permissions.js +25 -0
- package/cjs/utils/permissions.js.map +1 -0
- package/configs/scripts/getPkgTranslations.js +1 -1
- package/configs/scripts/jsdoc-builder/constants.mjs +1 -1
- package/configs/scripts/jsdoc-builder/index.mjs +1 -1
- package/configs/webpack/rules.js +2 -1
- package/constants/index.js +13 -0
- package/constants/index.js.map +1 -0
- package/cypress-utils/commands.js +268 -0
- package/cypress-utils/commands.js.map +1 -0
- package/cypress-utils/constants/index.js +7 -0
- package/cypress-utils/constants/index.js.map +1 -0
- package/cypress-utils/constants/routes.js +33 -0
- package/cypress-utils/constants/routes.js.map +1 -0
- package/cypress-utils/constants/selectors/common.js +94 -0
- package/cypress-utils/constants/selectors/common.js.map +1 -0
- package/cypress-utils/constants/selectors/editor.js +22 -0
- package/cypress-utils/constants/selectors/editor.js.map +1 -0
- package/cypress-utils/constants/selectors/ipRestriction.js +12 -0
- package/cypress-utils/constants/selectors/ipRestriction.js.map +1 -0
- package/cypress-utils/constants/selectors/login.js +14 -0
- package/cypress-utils/constants/selectors/login.js.map +1 -0
- package/cypress-utils/constants/selectors/member.js +56 -0
- package/cypress-utils/constants/selectors/member.js.map +1 -0
- package/cypress-utils/constants/selectors/navigation.js +20 -0
- package/cypress-utils/constants/selectors/navigation.js.map +1 -0
- package/cypress-utils/constants/selectors/roles.js +17 -0
- package/cypress-utils/constants/selectors/roles.js.map +1 -0
- package/cypress-utils/constants/selectors/signUp.js +16 -0
- package/cypress-utils/constants/selectors/signUp.js.map +1 -0
- package/cypress-utils/constants/selectors/tags.js +23 -0
- package/cypress-utils/constants/selectors/tags.js.map +1 -0
- package/cypress-utils/constants/texts/common.js +33 -0
- package/cypress-utils/constants/texts/common.js.map +1 -0
- package/cypress-utils/constants/texts/member.js +59 -0
- package/cypress-utils/constants/texts/member.js.map +1 -0
- package/cypress-utils/constants/texts/navigation.js +16 -0
- package/cypress-utils/constants/texts/navigation.js.map +1 -0
- package/cypress-utils/constants/texts/roles.js +18 -0
- package/cypress-utils/constants/texts/roles.js.map +1 -0
- package/cypress-utils/constants/texts/signUp.js +7 -0
- package/cypress-utils/constants/texts/signUp.js.map +1 -0
- package/cypress-utils/constants/texts/tags.js +21 -0
- package/cypress-utils/constants/texts/tags.js.map +1 -0
- package/cypress-utils/fixtures/fake.js +171 -0
- package/cypress-utils/fixtures/fake.js.map +1 -0
- package/cypress-utils/index.js +21 -0
- package/cypress-utils/index.js.map +1 -0
- package/cypress-utils/utils/authentication.js +38 -0
- package/cypress-utils/utils/authentication.js.map +1 -0
- package/cypress-utils/utils/common.js +75 -0
- package/cypress-utils/utils/common.js.map +1 -0
- package/cypress-utils/utils/date.js +20 -0
- package/cypress-utils/utils/date.js.map +1 -0
- package/cypress-utils/utils/email.js +156 -0
- package/cypress-utils/utils/email.js.map +1 -0
- package/cypress-utils/utils/member.js +344 -0
- package/cypress-utils/utils/member.js.map +1 -0
- package/cypress-utils/utils/navigation.js +200 -0
- package/cypress-utils/utils/navigation.js.map +1 -0
- package/cypress-utils/utils/organization.js +102 -0
- package/cypress-utils/utils/organization.js.map +1 -0
- package/cypress-utils/utils/validation.js +10 -0
- package/cypress-utils/utils/validation.js.map +1 -0
- package/initializers/axios/index.js +192 -0
- package/initializers/axios/index.js.map +1 -0
- package/initializers/axios/paramsSerializer.js +18 -0
- package/initializers/axios/paramsSerializer.js.map +1 -0
- package/initializers/constants.js +8 -0
- package/initializers/constants.js.map +1 -0
- package/initializers/globalProps.js +8 -0
- package/initializers/globalProps.js.map +1 -0
- package/initializers/i18n.js +61 -0
- package/initializers/i18n.js.map +1 -0
- package/initializers/index.js +28 -0
- package/initializers/index.js.map +1 -0
- package/initializers/logger.js +10 -0
- package/initializers/logger.js.map +1 -0
- package/initializers/reactDevTools.js +19 -0
- package/initializers/reactDevTools.js.map +1 -0
- package/initializers/utils/customFormatters.js +34 -0
- package/initializers/utils/customFormatters.js.map +1 -0
- package/initializers/utils/customPostProcessors.js +14 -0
- package/initializers/utils/customPostProcessors.js.map +1 -0
- package/initializers/utils.js +29 -0
- package/initializers/utils.js.map +1 -0
- package/package.json +51 -158
- package/pure.d.ts +384 -0
- package/react-utils/BrowserPushNotifications/devices.js +18 -0
- package/react-utils/BrowserPushNotifications/devices.js.map +1 -0
- package/react-utils/BrowserPushNotifications/index.js +1 -0
- package/react-utils/BrowserPushNotifications/index.js.map +1 -0
- package/react-utils/BrowserPushNotifications/pushHelper.js +107 -0
- package/react-utils/BrowserPushNotifications/pushHelper.js.map +1 -0
- package/react-utils/BrowserPushNotifications/registerServiceWorker.js +137 -0
- package/react-utils/BrowserPushNotifications/registerServiceWorker.js.map +1 -0
- package/react-utils/HoneybadgerErrorBoundary/FallbackComponent.js +144 -0
- package/react-utils/HoneybadgerErrorBoundary/FallbackComponent.js.map +1 -0
- package/react-utils/HoneybadgerErrorBoundary/constants.js +1 -0
- package/react-utils/HoneybadgerErrorBoundary/constants.js.map +1 -0
- package/react-utils/HoneybadgerErrorBoundary/index.js +52 -0
- package/react-utils/HoneybadgerErrorBoundary/index.js.map +1 -0
- package/react-utils/HoneybadgerErrorBoundary/utils.js +9 -0
- package/react-utils/HoneybadgerErrorBoundary/utils.js.map +1 -0
- package/react-utils/PrivateRoute.js +72 -0
- package/react-utils/PrivateRoute.js.map +1 -0
- package/react-utils/constants/constants.js +3 -0
- package/react-utils/constants/constants.js.map +1 -0
- package/react-utils/constants/index.js +3 -0
- package/react-utils/constants/index.js.map +1 -0
- package/react-utils/constants/query.js +4 -0
- package/react-utils/constants/query.js.map +1 -0
- package/react-utils/index.js +33 -0
- package/react-utils/index.js.map +1 -0
- package/react-utils/metaClick.js +8 -0
- package/react-utils/metaClick.js.map +1 -0
- package/react-utils/useDebounce.js +20 -0
- package/react-utils/useDebounce.js.map +1 -0
- package/react-utils/useDisplayErrorPage.js +15 -0
- package/react-utils/useDisplayErrorPage.js.map +1 -0
- package/react-utils/useFetchNeetoApps/apis/neeto_apps.js +9 -0
- package/react-utils/useFetchNeetoApps/apis/neeto_apps.js.map +1 -0
- package/react-utils/useFetchNeetoApps/index.js +1 -0
- package/react-utils/useFetchNeetoApps/index.js.map +1 -0
- package/react-utils/useFetchNeetoApps/useFetchNeetoApps.js +19 -0
- package/react-utils/useFetchNeetoApps/useFetchNeetoApps.js.map +1 -0
- package/react-utils/useFieldSubmit.js +26 -0
- package/react-utils/useFieldSubmit.js.map +1 -0
- package/react-utils/useFuncDebounce.js +20 -0
- package/react-utils/useFuncDebounce.js.map +1 -0
- package/react-utils/useHotKeys/constants.js +25 -0
- package/react-utils/useHotKeys/constants.js.map +1 -0
- package/react-utils/useHotKeys/index.js +1 -0
- package/react-utils/useHotKeys/index.js.map +1 -0
- package/react-utils/useHotKeys/useHotKeys.js +57 -0
- package/react-utils/useHotKeys/useHotKeys.js.map +1 -0
- package/react-utils/useHotKeys/utils.js +29 -0
- package/react-utils/useHotKeys/utils.js.map +1 -0
- package/react-utils/useIsElementVisibleInDom/index.js +1 -0
- package/react-utils/useIsElementVisibleInDom/index.js.map +1 -0
- package/react-utils/useIsElementVisibleInDom/useForceUpdate.js +15 -0
- package/react-utils/useIsElementVisibleInDom/useForceUpdate.js.map +1 -0
- package/react-utils/useIsElementVisibleInDom/useIsElementVisibleInDom.js +26 -0
- package/react-utils/useIsElementVisibleInDom/useIsElementVisibleInDom.js.map +1 -0
- package/react-utils/useKeyboardShortcutsPaneState.js +29 -0
- package/react-utils/useKeyboardShortcutsPaneState.js.map +1 -0
- package/react-utils/useLocalStorage.js +31 -0
- package/react-utils/useLocalStorage.js.map +1 -0
- package/react-utils/useMutationWithInvalidation.js +25 -0
- package/react-utils/useMutationWithInvalidation.js.map +1 -0
- package/react-utils/useOnClickOutside.js +25 -0
- package/react-utils/useOnClickOutside.js.map +1 -0
- package/react-utils/usePersistedQuery.js +51 -0
- package/react-utils/usePersistedQuery.js.map +1 -0
- package/react-utils/usePrevious.js +10 -0
- package/react-utils/usePrevious.js.map +1 -0
- package/react-utils/useQueryParams.js +8 -0
- package/react-utils/useQueryParams.js.map +1 -0
- package/react-utils/useRegisterNavigationCheckpoint.js +35 -0
- package/react-utils/useRegisterNavigationCheckpoint.js.map +1 -0
- package/react-utils/useStateWithDependency.js +15 -0
- package/react-utils/useStateWithDependency.js.map +1 -0
- package/react-utils/useTimer.js +43 -0
- package/react-utils/useTimer.js.map +1 -0
- package/react-utils/useUpdateEffect.js +14 -0
- package/react-utils/useUpdateEffect.js.map +1 -0
- package/react-utils/withImmutableActions.js +22 -0
- package/react-utils/withImmutableActions.js.map +1 -0
- package/react-utils/withT.js +7 -0
- package/react-utils/withT.js.map +1 -0
- package/react-utils/withTitle.js +36 -0
- package/react-utils/withTitle.js.map +1 -0
- package/react-utils.d.ts +14 -2
- package/utils/axios.js +10 -0
- package/utils/axios.js.map +1 -0
- package/utils/createSubscription.js +15 -0
- package/utils/createSubscription.js.map +1 -0
- package/utils/currencyFormat.js +42 -0
- package/utils/currencyFormat.js.map +1 -0
- package/utils/datetime.js +60 -0
- package/utils/datetime.js.map +1 -0
- package/utils/general.js +172 -0
- package/utils/general.js.map +1 -0
- package/utils/index.js +7 -0
- package/utils/index.js.map +1 -0
- package/utils/permissions.js +16 -0
- package/utils/permissions.js.map +1 -0
- package/utils.d.ts +18 -2
- package/README.md +0 -173
- package/constants.cjs.js.map +0 -1
- package/constants.js +0 -15
- package/constants.js.map +0 -1
- package/cypress-utils.cjs.js +0 -1819
- package/cypress-utils.cjs.js.map +0 -1
- package/cypress-utils.js +0 -1773
- package/cypress-utils.js.map +0 -1
- package/initializers.cjs.js +0 -2648
- package/initializers.cjs.js.map +0 -1
- package/initializers.js +0 -2634
- package/initializers.js.map +0 -1
- package/react-utils.cjs.js +0 -4915
- package/react-utils.cjs.js.map +0 -1
- package/react-utils.js +0 -4860
- package/react-utils.js.map +0 -1
- package/utils.cjs.js +0 -1280
- package/utils.cjs.js.map +0 -1
- package/utils.js +0 -1248
- package/utils.js.map +0 -1
- /package/{src/translations → translations}/en.json +0 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
3
|
+
import axios from "axios";
|
|
4
|
+
import i18next from "i18next";
|
|
5
|
+
import { keysToCamelCase, matches, serializeKeysToSnakeCase } from "@bigbinary/neeto-cist";
|
|
6
|
+
import { useErrorDisplayStore } from "@bigbinary/neeto-commons-frontend/react-utils";
|
|
7
|
+
import { resetAuthTokens } from "@bigbinary/neeto-commons-frontend/utils";
|
|
8
|
+
import { Toastr } from "@bigbinary/neetoui";
|
|
9
|
+
import { evolve, omit, values } from "ramda";
|
|
10
|
+
import setParamsSerializer from "./paramsSerializer";
|
|
11
|
+
import { HEADERS_KEYS } from "../constants";
|
|
12
|
+
var shouldNot = function shouldNot(skip) {
|
|
13
|
+
return _typeof(skip) === "object" || !skip;
|
|
14
|
+
};
|
|
15
|
+
var shouldShowToastr = function shouldShowToastr(response) {
|
|
16
|
+
return typeof response === "string" || _typeof(response) === "object" && ((response === null || response === void 0 ? void 0 : response.notice) || (response === null || response === void 0 ? void 0 : response.noticeCode));
|
|
17
|
+
};
|
|
18
|
+
var setAuthHeaders = function setAuthHeaders() {
|
|
19
|
+
var _document$querySelect, _axios$defaults$heade;
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
axios.defaults.headers = (_axios$defaults$heade = {}, _defineProperty(_axios$defaults$heade, HEADERS_KEYS.accept, "application/json"), _defineProperty(_axios$defaults$heade, HEADERS_KEYS.contentType, "application/json"), _defineProperty(_axios$defaults$heade, HEADERS_KEYS.xCsrfToken, (_document$querySelect = document.querySelector('[name="csrf-token"]')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.getAttribute("content")), _axios$defaults$heade);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// pipe function from ramda doesn't accept array of functions.
|
|
25
|
+
// We can't use spread operator too. So this is a workaround.
|
|
26
|
+
var createPipe = function createPipe(functions) {
|
|
27
|
+
return function (data) {
|
|
28
|
+
return functions.reduce(function (acc, fn) {
|
|
29
|
+
return fn(acc);
|
|
30
|
+
}, data);
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
var transformResponseKeysToCamelCase = function transformResponseKeysToCamelCase(response) {
|
|
34
|
+
var _response$config$tran = response.config.transformResponseCase,
|
|
35
|
+
transformResponseCase = _response$config$tran === void 0 ? true : _response$config$tran;
|
|
36
|
+
if (response.data && transformResponseCase) {
|
|
37
|
+
response.data = keysToCamelCase(response.data);
|
|
38
|
+
}
|
|
39
|
+
return response;
|
|
40
|
+
};
|
|
41
|
+
var transformErrorKeysToCamelCase = function transformErrorKeysToCamelCase(error) {
|
|
42
|
+
var _error$config, _error$response;
|
|
43
|
+
var _ref = (_error$config = error.config) !== null && _error$config !== void 0 ? _error$config : {},
|
|
44
|
+
_ref$transformRespons = _ref.transformResponseCase,
|
|
45
|
+
transformResponseCase = _ref$transformRespons === void 0 ? true : _ref$transformRespons;
|
|
46
|
+
if ((_error$response = error.response) !== null && _error$response !== void 0 && _error$response.data && transformResponseCase) {
|
|
47
|
+
error.response.data = keysToCamelCase(error.response.data);
|
|
48
|
+
}
|
|
49
|
+
return error;
|
|
50
|
+
};
|
|
51
|
+
var showSuccessToastr = function showSuccessToastr(response) {
|
|
52
|
+
var _response$config$show = response.config.showToastr,
|
|
53
|
+
showToastr = _response$config$show === void 0 ? true : _response$config$show;
|
|
54
|
+
if (!showToastr) return response;
|
|
55
|
+
if (matches({
|
|
56
|
+
showThumbsUpToastr: true
|
|
57
|
+
}, response.data)) {
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
Toastr.success("", {
|
|
60
|
+
icon: "👍",
|
|
61
|
+
className: "w-20"
|
|
62
|
+
});
|
|
63
|
+
} else if (matches({
|
|
64
|
+
noticeCode: "thumbs_up"
|
|
65
|
+
}, response.data)) {
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
Toastr.success("", {
|
|
68
|
+
icon: "👍",
|
|
69
|
+
className: "w-20"
|
|
70
|
+
});
|
|
71
|
+
} else if (shouldShowToastr(response.data)) {
|
|
72
|
+
Toastr.success(response.data);
|
|
73
|
+
}
|
|
74
|
+
return response;
|
|
75
|
+
};
|
|
76
|
+
var pullDataFromResponse = function pullDataFromResponse(response) {
|
|
77
|
+
var _response$config$incl = response.config.includeMetadataInResponse,
|
|
78
|
+
includeMetadataInResponse = _response$config$incl === void 0 ? false : _response$config$incl;
|
|
79
|
+
return includeMetadataInResponse ? response : response.data;
|
|
80
|
+
};
|
|
81
|
+
var buildSuccessResponseHandler = function buildSuccessResponseHandler(skip) {
|
|
82
|
+
var interceptors = [];
|
|
83
|
+
if (!(skip !== null && skip !== void 0 && skip.transformCase)) interceptors.push(transformResponseKeysToCamelCase);
|
|
84
|
+
if (!(skip !== null && skip !== void 0 && skip.showToastr)) interceptors.push(showSuccessToastr);
|
|
85
|
+
if (!(skip !== null && skip !== void 0 && skip.pullDataFromResponse)) interceptors.push(pullDataFromResponse);
|
|
86
|
+
return createPipe(interceptors);
|
|
87
|
+
};
|
|
88
|
+
var handleUnauthorizedErrorResponse = function handleUnauthorizedErrorResponse(error) {
|
|
89
|
+
var _error$response2, _error$config2;
|
|
90
|
+
if (((_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.status) !== 401) return error;
|
|
91
|
+
resetAuthTokens();
|
|
92
|
+
var _ref2 = (_error$config2 = error.config) !== null && _error$config2 !== void 0 ? _error$config2 : {},
|
|
93
|
+
_ref2$redirectOnError = _ref2.redirectOnError,
|
|
94
|
+
redirectOnError = _ref2$redirectOnError === void 0 ? true : _ref2$redirectOnError;
|
|
95
|
+
if (redirectOnError) {
|
|
96
|
+
setTimeout(function () {
|
|
97
|
+
var redirectTo = window.location.pathname === "/login" ? "/login" : "/login?redirect_uri=".concat(encodeURIComponent(window.location.href));
|
|
98
|
+
// eslint-disable-next-line xss/no-location-href-assign
|
|
99
|
+
window.location.href = redirectTo;
|
|
100
|
+
}, 300);
|
|
101
|
+
}
|
|
102
|
+
return error;
|
|
103
|
+
};
|
|
104
|
+
var showErrorToastr = function showErrorToastr(error) {
|
|
105
|
+
var _error$config3, _error$response3;
|
|
106
|
+
var _ref3 = (_error$config3 = error.config) !== null && _error$config3 !== void 0 ? _error$config3 : {},
|
|
107
|
+
_ref3$showToastr = _ref3.showToastr,
|
|
108
|
+
showToastr = _ref3$showToastr === void 0 ? true : _ref3$showToastr;
|
|
109
|
+
if (!showToastr) return error;
|
|
110
|
+
if (error.message === "Network Error") {
|
|
111
|
+
// @ts-ignore
|
|
112
|
+
Toastr.error(i18next.t("neetoCommons.toastr.error.networkError"));
|
|
113
|
+
} else if (![403, 404].includes((_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.status) && !axios.isCancel(error)) {
|
|
114
|
+
// we already display a page in case of 403 & 404 and we don't want to show a toastr for cancelled requests.
|
|
115
|
+
Toastr.error(error);
|
|
116
|
+
}
|
|
117
|
+
return error;
|
|
118
|
+
};
|
|
119
|
+
var getUrlPathName = function getUrlPathName(url) {
|
|
120
|
+
try {
|
|
121
|
+
return new URL(url).pathname;
|
|
122
|
+
} catch (_unused) {
|
|
123
|
+
return url;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
var handle404ErrorResponse = function handle404ErrorResponse(error) {
|
|
127
|
+
var _error$config4, _error$response4;
|
|
128
|
+
var _ref4 = (_error$config4 = error.config) !== null && _error$config4 !== void 0 ? _error$config4 : {},
|
|
129
|
+
_ref4$show404ErrorPag = _ref4.show404ErrorPage,
|
|
130
|
+
show404ErrorPage = _ref4$show404ErrorPag === void 0 ? true : _ref4$show404ErrorPag,
|
|
131
|
+
_ref4$show403ErrorPag = _ref4.show403ErrorPage,
|
|
132
|
+
show403ErrorPage = _ref4$show403ErrorPag === void 0 ? true : _ref4$show403ErrorPag;
|
|
133
|
+
var status = (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : _error$response4.status;
|
|
134
|
+
if (status === 404 && show404ErrorPage || status === 403 && show403ErrorPage) {
|
|
135
|
+
var _error$request;
|
|
136
|
+
var fullUrl = ((_error$request = error.request) === null || _error$request === void 0 ? void 0 : _error$request.responseURL) || error.config.url;
|
|
137
|
+
useErrorDisplayStore.setState({
|
|
138
|
+
showErrorPage: true,
|
|
139
|
+
statusCode: status,
|
|
140
|
+
failedApiUrl: fullUrl,
|
|
141
|
+
failedApiPath: getUrlPathName(fullUrl)
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
return error;
|
|
145
|
+
};
|
|
146
|
+
var buildErrorResponseHandler = function buildErrorResponseHandler(skip) {
|
|
147
|
+
var interceptors = [];
|
|
148
|
+
if (!(skip !== null && skip !== void 0 && skip.transformCase)) interceptors.push(transformErrorKeysToCamelCase);
|
|
149
|
+
if (!(skip !== null && skip !== void 0 && skip.show404ErrorPage)) interceptors.push(handle404ErrorResponse);
|
|
150
|
+
if (!(skip !== null && skip !== void 0 && skip.logoutOn401)) interceptors.push(handleUnauthorizedErrorResponse);
|
|
151
|
+
if (!(skip !== null && skip !== void 0 && skip.showToastr)) interceptors.push(showErrorToastr);
|
|
152
|
+
interceptors.push(Promise.reject.bind(Promise));
|
|
153
|
+
return createPipe(interceptors);
|
|
154
|
+
};
|
|
155
|
+
var cleanupCredentialsForCrossOrigin = function cleanupCredentialsForCrossOrigin(request) {
|
|
156
|
+
if (!request.url.includes("://")) return request;
|
|
157
|
+
if (request.url.includes(window.location.hostname)) return request;
|
|
158
|
+
return evolve({
|
|
159
|
+
headers: omit(values(HEADERS_KEYS))
|
|
160
|
+
})(request);
|
|
161
|
+
};
|
|
162
|
+
var transformDataToSnakeCase = function transformDataToSnakeCase(request) {
|
|
163
|
+
var _request$transformReq = request.transformRequestCase,
|
|
164
|
+
transformRequestCase = _request$transformReq === void 0 ? true : _request$transformReq;
|
|
165
|
+
if (!transformRequestCase) return request;
|
|
166
|
+
return evolve({
|
|
167
|
+
data: serializeKeysToSnakeCase,
|
|
168
|
+
params: serializeKeysToSnakeCase
|
|
169
|
+
}, request);
|
|
170
|
+
};
|
|
171
|
+
var addRequestInterceptors = function addRequestInterceptors(skip) {
|
|
172
|
+
if (!(skip !== null && skip !== void 0 && skip.cleanCredentialsForCrossOrigin)) {
|
|
173
|
+
axios.interceptors.request.use(cleanupCredentialsForCrossOrigin);
|
|
174
|
+
}
|
|
175
|
+
if (!(skip !== null && skip !== void 0 && skip.transformCase)) {
|
|
176
|
+
axios.interceptors.request.use(transformDataToSnakeCase);
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
var addResponseInterceptors = function addResponseInterceptors(skip) {
|
|
180
|
+
axios.interceptors.response.use(buildSuccessResponseHandler(skip), buildErrorResponseHandler(skip));
|
|
181
|
+
};
|
|
182
|
+
var registerIntercepts = function registerIntercepts(skip) {
|
|
183
|
+
if (shouldNot(skip === null || skip === void 0 ? void 0 : skip.request)) addRequestInterceptors(skip === null || skip === void 0 ? void 0 : skip.request);
|
|
184
|
+
if (shouldNot(skip === null || skip === void 0 ? void 0 : skip.response)) addResponseInterceptors(skip === null || skip === void 0 ? void 0 : skip.response);
|
|
185
|
+
};
|
|
186
|
+
export default function initializeAxios(skip) {
|
|
187
|
+
if (!(skip !== null && skip !== void 0 && skip.baseURL)) axios.defaults.baseURL = "/";
|
|
188
|
+
if (!(skip !== null && skip !== void 0 && skip.authHeaders)) setAuthHeaders();
|
|
189
|
+
if (!(skip !== null && skip !== void 0 && skip.paramsSerializer)) setParamsSerializer();
|
|
190
|
+
if (shouldNot(skip === null || skip === void 0 ? void 0 : skip.interceptors)) registerIntercepts(skip === null || skip === void 0 ? void 0 : skip.interceptors);
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["axios","i18next","keysToCamelCase","matches","serializeKeysToSnakeCase","useErrorDisplayStore","resetAuthTokens","Toastr","evolve","omit","values","setParamsSerializer","HEADERS_KEYS","shouldNot","skip","_typeof","shouldShowToastr","response","notice","noticeCode","setAuthHeaders","_document$querySelect","_axios$defaults$heade","defaults","headers","_defineProperty","accept","contentType","xCsrfToken","document","querySelector","getAttribute","createPipe","functions","data","reduce","acc","fn","transformResponseKeysToCamelCase","_response$config$tran","config","transformResponseCase","transformErrorKeysToCamelCase","error","_error$config","_error$response","_ref","_ref$transformRespons","showSuccessToastr","_response$config$show","showToastr","showThumbsUpToastr","success","icon","className","pullDataFromResponse","_response$config$incl","includeMetadataInResponse","buildSuccessResponseHandler","interceptors","transformCase","push","handleUnauthorizedErrorResponse","_error$response2","_error$config2","status","_ref2","_ref2$redirectOnError","redirectOnError","setTimeout","redirectTo","window","location","pathname","concat","encodeURIComponent","href","showErrorToastr","_error$config3","_error$response3","_ref3","_ref3$showToastr","message","t","includes","isCancel","getUrlPathName","url","URL","_unused","handle404ErrorResponse","_error$config4","_error$response4","_ref4","_ref4$show404ErrorPag","show404ErrorPage","_ref4$show403ErrorPag","show403ErrorPage","_error$request","fullUrl","request","responseURL","setState","showErrorPage","statusCode","failedApiUrl","failedApiPath","buildErrorResponseHandler","logoutOn401","Promise","reject","bind","cleanupCredentialsForCrossOrigin","hostname","transformDataToSnakeCase","_request$transformReq","transformRequestCase","params","addRequestInterceptors","cleanCredentialsForCrossOrigin","use","addResponseInterceptors","registerIntercepts","initializeAxios","baseURL","authHeaders","paramsSerializer"],"sources":["../../../src/initializers/axios/index.js"],"sourcesContent":["import axios from \"axios\";\nimport i18next from \"i18next\";\nimport { keysToCamelCase, matches, serializeKeysToSnakeCase } from \"neetocist\";\nimport { useErrorDisplayStore } from \"neetocommons/react-utils\";\nimport { resetAuthTokens } from \"neetocommons/utils\";\nimport { Toastr } from \"neetoui\";\nimport { evolve, omit, values } from \"ramda\";\n\nimport setParamsSerializer from \"./paramsSerializer\";\n\nimport { HEADERS_KEYS } from \"../constants\";\n\nconst shouldNot = skip => typeof skip === \"object\" || !skip;\n\nconst shouldShowToastr = response =>\n typeof response === \"string\" ||\n (typeof response === \"object\" && (response?.notice || response?.noticeCode));\n\nconst setAuthHeaders = () => {\n // @ts-ignore\n axios.defaults.headers = {\n [HEADERS_KEYS.accept]: \"application/json\",\n [HEADERS_KEYS.contentType]: \"application/json\",\n [HEADERS_KEYS.xCsrfToken]: document\n .querySelector('[name=\"csrf-token\"]')\n ?.getAttribute(\"content\"),\n };\n};\n\n// pipe function from ramda doesn't accept array of functions.\n// We can't use spread operator too. So this is a workaround.\nconst createPipe = functions => data =>\n functions.reduce((acc, fn) => fn(acc), data);\n\nconst transformResponseKeysToCamelCase = response => {\n const { transformResponseCase = true } = response.config;\n\n if (response.data && transformResponseCase) {\n response.data = keysToCamelCase(response.data);\n }\n\n return response;\n};\n\nconst transformErrorKeysToCamelCase = error => {\n const { transformResponseCase = true } = error.config ?? {};\n\n if (error.response?.data && transformResponseCase) {\n error.response.data = keysToCamelCase(error.response.data);\n }\n\n return error;\n};\n\nconst showSuccessToastr = response => {\n const { showToastr = true } = response.config;\n if (!showToastr) return response;\n\n if (matches({ showThumbsUpToastr: true }, response.data)) {\n // @ts-ignore\n Toastr.success(\"\", { icon: \"👍\", className: \"w-20\" });\n } else if (matches({ noticeCode: \"thumbs_up\" }, response.data)) {\n // @ts-ignore\n Toastr.success(\"\", { icon: \"👍\", className: \"w-20\" });\n } else if (shouldShowToastr(response.data)) {\n Toastr.success(response.data);\n }\n\n return response;\n};\n\nconst pullDataFromResponse = response => {\n const { includeMetadataInResponse = false } = response.config;\n\n return includeMetadataInResponse ? response : response.data;\n};\n\nconst buildSuccessResponseHandler = skip => {\n const interceptors = [];\n if (!skip?.transformCase) interceptors.push(transformResponseKeysToCamelCase);\n\n if (!skip?.showToastr) interceptors.push(showSuccessToastr);\n\n if (!skip?.pullDataFromResponse) interceptors.push(pullDataFromResponse);\n\n return createPipe(interceptors);\n};\n\nconst handleUnauthorizedErrorResponse = error => {\n if (error.response?.status !== 401) return error;\n\n resetAuthTokens();\n\n const { redirectOnError = true } = error.config ?? {};\n if (redirectOnError) {\n setTimeout(() => {\n const redirectTo =\n window.location.pathname === \"/login\"\n ? \"/login\"\n : `/login?redirect_uri=${encodeURIComponent(window.location.href)}`;\n // eslint-disable-next-line xss/no-location-href-assign\n window.location.href = redirectTo;\n }, 300);\n }\n\n return error;\n};\n\nconst showErrorToastr = error => {\n const { showToastr = true } = error.config ?? {};\n if (!showToastr) return error;\n\n if (error.message === \"Network Error\") {\n // @ts-ignore\n Toastr.error(i18next.t(\"neetoCommons.toastr.error.networkError\"));\n } else if (\n ![403, 404].includes(error.response?.status) &&\n !axios.isCancel(error)\n ) {\n // we already display a page in case of 403 & 404 and we don't want to show a toastr for cancelled requests.\n Toastr.error(error);\n }\n\n return error;\n};\n\nconst getUrlPathName = url => {\n try {\n return new URL(url).pathname;\n } catch {\n return url;\n }\n};\n\nconst handle404ErrorResponse = error => {\n const { show404ErrorPage = true, show403ErrorPage = true } =\n error.config ?? {};\n\n const status = error.response?.status;\n if (\n (status === 404 && show404ErrorPage) ||\n (status === 403 && show403ErrorPage)\n ) {\n const fullUrl = error.request?.responseURL || error.config.url;\n useErrorDisplayStore.setState({\n showErrorPage: true,\n statusCode: status,\n failedApiUrl: fullUrl,\n failedApiPath: getUrlPathName(fullUrl),\n });\n }\n\n return error;\n};\n\nconst buildErrorResponseHandler = skip => {\n const interceptors = [];\n if (!skip?.transformCase) interceptors.push(transformErrorKeysToCamelCase);\n\n if (!skip?.show404ErrorPage) interceptors.push(handle404ErrorResponse);\n\n if (!skip?.logoutOn401) interceptors.push(handleUnauthorizedErrorResponse);\n\n if (!skip?.showToastr) interceptors.push(showErrorToastr);\n\n interceptors.push(Promise.reject.bind(Promise));\n\n return createPipe(interceptors);\n};\n\nconst cleanupCredentialsForCrossOrigin = request => {\n if (!request.url.includes(\"://\")) return request;\n\n if (request.url.includes(window.location.hostname)) return request;\n\n return evolve({ headers: omit(values(HEADERS_KEYS)) })(request);\n};\n\nconst transformDataToSnakeCase = request => {\n const { transformRequestCase = true } = request;\n\n if (!transformRequestCase) return request;\n\n return evolve(\n { data: serializeKeysToSnakeCase, params: serializeKeysToSnakeCase },\n request\n );\n};\n\nconst addRequestInterceptors = skip => {\n if (!skip?.cleanCredentialsForCrossOrigin) {\n axios.interceptors.request.use(cleanupCredentialsForCrossOrigin);\n }\n\n if (!skip?.transformCase) {\n axios.interceptors.request.use(transformDataToSnakeCase);\n }\n};\n\nconst addResponseInterceptors = skip => {\n axios.interceptors.response.use(\n buildSuccessResponseHandler(skip),\n buildErrorResponseHandler(skip)\n );\n};\n\nconst registerIntercepts = skip => {\n if (shouldNot(skip?.request)) addRequestInterceptors(skip?.request);\n\n if (shouldNot(skip?.response)) addResponseInterceptors(skip?.response);\n};\n\nexport default function initializeAxios(skip) {\n if (!skip?.baseURL) axios.defaults.baseURL = \"/\";\n\n if (!skip?.authHeaders) setAuthHeaders();\n\n if (!skip?.paramsSerializer) setParamsSerializer();\n\n if (shouldNot(skip?.interceptors)) registerIntercepts(skip?.interceptors);\n}\n"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,OAAO,MAAM,SAAS;AAC7B,SAASC,eAAe,EAAEC,OAAO,EAAEC,wBAAwB;AAC3D,SAASC,oBAAoB;AAC7B,SAASC,eAAe;AACxB,SAASC,MAAM;AACf,SAASC,MAAM,EAAEC,IAAI,EAAEC,MAAM,QAAQ,OAAO;AAE5C,OAAOC,mBAAmB;AAE1B,SAASC,YAAY;AAErB,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAGC,IAAI;EAAA,OAAIC,OAAA,CAAOD,IAAI,MAAK,QAAQ,IAAI,CAACA,IAAI;AAAA;AAE3D,IAAME,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAGC,QA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AAC,EAAEwG,uBAAuB,CAAC3G,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEG,QAAQ,CAAC;AACxE,CAAC;AAED,eAAe,SAAS0G,eAAeA,CAAC7G,IAAI,EAAE;EAC5C,IAAI,EAACA,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAE8G,OAAO,GAAE5H,KAAK,CAACuB,QAAQ,CAACqG,OAAO,GAAG,GAAG;EAEhD,IAAI,EAAC9G,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAE+G,WAAW,GAAEzG,cAAc,EAAE;EAExC,IAAI,EAACN,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAEgH,gBAAgB,GAAEnH,mBAAmB,EAAE;EAElD,IAAIE,SAAS,CAACC,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAE6C,YAAY,CAAC,EAAE+D,kBAAkB,CAAC5G,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAE6C,YAAY,CAAC;AAC3E"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
+
/* eslint-disable @bigbinary/neeto/use-snake-case-for-api-connector-filename */
|
|
3
|
+
import axios from "axios";
|
|
4
|
+
import qs from "qs";
|
|
5
|
+
import { map } from "ramda";
|
|
6
|
+
var setParamsSerializer = function setParamsSerializer() {
|
|
7
|
+
axios.defaults.paramsSerializer = function (params) {
|
|
8
|
+
var modifiedParams = map(function checkObject(value) {
|
|
9
|
+
if (Array.isArray(value)) return map(checkObject, value);else if (value && _typeof(value) === "object") return JSON.stringify(value);
|
|
10
|
+
return value;
|
|
11
|
+
}, params);
|
|
12
|
+
return qs.stringify(modifiedParams, {
|
|
13
|
+
arrayFormat: "brackets"
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export default setParamsSerializer;
|
|
18
|
+
//# sourceMappingURL=paramsSerializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paramsSerializer.js","names":["axios","qs","map","setParamsSerializer","defaults","paramsSerializer","params","modifiedParams","checkObject","value","Array","isArray","_typeof","JSON","stringify","arrayFormat"],"sources":["../../../src/initializers/axios/paramsSerializer.js"],"sourcesContent":["/* eslint-disable @bigbinary/neeto/use-snake-case-for-api-connector-filename */\nimport axios from \"axios\";\nimport qs from \"qs\";\nimport { map } from \"ramda\";\n\nconst setParamsSerializer = () => {\n axios.defaults.paramsSerializer = function (params) {\n const modifiedParams = map(function checkObject(value) {\n if (Array.isArray(value)) return map(checkObject, value);\n else if (value && typeof value === \"object\") return JSON.stringify(value);\n\n return value;\n }, params);\n\n return qs.stringify(modifiedParams, { arrayFormat: \"brackets\" });\n };\n};\n\nexport default setParamsSerializer;\n"],"mappings":";AAAA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,EAAE,MAAM,IAAI;AACnB,SAASC,GAAG,QAAQ,OAAO;AAE3B,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAA,EAAS;EAChCH,KAAK,CAACI,QAAQ,CAACC,gBAAgB,GAAG,UAAUC,MAAM,EAAE;IAClD,IAAMC,cAAc,GAAGL,GAAG,CAAC,SAASM,WAAWA,CAACC,KAAK,EAAE;MACrD,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,EAAE,OAAOP,GAAG,CAACM,WAAW,EAAEC,KAAK,CAAC,CAAC,KACpD,IAAIA,KAAK,IAAIG,OAAA,CAAOH,KAAK,MAAK,QAAQ,EAAE,OAAOI,IAAI,CAACC,SAAS,CAACL,KAAK,CAAC;MAEzE,OAAOA,KAAK;IACd,CAAC,EAAEH,MAAM,CAAC;IAEV,OAAOL,EAAE,CAACa,SAAS,CAACP,cAAc,EAAE;MAAEQ,WAAW,EAAE;IAAW,CAAC,CAAC;EAClE,CAAC;AACH,CAAC;AAED,eAAeZ,mBAAmB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","names":["HEADERS_KEYS","xCsrfToken","contentType","accept","LOWERCASED","ANY_CASE"],"sources":["../../src/initializers/constants.js"],"sourcesContent":["export const HEADERS_KEYS = {\n xCsrfToken: \"X-CSRF-TOKEN\",\n contentType: \"Content-Type\",\n accept: \"Accept\",\n};\n\nexport const LOWERCASED = \"__LOWERCASED__\";\nexport const ANY_CASE = \"anyCase\";\n"],"mappings":"AAAA,OAAO,IAAMA,YAAY,GAAG;EAC1BC,UAAU,EAAE,cAAc;EAC1BC,WAAW,EAAE,cAAc;EAC3BC,MAAM,EAAE;AACV,CAAC;AAED,OAAO,IAAMC,UAAU,GAAG,gBAAgB;AAC1C,OAAO,IAAMC,QAAQ,GAAG,SAAS"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* eslint-disable @bigbinary/neeto/no-globalProps-reassignment */
|
|
2
|
+
import { keysToCamelCase, deepFreezeObject } from "@bigbinary/neeto-cist";
|
|
3
|
+
export default function initializeGlobalProps() {
|
|
4
|
+
var _document$getElements, _document$getElements2;
|
|
5
|
+
window.globalProps = keysToCamelCase(JSON.parse(((_document$getElements = document.getElementsByClassName("root-container")[0]) === null || _document$getElements === void 0 ? void 0 : (_document$getElements2 = _document$getElements.dataset) === null || _document$getElements2 === void 0 ? void 0 : _document$getElements2.reactProps) || "{}"));
|
|
6
|
+
deepFreezeObject(window.globalProps);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=globalProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globalProps.js","names":["keysToCamelCase","deepFreezeObject","initializeGlobalProps","_document$getElements","_document$getElements2","window","globalProps","JSON","parse","document","getElementsByClassName","dataset","reactProps"],"sources":["../../src/initializers/globalProps.js"],"sourcesContent":["/* eslint-disable @bigbinary/neeto/no-globalProps-reassignment */\nimport { keysToCamelCase, deepFreezeObject } from \"neetocist\";\n\nexport default function initializeGlobalProps() {\n window.globalProps = keysToCamelCase(\n JSON.parse(\n document.getElementsByClassName(\"root-container\")[0]?.dataset\n ?.reactProps || \"{}\"\n )\n );\n\n deepFreezeObject(window.globalProps);\n}\n"],"mappings":"AAAA;AACA,SAASA,eAAe,EAAEC,gBAAgB;AAE1C,eAAe,SAASC,qBAAqBA,CAAA,EAAG;EAAA,IAAAC,qBAAA,EAAAC,sBAAA;EAC9CC,MAAM,CAACC,WAAW,GAAGN,eAAe,CAClCO,IAAI,CAACC,KAAK,CACR,EAAAL,qBAAA,GAAAM,QAAQ,CAACC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,cAAAP,qBAAA,wBAAAC,sBAAA,GAApDD,qBAAA,CAAsDQ,OAAO,cAAAP,sBAAA,uBAA7DA,sBAAA,CACIQ,UAAU,KAAI,IAAI,CACvB,CACF;EAEDX,gBAAgB,CAACI,MAAM,CAACC,WAAW,CAAC;AACtC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import i18n from "i18next";
|
|
2
|
+
import LanguageDetector from "i18next-browser-languagedetector";
|
|
3
|
+
import { mergeDeepLeft } from "ramda";
|
|
4
|
+
import { initReactI18next } from "react-i18next";
|
|
5
|
+
import { replaceNullValuesWithGetter } from "./utils";
|
|
6
|
+
import { boldListFormatter, lowerCaseDynamicTextFormatter } from "./utils/customFormatters";
|
|
7
|
+
import { sentenceCaseProcessor } from "./utils/customPostProcessors";
|
|
8
|
+
import commonsEn from "../translations/en.json";
|
|
9
|
+
|
|
10
|
+
// eslint-disable-next-line import/no-mutable-exports
|
|
11
|
+
var taxonomies = {};
|
|
12
|
+
var initializeI18n = function initializeI18n(hostTranslations) {
|
|
13
|
+
var _window$globalProps;
|
|
14
|
+
// eslint-disable-next-line no-undef
|
|
15
|
+
var packageTranslations = preval.require("../configs/scripts/getPkgTranslations.js");
|
|
16
|
+
var commonsTranslations = {
|
|
17
|
+
en: {
|
|
18
|
+
translation: commonsEn
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var resources = [hostTranslations, commonsTranslations, packageTranslations].reduce(mergeDeepLeft);
|
|
22
|
+
var defaultTaxonomyKeys = Object.keys(resources.en.translation.taxonomyDefaultLabels || {});
|
|
23
|
+
var defaultTaxonomies = Object.fromEntries(defaultTaxonomyKeys.map(function (key) {
|
|
24
|
+
return [key, {
|
|
25
|
+
singular: null,
|
|
26
|
+
plural: null
|
|
27
|
+
}];
|
|
28
|
+
}));
|
|
29
|
+
var hostTaxonomies = ((_window$globalProps = window.globalProps) === null || _window$globalProps === void 0 ? void 0 : _window$globalProps.taxonomies) || {};
|
|
30
|
+
taxonomies = replaceNullValuesWithGetter(mergeDeepLeft(hostTaxonomies, defaultTaxonomies));
|
|
31
|
+
i18n.use(LanguageDetector).use(initReactI18next).use(sentenceCaseProcessor).init({
|
|
32
|
+
resources: resources,
|
|
33
|
+
fallbackLng: "en",
|
|
34
|
+
interpolation: {
|
|
35
|
+
defaultVariables: {
|
|
36
|
+
taxonomies: taxonomies
|
|
37
|
+
},
|
|
38
|
+
escapeValue: false,
|
|
39
|
+
skipOnVariables: false,
|
|
40
|
+
alwaysFormat: true,
|
|
41
|
+
format: function format(value, _format, lng, options) {
|
|
42
|
+
var newValue = value;
|
|
43
|
+
if (_format === "boldList") {
|
|
44
|
+
newValue = boldListFormatter(newValue, lng, options);
|
|
45
|
+
return newValue;
|
|
46
|
+
}
|
|
47
|
+
return lowerCaseDynamicTextFormatter(newValue, _format);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
postProcess: [sentenceCaseProcessor.name],
|
|
51
|
+
detection: {
|
|
52
|
+
order: ["querystring", "cookie", "navigator", "path"],
|
|
53
|
+
caches: ["cookie"],
|
|
54
|
+
lookupQuerystring: "lang",
|
|
55
|
+
lookupCookie: "lang"
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
export { taxonomies };
|
|
60
|
+
export default initializeI18n;
|
|
61
|
+
//# sourceMappingURL=i18n.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.js","names":["i18n","LanguageDetector","mergeDeepLeft","initReactI18next","replaceNullValuesWithGetter","boldListFormatter","lowerCaseDynamicTextFormatter","sentenceCaseProcessor","commonsEn","taxonomies","initializeI18n","hostTranslations","_window$globalProps","packageTranslations","preval","require","commonsTranslations","en","translation","resources","reduce","defaultTaxonomyKeys","Object","keys","taxonomyDefaultLabels","defaultTaxonomies","fromEntries","map","key","singular","plural","hostTaxonomies","window","globalProps","use","init","fallbackLng","interpolation","defaultVariables","escapeValue","skipOnVariables","alwaysFormat","format","value","lng","options","newValue","postProcess","name","detection","order","caches","lookupQuerystring","lookupCookie"],"sources":["../../src/initializers/i18n.js"],"sourcesContent":["import i18n from \"i18next\";\nimport LanguageDetector from \"i18next-browser-languagedetector\";\nimport { mergeDeepLeft } from \"ramda\";\nimport { initReactI18next } from \"react-i18next\";\n\nimport { replaceNullValuesWithGetter } from \"./utils\";\nimport {\n boldListFormatter,\n lowerCaseDynamicTextFormatter,\n} from \"./utils/customFormatters\";\nimport { sentenceCaseProcessor } from \"./utils/customPostProcessors\";\n\nimport commonsEn from \"../translations/en.json\";\n\n// eslint-disable-next-line import/no-mutable-exports\nlet taxonomies = {};\n\nconst initializeI18n = hostTranslations => {\n // eslint-disable-next-line no-undef\n const packageTranslations = preval.require(\n \"../configs/scripts/getPkgTranslations.js\"\n );\n\n const commonsTranslations = { en: { translation: commonsEn } };\n\n const resources = [\n hostTranslations,\n commonsTranslations,\n packageTranslations,\n ].reduce(mergeDeepLeft);\n\n const defaultTaxonomyKeys = Object.keys(\n resources.en.translation.taxonomyDefaultLabels || {}\n );\n\n const defaultTaxonomies = Object.fromEntries(\n defaultTaxonomyKeys.map(key => [key, { singular: null, plural: null }])\n );\n\n const hostTaxonomies = window.globalProps?.taxonomies || {};\n\n taxonomies = replaceNullValuesWithGetter(\n mergeDeepLeft(hostTaxonomies, defaultTaxonomies)\n );\n\n i18n\n .use(LanguageDetector)\n .use(initReactI18next)\n .use(sentenceCaseProcessor)\n .init({\n resources,\n fallbackLng: \"en\",\n interpolation: {\n defaultVariables: { taxonomies },\n escapeValue: false,\n skipOnVariables: false,\n alwaysFormat: true,\n format: (value, format, lng, options) => {\n let newValue = value;\n if (format === \"boldList\") {\n newValue = boldListFormatter(newValue, lng, options);\n\n return newValue;\n }\n\n return lowerCaseDynamicTextFormatter(newValue, format);\n },\n },\n postProcess: [sentenceCaseProcessor.name],\n detection: {\n order: [\"querystring\", \"cookie\", \"navigator\", \"path\"],\n caches: [\"cookie\"],\n lookupQuerystring: \"lang\",\n lookupCookie: \"lang\",\n },\n });\n};\n\nexport { taxonomies };\n\nexport default initializeI18n;\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,SAAS;AAC1B,OAAOC,gBAAgB,MAAM,kCAAkC;AAC/D,SAASC,aAAa,QAAQ,OAAO;AACrC,SAASC,gBAAgB,QAAQ,eAAe;AAEhD,SAASC,2BAA2B;AACpC,SACEC,iBAAiB,EACjBC,6BAA6B;AAE/B,SAASC,qBAAqB;AAE9B,OAAOC,SAAS;;AAEhB;AACA,IAAIC,UAAU,GAAG,CAAC,CAAC;AAEnB,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAGC,gBAAgB,EAAI;EAAA,IAAAC,mBAAA;EACzC;EACA,IAAMC,mBAAmB,GAAGC,MAAM,CAACC,OAAO,CACxC,0CAA0C,CAC3C;EAED,IAAMC,mBAAmB,GAAG;IAAEC,EAAE,EAAE;MAAEC,WAAW,EAAEV;IAAU;EAAE,CAAC;EAE9D,IAAMW,SAAS,GAAG,CAChBR,gBAAgB,EAChBK,mBAAmB,EACnBH,mBAAmB,CACpB,CAACO,MAAM,CAAClB,aAAa,CAAC;EAEvB,IAAMmB,mBAAmB,GAAGC,MAAM,CAACC,IAAI,CACrCJ,SAAS,CAACF,EAAE,CAACC,WAAW,CAACM,qBAAqB,IAAI,CAAC,CAAC,CACrD;EAED,IAAMC,iBAAiB,GAAGH,MAAM,CAACI,WAAW,CAC1CL,mBAAmB,CAACM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,EAAE,MAAM;MACzBC,YAAY,EAAE;IAChB;EACF,CAAC,CAAC;AACN,CAAC;AAED,SAAS5C,UAAU;AAEnB,eAAeC,cAAc"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
+
// TODO: kept for backward compatibility.
|
|
3
|
+
import { useDisplayErrorPage } from "@bigbinary/neeto-commons-frontend/react-utils";
|
|
4
|
+
import initializeAxios from "./axios";
|
|
5
|
+
import initializeGlobalProps from "./globalProps";
|
|
6
|
+
import initializeI18n, { taxonomies } from "./i18n";
|
|
7
|
+
import initializeLogger from "./logger";
|
|
8
|
+
import disableReactDevTools from "./reactDevTools";
|
|
9
|
+
|
|
10
|
+
// eslint-disable-next-line import/no-mutable-exports
|
|
11
|
+
var globalProps = {};
|
|
12
|
+
export { globalProps, useDisplayErrorPage, taxonomies };
|
|
13
|
+
export default function initializeApplication(_ref) {
|
|
14
|
+
var translationResources = _ref.translationResources,
|
|
15
|
+
skip = _ref.skip;
|
|
16
|
+
if (!(skip !== null && skip !== void 0 && skip.globalProps)) {
|
|
17
|
+
initializeGlobalProps();
|
|
18
|
+
// eslint-disable-next-line @bigbinary/neeto/no-globalProps-reassignment
|
|
19
|
+
globalProps = window.globalProps;
|
|
20
|
+
}
|
|
21
|
+
if (_typeof(skip === null || skip === void 0 ? void 0 : skip.axios) === "object" || !(skip !== null && skip !== void 0 && skip.axios)) {
|
|
22
|
+
initializeAxios(skip === null || skip === void 0 ? void 0 : skip.axios);
|
|
23
|
+
}
|
|
24
|
+
if (!(skip !== null && skip !== void 0 && skip.i18n)) initializeI18n(translationResources);
|
|
25
|
+
if (!(skip !== null && skip !== void 0 && skip.logger)) initializeLogger();
|
|
26
|
+
if (process.env.NODE_ENV === "production") disableReactDevTools();
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["useDisplayErrorPage","initializeAxios","initializeGlobalProps","initializeI18n","taxonomies","initializeLogger","disableReactDevTools","globalProps","initializeApplication","_ref","translationResources","skip","window","_typeof","axios","i18n","logger","process","env","NODE_ENV"],"sources":["../../src/initializers/index.js"],"sourcesContent":["// TODO: kept for backward compatibility.\nimport { useDisplayErrorPage } from \"neetocommons/react-utils\";\n\nimport initializeAxios from \"./axios\";\nimport initializeGlobalProps from \"./globalProps\";\nimport initializeI18n, { taxonomies } from \"./i18n\";\nimport initializeLogger from \"./logger\";\nimport disableReactDevTools from \"./reactDevTools\";\n\n// eslint-disable-next-line import/no-mutable-exports\nlet globalProps = {};\n\nexport { globalProps, useDisplayErrorPage, taxonomies };\n\nexport default function initializeApplication({ translationResources, skip }) {\n if (!skip?.globalProps) {\n initializeGlobalProps();\n // eslint-disable-next-line @bigbinary/neeto/no-globalProps-reassignment\n globalProps = window.globalProps;\n }\n\n if (typeof skip?.axios === \"object\" || !skip?.axios) {\n initializeAxios(skip?.axios);\n }\n\n if (!skip?.i18n) initializeI18n(translationResources);\n\n if (!skip?.logger) initializeLogger();\n\n if (process.env.NODE_ENV === \"production\") disableReactDevTools();\n}\n"],"mappings":";AAAA;AACA,SAASA,mBAAmB;AAE5B,OAAOC,eAAe;AACtB,OAAOC,qBAAqB;AAC5B,OAAOC,cAAc,IAAIC,UAAU;AACnC,OAAOC,gBAAgB;AACvB,OAAOC,oBAAoB;;AAE3B;AACA,IAAIC,WAAW,GAAG,CAAC,CAAC;AAEpB,SAASA,WAAW,EAAEP,mBAAmB,EAAEI,UAAU;AAErD,eAAe,SAASI,qBAAqBA,CAAAC,IAAA,EAAiC;EAAA,IAA9BC,oBAAoB,GAAAD,IAAA,CAApBC,oBAAoB;IAAEC,IAAI,GAAAF,IAAA,CAAJE,IAAI;EACxE,IAAI,EAACA,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAEJ,WAAW,GAAE;IACtBL,qBAAqB,EAAE;IACvB;IACAK,WAAW,GAAGK,MAAM,CAACL,WAAW;EAClC;EAEA,IAAIM,OAAA,CAAOF,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEG,KAAK,MAAK,QAAQ,IAAI,EAACH,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAEG,KAAK,GAAE;IACnDb,eAAe,CAACU,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEG,KAAK,CAAC;EAC9B;EAEA,IAAI,EAACH,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAEI,IAAI,GAAEZ,cAAc,CAACO,oBAAoB,CAAC;EAErD,IAAI,EAACC,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAEK,MAAM,GAAEX,gBAAgB,EAAE;EAErC,IAAIY,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAEb,oBAAoB,EAAE;AACnE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Logger from "js-logger";
|
|
2
|
+
export default function initializeLogger() {
|
|
3
|
+
/* eslint react-hooks/rules-of-hooks: "off" */
|
|
4
|
+
Logger.useDefaults();
|
|
5
|
+
if (process.env.RAILS_ENV === "production") {
|
|
6
|
+
Logger.setLevel(Logger.OFF);
|
|
7
|
+
}
|
|
8
|
+
window.logger = Logger;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","names":["Logger","initializeLogger","useDefaults","process","env","RAILS_ENV","setLevel","OFF","window","logger"],"sources":["../../src/initializers/logger.js"],"sourcesContent":["import Logger from \"js-logger\";\n\nexport default function initializeLogger() {\n /* eslint react-hooks/rules-of-hooks: \"off\" */\n Logger.useDefaults();\n if (process.env.RAILS_ENV === \"production\") {\n Logger.setLevel(Logger.OFF);\n }\n window.logger = Logger;\n}\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,WAAW;AAE9B,eAAe,SAASC,gBAAgBA,CAAA,EAAG;EACzC;EACAD,MAAM,CAACE,WAAW,EAAE;EACpB,IAAIC,OAAO,CAACC,GAAG,CAACC,SAAS,KAAK,YAAY,EAAE;IAC1CL,MAAM,CAACM,QAAQ,CAACN,MAAM,CAACO,GAAG,CAAC;EAC7B;EACAC,MAAM,CAACC,MAAM,GAAGT,MAAM;AACxB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
+
var isObjectOrFunction = function isObjectOrFunction(object) {
|
|
3
|
+
var type = _typeof(object);
|
|
4
|
+
return type === "function" || type === "object" && !!object;
|
|
5
|
+
};
|
|
6
|
+
export default function disableReactDevTools() {
|
|
7
|
+
if (window && window.document) {
|
|
8
|
+
var developerToolsHook = window.__REACT_DEVTOOLS_GLOBAL_HOOK__;
|
|
9
|
+
if (!isObjectOrFunction(developerToolsHook)) return;
|
|
10
|
+
for (var prop in developerToolsHook) {
|
|
11
|
+
if (prop === "renderers") {
|
|
12
|
+
developerToolsHook[prop] = new Map();
|
|
13
|
+
} else {
|
|
14
|
+
developerToolsHook[prop] = typeof developerToolsHook[prop] === "function" ? Function.prototype : null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=reactDevTools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactDevTools.js","names":["isObjectOrFunction","object","type","_typeof","disableReactDevTools","window","document","developerToolsHook","__REACT_DEVTOOLS_GLOBAL_HOOK__","prop","Map","Function","prototype"],"sources":["../../src/initializers/reactDevTools.js"],"sourcesContent":["const isObjectOrFunction = object => {\n const type = typeof object;\n\n return type === \"function\" || (type === \"object\" && !!object);\n};\n\nexport default function disableReactDevTools() {\n if (window && window.document) {\n const developerToolsHook = window.__REACT_DEVTOOLS_GLOBAL_HOOK__;\n\n if (!isObjectOrFunction(developerToolsHook)) return;\n\n for (const prop in developerToolsHook) {\n if (prop === \"renderers\") {\n developerToolsHook[prop] = new Map();\n } else {\n developerToolsHook[prop] =\n typeof developerToolsHook[prop] === \"function\"\n ? Function.prototype\n : null;\n }\n }\n }\n}\n"],"mappings":";AAAA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAGC,MAAM,EAAI;EACnC,IAAMC,IAAI,GAAAC,OAAA,CAAUF,MAAM;EAE1B,OAAOC,IAAI,KAAK,UAAU,IAAKA,IAAI,KAAK,QAAQ,IAAI,CAAC,CAACD,MAAO;AAC/D,CAAC;AAED,eAAe,SAASG,oBAAoBA,CAAA,EAAG;EAC7C,IAAIC,MAAM,IAAIA,MAAM,CAACC,QAAQ,EAAE;IAC7B,IAAMC,kBAAkB,GAAGF,MAAM,CAACG,8BAA8B;IAEhE,IAAI,CAACR,kBAAkB,CAACO,kBAAkB,CAAC,EAAE;IAE7C,KAAK,IAAME,IAAI,IAAIF,kBAAkB,EAAE;MACrC,IAAIE,IAAI,KAAK,WAAW,EAAE;QACxBF,kBAAkB,CAACE,IAAI,CAAC,GAAG,IAAIC,GAAG,EAAE;MACtC,CAAC,MAAM;QACLH,kBAAkB,CAACE,IAAI,CAAC,GACtB,OAAOF,kBAAkB,CAACE,IAAI,CAAC,KAAK,UAAU,GAC1CE,QAAQ,CAACC,SAAS,GAClB,IAAI;MACZ;IACF;EACF;AACF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import DOMPurify from "dompurify";
|
|
2
|
+
import { LOWERCASED, ANY_CASE } from "../constants";
|
|
3
|
+
var sanitizer = function sanitizer(array) {
|
|
4
|
+
return DOMPurify.sanitize(array, {
|
|
5
|
+
USE_PROFILES: {
|
|
6
|
+
html: true
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var cacheStore = new Map();
|
|
11
|
+
var fetchCachedOrInvoke = function fetchCachedOrInvoke(func, lng, options) {
|
|
12
|
+
var _cacheStore$get;
|
|
13
|
+
var cache = (_cacheStore$get = cacheStore.get(lng)) === null || _cacheStore$get === void 0 ? void 0 : _cacheStore$get.get(options);
|
|
14
|
+
if (cache) return cache;
|
|
15
|
+
cache = func(lng, options);
|
|
16
|
+
var lngCache = cacheStore.get(lng);
|
|
17
|
+
if (lngCache) lngCache.set(options, cache);else cacheStore.set(lng, new Map([[options, cache]]));
|
|
18
|
+
return cache;
|
|
19
|
+
};
|
|
20
|
+
export var lowerCaseDynamicTextFormatter = function lowerCaseDynamicTextFormatter(value, format) {
|
|
21
|
+
if (!value || format === ANY_CASE || typeof value !== "string") return value;
|
|
22
|
+
return LOWERCASED + value.toLocaleLowerCase();
|
|
23
|
+
};
|
|
24
|
+
export var boldListFormatter = function boldListFormatter(array, lng, options) {
|
|
25
|
+
var formatter = fetchCachedOrInvoke(function (lng, options) {
|
|
26
|
+
return new Intl.ListFormat(lng, options);
|
|
27
|
+
}, lng, options);
|
|
28
|
+
var boldItems = array.map(function (item) {
|
|
29
|
+
return "<strong>".concat(item, "</strong>");
|
|
30
|
+
});
|
|
31
|
+
var sanitizedItems = sanitizer(boldItems).split(",");
|
|
32
|
+
return formatter.format(sanitizedItems);
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=customFormatters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customFormatters.js","names":["DOMPurify","LOWERCASED","ANY_CASE","sanitizer","array","sanitize","USE_PROFILES","html","cacheStore","Map","fetchCachedOrInvoke","func","lng","options","_cacheStore$get","cache","get","lngCache","set","lowerCaseDynamicTextFormatter","value","format","toLocaleLowerCase","boldListFormatter","formatter","Intl","ListFormat","boldItems","map","item","concat","sanitizedItems","split"],"sources":["../../../src/initializers/utils/customFormatters.js"],"sourcesContent":["import DOMPurify from \"dompurify\";\n\nimport { LOWERCASED, ANY_CASE } from \"../constants\";\n\nconst sanitizer = array =>\n DOMPurify.sanitize(array, { USE_PROFILES: { html: true } });\n\nconst cacheStore = new Map();\n\nconst fetchCachedOrInvoke = (func, lng, options) => {\n let cache = cacheStore.get(lng)?.get(options);\n if (cache) return cache;\n\n cache = func(lng, options);\n const lngCache = cacheStore.get(lng);\n if (lngCache) lngCache.set(options, cache);\n else cacheStore.set(lng, new Map([[options, cache]]));\n\n return cache;\n};\n\nexport const lowerCaseDynamicTextFormatter = (value, format) => {\n if (!value || format === ANY_CASE || typeof value !== \"string\") return value;\n\n return LOWERCASED + value.toLocaleLowerCase();\n};\n\nexport const boldListFormatter = (array, lng, options) => {\n const formatter = fetchCachedOrInvoke(\n (lng, options) => new Intl.ListFormat(lng, options),\n lng,\n options\n );\n const boldItems = array.map(item => `<strong>${item}</strong>`);\n const sanitizedItems = sanitizer(boldItems).split(\",\");\n\n return formatter.format(sanitizedItems);\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,WAAW;AAEjC,SAASC,UAAU,EAAEC,QAAQ;AAE7B,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAGC,KAAK;EAAA,OACrBJ,SAAS,CAACK,QAAQ,CAACD,KAAK,EAAE;IAAEE,YAAY,EAAE;MAAEC,IAAI,EAAE;IAAK;EAAE,CAAC,CAAC;AAAA;AAE7D,IAAMC,UAAU,GAAG,IAAIC,GAAG,EAAE;AAE5B,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIC,IAAI,EAAEC,GAAG,EAAEC,OAAO,EAAK;EAAA,IAAAC,eAAA;EAClD,IAAIC,KAAK,IAAAD,eAAA,GAAGN,UAAU,CAACQ,GAAG,CAACJ,GAAG,CAAC,cAAAE,eAAA,uBAAnBA,eAAA,CAAqBE,GAAG,CAACH,OAAO,CAAC;EAC7C,IAAIE,KAAK,EAAE,OAAOA,KAAK;EAEvBA,KAAK,GAAGJ,IAAI,CAACC,GAAG,EAAEC,OAAO,CAAC;EAC1B,IAAMI,QAAQ,GAAGT,UAAU,CAACQ,GAAG,CAACJ,GAAG,CAAC;EACpC,IAAIK,QAAQ,EAAEA,QAAQ,CAACC,GAAG,CAACL,OAAO,EAAEE,KAAK,CAAC,CAAC,KACtCP,UAAU,CAACU,GAAG,CAACN,GAAG,EAAE,IAAIH,GAAG,CAAC,CAAC,CAACI,OAAO,EAAEE,KAAK,CAAC,CAAC,CAAC,CAAC;EAErD,OAAOA,KAAK;AACd,CAAC;AAED,OAAO,IAAMI,6BAA6B,GAAG,SAAhCA,6BAA6BA,CAAIC,KAAK,EAAEC,MAAM,EAAK;EAC9D,IAAI,CAACD,KAAK,IAAIC,MAAM,KAAKnB,QAAQ,IAAI,OAAOkB,KAAK,KAAK,QAAQ,EAAE,OAAOA,KAAK;EAE5E,OAAOnB,UAAU,GAAGmB,KAAK,CAACE,iBAAiB,EAAE;AAC/C,CAAC;AAED,OAAO,IAAMC,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAInB,KAAK,EAAEQ,GAAG,EAAEC,OAAO,EAAK;EACxD,IAAMW,SAAS,GAAGd,mBAAmB,CACnC,UAACE,GAAG,EAAEC,OAAO;IAAA,OAAK,IAAIY,IAAI,CAACC,UAAU,CAACd,GAAG,EAAEC,OAAO,CAAC;EAAA,GACnDD,GAAG,EACHC,OAAO,CACR;EACD,IAAMc,SAAS,GAAGvB,KAAK,CAACwB,GAAG,CAAC,UAAAC,IAAI;IAAA,kBAAAC,MAAA,CAAeD,IAAI;EAAA,CAAW,CAAC;EAC/D,IAAME,cAAc,GAAG5B,SAAS,CAACwB,SAAS,CAAC,CAACK,KAAK,CAAC,GAAG,CAAC;EAEtD,OAAOR,SAAS,CAACH,MAAM,CAACU,cAAc,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LOWERCASED } from "../constants";
|
|
2
|
+
var sentenceCase = function sentenceCase(value) {
|
|
3
|
+
return value.charAt(0).toLocaleUpperCase() + value.slice(1);
|
|
4
|
+
};
|
|
5
|
+
export var sentenceCaseProcessor = {
|
|
6
|
+
type: "postProcessor",
|
|
7
|
+
name: "sentenceCaseProcessor",
|
|
8
|
+
process: function process(value) {
|
|
9
|
+
var shouldSentenceCase = value.startsWith(LOWERCASED);
|
|
10
|
+
value = value.replaceAll(LOWERCASED, "");
|
|
11
|
+
return shouldSentenceCase ? sentenceCase(value) : value;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=customPostProcessors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customPostProcessors.js","names":["LOWERCASED","sentenceCase","value","charAt","toLocaleUpperCase","slice","sentenceCaseProcessor","type","name","process","shouldSentenceCase","startsWith","replaceAll"],"sources":["../../../src/initializers/utils/customPostProcessors.js"],"sourcesContent":["import { LOWERCASED } from \"../constants\";\n\nconst sentenceCase = value =>\n value.charAt(0).toLocaleUpperCase() + value.slice(1);\n\nexport const sentenceCaseProcessor = {\n type: \"postProcessor\",\n name: \"sentenceCaseProcessor\",\n process: value => {\n const shouldSentenceCase = value.startsWith(LOWERCASED);\n value = value.replaceAll(LOWERCASED, \"\");\n\n return shouldSentenceCase ? sentenceCase(value) : value;\n },\n};\n"],"mappings":"AAAA,SAASA,UAAU;AAEnB,IAAMC,YAAY,GAAG,SAAfA,YAAYA,CAAGC,KAAK;EAAA,OACxBA,KAAK,CAACC,MAAM,CAAC,CAAC,CAAC,CAACC,iBAAiB,EAAE,GAAGF,KAAK,CAACG,KAAK,CAAC,CAAC,CAAC;AAAA;AAEtD,OAAO,IAAMC,qBAAqB,GAAG;EACnCC,IAAI,EAAE,eAAe;EACrBC,IAAI,EAAE,uBAAuB;EAC7BC,OAAO,EAAE,SAAAA,QAAAP,KAAK,EAAI;IAChB,IAAMQ,kBAAkB,GAAGR,KAAK,CAACS,UAAU,CAACX,UAAU,CAAC;IACvDE,KAAK,GAAGA,KAAK,CAACU,UAAU,CAACZ,UAAU,EAAE,EAAE,CAAC;IAExC,OAAOU,kBAAkB,GAAGT,YAAY,CAACC,KAAK,CAAC,GAAGA,KAAK;EACzD;AACF,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import i18n from "i18next";
|
|
4
|
+
var getter = function getter(key) {
|
|
5
|
+
return function () {
|
|
6
|
+
return i18n.t("taxonomyDefaultLabels.".concat(key));
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export var replaceNullValuesWithGetter = function replaceNullValuesWithGetter(inputObject) {
|
|
10
|
+
var parentKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
11
|
+
var result = {};
|
|
12
|
+
for (var _i = 0, _Object$entries = Object.entries(inputObject); _i < _Object$entries.length; _i++) {
|
|
13
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
14
|
+
key = _Object$entries$_i[0],
|
|
15
|
+
value = _Object$entries$_i[1];
|
|
16
|
+
var transKey = parentKey ? "".concat(parentKey, ".").concat(key) : key;
|
|
17
|
+
if (value === null) {
|
|
18
|
+
Object.defineProperty(result, key, {
|
|
19
|
+
get: getter(transKey)
|
|
20
|
+
});
|
|
21
|
+
} else if (_typeof(value) === "object") {
|
|
22
|
+
result[key] = replaceNullValuesWithGetter(value, transKey);
|
|
23
|
+
} else {
|
|
24
|
+
result[key] = value;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":["i18n","getter","key","t","concat","replaceNullValuesWithGetter","inputObject","parentKey","arguments","length","undefined","result","_i","_Object$entries","Object","entries","_Object$entries$_i","_slicedToArray","value","transKey","defineProperty","get","_typeof"],"sources":["../../src/initializers/utils.js"],"sourcesContent":["import i18n from \"i18next\";\n\nconst getter = key => () => i18n.t(`taxonomyDefaultLabels.${key}`);\n\nexport const replaceNullValuesWithGetter = (inputObject, parentKey = \"\") => {\n const result = {};\n\n for (const [key, value] of Object.entries(inputObject)) {\n const transKey = parentKey ? `${parentKey}.${key}` : key;\n\n if (value === null) {\n Object.defineProperty(result, key, {\n get: getter(transKey),\n });\n } else if (typeof value === \"object\") {\n result[key] = replaceNullValuesWithGetter(value, transKey);\n } else {\n result[key] = value;\n }\n }\n\n return result;\n};\n"],"mappings":";;AAAA,OAAOA,IAAI,MAAM,SAAS;AAE1B,IAAMC,MAAM,GAAG,SAATA,MAAMA,CAAGC,GAAG;EAAA,OAAI;IAAA,OAAMF,IAAI,CAACG,CAAC,0BAAAC,MAAA,CAA0BF,GAAG,EAAG;EAAA;AAAA;AAElE,OAAO,IAAMG,2BAA2B,GAAG,SAA9BA,2BAA2BA,CAAIC,WAAW,EAAqB;EAAA,IAAnBC,SAAS,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EACrE,IAAMG,MAAM,GAAG,CAAC,CAAC;EAEjB,SAAAC,EAAA,MAAAC,eAAA,GAA2BC,MAAM,CAACC,OAAO,CAACT,WAAW,CAAC,EAAAM,EAAA,GAAAC,eAAA,CAAAJ,MAAA,EAAAG,EAAA,IAAE;IAAnD,IAAAI,kBAAA,GAAAC,cAAA,CAAAJ,eAAA,CAAAD,EAAA;MAAOV,GAAG,GAAAc,kBAAA;MAAEE,KAAK,GAAAF,kBAAA;IACpB,IAAMG,QAAQ,GAAGZ,SAAS,MAAAH,MAAA,CAAMG,SAAS,OAAAH,MAAA,CAAIF,GAAG,IAAKA,GAAG;IAExD,IAAIgB,KAAK,KAAK,IAAI,EAAE;MAClBJ,MAAM,CAACM,cAAc,CAACT,MAAM,EAAET,GAAG,EAAE;QACjCmB,GAAG,EAAEpB,MAAM,CAACkB,QAAQ;MACtB,CAAC,CAAC;IACJ,CAAC,MAAM,IAAIG,OAAA,CAAOJ,KAAK,MAAK,QAAQ,EAAE;MACpCP,MAAM,CAACT,GAAG,CAAC,GAAGG,2BAA2B,CAACa,KAAK,EAAEC,QAAQ,CAAC;IAC5D,CAAC,MAAM;MACLR,MAAM,CAACT,GAAG,CA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