@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.
Files changed (427) hide show
  1. package/App.d.ts +5 -13
  2. package/App.js +70 -87
  3. package/App.js.map +1 -1
  4. package/AppContainer.d.ts +23 -0
  5. package/AppContainer.js +9 -0
  6. package/AppContainer.js.map +1 -0
  7. package/README.md +7 -15
  8. package/apollo-client/InMemoryCache.d.ts +3 -2
  9. package/apollo-client/InMemoryCache.js +16 -47
  10. package/apollo-client/InMemoryCache.js.map +1 -1
  11. package/apollo-client/IntrospectionFragmentMatcher.d.ts +2 -2
  12. package/apollo-client/IntrospectionFragmentMatcher.js +33 -50
  13. package/apollo-client/IntrospectionFragmentMatcher.js.map +1 -1
  14. package/components/Image.d.ts +1 -2
  15. package/components/Image.js +11 -19
  16. package/components/Image.js.map +1 -1
  17. package/components/index.d.ts +1 -2
  18. package/components/index.js +1 -19
  19. package/components/index.js.map +1 -1
  20. package/config/RouterConfig/Route.d.ts +29 -0
  21. package/config/RouterConfig/Route.js +33 -0
  22. package/config/RouterConfig/Route.js.map +1 -0
  23. package/config/RouterConfig.d.ts +31 -0
  24. package/config/RouterConfig.js +18 -0
  25. package/config/RouterConfig.js.map +1 -0
  26. package/config.js +9 -15
  27. package/config.js.map +1 -1
  28. package/contexts/Ui/index.js +28 -52
  29. package/contexts/Ui/index.js.map +1 -1
  30. package/core/DebounceRender.js +13 -24
  31. package/core/DebounceRender.js.map +1 -1
  32. package/core/Plugin.d.ts +1 -1
  33. package/core/Plugin.js +11 -19
  34. package/core/Plugin.js.map +1 -1
  35. package/core/Plugins.d.ts +1 -1
  36. package/core/Plugins.js +20 -25
  37. package/core/Plugins.js.map +1 -1
  38. package/core/Provider.d.ts +1 -1
  39. package/core/Provider.js +9 -13
  40. package/core/Provider.js.map +1 -1
  41. package/core/Routes.d.ts +2 -1
  42. package/core/Routes.js +13 -23
  43. package/core/Routes.js.map +1 -1
  44. package/core/createProvider.d.ts +2 -2
  45. package/core/createProvider.js +1 -7
  46. package/core/createProvider.js.map +1 -1
  47. package/core/createProviderPlugin.d.ts +1 -1
  48. package/core/createProviderPlugin.js +4 -10
  49. package/core/createProviderPlugin.js.map +1 -1
  50. package/errors/AuthenticationErrorEvent.d.ts +9 -0
  51. package/errors/AuthenticationErrorEvent.js +10 -0
  52. package/errors/AuthenticationErrorEvent.js.map +1 -0
  53. package/errors/NetworkErrorEvent.d.ts +15 -0
  54. package/errors/NetworkErrorEvent.js +10 -0
  55. package/errors/NetworkErrorEvent.js.map +1 -0
  56. package/errors/abstractions.d.ts +12 -0
  57. package/errors/abstractions.js +5 -0
  58. package/errors/abstractions.js.map +1 -0
  59. package/errors/index.d.ts +6 -0
  60. package/errors/index.js +6 -0
  61. package/errors/index.js.map +1 -0
  62. package/exports/admin/envConfig.d.ts +1 -0
  63. package/exports/admin/envConfig.js +3 -0
  64. package/exports/admin/envConfig.js.map +1 -0
  65. package/exports/admin/graphqlClient.d.ts +1 -0
  66. package/exports/admin/graphqlClient.js +3 -0
  67. package/exports/admin/graphqlClient.js.map +1 -0
  68. package/exports/admin/localStorage.d.ts +2 -0
  69. package/exports/admin/localStorage.js +4 -0
  70. package/exports/admin/localStorage.js.map +1 -0
  71. package/exports/admin/router.d.ts +4 -0
  72. package/exports/admin/router.js +6 -0
  73. package/exports/admin/router.js.map +1 -0
  74. package/exports/admin/security.d.ts +1 -0
  75. package/exports/admin/security.js +3 -0
  76. package/exports/admin/security.js.map +1 -0
  77. package/exports/admin.d.ts +6 -0
  78. package/exports/admin.js +8 -0
  79. package/exports/admin.js.map +1 -0
  80. package/features/envConfig/EnvConfig.d.ts +6 -0
  81. package/features/envConfig/EnvConfig.js +14 -0
  82. package/features/envConfig/EnvConfig.js.map +1 -0
  83. package/features/envConfig/abstractions.d.ts +27 -0
  84. package/features/envConfig/abstractions.js +4 -0
  85. package/features/envConfig/abstractions.js.map +1 -0
  86. package/features/envConfig/feature.d.ts +17 -0
  87. package/features/envConfig/feature.js +14 -0
  88. package/features/envConfig/feature.js.map +1 -0
  89. package/features/envConfig/index.d.ts +1 -0
  90. package/features/envConfig/index.js +3 -0
  91. package/features/envConfig/index.js.map +1 -0
  92. package/features/eventPublisher/EventPublisher.d.ts +8 -0
  93. package/features/eventPublisher/EventPublisher.js +27 -0
  94. package/features/eventPublisher/EventPublisher.js.map +1 -0
  95. package/features/eventPublisher/abstractions.d.ts +18 -0
  96. package/features/eventPublisher/abstractions.js +14 -0
  97. package/features/eventPublisher/abstractions.js.map +1 -0
  98. package/features/eventPublisher/feature.d.ts +1 -0
  99. package/features/eventPublisher/feature.js +11 -0
  100. package/features/eventPublisher/feature.js.map +1 -0
  101. package/features/eventPublisher/index.d.ts +3 -0
  102. package/features/eventPublisher/index.js +4 -0
  103. package/features/eventPublisher/index.js.map +1 -0
  104. package/features/graphqlClient/AuthenticationErrorPublishing.d.ts +13 -0
  105. package/features/graphqlClient/AuthenticationErrorPublishing.js +35 -0
  106. package/features/graphqlClient/AuthenticationErrorPublishing.js.map +1 -0
  107. package/features/graphqlClient/BatchingGraphQLClient.d.ts +18 -0
  108. package/features/graphqlClient/BatchingGraphQLClient.js +164 -0
  109. package/features/graphqlClient/BatchingGraphQLClient.js.map +1 -0
  110. package/features/graphqlClient/FetchGraphQLClient.d.ts +10 -0
  111. package/features/graphqlClient/FetchGraphQLClient.js +62 -0
  112. package/features/graphqlClient/FetchGraphQLClient.js.map +1 -0
  113. package/features/graphqlClient/NetworkErrorPublishing.d.ts +14 -0
  114. package/features/graphqlClient/NetworkErrorPublishing.js +55 -0
  115. package/features/graphqlClient/NetworkErrorPublishing.js.map +1 -0
  116. package/features/graphqlClient/RequestValue.d.ts +20 -0
  117. package/features/graphqlClient/RequestValue.js +42 -0
  118. package/features/graphqlClient/RequestValue.js.map +1 -0
  119. package/features/graphqlClient/RetryGraphQLClient.d.ts +18 -0
  120. package/features/graphqlClient/RetryGraphQLClient.js +54 -0
  121. package/features/graphqlClient/RetryGraphQLClient.js.map +1 -0
  122. package/features/graphqlClient/__tests__/GraphQLClient.test.d.ts +1 -0
  123. package/features/graphqlClient/__tests__/GraphQLClient.test.js +350 -0
  124. package/features/graphqlClient/__tests__/GraphQLClient.test.js.map +1 -0
  125. package/features/graphqlClient/abstractions.d.ts +17 -0
  126. package/features/graphqlClient/abstractions.js +4 -0
  127. package/features/graphqlClient/abstractions.js.map +1 -0
  128. package/features/graphqlClient/feature.d.ts +6 -0
  129. package/features/graphqlClient/feature.js +31 -0
  130. package/features/graphqlClient/feature.js.map +1 -0
  131. package/features/graphqlClient/index.d.ts +1 -0
  132. package/features/graphqlClient/index.js +3 -0
  133. package/features/graphqlClient/index.js.map +1 -0
  134. package/features/graphqlClient/types.d.ts +5 -0
  135. package/features/graphqlClient/types.js +3 -0
  136. package/features/graphqlClient/types.js.map +1 -0
  137. package/features/localStorage/BrowserLocalStorageGateway.d.ts +9 -0
  138. package/features/localStorage/BrowserLocalStorageGateway.js +68 -0
  139. package/features/localStorage/BrowserLocalStorageGateway.js.map +1 -0
  140. package/features/localStorage/LocalStorage.d.ts +12 -0
  141. package/features/localStorage/LocalStorage.js +31 -0
  142. package/features/localStorage/LocalStorage.js.map +1 -0
  143. package/features/localStorage/LocalStorageRepository.d.ts +20 -0
  144. package/features/localStorage/LocalStorageRepository.js +95 -0
  145. package/features/localStorage/LocalStorageRepository.js.map +1 -0
  146. package/features/localStorage/abstractions.d.ts +48 -0
  147. package/features/localStorage/abstractions.js +19 -0
  148. package/features/localStorage/abstractions.js.map +1 -0
  149. package/features/localStorage/feature.d.ts +12 -0
  150. package/features/localStorage/feature.js +34 -0
  151. package/features/localStorage/feature.js.map +1 -0
  152. package/features/localStorage/index.d.ts +1 -0
  153. package/features/localStorage/index.js +3 -0
  154. package/features/localStorage/index.js.map +1 -0
  155. package/features/router/HistoryRouterGateway.d.ts +18 -0
  156. package/features/router/HistoryRouterGateway.js +82 -0
  157. package/features/router/HistoryRouterGateway.js.map +1 -0
  158. package/features/router/HistoryRouterGateway.test.d.ts +1 -0
  159. package/features/router/HistoryRouterGateway.test.js +204 -0
  160. package/features/router/HistoryRouterGateway.test.js.map +1 -0
  161. package/features/router/Route.d.ts +19 -0
  162. package/features/router/Route.js +59 -0
  163. package/features/router/Route.js.map +1 -0
  164. package/features/router/RouteUrl.d.ts +85 -0
  165. package/features/router/RouteUrl.js +232 -0
  166. package/features/router/RouteUrl.js.map +1 -0
  167. package/features/router/Router.d.ts +45 -0
  168. package/features/router/Router.js +129 -0
  169. package/features/router/Router.js.map +1 -0
  170. package/features/router/RouterPresenter.d.ts +17 -0
  171. package/features/router/RouterPresenter.js +45 -0
  172. package/features/router/RouterPresenter.js.map +1 -0
  173. package/features/router/RouterRepository.d.ts +21 -0
  174. package/features/router/RouterRepository.js +71 -0
  175. package/features/router/RouterRepository.js.map +1 -0
  176. package/features/router/RouterRepository.test.d.ts +1 -0
  177. package/features/router/RouterRepository.test.js +154 -0
  178. package/features/router/RouterRepository.test.js.map +1 -0
  179. package/features/router/abstractions.d.ts +68 -0
  180. package/features/router/abstractions.js +15 -0
  181. package/features/router/abstractions.js.map +1 -0
  182. package/features/router/feature.d.ts +4 -0
  183. package/features/router/feature.js +18 -0
  184. package/features/router/feature.js.map +1 -0
  185. package/features/router/index.d.ts +1 -0
  186. package/features/router/index.js +3 -0
  187. package/features/router/index.js.map +1 -0
  188. package/helpers/InterfaceGenerator/date.d.ts +15 -0
  189. package/helpers/InterfaceGenerator/date.js +3 -0
  190. package/helpers/InterfaceGenerator/date.js.map +1 -0
  191. package/helpers/InterfaceGenerator/id.d.ts +23 -0
  192. package/helpers/InterfaceGenerator/id.js +3 -0
  193. package/helpers/InterfaceGenerator/id.js.map +1 -0
  194. package/helpers/InterfaceGenerator/identity.d.ts +10 -0
  195. package/helpers/InterfaceGenerator/identity.js +3 -0
  196. package/helpers/InterfaceGenerator/identity.js.map +1 -0
  197. package/helpers/InterfaceGenerator/index.d.ts +5 -0
  198. package/helpers/InterfaceGenerator/index.js +3 -0
  199. package/helpers/InterfaceGenerator/index.js.map +1 -0
  200. package/helpers/InterfaceGenerator/numeric.d.ts +12 -0
  201. package/helpers/InterfaceGenerator/numeric.js +3 -0
  202. package/helpers/InterfaceGenerator/numeric.js.map +1 -0
  203. package/helpers/InterfaceGenerator/truthful.d.ts +7 -0
  204. package/helpers/InterfaceGenerator/truthful.js +3 -0
  205. package/helpers/InterfaceGenerator/truthful.js.map +1 -0
  206. package/hooks/useAutocomplete/index.d.ts +1 -1
  207. package/hooks/useAutocomplete/index.js +1 -12
  208. package/hooks/useAutocomplete/index.js.map +1 -1
  209. package/hooks/useAutocomplete/useAutocomplete.d.ts +1 -1
  210. package/hooks/useAutocomplete/useAutocomplete.js +6 -16
  211. package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
  212. package/hooks/useDataList/functions/getData.js +2 -11
  213. package/hooks/useDataList/functions/getData.js.map +1 -1
  214. package/hooks/useDataList/functions/getError.js +2 -11
  215. package/hooks/useDataList/functions/getError.js.map +1 -1
  216. package/hooks/useDataList/functions/getMeta.js +2 -11
  217. package/hooks/useDataList/functions/getMeta.js.map +1 -1
  218. package/hooks/useDataList/functions/index.d.ts +3 -3
  219. package/hooks/useDataList/functions/index.js +3 -27
  220. package/hooks/useDataList/functions/index.js.map +1 -1
  221. package/hooks/useDataList/functions/searchDataByKey.js +4 -10
  222. package/hooks/useDataList/functions/searchDataByKey.js.map +1 -1
  223. package/hooks/useDataList/index.d.ts +1 -1
  224. package/hooks/useDataList/index.js +1 -12
  225. package/hooks/useDataList/index.js.map +1 -1
  226. package/hooks/useDataList/useDataList.d.ts +2 -3
  227. package/hooks/useDataList/useDataList.js +74 -94
  228. package/hooks/useDataList/useDataList.js.map +1 -1
  229. package/hooks/useDataList/utils/index.d.ts +1 -2
  230. package/hooks/useDataList/utils/index.js +1 -20
  231. package/hooks/useDataList/utils/index.js.map +1 -1
  232. package/hooks/useDataList/utils/prepareLoadListParams.js +10 -16
  233. package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -1
  234. package/hooks/useHandler.js +7 -12
  235. package/hooks/useHandler.js.map +1 -1
  236. package/hooks/useHandlers.js +11 -17
  237. package/hooks/useHandlers.js.map +1 -1
  238. package/hooks/useRegisterLegacyPlugin.d.ts +1 -1
  239. package/hooks/useRegisterLegacyPlugin.js +5 -11
  240. package/hooks/useRegisterLegacyPlugin.js.map +1 -1
  241. package/hooks/useUi.d.ts +1 -1
  242. package/hooks/useUi.js +4 -10
  243. package/hooks/useUi.js.map +1 -1
  244. package/i18n/i18n.js +5 -13
  245. package/i18n/i18n.js.map +1 -1
  246. package/i18n/index.d.ts +1 -1
  247. package/i18n/index.js +1 -13
  248. package/i18n/index.js.map +1 -1
  249. package/index.d.ts +23 -15
  250. package/index.js +25 -177
  251. package/index.js.map +1 -1
  252. package/package.json +25 -22
  253. package/plugins/AddQuerySelectionPlugin.d.ts +2 -2
  254. package/plugins/AddQuerySelectionPlugin.js +61 -107
  255. package/plugins/AddQuerySelectionPlugin.js.map +1 -1
  256. package/plugins/ApolloCacheObjectIdPlugin.js +12 -31
  257. package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -1
  258. package/plugins/ApolloDynamicLink.d.ts +3 -2
  259. package/plugins/ApolloDynamicLink.js +19 -46
  260. package/plugins/ApolloDynamicLink.js.map +1 -1
  261. package/plugins/ApolloLinkPlugin.d.ts +1 -1
  262. package/plugins/ApolloLinkPlugin.js +18 -37
  263. package/plugins/ApolloLinkPlugin.js.map +1 -1
  264. package/plugins/ConsoleLinkPlugin.d.ts +1 -1
  265. package/plugins/ConsoleLinkPlugin.js +20 -41
  266. package/plugins/ConsoleLinkPlugin.js.map +1 -1
  267. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +8 -13
  268. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +35 -58
  269. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -1
  270. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.d.ts +14 -0
  271. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js +31 -0
  272. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js.map +1 -0
  273. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.d.ts +2 -0
  274. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js +31 -0
  275. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js.map +1 -0
  276. package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +4 -5
  277. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +68 -12
  278. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
  279. package/plugins/NetworkErrorLinkPlugin/Typography.d.ts +8 -0
  280. package/plugins/NetworkErrorLinkPlugin/Typography.js +18 -0
  281. package/plugins/NetworkErrorLinkPlugin/Typography.js.map +1 -0
  282. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +3 -3
  283. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +10 -25
  284. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
  285. package/plugins/NetworkErrorLinkPlugin.d.ts +4 -1
  286. package/plugins/NetworkErrorLinkPlugin.js +60 -37
  287. package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
  288. package/plugins/OmitTypenameLinkPlugin.d.ts +1 -1
  289. package/plugins/OmitTypenameLinkPlugin.js +11 -30
  290. package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
  291. package/plugins/TenantHeaderLinkPlugin.d.ts +3 -3
  292. package/plugins/TenantHeaderLinkPlugin.js +29 -48
  293. package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
  294. package/plugins/components/Image.d.ts +6 -0
  295. package/plugins/components/Image.js +19 -0
  296. package/plugins/components/Image.js.map +1 -0
  297. package/plugins/image.d.ts +1 -1
  298. package/plugins/image.js +46 -53
  299. package/plugins/image.js.map +1 -1
  300. package/plugins/index.d.ts +4 -4
  301. package/plugins/index.js +31 -53
  302. package/plugins/index.js.map +1 -1
  303. package/presentation/localStorage/index.d.ts +3 -0
  304. package/presentation/localStorage/index.js +5 -0
  305. package/presentation/localStorage/index.js.map +1 -0
  306. package/presentation/localStorage/useLocalStorage.d.ts +6 -0
  307. package/presentation/localStorage/useLocalStorage.js +21 -0
  308. package/presentation/localStorage/useLocalStorage.js.map +1 -0
  309. package/presentation/localStorage/useLocalStorageValue.d.ts +1 -0
  310. package/presentation/localStorage/useLocalStorageValue.js +20 -0
  311. package/presentation/localStorage/useLocalStorageValue.js.map +1 -0
  312. package/presentation/localStorage/useLocalStorageValues.d.ts +5 -0
  313. package/presentation/localStorage/useLocalStorageValues.js +39 -0
  314. package/presentation/localStorage/useLocalStorageValues.js.map +1 -0
  315. package/presentation/router/RouteElementRegistry.d.ts +14 -0
  316. package/presentation/router/RouteElementRegistry.js +32 -0
  317. package/presentation/router/RouteElementRegistry.js.map +1 -0
  318. package/presentation/router/abstractions.d.ts +13 -0
  319. package/presentation/router/abstractions.js +4 -0
  320. package/presentation/router/abstractions.js.map +1 -0
  321. package/presentation/router/components/RouteContent.d.ts +2 -0
  322. package/presentation/router/components/RouteContent.js +17 -0
  323. package/presentation/router/components/RouteContent.js.map +1 -0
  324. package/presentation/router/components/RouteLink.d.ts +50 -0
  325. package/presentation/router/components/RouteLink.js +22 -0
  326. package/presentation/router/components/RouteLink.js.map +1 -0
  327. package/presentation/router/components/SimpleLink.d.ts +44 -0
  328. package/presentation/router/components/SimpleLink.js +30 -0
  329. package/presentation/router/components/SimpleLink.js.map +1 -0
  330. package/presentation/router/hooks/useRoute.d.ts +6 -0
  331. package/presentation/router/hooks/useRoute.js +30 -0
  332. package/presentation/router/hooks/useRoute.js.map +1 -0
  333. package/presentation/router/hooks/useRouter.d.ts +7 -0
  334. package/presentation/router/hooks/useRouter.js +26 -0
  335. package/presentation/router/hooks/useRouter.js.map +1 -0
  336. package/presentation/router/index.d.ts +4 -0
  337. package/presentation/router/index.js +5 -0
  338. package/presentation/router/index.js.map +1 -0
  339. package/presentation/router/types.d.ts +5 -0
  340. package/presentation/router/types.js +3 -0
  341. package/presentation/router/types.js.map +1 -0
  342. package/react-butterfiles/Files.js +208 -235
  343. package/react-butterfiles/Files.js.map +1 -1
  344. package/react-butterfiles/file.todo +1 -0
  345. package/react-butterfiles/index.d.ts +1 -1
  346. package/react-butterfiles/index.js +2 -8
  347. package/react-butterfiles/index.js.map +1 -1
  348. package/react-butterfiles/utils/generateId.js +1 -7
  349. package/react-butterfiles/utils/generateId.js.map +1 -1
  350. package/react-butterfiles/utils/readFileContent.js +4 -10
  351. package/react-butterfiles/utils/readFileContent.js.map +1 -1
  352. package/renderApp.d.ts +1 -1
  353. package/renderApp.js +4 -11
  354. package/renderApp.js.map +1 -1
  355. package/router.d.ts +5 -0
  356. package/router.js +8 -0
  357. package/router.js.map +1 -0
  358. package/shared/di/DiContainerProvider.d.ts +8 -0
  359. package/shared/di/DiContainerProvider.js +17 -0
  360. package/shared/di/DiContainerProvider.js.map +1 -0
  361. package/shared/di/createFeature.d.ts +11 -0
  362. package/shared/di/createFeature.js +11 -0
  363. package/shared/di/createFeature.js.map +1 -0
  364. package/shared/di/useFeature.d.ts +2 -0
  365. package/shared/di/useFeature.js +18 -0
  366. package/shared/di/useFeature.js.map +1 -0
  367. package/types.d.ts +9 -6
  368. package/types.js +1 -12
  369. package/types.js.map +1 -1
  370. package/utils/createGenericContext.js +13 -22
  371. package/utils/createGenericContext.js.map +1 -1
  372. package/utils/createHashing.js +9 -15
  373. package/utils/createHashing.js.map +1 -1
  374. package/utils/index.d.ts +2 -10
  375. package/utils/index.js +2 -115
  376. package/utils/index.js.map +1 -1
  377. package/utils/legacyPluginToReactComponent.d.ts +1 -1
  378. package/utils/legacyPluginToReactComponent.js +5 -11
  379. package/utils/legacyPluginToReactComponent.js.map +1 -1
  380. package/components/Routes.d.ts +0 -2
  381. package/components/Routes.js +0 -46
  382. package/components/Routes.js.map +0 -1
  383. package/components/View.d.ts +0 -8
  384. package/components/View.js +0 -31
  385. package/components/View.js.map +0 -1
  386. package/core/AddRoute.d.ts +0 -21
  387. package/core/AddRoute.js +0 -21
  388. package/core/AddRoute.js.map +0 -1
  389. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.d.ts +0 -14
  390. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +0 -30
  391. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +0 -1
  392. package/hooks/useDataList/utils/types.d.ts +0 -40
  393. package/hooks/useDataList/utils/types.js +0 -7
  394. package/hooks/useDataList/utils/types.js.map +0 -1
  395. package/plugins/LocaleHeaderLinkPlugin.d.ts +0 -10
  396. package/plugins/LocaleHeaderLinkPlugin.js +0 -49
  397. package/plugins/LocaleHeaderLinkPlugin.js.map +0 -1
  398. package/plugins/RoutePlugin.d.ts +0 -12
  399. package/plugins/RoutePlugin.js +0 -35
  400. package/plugins/RoutePlugin.js.map +0 -1
  401. package/plugins/ViewPlugin.d.ts +0 -14
  402. package/plugins/ViewPlugin.js +0 -40
  403. package/plugins/ViewPlugin.js.map +0 -1
  404. package/utils/getApiUrl.d.ts +0 -1
  405. package/utils/getApiUrl.js +0 -12
  406. package/utils/getApiUrl.js.map +0 -1
  407. package/utils/getGqlApiUrl.d.ts +0 -1
  408. package/utils/getGqlApiUrl.js +0 -12
  409. package/utils/getGqlApiUrl.js.map +0 -1
  410. package/utils/getHeadlessCmsGqlApiUrl.d.ts +0 -5
  411. package/utils/getHeadlessCmsGqlApiUrl.js +0 -18
  412. package/utils/getHeadlessCmsGqlApiUrl.js.map +0 -1
  413. package/utils/getLocaleCode.d.ts +0 -6
  414. package/utils/getLocaleCode.js +0 -43
  415. package/utils/getLocaleCode.js.map +0 -1
  416. package/utils/getPrerenderId.d.ts +0 -6
  417. package/utils/getPrerenderId.js +0 -11
  418. package/utils/getPrerenderId.js.map +0 -1
  419. package/utils/getTenantId.d.ts +0 -6
  420. package/utils/getTenantId.js +0 -51
  421. package/utils/getTenantId.js.map +0 -1
  422. package/utils/isLocalhost.d.ts +0 -1
  423. package/utils/isLocalhost.js +0 -15
  424. package/utils/isLocalhost.js.map +0 -1
  425. package/utils/isPrerendering.d.ts +0 -1
  426. package/utils/isPrerendering.js +0 -11
  427. package/utils/isPrerendering.js.map +0 -1
