@webiny/app 5.44.1-beta.0 → 5.45.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App.d.ts +5 -13
- package/App.js +70 -87
- package/App.js.map +1 -1
- package/AppContainer.d.ts +23 -0
- package/AppContainer.js +9 -0
- package/AppContainer.js.map +1 -0
- package/README.md +7 -15
- package/apollo-client/InMemoryCache.d.ts +3 -2
- package/apollo-client/InMemoryCache.js +16 -47
- package/apollo-client/InMemoryCache.js.map +1 -1
- package/apollo-client/IntrospectionFragmentMatcher.d.ts +2 -2
- package/apollo-client/IntrospectionFragmentMatcher.js +33 -50
- package/apollo-client/IntrospectionFragmentMatcher.js.map +1 -1
- package/components/Image.d.ts +1 -2
- package/components/Image.js +11 -19
- package/components/Image.js.map +1 -1
- package/components/index.d.ts +1 -2
- package/components/index.js +1 -19
- package/components/index.js.map +1 -1
- package/config/RouterConfig/Route.d.ts +29 -0
- package/config/RouterConfig/Route.js +33 -0
- package/config/RouterConfig/Route.js.map +1 -0
- package/config/RouterConfig.d.ts +31 -0
- package/config/RouterConfig.js +18 -0
- package/config/RouterConfig.js.map +1 -0
- package/config.js +9 -15
- package/config.js.map +1 -1
- package/contexts/Ui/index.js +28 -52
- package/contexts/Ui/index.js.map +1 -1
- package/core/DebounceRender.js +13 -24
- package/core/DebounceRender.js.map +1 -1
- package/core/Plugin.d.ts +1 -1
- package/core/Plugin.js +11 -19
- package/core/Plugin.js.map +1 -1
- package/core/Plugins.d.ts +1 -1
- package/core/Plugins.js +20 -25
- package/core/Plugins.js.map +1 -1
- package/core/Provider.d.ts +1 -1
- package/core/Provider.js +9 -13
- package/core/Provider.js.map +1 -1
- package/core/Routes.d.ts +2 -1
- package/core/Routes.js +13 -23
- package/core/Routes.js.map +1 -1
- package/core/createProvider.d.ts +2 -2
- package/core/createProvider.js +1 -7
- package/core/createProvider.js.map +1 -1
- package/core/createProviderPlugin.d.ts +1 -1
- package/core/createProviderPlugin.js +4 -10
- package/core/createProviderPlugin.js.map +1 -1
- package/errors/AuthenticationErrorEvent.d.ts +9 -0
- package/errors/AuthenticationErrorEvent.js +10 -0
- package/errors/AuthenticationErrorEvent.js.map +1 -0
- package/errors/NetworkErrorEvent.d.ts +15 -0
- package/errors/NetworkErrorEvent.js +10 -0
- package/errors/NetworkErrorEvent.js.map +1 -0
- package/errors/abstractions.d.ts +12 -0
- package/errors/abstractions.js +5 -0
- package/errors/abstractions.js.map +1 -0
- package/errors/index.d.ts +6 -0
- package/errors/index.js +6 -0
- package/errors/index.js.map +1 -0
- package/exports/admin/envConfig.d.ts +1 -0
- package/exports/admin/envConfig.js +3 -0
- package/exports/admin/envConfig.js.map +1 -0
- package/exports/admin/graphqlClient.d.ts +1 -0
- package/exports/admin/graphqlClient.js +3 -0
- package/exports/admin/graphqlClient.js.map +1 -0
- package/exports/admin/localStorage.d.ts +2 -0
- package/exports/admin/localStorage.js +4 -0
- package/exports/admin/localStorage.js.map +1 -0
- package/exports/admin/router.d.ts +4 -0
- package/exports/admin/router.js +6 -0
- package/exports/admin/router.js.map +1 -0
- package/exports/admin/security.d.ts +1 -0
- package/exports/admin/security.js +3 -0
- package/exports/admin/security.js.map +1 -0
- package/exports/admin.d.ts +6 -0
- package/exports/admin.js +8 -0
- package/exports/admin.js.map +1 -0
- package/features/envConfig/EnvConfig.d.ts +6 -0
- package/features/envConfig/EnvConfig.js +14 -0
- package/features/envConfig/EnvConfig.js.map +1 -0
- package/features/envConfig/abstractions.d.ts +27 -0
- package/features/envConfig/abstractions.js +4 -0
- package/features/envConfig/abstractions.js.map +1 -0
- package/features/envConfig/feature.d.ts +17 -0
- package/features/envConfig/feature.js +14 -0
- package/features/envConfig/feature.js.map +1 -0
- package/features/envConfig/index.d.ts +1 -0
- package/features/envConfig/index.js +3 -0
- package/features/envConfig/index.js.map +1 -0
- package/features/eventPublisher/EventPublisher.d.ts +8 -0
- package/features/eventPublisher/EventPublisher.js +27 -0
- package/features/eventPublisher/EventPublisher.js.map +1 -0
- package/features/eventPublisher/abstractions.d.ts +18 -0
- package/features/eventPublisher/abstractions.js +14 -0
- package/features/eventPublisher/abstractions.js.map +1 -0
- package/features/eventPublisher/feature.d.ts +1 -0
- package/features/eventPublisher/feature.js +11 -0
- package/features/eventPublisher/feature.js.map +1 -0
- package/features/eventPublisher/index.d.ts +3 -0
- package/features/eventPublisher/index.js +4 -0
- package/features/eventPublisher/index.js.map +1 -0
- package/features/graphqlClient/AuthenticationErrorPublishing.d.ts +13 -0
- package/features/graphqlClient/AuthenticationErrorPublishing.js +35 -0
- package/features/graphqlClient/AuthenticationErrorPublishing.js.map +1 -0
- package/features/graphqlClient/BatchingGraphQLClient.d.ts +18 -0
- package/features/graphqlClient/BatchingGraphQLClient.js +164 -0
- package/features/graphqlClient/BatchingGraphQLClient.js.map +1 -0
- package/features/graphqlClient/FetchGraphQLClient.d.ts +10 -0
- package/features/graphqlClient/FetchGraphQLClient.js +62 -0
- package/features/graphqlClient/FetchGraphQLClient.js.map +1 -0
- package/features/graphqlClient/NetworkErrorPublishing.d.ts +14 -0
- package/features/graphqlClient/NetworkErrorPublishing.js +55 -0
- package/features/graphqlClient/NetworkErrorPublishing.js.map +1 -0
- package/features/graphqlClient/RequestValue.d.ts +20 -0
- package/features/graphqlClient/RequestValue.js +42 -0
- package/features/graphqlClient/RequestValue.js.map +1 -0
- package/features/graphqlClient/RetryGraphQLClient.d.ts +18 -0
- package/features/graphqlClient/RetryGraphQLClient.js +54 -0
- package/features/graphqlClient/RetryGraphQLClient.js.map +1 -0
- package/features/graphqlClient/__tests__/GraphQLClient.test.d.ts +1 -0
- package/features/graphqlClient/__tests__/GraphQLClient.test.js +350 -0
- package/features/graphqlClient/__tests__/GraphQLClient.test.js.map +1 -0
- package/features/graphqlClient/abstractions.d.ts +17 -0
- package/features/graphqlClient/abstractions.js +4 -0
- package/features/graphqlClient/abstractions.js.map +1 -0
- package/features/graphqlClient/feature.d.ts +6 -0
- package/features/graphqlClient/feature.js +31 -0
- package/features/graphqlClient/feature.js.map +1 -0
- package/features/graphqlClient/index.d.ts +1 -0
- package/features/graphqlClient/index.js +3 -0
- package/features/graphqlClient/index.js.map +1 -0
- package/features/graphqlClient/types.d.ts +5 -0
- package/features/graphqlClient/types.js +3 -0
- package/features/graphqlClient/types.js.map +1 -0
- package/features/localStorage/BrowserLocalStorageGateway.d.ts +9 -0
- package/features/localStorage/BrowserLocalStorageGateway.js +68 -0
- package/features/localStorage/BrowserLocalStorageGateway.js.map +1 -0
- package/features/localStorage/LocalStorage.d.ts +12 -0
- package/features/localStorage/LocalStorage.js +31 -0
- package/features/localStorage/LocalStorage.js.map +1 -0
- package/features/localStorage/LocalStorageRepository.d.ts +20 -0
- package/features/localStorage/LocalStorageRepository.js +95 -0
- package/features/localStorage/LocalStorageRepository.js.map +1 -0
- package/features/localStorage/abstractions.d.ts +48 -0
- package/features/localStorage/abstractions.js +19 -0
- package/features/localStorage/abstractions.js.map +1 -0
- package/features/localStorage/feature.d.ts +12 -0
- package/features/localStorage/feature.js +34 -0
- package/features/localStorage/feature.js.map +1 -0
- package/features/localStorage/index.d.ts +1 -0
- package/features/localStorage/index.js +3 -0
- package/features/localStorage/index.js.map +1 -0
- package/features/router/HistoryRouterGateway.d.ts +18 -0
- package/features/router/HistoryRouterGateway.js +82 -0
- package/features/router/HistoryRouterGateway.js.map +1 -0
- package/features/router/HistoryRouterGateway.test.d.ts +1 -0
- package/features/router/HistoryRouterGateway.test.js +204 -0
- package/features/router/HistoryRouterGateway.test.js.map +1 -0
- package/features/router/Route.d.ts +19 -0
- package/features/router/Route.js +59 -0
- package/features/router/Route.js.map +1 -0
- package/features/router/RouteUrl.d.ts +85 -0
- package/features/router/RouteUrl.js +232 -0
- package/features/router/RouteUrl.js.map +1 -0
- package/features/router/Router.d.ts +45 -0
- package/features/router/Router.js +129 -0
- package/features/router/Router.js.map +1 -0
- package/features/router/RouterPresenter.d.ts +17 -0
- package/features/router/RouterPresenter.js +45 -0
- package/features/router/RouterPresenter.js.map +1 -0
- package/features/router/RouterRepository.d.ts +21 -0
- package/features/router/RouterRepository.js +71 -0
- package/features/router/RouterRepository.js.map +1 -0
- package/features/router/RouterRepository.test.d.ts +1 -0
- package/features/router/RouterRepository.test.js +154 -0
- package/features/router/RouterRepository.test.js.map +1 -0
- package/features/router/abstractions.d.ts +68 -0
- package/features/router/abstractions.js +15 -0
- package/features/router/abstractions.js.map +1 -0
- package/features/router/feature.d.ts +4 -0
- package/features/router/feature.js +18 -0
- package/features/router/feature.js.map +1 -0
- package/features/router/index.d.ts +1 -0
- package/features/router/index.js +3 -0
- package/features/router/index.js.map +1 -0
- package/helpers/InterfaceGenerator/date.d.ts +15 -0
- package/helpers/InterfaceGenerator/date.js +3 -0
- package/helpers/InterfaceGenerator/date.js.map +1 -0
- package/helpers/InterfaceGenerator/id.d.ts +23 -0
- package/helpers/InterfaceGenerator/id.js +3 -0
- package/helpers/InterfaceGenerator/id.js.map +1 -0
- package/helpers/InterfaceGenerator/identity.d.ts +10 -0
- package/helpers/InterfaceGenerator/identity.js +3 -0
- package/helpers/InterfaceGenerator/identity.js.map +1 -0
- package/helpers/InterfaceGenerator/index.d.ts +5 -0
- package/helpers/InterfaceGenerator/index.js +3 -0
- package/helpers/InterfaceGenerator/index.js.map +1 -0
- package/helpers/InterfaceGenerator/numeric.d.ts +12 -0
- package/helpers/InterfaceGenerator/numeric.js +3 -0
- package/helpers/InterfaceGenerator/numeric.js.map +1 -0
- package/helpers/InterfaceGenerator/truthful.d.ts +7 -0
- package/helpers/InterfaceGenerator/truthful.js +3 -0
- package/helpers/InterfaceGenerator/truthful.js.map +1 -0
- package/hooks/useAutocomplete/index.d.ts +1 -1
- package/hooks/useAutocomplete/index.js +1 -12
- package/hooks/useAutocomplete/index.js.map +1 -1
- package/hooks/useAutocomplete/useAutocomplete.d.ts +1 -1
- package/hooks/useAutocomplete/useAutocomplete.js +6 -16
- package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
- package/hooks/useDataList/functions/getData.js +2 -11
- package/hooks/useDataList/functions/getData.js.map +1 -1
- package/hooks/useDataList/functions/getError.js +2 -11
- package/hooks/useDataList/functions/getError.js.map +1 -1
- package/hooks/useDataList/functions/getMeta.js +2 -11
- package/hooks/useDataList/functions/getMeta.js.map +1 -1
- package/hooks/useDataList/functions/index.d.ts +3 -3
- package/hooks/useDataList/functions/index.js +3 -27
- package/hooks/useDataList/functions/index.js.map +1 -1
- package/hooks/useDataList/functions/searchDataByKey.js +4 -10
- package/hooks/useDataList/functions/searchDataByKey.js.map +1 -1
- package/hooks/useDataList/index.d.ts +1 -1
- package/hooks/useDataList/index.js +1 -12
- package/hooks/useDataList/index.js.map +1 -1
- package/hooks/useDataList/useDataList.d.ts +2 -3
- package/hooks/useDataList/useDataList.js +74 -94
- package/hooks/useDataList/useDataList.js.map +1 -1
- package/hooks/useDataList/utils/index.d.ts +1 -2
- package/hooks/useDataList/utils/index.js +1 -20
- package/hooks/useDataList/utils/index.js.map +1 -1
- package/hooks/useDataList/utils/prepareLoadListParams.js +10 -16
- package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -1
- package/hooks/useHandler.js +7 -12
- package/hooks/useHandler.js.map +1 -1
- package/hooks/useHandlers.js +11 -17
- package/hooks/useHandlers.js.map +1 -1
- package/hooks/useRegisterLegacyPlugin.d.ts +1 -1
- package/hooks/useRegisterLegacyPlugin.js +5 -11
- package/hooks/useRegisterLegacyPlugin.js.map +1 -1
- package/hooks/useUi.d.ts +1 -1
- package/hooks/useUi.js +4 -10
- package/hooks/useUi.js.map +1 -1
- package/i18n/i18n.js +5 -13
- package/i18n/i18n.js.map +1 -1
- package/i18n/index.d.ts +1 -1
- package/i18n/index.js +1 -13
- package/i18n/index.js.map +1 -1
- package/index.d.ts +23 -15
- package/index.js +25 -177
- package/index.js.map +1 -1
- package/package.json +25 -22
- package/plugins/AddQuerySelectionPlugin.d.ts +2 -2
- package/plugins/AddQuerySelectionPlugin.js +61 -107
- package/plugins/AddQuerySelectionPlugin.js.map +1 -1
- package/plugins/ApolloCacheObjectIdPlugin.js +12 -31
- package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -1
- package/plugins/ApolloDynamicLink.d.ts +3 -2
- package/plugins/ApolloDynamicLink.js +19 -46
- package/plugins/ApolloDynamicLink.js.map +1 -1
- package/plugins/ApolloLinkPlugin.d.ts +1 -1
- package/plugins/ApolloLinkPlugin.js +18 -37
- package/plugins/ApolloLinkPlugin.js.map +1 -1
- package/plugins/ConsoleLinkPlugin.d.ts +1 -1
- package/plugins/ConsoleLinkPlugin.js +20 -41
- package/plugins/ConsoleLinkPlugin.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +8 -13
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +35 -58
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.d.ts +14 -0
- package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js +31 -0
- package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.d.ts +2 -0
- package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js +31 -0
- package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +4 -5
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +68 -12
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/Typography.d.ts +8 -0
- package/plugins/NetworkErrorLinkPlugin/Typography.js +18 -0
- package/plugins/NetworkErrorLinkPlugin/Typography.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +3 -3
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +10 -25
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin.d.ts +4 -1
- package/plugins/NetworkErrorLinkPlugin.js +60 -37
- package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
- package/plugins/OmitTypenameLinkPlugin.d.ts +1 -1
- package/plugins/OmitTypenameLinkPlugin.js +11 -30
- package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
- package/plugins/TenantHeaderLinkPlugin.d.ts +3 -3
- package/plugins/TenantHeaderLinkPlugin.js +29 -48
- package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
- package/plugins/components/Image.d.ts +6 -0
- package/plugins/components/Image.js +19 -0
- package/plugins/components/Image.js.map +1 -0
- package/plugins/image.d.ts +1 -1
- package/plugins/image.js +46 -53
- package/plugins/image.js.map +1 -1
- package/plugins/index.d.ts +4 -4
- package/plugins/index.js +31 -53
- package/plugins/index.js.map +1 -1
- package/presentation/localStorage/index.d.ts +3 -0
- package/presentation/localStorage/index.js +5 -0
- package/presentation/localStorage/index.js.map +1 -0
- package/presentation/localStorage/useLocalStorage.d.ts +6 -0
- package/presentation/localStorage/useLocalStorage.js +21 -0
- package/presentation/localStorage/useLocalStorage.js.map +1 -0
- package/presentation/localStorage/useLocalStorageValue.d.ts +1 -0
- package/presentation/localStorage/useLocalStorageValue.js +20 -0
- package/presentation/localStorage/useLocalStorageValue.js.map +1 -0
- package/presentation/localStorage/useLocalStorageValues.d.ts +5 -0
- package/presentation/localStorage/useLocalStorageValues.js +39 -0
- package/presentation/localStorage/useLocalStorageValues.js.map +1 -0
- package/presentation/router/RouteElementRegistry.d.ts +14 -0
- package/presentation/router/RouteElementRegistry.js +32 -0
- package/presentation/router/RouteElementRegistry.js.map +1 -0
- package/presentation/router/abstractions.d.ts +13 -0
- package/presentation/router/abstractions.js +4 -0
- package/presentation/router/abstractions.js.map +1 -0
- package/presentation/router/components/RouteContent.d.ts +2 -0
- package/presentation/router/components/RouteContent.js +17 -0
- package/presentation/router/components/RouteContent.js.map +1 -0
- package/presentation/router/components/RouteLink.d.ts +50 -0
- package/presentation/router/components/RouteLink.js +22 -0
- package/presentation/router/components/RouteLink.js.map +1 -0
- package/presentation/router/components/SimpleLink.d.ts +44 -0
- package/presentation/router/components/SimpleLink.js +30 -0
- package/presentation/router/components/SimpleLink.js.map +1 -0
- package/presentation/router/hooks/useRoute.d.ts +6 -0
- package/presentation/router/hooks/useRoute.js +30 -0
- package/presentation/router/hooks/useRoute.js.map +1 -0
- package/presentation/router/hooks/useRouter.d.ts +7 -0
- package/presentation/router/hooks/useRouter.js +26 -0
- package/presentation/router/hooks/useRouter.js.map +1 -0
- package/presentation/router/index.d.ts +4 -0
- package/presentation/router/index.js +5 -0
- package/presentation/router/index.js.map +1 -0
- package/presentation/router/types.d.ts +5 -0
- package/presentation/router/types.js +3 -0
- package/presentation/router/types.js.map +1 -0
- package/react-butterfiles/Files.js +208 -235
- package/react-butterfiles/Files.js.map +1 -1
- package/react-butterfiles/file.todo +1 -0
- package/react-butterfiles/index.d.ts +1 -1
- package/react-butterfiles/index.js +2 -8
- package/react-butterfiles/index.js.map +1 -1
- package/react-butterfiles/utils/generateId.js +1 -7
- package/react-butterfiles/utils/generateId.js.map +1 -1
- package/react-butterfiles/utils/readFileContent.js +4 -10
- package/react-butterfiles/utils/readFileContent.js.map +1 -1
- package/renderApp.d.ts +1 -1
- package/renderApp.js +4 -11
- package/renderApp.js.map +1 -1
- package/router.d.ts +5 -0
- package/router.js +8 -0
- package/router.js.map +1 -0
- package/shared/di/DiContainerProvider.d.ts +8 -0
- package/shared/di/DiContainerProvider.js +17 -0
- package/shared/di/DiContainerProvider.js.map +1 -0
- package/shared/di/createFeature.d.ts +11 -0
- package/shared/di/createFeature.js +11 -0
- package/shared/di/createFeature.js.map +1 -0
- package/shared/di/useFeature.d.ts +2 -0
- package/shared/di/useFeature.js +18 -0
- package/shared/di/useFeature.js.map +1 -0
- package/types.d.ts +9 -6
- package/types.js +1 -12
- package/types.js.map +1 -1
- package/utils/createGenericContext.js +13 -22
- package/utils/createGenericContext.js.map +1 -1
- package/utils/createHashing.js +9 -15
- package/utils/createHashing.js.map +1 -1
- package/utils/index.d.ts +2 -10
- package/utils/index.js +2 -115
- package/utils/index.js.map +1 -1
- package/utils/legacyPluginToReactComponent.d.ts +1 -1
- package/utils/legacyPluginToReactComponent.js +5 -11
- package/utils/legacyPluginToReactComponent.js.map +1 -1
- package/components/Routes.d.ts +0 -2
- package/components/Routes.js +0 -46
- package/components/Routes.js.map +0 -1
- package/components/View.d.ts +0 -8
- package/components/View.js +0 -31
- package/components/View.js.map +0 -1
- package/core/AddRoute.d.ts +0 -21
- package/core/AddRoute.js +0 -21
- package/core/AddRoute.js.map +0 -1
- package/hooks/useDataList/utils/redirectToRouteWithQueryParams.d.ts +0 -14
- package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +0 -30
- package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +0 -1
- package/hooks/useDataList/utils/types.d.ts +0 -40
- package/hooks/useDataList/utils/types.js +0 -7
- package/hooks/useDataList/utils/types.js.map +0 -1
- package/plugins/LocaleHeaderLinkPlugin.d.ts +0 -10
- package/plugins/LocaleHeaderLinkPlugin.js +0 -49
- package/plugins/LocaleHeaderLinkPlugin.js.map +0 -1
- package/plugins/RoutePlugin.d.ts +0 -12
- package/plugins/RoutePlugin.js +0 -35
- package/plugins/RoutePlugin.js.map +0 -1
- package/plugins/ViewPlugin.d.ts +0 -14
- package/plugins/ViewPlugin.js +0 -40
- package/plugins/ViewPlugin.js.map +0 -1
- package/utils/getApiUrl.d.ts +0 -1
- package/utils/getApiUrl.js +0 -12
- package/utils/getApiUrl.js.map +0 -1
- package/utils/getGqlApiUrl.d.ts +0 -1
- package/utils/getGqlApiUrl.js +0 -12
- package/utils/getGqlApiUrl.js.map +0 -1
- package/utils/getHeadlessCmsGqlApiUrl.d.ts +0 -5
- package/utils/getHeadlessCmsGqlApiUrl.js +0 -18
- package/utils/getHeadlessCmsGqlApiUrl.js.map +0 -1
- package/utils/getLocaleCode.d.ts +0 -6
- package/utils/getLocaleCode.js +0 -43
- package/utils/getLocaleCode.js.map +0 -1
- package/utils/getPrerenderId.d.ts +0 -6
- package/utils/getPrerenderId.js +0 -11
- package/utils/getPrerenderId.js.map +0 -1
- package/utils/getTenantId.d.ts +0 -6
- package/utils/getTenantId.js +0 -51
- package/utils/getTenantId.js.map +0 -1
- package/utils/isLocalhost.d.ts +0 -1
- package/utils/isLocalhost.js +0 -15
- package/utils/isLocalhost.js.map +0 -1
- package/utils/isPrerendering.d.ts +0 -1
- package/utils/isPrerendering.js +0 -11
- package/utils/isPrerendering.js.map +0 -1
|
@@ -1,37 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _reactDom = require("react-dom");
|
|
10
|
-
var _ErrorOverlay = _interopRequireDefault(require("./ErrorOverlay"));
|
|
11
|
-
/**
|
|
12
|
-
* TODO fix with react 19
|
|
13
|
-
*/
|
|
14
|
-
// eslint-disable-next-line react/no-deprecated
|
|
15
|
-
|
|
16
|
-
var createErrorOverlay = function createErrorOverlay(params) {
|
|
17
|
-
var query = params.query,
|
|
18
|
-
networkError = params.networkError;
|
|
1
|
+
import { createRoot } from "react-dom/client";
|
|
2
|
+
const createErrorOverlay = params => {
|
|
3
|
+
const {
|
|
4
|
+
element
|
|
5
|
+
} = params;
|
|
19
6
|
// If the element already present in DOM, return immediately.
|
|
20
7
|
if (document.getElementById("overlay-root")) {
|
|
21
8
|
return;
|
|
22
9
|
}
|
|
23
10
|
// Create root element to hold React tree.
|
|
24
|
-
|
|
11
|
+
const container = document.createElement("div");
|
|
25
12
|
container.id = "overlay-root";
|
|
26
13
|
// Insert root element into body.
|
|
27
|
-
|
|
14
|
+
const body = document.getElementsByTagName("body")[0];
|
|
28
15
|
body.appendChild(container);
|
|
29
16
|
// Mount the ErrorOverlay component into root element.
|
|
30
|
-
(
|
|
31
|
-
|
|
32
|
-
networkError: networkError
|
|
33
|
-
}), container);
|
|
17
|
+
const root = createRoot(container);
|
|
18
|
+
root.render(element);
|
|
34
19
|
};
|
|
35
|
-
|
|
20
|
+
export default createErrorOverlay;
|
|
36
21
|
|
|
37
22
|
//# sourceMappingURL=createErrorOverlay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["createRoot","createErrorOverlay","params","element","document","getElementById","container","createElement","id","body","getElementsByTagName","appendChild","root","render"],"sources":["createErrorOverlay.tsx"],"sourcesContent":["import type React from \"react\";\nimport { createRoot } from \"react-dom/client\";\n\ninterface CreateErrorOverlayParams {\n element: React.ReactElement;\n closeable?: boolean;\n}\n\nconst createErrorOverlay = (params: CreateErrorOverlayParams): void => {\n const { element } = params;\n // If the element already present in DOM, return immediately.\n if (document.getElementById(\"overlay-root\")) {\n return;\n }\n // Create root element to hold React tree.\n const container: HTMLDivElement = document.createElement(\"div\");\n container.id = \"overlay-root\";\n // Insert root element into body.\n const body: HTMLBodyElement = document.getElementsByTagName(\"body\")[0];\n body.appendChild(container);\n // Mount the ErrorOverlay component into root element.\n const root = createRoot(container);\n root.render(element);\n};\n\nexport default createErrorOverlay;\n"],"mappings":"AACA,SAASA,UAAU,QAAQ,kBAAkB;AAO7C,MAAMC,kBAAkB,GAAIC,MAAgC,IAAW;EACnE,MAAM;IAAEC;EAAQ,CAAC,GAAGD,MAAM;EAC1B;EACA,IAAIE,QAAQ,CAACC,cAAc,CAAC,cAAc,CAAC,EAAE;IACzC;EACJ;EACA;EACA,MAAMC,SAAyB,GAAGF,QAAQ,CAACG,aAAa,CAAC,KAAK,CAAC;EAC/DD,SAAS,CAACE,EAAE,GAAG,cAAc;EAC7B;EACA,MAAMC,IAAqB,GAAGL,QAAQ,CAACM,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;EACtED,IAAI,CAACE,WAAW,CAACL,SAAS,CAAC;EAC3B;EACA,MAAMM,IAAI,GAAGZ,UAAU,CAACM,SAAS,CAAC;EAClCM,IAAI,CAACC,MAAM,CAACV,OAAO,CAAC;AACxB,CAAC;AAED,eAAeF,kBAAkB","ignoreList":[]}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { ApolloLinkPlugin } from "./ApolloLinkPlugin";
|
|
1
|
+
import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
|
|
2
|
+
import type { EventPublisher } from "../features/eventPublisher/index.js";
|
|
2
3
|
/**
|
|
3
4
|
* This plugin creates an ApolloLink that checks for `NetworkError` and shows an ErrorOverlay in the browser.
|
|
4
5
|
*/
|
|
5
6
|
export declare class NetworkErrorLinkPlugin extends ApolloLinkPlugin {
|
|
7
|
+
private getEventPublisher;
|
|
8
|
+
constructor(getEventPublisher: () => EventPublisher.Interface);
|
|
6
9
|
createLink(): import("apollo-link").ApolloLink;
|
|
7
10
|
}
|
|
@@ -1,47 +1,70 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { onError } from "apollo-link-error";
|
|
3
|
+
import { print } from "graphql/language/index.js";
|
|
4
|
+
import { boolean } from "boolean";
|
|
5
|
+
import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
|
|
6
|
+
import createErrorOverlay from "./NetworkErrorLinkPlugin/createErrorOverlay.js";
|
|
7
|
+
import { LocalAwsLambdaTimeoutMessage } from "./NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js";
|
|
8
|
+
import { config as appConfig } from "../config.js";
|
|
9
|
+
import { ErrorOverlay } from "./NetworkErrorLinkPlugin/ErrorOverlay.js";
|
|
10
|
+
import { GqlErrorOverlay } from "./NetworkErrorLinkPlugin/GqlErrorOverlay.js";
|
|
11
|
+
import { NetworkErrorEvent } from "../errors/index.js";
|
|
12
|
+
const isLocalAwsLambdaFnInvocationTimeoutError = error => {
|
|
13
|
+
return error.result && error.result.code === "LOCAL_AWS_LAMBDA_TIMEOUT";
|
|
14
|
+
};
|
|
2
15
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.NetworkErrorLinkPlugin = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/callSuper"));
|
|
11
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
|
-
var _ApolloLinkPlugin2 = require("./ApolloLinkPlugin");
|
|
13
|
-
var _apolloLinkError = require("apollo-link-error");
|
|
14
|
-
var _language = require("graphql/language");
|
|
15
|
-
var _createErrorOverlay = _interopRequireDefault(require("./NetworkErrorLinkPlugin/createErrorOverlay"));
|
|
16
|
-
var _boolean = require("boolean");
|
|
17
|
-
var _config = require("../config");
|
|
18
16
|
/**
|
|
19
17
|
* This plugin creates an ApolloLink that checks for `NetworkError` and shows an ErrorOverlay in the browser.
|
|
20
18
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
(
|
|
24
|
-
|
|
19
|
+
export class NetworkErrorLinkPlugin extends ApolloLinkPlugin {
|
|
20
|
+
constructor(getEventPublisher) {
|
|
21
|
+
super();
|
|
22
|
+
this.getEventPublisher = getEventPublisher;
|
|
25
23
|
}
|
|
26
|
-
(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
createLink() {
|
|
25
|
+
return onError(({
|
|
26
|
+
networkError,
|
|
27
|
+
operation
|
|
28
|
+
}) => {
|
|
29
|
+
const debug = appConfig.getKey("DEBUG", boolean(process.env.REACT_APP_DEBUG));
|
|
30
|
+
if (networkError) {
|
|
31
|
+
// Publish network error event
|
|
32
|
+
const errorType = isLocalAwsLambdaFnInvocationTimeoutError(networkError) ? "timeout" : "network";
|
|
33
|
+
const event = new NetworkErrorEvent({
|
|
34
|
+
message: networkError.message,
|
|
35
|
+
operationName: operation.operationName,
|
|
36
|
+
query: print(operation.query),
|
|
37
|
+
variables: operation.variables,
|
|
38
|
+
errorType,
|
|
39
|
+
statusCode: networkError.statusCode,
|
|
40
|
+
result: networkError.result
|
|
41
|
+
});
|
|
42
|
+
this.getEventPublisher().publish(event);
|
|
43
|
+
|
|
44
|
+
// Keep existing overlay logic for now
|
|
45
|
+
if (debug) {
|
|
46
|
+
if (isLocalAwsLambdaFnInvocationTimeoutError(networkError)) {
|
|
47
|
+
createErrorOverlay({
|
|
48
|
+
element: /*#__PURE__*/React.createElement(ErrorOverlay, {
|
|
49
|
+
message: /*#__PURE__*/React.createElement(LocalAwsLambdaTimeoutMessage, null),
|
|
50
|
+
closeable: false
|
|
51
|
+
}),
|
|
52
|
+
closeable: false
|
|
53
|
+
});
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
createErrorOverlay({
|
|
57
|
+
element: /*#__PURE__*/React.createElement(GqlErrorOverlay, {
|
|
58
|
+
query: print(operation.query),
|
|
59
|
+
networkError: networkError
|
|
60
|
+
})
|
|
38
61
|
});
|
|
39
62
|
}
|
|
63
|
+
}
|
|
40
64
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}(_ApolloLinkPlugin2.ApolloLinkPlugin);
|
|
65
|
+
// TODO: also print graphQLErrors
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
46
69
|
|
|
47
70
|
//# sourceMappingURL=NetworkErrorLinkPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["React","onError","print","boolean","ApolloLinkPlugin","createErrorOverlay","LocalAwsLambdaTimeoutMessage","config","appConfig","ErrorOverlay","GqlErrorOverlay","NetworkErrorEvent","isLocalAwsLambdaFnInvocationTimeoutError","error","result","code","NetworkErrorLinkPlugin","constructor","getEventPublisher","createLink","networkError","operation","debug","getKey","process","env","REACT_APP_DEBUG","errorType","event","message","operationName","query","variables","statusCode","publish","element","createElement","closeable"],"sources":["NetworkErrorLinkPlugin.tsx"],"sourcesContent":["import React from \"react\";\nimport { onError } from \"apollo-link-error\";\nimport { type ServerError } from \"apollo-link-http-common\";\nimport { print } from \"graphql/language/index.js\";\nimport { boolean } from \"boolean\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin.js\";\nimport createErrorOverlay from \"./NetworkErrorLinkPlugin/createErrorOverlay.js\";\nimport { LocalAwsLambdaTimeoutMessage } from \"./NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js\";\nimport { config as appConfig } from \"~/config.js\";\nimport { ErrorOverlay } from \"~/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js\";\nimport { GqlErrorOverlay } from \"./NetworkErrorLinkPlugin/GqlErrorOverlay.js\";\nimport type { EventPublisher } from \"~/features/eventPublisher/index.js\";\nimport { NetworkErrorEvent } from \"~/errors/index.js\";\n\nconst isLocalAwsLambdaFnInvocationTimeoutError = (error: any): error is ServerError => {\n return error.result && error.result.code === \"LOCAL_AWS_LAMBDA_TIMEOUT\";\n};\n\n/**\n * This plugin creates an ApolloLink that checks for `NetworkError` and shows an ErrorOverlay in the browser.\n */\nexport class NetworkErrorLinkPlugin extends ApolloLinkPlugin {\n constructor(private getEventPublisher: () => EventPublisher.Interface) {\n super();\n }\n\n public override createLink() {\n return onError(({ networkError, operation }) => {\n const debug = appConfig.getKey(\"DEBUG\", boolean(process.env.REACT_APP_DEBUG));\n\n if (networkError) {\n // Publish network error event\n const errorType = isLocalAwsLambdaFnInvocationTimeoutError(networkError)\n ? \"timeout\"\n : \"network\";\n\n const event = new NetworkErrorEvent({\n message: networkError.message,\n operationName: operation.operationName,\n query: print(operation.query),\n variables: operation.variables,\n errorType,\n statusCode: (networkError as any).statusCode,\n result: (networkError as any).result\n });\n\n this.getEventPublisher().publish(event);\n\n // Keep existing overlay logic for now\n if (debug) {\n if (isLocalAwsLambdaFnInvocationTimeoutError(networkError)) {\n createErrorOverlay({\n element: (\n <ErrorOverlay\n message={<LocalAwsLambdaTimeoutMessage />}\n closeable={false}\n />\n ),\n closeable: false\n });\n return;\n }\n\n createErrorOverlay({\n element: (\n <GqlErrorOverlay\n query={print(operation.query)}\n networkError={networkError}\n />\n )\n });\n }\n }\n\n // TODO: also print graphQLErrors\n });\n }\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,OAAO,QAAQ,mBAAmB;AAE3C,SAASC,KAAK,QAAQ,2BAA2B;AACjD,SAASC,OAAO,QAAQ,SAAS;AACjC,SAASC,gBAAgB;AACzB,OAAOC,kBAAkB;AACzB,SAASC,4BAA4B;AACrC,SAASC,MAAM,IAAIC,SAAS;AAC5B,SAASC,YAAY;AACrB,SAASC,eAAe;AAExB,SAASC,iBAAiB;AAE1B,MAAMC,wCAAwC,GAAIC,KAAU,IAA2B;EACnF,OAAOA,KAAK,CAACC,MAAM,IAAID,KAAK,CAACC,MAAM,CAACC,IAAI,KAAK,0BAA0B;AAC3E,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,SAASZ,gBAAgB,CAAC;EACzDa,WAAWA,CAASC,iBAAiD,EAAE;IACnE,KAAK,CAAC,CAAC;IAAC,KADQA,iBAAiD,GAAjDA,iBAAiD;EAErE;EAEgBC,UAAUA,CAAA,EAAG;IACzB,OAAOlB,OAAO,CAAC,CAAC;MAAEmB,YAAY;MAAEC;IAAU,CAAC,KAAK;MAC5C,MAAMC,KAAK,GAAGd,SAAS,CAACe,MAAM,CAAC,OAAO,EAAEpB,OAAO,CAACqB,OAAO,CAACC,GAAG,CAACC,eAAe,CAAC,CAAC;MAE7E,IAAIN,YAAY,EAAE;QACd;QACA,MAAMO,SAAS,GAAGf,wCAAwC,CAACQ,YAAY,CAAC,GAClE,SAAS,GACT,SAAS;QAEf,MAAMQ,KAAK,GAAG,IAAIjB,iBAAiB,CAAC;UAChCkB,OAAO,EAAET,YAAY,CAACS,OAAO;UAC7BC,aAAa,EAAET,SAAS,CAACS,aAAa;UACtCC,KAAK,EAAE7B,KAAK,CAACmB,SAAS,CAACU,KAAK,CAAC;UAC7BC,SAAS,EAAEX,SAAS,CAACW,SAAS;UAC9BL,SAAS;UACTM,UAAU,EAAGb,YAAY,CAASa,UAAU;UAC5CnB,MAAM,EAAGM,YAAY,CAASN;QAClC,CAAC,CAAC;QAEF,IAAI,CAACI,iBAAiB,CAAC,CAAC,CAACgB,OAAO,CAACN,KAAK,CAAC;;QAEvC;QACA,IAAIN,KAAK,EAAE;UACP,IAAIV,wCAAwC,CAACQ,YAAY,CAAC,EAAE;YACxDf,kBAAkB,CAAC;cACf8B,OAAO,eACHnC,KAAA,CAAAoC,aAAA,CAAC3B,YAAY;gBACToB,OAAO,eAAE7B,KAAA,CAAAoC,aAAA,CAAC9B,4BAA4B,MAAE,CAAE;gBAC1C+B,SAAS,EAAE;cAAM,CACpB,CACJ;cACDA,SAAS,EAAE;YACf,CAAC,CAAC;YACF;UACJ;UAEAhC,kBAAkB,CAAC;YACf8B,OAAO,eACHnC,KAAA,CAAAoC,aAAA,CAAC1B,eAAe;cACZqB,KAAK,EAAE7B,KAAK,CAACmB,SAAS,CAACU,KAAK,CAAE;cAC9BX,YAAY,EAAEA;YAAa,CAC9B;UAET,CAAC,CAAC;QACN;MACJ;;MAEA;IACJ,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.OmitTypenameLinkPlugin = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/callSuper"));
|
|
11
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
|
-
var _apolloLink = require("apollo-link");
|
|
13
|
-
var _ApolloLinkPlugin2 = require("./ApolloLinkPlugin");
|
|
1
|
+
import { ApolloLink } from "apollo-link";
|
|
2
|
+
import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
|
|
14
3
|
function omitTypename(key, value) {
|
|
15
4
|
return key === "__typename" ? undefined : value;
|
|
16
5
|
}
|
|
@@ -18,23 +7,15 @@ function omitTypename(key, value) {
|
|
|
18
7
|
/**
|
|
19
8
|
* This link removes `__typename` from the variables being sent to the API.
|
|
20
9
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
(
|
|
24
|
-
|
|
10
|
+
export class OmitTypenameLinkPlugin extends ApolloLinkPlugin {
|
|
11
|
+
createLink() {
|
|
12
|
+
return new ApolloLink((operation, forward) => {
|
|
13
|
+
if (operation.variables) {
|
|
14
|
+
operation.variables = JSON.parse(JSON.stringify(operation.variables), omitTypename);
|
|
15
|
+
}
|
|
16
|
+
return forward(operation);
|
|
17
|
+
});
|
|
25
18
|
}
|
|
26
|
-
|
|
27
|
-
return (0, _createClass2.default)(OmitTypenameLinkPlugin, [{
|
|
28
|
-
key: "createLink",
|
|
29
|
-
value: function createLink() {
|
|
30
|
-
return new _apolloLink.ApolloLink(function (operation, forward) {
|
|
31
|
-
if (operation.variables) {
|
|
32
|
-
operation.variables = JSON.parse(JSON.stringify(operation.variables), omitTypename);
|
|
33
|
-
}
|
|
34
|
-
return forward(operation);
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}]);
|
|
38
|
-
}(_ApolloLinkPlugin2.ApolloLinkPlugin);
|
|
19
|
+
}
|
|
39
20
|
|
|
40
21
|
//# sourceMappingURL=OmitTypenameLinkPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["ApolloLink","ApolloLinkPlugin","omitTypename","key","value","undefined","OmitTypenameLinkPlugin","createLink","operation","forward","variables","JSON","parse","stringify"],"sources":["OmitTypenameLinkPlugin.ts"],"sourcesContent":["import { ApolloLink } from \"apollo-link\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin.js\";\n\nfunction omitTypename(key: string, value: string): string | undefined {\n return key === \"__typename\" ? undefined : value;\n}\n\n/**\n * This link removes `__typename` from the variables being sent to the API.\n */\nexport class OmitTypenameLinkPlugin extends ApolloLinkPlugin {\n public override createLink(): ApolloLink {\n return new ApolloLink((operation, forward) => {\n if (operation.variables) {\n operation.variables = JSON.parse(JSON.stringify(operation.variables), omitTypename);\n }\n return forward(operation);\n });\n }\n}\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,aAAa;AACxC,SAASC,gBAAgB;AAEzB,SAASC,YAAYA,CAACC,GAAW,EAAEC,KAAa,EAAsB;EAClE,OAAOD,GAAG,KAAK,YAAY,GAAGE,SAAS,GAAGD,KAAK;AACnD;;AAEA;AACA;AACA;AACA,OAAO,MAAME,sBAAsB,SAASL,gBAAgB,CAAC;EACzCM,UAAUA,CAAA,EAAe;IACrC,OAAO,IAAIP,UAAU,CAAC,CAACQ,SAAS,EAAEC,OAAO,KAAK;MAC1C,IAAID,SAAS,CAACE,SAAS,EAAE;QACrBF,SAAS,CAACE,SAAS,GAAGC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,SAAS,CAACL,SAAS,CAACE,SAAS,CAAC,EAAER,YAAY,CAAC;MACvF;MACA,OAAOO,OAAO,CAACD,SAAS,CAAC;IAC7B,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ApolloLinkPlugin } from "./ApolloLinkPlugin";
|
|
2
|
-
import { ApolloLink } from "apollo-link";
|
|
1
|
+
import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
|
|
2
|
+
import type { ApolloLink } from "apollo-link";
|
|
3
3
|
/**
|
|
4
4
|
* Append `x-tenant` header from URL query (necessary for prerendering service).
|
|
5
5
|
*/
|
|
6
6
|
export declare class TenantHeaderLinkPlugin extends ApolloLinkPlugin {
|
|
7
7
|
private readonly tenant;
|
|
8
|
-
constructor(tenant
|
|
8
|
+
constructor(tenant: string);
|
|
9
9
|
createLink(): ApolloLink;
|
|
10
10
|
}
|
|
@@ -1,56 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.TenantHeaderLinkPlugin = void 0;
|
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/callSuper"));
|
|
12
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
-
var _apolloLinkContext = require("apollo-link-context");
|
|
14
|
-
var _ApolloLinkPlugin2 = require("./ApolloLinkPlugin");
|
|
15
|
-
var _utils = require("../utils");
|
|
1
|
+
import { setContext } from "apollo-link-context";
|
|
2
|
+
import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
|
|
16
3
|
/**
|
|
17
4
|
* Append `x-tenant` header from URL query (necessary for prerendering service).
|
|
18
5
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
_this.name = "tenant-header-link";
|
|
25
|
-
_this.tenant = tenant || (0, _utils.getTenantId)();
|
|
26
|
-
return _this;
|
|
6
|
+
export class TenantHeaderLinkPlugin extends ApolloLinkPlugin {
|
|
7
|
+
constructor(tenant) {
|
|
8
|
+
super();
|
|
9
|
+
this.name = "tenant-header-link";
|
|
10
|
+
this.tenant = tenant;
|
|
27
11
|
}
|
|
28
|
-
(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
if (_this2.tenant) {
|
|
42
|
-
return {
|
|
43
|
-
headers: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, headers), {}, {
|
|
44
|
-
"x-tenant": _this2.tenant
|
|
45
|
-
})
|
|
46
|
-
};
|
|
47
|
-
}
|
|
12
|
+
createLink() {
|
|
13
|
+
return setContext((_, {
|
|
14
|
+
headers
|
|
15
|
+
}) => {
|
|
16
|
+
// If tenant header is already set, do not overwrite it.
|
|
17
|
+
if (headers && "x-tenant" in headers) {
|
|
18
|
+
return {
|
|
19
|
+
headers
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
if (this.tenant) {
|
|
48
23
|
return {
|
|
49
|
-
headers:
|
|
24
|
+
headers: {
|
|
25
|
+
...headers,
|
|
26
|
+
"x-tenant": this.tenant
|
|
27
|
+
}
|
|
50
28
|
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
headers
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
55
36
|
|
|
56
37
|
//# sourceMappingURL=TenantHeaderLinkPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["setContext","ApolloLinkPlugin","TenantHeaderLinkPlugin","constructor","tenant","name","createLink","_","headers"],"sources":["TenantHeaderLinkPlugin.ts"],"sourcesContent":["import { setContext } from \"apollo-link-context\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin.js\";\nimport type { ApolloLink } from \"apollo-link\";\n\n/**\n * Append `x-tenant` header from URL query (necessary for prerendering service).\n */\nexport class TenantHeaderLinkPlugin extends ApolloLinkPlugin {\n private readonly tenant: string;\n\n public constructor(tenant: string) {\n super();\n this.name = \"tenant-header-link\";\n\n this.tenant = tenant;\n }\n\n public override createLink(): ApolloLink {\n return setContext((_, { headers }) => {\n // If tenant header is already set, do not overwrite it.\n if (headers && \"x-tenant\" in headers) {\n return { headers };\n }\n\n if (this.tenant) {\n return {\n headers: {\n ...headers,\n \"x-tenant\": this.tenant\n }\n };\n }\n\n return { headers };\n });\n }\n}\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,qBAAqB;AAChD,SAASC,gBAAgB;AAGzB;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,SAASD,gBAAgB,CAAC;EAGlDE,WAAWA,CAACC,MAAc,EAAE;IAC/B,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,IAAI,GAAG,oBAAoB;IAEhC,IAAI,CAACD,MAAM,GAAGA,MAAM;EACxB;EAEgBE,UAAUA,CAAA,EAAe;IACrC,OAAON,UAAU,CAAC,CAACO,CAAC,EAAE;MAAEC;IAAQ,CAAC,KAAK;MAClC;MACA,IAAIA,OAAO,IAAI,UAAU,IAAIA,OAAO,EAAE;QAClC,OAAO;UAAEA;QAAQ,CAAC;MACtB;MAEA,IAAI,IAAI,CAACJ,MAAM,EAAE;QACb,OAAO;UACHI,OAAO,EAAE;YACL,GAAGA,OAAO;YACV,UAAU,EAAE,IAAI,CAACJ;UACrB;QACJ,CAAC;MACL;MAEA,OAAO;QAAEI;MAAQ,CAAC;IACtB,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface ImageProps extends React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement> {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}
|
|
5
|
+
declare const Image: ({ ...rest }: ImageProps) => React.JSX.Element;
|
|
6
|
+
export { Image, type ImageProps };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
// Accepts all props that a normal <img> element would accept.
|
|
4
|
+
|
|
5
|
+
const Image = ({
|
|
6
|
+
...rest
|
|
7
|
+
}) => {
|
|
8
|
+
const finalProps = {
|
|
9
|
+
...rest
|
|
10
|
+
};
|
|
11
|
+
const srcSet = finalProps.srcSet;
|
|
12
|
+
if (srcSet && typeof srcSet === "object") {
|
|
13
|
+
finalProps.srcSet = Object.keys(srcSet).map(key => `${srcSet[key]} ${key}`).join(", ");
|
|
14
|
+
}
|
|
15
|
+
return /*#__PURE__*/React.createElement("img", finalProps);
|
|
16
|
+
};
|
|
17
|
+
export { Image };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=Image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Image","rest","finalProps","srcSet","Object","keys","map","key","join","createElement"],"sources":["Image.tsx"],"sourcesContent":["import React from \"react\";\n\n// Accepts all props that a normal <img> element would accept.\ninterface ImageProps\n extends React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement> {\n [key: string]: any;\n}\n\nconst Image = ({ ...rest }: ImageProps) => {\n const finalProps = { ...rest };\n const srcSet = finalProps.srcSet;\n if (srcSet && typeof srcSet === \"object\") {\n finalProps.srcSet = Object.keys(srcSet)\n .map(key => `${srcSet[key]} ${key}`)\n .join(\", \");\n }\n\n return <img {...finalProps} />;\n};\n\nexport { Image, type ImageProps };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;;AAEzB;;AAMA,MAAMC,KAAK,GAAGA,CAAC;EAAE,GAAGC;AAAiB,CAAC,KAAK;EACvC,MAAMC,UAAU,GAAG;IAAE,GAAGD;EAAK,CAAC;EAC9B,MAAME,MAAM,GAAGD,UAAU,CAACC,MAAM;EAChC,IAAIA,MAAM,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;IACtCD,UAAU,CAACC,MAAM,GAAGC,MAAM,CAACC,IAAI,CAACF,MAAM,CAAC,CAClCG,GAAG,CAACC,GAAG,IAAI,GAAGJ,MAAM,CAACI,GAAG,CAAC,IAAIA,GAAG,EAAE,CAAC,CACnCC,IAAI,CAAC,IAAI,CAAC;EACnB;EAEA,oBAAOT,KAAA,CAAAU,aAAA,QAASP,UAAa,CAAC;AAClC,CAAC;AAED,SAASF,KAAK","ignoreList":[]}
|
package/plugins/image.d.ts
CHANGED
package/plugins/image.js
CHANGED
|
@@ -1,24 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
var _Image = require("@webiny/ui/Image");
|
|
12
|
-
var _excluded = ["transform", "srcSet"];
|
|
13
|
-
var SUPPORTED_IMAGE_RESIZE_WIDTHS = [100, 300, 500, 750, 1000, 1500, 2500];
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Image } from "./components/Image.js";
|
|
3
|
+
const SUPPORTED_IMAGE_RESIZE_WIDTHS = [128, 384, 640, 750, 828, 1080, 1200, 1920, 2048, 3840];
|
|
14
4
|
|
|
15
5
|
/**
|
|
16
6
|
* Width of the image should not be just any random number. For optimization reasons,
|
|
17
7
|
* we only allow the ones listed in SUPPORTED_IMAGE_RESIZE_WIDTHS list (Webiny Cloud supports only these).
|
|
18
8
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
const getSupportedImageResizeWidth = width => {
|
|
10
|
+
let output = SUPPORTED_IMAGE_RESIZE_WIDTHS[0];
|
|
11
|
+
let i = SUPPORTED_IMAGE_RESIZE_WIDTHS.length;
|
|
22
12
|
while (i >= 0) {
|
|
23
13
|
if (width === SUPPORTED_IMAGE_RESIZE_WIDTHS[i]) {
|
|
24
14
|
output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i];
|
|
@@ -40,37 +30,37 @@ var getSupportedImageResizeWidth = function getSupportedImageResizeWidth(width)
|
|
|
40
30
|
* Currently we only allow "width" as a transform option.
|
|
41
31
|
* @param args
|
|
42
32
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
33
|
+
const sanitizeTransformArgs = args => {
|
|
34
|
+
const output = {};
|
|
45
35
|
if (!args || args.width === undefined || args.width === null) {
|
|
46
36
|
return output;
|
|
47
37
|
}
|
|
48
|
-
|
|
38
|
+
const width = parseInt(args.width);
|
|
49
39
|
if (width > 0) {
|
|
50
40
|
output.width = getSupportedImageResizeWidth(width);
|
|
51
41
|
}
|
|
52
42
|
return output;
|
|
53
43
|
};
|
|
54
|
-
|
|
44
|
+
const getSizes = width => {
|
|
55
45
|
if (typeof width !== "string") {
|
|
56
46
|
return undefined;
|
|
57
47
|
}
|
|
58
48
|
// Check if width was set as percentage, with "%" in the value.
|
|
59
49
|
if (width.endsWith("%")) {
|
|
60
|
-
return
|
|
50
|
+
return `${parseInt(width)}vw`;
|
|
61
51
|
}
|
|
62
52
|
// Check if width was set as viewport width, with "vw" in the value.
|
|
63
53
|
if (width.endsWith("vw")) {
|
|
64
|
-
return
|
|
54
|
+
return `${parseInt(width)}vw`;
|
|
65
55
|
}
|
|
66
56
|
|
|
67
57
|
// Check if width was set as relative, with "em" in the value.
|
|
68
58
|
if (width.endsWith("em")) {
|
|
69
|
-
return
|
|
59
|
+
return `${parseInt(width)}em`;
|
|
70
60
|
}
|
|
71
61
|
return undefined;
|
|
72
62
|
};
|
|
73
|
-
|
|
63
|
+
const isFixedImageWidth = width => {
|
|
74
64
|
if (Number.isFinite(width)) {
|
|
75
65
|
return true;
|
|
76
66
|
}
|
|
@@ -79,20 +69,18 @@ var isFixedImageWidth = function isFixedImageWidth(width) {
|
|
|
79
69
|
}
|
|
80
70
|
return false;
|
|
81
71
|
};
|
|
82
|
-
|
|
72
|
+
const getSrcSetAutoSizes = max => {
|
|
83
73
|
max = isFixedImageWidth(max) ? parseInt("" + max) : 2500;
|
|
84
|
-
|
|
85
|
-
return SUPPORTED_IMAGE_RESIZE_WIDTHS.filter(
|
|
74
|
+
const maxWidth = getSupportedImageResizeWidth(max);
|
|
75
|
+
return SUPPORTED_IMAGE_RESIZE_WIDTHS.filter(supportedWidth => {
|
|
86
76
|
return supportedWidth <= maxWidth;
|
|
87
77
|
});
|
|
88
78
|
};
|
|
89
|
-
|
|
90
|
-
return Object.keys(transform).map(
|
|
91
|
-
return "".concat(key, "=").concat(transform[key]);
|
|
92
|
-
}).join("&");
|
|
79
|
+
const convertTransformToQueryParams = transform => {
|
|
80
|
+
return Object.keys(transform).map(key => `${key}=${transform[key]}`).join("&");
|
|
93
81
|
};
|
|
94
|
-
|
|
95
|
-
|
|
82
|
+
export default () => {
|
|
83
|
+
const imagePlugin = {
|
|
96
84
|
name: "image-component",
|
|
97
85
|
type: "image-component",
|
|
98
86
|
presets: {
|
|
@@ -100,46 +88,51 @@ var _default = exports.default = function _default() {
|
|
|
100
88
|
width: 300
|
|
101
89
|
}
|
|
102
90
|
},
|
|
103
|
-
getImageSrc:
|
|
91
|
+
getImageSrc: props => {
|
|
104
92
|
if (!props) {
|
|
105
93
|
return "";
|
|
106
94
|
}
|
|
107
|
-
|
|
108
|
-
|
|
95
|
+
const {
|
|
96
|
+
src,
|
|
97
|
+
transform
|
|
98
|
+
} = props;
|
|
109
99
|
if (!transform) {
|
|
110
100
|
return src;
|
|
111
101
|
}
|
|
112
102
|
if (!src || src.startsWith("data:") || src.endsWith("svg")) {
|
|
113
103
|
return src;
|
|
114
104
|
}
|
|
115
|
-
|
|
116
|
-
|
|
105
|
+
const sanitizedParams = sanitizeTransformArgs(transform);
|
|
106
|
+
const params = convertTransformToQueryParams(sanitizedParams);
|
|
117
107
|
return src + "?" + params;
|
|
118
108
|
},
|
|
119
|
-
render
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
109
|
+
render(props) {
|
|
110
|
+
const {
|
|
111
|
+
transform,
|
|
112
|
+
srcSet: srcSetInitial,
|
|
113
|
+
...imageProps
|
|
114
|
+
} = props;
|
|
115
|
+
let srcSet = srcSetInitial;
|
|
116
|
+
let sizes;
|
|
117
|
+
const src = imageProps.src;
|
|
126
118
|
if (srcSet && srcSet === "auto") {
|
|
127
119
|
srcSet = {};
|
|
128
120
|
|
|
129
121
|
// Check if image width was forced, and additionally if width was set as pixels, with "px" in the value.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
srcSetAutoWidths.forEach(
|
|
122
|
+
const forcedWidth = props.width || props.style && props.style.width;
|
|
123
|
+
const srcSetAutoWidths = getSrcSetAutoSizes(forcedWidth);
|
|
124
|
+
srcSetAutoWidths.forEach(width => {
|
|
133
125
|
srcSet[width + "w"] = imagePlugin.getImageSrc({
|
|
134
|
-
src
|
|
135
|
-
transform:
|
|
136
|
-
|
|
137
|
-
|
|
126
|
+
src,
|
|
127
|
+
transform: {
|
|
128
|
+
...transform,
|
|
129
|
+
width
|
|
130
|
+
}
|
|
138
131
|
});
|
|
139
132
|
});
|
|
140
133
|
sizes = getSizes(forcedWidth);
|
|
141
134
|
}
|
|
142
|
-
return /*#__PURE__*/
|
|
135
|
+
return /*#__PURE__*/React.createElement(Image, Object.assign({}, imageProps, {
|
|
143
136
|
srcSet: srcSet,
|
|
144
137
|
src: src,
|
|
145
138
|
sizes: sizes
|