@webiny/app 0.0.0-mt-2 → 0.0.0-unstable.06b2ede40f

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.
Files changed (211) hide show
  1. package/App.d.ts +26 -0
  2. package/App.js +95 -0
  3. package/App.js.map +1 -0
  4. package/AppContainer.d.ts +23 -0
  5. package/AppContainer.js +9 -0
  6. package/AppContainer.js.map +1 -0
  7. package/apollo-client/InMemoryCache.d.ts +4 -3
  8. package/apollo-client/InMemoryCache.js +13 -52
  9. package/apollo-client/InMemoryCache.js.map +1 -0
  10. package/apollo-client/IntrospectionFragmentMatcher.d.ts +11 -0
  11. package/apollo-client/IntrospectionFragmentMatcher.js +45 -0
  12. package/apollo-client/IntrospectionFragmentMatcher.js.map +1 -0
  13. package/components/Image.d.ts +3 -3
  14. package/components/Image.js +12 -17
  15. package/components/Image.js.map +1 -0
  16. package/components/Routes.d.ts +2 -2
  17. package/components/Routes.js +20 -19
  18. package/components/Routes.js.map +1 -0
  19. package/components/View.d.ts +1 -1
  20. package/components/View.js +13 -17
  21. package/components/View.js.map +1 -0
  22. package/components/index.d.ts +1 -0
  23. package/components/index.js +4 -1
  24. package/components/index.js.map +1 -0
  25. package/config/RouterConfig/Route.d.ts +30 -0
  26. package/config/RouterConfig/Route.js +42 -0
  27. package/config/RouterConfig/Route.js.map +1 -0
  28. package/config/RouterConfig.d.ts +32 -0
  29. package/config/RouterConfig.js +18 -0
  30. package/config/RouterConfig.js.map +1 -0
  31. package/config.d.ts +8 -0
  32. package/config.js +25 -0
  33. package/config.js.map +1 -0
  34. package/contexts/Ui/index.d.ts +5 -8
  35. package/contexts/Ui/index.js +27 -64
  36. package/contexts/Ui/index.js.map +1 -0
  37. package/core/DebounceRender.d.ts +12 -0
  38. package/core/DebounceRender.js +31 -0
  39. package/core/DebounceRender.js.map +1 -0
  40. package/core/Plugin.d.ts +8 -0
  41. package/core/Plugin.js +14 -0
  42. package/core/Plugin.js.map +1 -0
  43. package/core/Plugins.d.ts +15 -0
  44. package/core/Plugins.js +39 -0
  45. package/core/Plugins.js.map +1 -0
  46. package/core/Provider.d.ts +8 -0
  47. package/core/Provider.js +18 -0
  48. package/core/Provider.js.map +1 -0
  49. package/core/Routes.d.ts +6 -0
  50. package/core/Routes.js +34 -0
  51. package/core/Routes.js.map +1 -0
  52. package/core/createProvider.d.ts +10 -0
  53. package/core/createProvider.js +9 -0
  54. package/core/createProvider.js.map +1 -0
  55. package/core/createProviderPlugin.d.ts +8 -0
  56. package/core/createProviderPlugin.js +17 -0
  57. package/core/createProviderPlugin.js.map +1 -0
  58. package/hooks/useAutocomplete/index.js +3 -1
  59. package/hooks/useAutocomplete/index.js.map +1 -0
  60. package/hooks/useAutocomplete/useAutocomplete.d.ts +6 -1
  61. package/hooks/useAutocomplete/useAutocomplete.js +11 -15
  62. package/hooks/useAutocomplete/useAutocomplete.js.map +1 -0
  63. package/hooks/useDataList/functions/getData.d.ts +1 -1
  64. package/hooks/useDataList/functions/getData.js +3 -3
  65. package/hooks/useDataList/functions/getData.js.map +1 -0
  66. package/hooks/useDataList/functions/getError.d.ts +1 -1
  67. package/hooks/useDataList/functions/getError.js +3 -3
  68. package/hooks/useDataList/functions/getError.js.map +1 -0
  69. package/hooks/useDataList/functions/getMeta.d.ts +1 -1
  70. package/hooks/useDataList/functions/getMeta.js +3 -3
  71. package/hooks/useDataList/functions/getMeta.js.map +1 -0
  72. package/hooks/useDataList/functions/index.js +3 -1
  73. package/hooks/useDataList/functions/index.js.map +1 -0
  74. package/hooks/useDataList/functions/searchDataByKey.d.ts +1 -1
  75. package/hooks/useDataList/functions/searchDataByKey.js +5 -8
  76. package/hooks/useDataList/functions/searchDataByKey.js.map +1 -0
  77. package/hooks/useDataList/index.js +3 -1
  78. package/hooks/useDataList/index.js.map +1 -0
  79. package/hooks/useDataList/useDataList.d.ts +6 -6
  80. package/hooks/useDataList/useDataList.js +80 -90
  81. package/hooks/useDataList/useDataList.js.map +1 -0
  82. package/hooks/useDataList/utils/index.js +3 -1
  83. package/hooks/useDataList/utils/index.js.map +1 -0
  84. package/hooks/useDataList/utils/prepareLoadListParams.d.ts +9 -3
  85. package/hooks/useDataList/utils/prepareLoadListParams.js +35 -31
  86. package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -0
  87. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.d.ts +13 -4
  88. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +13 -9
  89. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +1 -0
  90. package/hooks/useDataList/utils/types.d.ts +21 -15
  91. package/hooks/useDataList/utils/types.js +3 -1
  92. package/hooks/useDataList/utils/types.js.map +1 -0
  93. package/hooks/useHandler.d.ts +11 -1
  94. package/hooks/useHandler.js +13 -6
  95. package/hooks/useHandler.js.map +1 -0
  96. package/hooks/useHandlers.d.ts +4 -4
  97. package/hooks/useHandlers.js +15 -11
  98. package/hooks/useHandlers.js.map +1 -0
  99. package/hooks/useRegisterLegacyPlugin.d.ts +2 -0
  100. package/hooks/useRegisterLegacyPlugin.js +11 -0
  101. package/hooks/useRegisterLegacyPlugin.js.map +1 -0
  102. package/hooks/useUi.d.ts +1 -1
  103. package/hooks/useUi.js +5 -3
  104. package/hooks/useUi.js.map +1 -0
  105. package/i18n/i18n.js +3 -1
  106. package/i18n/i18n.js.map +1 -0
  107. package/i18n/index.js +3 -1
  108. package/i18n/index.js.map +1 -0
  109. package/index.d.ts +17 -0
  110. package/index.js +20 -0
  111. package/index.js.map +1 -0
  112. package/package.json +27 -27
  113. package/plugins/AddQuerySelectionPlugin.d.ts +10 -3
  114. package/plugins/AddQuerySelectionPlugin.js +63 -92
  115. package/plugins/AddQuerySelectionPlugin.js.map +1 -0
  116. package/plugins/ApolloCacheObjectIdPlugin.d.ts +8 -8
  117. package/plugins/ApolloCacheObjectIdPlugin.js +12 -36
  118. package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -0
  119. package/plugins/ApolloDynamicLink.d.ts +3 -1
  120. package/plugins/ApolloDynamicLink.js +19 -50
  121. package/plugins/ApolloDynamicLink.js.map +1 -0
  122. package/plugins/ApolloLinkPlugin.d.ts +6 -6
  123. package/plugins/ApolloLinkPlugin.js +18 -39
  124. package/plugins/ApolloLinkPlugin.js.map +1 -0
  125. package/plugins/ConsoleLinkPlugin.js +19 -40
  126. package/plugins/ConsoleLinkPlugin.js.map +1 -0
  127. package/plugins/LocaleHeaderLinkPlugin.d.ts +3 -7
  128. package/plugins/LocaleHeaderLinkPlugin.js +22 -51
  129. package/plugins/LocaleHeaderLinkPlugin.js.map +1 -0
  130. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +13 -5
  131. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +21 -31
  132. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -0
  133. package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +8 -2
  134. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +76 -7
  135. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -0
  136. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +6 -4
  137. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +20 -16
  138. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -0
  139. package/plugins/NetworkErrorLinkPlugin.js +20 -35
  140. package/plugins/NetworkErrorLinkPlugin.js.map +1 -0
  141. package/plugins/OmitTypenameLinkPlugin.js +11 -31
  142. package/plugins/OmitTypenameLinkPlugin.js.map +1 -0
  143. package/plugins/RoutePlugin.d.ts +3 -3
  144. package/plugins/RoutePlugin.js +12 -32
  145. package/plugins/RoutePlugin.js.map +1 -0
  146. package/plugins/TenantHeaderLinkPlugin.d.ts +3 -7
  147. package/plugins/TenantHeaderLinkPlugin.js +29 -61
  148. package/plugins/TenantHeaderLinkPlugin.js.map +1 -0
  149. package/plugins/ViewPlugin.d.ts +5 -5
  150. package/plugins/ViewPlugin.js +15 -37
  151. package/plugins/ViewPlugin.js.map +1 -0
  152. package/plugins/image.d.ts +1 -1
  153. package/plugins/image.js +65 -85
  154. package/plugins/image.js.map +1 -0
  155. package/plugins/index.d.ts +3 -3
  156. package/plugins/index.js +35 -42
  157. package/plugins/index.js.map +1 -0
  158. package/react-butterfiles/Files.d.ts +69 -0
  159. package/react-butterfiles/Files.js +227 -0
  160. package/react-butterfiles/Files.js.map +1 -0
  161. package/react-butterfiles/index.d.ts +2 -0
  162. package/react-butterfiles/index.js +4 -0
  163. package/react-butterfiles/index.js.map +1 -0
  164. package/react-butterfiles/utils/generateId.d.ts +1 -0
  165. package/react-butterfiles/utils/generateId.js +5 -0
  166. package/react-butterfiles/utils/generateId.js.map +1 -0
  167. package/react-butterfiles/utils/readFileContent.d.ts +1 -0
  168. package/react-butterfiles/utils/readFileContent.js +15 -0
  169. package/react-butterfiles/utils/readFileContent.js.map +1 -0
  170. package/renderApp.d.ts +2 -0
  171. package/renderApp.js +9 -0
  172. package/renderApp.js.map +1 -0
  173. package/types.d.ts +29 -24
  174. package/types.js +13 -1
  175. package/types.js.map +1 -0
  176. package/utils/createGenericContext.d.ts +13 -0
  177. package/utils/createGenericContext.js +25 -0
  178. package/utils/createGenericContext.js.map +1 -0
  179. package/utils/createHashing.d.ts +2 -0
  180. package/utils/createHashing.js +18 -0
  181. package/utils/createHashing.js.map +1 -0
  182. package/utils/getApiUrl.d.ts +1 -0
  183. package/utils/getApiUrl.js +5 -0
  184. package/utils/getApiUrl.js.map +1 -0
  185. package/utils/getGqlApiUrl.d.ts +1 -0
  186. package/utils/getGqlApiUrl.js +6 -0
  187. package/utils/getGqlApiUrl.js.map +1 -0
  188. package/utils/getHeadlessCmsGqlApiUrl.d.ts +5 -0
  189. package/utils/getHeadlessCmsGqlApiUrl.js +12 -0
  190. package/utils/getHeadlessCmsGqlApiUrl.js.map +1 -0
  191. package/utils/getLocaleCode.d.ts +6 -0
  192. package/utils/getLocaleCode.js +33 -0
  193. package/utils/getLocaleCode.js.map +1 -0
  194. package/utils/getPrerenderId.d.ts +6 -0
  195. package/utils/getPrerenderId.js +5 -0
  196. package/utils/getPrerenderId.js.map +1 -0
  197. package/utils/getTenantId.d.ts +6 -0
  198. package/utils/getTenantId.js +45 -0
  199. package/utils/getTenantId.js.map +1 -0
  200. package/utils/index.d.ts +10 -0
  201. package/utils/index.js +12 -0
  202. package/utils/index.js.map +1 -0
  203. package/utils/isLocalhost.d.ts +1 -0
  204. package/utils/isLocalhost.js +7 -0
  205. package/utils/isLocalhost.js.map +1 -0
  206. package/utils/isPrerendering.d.ts +1 -0
  207. package/utils/isPrerendering.js +5 -0
  208. package/utils/isPrerendering.js.map +1 -0
  209. package/utils/legacyPluginToReactComponent.d.ts +7 -0
  210. package/utils/legacyPluginToReactComponent.js +14 -0
  211. package/utils/legacyPluginToReactComponent.js.map +1 -0