@@ -1,25 +1,17 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.Image = void 0;
8
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
- var _invariant = _interopRequireDefault(require("invariant"));
10
- var _plugins = require("@webiny/plugins");
11
- var _get = _interopRequireDefault(require("lodash/get"));
12
- var _excluded = ["preset"];
13
- var Image = exports.Image = function Image(_ref) {
14
- var presetName = _ref.preset,
15
- props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
16
- var plugin = _plugins.plugins.byName("image-component");
1
+ import invariant from "invariant";
2
+ import { plugins } from "@webiny/plugins";
3
+ import get from "lodash/get.js";
4
+ export const Image = ({
5
+ preset: presetName,
6
+ ...props
7
+ }) => {
8
+ const plugin = plugins.byName("image-component");
17
9
  if (!plugin) {
18
- throw new Error("Image component plugin (type \"image-component\") not defined.");
10
+ throw new Error(`Image component plugin (type "image-component") not defined.`);
19
11
  }
20
12
  if (presetName) {
21
- var preset = (0, _get.default)(plugin, "presets.".concat(presetName));
22
- (0, _invariant.default)(preset, "Transform preset \"".concat(presetName, "\" not found."));
13
+ const preset = get(plugin, `presets.${presetName}`);
14
+ invariant(preset, `Transform preset "${presetName}" not found.`);
23
15
  props.transform = preset;
24
16
  }
25
17
  if (props.transform) {
@@ -1 +1 @@
1
- {"version":3,"names":["_invariant","_interopRequireDefault","require","_plugins","_get","_excluded","Image","exports","_ref","presetName","preset","props","_objectWithoutProperties2","default","plugin","plugins","byName","Error","get","concat","invariant","transform","src","getImageSrc","render"],"sources":["Image.tsx"],"sourcesContent":["import invariant from \"invariant\";\nimport { plugins } from \"@webiny/plugins\";\nimport get from \"lodash/get\";\nimport { ImageComponentPlugin, ImageProps } from \"~/types\";\n\nexport const Image = ({ preset: presetName, ...props }: ImageProps) => {\n const plugin = plugins.byName<ImageComponentPlugin>(\"image-component\");\n if (!plugin) {\n throw new Error(`Image component plugin (type \"image-component\") not defined.`);\n }\n\n if (presetName) {\n const preset = get(plugin, `presets.${presetName}`);\n invariant(preset, `Transform preset \"${presetName}\" not found.`);\n props.transform = preset;\n }\n\n if (props.transform) {\n props.src = plugin.getImageSrc(props);\n }\n\n return plugin.render(props);\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAH,sBAAA,CAAAC,OAAA;AAA6B,IAAAG,SAAA;AAGtB,IAAMC,KAAK,GAAAC,OAAA,CAAAD,KAAA,GAAG,SAARA,KAAKA,CAAAE,IAAA,EAAqD;EAAA,IAAvCC,UAAU,GAAAD,IAAA,CAAlBE,MAAM;IAAiBC,KAAK,OAAAC,yBAAA,CAAAC,OAAA,EAAAL,IAAA,EAAAH,SAAA;EAChD,IAAMS,MAAM,GAAGC,gBAAO,CAACC,MAAM,CAAuB,iBAAiB,CAAC;EACtE,IAAI,CAACF,MAAM,EAAE;IACT,MAAM,IAAIG,KAAK,iEAA+D,CAAC;EACnF;EAEA,IAAIR,UAAU,EAAE;IACZ,IAAMC,MAAM,GAAG,IAAAQ,YAAG,EAACJ,MAAM,aAAAK,MAAA,CAAaV,UAAU,CAAE,CAAC;IACnD,IAAAW,kBAAS,EAACV,MAAM,wBAAAS,MAAA,CAAuBV,UAAU,kBAAc,CAAC;IAChEE,KAAK,CAACU,SAAS,GAAGX,MAAM;EAC5B;EAEA,IAAIC,KAAK,CAACU,SAAS,EAAE;IACjBV,KAAK,CAACW,GAAG,GAAGR,MAAM,CAACS,WAAW,CAACZ,KAAK,CAAC;EACzC;EAEA,OAAOG,MAAM,CAACU,MAAM,CAACb,KAAK,CAAC;AAC/B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["invariant","plugins","get","Image","preset","presetName","props","plugin","byName","Error","transform","src","getImageSrc","render"],"sources":["Image.tsx"],"sourcesContent":["import invariant from \"invariant\";\nimport { plugins } from \"@webiny/plugins\";\nimport get from \"lodash/get.js\";\nimport type { ImageComponentPlugin, ImageProps } from \"~/types.js\";\n\nexport const Image = ({ preset: presetName, ...props }: ImageProps) => {\n const plugin = plugins.byName<ImageComponentPlugin>(\"image-component\");\n if (!plugin) {\n throw new Error(`Image component plugin (type \"image-component\") not defined.`);\n }\n\n if (presetName) {\n const preset = get(plugin, `presets.${presetName}`);\n invariant(preset, `Transform preset \"${presetName}\" not found.`);\n props.transform = preset;\n }\n\n if (props.transform) {\n props.src = plugin.getImageSrc(props);\n }\n\n return plugin.render(props);\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,WAAW;AACjC,SAASC,OAAO,QAAQ,iBAAiB;AACzC,OAAOC,GAAG,MAAM,eAAe;AAG/B,OAAO,MAAMC,KAAK,GAAGA,CAAC;EAAEC,MAAM,EAAEC,UAAU;EAAE,GAAGC;AAAkB,CAAC,KAAK;EACnE,MAAMC,MAAM,GAAGN,OAAO,CAACO,MAAM,CAAuB,iBAAiB,CAAC;EACtE,IAAI,CAACD,MAAM,EAAE;IACT,MAAM,IAAIE,KAAK,CAAC,8DAA8D,CAAC;EACnF;EAEA,IAAIJ,UAAU,EAAE;IACZ,MAAMD,MAAM,GAAGF,GAAG,CAACK,MAAM,EAAE,WAAWF,UAAU,EAAE,CAAC;IACnDL,SAAS,CAACI,MAAM,EAAE,qBAAqBC,UAAU,cAAc,CAAC;IAChEC,KAAK,CAACI,SAAS,GAAGN,MAAM;EAC5B;EAEA,IAAIE,KAAK,CAACI,SAAS,EAAE;IACjBJ,KAAK,CAACK,GAAG,GAAGJ,MAAM,CAACK,WAAW,CAACN,KAAK,CAAC;EACzC;EAEA,OAAOC,MAAM,CAACM,MAAM,CAACP,KAAK,CAAC;AAC/B,CAAC","ignoreList":[]}
@@ -1,2 +1 @@
1
- export { Image } from "./Image";
2
- export { Routes } from "./Routes";
1
+ export { Image } from "./Image.js";
@@ -1,21 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "Image", {
7
- enumerable: true,
8
- get: function get() {
9
- return _Image.Image;
10
- }
11
- });
12
- Object.defineProperty(exports, "Routes", {
13
- enumerable: true,
14
- get: function get() {
15
- return _Routes.Routes;
16
- }
17
- });
18
- var _Image = require("./Image");
19
- var _Routes = require("./Routes");
1
+ export { Image } from "./Image.js";
20
2
 
21
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_Image","require","_Routes"],"sources":["index.ts"],"sourcesContent":["export { Image } from \"./Image\";\nexport { Routes } from \"./Routes\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["Image"],"sources":["index.ts"],"sourcesContent":["export { Image } from \"./Image.js\";\n"],"mappings":"AAAA,SAASA,KAAK","ignoreList":[]}
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+ import type { Route as BaseRoute } from "../../router.js";
3
+ export interface RouteProps {
4
+ route: BaseRoute<any>;
5
+ element: React.ReactElement;
6
+ remove?: boolean;
7
+ before?: string;
8
+ after?: string;
9
+ }
10
+ export type RouteConfig = Pick<RouteProps, "route" | "element">;
11
+ export declare const Route: (({ route, element, remove, before, after }: RouteProps) => React.JSX.Element) & {
12
+ original: ({ route, element, remove, before, after }: RouteProps) => React.JSX.Element;
13
+ originalName: string;
14
+ displayName: string;
15
+ } & {
16
+ original: (({ route, element, remove, before, after }: RouteProps) => React.JSX.Element) & {
17
+ original: ({ route, element, remove, before, after }: RouteProps) => React.JSX.Element;
18
+ originalName: string;
19
+ displayName: string;
20
+ };
21
+ originalName: string;
22
+ displayName: string;
23
+ } & {
24
+ createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<(({ route, element, remove, before, after }: RouteProps) => React.JSX.Element) & {
25
+ original: ({ route, element, remove, before, after }: RouteProps) => React.JSX.Element;
26
+ originalName: string;
27
+ displayName: string;
28
+ }>) => (props: unknown) => React.JSX.Element;
29
+ };
@@ -0,0 +1,33 @@
1
+ import React from "react";
2
+ import { makeDecoratable } from "@webiny/react-composition";
3
+ import { Property, useIdGenerator } from "@webiny/react-properties";
4
+ export const Route = makeDecoratable("Route", ({
5
+ route,
6
+ element,
7
+ remove,
8
+ before,
9
+ after
10
+ }) => {
11
+ const name = route.name;
12
+ const getId = useIdGenerator("Route");
13
+ const placeAfter = after !== undefined ? getId(after) : undefined;
14
+ const placeBefore = before !== undefined ? getId(before) : undefined;
15
+ return /*#__PURE__*/React.createElement(Property, {
16
+ id: getId(name),
17
+ name: "routes",
18
+ remove: remove,
19
+ array: true,
20
+ before: placeBefore,
21
+ after: placeAfter
22
+ }, /*#__PURE__*/React.createElement(Property, {
23
+ id: getId(name, "route"),
24
+ name: "route",
25
+ value: route
26
+ }), /*#__PURE__*/React.createElement(Property, {
27
+ id: getId(name, "element"),
28
+ name: "element",
29
+ value: element
30
+ }));
31
+ });
32
+
33
+ //# sourceMappingURL=Route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","makeDecoratable","Property","useIdGenerator","Route","route","element","remove","before","after","name","getId","placeAfter","undefined","placeBefore","createElement","id","array","value"],"sources":["Route.tsx"],"sourcesContent":["import React from \"react\";\nimport { makeDecoratable } from \"@webiny/react-composition\";\nimport { Property, useIdGenerator } from \"@webiny/react-properties\";\nimport type { Route as BaseRoute } from \"~/router.js\";\n\nexport interface RouteProps {\n route: BaseRoute<any>;\n element: React.ReactElement;\n remove?: boolean;\n before?: string;\n after?: string;\n}\n\nexport type RouteConfig = Pick<RouteProps, \"route\" | \"element\">;\n\nexport const Route = makeDecoratable(\n \"Route\",\n ({ route, element, remove, before, after }: RouteProps) => {\n const name = route.name;\n\n const getId = useIdGenerator(\"Route\");\n\n const placeAfter = after !== undefined ? getId(after) : undefined;\n const placeBefore = before !== undefined ? getId(before) : undefined;\n\n return (\n <Property\n id={getId(name)}\n name={\"routes\"}\n remove={remove}\n array={true}\n before={placeBefore}\n after={placeAfter}\n >\n <Property id={getId(name, \"route\")} name={\"route\"} value={route} />\n <Property id={getId(name, \"element\")} name={\"element\"} value={element} />\n </Property>\n );\n }\n);\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,QAAQ,2BAA2B;AAC3D,SAASC,QAAQ,EAAEC,cAAc,QAAQ,0BAA0B;AAanE,OAAO,MAAMC,KAAK,GAAGH,eAAe,CAChC,OAAO,EACP,CAAC;EAAEI,KAAK;EAAEC,OAAO;EAAEC,MAAM;EAAEC,MAAM;EAAEC;AAAkB,CAAC,KAAK;EACvD,MAAMC,IAAI,GAAGL,KAAK,CAACK,IAAI;EAEvB,MAAMC,KAAK,GAAGR,cAAc,CAAC,OAAO,CAAC;EAErC,MAAMS,UAAU,GAAGH,KAAK,KAAKI,SAAS,GAAGF,KAAK,CAACF,KAAK,CAAC,GAAGI,SAAS;EACjE,MAAMC,WAAW,GAAGN,MAAM,KAAKK,SAAS,GAAGF,KAAK,CAACH,MAAM,CAAC,GAAGK,SAAS;EAEpE,oBACIb,KAAA,CAAAe,aAAA,CAACb,QAAQ;IACLc,EAAE,EAAEL,KAAK,CAACD,IAAI,CAAE;IAChBA,IAAI,EAAE,QAAS;IACfH,MAAM,EAAEA,MAAO;IACfU,KAAK,EAAE,IAAK;IACZT,MAAM,EAAEM,WAAY;IACpBL,KAAK,EAAEG;EAAW,gBAElBZ,KAAA,CAAAe,aAAA,CAACb,QAAQ;IAACc,EAAE,EAAEL,KAAK,CAACD,IAAI,EAAE,OAAO,CAAE;IAACA,IAAI,EAAE,OAAQ;IAACQ,KAAK,EAAEb;EAAM,CAAE,CAAC,eACnEL,KAAA,CAAAe,aAAA,CAACb,QAAQ;IAACc,EAAE,EAAEL,KAAK,CAACD,IAAI,EAAE,SAAS,CAAE;IAACA,IAAI,EAAE,SAAU;IAACQ,KAAK,EAAEZ;EAAQ,CAAE,CAClE,CAAC;AAEnB,CACJ,CAAC","ignoreList":[]}
@@ -0,0 +1,31 @@
1
+ import { type RouteConfig } from "./RouterConfig/Route.js";
2
+ export declare const RouterWithConfig: (({ onProperties, children }: import("@webiny/react-properties").WithConfigProps) => React.JSX.Element) & {
3
+ displayName: string;
4
+ };
5
+ export declare const useRouterConfig: () => {
6
+ routes: RouteConfig[];
7
+ };
8
+ export declare const RouterConfig: (({ priority, children }: import("@webiny/react-properties").ConfigProps) => React.JSX.Element) & {
9
+ Route: (({ route, element, remove, before, after }: import("./RouterConfig/Route.js").RouteProps) => import("react").JSX.Element) & {
10
+ original: ({ route, element, remove, before, after }: import("./RouterConfig/Route.js").RouteProps) => import("react").JSX.Element;
11
+ originalName: string;
12
+ displayName: string;
13
+ } & {
14
+ original: (({ route, element, remove, before, after }: import("./RouterConfig/Route.js").RouteProps) => import("react").JSX.Element) & {
15
+ original: ({ route, element, remove, before, after }: import("./RouterConfig/Route.js").RouteProps) => import("react").JSX.Element;
16
+ originalName: string;
17
+ displayName: string;
18
+ };
19
+ originalName: string;
20
+ displayName: string;
21
+ } & {
22
+ createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ route, element, remove, before, after }: import("./RouterConfig/Route.js").RouteProps) => import("react").JSX.Element) & {
23
+ original: ({ route, element, remove, before, after }: import("./RouterConfig/Route.js").RouteProps) => import("react").JSX.Element;
24
+ originalName: string;
25
+ displayName: string;
26
+ }>) => (props: unknown) => React.JSX.Element;
27
+ };
28
+ useRouterConfig: () => {
29
+ routes: RouteConfig[];
30
+ };
31
+ };
@@ -0,0 +1,18 @@
1
+ import { createConfigurableComponent } from "@webiny/react-properties";
2
+ import { Route } from "./RouterConfig/Route.js";
3
+ const base = createConfigurableComponent("RouterConfig");
4
+ export const RouterWithConfig = Object.assign(base.WithConfig, {
5
+ displayName: "RouterWithConfig"
6
+ });
7
+ export const useRouterConfig = () => {
8
+ const baseConfig = base.useConfig();
9
+ return {
10
+ routes: baseConfig.routes ?? []
11
+ };
12
+ };
13
+ export const RouterConfig = Object.assign(base.Config, {
14
+ Route,
15
+ useRouterConfig
16
+ });
17
+
18
+ //# sourceMappingURL=RouterConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createConfigurableComponent","Route","base","RouterWithConfig","Object","assign","WithConfig","displayName","useRouterConfig","baseConfig","useConfig","routes","RouterConfig","Config"],"sources":["RouterConfig.tsx"],"sourcesContent":["import { createConfigurableComponent } from \"@webiny/react-properties\";\nimport { Route, type RouteConfig } from \"./RouterConfig/Route.js\";\n\nconst base = createConfigurableComponent<RouterConfig>(\"RouterConfig\");\n\nexport const RouterWithConfig = Object.assign(base.WithConfig, {\n displayName: \"RouterWithConfig\"\n});\n\ninterface RouterConfig {\n routes: RouteConfig[];\n}\n\nexport const useRouterConfig = () => {\n const baseConfig = base.useConfig();\n\n return {\n routes: baseConfig.routes ?? []\n };\n};\n\nexport const RouterConfig = Object.assign(base.Config, {\n Route,\n useRouterConfig\n});\n"],"mappings":"AAAA,SAASA,2BAA2B,QAAQ,0BAA0B;AACtE,SAASC,KAAK;AAEd,MAAMC,IAAI,GAAGF,2BAA2B,CAAe,cAAc,CAAC;AAEtE,OAAO,MAAMG,gBAAgB,GAAGC,MAAM,CAACC,MAAM,CAACH,IAAI,CAACI,UAAU,EAAE;EAC3DC,WAAW,EAAE;AACjB,CAAC,CAAC;AAMF,OAAO,MAAMC,eAAe,GAAGA,CAAA,KAAM;EACjC,MAAMC,UAAU,GAAGP,IAAI,CAACQ,SAAS,CAAC,CAAC;EAEnC,OAAO;IACHC,MAAM,EAAEF,UAAU,CAACE,MAAM,IAAI;EACjC,CAAC;AACL,CAAC;AAED,OAAO,MAAMC,YAAY,GAAGR,MAAM,CAACC,MAAM,CAACH,IAAI,CAACW,MAAM,EAAE;EACnDZ,KAAK;EACLO;AACJ,CAAC,CAAC","ignoreList":[]}
package/config.js CHANGED
@@ -1,31 +1,25 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.config = void 0;
7
- var _deepFreeze = function deepFreeze(obj) {
8
- Object.keys(obj).forEach(function (prop) {
1
+ const deepFreeze = obj => {
2
+ Object.keys(obj).forEach(prop => {
9
3
  if (typeof obj[prop] === "object" && !Object.isFrozen(obj[prop])) {
10
- _deepFreeze(obj[prop]);
4
+ deepFreeze(obj[prop]);
11
5
  }
12
6
  });
13
7
  return Object.freeze(obj);
14
8
  };
15
9
  function createConfig() {
16
- var _config = {};
10
+ let _config = {};
17
11
  return {
18
- set: function set(config) {
19
- _config = _deepFreeze(config);
12
+ set(config) {
13
+ _config = deepFreeze(config);
20
14
  },
21
- get: function get() {
15
+ get() {
22
16
  return _config;
23
17
  },
24
- getKey: function getKey(key, defaultValue) {
18
+ getKey(key, defaultValue) {
25
19
  return key in _config ? _config[key] : defaultValue;
26
20
  }
27
21
  };
28
22
  }
29
- var config = exports.config = createConfig();
23
+ export const config = createConfig();
30
24
 
31
25
  //# sourceMappingURL=config.js.map
package/config.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["deepFreeze","obj","Object","keys","forEach","prop","isFrozen","freeze","createConfig","_config","set","config","get","getKey","key","defaultValue","exports"],"sources":["config.ts"],"sourcesContent":["export type Config = Record<string, any>;\n\ninterface AppConfig {\n set(config: Config): void;\n get(): Config;\n getKey<T = string>(key: string, defaultValue: T): T;\n}\n\nconst deepFreeze = (obj: Record<string, any>): Record<string, any> => {\n Object.keys(obj).forEach(prop => {\n if (typeof obj[prop] === \"object\" && !Object.isFrozen(obj[prop])) {\n deepFreeze(obj[prop]);\n }\n });\n return Object.freeze(obj);\n};\n\nfunction createConfig(): AppConfig {\n let _config: Record<string, any> = {};\n\n return {\n set(config: Config) {\n _config = deepFreeze(config);\n },\n get() {\n return _config;\n },\n getKey(key, defaultValue) {\n return key in _config ? _config[key] : defaultValue;\n }\n };\n}\n\nexport const config = createConfig();\n"],"mappings":";;;;;;AAQA,IAAMA,WAAU,GAAG,SAAbA,UAAUA,CAAIC,GAAwB,EAA0B;EAClEC,MAAM,CAACC,IAAI,CAACF,GAAG,CAAC,CAACG,OAAO,CAAC,UAAAC,IAAI,EAAI;IAC7B,IAAI,OAAOJ,GAAG,CAACI,IAAI,CAAC,KAAK,QAAQ,IAAI,CAACH,MAAM,CAACI,QAAQ,CAACL,GAAG,CAACI,IAAI,CAAC,CAAC,EAAE;MAC9DL,WAAU,CAACC,GAAG,CAACI,IAAI,CAAC,CAAC;IACzB;EACJ,CAAC,CAAC;EACF,OAAOH,MAAM,CAACK,MAAM,CAACN,GAAG,CAAC;AAC7B,CAAC;AAED,SAASO,YAAYA,CAAA,EAAc;EAC/B,IAAIC,OAA4B,GAAG,CAAC,CAAC;EAErC,OAAO;IACHC,GAAG,WAAHA,GAAGA,CAACC,MAAc,EAAE;MAChBF,OAAO,GAAGT,WAAU,CAACW,MAAM,CAAC;IAChC,CAAC;IACDC,GAAG,WAAHA,GAAGA,CAAA,EAAG;MACF,OAAOH,OAAO;IAClB,CAAC;IACDI,MAAM,WAANA,MAAMA,CAACC,GAAG,EAAEC,YAAY,EAAE;MACtB,OAAOD,GAAG,IAAIL,OAAO,GAAGA,OAAO,CAACK,GAAG,CAAC,GAAGC,YAAY;IACvD;EACJ,CAAC;AACL;AAEO,IAAMJ,MAAM,GAAAK,OAAA,CAAAL,MAAA,GAAGH,YAAY,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["deepFreeze","obj","Object","keys","forEach","prop","isFrozen","freeze","createConfig","_config","set","config","get","getKey","key","defaultValue"],"sources":["config.ts"],"sourcesContent":["export type Config = Record<string, any>;\n\ninterface AppConfig {\n set(config: Config): void;\n get(): Config;\n getKey<T = string>(key: string, defaultValue: T): T;\n}\n\nconst deepFreeze = (obj: Record<string, any>): Record<string, any> => {\n Object.keys(obj).forEach(prop => {\n if (typeof obj[prop] === \"object\" && !Object.isFrozen(obj[prop])) {\n deepFreeze(obj[prop]);\n }\n });\n return Object.freeze(obj);\n};\n\nfunction createConfig(): AppConfig {\n let _config: Record<string, any> = {};\n\n return {\n set(config: Config) {\n _config = deepFreeze(config);\n },\n get() {\n return _config;\n },\n getKey(key, defaultValue) {\n return key in _config ? _config[key] : defaultValue;\n }\n };\n}\n\nexport const config = createConfig();\n"],"mappings":"AAQA,MAAMA,UAAU,GAAIC,GAAwB,IAA0B;EAClEC,MAAM,CAACC,IAAI,CAACF,GAAG,CAAC,CAACG,OAAO,CAACC,IAAI,IAAI;IAC7B,IAAI,OAAOJ,GAAG,CAACI,IAAI,CAAC,KAAK,QAAQ,IAAI,CAACH,MAAM,CAACI,QAAQ,CAACL,GAAG,CAACI,IAAI,CAAC,CAAC,EAAE;MAC9DL,UAAU,CAACC,GAAG,CAACI,IAAI,CAAC,CAAC;IACzB;EACJ,CAAC,CAAC;EACF,OAAOH,MAAM,CAACK,MAAM,CAACN,GAAG,CAAC;AAC7B,CAAC;AAED,SAASO,YAAYA,CAAA,EAAc;EAC/B,IAAIC,OAA4B,GAAG,CAAC,CAAC;EAErC,OAAO;IACHC,GAAGA,CAACC,MAAc,EAAE;MAChBF,OAAO,GAAGT,UAAU,CAACW,MAAM,CAAC;IAChC,CAAC;IACDC,GAAGA,CAAA,EAAG;MACF,OAAOH,OAAO;IAClB,CAAC;IACDI,MAAMA,CAACC,GAAG,EAAEC,YAAY,EAAE;MACtB,OAAOD,GAAG,IAAIL,OAAO,GAAGA,OAAO,CAACK,GAAG,CAAC,GAAGC,YAAY;IACvD;EACJ,CAAC;AACL;AAEA,OAAO,MAAMJ,MAAM,GAAGH,YAAY,CAAC,CAAC","ignoreList":[]}
@@ -1,56 +1,32 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.UiProvider = exports.UiContext = 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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
- var _react = _interopRequireDefault(require("react"));
15
- var _plugins = require("@webiny/plugins");
16
- var UiContext = exports.UiContext = /*#__PURE__*/_react.default.createContext({});
17
- var UiProvider = exports.UiProvider = /*#__PURE__*/function (_React$Component) {
18
- function UiProvider() {
19
- var _this;
20
- (0, _classCallCheck2.default)(this, UiProvider);
21
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
22
- args[_key] = arguments[_key];
23
- }
24
- _this = (0, _callSuper2.default)(this, UiProvider, [].concat(args));
25
- (0, _defineProperty2.default)(_this, "state", {
26
- ui: {}
27
- });
28
- (0, _defineProperty2.default)(_this, "setData", function (setter) {
29
- return _this.setState(function (state) {
30
- return {
31
- ui: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state.ui), setter(state.ui))
32
- };
33
- });
1
+ import React from "react";
2
+ import { plugins } from "@webiny/plugins";
3
+ export const UiContext = /*#__PURE__*/React.createContext({});
4
+ export class UiProvider extends React.Component {
5
+ state = {
6
+ ui: {}
7
+ };
8
+ setData = setter => {
9
+ return this.setState(state => {
10
+ return {
11
+ ui: {
12
+ ...state.ui,
13
+ ...setter(state.ui)
14
+ }
15
+ };
34
16
  });
35
- return _this;
17
+ };
18
+ render() {
19
+ const value = {
20
+ ...this.state.ui,
21
+ setState: this.setData
22
+ };
23
+ const uiStatePlugins = plugins.byType("ui-state");
24
+ return /*#__PURE__*/React.createElement(UiContext.Provider, {
25
+ value: value
26
+ }, uiStatePlugins.map(pl => /*#__PURE__*/React.cloneElement(pl.render(), {
27
+ key: pl.name
28
+ })), this.props.children);
36
29
  }
37
- (0, _inherits2.default)(UiProvider, _React$Component);
38
- return (0, _createClass2.default)(UiProvider, [{
39
- key: "render",
40
- value: function render() {
41
- var value = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, this.state.ui), {}, {
42
- setState: this.setData
43
- });
44
- var uiStatePlugins = _plugins.plugins.byType("ui-state");
45
- return /*#__PURE__*/_react.default.createElement(UiContext.Provider, {
46
- value: value
47
- }, uiStatePlugins.map(function (pl) {
48
- return /*#__PURE__*/_react.default.cloneElement(pl.render(), {
49
- key: pl.name
50
- });
51
- }), this.props.children);
52
- }
53
- }]);
54
- }(_react.default.Component);
30
+ }
55
31
 
56
32
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_plugins","UiContext","exports","React","createContext","UiProvider","_React$Component","_this","_classCallCheck2","default","_len","arguments","length","args","Array","_key","_callSuper2","concat","_defineProperty2","ui","setter","setState","state","_objectSpread2","_inherits2","_createClass2","key","value","render","setData","uiStatePlugins","plugins","byType","createElement","Provider","map","pl","cloneElement","name","props","children","Component"],"sources":["index.tsx"],"sourcesContent":["import React from \"react\";\nimport { UiStatePlugin } from \"~/types\";\nimport { plugins } from \"@webiny/plugins\";\n\nexport const UiContext = React.createContext<Record<string, any>>({});\n\ntype Props = Record<string, any>;\n\ntype State = {\n ui: { [key: string]: any };\n};\n\ninterface UiData {\n [key: string]: any;\n}\n\ninterface UiDataSetter {\n (ui: UiData): UiData;\n}\n\nexport interface UiContextValue {\n setState: (setter: UiDataSetter) => void;\n [key: string]: any;\n}\n\nexport class UiProvider extends React.Component<Props, State> {\n public override state: State = {\n ui: {}\n };\n\n private readonly setData = (setter: UiDataSetter): void => {\n return this.setState((state: State) => {\n return { ui: { ...state.ui, ...setter(state.ui) } };\n });\n };\n\n public override render() {\n const value: UiContextValue = { ...this.state.ui, setState: this.setData };\n const uiStatePlugins = plugins.byType<UiStatePlugin>(\"ui-state\");\n return (\n <UiContext.Provider value={value}>\n {uiStatePlugins.map(pl => React.cloneElement(pl.render(), { key: pl.name }))}\n {this.props.children}\n </UiContext.Provider>\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAEO,IAAME,SAAS,GAAAC,OAAA,CAAAD,SAAA,gBAAGE,cAAK,CAACC,aAAa,CAAsB,CAAC,CAAC,CAAC;AAAC,IAqBzDC,UAAU,GAAAH,OAAA,CAAAG,UAAA,0BAAAC,gBAAA;EAAA,SAAAD,WAAA;IAAA,IAAAE,KAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,QAAAJ,UAAA;IAAA,SAAAK,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IAAA;IAAAR,KAAA,OAAAS,WAAA,CAAAP,OAAA,QAAAJ,UAAA,KAAAY,MAAA,CAAAJ,IAAA;IAAA,IAAAK,gBAAA,CAAAT,OAAA,EAAAF,KAAA,WACY;MAC3BY,EAAE,EAAE,CAAC;IACT,CAAC;IAAA,IAAAD,gBAAA,CAAAT,OAAA,EAAAF,KAAA,aAE0B,UAACa,MAAoB,EAAW;MACvD,OAAOb,KAAA,CAAKc,QAAQ,CAAC,UAACC,KAAY,EAAK;QACnC,OAAO;UAAEH,EAAE,MAAAI,cAAA,CAAAd,OAAA,MAAAc,cAAA,CAAAd,OAAA,MAAOa,KAAK,CAACH,EAAE,GAAKC,MAAM,CAACE,KAAK,CAACH,EAAE,CAAC;QAAG,CAAC;MACvD,CAAC,CAAC;IACN,CAAC;IAAA,OAAAZ,KAAA;EAAA;EAAA,IAAAiB,UAAA,CAAAf,OAAA,EAAAJ,UAAA,EAAAC,gBAAA;EAAA,WAAAmB,aAAA,CAAAhB,OAAA,EAAAJ,UAAA;IAAAqB,GAAA;IAAAC,KAAA,EAED,SAAgBC,MAAMA,CAAA,EAAG;MACrB,IAAMD,KAAqB,OAAAJ,cAAA,CAAAd,OAAA,MAAAc,cAAA,CAAAd,OAAA,MAAQ,IAAI,CAACa,KAAK,CAACH,EAAE;QAAEE,QAAQ,EAAE,IAAI,CAACQ;MAAO,EAAE;MAC1E,IAAMC,cAAc,GAAGC,gBAAO,CAACC,MAAM,CAAgB,UAAU,CAAC;MAChE,oBACInC,MAAA,CAAAY,OAAA,CAAAwB,aAAA,CAAChC,SAAS,CAACiC,QAAQ;QAACP,KAAK,EAAEA;MAAM,GAC5BG,cAAc,CAACK,GAAG,CAAC,UAAAC,EAAE;QAAA,oBAAIjC,cAAK,CAACkC,YAAY,CAACD,EAAE,CAACR,MAAM,CAAC,CAAC,EAAE;UAAEF,GAAG,EAAEU,EAAE,CAACE;QAAK,CAAC,CAAC;MAAA,EAAC,EAC3E,IAAI,CAACC,KAAK,CAACC,QACI,CAAC;IAE7B;EAAC;AAAA,EApB2BrC,cAAK,CAACsC,SAAS","ignoreList":[]}
1
+ {"version":3,"names":["React","plugins","UiContext","createContext","UiProvider","Component","state","ui","setData","setter","setState","render","value","uiStatePlugins","byType","createElement","Provider","map","pl","cloneElement","key","name","props","children"],"sources":["index.tsx"],"sourcesContent":["import React from \"react\";\nimport type { UiStatePlugin } from \"~/types.js\";\nimport { plugins } from \"@webiny/plugins\";\n\nexport const UiContext = React.createContext<Record<string, any>>({});\n\ntype Props = Record<string, any>;\n\ntype State = {\n ui: { [key: string]: any };\n};\n\ninterface UiData {\n [key: string]: any;\n}\n\ninterface UiDataSetter {\n (ui: UiData): UiData;\n}\n\nexport interface UiContextValue {\n setState: (setter: UiDataSetter) => void;\n [key: string]: any;\n}\n\nexport class UiProvider extends React.Component<Props, State> {\n public override state: State = {\n ui: {}\n };\n\n private readonly setData = (setter: UiDataSetter): void => {\n return this.setState((state: State) => {\n return { ui: { ...state.ui, ...setter(state.ui) } };\n });\n };\n\n public override render() {\n const value: UiContextValue = { ...this.state.ui, setState: this.setData };\n const uiStatePlugins = plugins.byType<UiStatePlugin>(\"ui-state\");\n return (\n <UiContext.Provider value={value}>\n {uiStatePlugins.map(pl => React.cloneElement(pl.render(), { key: pl.name }))}\n {this.props.children}\n </UiContext.Provider>\n );\n }\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,OAAO,QAAQ,iBAAiB;AAEzC,OAAO,MAAMC,SAAS,gBAAGF,KAAK,CAACG,aAAa,CAAsB,CAAC,CAAC,CAAC;AAqBrE,OAAO,MAAMC,UAAU,SAASJ,KAAK,CAACK,SAAS,CAAe;EAC1CC,KAAK,GAAU;IAC3BC,EAAE,EAAE,CAAC;EACT,CAAC;EAEgBC,OAAO,GAAIC,MAAoB,IAAW;IACvD,OAAO,IAAI,CAACC,QAAQ,CAAEJ,KAAY,IAAK;MACnC,OAAO;QAAEC,EAAE,EAAE;UAAE,GAAGD,KAAK,CAACC,EAAE;UAAE,GAAGE,MAAM,CAACH,KAAK,CAACC,EAAE;QAAE;MAAE,CAAC;IACvD,CAAC,CAAC;EACN,CAAC;EAEeI,MAAMA,CAAA,EAAG;IACrB,MAAMC,KAAqB,GAAG;MAAE,GAAG,IAAI,CAACN,KAAK,CAACC,EAAE;MAAEG,QAAQ,EAAE,IAAI,CAACF;IAAQ,CAAC;IAC1E,MAAMK,cAAc,GAAGZ,OAAO,CAACa,MAAM,CAAgB,UAAU,CAAC;IAChE,oBACId,KAAA,CAAAe,aAAA,CAACb,SAAS,CAACc,QAAQ;MAACJ,KAAK,EAAEA;IAAM,GAC5BC,cAAc,CAACI,GAAG,CAACC,EAAE,iBAAIlB,KAAK,CAACmB,YAAY,CAACD,EAAE,CAACP,MAAM,CAAC,CAAC,EAAE;MAAES,GAAG,EAAEF,EAAE,CAACG;IAAK,CAAC,CAAC,CAAC,EAC3E,IAAI,CAACC,KAAK,CAACC,QACI,CAAC;EAE7B;AACJ","ignoreList":[]}
@@ -1,42 +1,31 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.DebounceRender = void 0;
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _react = _interopRequireWildcard(require("react"));
11
- var _debounce = _interopRequireDefault(require("lodash/debounce"));
1
+ import React from "react";
2
+ import { useEffect, useMemo, useState } from "react";
3
+ import debounce from "lodash/debounce.js";
12
4
  /**
13
5
  * We need to debounce the rendering of children during app bootstrap, since many plugins
14
6
  * can add more and more Providers which will recompose the entire hierarchy of React Context providers.
15
7
  * During this stage, we don't want to render anything.
16
8
  */
17
- var DebounceRender = exports.DebounceRender = function DebounceRender(_ref) {
18
- var _ref$wait = _ref.wait,
19
- wait = _ref$wait === void 0 ? 50 : _ref$wait,
20
- children = _ref.children;
21
- var _useState = (0, _react.useState)(wait === 0),
22
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
23
- render = _useState2[0],
24
- setRender = _useState2[1];
25
- var debouncedRender = (0, _react.useMemo)(function () {
26
- return (0, _debounce.default)(function () {
9
+ export const DebounceRender = ({
10
+ wait = 50,
11
+ children
12
+ }) => {
13
+ const [render, setRender] = useState(wait === 0);
14
+ const debouncedRender = useMemo(() => {
15
+ return debounce(() => {
27
16
  setRender(true);
28
17
  }, wait);
29
18
  }, [setRender]);
30
- (0, _react.useEffect)(function () {
19
+ useEffect(() => {
31
20
  if (render) {
32
21
  return;
33
22
  }
34
23
  debouncedRender();
35
- return function () {
24
+ return () => {
36
25
  debouncedRender.cancel();
37
26
  };
38
27
  }, []);
39
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, render ? children : null);
28
+ return /*#__PURE__*/React.createElement(React.Fragment, null, render ? children : null);
40
29
  };
41
30
 
42
31
  //# sourceMappingURL=DebounceRender.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_debounce","_interopRequireDefault","DebounceRender","exports","_ref","_ref$wait","wait","children","_useState","useState","_useState2","_slicedToArray2","default","render","setRender","debouncedRender","useMemo","debounce","useEffect","cancel","createElement","Fragment"],"sources":["DebounceRender.tsx"],"sourcesContent":["import React from \"react\";\nimport { useEffect, useMemo, useState } from \"react\";\nimport debounce from \"lodash/debounce\";\n\ninterface Props {\n wait?: number;\n children?: React.ReactNode;\n}\n/**\n * We need to debounce the rendering of children during app bootstrap, since many plugins\n * can add more and more Providers which will recompose the entire hierarchy of React Context providers.\n * During this stage, we don't want to render anything.\n */\nexport const DebounceRender = ({ wait = 50, children }: Props) => {\n const [render, setRender] = useState(wait === 0);\n\n const debouncedRender = useMemo(() => {\n return debounce(() => {\n setRender(true);\n }, wait);\n }, [setRender]);\n\n useEffect(() => {\n if (render) {\n return;\n }\n\n debouncedRender();\n\n return () => {\n debouncedRender.cancel();\n };\n }, []);\n\n return <>{render ? children : null}</>;\n};\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AAMA;AACA;AACA;AACA;AACA;AACO,IAAMG,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,SAAjBA,cAAcA,CAAAE,IAAA,EAAuC;EAAA,IAAAC,SAAA,GAAAD,IAAA,CAAjCE,IAAI;IAAJA,IAAI,GAAAD,SAAA,cAAG,EAAE,GAAAA,SAAA;IAAEE,QAAQ,GAAAH,IAAA,CAARG,QAAQ;EAChD,IAAAC,SAAA,GAA4B,IAAAC,eAAQ,EAACH,IAAI,KAAK,CAAC,CAAC;IAAAI,UAAA,OAAAC,eAAA,CAAAC,OAAA,EAAAJ,SAAA;IAAzCK,MAAM,GAAAH,UAAA;IAAEI,SAAS,GAAAJ,UAAA;EAExB,IAAMK,eAAe,GAAG,IAAAC,cAAO,EAAC,YAAM;IAClC,OAAO,IAAAC,iBAAQ,EAAC,YAAM;MAClBH,SAAS,CAAC,IAAI,CAAC;IACnB,CAAC,EAAER,IAAI,CAAC;EACZ,CAAC,EAAE,CAACQ,SAAS,CAAC,CAAC;EAEf,IAAAI,gBAAS,EAAC,YAAM;IACZ,IAAIL,MAAM,EAAE;MACR;IACJ;IAEAE,eAAe,CAAC,CAAC;IAEjB,OAAO,YAAM;MACTA,eAAe,CAACI,MAAM,CAAC,CAAC;IAC5B,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,oBAAOtB,MAAA,CAAAe,OAAA,CAAAQ,aAAA,CAAAvB,MAAA,CAAAe,OAAA,CAAAS,QAAA,QAAGR,MAAM,GAAGN,QAAQ,GAAG,IAAO,CAAC;AAC1C,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useEffect","useMemo","useState","debounce","DebounceRender","wait","children","render","setRender","debouncedRender","cancel","createElement","Fragment"],"sources":["DebounceRender.tsx"],"sourcesContent":["import React from \"react\";\nimport { useEffect, useMemo, useState } from \"react\";\nimport debounce from \"lodash/debounce.js\";\n\ninterface Props {\n wait?: number;\n children?: React.ReactNode;\n}\n/**\n * We need to debounce the rendering of children during app bootstrap, since many plugins\n * can add more and more Providers which will recompose the entire hierarchy of React Context providers.\n * During this stage, we don't want to render anything.\n */\nexport const DebounceRender = ({ wait = 50, children }: Props) => {\n const [render, setRender] = useState(wait === 0);\n\n const debouncedRender = useMemo(() => {\n return debounce(() => {\n setRender(true);\n }, wait);\n }, [setRender]);\n\n useEffect(() => {\n if (render) {\n return;\n }\n\n debouncedRender();\n\n return () => {\n debouncedRender.cancel();\n };\n }, []);\n\n return <>{render ? children : null}</>;\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AACpD,OAAOC,QAAQ,MAAM,oBAAoB;AAMzC;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GAAGA,CAAC;EAAEC,IAAI,GAAG,EAAE;EAAEC;AAAgB,CAAC,KAAK;EAC9D,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAGN,QAAQ,CAACG,IAAI,KAAK,CAAC,CAAC;EAEhD,MAAMI,eAAe,GAAGR,OAAO,CAAC,MAAM;IAClC,OAAOE,QAAQ,CAAC,MAAM;MAClBK,SAAS,CAAC,IAAI,CAAC;IACnB,CAAC,EAAEH,IAAI,CAAC;EACZ,CAAC,EAAE,CAACG,SAAS,CAAC,CAAC;EAEfR,SAAS,CAAC,MAAM;IACZ,IAAIO,MAAM,EAAE;MACR;IACJ;IAEAE,eAAe,CAAC,CAAC;IAEjB,OAAO,MAAM;MACTA,eAAe,CAACC,MAAM,CAAC,CAAC;IAC5B,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,oBAAOX,KAAA,CAAAY,aAAA,CAAAZ,KAAA,CAAAa,QAAA,QAAGL,MAAM,GAAGD,QAAQ,GAAG,IAAO,CAAC;AAC1C,CAAC","ignoreList":[]}
package/core/Plugin.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { GenericComponent, Decorator } from "@webiny/react-composition";
2
+ import type { GenericComponent, Decorator } from "@webiny/react-composition";
3
3
  interface PluginProps {
4
4
  providers?: Decorator<GenericComponent>[];
5
5
  children?: React.ReactNode;
package/core/Plugin.js CHANGED
@@ -1,22 +1,14 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.Plugin = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _Provider = require("./Provider");
10
- var _Plugins = require("./Plugins");
11
- var Plugin = exports.Plugin = /*#__PURE__*/_react.default.memo(function Plugin(_ref) {
12
- var providers = _ref.providers,
13
- children = _ref.children;
14
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (providers || []).map(function (provider, index) {
15
- return /*#__PURE__*/_react.default.createElement(_Provider.Provider, {
16
- key: index,
17
- hoc: provider
18
- });
19
- }), children ? /*#__PURE__*/_react.default.createElement(_Plugins.Plugins, null, children) : null);
1
+ import React from "react";
2
+ import { Provider } from "./Provider.js";
3
+ import { Plugins } from "./Plugins.js";
4
+ export const Plugin = /*#__PURE__*/React.memo(function Plugin({
5
+ providers,
6
+ children
7
+ }) {
8
+ return /*#__PURE__*/React.createElement(React.Fragment, null, (providers || []).map((provider, index) => /*#__PURE__*/React.createElement(Provider, {
9
+ key: index,
10
+ hoc: provider
11
+ })), children ? /*#__PURE__*/React.createElement(Plugins, null, children) : null);
20
12
  });
21
13
 
22
14
  //# sourceMappingURL=Plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_Provider","_Plugins","Plugin","exports","React","memo","_ref","providers","children","default","createElement","Fragment","map","provider","index","Provider","key","hoc","Plugins"],"sources":["Plugin.tsx"],"sourcesContent":["import React from \"react\";\nimport { Provider } from \"./Provider\";\nimport { Plugins } from \"./Plugins\";\nimport { GenericComponent, Decorator } from \"@webiny/react-composition\";\n\ninterface PluginProps {\n providers?: Decorator<GenericComponent>[];\n children?: React.ReactNode;\n}\n\nexport const Plugin = React.memo(function Plugin({ providers, children }: PluginProps) {\n return (\n <>\n {(providers || []).map((provider, index) => (\n <Provider key={index} hoc={provider} />\n ))}\n {children ? <Plugins>{children}</Plugins> : null}\n </>\n );\n});\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAQO,IAAMG,MAAM,GAAAC,OAAA,CAAAD,MAAA,gBAAGE,cAAK,CAACC,IAAI,CAAC,SAASH,MAAMA,CAAAI,IAAA,EAAuC;EAAA,IAApCC,SAAS,GAAAD,IAAA,CAATC,SAAS;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;EAClE,oBACIX,MAAA,CAAAY,OAAA,CAAAC,aAAA,CAAAb,MAAA,CAAAY,OAAA,CAAAE,QAAA,QACK,CAACJ,SAAS,IAAI,EAAE,EAAEK,GAAG,CAAC,UAACC,QAAQ,EAAEC,KAAK;IAAA,oBACnCjB,MAAA,CAAAY,OAAA,CAAAC,aAAA,CAACV,SAAA,CAAAe,QAAQ;MAACC,GAAG,EAAEF,KAAM;MAACG,GAAG,EAAEJ;IAAS,CAAE,CAAC;EAAA,CAC1C,CAAC,EACDL,QAAQ,gBAAGX,MAAA,CAAAY,OAAA,CAAAC,aAAA,CAACT,QAAA,CAAAiB,OAAO,QAAEV,QAAkB,CAAC,GAAG,IAC9C,CAAC;AAEX,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","Provider","Plugins","Plugin","memo","providers","children","createElement","Fragment","map","provider","index","key","hoc"],"sources":["Plugin.tsx"],"sourcesContent":["import React from \"react\";\nimport { Provider } from \"./Provider.js\";\nimport { Plugins } from \"./Plugins.js\";\nimport type { GenericComponent, Decorator } from \"@webiny/react-composition\";\n\ninterface PluginProps {\n providers?: Decorator<GenericComponent>[];\n children?: React.ReactNode;\n}\n\nexport const Plugin = React.memo(function Plugin({ providers, children }: PluginProps) {\n return (\n <>\n {(providers || []).map((provider, index) => (\n <Provider key={index} hoc={provider} />\n ))}\n {children ? <Plugins>{children}</Plugins> : null}\n </>\n );\n});\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ;AACjB,SAASC,OAAO;AAQhB,OAAO,MAAMC,MAAM,gBAAGH,KAAK,CAACI,IAAI,CAAC,SAASD,MAAMA,CAAC;EAAEE,SAAS;EAAEC;AAAsB,CAAC,EAAE;EACnF,oBACIN,KAAA,CAAAO,aAAA,CAAAP,KAAA,CAAAQ,QAAA,QACK,CAACH,SAAS,IAAI,EAAE,EAAEI,GAAG,CAAC,CAACC,QAAQ,EAAEC,KAAK,kBACnCX,KAAA,CAAAO,aAAA,CAACN,QAAQ;IAACW,GAAG,EAAED,KAAM;IAACE,GAAG,EAAEH;EAAS,CAAE,CACzC,CAAC,EACDJ,QAAQ,gBAAGN,KAAA,CAAAO,aAAA,CAACL,OAAO,QAAEI,QAAkB,CAAC,GAAG,IAC9C,CAAC;AAEX,CAAC,CAAC","ignoreList":[]}
package/core/Plugins.d.ts CHANGED
@@ -11,5 +11,5 @@ export declare const PluginsProvider: React.MemoExoticComponent<({ children }: P
11
11
  interface PluginsComponentsProps {
12
12
  children: React.ReactNode;
13
13
  }
14
- export declare const Plugins: ({ children }: PluginsComponentsProps) => React.JSX.Element | null;
14
+ export declare const Plugins: React.MemoExoticComponent<({ children }: PluginsComponentsProps) => React.JSX.Element | null>;
15
15
  export {};
package/core/Plugins.js CHANGED
@@ -1,45 +1,40 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.PluginsProvider = exports.PluginsContext = exports.Plugins = void 0;
8
- var _react = _interopRequireWildcard(require("react"));
9
- var _App = require("../App");
10
- var PluginsContext = exports.PluginsContext = /*#__PURE__*/(0, _react.createContext)(false);
1
+ import React, { Children, createContext, Fragment, memo, useContext, useEffect } from "react";
2
+ import { useApp } from "../App.js";
3
+ export const PluginsContext = /*#__PURE__*/createContext(false);
11
4
  PluginsContext.displayName = "PluginsContext";
12
- var PluginsProviderComponent = function PluginsProviderComponent(_ref) {
13
- var children = _ref.children;
5
+ const PluginsProviderComponent = ({
6
+ children
7
+ }) => {
14
8
  /**
15
9
  * This context only serves as a safeguard. We need to warn users when they mount a plugin without using
16
10
  * the <Plugins> component. In that case, the context will not be available, and we can log warnings.
17
11
  */
18
- return /*#__PURE__*/_react.default.createElement(PluginsContext.Provider, {
12
+ return /*#__PURE__*/React.createElement(PluginsContext.Provider, {
19
13
  value: true
20
14
  }, children);
21
15
  };
22
- var PluginsProvider = exports.PluginsProvider = /*#__PURE__*/(0, _react.memo)(PluginsProviderComponent);
16
+ export const PluginsProvider = /*#__PURE__*/memo(PluginsProviderComponent);
23
17
 
24
18
  /**
25
19
  * @param children
26
20
  * @deprecated This component should not be used directly. Use the <Plugin> component to create plugins.
27
21
  */
28
22
 
29
- var Plugins = exports.Plugins = function Plugins(_ref2) {
30
- var children = _ref2.children;
31
- var _useApp = (0, _App.useApp)(),
32
- addPlugin = _useApp.addPlugin;
33
- var hasParentPlugin = (0, _react.useContext)(PluginsContext);
34
- (0, _react.useEffect)(function () {
23
+ export const Plugins = /*#__PURE__*/React.memo(({
24
+ children
25
+ }) => {
26
+ const {
27
+ addPlugin
28
+ } = useApp();
29
+ const hasParentPlugin = useContext(PluginsContext);
30
+ useEffect(() => {
35
31
  if (hasParentPlugin) {
36
32
  return;
37
33
  }
38
- _react.Children.forEach(children, function (child) {
39
- return addPlugin(child);
40
- });
34
+ Children.forEach(children, child => addPlugin(child));
41
35
  }, []);
42
- return hasParentPlugin ? /*#__PURE__*/_react.default.createElement(_react.Fragment, null, children) : null;
43
- };
36
+ return hasParentPlugin ? /*#__PURE__*/React.createElement(Fragment, null, children) : null;
37
+ });
38
+ Plugins.displayName = "Plugins";
44
39
 
45
40
  //# sourceMappingURL=Plugins.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_App","PluginsContext","exports","createContext","displayName","PluginsProviderComponent","_ref","children","default","createElement","Provider","value","PluginsProvider","memo","Plugins","_ref2","_useApp","useApp","addPlugin","hasParentPlugin","useContext","useEffect","Children","forEach","child","Fragment"],"sources":["Plugins.tsx"],"sourcesContent":["import React, { Fragment, Children, createContext, useContext, useEffect, memo } from \"react\";\nimport { useApp } from \"~/App\";\n\nexport const PluginsContext = createContext<boolean>(false);\nPluginsContext.displayName = \"PluginsContext\";\n\ninterface PluginsProviderComponentProps {\n children: JSX.Element[];\n}\nconst PluginsProviderComponent = ({ children }: PluginsProviderComponentProps) => {\n /**\n * This context only serves as a safeguard. We need to warn users when they mount a plugin without using\n * the <Plugins> component. In that case, the context will not be available, and we can log warnings.\n */\n return <PluginsContext.Provider value={true}>{children}</PluginsContext.Provider>;\n};\n\nexport const PluginsProvider = memo(PluginsProviderComponent);\n\n/**\n * @param children\n * @deprecated This component should not be used directly. Use the <Plugin> component to create plugins.\n */\ninterface PluginsComponentsProps {\n children: React.ReactNode;\n}\nexport const Plugins = ({ children }: PluginsComponentsProps) => {\n const { addPlugin } = useApp();\n const hasParentPlugin = useContext(PluginsContext);\n\n useEffect(() => {\n if (hasParentPlugin) {\n return;\n }\n\n Children.forEach(children, child => addPlugin(child));\n }, []);\n\n return hasParentPlugin ? <Fragment>{children}</Fragment> : null;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAEO,IAAME,cAAc,GAAAC,OAAA,CAAAD,cAAA,gBAAG,IAAAE,oBAAa,EAAU,KAAK,CAAC;AAC3DF,cAAc,CAACG,WAAW,GAAG,gBAAgB;AAK7C,IAAMC,wBAAwB,GAAG,SAA3BA,wBAAwBA,CAAAC,IAAA,EAAoD;EAAA,IAA9CC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;EACxC;AACJ;AACA;AACA;EACI,oBAAOV,MAAA,CAAAW,OAAA,CAAAC,aAAA,CAACR,cAAc,CAACS,QAAQ;IAACC,KAAK,EAAE;EAAK,GAAEJ,QAAkC,CAAC;AACrF,CAAC;AAEM,IAAMK,eAAe,GAAAV,OAAA,CAAAU,eAAA,gBAAG,IAAAC,WAAI,EAACR,wBAAwB,CAAC;;AAE7D;AACA;AACA;AACA;;AAIO,IAAMS,OAAO,GAAAZ,OAAA,CAAAY,OAAA,GAAG,SAAVA,OAAOA,CAAAC,KAAA,EAA6C;EAAA,IAAvCR,QAAQ,GAAAQ,KAAA,CAARR,QAAQ;EAC9B,IAAAS,OAAA,GAAsB,IAAAC,WAAM,EAAC,CAAC;IAAtBC,SAAS,GAAAF,OAAA,CAATE,SAAS;EACjB,IAAMC,eAAe,GAAG,IAAAC,iBAAU,EAACnB,cAAc,CAAC;EAElD,IAAAoB,gBAAS,EAAC,YAAM;IACZ,IAAIF,eAAe,EAAE;MACjB;IACJ;IAEAG,eAAQ,CAACC,OAAO,CAAChB,QAAQ,EAAE,UAAAiB,KAAK;MAAA,OAAIN,SAAS,CAACM,KAAK,CAAC;IAAA,EAAC;EACzD,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOL,eAAe,gBAAGtB,MAAA,CAAAW,OAAA,CAAAC,aAAA,CAACZ,MAAA,CAAA4B,QAAQ,QAAElB,QAAmB,CAAC,GAAG,IAAI;AACnE,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","Children","createContext","Fragment","memo","useContext","useEffect","useApp","PluginsContext","displayName","PluginsProviderComponent","children","createElement","Provider","value","PluginsProvider","Plugins","addPlugin","hasParentPlugin","forEach","child"],"sources":["Plugins.tsx"],"sourcesContent":["import React, { Children, createContext, Fragment, memo, useContext, useEffect } from \"react\";\nimport { useApp } from \"~/App.js\";\n\nexport const PluginsContext = createContext<boolean>(false);\nPluginsContext.displayName = \"PluginsContext\";\n\ninterface PluginsProviderComponentProps {\n children: JSX.Element[];\n}\nconst PluginsProviderComponent = ({ children }: PluginsProviderComponentProps) => {\n /**\n * This context only serves as a safeguard. We need to warn users when they mount a plugin without using\n * the <Plugins> component. In that case, the context will not be available, and we can log warnings.\n */\n return <PluginsContext.Provider value={true}>{children}</PluginsContext.Provider>;\n};\n\nexport const PluginsProvider = memo(PluginsProviderComponent);\n\n/**\n * @param children\n * @deprecated This component should not be used directly. Use the <Plugin> component to create plugins.\n */\ninterface PluginsComponentsProps {\n children: React.ReactNode;\n}\nexport const Plugins = React.memo(({ children }: PluginsComponentsProps) => {\n const { addPlugin } = useApp();\n const hasParentPlugin = useContext(PluginsContext);\n\n useEffect(() => {\n if (hasParentPlugin) {\n return;\n }\n\n Children.forEach(children, child => addPlugin(child));\n }, []);\n\n return hasParentPlugin ? <Fragment>{children}</Fragment> : null;\n});\n\nPlugins.displayName = \"Plugins\";\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,aAAa,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,UAAU,EAAEC,SAAS,QAAQ,OAAO;AAC7F,SAASC,MAAM;AAEf,OAAO,MAAMC,cAAc,gBAAGN,aAAa,CAAU,KAAK,CAAC;AAC3DM,cAAc,CAACC,WAAW,GAAG,gBAAgB;AAK7C,MAAMC,wBAAwB,GAAGA,CAAC;EAAEC;AAAwC,CAAC,KAAK;EAC9E;AACJ;AACA;AACA;EACI,oBAAOX,KAAA,CAAAY,aAAA,CAACJ,cAAc,CAACK,QAAQ;IAACC,KAAK,EAAE;EAAK,GAAEH,QAAkC,CAAC;AACrF,CAAC;AAED,OAAO,MAAMI,eAAe,gBAAGX,IAAI,CAACM,wBAAwB,CAAC;;AAE7D;AACA;AACA;AACA;;AAIA,OAAO,MAAMM,OAAO,gBAAGhB,KAAK,CAACI,IAAI,CAAC,CAAC;EAAEO;AAAiC,CAAC,KAAK;EACxE,MAAM;IAAEM;EAAU,CAAC,GAAGV,MAAM,CAAC,CAAC;EAC9B,MAAMW,eAAe,GAAGb,UAAU,CAACG,cAAc,CAAC;EAElDF,SAAS,CAAC,MAAM;IACZ,IAAIY,eAAe,EAAE;MACjB;IACJ;IAEAjB,QAAQ,CAACkB,OAAO,CAACR,QAAQ,EAAES,KAAK,IAAIH,SAAS,CAACG,KAAK,CAAC,CAAC;EACzD,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOF,eAAe,gBAAGlB,KAAA,CAAAY,aAAA,CAACT,QAAQ,QAAEQ,QAAmB,CAAC,GAAG,IAAI;AACnE,CAAC,CAAC;AAEFK,OAAO,CAACP,WAAW,GAAG,SAAS","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { GenericComponent, Decorator } from "../index";
1
+ import type { GenericComponent, Decorator } from "../index.js";
2
2
  export interface ProviderProps {
3
3
  hoc: Decorator<GenericComponent>;
4
4
  }