@bigbinary/neeto-commons-frontend 3.0.6 → 3.0.9
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/cjs/configs/babel.js +50 -0
- package/cjs/configs/eslint/globals.js +14 -0
- package/cjs/configs/eslint/helpers/index.js +74 -0
- package/cjs/configs/eslint/imports/enforced.js +29 -0
- package/cjs/configs/eslint/imports/order.js +65 -0
- package/cjs/configs/eslint/index.js +171 -0
- package/cjs/configs/eslint/overrides.js +30 -0
- package/cjs/configs/eslint/promise.js +8 -0
- package/cjs/configs/eslint/react.js +92 -0
- package/cjs/configs/nanos/eslint/imports/order.js +25 -0
- package/cjs/configs/nanos/eslint/index.js +28 -0
- package/cjs/configs/nanos/tailwind.js +11 -0
- package/cjs/configs/nanos/webpack/resolve.js +48 -0
- package/cjs/configs/nextjs/eslint/imports/order.js +25 -0
- package/cjs/configs/nextjs/eslint/index.js +22 -0
- package/cjs/configs/nextjs/webpack/resolve.js +1 -0
- package/cjs/configs/prettier.js +16 -0
- package/cjs/configs/scripts/dead-code-eliminator/constants.js +12 -0
- package/cjs/configs/scripts/dead-code-eliminator/index.js +266 -0
- package/cjs/configs/scripts/getPkgTranslations.js +45 -0
- package/cjs/configs/scripts/jsdoc-builder/constants.mjs +42 -0
- package/cjs/configs/scripts/jsdoc-builder/index.mjs +67 -0
- package/cjs/configs/scripts/jsdoc-builder/utils.mjs +219 -0
- package/cjs/configs/scripts/remove-unused-translation-keys/constants.js +11 -0
- package/cjs/configs/scripts/remove-unused-translation-keys/index.js +186 -0
- package/cjs/configs/tailwind.js +13 -0
- package/cjs/configs/webpack/helpers/customize-default-rules.js +54 -0
- package/cjs/configs/webpack/index.js +58 -0
- package/cjs/configs/webpack/resolve.js +53 -0
- package/cjs/configs/webpack/rules.js +34 -0
- package/{constants.cjs.js → cjs/constants/index.js} +11 -10
- package/cjs/constants/index.js.map +1 -0
- package/cjs/cypress-configs/initializer.js +32 -0
- package/cjs/cypress-configs/plugins.js +105 -0
- package/cjs/cypress-configs/resolve.js +17 -0
- package/cjs/cypress-configs/webpack.config.js +19 -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 +23 -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 +74 -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 +52 -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 +13 -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 +67 -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 +43 -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/translations/en.json +100 -0
- 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 → cjs}/translations/en.json +0 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { env } from "./common";
|
|
2
|
+
import { requestApis } from "../constants/routes";
|
|
3
|
+
import { commonSelectors } from "../constants/selectors/common";
|
|
4
|
+
import { signUpSelectors } from "../constants/selectors/signUp";
|
|
5
|
+
import { signUpTexts } from "../constants/texts/signUp";
|
|
6
|
+
var extractSubdomainFromError = function extractSubdomainFromError(inputString) {
|
|
7
|
+
var regex = /cypresstest[a-zA-Z0-9-]+/g;
|
|
8
|
+
var matches = inputString.match(regex);
|
|
9
|
+
return matches[1];
|
|
10
|
+
};
|
|
11
|
+
var updateSubdomainIfExists = function updateSubdomainIfExists(appName) {
|
|
12
|
+
cy.ifExist(signUpSelectors.subdomainError, function () {
|
|
13
|
+
cy.get(signUpSelectors.subdomainError).invoke("text").then(function (text) {
|
|
14
|
+
cy.intercept({
|
|
15
|
+
url: requestApis.subdomainAvailability,
|
|
16
|
+
times: 1
|
|
17
|
+
}).as("subdomainRequest");
|
|
18
|
+
var newOrganizationName = extractSubdomainFromError(text);
|
|
19
|
+
cy.clearAndType(signUpSelectors.subdomainNameTextField, newOrganizationName);
|
|
20
|
+
cy.wait("@subdomainRequest");
|
|
21
|
+
cy.ifNotExist(signUpSelectors.subdomainError, function () {
|
|
22
|
+
cy.task("updateGlobalState", {
|
|
23
|
+
key: "subdomainName",
|
|
24
|
+
value: newOrganizationName
|
|
25
|
+
});
|
|
26
|
+
cy.task("updateGlobalState", {
|
|
27
|
+
key: "businessName",
|
|
28
|
+
value: newOrganizationName
|
|
29
|
+
});
|
|
30
|
+
var newBaseUrl = "https://".concat(newOrganizationName, ".").concat(appName, ".").concat(env.tld);
|
|
31
|
+
Cypress.config("baseUrl", newBaseUrl);
|
|
32
|
+
cy.clearAndType(signUpSelectors.organizationNameTextField, newOrganizationName);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
cy.ifExist(signUpSelectors.subdomainError, function () {
|
|
36
|
+
return updateSubdomainIfExists(appName);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
export var createOrganization = function createOrganization(_ref) {
|
|
41
|
+
var email = _ref.email,
|
|
42
|
+
businessName = _ref.businessName,
|
|
43
|
+
subdomainName = _ref.subdomainName,
|
|
44
|
+
firstName = _ref.firstName,
|
|
45
|
+
lastName = _ref.lastName,
|
|
46
|
+
appName = _ref.appName;
|
|
47
|
+
var isMailosaurEmail = email.includes("mailosaur");
|
|
48
|
+
var defaultOtp = "123456";
|
|
49
|
+
var appNameInLowerCase = appName.toLowerCase();
|
|
50
|
+
var isNeetoAuth = appNameInLowerCase === "neetoauth";
|
|
51
|
+
var authUrl = "https://app.neetoauth.".concat(env.tld, "/signups/new");
|
|
52
|
+
isNeetoAuth ? cy.visit(authUrl) : cy.visit("".concat(authUrl, "?redirect_uri=").concat(appNameInLowerCase, ".").concat(env.tld));
|
|
53
|
+
cy.clearAndType(signUpSelectors.emailTextField, email);
|
|
54
|
+
cy.intercept({
|
|
55
|
+
url: requestApis.signUp,
|
|
56
|
+
times: 2
|
|
57
|
+
}).as("signupRequest");
|
|
58
|
+
cy.get(signUpSelectors.submitButton).click();
|
|
59
|
+
cy.wait("@signupRequest");
|
|
60
|
+
if (isMailosaurEmail) {
|
|
61
|
+
cy.getEmailContent({
|
|
62
|
+
sentTo: email,
|
|
63
|
+
subject: signUpTexts.loginCode
|
|
64
|
+
}).then(function (emailBody) {
|
|
65
|
+
var otp = emailBody.html.codes[0].value;
|
|
66
|
+
cy.get(signUpSelectors.otpTextBox).type(otp);
|
|
67
|
+
});
|
|
68
|
+
} else cy.get(signUpSelectors.otpTextBox).type(defaultOtp);
|
|
69
|
+
cy.wait("@signupRequest");
|
|
70
|
+
cy.intercept({
|
|
71
|
+
url: requestApis.subdomainAvailability,
|
|
72
|
+
times: 1
|
|
73
|
+
}).as("subdomainRequest");
|
|
74
|
+
cy.clearAndType(signUpSelectors.organizationNameTextField, businessName);
|
|
75
|
+
cy.clearAndType(signUpSelectors.subdomainNameTextField, subdomainName);
|
|
76
|
+
cy.wait("@subdomainRequest");
|
|
77
|
+
updateSubdomainIfExists(appNameInLowerCase);
|
|
78
|
+
cy.intercept({
|
|
79
|
+
url: requestApis.signUp,
|
|
80
|
+
times: 1
|
|
81
|
+
}).as("signupRequest");
|
|
82
|
+
cy.intercept({
|
|
83
|
+
url: requestApis.countries,
|
|
84
|
+
times: 1
|
|
85
|
+
}).as("fetchCountries");
|
|
86
|
+
cy.get(signUpSelectors.organizationSubmitButton).click();
|
|
87
|
+
cy.wait("@signupRequest");
|
|
88
|
+
cy.url({
|
|
89
|
+
timeout: 15000
|
|
90
|
+
}).should("include", signUpTexts.profile);
|
|
91
|
+
cy.wait("@fetchCountries");
|
|
92
|
+
cy.clearAndType(signUpSelectors.firstNameTextField, firstName);
|
|
93
|
+
cy.clearAndType(signUpSelectors.lastNameTextField, lastName);
|
|
94
|
+
cy.get(commonSelectors.checkbox).click();
|
|
95
|
+
cy.intercept({
|
|
96
|
+
url: requestApis.signUp,
|
|
97
|
+
times: 1
|
|
98
|
+
}).as("setupProfile");
|
|
99
|
+
cy.get(signUpSelectors.profileSubmitButton).click();
|
|
100
|
+
cy.wait("@setupProfile");
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=organization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organization.js","names":["env","requestApis","commonSelectors","signUpSelectors","signUpTexts","extractSubdomainFromError","inputString","regex","matches","match","updateSubdomainIfExists","appName","cy","ifExist","subdomainError","get","invoke","then","text","intercept","url","subdomainAvailability","times","as","newOrganizationName","clearAndType","subdomainNameTextField","wait","ifNotExist","task","key","value","newBaseUrl","concat","tld","Cypress","config","organizationNameTextField","createOrganization","_ref","email","businessName","subdomainName","firstName","lastName","isMailosaurEmail","includes","defaultOtp","appNameInLowerCase","toLowerCase","isNeetoAuth","authUrl","visit","emailTextField","signUp","submitButton","click","getEmailContent","sentTo","subject","loginCode","emailBody","otp","html","codes","otpTextBox","type","countries","organizationSubmitButton","timeout","should","profile","firstNameTextField","lastNameTextField","checkbox","profileSubmitButton"],"sources":["../../../src/cypress-utils/utils/organization.js"],"sourcesContent":["import { env } from \"./common\";\n\nimport { requestApis } from \"../constants/routes\";\nimport { commonSelectors } from \"../constants/selectors/common\";\nimport { signUpSelectors } from \"../constants/selectors/signUp\";\nimport { signUpTexts } from \"../constants/texts/signUp\";\n\nconst extractSubdomainFromError = inputString => {\n const regex = /cypresstest[a-zA-Z0-9-]+/g;\n const matches = inputString.match(regex);\n\n return matches[1];\n};\n\nconst updateSubdomainIfExists = appName => {\n cy.ifExist(signUpSelectors.subdomainError, () => {\n cy.get(signUpSelectors.subdomainError)\n .invoke(\"text\")\n .then(text => {\n cy.intercept({ url: requestApis.subdomainAvailability, times: 1 }).as(\n \"subdomainRequest\"\n );\n const newOrganizationName = extractSubdomainFromError(text);\n cy.clearAndType(\n signUpSelectors.subdomainNameTextField,\n newOrganizationName\n );\n cy.wait(\"@subdomainRequest\");\n\n cy.ifNotExist(signUpSelectors.subdomainError, () => {\n cy.task(\"updateGlobalState\", {\n key: \"subdomainName\",\n value: newOrganizationName,\n });\n\n cy.task(\"updateGlobalState\", {\n key: \"businessName\",\n value: newOrganizationName,\n });\n const newBaseUrl = `https://${newOrganizationName}.${appName}.${env.tld}`;\n Cypress.config(\"baseUrl\", newBaseUrl);\n cy.clearAndType(\n signUpSelectors.organizationNameTextField,\n newOrganizationName\n );\n });\n });\n\n cy.ifExist(signUpSelectors.subdomainError, () =>\n updateSubdomainIfExists(appName)\n );\n });\n};\n\nexport const createOrganization = ({\n email,\n businessName,\n subdomainName,\n firstName,\n lastName,\n appName,\n}) => {\n const isMailosaurEmail = email.includes(\"mailosaur\");\n const defaultOtp = \"123456\";\n const appNameInLowerCase = appName.toLowerCase();\n const isNeetoAuth = appNameInLowerCase === \"neetoauth\";\n const authUrl = `https://app.neetoauth.${env.tld}/signups/new`;\n isNeetoAuth\n ? cy.visit(authUrl)\n : cy.visit(`${authUrl}?redirect_uri=${appNameInLowerCase}.${env.tld}`);\n cy.clearAndType(signUpSelectors.emailTextField, email);\n cy.intercept({ url: requestApis.signUp, times: 2 }).as(\"signupRequest\");\n cy.get(signUpSelectors.submitButton).click();\n cy.wait(\"@signupRequest\");\n if (isMailosaurEmail) {\n cy.getEmailContent({ sentTo: email, subject: signUpTexts.loginCode }).then(\n emailBody => {\n const otp = emailBody.html.codes[0].value;\n cy.get(signUpSelectors.otpTextBox).type(otp);\n }\n );\n } else cy.get(signUpSelectors.otpTextBox).type(defaultOtp);\n\n cy.wait(\"@signupRequest\");\n cy.intercept({ url: requestApis.subdomainAvailability, times: 1 }).as(\n \"subdomainRequest\"\n );\n cy.clearAndType(signUpSelectors.organizationNameTextField, businessName);\n cy.clearAndType(signUpSelectors.subdomainNameTextField, subdomainName);\n cy.wait(\"@subdomainRequest\");\n updateSubdomainIfExists(appNameInLowerCase);\n\n cy.intercept({ url: requestApis.signUp, times: 1 }).as(\"signupRequest\");\n cy.intercept({ url: requestApis.countries, times: 1 }).as(\"fetchCountries\");\n cy.get(signUpSelectors.organizationSubmitButton).click();\n cy.wait(\"@signupRequest\");\n cy.url({ timeout: 15000 }).should(\"include\", signUpTexts.profile);\n cy.wait(\"@fetchCountries\");\n cy.clearAndType(signUpSelectors.firstNameTextField, firstName);\n cy.clearAndType(signUpSelectors.lastNameTextField, lastName);\n cy.get(commonSelectors.checkbox).click();\n cy.intercept({ url: requestApis.signUp, times: 1 }).as(\"setupProfile\");\n cy.get(signUpSelectors.profileSubmitButton).click();\n cy.wait(\"@setupProfile\");\n};\n"],"mappings":"AAAA,SAASA,GAAG;AAEZ,SAASC,WAAW;AACpB,SAASC,eAAe;AACxB,SAASC,eAAe;AACxB,SAASC,WAAW;AAEpB,IAAMC,yBAAyB,GAAG,SAA5BA,yBAAyBA,CAAGC,WAAW,EA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KAAK,EAAE;EAAE,CAAC,CAAC,CAACC,EAAE,CAAC,gBAAgB,CAAC;EAC3EX,EAAE,CAACG,GAAG,CAACZ,eAAe,CAACiE,wBAAwB,CAAC,CAACZ,KAAK,EAAE;EACxD5C,EAAE,CAACe,IAAI,CAAC,gBAAgB,CAAC;EACzBf,EAAE,CAACQ,GAAG,CAAC;IAAEiD,OAAO,EAAE;EAAM,CAAC,CAAC,CAACC,MAAM,CAAC,SAAS,EAAElE,WAAW,CAACmE,OAAO,CAAC;EACjE3D,EAAE,CAACe,IAAI,CAAC,iBAAiB,CAAC;EAC1Bf,EAAE,CAACa,YAAY,CAACtB,eAAe,CAACqE,kBAAkB,EAAE7B,SAAS,CAAC;EAC9D/B,EAAE,CAACa,YAAY,CAACtB,eAAe,CAACsE,iBAAiB,EAAE7B,QAAQ,CAAC;EAC5DhC,EAAE,CAACG,GAAG,CAACb,eAAe,CAACwE,QAAQ,CAAC,CAAClB,KAAK,EAAE;EACxC5C,EAAE,CAACO,SAAS,CAAC;IAAEC,GAAG,EAAEnB,WAAW,CAACqD,MAAM;IAAEhC,KAAK,EAAE;EAAE,CAAC,CAAC,CAACC,EAAE,CAAC,cAAc,CAAC;EACtEX,EAAE,CAACG,GAAG,CAACZ,eAAe,CAACwE,mBAAmB,CAAC,CAACnB,KAAK,EAAE;EACnD5C,EAAE,CAACe,IAAI,CAAC,eAAe,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { commonSelectors } from "../constants/selectors/common";
|
|
2
|
+
import { commonTexts } from "../constants/texts/common";
|
|
3
|
+
export var verifyCrossSiteScript = function verifyCrossSiteScript(inputSelector, submitSelector) {
|
|
4
|
+
cy.interceptApi("searchRequest");
|
|
5
|
+
cy.clearAndType(inputSelector, commonTexts.crossSiteScript);
|
|
6
|
+
submitSelector && cy.get(submitSelector).click();
|
|
7
|
+
cy.wait("@searchRequest");
|
|
8
|
+
cy.get(commonSelectors.windowAlert).should("not.exist");
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","names":["commonSelectors","commonTexts","verifyCrossSiteScript","inputSelector","submitSelector","cy","interceptApi","clearAndType","crossSiteScript","get","click","wait","windowAlert","should"],"sources":["../../../src/cypress-utils/utils/validation.js"],"sourcesContent":["import { commonSelectors } from \"../constants/selectors/common\";\nimport { commonTexts } from \"../constants/texts/common\";\n\nexport const verifyCrossSiteScript = (inputSelector, submitSelector) => {\n cy.interceptApi(\"searchRequest\");\n cy.clearAndType(inputSelector, commonTexts.crossSiteScript);\n submitSelector && cy.get(submitSelector).click();\n cy.wait(\"@searchRequest\");\n cy.get(commonSelectors.windowAlert).should(\"not.exist\");\n};\n"],"mappings":"AAAA,SAASA,eAAe;AACxB,SAASC,WAAW;AAEpB,OAAO,IAAMC,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAIC,aAAa,EAAEC,cAAc,EAAK;EACtEC,EAAE,CAACC,YAAY,CAAC,eAAe,CAAC;EAChCD,EAAE,CAACE,YAAY,CAACJ,aAAa,EAAEF,WAAW,CAACO,eAAe,CAAC;EAC3DJ,cAAc,IAAIC,EAAE,CAACI,GAAG,CAACL,cAAc,CAAC,CAACM,KAAK,EAAE;EAChDL,EAAE,CAACM,IAAI,CAAC,gBAAgB,CAAC;EACzBN,EAAE,CAACI,GAAG,CAACT,eAAe,CAACY,WAAW,CAAC,CAACC,MAAM,CAAC,WAAW,CAAC;AACzD,CAAC"}
|
|
@@ -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,QAAQ;EAAA,OAC/B,OAAOA,QAAQ,KAAK,QAAQ,IAC3BF,OAAA,CAAOE,QAAQ,MAAK,QAAQ,KAAK,CAAAA,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEC,MAAM,MAAID,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEE,UAAU,EAAE;AAAA;AAE9E,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAA,EAAS;EAAA,IAAAC,qBAAA,EAAAC,qBAAA;EAC3B;EACAtB,KAAK,CAACuB,QAAQ,CAACC,OAAO,IAAAF,qBAAA,OAAAG,eAAA,CAAAH,qBAAA,EACnBV,YAAY,CAACc,MAAM,EAAG,kBAAkB,GAAAD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AE;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,13 @@
|
|
|
1
|
+
export var HEADERS_KEYS = {
|
|
2
|
+
xCsrfToken: "X-CSRF-TOKEN",
|
|
3
|
+
contentType: "Content-Type",
|
|
4
|
+
accept: "Accept"
|
|
5
|
+
};
|
|
6
|
+
export var LOWERCASED = "__LOWERCASED__";
|
|
7
|
+
export var FORMATS = {
|
|
8
|
+
boldList: "boldList",
|
|
9
|
+
list: "list",
|
|
10
|
+
anyCase: "anyCase"
|
|
11
|
+
};
|
|
12
|
+
export var LIST_FORMATS = [FORMATS.boldList, FORMATS.list];
|
|
13
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","names":["HEADERS_KEYS","xCsrfToken","contentType","accept","LOWERCASED","FORMATS","boldList","list","anyCase","LIST_FORMATS"],"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__\";\n\nexport const FORMATS = {\n boldList: \"boldList\",\n list: \"list\",\n anyCase: \"anyCase\",\n};\nexport const LIST_FORMATS = [FORMATS.boldList, FORMATS.list];\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;AAE1C,OAAO,IAAMC,OAAO,GAAG;EACrBC,QAAQ,EAAE,UAAU;EACpBC,IAAI,EAAE,MAAM;EACZC,OAAO,EAAE;AACX,CAAC;AACD,OAAO,IAAMC,YAAY,GAAG,CAACJ,OAAO,CAACC,QAAQ,EAAED,OAAO,CAACE,IAAI,CAAC"}
|
|
@@ -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,67 @@
|
|
|
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 { LIST_FORMATS } from "./constants";
|
|
6
|
+
import { replaceNullValuesWithGetter } from "./utils";
|
|
7
|
+
import { listFormatter, lowerCaseDynamicTextFormatter } from "./utils/customFormatters";
|
|
8
|
+
import { sentenceCaseProcessor } from "./utils/customPostProcessors";
|
|
9
|
+
import commonsEn from "../translations/en.json";
|
|
10
|
+
|
|
11
|
+
// eslint-disable-next-line import/no-mutable-exports
|
|
12
|
+
var taxonomies = {};
|
|
13
|
+
var initializeI18n = function initializeI18n(hostTranslations) {
|
|
14
|
+
var _window$globalProps;
|
|
15
|
+
// eslint-disable-next-line no-undef
|
|
16
|
+
var packageTranslations = preval.require("../configs/scripts/getPkgTranslations.js");
|
|
17
|
+
var commonsTranslations = {
|
|
18
|
+
en: {
|
|
19
|
+
translation: commonsEn
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
var resources = [hostTranslations, commonsTranslations, packageTranslations].reduce(mergeDeepLeft);
|
|
23
|
+
var defaultTaxonomyKeys = Object.keys(resources.en.translation.taxonomyDefaultLabels || {});
|
|
24
|
+
var defaultTaxonomies = Object.fromEntries(defaultTaxonomyKeys.map(function (key) {
|
|
25
|
+
return [key, {
|
|
26
|
+
singular: null,
|
|
27
|
+
plural: null
|
|
28
|
+
}];
|
|
29
|
+
}));
|
|
30
|
+
var hostTaxonomies = ((_window$globalProps = window.globalProps) === null || _window$globalProps === void 0 ? void 0 : _window$globalProps.taxonomies) || {};
|
|
31
|
+
taxonomies = replaceNullValuesWithGetter(mergeDeepLeft(hostTaxonomies, defaultTaxonomies));
|
|
32
|
+
i18n.use(LanguageDetector).use(initReactI18next).use(sentenceCaseProcessor).init({
|
|
33
|
+
resources: resources,
|
|
34
|
+
fallbackLng: "en",
|
|
35
|
+
interpolation: {
|
|
36
|
+
defaultVariables: {
|
|
37
|
+
taxonomies: taxonomies
|
|
38
|
+
},
|
|
39
|
+
escapeValue: false,
|
|
40
|
+
skipOnVariables: false,
|
|
41
|
+
alwaysFormat: true,
|
|
42
|
+
format: function format(value, _format, lng, options) {
|
|
43
|
+
var newValue = value;
|
|
44
|
+
if (LIST_FORMATS.includes(_format)) {
|
|
45
|
+
newValue = listFormatter({
|
|
46
|
+
value: newValue,
|
|
47
|
+
format: _format,
|
|
48
|
+
lng: lng,
|
|
49
|
+
options: options
|
|
50
|
+
});
|
|
51
|
+
return newValue;
|
|
52
|
+
}
|
|
53
|
+
return lowerCaseDynamicTextFormatter(newValue, _format);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
postProcess: [sentenceCaseProcessor.name],
|
|
57
|
+
detection: {
|
|
58
|
+
order: ["querystring", "cookie", "navigator", "path"],
|
|
59
|
+
caches: ["cookie"],
|
|
60
|
+
lookupQuerystring: "lang",
|
|
61
|
+
lookupCookie: "lang"
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
export { taxonomies };
|
|
66
|
+
export default initializeI18n;
|
|
67
|
+
//# sourceMappingURL=i18n.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.js","names":["i18n","LanguageDetector","mergeDeepLeft","initReactI18next","LIST_FORMATS","replaceNullValuesWithGetter","listFormatter","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","includes","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 { LIST_FORMATS } from \"./constants\";\nimport { replaceNullValuesWithGetter } from \"./utils\";\nimport {\n listFormatter,\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\n if (LIST_FORMATS.includes(format)) {\n newValue = listFormatter({ value: newValue, format, 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,YAAY;AACrB,SAASC,2BAA2B;AACpC,SACEC,aAAa,EACbC,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,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C,YAAY,CAAC4C,QAAQ,CAACL,OAAM,CAAC,EAAE;UACjCI,QAAQ,GAAGzC,aAAa,CAAC;YAAEsC,KAAK,EAAEG,QAAQ;YAAEJ,MAAM,EAANA,OAAM;YAAEE,GAAG,EAAHA,GAAG;YAAEC,OAAO,EAAPA;UAAQ,CAAC,CAAC;UAEnE,OAAOC,QAAQ;QACjB;QAEA,OAAOxC,6BAA6B,CAACwC,QAAQ,EAAEJ,OAAM,CAAC;MACxD;IACF,CAAC;IACDM,WAAW,EAAE,CAACzC,qBAAqB,CAAC0C,IAAI,CAAC;IACzCC,SAAS,EAAE;MACTC,KAAK,EAAE,CAAC,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,CAAC;MACrDC,MAAM,EAAE,CAAC,QAAQ,CAAC;MAClBC,iBAAiB,EAAE,MAAM;MACzBC,YAAY,EAAE;IAChB;EACF,CAAC,CAAC;AACN,CAAC;AAED,SAAS7C,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"}
|