@@ -1,9 +1,78 @@
1
- import styled from "@emotion/styled";
2
- export var OverlayWrapper = /*#__PURE__*/styled("div", {
3
- target: "e1rvk94r0",
4
- label: "OverlayWrapper"
5
- })("\n width: 100vw;\n height: 100vh;\n position: fixed;\n top: 0;\n left: 0;\n z-index: 105; // The highest z-index value is 100 for Dialogs\n \n .inner {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n overflow: auto;\n background-color: white;\n padding: 1rem;\n }\n \n .header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 1rem;\n .header__title {\n color: var(--mdc-theme-error);\n }\n }\n \n .body {\n flex-grow: 1;\n .body__summary {\n margin-bottom: 1rem;\n }\n }\n \n .footer {\n color: var(--mdc-theme-text-secondary-on-background);\n \n .highlight {\n background-color: rgba(251, 245, 180, 0.5);\n padding: 0 4px;\n border-radius: 6px;\n font-family: monospace;\n }\n }\n");
6
- export var Pre = /*#__PURE__*/styled("pre", {
1
+ import _styled from "@emotion/styled/base";
2
+ export const OverlayWrapper = /*#__PURE__*/_styled("div", process.env.NODE_ENV === "production" ? {
3
+ target: "e1rvk94r1"
4
+ } : {
7
5
  target: "e1rvk94r1",
6
+ label: "OverlayWrapper"
7
+ })(`
8
+ width: 100vw;
9
+ height: 100vh;
10
+ position: fixed;
11
+ top: 0;
12
+ left: 0;
13
+ z-index: 105; // The highest z-index value is 100 for Dialogs
14
+
15
+ .inner {
16
+ box-sizing: border-box;
17
+ display: flex;
18
+ flex-direction: column;
19
+ width: 100%;
20
+ height: 100%;
21
+ overflow: auto;
22
+ background-color: white;
23
+ padding: 1rem;
24
+ }
25
+
26
+ .header {
27
+ display: flex;
28
+ justify-content: space-between;
29
+ align-items: center;
30
+ margin-bottom: 1rem;
31
+ .header__title {
32
+ color: var(--mdc-theme-error);
33
+ }
34
+ }
35
+
36
+ .body {
37
+ flex-grow: 1;
38
+ .body__summary {
39
+ margin-bottom: 1rem;
40
+ }
41
+ }
42
+
43
+ .footer {
44
+ color: var(--mdc-theme-text-secondary-on-background);
45
+
46
+ .highlight {
47
+ background-color: rgba(251, 245, 180, 0.5);
48
+ padding: 0 4px;
49
+ border-radius: 6px;
50
+ font-family: monospace;
51
+ }
52
+ }
53
+ `, process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlN0eWxlZENvbXBvbmVudHMudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUU4QiIsImZpbGUiOiJTdHlsZWRDb21wb25lbnRzLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBzdHlsZWQgZnJvbSBcIkBlbW90aW9uL3N0eWxlZFwiO1xuXG5leHBvcnQgY29uc3QgT3ZlcmxheVdyYXBwZXIgPSBzdHlsZWQoXCJkaXZcIikoYFxuICAgIHdpZHRoOiAxMDB2dztcbiAgICBoZWlnaHQ6IDEwMHZoO1xuICAgIHBvc2l0aW9uOiBmaXhlZDtcbiAgICB0b3A6IDA7XG4gICAgbGVmdDogMDtcbiAgICB6LWluZGV4OiAxMDU7IC8vIFRoZSBoaWdoZXN0IHotaW5kZXggdmFsdWUgaXMgMTAwIGZvciBEaWFsb2dzXG4gICAgXG4gICAgLmlubmVyIHtcbiAgICAgICAgYm94LXNpemluZzogYm9yZGVyLWJveDtcbiAgICAgICAgZGlzcGxheTogZmxleDtcbiAgICAgICAgZmxleC1kaXJlY3Rpb246IGNvbHVtbjtcbiAgICAgICAgd2lkdGg6IDEwMCU7XG4gICAgICAgIGhlaWdodDogMTAwJTtcbiAgICAgICAgb3ZlcmZsb3c6IGF1dG87XG4gICAgICAgIGJhY2tncm91bmQtY29sb3I6IHdoaXRlO1xuICAgICAgICBwYWRkaW5nOiAxcmVtO1xuICAgIH1cbiAgICBcbiAgICAuaGVhZGVyIHtcbiAgICAgICAgZGlzcGxheTogZmxleDtcbiAgICAgICAganVzdGlmeS1jb250ZW50OiBzcGFjZS1iZXR3ZWVuO1xuICAgICAgICBhbGlnbi1pdGVtczogY2VudGVyO1xuICAgICAgICBtYXJnaW4tYm90dG9tOiAxcmVtO1xuICAgICAgICAuaGVhZGVyX190aXRsZSB7XG4gICAgICAgICAgICBjb2xvcjogdmFyKC0tbWRjLXRoZW1lLWVycm9yKTtcbiAgICAgICAgfVxuICAgIH1cbiAgICBcbiAgICAuYm9keSB7XG4gICAgICAgIGZsZXgtZ3JvdzogMTtcbiAgICAgICAgLmJvZHlfX3N1bW1hcnkge1xuICAgICAgICAgICAgbWFyZ2luLWJvdHRvbTogMXJlbTtcbiAgICAgICAgfVxuICAgIH1cbiAgICBcbiAgICAuZm9vdGVyIHtcbiAgICAgICAgY29sb3I6IHZhcigtLW1kYy10aGVtZS10ZXh0LXNlY29uZGFyeS1vbi1iYWNrZ3JvdW5kKTtcbiAgICAgICAgXG4gICAgICAgIC5oaWdobGlnaHQge1xuICAgICAgICAgICAgYmFja2dyb3VuZC1jb2xvcjogcmdiYSgyNTEsIDI0NSwgMTgwLCAwLjUpO1xuICAgICAgICAgICAgcGFkZGluZzogMCA0cHg7XG4gICAgICAgICAgICBib3JkZXItcmFkaXVzOiA2cHg7XG4gICAgICAgICAgICBmb250LWZhbWlseTogbW9ub3NwYWNlO1xuICAgICAgICB9XG4gICAgfVxuYCk7XG5cbmV4cG9ydCBjb25zdCBQcmUgPSBzdHlsZWQoXCJwcmVcIikoYFxuICAgIHBvc2l0aW9uOiByZWxhdGl2ZTtcbiAgICBkaXNwbGF5OiBibG9jaztcbiAgICBwYWRkaW5nOiAwLjVlbTtcbiAgICBtYXJnaW4tdG9wOiAwLjVlbTtcbiAgICBtYXJnaW4tYm90dG9tOiAwLjVlbTtcbiAgICBvdmVyZmxvdy14OiBhdXRvO1xuICAgIHdoaXRlLXNwYWNlOiBwcmUtd3JhcDtcbiAgICBib3JkZXItcmFkaXVzOiAwLjI1cmVtO1xuICAgIGJhY2tncm91bmQtY29sb3I6IHJnYmEoMjUxLCAyNDUsIDE4MCwgMC4zKTtcbiAgICBjb2xvcjogaW5oZXJpdDtcbiAgICBcbiAgICBjb2RlIHtcbiAgICAgICAgZm9udC1mYW1pbHk6IG1vbm9zcGFjZTtcbiAgICAgICAgZm9udC1zaXplOiAwLjg1cmVtO1xuICAgICAgICBsaW5lLWhlaWdodDogMXJlbTtcbiAgICB9XG5gKTtcbiJdfQ== */");
54
+ export const Pre = /*#__PURE__*/_styled("pre", process.env.NODE_ENV === "production" ? {
55
+ target: "e1rvk94r0"
56
+ } : {
57
+ target: "e1rvk94r0",
8
58
  label: "Pre"
9
- })("\n position: relative;\n display: block;\n padding: 0.5em;\n margin-top: 0.5em;\n margin-bottom: 0.5em;\n overflow-x: auto;\n white-space: pre-wrap;\n border-radius: 0.25rem;\n background-color: rgba(251, 245, 180, 0.3);\n color: inherit;\n \n code {\n font-family: monospace;\n font-size: 0.85rem;\n line-height: 1rem;\n }\n");
59
+ })(`
60
+ position: relative;
61
+ display: block;
62
+ padding: 0.5em;
63
+ margin-top: 0.5em;
64
+ margin-bottom: 0.5em;
65
+ overflow-x: auto;
66
+ white-space: pre-wrap;
67
+ border-radius: 0.25rem;
68
+ background-color: rgba(251, 245, 180, 0.3);
69
+ color: inherit;
70
+
71
+ code {
72
+ font-family: monospace;
73
+ font-size: 0.85rem;
74
+ line-height: 1rem;
75
+ }
76
+ `, process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlN0eWxlZENvbXBvbmVudHMudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWtEbUIiLCJmaWxlIjoiU3R5bGVkQ29tcG9uZW50cy50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gXCJAZW1vdGlvbi9zdHlsZWRcIjtcblxuZXhwb3J0IGNvbnN0IE92ZXJsYXlXcmFwcGVyID0gc3R5bGVkKFwiZGl2XCIpKGBcbiAgICB3aWR0aDogMTAwdnc7XG4gICAgaGVpZ2h0OiAxMDB2aDtcbiAgICBwb3NpdGlvbjogZml4ZWQ7XG4gICAgdG9wOiAwO1xuICAgIGxlZnQ6IDA7XG4gICAgei1pbmRleDogMTA1OyAvLyBUaGUgaGlnaGVzdCB6LWluZGV4IHZhbHVlIGlzIDEwMCBmb3IgRGlhbG9nc1xuICAgIFxuICAgIC5pbm5lciB7XG4gICAgICAgIGJveC1zaXppbmc6IGJvcmRlci1ib3g7XG4gICAgICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgICAgIGZsZXgtZGlyZWN0aW9uOiBjb2x1bW47XG4gICAgICAgIHdpZHRoOiAxMDAlO1xuICAgICAgICBoZWlnaHQ6IDEwMCU7XG4gICAgICAgIG92ZXJmbG93OiBhdXRvO1xuICAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiB3aGl0ZTtcbiAgICAgICAgcGFkZGluZzogMXJlbTtcbiAgICB9XG4gICAgXG4gICAgLmhlYWRlciB7XG4gICAgICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgICAgIGp1c3RpZnktY29udGVudDogc3BhY2UtYmV0d2VlbjtcbiAgICAgICAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbiAgICAgICAgbWFyZ2luLWJvdHRvbTogMXJlbTtcbiAgICAgICAgLmhlYWRlcl9fdGl0bGUge1xuICAgICAgICAgICAgY29sb3I6IHZhcigtLW1kYy10aGVtZS1lcnJvcik7XG4gICAgICAgIH1cbiAgICB9XG4gICAgXG4gICAgLmJvZHkge1xuICAgICAgICBmbGV4LWdyb3c6IDE7XG4gICAgICAgIC5ib2R5X19zdW1tYXJ5IHtcbiAgICAgICAgICAgIG1hcmdpbi1ib3R0b206IDFyZW07XG4gICAgICAgIH1cbiAgICB9XG4gICAgXG4gICAgLmZvb3RlciB7XG4gICAgICAgIGNvbG9yOiB2YXIoLS1tZGMtdGhlbWUtdGV4dC1zZWNvbmRhcnktb24tYmFja2dyb3VuZCk7XG4gICAgICAgIFxuICAgICAgICAuaGlnaGxpZ2h0IHtcbiAgICAgICAgICAgIGJhY2tncm91bmQtY29sb3I6IHJnYmEoMjUxLCAyNDUsIDE4MCwgMC41KTtcbiAgICAgICAgICAgIHBhZGRpbmc6IDAgNHB4O1xuICAgICAgICAgICAgYm9yZGVyLXJhZGl1czogNnB4O1xuICAgICAgICAgICAgZm9udC1mYW1pbHk6IG1vbm9zcGFjZTtcbiAgICAgICAgfVxuICAgIH1cbmApO1xuXG5leHBvcnQgY29uc3QgUHJlID0gc3R5bGVkKFwicHJlXCIpKGBcbiAgICBwb3NpdGlvbjogcmVsYXRpdmU7XG4gICAgZGlzcGxheTogYmxvY2s7XG4gICAgcGFkZGluZzogMC41ZW07XG4gICAgbWFyZ2luLXRvcDogMC41ZW07XG4gICAgbWFyZ2luLWJvdHRvbTogMC41ZW07XG4gICAgb3ZlcmZsb3cteDogYXV0bztcbiAgICB3aGl0ZS1zcGFjZTogcHJlLXdyYXA7XG4gICAgYm9yZGVyLXJhZGl1czogMC4yNXJlbTtcbiAgICBiYWNrZ3JvdW5kLWNvbG9yOiByZ2JhKDI1MSwgMjQ1LCAxODAsIDAuMyk7XG4gICAgY29sb3I6IGluaGVyaXQ7XG4gICAgXG4gICAgY29kZSB7XG4gICAgICAgIGZvbnQtZmFtaWx5OiBtb25vc3BhY2U7XG4gICAgICAgIGZvbnQtc2l6ZTogMC44NXJlbTtcbiAgICAgICAgbGluZS1oZWlnaHQ6IDFyZW07XG4gICAgfVxuYCk7XG4iXX0= */");
77
+
78
+ //# sourceMappingURL=StyledComponents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["OverlayWrapper","_styled","process","env","NODE_ENV","target","label","Pre"],"sources":["StyledComponents.tsx"],"sourcesContent":["import styled from \"@emotion/styled\";\n\nexport const OverlayWrapper = styled(\"div\")(`\n width: 100vw;\n height: 100vh;\n position: fixed;\n top: 0;\n left: 0;\n z-index: 105; // The highest z-index value is 100 for Dialogs\n \n .inner {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n overflow: auto;\n background-color: white;\n padding: 1rem;\n }\n \n .header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 1rem;\n .header__title {\n color: var(--mdc-theme-error);\n }\n }\n \n .body {\n flex-grow: 1;\n .body__summary {\n margin-bottom: 1rem;\n }\n }\n \n .footer {\n color: var(--mdc-theme-text-secondary-on-background);\n \n .highlight {\n background-color: rgba(251, 245, 180, 0.5);\n padding: 0 4px;\n border-radius: 6px;\n font-family: monospace;\n }\n }\n`);\n\nexport const Pre = styled(\"pre\")(`\n position: relative;\n display: block;\n padding: 0.5em;\n margin-top: 0.5em;\n margin-bottom: 0.5em;\n overflow-x: auto;\n white-space: pre-wrap;\n border-radius: 0.25rem;\n background-color: rgba(251, 245, 180, 0.3);\n color: inherit;\n \n code {\n font-family: monospace;\n font-size: 0.85rem;\n line-height: 1rem;\n }\n`);\n"],"mappings":";AAEA,OAAO,MAAMA,cAAc,gBAAGC,OAAA,CAAO,KAAK,EAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,EAAC,CAAC;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAAJ,OAAA,CAAAC,GAAA,CAAAC,QAAA,2zEAAC;AAEF,OAAO,MAAMG,GAAG,gBAAGN,OAAA,CAAO,KAAK,EAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,EAAC,CAAC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAAJ,OAAA,CAAAC,GAAA,CAAAC,QAAA,2zEAAC","ignoreList":[]}
@@ -1,5 +1,7 @@
1
- declare const createErrorOverlay: ({ query, networkError }: {
2
- query: any;
3
- networkError: any;
4
- }) => void;
1
+ import type { ServerError, ServerParseError } from "apollo-link-http-common";
2
+ interface CreateErrorOverlayParams {
3
+ query: string;
4
+ networkError: Error | ServerError | ServerParseError;
5
+ }
6
+ declare const createErrorOverlay: (params: CreateErrorOverlayParams) => void;
5
7
  export default createErrorOverlay;
@@ -1,27 +1,31 @@
1
1
  import React from "react";
2
+ /**
3
+ * TODO fix with react 19
4
+ */
5
+ // eslint-disable-next-line react/no-deprecated
2
6
  import { render } from "react-dom";
3
7
  import ErrorOverlay from "./ErrorOverlay";
4
-
5
- var createErrorOverlay = function createErrorOverlay(_ref) {
6
- var query = _ref.query,
7
- networkError = _ref.networkError;
8
-
8
+ const createErrorOverlay = params => {
9
+ const {
10
+ query,
11
+ networkError
12
+ } = params;
9
13
  // If the element already present in DOM, return immediately.
10
14
  if (document.getElementById("overlay-root")) {
11
15
  return;
12
- } // Create root element to hold React tree.
13
-
14
-
15
- var container = document.createElement("div");
16
- container.id = "overlay-root"; // Insert root element into body.
17
-
18
- var body = document.getElementsByTagName("body")[0];
19
- body.appendChild(container); // Mount the ErrorOverlay component into root element.
20
-
21
- render( /*#__PURE__*/React.createElement(ErrorOverlay, {
16
+ }
17
+ // Create root element to hold React tree.
18
+ const container = document.createElement("div");
19
+ container.id = "overlay-root";
20
+ // Insert root element into body.
21
+ const body = document.getElementsByTagName("body")[0];
22
+ body.appendChild(container);
23
+ // Mount the ErrorOverlay component into root element.
24
+ render(/*#__PURE__*/React.createElement(ErrorOverlay, {
22
25
  query: query,
23
26
  networkError: networkError
24
27
  }), container);
25
28
  };
29
+ export default createErrorOverlay;
26
30
 
27
- export default createErrorOverlay;
31
+ //# sourceMappingURL=createErrorOverlay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","render","ErrorOverlay","createErrorOverlay","params","query","networkError","document","getElementById","container","createElement","id","body","getElementsByTagName","appendChild"],"sources":["createErrorOverlay.tsx"],"sourcesContent":["import React from \"react\";\n/**\n * TODO fix with react 19\n */\n// eslint-disable-next-line react/no-deprecated\nimport { render } from \"react-dom\";\nimport ErrorOverlay from \"./ErrorOverlay\";\nimport type { ServerError, ServerParseError } from \"apollo-link-http-common\";\n\ninterface CreateErrorOverlayParams {\n query: string;\n networkError: Error | ServerError | ServerParseError;\n}\nconst createErrorOverlay = (params: CreateErrorOverlayParams): void => {\n const { query, networkError } = 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 render(<ErrorOverlay query={query} networkError={networkError} />, container);\n};\n\nexport default createErrorOverlay;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB;AACA;AACA;AACA;AACA,SAASC,MAAM,QAAQ,WAAW;AAClC,OAAOC,YAAY;AAOnB,MAAMC,kBAAkB,GAAIC,MAAgC,IAAW;EACnE,MAAM;IAAEC,KAAK;IAAEC;EAAa,CAAC,GAAGF,MAAM;EACtC;EACA,IAAIG,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;EACAR,MAAM,cAACD,KAAA,CAAAU,aAAA,CAACR,YAAY;IAACG,KAAK,EAAEA,KAAM;IAACC,YAAY,EAAEA;EAAa,CAAE,CAAC,EAAEG,SAAS,CAAC;AACjF,CAAC;AAED,eAAeN,kBAAkB","ignoreList":[]}
@@ -1,45 +1,30 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _inherits from "@babel/runtime/helpers/inherits";
4
- import _createSuper from "@babel/runtime/helpers/createSuper";
5
1
  import { ApolloLinkPlugin } from "./ApolloLinkPlugin";
6
2
  import { onError } from "apollo-link-error";
7
3
  import { print } from "graphql/language";
8
4
  import createErrorOverlay from "./NetworkErrorLinkPlugin/createErrorOverlay";
9
5
  import { boolean } from "boolean";
6
+ import { config as appConfig } from "../config";
7
+
10
8
  /**
11
9
  * This plugin creates an ApolloLink that checks for `NetworkError` and shows an ErrorOverlay in the browser.
12
10
  */
13
-
14
- export var NetworkErrorLinkPlugin = /*#__PURE__*/function (_ApolloLinkPlugin) {
15
- _inherits(NetworkErrorLinkPlugin, _ApolloLinkPlugin);
16
-
17
- var _super = _createSuper(NetworkErrorLinkPlugin);
18
-
19
- function NetworkErrorLinkPlugin() {
20
- _classCallCheck(this, NetworkErrorLinkPlugin);
21
-
22
- return _super.apply(this, arguments);
11
+ export class NetworkErrorLinkPlugin extends ApolloLinkPlugin {
12
+ createLink() {
13
+ return onError(({
14
+ networkError,
15
+ operation
16
+ }) => {
17
+ const debug = appConfig.getKey("DEBUG", boolean(process.env.REACT_APP_DEBUG));
18
+ if (networkError && debug) {
19
+ createErrorOverlay({
20
+ query: print(operation.query),
21
+ networkError
22
+ });
23
+ }
24
+
25
+ // TODO: also print graphQLErrors
26
+ });
23
27
  }
28
+ }
24
29
 
25
- _createClass(NetworkErrorLinkPlugin, [{
26
- key: "createLink",
27
- value: function createLink() {
28
- return onError(function (_ref) {
29
- var networkError = _ref.networkError,
30
- operation = _ref.operation;
31
- var debug = boolean(process.env.REACT_APP_DEBUG);
32
-
33
- if (networkError && debug) {
34
- createErrorOverlay({
35
- query: print(operation.query),
36
- networkError: networkError
37
- });
38
- } // TODO: also print graphQLErrors
39
-
40
- });
41
- }
42
- }]);
43
-
44
- return NetworkErrorLinkPlugin;
45
- }(ApolloLinkPlugin);
30
+ //# sourceMappingURL=NetworkErrorLinkPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ApolloLinkPlugin","onError","print","createErrorOverlay","boolean","config","appConfig","NetworkErrorLinkPlugin","createLink","networkError","operation","debug","getKey","process","env","REACT_APP_DEBUG","query"],"sources":["NetworkErrorLinkPlugin.ts"],"sourcesContent":["import { ApolloLinkPlugin } from \"./ApolloLinkPlugin\";\nimport { onError } from \"apollo-link-error\";\nimport { print } from \"graphql/language\";\nimport createErrorOverlay from \"./NetworkErrorLinkPlugin/createErrorOverlay\";\nimport { boolean } from \"boolean\";\nimport { config as appConfig } from \"~/config\";\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 public override createLink() {\n return onError(({ networkError, operation }) => {\n const debug = appConfig.getKey(\"DEBUG\", boolean(process.env.REACT_APP_DEBUG));\n\n if (networkError && debug) {\n createErrorOverlay({ query: print(operation.query), networkError });\n }\n\n // TODO: also print graphQLErrors\n });\n }\n}\n"],"mappings":"AAAA,SAASA,gBAAgB;AACzB,SAASC,OAAO,QAAQ,mBAAmB;AAC3C,SAASC,KAAK,QAAQ,kBAAkB;AACxC,OAAOC,kBAAkB;AACzB,SAASC,OAAO,QAAQ,SAAS;AACjC,SAASC,MAAM,IAAIC,SAAS;;AAE5B;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,SAASP,gBAAgB,CAAC;EACzCQ,UAAUA,CAAA,EAAG;IACzB,OAAOP,OAAO,CAAC,CAAC;MAAEQ,YAAY;MAAEC;IAAU,CAAC,KAAK;MAC5C,MAAMC,KAAK,GAAGL,SAAS,CAACM,MAAM,CAAC,OAAO,EAAER,OAAO,CAACS,OAAO,CAACC,GAAG,CAACC,eAAe,CAAC,CAAC;MAE7E,IAAIN,YAAY,IAAIE,KAAK,EAAE;QACvBR,kBAAkB,CAAC;UAAEa,KAAK,EAAEd,KAAK,CAACQ,SAAS,CAACM,KAAK,CAAC;UAAEP;QAAa,CAAC,CAAC;MACvE;;MAEA;IACJ,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
@@ -1,41 +1,21 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _inherits from "@babel/runtime/helpers/inherits";
4
- import _createSuper from "@babel/runtime/helpers/createSuper";
5
1
  import { ApolloLink } from "apollo-link";
6
2
  import { ApolloLinkPlugin } from "./ApolloLinkPlugin";
7
-
8
3
  function omitTypename(key, value) {
9
4
  return key === "__typename" ? undefined : value;
10
5
  }
6
+
11
7
  /**
12
8
  * This link removes `__typename` from the variables being sent to the API.
13
9
  */
14
-
15
-
16
- export var OmitTypenameLinkPlugin = /*#__PURE__*/function (_ApolloLinkPlugin) {
17
- _inherits(OmitTypenameLinkPlugin, _ApolloLinkPlugin);
18
-
19
- var _super = _createSuper(OmitTypenameLinkPlugin);
20
-
21
- function OmitTypenameLinkPlugin() {
22
- _classCallCheck(this, OmitTypenameLinkPlugin);
23
-
24
- return _super.apply(this, arguments);
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
  }
19
+ }
26
20
 
27
- _createClass(OmitTypenameLinkPlugin, [{
28
- key: "createLink",
29
- value: function createLink() {
30
- return new ApolloLink(function (operation, forward) {
31
- if (operation.variables) {
32
- operation.variables = JSON.parse(JSON.stringify(operation.variables), omitTypename);
33
- }
34
-
35
- return forward(operation);
36
- });
37
- }
38
- }]);
39
-
40
- return OmitTypenameLinkPlugin;
41
- }(ApolloLinkPlugin);
21
+ //# sourceMappingURL=OmitTypenameLinkPlugin.js.map
@@ -0,0 +1 @@
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\";\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 * as React from "react";
1
+ import type * as React from "react";
2
2
  import { Plugin } from "@webiny/plugins";
3
3
  interface Config {
4
- route: React.ReactElement;
4
+ route: React.ReactElement | null;
5
5
  }
6
6
  export declare class RoutePlugin extends Plugin {
7
- static readonly type = "route";
7
+ static readonly type: string;
8
8
  private _config;
9
9
  constructor(config?: Config);
10
10
  get route(): Config["route"];
@@ -1,36 +1,16 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
- import _createSuper from "@babel/runtime/helpers/createSuper";
6
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
1
  import { Plugin } from "@webiny/plugins";
8
- export var RoutePlugin = /*#__PURE__*/function (_Plugin) {
9
- _inherits(RoutePlugin, _Plugin);
10
-
11
- var _super = _createSuper(RoutePlugin);
12
-
13
- function RoutePlugin(config) {
14
- var _this;
15
-
16
- _classCallCheck(this, RoutePlugin);
17
-
18
- _this = _super.call(this);
19
-
20
- _defineProperty(_assertThisInitialized(_this), "_config", void 0);
21
-
22
- _this._config = config || {};
23
- return _this;
2
+ export class RoutePlugin extends Plugin {
3
+ static type = "route";
4
+ constructor(config) {
5
+ super();
6
+ this._config = config || {};
24
7
  }
25
-
26
- _createClass(RoutePlugin, [{
27
- key: "route",
28
- get: function get() {
29
- return this._config.route;
8
+ get route() {
9
+ if (!this._config.route) {
10
+ return null;
30
11
  }
31
- }]);
32
-
33
- return RoutePlugin;
34
- }(Plugin);
12
+ return this._config.route;
13
+ }
14
+ }
35
15
 
36
- _defineProperty(RoutePlugin, "type", "route");
16
+ //# sourceMappingURL=RoutePlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Plugin","RoutePlugin","type","constructor","config","_config","route"],"sources":["RoutePlugin.tsx"],"sourcesContent":["import type * as React from \"react\";\nimport { Plugin } from \"@webiny/plugins\";\n\ninterface Config {\n route: React.ReactElement | null;\n}\n\nexport class RoutePlugin extends Plugin {\n public static override readonly type: string = \"route\";\n private _config: Partial<Config>;\n\n constructor(config?: Config) {\n super();\n this._config = config || {};\n }\n\n get route(): Config[\"route\"] {\n if (!this._config.route) {\n return null;\n }\n return this._config.route;\n }\n}\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,iBAAiB;AAMxC,OAAO,MAAMC,WAAW,SAASD,MAAM,CAAC;EACpC,OAAgCE,IAAI,GAAW,OAAO;EAGtDC,WAAWA,CAACC,MAAe,EAAE;IACzB,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,OAAO,GAAGD,MAAM,IAAI,CAAC,CAAC;EAC/B;EAEA,IAAIE,KAAKA,CAAA,EAAoB;IACzB,IAAI,CAAC,IAAI,CAACD,OAAO,CAACC,KAAK,EAAE;MACrB,OAAO,IAAI;IACf;IACA,OAAO,IAAI,CAACD,OAAO,CAACC,KAAK;EAC7B;AACJ","ignoreList":[]}
@@ -1,14 +1,10 @@
1
1
  import { ApolloLinkPlugin } from "./ApolloLinkPlugin";
2
- declare global {
3
- interface Window {
4
- __PS_RENDER_TENANT__: string;
5
- }
6
- }
2
+ import type { ApolloLink } from "apollo-link";
7
3
  /**
8
4
  * Append `x-tenant` header from URL query (necessary for prerendering service).
9
5
  */
10
6
  export declare class TenantHeaderLinkPlugin extends ApolloLinkPlugin {
11
- private tenant;
7
+ private readonly tenant;
12
8
  constructor(tenant?: string);
13
- createLink(): import("apollo-link").ApolloLink;
9
+ createLink(): ApolloLink;
14
10
  }
@@ -1,71 +1,39 @@
1
- import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
- import _inherits from "@babel/runtime/helpers/inherits";
6
- import _createSuper from "@babel/runtime/helpers/createSuper";
7
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
1
  import { setContext } from "apollo-link-context";
9
2
  import { ApolloLinkPlugin } from "./ApolloLinkPlugin";
3
+ import { getTenantId } from "../utils";
10
4
 
11
5
  /**
12
6
  * Append `x-tenant` header from URL query (necessary for prerendering service).
13
7
  */
14
- export var TenantHeaderLinkPlugin = /*#__PURE__*/function (_ApolloLinkPlugin) {
15
- _inherits(TenantHeaderLinkPlugin, _ApolloLinkPlugin);
16
-
17
- var _super = _createSuper(TenantHeaderLinkPlugin);
18
-
19
- function TenantHeaderLinkPlugin(tenant) {
20
- var _this;
21
-
22
- _classCallCheck(this, TenantHeaderLinkPlugin);
23
-
24
- _this = _super.call(this);
25
-
26
- _defineProperty(_assertThisInitialized(_this), "tenant", void 0);
27
-
28
- _this.name = "tenant-header-link";
29
-
30
- if (!tenant) {
31
- var query = new URLSearchParams(location.search);
32
- tenant = query.get("__tenant") || window.__PS_RENDER_TENANT__;
33
- }
34
-
35
- _this.tenant = tenant;
36
- console.log("Detected tenant", _this.tenant);
37
- return _this;
8
+ export class TenantHeaderLinkPlugin extends ApolloLinkPlugin {
9
+ constructor(tenant) {
10
+ super();
11
+ this.name = "tenant-header-link";
12
+ this.tenant = tenant || getTenantId();
38
13
  }
39
-
40
- _createClass(TenantHeaderLinkPlugin, [{
41
- key: "createLink",
42
- value: function createLink() {
43
- var _this2 = this;
44
-
45
- return setContext(function (_, _ref) {
46
- var headers = _ref.headers;
47
-
48
- // If tenant header is already set, do not overwrite it.
49
- if (headers && "x-tenant" in headers) {
50
- return {
51
- headers: headers
52
- };
53
- }
54
-
55
- if (_this2.tenant) {
56
- return {
57
- headers: _objectSpread(_objectSpread({}, headers), {}, {
58
- "x-tenant": _this2.tenant
59
- })
60
- };
61
- }
62
-
14
+ createLink() {
15
+ return setContext((_, {
16
+ headers
17
+ }) => {
18
+ // If tenant header is already set, do not overwrite it.
19
+ if (headers && "x-tenant" in headers) {
20
+ return {
21
+ headers
22
+ };
23
+ }
24
+ if (this.tenant) {
63
25
  return {
64
- headers: headers
26
+ headers: {
27
+ ...headers,
28
+ "x-tenant": this.tenant
29
+ }
65
30
  };
66
- });
67
- }
68
- }]);
31
+ }
32
+ return {
33
+ headers
34
+ };
35
+ });
36
+ }
37
+ }
69
38
 
70
- return TenantHeaderLinkPlugin;
71
- }(ApolloLinkPlugin);
39
+ //# sourceMappingURL=TenantHeaderLinkPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["setContext","ApolloLinkPlugin","getTenantId","TenantHeaderLinkPlugin","constructor","tenant","name","createLink","_","headers"],"sources":["TenantHeaderLinkPlugin.ts"],"sourcesContent":["import { setContext } from \"apollo-link-context\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin\";\nimport type { ApolloLink } from \"apollo-link\";\nimport { getTenantId } from \"~/utils\";\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 || (getTenantId() as string);\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;AAEzB,SAASC,WAAW;;AAEpB;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,SAASF,gBAAgB,CAAC;EAGlDG,WAAWA,CAACC,MAAe,EAAE;IAChC,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,IAAI,GAAG,oBAAoB;IAEhC,IAAI,CAACD,MAAM,GAAGA,MAAM,IAAKH,WAAW,CAAC,CAAY;EACrD;EAEgBK,UAAUA,CAAA,EAAe;IACrC,OAAOP,UAAU,CAAC,CAACQ,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":[]}
@@ -1,14 +1,14 @@
1
- import * as React from "react";
1
+ import type * as React from "react";
2
2
  import { Plugin } from "@webiny/plugins";
3
3
  interface Config<Props> {
4
4
  name: string;
5
5
  render(props: Props): React.ReactElement | null;
6
6
  }
7
7
  export declare class ViewPlugin<Props = any> extends Plugin {
8
- static readonly type = "view";
9
- private _config;
8
+ static readonly type: string;
9
+ private readonly _config;
10
10
  constructor(config?: Config<Props>);
11
- get key(): string;
12
- render(props: Props): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)>) | (new (props: any) => React.Component<any, any, any>)>;
11
+ get key(): string | undefined;
12
+ render(props: Props): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
13
13
  }
14
14
  export {};
@@ -1,41 +1,19 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
- import _createSuper from "@babel/runtime/helpers/createSuper";
6
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
1
  import { Plugin } from "@webiny/plugins";
8
- export var ViewPlugin = /*#__PURE__*/function (_Plugin) {
9
- _inherits(ViewPlugin, _Plugin);
10
-
11
- var _super = _createSuper(ViewPlugin);
12
-
13
- function ViewPlugin(config) {
14
- var _this;
15
-
16
- _classCallCheck(this, ViewPlugin);
17
-
18
- _this = _super.call(this);
19
-
20
- _defineProperty(_assertThisInitialized(_this), "_config", void 0);
21
-
22
- _this._config = config || {};
23
- return _this;
2
+ export class ViewPlugin extends Plugin {
3
+ static type = "view";
4
+ constructor(config) {
5
+ super();
6
+ this._config = config || {};
24
7
  }
25
-
26
- _createClass(ViewPlugin, [{
27
- key: "key",
28
- get: function get() {
29
- return this._config.name;
30
- }
31
- }, {
32
- key: "render",
33
- value: function render(props) {
34
- return this._config.render(props);
8
+ get key() {
9
+ return this._config.name;
10
+ }
11
+ render(props) {
12
+ if (!this._config.render) {
13
+ return null;
35
14
  }
36
- }]);
37
-
38
- return ViewPlugin;
39
- }(Plugin);
15
+ return this._config.render(props);
16
+ }
17
+ }
40
18
 
41
- _defineProperty(ViewPlugin, "type", "view");
19
+ //# sourceMappingURL=ViewPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Plugin","ViewPlugin","type","constructor","config","_config","key","name","render","props"],"sources":["ViewPlugin.ts"],"sourcesContent":["import type * as React from \"react\";\nimport { Plugin } from \"@webiny/plugins\";\n\ninterface Config<Props> {\n name: string;\n render(props: Props): React.ReactElement | null;\n}\n\nexport class ViewPlugin<Props = any> extends Plugin {\n public static override readonly type: string = \"view\";\n private readonly _config: Partial<Config<Props>>;\n\n public constructor(config?: Config<Props>) {\n super();\n this._config = config || {};\n }\n\n get key() {\n return this._config.name;\n }\n\n public render(props: Props) {\n if (!this._config.render) {\n return null;\n }\n return this._config.render(props);\n }\n}\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,iBAAiB;AAOxC,OAAO,MAAMC,UAAU,SAAsBD,MAAM,CAAC;EAChD,OAAgCE,IAAI,GAAW,MAAM;EAG9CC,WAAWA,CAACC,MAAsB,EAAE;IACvC,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,OAAO,GAAGD,MAAM,IAAI,CAAC,CAAC;EAC/B;EAEA,IAAIE,GAAGA,CAAA,EAAG;IACN,OAAO,IAAI,CAACD,OAAO,CAACE,IAAI;EAC5B;EAEOC,MAAMA,CAACC,KAAY,EAAE;IACxB,IAAI,CAAC,IAAI,CAACJ,OAAO,CAACG,MAAM,EAAE;MACtB,OAAO,IAAI;IACf;IACA,OAAO,IAAI,CAACH,OAAO,CAACG,MAAM,CAACC,KAAK,CAAC;EACrC;AACJ","ignoreList":[]}
@@ -1,3 +1,3 @@
1
- import { ImageComponentPlugin } from "../types";
1
+ import type { ImageComponentPlugin } from "../types";
2
2
  declare const _default: () => ImageComponentPlugin;
3
3
  export default _default;