@webiny/app 0.0.0-unstable.99666aeb00 → 0.0.0-unstable.a9593f74dd

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 (136) hide show
  1. package/App.js +3 -1
  2. package/App.js.map +1 -1
  3. package/apollo-client/InMemoryCache.js +4 -5
  4. package/apollo-client/InMemoryCache.js.map +1 -1
  5. package/components/Image.d.ts +2 -2
  6. package/components/Image.js +5 -3
  7. package/components/Image.js.map +1 -1
  8. package/components/Routes.js +3 -1
  9. package/components/Routes.js.map +1 -1
  10. package/components/View.js +3 -1
  11. package/components/View.js.map +1 -1
  12. package/components/index.js +3 -1
  13. package/components/index.js.map +1 -1
  14. package/config.js +3 -1
  15. package/config.js.map +1 -1
  16. package/contexts/Ui/index.d.ts +2 -2
  17. package/contexts/Ui/index.js +3 -1
  18. package/contexts/Ui/index.js.map +1 -1
  19. package/core/AddRoute.d.ts +1 -2
  20. package/core/AddRoute.js +3 -1
  21. package/core/AddRoute.js.map +1 -1
  22. package/core/DebounceRender.d.ts +2 -1
  23. package/core/DebounceRender.js +5 -3
  24. package/core/DebounceRender.js.map +1 -1
  25. package/core/Plugin.js +3 -1
  26. package/core/Plugin.js.map +1 -1
  27. package/core/Plugins.d.ts +5 -2
  28. package/core/Plugins.js +3 -1
  29. package/core/Plugins.js.map +1 -1
  30. package/core/Provider.d.ts +1 -2
  31. package/core/Provider.js +3 -1
  32. package/core/Provider.js.map +1 -1
  33. package/core/Routes.d.ts +2 -2
  34. package/core/Routes.js +3 -1
  35. package/core/Routes.js.map +1 -1
  36. package/core/createProvider.js +3 -1
  37. package/core/createProvider.js.map +1 -1
  38. package/core/createProviderPlugin.d.ts +2 -2
  39. package/core/createProviderPlugin.js +3 -1
  40. package/core/createProviderPlugin.js.map +1 -1
  41. package/hooks/useAutocomplete/index.js +3 -1
  42. package/hooks/useAutocomplete/index.js.map +1 -1
  43. package/hooks/useAutocomplete/useAutocomplete.js +5 -3
  44. package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
  45. package/hooks/useDataList/functions/getData.js +3 -1
  46. package/hooks/useDataList/functions/getData.js.map +1 -1
  47. package/hooks/useDataList/functions/getError.js +3 -1
  48. package/hooks/useDataList/functions/getError.js.map +1 -1
  49. package/hooks/useDataList/functions/getMeta.js +3 -1
  50. package/hooks/useDataList/functions/getMeta.js.map +1 -1
  51. package/hooks/useDataList/functions/index.js +3 -1
  52. package/hooks/useDataList/functions/index.js.map +1 -1
  53. package/hooks/useDataList/functions/searchDataByKey.js +3 -1
  54. package/hooks/useDataList/functions/searchDataByKey.js.map +1 -1
  55. package/hooks/useDataList/index.js +3 -1
  56. package/hooks/useDataList/index.js.map +1 -1
  57. package/hooks/useDataList/useDataList.js +9 -7
  58. package/hooks/useDataList/useDataList.js.map +1 -1
  59. package/hooks/useDataList/utils/index.js +3 -1
  60. package/hooks/useDataList/utils/index.js.map +1 -1
  61. package/hooks/useDataList/utils/prepareLoadListParams.d.ts +1 -2
  62. package/hooks/useDataList/utils/prepareLoadListParams.js +32 -25
  63. package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -1
  64. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +3 -1
  65. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +1 -1
  66. package/hooks/useDataList/utils/types.d.ts +18 -12
  67. package/hooks/useDataList/utils/types.js +3 -1
  68. package/hooks/useDataList/utils/types.js.map +1 -1
  69. package/hooks/useHandler.js +7 -1
  70. package/hooks/useHandler.js.map +1 -1
  71. package/hooks/useHandlers.js +3 -1
  72. package/hooks/useHandlers.js.map +1 -1
  73. package/hooks/useUi.js +3 -1
  74. package/hooks/useUi.js.map +1 -1
  75. package/i18n/i18n.js +3 -1
  76. package/i18n/i18n.js.map +1 -1
  77. package/i18n/index.js +3 -1
  78. package/i18n/index.js.map +1 -1
  79. package/index.js +3 -1
  80. package/index.js.map +1 -1
  81. package/package.json +17 -21
  82. package/plugins/AddQuerySelectionPlugin.js +3 -4
  83. package/plugins/AddQuerySelectionPlugin.js.map +1 -1
  84. package/plugins/ApolloCacheObjectIdPlugin.js +3 -3
  85. package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -1
  86. package/plugins/ApolloDynamicLink.js +3 -1
  87. package/plugins/ApolloDynamicLink.js.map +1 -1
  88. package/plugins/ApolloLinkPlugin.js +3 -5
  89. package/plugins/ApolloLinkPlugin.js.map +1 -1
  90. package/plugins/ConsoleLinkPlugin.js +3 -1
  91. package/plugins/ConsoleLinkPlugin.js.map +1 -1
  92. package/plugins/LocaleHeaderLinkPlugin.js +3 -4
  93. package/plugins/LocaleHeaderLinkPlugin.js.map +1 -1
  94. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +2 -2
  95. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +3 -1
  96. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -1
  97. package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +0 -2
  98. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +3 -1
  99. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
  100. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +3 -1
  101. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
  102. package/plugins/NetworkErrorLinkPlugin.js +3 -1
  103. package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
  104. package/plugins/OmitTypenameLinkPlugin.js +3 -1
  105. package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
  106. package/plugins/RoutePlugin.js +3 -3
  107. package/plugins/RoutePlugin.js.map +1 -1
  108. package/plugins/TenantHeaderLinkPlugin.js +3 -4
  109. package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
  110. package/plugins/ViewPlugin.js +3 -3
  111. package/plugins/ViewPlugin.js.map +1 -1
  112. package/plugins/image.js +3 -1
  113. package/plugins/image.js.map +1 -1
  114. package/plugins/index.js +4 -2
  115. package/plugins/index.js.map +1 -1
  116. package/types.d.ts +0 -1
  117. package/types.js +3 -1
  118. package/types.js.map +1 -1
  119. package/utils/getApiUrl.js +3 -1
  120. package/utils/getApiUrl.js.map +1 -1
  121. package/utils/getGqlApiUrl.js +3 -1
  122. package/utils/getGqlApiUrl.js.map +1 -1
  123. package/utils/getHeadlessCmsGqlApiUrl.js +3 -1
  124. package/utils/getHeadlessCmsGqlApiUrl.js.map +1 -1
  125. package/utils/getLocaleCode.js +3 -1
  126. package/utils/getLocaleCode.js.map +1 -1
  127. package/utils/getPrerenderId.js +3 -1
  128. package/utils/getPrerenderId.js.map +1 -1
  129. package/utils/getTenantId.js +3 -1
  130. package/utils/getTenantId.js.map +1 -1
  131. package/utils/index.js +3 -1
  132. package/utils/index.js.map +1 -1
  133. package/utils/isLocalhost.js +3 -1
  134. package/utils/isLocalhost.js.map +1 -1
  135. package/utils/isPrerendering.js +3 -1
  136. package/utils/isPrerendering.js.map +1 -1
package/App.js CHANGED
@@ -102,4 +102,6 @@ var App = function App(_ref) {
102
102
  }, /*#__PURE__*/_react.default.createElement(AppRouter, null))))));
103
103
  };
104
104
  exports.App = App;
105
- App.displayName = "App";
105
+ App.displayName = "App";
106
+
107
+ //# sourceMappingURL=App.js.map
package/App.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["AppContext","createContext","undefined","displayName","useApp","appContext","useContext","Error","App","debounceRender","routes","providers","children","useState","reduce","acc","item","path","plugins","state","setState","addRoute","useCallback","route","props","addProvider","component","findIndex","m","addPlugin","element","useMemo","AppRouter","Object","values","length","Providers","compose"],"sources":["App.tsx"],"sourcesContent":["import React, {\n createContext,\n useContext,\n useMemo,\n useState,\n useCallback,\n FunctionComponentElement,\n ReactElement\n} from \"react\";\nimport { BrowserRouter, RouteProps, Route } from \"@webiny/react-router\";\nimport { compose, HigherOrderComponent, CompositionProvider } from \"@webiny/react-composition\";\nimport { Routes as SortRoutes } from \"./core/Routes\";\nimport { DebounceRender } from \"./core/DebounceRender\";\nimport { PluginsProvider } from \"./core/Plugins\";\n\ntype RoutesByPath = {\n [key: string]: ReactElement<RouteProps>;\n};\n\ninterface State {\n routes: RoutesByPath;\n plugins: JSX.Element[];\n providers: HigherOrderComponent[];\n}\n\ninterface AppContext extends State {\n addRoute(route: JSX.Element): void;\n addProvider(hoc: HigherOrderComponent): void;\n addPlugin(plugin: React.ReactNode): void;\n}\n\nconst AppContext = createContext<AppContext | undefined>(undefined);\n\nAppContext.displayName = \"AppContext\";\n\nexport const useApp = () => {\n const appContext = useContext(AppContext);\n if (!appContext) {\n throw Error(\n `AppContext provider was not found. Are you using the \"useApp()\" hook in the right place?`\n );\n }\n return appContext;\n};\n\nexport interface AppProps {\n debounceRender?: number;\n routes?: Array<RouteProps>;\n providers?: Array<HigherOrderComponent>;\n children?: React.ReactNode | React.ReactNode[];\n}\n\nexport const App = ({ debounceRender = 50, routes = [], providers = [], children }: AppProps) => {\n const [state, setState] = useState<State>({\n routes: routes.reduce<RoutesByPath>((acc, item) => {\n return { ...acc, [item.path as string]: <Route {...item} /> };\n }, {}),\n plugins: [],\n providers\n });\n\n const addRoute = useCallback((route: FunctionComponentElement<RouteProps>) => {\n setState(state => {\n return {\n ...state,\n routes: { ...state.routes, [route.props.path as string]: route }\n };\n });\n }, []);\n\n const addProvider = useCallback(component => {\n setState(state => {\n if (state.providers.findIndex(m => m === component) > -1) {\n return state;\n }\n\n return {\n ...state,\n providers: [...state.providers, component]\n };\n });\n }, []);\n\n const addPlugin = useCallback(element => {\n setState(state => {\n return {\n ...state,\n plugins: [...state.plugins, element]\n };\n });\n }, []);\n\n const appContext = useMemo(\n () => ({\n ...state,\n addRoute,\n addProvider,\n addPlugin\n }),\n [state]\n );\n\n const AppRouter = useMemo(() => {\n return function AppRouter() {\n const routes = Object.values(state.routes);\n return <SortRoutes key={routes.length} routes={routes} />;\n };\n }, [state.routes]);\n\n const Providers = useMemo(() => {\n return compose(...(state.providers || []))(({ children }: any) => (\n <DebounceRender wait={debounceRender}>{children}</DebounceRender>\n ));\n }, [state.providers.length]);\n\n Providers.displayName = \"Providers\";\n\n return (\n <AppContext.Provider value={appContext}>\n <CompositionProvider>\n {children}\n <BrowserRouter>\n <Providers>\n <PluginsProvider>{state.plugins}</PluginsProvider>\n <DebounceRender wait={debounceRender}>\n <AppRouter />\n </DebounceRender>\n </Providers>\n </BrowserRouter>\n </CompositionProvider>\n </AppContext.Provider>\n );\n};\n\nApp.displayName = \"App\";\n"],"mappings":";;;;;;;;;;;;AAAA;AASA;AACA;AACA;AACA;AACA;AAkBA,IAAMA,UAAU,gBAAG,IAAAC,oBAAa,EAAyBC,SAAS,CAAC;AAEnEF,UAAU,CAACG,WAAW,GAAG,YAAY;AAE9B,IAAMC,MAAM,GAAG,SAATA,MAAM,GAAS;EACxB,IAAMC,UAAU,GAAG,IAAAC,iBAAU,EAACN,UAAU,CAAC;EACzC,IAAI,CAACK,UAAU,EAAE;IACb,MAAME,KAAK,8FAEV;EACL;EACA,OAAOF,UAAU;AACrB,CAAC;AAAC;AASK,IAAMG,GAAG,GAAG,SAANA,GAAG,OAAiF;EAAA,+BAA3EC,cAAc;IAAdA,cAAc,oCAAG,EAAE;IAAA,mBAAEC,MAAM;IAANA,MAAM,4BAAG,EAAE;IAAA,sBAAEC,SAAS;IAATA,SAAS,+BAAG,EAAE;IAAEC,QAAQ,QAARA,QAAQ;EAC5E,gBAA0B,IAAAC,eAAQ,EAAQ;MACtCH,MAAM,EAAEA,MAAM,CAACI,MAAM,CAAe,UAACC,GAAG,EAAEC,IAAI,EAAK;QAC/C,mEAAYD,GAAG,yCAAGC,IAAI,CAACC,IAAI,eAAa,6BAAC,kBAAK,EAAKD,IAAI,CAAI;MAC/D,CAAC,EAAE,CAAC,CAAC,CAAC;MACNE,OAAO,EAAE,EAAE;MACXP,SAAS,EAATA;IACJ,CAAC,CAAC;IAAA;IANKQ,KAAK;IAAEC,QAAQ;EAQtB,IAAMC,QAAQ,GAAG,IAAAC,kBAAW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AM,CAACyB,MAAO;QAAC,MAAM,EAAEzB;MAAO,EAAG;IAC7D,CAAC;EACL,CAAC,EAAE,CAACS,KAAK,CAACT,MAAM,CAAC,CAAC;EAElB,IAAM0B,SAAS,GAAG,IAAAL,cAAO,EAAC,YAAM;IAC5B,OAAOM,yBAAO,gDAAKlB,KAAK,CAACR,SAAS,IAAI,EAAE,EAAE,CAAC;MAAA,IAAGC,QAAQ,SAARA,QAAQ;MAAA,oBAClD,6BAAC,8BAAc;QAAC,IAAI,EAAEH;MAAe,GAAEG,QAAQ,CAAkB;IAAA,CACpE,CAAC;EACN,CAAC,EAAE,CAACO,KAAK,CAACR,SAAS,CAACwB,MAAM,CAAC,CAAC;EAE5BC,SAAS,CAACjC,WAAW,GAAG,WAAW;EAEnC,oBACI,6BAAC,UAAU,CAAC,QAAQ;IAAC,KAAK,EAAEE;EAAW,gBACnC,6BAAC,qCAAmB,QACfO,QAAQ,eACT,6BAAC,0BAAa,qBACV,6BAAC,SAAS,qBACN,6BAAC,wBAAe,QAAEO,KAAK,CAACD,OAAO,CAAmB,eAClD,6BAAC,8BAAc;IAAC,IAAI,EAAET;EAAe,gBACjC,6BAAC,SAAS,OAAG,CACA,CACT,CACA,CACE,CACJ;AAE9B,CAAC;AAAC;AAEFD,GAAG,CAACL,WAAW,GAAG,KAAK"}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactRouter","_reactComposition","_Routes","_DebounceRender","_Plugins","AppContext","createContext","undefined","displayName","useApp","appContext","useContext","Error","exports","App","_ref","_ref$debounceRender","debounceRender","_ref$routes","routes","_ref$providers","providers","children","_useState","useState","reduce","acc","item","_objectSpread4","default","_defineProperty2","path","createElement","Route","plugins","_useState2","_slicedToArray2","state","setState","addRoute","useCallback","route","props","addProvider","component","findIndex","m","concat","_toConsumableArray2","addPlugin","element","useMemo","AppRouter","Object","values","Routes","key","length","Providers","compose","apply","_ref2","DebounceRender","wait","Provider","value","CompositionProvider","BrowserRouter","PluginsProvider"],"sources":["App.tsx"],"sourcesContent":["import React, {\n createContext,\n useContext,\n useMemo,\n useState,\n useCallback,\n FunctionComponentElement,\n ReactElement\n} from \"react\";\nimport { BrowserRouter, RouteProps, Route } from \"@webiny/react-router\";\nimport { compose, HigherOrderComponent, CompositionProvider } from \"@webiny/react-composition\";\nimport { Routes as SortRoutes } from \"./core/Routes\";\nimport { DebounceRender } from \"./core/DebounceRender\";\nimport { PluginsProvider } from \"./core/Plugins\";\n\ntype RoutesByPath = {\n [key: string]: ReactElement<RouteProps>;\n};\n\ninterface State {\n routes: RoutesByPath;\n plugins: JSX.Element[];\n providers: HigherOrderComponent[];\n}\n\ninterface AppContext extends State {\n addRoute(route: JSX.Element): void;\n addProvider(hoc: HigherOrderComponent): void;\n addPlugin(plugin: React.ReactNode): void;\n}\n\nconst AppContext = createContext<AppContext | undefined>(undefined);\n\nAppContext.displayName = \"AppContext\";\n\nexport const useApp = () => {\n const appContext = useContext(AppContext);\n if (!appContext) {\n throw Error(\n `AppContext provider was not found. Are you using the \"useApp()\" hook in the right place?`\n );\n }\n return appContext;\n};\n\nexport interface AppProps {\n debounceRender?: number;\n routes?: Array<RouteProps>;\n providers?: Array<HigherOrderComponent>;\n children?: React.ReactNode | React.ReactNode[];\n}\n\nexport const App = ({ debounceRender = 50, routes = [], providers = [], children }: AppProps) => {\n const [state, setState] = useState<State>({\n routes: routes.reduce<RoutesByPath>((acc, item) => {\n return { ...acc, [item.path as string]: <Route {...item} /> };\n }, {}),\n plugins: [],\n providers\n });\n\n const addRoute = useCallback((route: FunctionComponentElement<RouteProps>) => {\n setState(state => {\n return {\n ...state,\n routes: { ...state.routes, [route.props.path as string]: route }\n };\n });\n }, []);\n\n const addProvider = useCallback(component => {\n setState(state => {\n if (state.providers.findIndex(m => m === component) > -1) {\n return state;\n }\n\n return {\n ...state,\n providers: [...state.providers, component]\n };\n });\n }, []);\n\n const addPlugin = useCallback(element => {\n setState(state => {\n return {\n ...state,\n plugins: [...state.plugins, element]\n };\n });\n }, []);\n\n const appContext = useMemo(\n () => ({\n ...state,\n addRoute,\n addProvider,\n addPlugin\n }),\n [state]\n );\n\n const AppRouter = useMemo(() => {\n return function AppRouter() {\n const routes = Object.values(state.routes);\n return <SortRoutes key={routes.length} routes={routes} />;\n };\n }, [state.routes]);\n\n const Providers = useMemo(() => {\n return compose(...(state.providers || []))(({ children }: any) => (\n <DebounceRender wait={debounceRender}>{children}</DebounceRender>\n ));\n }, [state.providers.length]);\n\n Providers.displayName = \"Providers\";\n\n return (\n <AppContext.Provider value={appContext}>\n <CompositionProvider>\n {children}\n <BrowserRouter>\n <Providers>\n <PluginsProvider>{state.plugins}</PluginsProvider>\n <DebounceRender wait={debounceRender}>\n <AppRouter />\n </DebounceRender>\n </Providers>\n </BrowserRouter>\n </CompositionProvider>\n </AppContext.Provider>\n );\n};\n\nApp.displayName = \"App\";\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AASA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAkBA,IAAMM,UAAU,gBAAG,IAAAC,oBAAa,EAAyBC,SAAS,CAAC;AAEnEF,UAAU,CAACG,WAAW,GAAG,YAAY;AAE9B,IAAMC,MAAM,GAAG,SAATA,MAAMA,CAAA,EAAS;EACxB,IAAMC,UAAU,GAAG,IAAAC,iBAAU,EAACN,UAAU,CAAC;EACzC,IAAI,CAACK,UAAU,EAAE;IACb,MAAME,KAAK,6FAEX,CAAC;EACL;EACA,OAAOF,UAAU;AACrB,CAAC;AAACG,OAAA,CAAAJ,MAAA,GAAAA,MAAA;AASK,IAAMK,GAAG,GAAG,SAANA,GAAGA,CAAAC,IAAA,EAAiF;EAAA,IAAAC,mBAAA,GAAAD,IAAA,CAA3EE,cAAc;IAAdA,cAAc,GAAAD,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AACoB,SAAS,MAAE,CACA,CACT,CACA,CACE,CACJ,CAAC;AAE9B,CAAC;AAACvC,OAAA,CAAAC,GAAA,GAAAA,GAAA;AAEFA,GAAG,CAACN,WAAW,GAAG,KAAK"}
@@ -8,12 +8,10 @@ exports.InMemoryCache = void 0;
8
8
  var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
9
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
12
11
  var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
13
12
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
13
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
14
  var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
16
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
15
  var _apolloCacheInmemory = require("apollo-cache-inmemory");
18
16
  var _plugins = require("@webiny/plugins");
19
17
  var _AddQuerySelectionPlugin = require("../plugins/AddQuerySelectionPlugin");
@@ -25,7 +23,6 @@ var InMemoryCache = /*#__PURE__*/function (_BaseInMemoryCache) {
25
23
  var _this;
26
24
  (0, _classCallCheck2.default)(this, InMemoryCache);
27
25
  _this = _super.call(this, config);
28
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "transformPlugins", void 0);
29
26
  _this.transformPlugins = _plugins.plugins.byType(_ApolloLinkPlugin.ApolloLinkPlugin.type).filter(function (pl) {
30
27
  return pl instanceof _AddQuerySelectionPlugin.AddQuerySelectionPlugin;
31
28
  });
@@ -34,7 +31,7 @@ var InMemoryCache = /*#__PURE__*/function (_BaseInMemoryCache) {
34
31
  (0, _createClass2.default)(InMemoryCache, [{
35
32
  key: "transformDocument",
36
33
  value: function transformDocument(document) {
37
- // @ts-ignore
34
+ // @ts-expect-error
38
35
  var operationName = document.definitions[0].name.value;
39
36
  var _iterator = (0, _createForOfIteratorHelper2.default)(this.transformPlugins),
40
37
  _step;
@@ -53,4 +50,6 @@ var InMemoryCache = /*#__PURE__*/function (_BaseInMemoryCache) {
53
50
  }]);
54
51
  return InMemoryCache;
55
52
  }(_apolloCacheInmemory.InMemoryCache);
56
- exports.InMemoryCache = InMemoryCache;
53
+ exports.InMemoryCache = InMemoryCache;
54
+
55
+ //# sourceMappingURL=InMemoryCache.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["InMemoryCache","config","transformPlugins","plugins","byType","ApolloLinkPlugin","type","filter","pl","AddQuerySelectionPlugin","document","operationName","definitions","name","value","addSelectionToQuery","BaseInMemoryCache"],"sources":["InMemoryCache.ts"],"sourcesContent":["import { InMemoryCache as BaseInMemoryCache, InMemoryCacheConfig } from \"apollo-cache-inmemory\";\nimport { DocumentNode } from \"graphql\";\nimport { plugins } from \"@webiny/plugins\";\nimport { AddQuerySelectionPlugin } from \"../plugins/AddQuerySelectionPlugin\";\nimport { ApolloLinkPlugin } from \"../plugins/ApolloLinkPlugin\";\n\nexport class InMemoryCache extends BaseInMemoryCache {\n private readonly transformPlugins: AddQuerySelectionPlugin[];\n\n constructor(config?: InMemoryCacheConfig) {\n super(config);\n\n this.transformPlugins = plugins\n .byType<AddQuerySelectionPlugin>(ApolloLinkPlugin.type)\n .filter(pl => pl instanceof AddQuerySelectionPlugin);\n }\n\n public override transformDocument(document: DocumentNode): DocumentNode {\n // @ts-ignore\n const operationName = document.definitions[0].name.value;\n\n for (const pl of this.transformPlugins) {\n pl.addSelectionToQuery(operationName, document);\n }\n\n return super.transformDocument(document);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAEA;AACA;AACA;AAA+D,IAElDA,aAAa;EAAA;EAAA;EAGtB,uBAAYC,MAA4B,EAAE;IAAA;IAAA;IACtC,0BAAMA,MAAM;IAAE;IAEd,MAAKC,gBAAgB,GAAGC,gBAAO,CAC1BC,MAAM,CAA0BC,kCAAgB,CAACC,IAAI,CAAC,CACtDC,MAAM,CAAC,UAAAC,EAAE;MAAA,OAAIA,EAAE,YAAYC,gDAAuB;IAAA,EAAC;IAAC;EAC7D;EAAC;IAAA;IAAA,OAED,2BAAkCC,QAAsB,EAAgB;MACpE;MACA,IAAMC,aAAa,GAAGD,QAAQ,CAACE,WAAW,CAAC,CAAC,CAAC,CAACC,IAAI,CAACC,KAAK;MAAC,yDAExC,IAAI,CAACZ,gBAAgB;QAAA;MAAA;QAAtC,oDAAwC;UAAA,IAA7BM,EAAE;UACTA,EAAE,CAACO,mBAAmB,CAACJ,aAAa,EAAED,QAAQ,CAAC;QACnD;MAAC;QAAA;MAAA;QAAA;MAAA;MAED,wHAA+BA,QAAQ;IAC3C;EAAC;EAAA;AAAA,EApB8BM,kCAAiB;AAAA"}
1
+ {"version":3,"names":["_apolloCacheInmemory","require","_plugins","_AddQuerySelectionPlugin","_ApolloLinkPlugin","InMemoryCache","_BaseInMemoryCache","_inherits2","default","_super","_createSuper2","config","_this","_classCallCheck2","call","transformPlugins","plugins","byType","ApolloLinkPlugin","type","filter","pl","AddQuerySelectionPlugin","_createClass2","key","value","transformDocument","document","operationName","definitions","name","_iterator","_createForOfIteratorHelper2","_step","s","n","done","addSelectionToQuery","err","e","f","_get2","_getPrototypeOf2","prototype","BaseInMemoryCache","exports"],"sources":["InMemoryCache.ts"],"sourcesContent":["import { InMemoryCache as BaseInMemoryCache, InMemoryCacheConfig } from \"apollo-cache-inmemory\";\nimport { DocumentNode } from \"graphql\";\nimport { plugins } from \"@webiny/plugins\";\nimport { AddQuerySelectionPlugin } from \"../plugins/AddQuerySelectionPlugin\";\nimport { ApolloLinkPlugin } from \"../plugins/ApolloLinkPlugin\";\n\nexport class InMemoryCache extends BaseInMemoryCache {\n private readonly transformPlugins: AddQuerySelectionPlugin[];\n\n constructor(config?: InMemoryCacheConfig) {\n super(config);\n\n this.transformPlugins = plugins\n .byType<AddQuerySelectionPlugin>(ApolloLinkPlugin.type)\n .filter(pl => pl instanceof AddQuerySelectionPlugin);\n }\n\n public override transformDocument(document: DocumentNode): DocumentNode {\n // @ts-expect-error\n const operationName = document.definitions[0].name.value;\n\n for (const pl of this.transformPlugins) {\n pl.addSelectionToQuery(operationName, document);\n }\n\n return super.transformDocument(document);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AAA+D,IAElDI,aAAa,0BAAAC,kBAAA;EAAA,IAAAC,UAAA,CAAAC,OAAA,EAAAH,aAAA,EAAAC,kBAAA;EAAA,IAAAG,MAAA,OAAAC,aAAA,CAAAF,OAAA,EAAAH,aAAA;EAGtB,SAAAA,cAAYM,MAA4B,EAAE;IAAA,IAAAC,KAAA;IAAA,IAAAC,gBAAA,CAAAL,OAAA,QAAAH,aAAA;IACtCO,KAAA,GAAAH,MAAA,CAAAK,IAAA,OAAMH,MAAM;IAEZC,KAAA,CAAKG,gBAAgB,GAAGC,gBAAO,CAC1BC,MAAM,CAA0BC,kCAAgB,CAACC,IAAI,CAAC,CACtDC,MAAM,CAAC,UAAAC,EAAE;MAAA,OAAIA,EAAE,YAAYC,gDAAuB;IAAA,EAAC;IAAC,OAAAV,KAAA;EAC7D;EAAC,IAAAW,aAAA,CAAAf,OAAA,EAAAH,aAAA;IAAAmB,GAAA;IAAAC,KAAA,EAED,SAAAC,kBAAkCC,QAAsB,EAAgB;MACpE;MACA,IAAMC,aAAa,GAAGD,QAAQ,CAACE,WAAW,CAAC,CAAC,CAAC,CAACC,IAAI,CAACL,KAAK;MAAC,IAAAM,SAAA,OAAAC,2BAAA,CAAAxB,OAAA,EAExC,IAAI,CAACO,gBAAgB;QAAAkB,KAAA;MAAA;QAAtC,KAAAF,SAAA,CAAAG,CAAA,MAAAD,KAAA,GAAAF,SAAA,CAAAI,CAAA,IAAAC,IAAA,GAAwC;UAAA,IAA7Bf,EAAE,GAAAY,KAAA,CAAAR,KAAA;UACTJ,EAAE,CAACgB,mBAAmB,CAACT,aAAa,EAAED,QAAQ,CAAC;QACnD;MAAC,SAAAW,GAAA;QAAAP,SAAA,CAAAQ,CAAA,CAAAD,GAAA;MAAA;QAAAP,SAAA,CAAAS,CAAA;MAAA;MAED,WAAAC,KAAA,CAAAjC,OAAA,MAAAkC,gBAAA,CAAAlC,OAAA,EAAAH,aAAA,CAAAsC,SAAA,8BAAA7B,IAAA,OAA+Ba,QAAQ;IAC3C;EAAC;EAAA,OAAAtB,aAAA;AAAA,EApB8BuC,kCAAiB;AAAAC,OAAA,CAAAxC,aAAA,GAAAA,aAAA"}
@@ -1,3 +1,3 @@
1
- import * as React from "react";
1
+ /// <reference types="react" />
2
2
  import { ImageProps } from "../types";
3
- export declare const Image: React.FC<ImageProps>;
3
+ export declare const Image: ({ preset: presetName, ...props }: ImageProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.Image = void 0;
8
8
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
- var _get2 = _interopRequireDefault(require("lodash/get"));
10
9
  var _invariant = _interopRequireDefault(require("invariant"));
11
10
  var _plugins = require("@webiny/plugins");
11
+ var _get = _interopRequireDefault(require("lodash/get"));
12
12
  var _excluded = ["preset"];
13
13
  var Image = function Image(_ref) {
14
14
  var presetName = _ref.preset,
@@ -18,7 +18,7 @@ var Image = function Image(_ref) {
18
18
  throw new Error("Image component plugin (type \"image-component\") not defined.");
19
19
  }
20
20
  if (presetName) {
21
- var preset = (0, _get2.default)(plugin, "presets.".concat(presetName));
21
+ var preset = (0, _get.default)(plugin, "presets.".concat(presetName));
22
22
  (0, _invariant.default)(preset, "Transform preset \"".concat(presetName, "\" not found."));
23
23
  props.transform = preset;
24
24
  }
@@ -27,4 +27,6 @@ var Image = function Image(_ref) {
27
27
  }
28
28
  return plugin.render(props);
29
29
  };
30
- exports.Image = Image;
30
+ exports.Image = Image;
31
+
32
+ //# sourceMappingURL=Image.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Image","presetName","preset","props","plugin","plugins","byName","Error","invariant","transform","src","getImageSrc","render"],"sources":["Image.tsx"],"sourcesContent":["import * as React from \"react\";\nimport invariant from \"invariant\";\nimport { plugins } from \"@webiny/plugins\";\nimport { get } from \"lodash\";\nimport { ImageComponentPlugin, ImageProps } from \"~/types\";\n\nexport const Image: React.FC<ImageProps> = ({ preset: presetName, ...props }) => {\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":";;;;;;;;;AACA;AACA;AAA0C;AAInC,IAAMA,KAA2B,GAAG,SAA9BA,KAA2B,OAAyC;EAAA,IAA3BC,UAAU,QAAlBC,MAAM;IAAiBC,KAAK;EACtE,IAAMC,MAAM,GAAGC,gBAAO,CAACC,MAAM,CAAuB,iBAAiB,CAAC;EACtE,IAAI,CAACF,MAAM,EAAE;IACT,MAAM,IAAIG,KAAK,kEAAgE;EACnF;EAEA,IAAIN,UAAU,EAAE;IACZ,IAAMC,MAAM,GAAG,mBAAIE,MAAM,oBAAaH,UAAU,EAAG;IACnD,IAAAO,kBAAS,EAACN,MAAM,+BAAuBD,UAAU,mBAAe;IAChEE,KAAK,CAACM,SAAS,GAAGP,MAAM;EAC5B;EAEA,IAAIC,KAAK,CAACM,SAAS,EAAE;IACjBN,KAAK,CAACO,GAAG,GAAGN,MAAM,CAACO,WAAW,CAACR,KAAK,CAAC;EACzC;EAEA,OAAOC,MAAM,CAACQ,MAAM,CAACT,KAAK,CAAC;AAC/B,CAAC;AAAC"}
1
+ {"version":3,"names":["_invariant","_interopRequireDefault","require","_plugins","_get","_excluded","Image","_ref","presetName","preset","props","_objectWithoutProperties2","default","plugin","plugins","byName","Error","get","concat","invariant","transform","src","getImageSrc","render","exports"],"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,GAAG,SAARA,KAAKA,CAAAC,IAAA,EAAqD;EAAA,IAAvCC,UAAU,GAAAD,IAAA,CAAlBE,MAAM;IAAiBC,KAAK,OAAAC,yBAAA,CAAAC,OAAA,EAAAL,IAAA,EAAAF,SAAA;EAChD,IAAMQ,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;AAACc,OAAA,CAAAlB,KAAA,GAAAA,KAAA"}
@@ -42,4 +42,6 @@ var Routes = function Routes() {
42
42
  });
43
43
  }));
44
44
  };
45
- exports.Routes = Routes;
45
+ exports.Routes = Routes;
46
+
47
+ //# sourceMappingURL=Routes.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Routes","routes","plugins","byType","sort","a","b","pathA","route","props","path","pathB","includes","map","name","React","cloneElement","key"],"sources":["Routes.tsx"],"sourcesContent":["// This file is necessary only for backwards compatibility.\n// We'll remove this once the legacy rendering engine is removed.\nimport React from \"react\";\nimport { plugins } from \"@webiny/plugins\";\nimport { Routes as ReactRouterRoutes } from \"@webiny/react-router\";\nimport { RoutePlugin } from \"../types\";\n\nexport const Routes = () => {\n // We cannot call `sort` on the array returned by the `plugins.byType` call - it is read-only.\n const routes = [...plugins.byType<RoutePlugin>(\"route\")].sort((a, b) => {\n const pathA = a.route.props.path || \"*\";\n const pathB = b.route.props.path || \"*\";\n\n // This will sort paths at the very bottom of the list\n if (pathA === \"/\" && pathB === \"*\") {\n return -1;\n }\n\n // This will push * and / to the bottom of the list\n if (pathA === \"*\" || pathA === \"/\") {\n return 1;\n }\n\n // This will push * and / to the bottom of the list\n if ([\"*\", \"/\"].includes(pathB)) {\n return -1;\n }\n\n return 0;\n });\n\n return (\n <ReactRouterRoutes>\n {routes.map(({ route, name }) => React.cloneElement(route, { key: name }))}\n </ReactRouterRoutes>\n );\n};\n"],"mappings":";;;;;;;;AAEA;AACA;AACA;AAJA;AACA;;AAMO,IAAMA,MAAM,GAAG,SAATA,MAAM,GAAS;EACxB;EACA,IAAMC,MAAM,GAAG,iCAAIC,gBAAO,CAACC,MAAM,CAAc,OAAO,CAAC,EAAEC,IAAI,CAAC,UAACC,CAAC,EAAEC,CAAC,EAAK;IACpE,IAAMC,KAAK,GAAGF,CAAC,CAACG,KAAK,CAACC,KAAK,CAACC,IAAI,IAAI,GAAG;IACvC,IAAMC,KAAK,GAAGL,CAAC,CAACE,KAAK,CAACC,KAAK,CAACC,IAAI,IAAI,GAAG;;IAEvC;IACA,IAAIH,KAAK,KAAK,GAAG,IAAII,KAAK,KAAK,GAAG,EAAE;MAChC,OAAO,CAAC,CAAC;IACb;;IAEA;IACA,IAAIJ,KAAK,KAAK,GAAG,IAAIA,KAAK,KAAK,GAAG,EAAE;MAChC,OAAO,CAAC;IACZ;;IAEA;IACA,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAACK,QAAQ,CAACD,KAAK,CAAC,EAAE;MAC5B,OAAO,CAAC,CAAC;IACb;IAEA,OAAO,CAAC;EACZ,CAAC,CAAC;EAEF,oBACI,6BAAC,mBAAiB,QACbV,MAAM,CAACY,GAAG,CAAC;IAAA,IAAGL,KAAK,QAALA,KAAK;MAAEM,IAAI,QAAJA,IAAI;IAAA,oBAAOC,cAAK,CAACC,YAAY,CAACR,KAAK,EAAE;MAAES,GAAG,EAAEH;IAAK,CAAC,CAAC;EAAA,EAAC,CAC1D;AAE5B,CAAC;AAAC"}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_plugins","_reactRouter","Routes","routes","_toConsumableArray2","default","plugins","byType","sort","a","b","pathA","route","props","path","pathB","includes","createElement","map","_ref","name","React","cloneElement","key","exports"],"sources":["Routes.tsx"],"sourcesContent":["// This file is necessary only for backwards compatibility.\n// We'll remove this once the legacy rendering engine is removed.\nimport React from \"react\";\nimport { plugins } from \"@webiny/plugins\";\nimport { Routes as ReactRouterRoutes } from \"@webiny/react-router\";\nimport { RoutePlugin } from \"../types\";\n\nexport const Routes = () => {\n // We cannot call `sort` on the array returned by the `plugins.byType` call - it is read-only.\n const routes = [...plugins.byType<RoutePlugin>(\"route\")].sort((a, b) => {\n const pathA = a.route.props.path || \"*\";\n const pathB = b.route.props.path || \"*\";\n\n // This will sort paths at the very bottom of the list\n if (pathA === \"/\" && pathB === \"*\") {\n return -1;\n }\n\n // This will push * and / to the bottom of the list\n if (pathA === \"*\" || pathA === \"/\") {\n return 1;\n }\n\n // This will push * and / to the bottom of the list\n if ([\"*\", \"/\"].includes(pathB)) {\n return -1;\n }\n\n return 0;\n });\n\n return (\n <ReactRouterRoutes>\n {routes.map(({ route, name }) => React.cloneElement(route, { key: name }))}\n </ReactRouterRoutes>\n );\n};\n"],"mappings":";;;;;;;;AAEA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAJA;AACA;;AAMO,IAAMG,MAAM,GAAG,SAATA,MAAMA,CAAA,EAAS;EACxB;EACA,IAAMC,MAAM,GAAG,IAAAC,mBAAA,CAAAC,OAAA,EAAIC,gBAAO,CAACC,MAAM,CAAc,OAAO,CAAC,EAAEC,IAAI,CAAC,UAACC,CAAC,EAAEC,CAAC,EAAK;IACpE,IAAMC,KAAK,GAAGF,CAAC,CAACG,KAAK,CAACC,KAAK,CAACC,IAAI,IAAI,GAAG;IACvC,IAAMC,KAAK,GAAGL,CAAC,CAACE,KAAK,CAACC,KAAK,CAACC,IAAI,IAAI,GAAG;;IAEvC;IACA,IAAIH,KAAK,KAAK,GAAG,IAAII,KAAK,KAAK,GAAG,EAAE;MAChC,OAAO,CAAC,CAAC;IACb;;IAEA;IACA,IAAIJ,KAAK,KAAK,GAAG,IAAIA,KAAK,KAAK,GAAG,EAAE;MAChC,OAAO,CAAC;IACZ;;IAEA;IACA,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAACK,QAAQ,CAACD,KAAK,CAAC,EAAE;MAC5B,OAAO,CAAC,CAAC;IACb;IAEA,OAAO,CAAC;EACZ,CAAC,CAAC;EAEF,oBACIlB,MAAA,CAAAQ,OAAA,CAAAY,aAAA,CAAChB,YAAA,CAAAC,MAAiB,QACbC,MAAM,CAACe,GAAG,CAAC,UAAAC,IAAA;IAAA,IAAGP,KAAK,GAAAO,IAAA,CAALP,KAAK;MAAEQ,IAAI,GAAAD,IAAA,CAAJC,IAAI;IAAA,oBAAOC,cAAK,CAACC,YAAY,CAACV,KAAK,EAAE;MAAEW,GAAG,EAAEH;IAAK,CAAC,CAAC;EAAA,EAC1D,CAAC;AAE5B,CAAC;AAACI,OAAA,CAAAtB,MAAA,GAAAA,MAAA"}
@@ -27,4 +27,6 @@ var View = function View(_ref) {
27
27
  }
28
28
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, children || null);
29
29
  };
30
- exports.View = View;
30
+ exports.View = View;
31
+
32
+ //# sourceMappingURL=View.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["View","name","children","props","viewPlugins","plugins","byType","ViewPlugin","type","filter","pl","key","length","reduce","el","render"],"sources":["View.tsx"],"sourcesContent":["import React, { Fragment } from \"react\";\nimport { plugins } from \"@webiny/plugins\";\nimport { ViewPlugin } from \"../plugins/ViewPlugin\";\n\ninterface Props {\n name: string;\n props?: Record<string, any>;\n children?: React.ReactNode;\n}\n\nexport const View = ({ name, children, props = {} }: Props) => {\n const viewPlugins = plugins.byType<ViewPlugin>(ViewPlugin.type).filter(pl => pl.key === name);\n\n if (viewPlugins.length) {\n children = viewPlugins.reduce((el, pl) => pl.render({ children: el, ...props }), children);\n }\n\n return <Fragment>{children || null}</Fragment>;\n};\n"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AAQO,IAAMA,IAAI,GAAG,SAAPA,IAAI,OAA8C;EAAA,IAAxCC,IAAI,QAAJA,IAAI;IAAEC,QAAQ,QAARA,QAAQ;IAAA,kBAAEC,KAAK;IAALA,KAAK,2BAAG,CAAC,CAAC;EAC7C,IAAMC,WAAW,GAAGC,gBAAO,CAACC,MAAM,CAAaC,sBAAU,CAACC,IAAI,CAAC,CAACC,MAAM,CAAC,UAAAC,EAAE;IAAA,OAAIA,EAAE,CAACC,GAAG,KAAKV,IAAI;EAAA,EAAC;EAE7F,IAAIG,WAAW,CAACQ,MAAM,EAAE;IACpBV,QAAQ,GAAGE,WAAW,CAACS,MAAM,CAAC,UAACC,EAAE,EAAEJ,EAAE;MAAA,OAAKA,EAAE,CAACK,MAAM;QAAGb,QAAQ,EAAEY;MAAE,GAAKX,KAAK,EAAG;IAAA,GAAED,QAAQ,CAAC;EAC9F;EAEA,oBAAO,6BAAC,eAAQ,QAAEA,QAAQ,IAAI,IAAI,CAAY;AAClD,CAAC;AAAC"}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_plugins","_ViewPlugin","View","_ref","name","children","_ref$props","props","viewPlugins","plugins","byType","ViewPlugin","type","filter","pl","key","length","reduce","el","render","_objectSpread2","default","createElement","Fragment","exports"],"sources":["View.tsx"],"sourcesContent":["import React, { Fragment } from \"react\";\nimport { plugins } from \"@webiny/plugins\";\nimport { ViewPlugin } from \"../plugins/ViewPlugin\";\n\ninterface Props {\n name: string;\n props?: Record<string, any>;\n children?: React.ReactNode;\n}\n\nexport const View = ({ name, children, props = {} }: Props) => {\n const viewPlugins = plugins.byType<ViewPlugin>(ViewPlugin.type).filter(pl => pl.key === name);\n\n if (viewPlugins.length) {\n children = viewPlugins.reduce((el, pl) => pl.render({ children: el, ...props }), children);\n }\n\n return <Fragment>{children || null}</Fragment>;\n};\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAQO,IAAMG,IAAI,GAAG,SAAPA,IAAIA,CAAAC,IAAA,EAA8C;EAAA,IAAxCC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAAC,UAAA,GAAAH,IAAA,CAAEI,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAG,CAAC,CAAC,GAAAA,UAAA;EAC7C,IAAME,WAAW,GAAGC,gBAAO,CAACC,MAAM,CAAaC,sBAAU,CAACC,IAAI,CAAC,CAACC,MAAM,CAAC,UAAAC,EAAE;IAAA,OAAIA,EAAE,CAACC,GAAG,KAAKX,IAAI;EAAA,EAAC;EAE7F,IAAII,WAAW,CAACQ,MAAM,EAAE;IACpBX,QAAQ,GAAGG,WAAW,CAACS,MAAM,CAAC,UAACC,EAAE,EAAEJ,EAAE;MAAA,OAAKA,EAAE,CAACK,MAAM,KAAAC,cAAA,CAAAC,OAAA;QAAGhB,QAAQ,EAAEa;MAAE,GAAKX,KAAK,CAAE,CAAC;IAAA,GAAEF,QAAQ,CAAC;EAC9F;EAEA,oBAAOR,MAAA,CAAAwB,OAAA,CAAAC,aAAA,CAACzB,MAAA,CAAA0B,QAAQ,QAAElB,QAAQ,IAAI,IAAe,CAAC;AAClD,CAAC;AAACmB,OAAA,CAAAtB,IAAA,GAAAA,IAAA"}
@@ -16,4 +16,6 @@ Object.defineProperty(exports, "Routes", {
16
16
  }
17
17
  });
18
18
  var _Image = require("./Image");
19
- var _Routes = require("./Routes");
19
+ var _Routes = require("./Routes");
20
+
21
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { Image } from \"./Image\";\nexport { Routes } from \"./Routes\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AACA"}
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"}
package/config.js CHANGED
@@ -27,4 +27,6 @@ function createConfig() {
27
27
  };
28
28
  }
29
29
  var config = createConfig();
30
- exports.config = config;
30
+ exports.config = config;
31
+
32
+ //# 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"],"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,UAAU,GAAG,SAAbA,UAAU,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,UAAU,CAACC,GAAG,CAACI,IAAI,CAAC,CAAC;IACzB;EACJ,CAAC,CAAC;EACF,OAAOH,MAAM,CAACK,MAAM,CAACN,GAAG,CAAC;AAC7B,CAAC;AAED,SAASO,YAAY,GAAc;EAC/B,IAAIC,OAA4B,GAAG,CAAC,CAAC;EAErC,OAAO;IACHC,GAAG,eAACC,MAAc,EAAE;MAChBF,OAAO,GAAGT,UAAU,CAACW,MAAM,CAAC;IAChC,CAAC;IACDC,GAAG,iBAAG;MACF,OAAOH,OAAO;IAClB,CAAC;IACDI,MAAM,kBAACC,GAAG,EAAEC,YAAY,EAAE;MACtB,OAAOD,GAAG,IAAIL,OAAO,GAAGA,OAAO,CAACK,GAAG,CAAC,GAAGC,YAAY;IACvD;EACJ,CAAC;AACL;AAEO,IAAMJ,MAAM,GAAGH,YAAY,EAAE;AAAC"}
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,UAAU,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,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,GAAG,WAAAA,IAACC,MAAc,EAAE;MAChBF,OAAO,GAAGT,UAAU,CAACW,MAAM,CAAC;IAChC,CAAC;IACDC,GAAG,WAAAA,IAAA,EAAG;MACF,OAAOH,OAAO;IAClB,CAAC;IACDI,MAAM,WAAAA,OAACC,GAAG,EAAEC,YAAY,EAAE;MACtB,OAAOD,GAAG,IAAIL,OAAO,GAAGA,OAAO,CAACK,GAAG,CAAC,GAAGC,YAAY;IACvD;EACJ,CAAC;AACL;AAEO,IAAMJ,MAAM,GAAGH,YAAY,CAAC,CAAC;AAACQ,OAAA,CAAAL,MAAA,GAAAA,MAAA"}
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- export declare const UiContext: React.Context<{}>;
3
- declare type Props = {};
2
+ export declare const UiContext: React.Context<Record<string, any>>;
3
+ declare type Props = Record<string, any>;
4
4
  declare type State = {
5
5
  ui: {
6
6
  [key: string]: any;
@@ -56,4 +56,6 @@ var UiProvider = /*#__PURE__*/function (_React$Component) {
56
56
  }]);
57
57
  return UiProvider;
58
58
  }(_react.default.Component);
59
- exports.UiProvider = UiProvider;
59
+ exports.UiProvider = UiProvider;
60
+
61
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["UiContext","React","createContext","UiProvider","ui","setter","setState","state","value","setData","uiStatePlugins","plugins","byType","map","pl","cloneElement","render","key","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({});\n\ntype Props = {};\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: Function): 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;AAEA;AAEO,IAAMA,SAAS,gBAAGC,cAAK,CAACC,aAAa,CAAC,CAAC,CAAC,CAAC;AAAC;AAAA,IAqBpCC,UAAU;EAAA;EAAA;EAAA;IAAA;IAAA;IAAA;MAAA;IAAA;IAAA;IAAA,oFACY;MAC3BC,EAAE,EAAE,CAAC;IACT,CAAC;IAAA,sFAE0B,UAACC,MAAgB,EAAW;MACnD,OAAO,MAAKC,QAAQ,CAAC,UAACC,KAAY,EAAK;QACnC,OAAO;UAAEH,EAAE,8DAAOG,KAAK,CAACH,EAAE,GAAKC,MAAM,CAACE,KAAK,CAACH,EAAE,CAAC;QAAG,CAAC;MACvD,CAAC,CAAC;IACN,CAAC;IAAA;EAAA;EAAA;IAAA;IAAA,OAED,kBAAyB;MACrB,IAAMI,KAAqB,+DAAQ,IAAI,CAACD,KAAK,CAACH,EAAE;QAAEE,QAAQ,EAAE,IAAI,CAACG;MAAO,EAAE;MAC1E,IAAMC,cAAc,GAAGC,gBAAO,CAACC,MAAM,CAAgB,UAAU,CAAC;MAChE,oBACI,6BAAC,SAAS,CAAC,QAAQ;QAAC,KAAK,EAAEJ;MAAM,GAC5BE,cAAc,CAACG,GAAG,CAAC,UAAAC,EAAE;QAAA,oBAAIb,cAAK,CAACc,YAAY,CAACD,EAAE,CAACE,MAAM,EAAE,EAAE;UAAEC,GAAG,EAAEH,EAAE,CAACI;QAAK,CAAC,CAAC;MAAA,EAAC,EAC3E,IAAI,CAACC,KAAK,CAACC,QAAQ,CACH;IAE7B;EAAC;EAAA;AAAA,EApB2BnB,cAAK,CAACoB,SAAS;AAAA"}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_plugins","UiContext","React","createContext","exports","UiProvider","_React$Component","_inherits2","default","_super","_createSuper2","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty2","_assertThisInitialized2","ui","setter","setState","state","_objectSpread2","_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,gBAAGC,cAAK,CAACC,aAAa,CAAsB,CAAC,CAAC,CAAC;AAACC,OAAA,CAAAH,SAAA,G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mB,KAAK,CAACH,EAAE;QAAEE,QAAQ,EAAE,IAAI,CAACO;MAAO,EAAE;MAC1E,IAAMC,cAAc,GAAGC,gBAAO,CAACC,MAAM,CAAgB,UAAU,CAAC;MAChE,oBACIvC,MAAA,CAAAW,OAAA,CAAA6B,aAAA,CAACpC,SAAS,CAACqC,QAAQ;QAACP,KAAK,EAAEA;MAAM,GAC5BG,cAAc,CAACK,GAAG,CAAC,UAAAC,EAAE;QAAA,oBAAItC,cAAK,CAACuC,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;EAAA,OAAAvC,UAAA;AAAA,EApB2BH,cAAK,CAAC2C,SAAS;AAAAzC,OAAA,CAAAC,UAAA,GAAAA,UAAA"}
@@ -1,3 +1,2 @@
1
- import React from "react";
2
1
  import { RouteProps } from "@webiny/react-router";
3
- export declare const AddRoute: React.FC<RouteProps>;
2
+ export declare const AddRoute: (props: RouteProps) => null;
package/core/AddRoute.js CHANGED
@@ -16,4 +16,6 @@ var AddRoute = function AddRoute(props) {
16
16
  }, []);
17
17
  return null;
18
18
  };
19
- exports.AddRoute = AddRoute;
19
+ exports.AddRoute = AddRoute;
20
+
21
+ //# sourceMappingURL=AddRoute.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["AddRoute","props","useApp","addRoute","useEffect"],"sources":["AddRoute.tsx"],"sourcesContent":["import React, { useEffect } from \"react\";\nimport { useApp } from \"~/App\";\nimport { Route, RouteProps } from \"@webiny/react-router\";\n\nexport const AddRoute: React.FC<RouteProps> = props => {\n const { addRoute } = useApp();\n\n useEffect(() => {\n addRoute(<Route {...props} />);\n }, []);\n\n return null;\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAEO,IAAMA,QAA8B,GAAG,SAAjCA,QAA8B,CAAGC,KAAK,EAAI;EACnD,cAAqB,IAAAC,WAAM,GAAE;IAArBC,QAAQ,WAARA,QAAQ;EAEhB,IAAAC,gBAAS,EAAC,YAAM;IACZD,QAAQ,eAAC,6BAAC,kBAAK,EAAKF,KAAK,CAAI,CAAC;EAClC,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO,IAAI;AACf,CAAC;AAAC"}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_App","_reactRouter","AddRoute","props","_useApp","useApp","addRoute","useEffect","default","createElement","Route","exports"],"sources":["AddRoute.tsx"],"sourcesContent":["import React, { useEffect } from \"react\";\nimport { useApp } from \"~/App\";\nimport { Route, RouteProps } from \"@webiny/react-router\";\n\nexport const AddRoute = (props: RouteProps) => {\n const { addRoute } = useApp();\n\n useEffect(() => {\n addRoute(<Route {...props} />);\n }, []);\n\n return null;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEO,IAAMG,QAAQ,GAAG,SAAXA,QAAQA,CAAIC,KAAiB,EAAK;EAC3C,IAAAC,OAAA,GAAqB,IAAAC,WAAM,EAAC,CAAC;IAArBC,QAAQ,GAAAF,OAAA,CAARE,QAAQ;EAEhB,IAAAC,gBAAS,EAAC,YAAM;IACZD,QAAQ,eAACT,MAAA,CAAAW,OAAA,CAAAC,aAAA,CAACR,YAAA,CAAAS,KAAK,EAAKP,KAAQ,CAAC,CAAC;EAClC,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO,IAAI;AACf,CAAC;AAACQ,OAAA,CAAAT,QAAA,GAAAA,QAAA"}
@@ -1,11 +1,12 @@
1
1
  import React from "react";
2
2
  interface Props {
3
3
  wait?: number;
4
+ children?: React.ReactNode;
4
5
  }
5
6
  /**
6
7
  * We need to debounce the rendering of children during app bootstrap, since many plugins
7
8
  * can add more and more Providers which will recompose the entire hierarchy of React Context providers.
8
9
  * During this stage, we don't want to render anything.
9
10
  */
10
- export declare const DebounceRender: React.FC<Props>;
11
+ export declare const DebounceRender: ({ wait, children }: Props) => JSX.Element;
11
12
  export {};
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.DebounceRender = void 0;
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var _react = _interopRequireWildcard(require("react"));
11
- var _lodash = _interopRequireDefault(require("lodash.debounce"));
11
+ var _debounce = _interopRequireDefault(require("lodash/debounce"));
12
12
  /**
13
13
  * We need to debounce the rendering of children during app bootstrap, since many plugins
14
14
  * can add more and more Providers which will recompose the entire hierarchy of React Context providers.
@@ -23,7 +23,7 @@ var DebounceRender = function DebounceRender(_ref) {
23
23
  render = _useState2[0],
24
24
  setRender = _useState2[1];
25
25
  var debouncedRender = (0, _react.useMemo)(function () {
26
- return (0, _lodash.default)(function () {
26
+ return (0, _debounce.default)(function () {
27
27
  setRender(true);
28
28
  }, wait);
29
29
  }, [setRender]);
@@ -38,4 +38,6 @@ var DebounceRender = function DebounceRender(_ref) {
38
38
  }, []);
39
39
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, render ? children : null);
40
40
  };
41
- exports.DebounceRender = DebounceRender;
41
+ exports.DebounceRender = DebounceRender;
42
+
43
+ //# sourceMappingURL=DebounceRender.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["DebounceRender","wait","children","useState","render","setRender","debouncedRender","useMemo","debounce","useEffect","cancel"],"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}\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: React.FC<Props> = ({ wait = 50, children }) => {\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;AAEA;AAKA;AACA;AACA;AACA;AACA;AACO,IAAMA,cAA+B,GAAG,SAAlCA,cAA+B,OAAgC;EAAA,qBAA1BC,IAAI;IAAJA,IAAI,0BAAG,EAAE;IAAEC,QAAQ,QAARA,QAAQ;EACjE,gBAA4B,IAAAC,eAAQ,EAACF,IAAI,KAAK,CAAC,CAAC;IAAA;IAAzCG,MAAM;IAAEC,SAAS;EAExB,IAAMC,eAAe,GAAG,IAAAC,cAAO,EAAC,YAAM;IAClC,OAAO,IAAAC,eAAQ,EAAC,YAAM;MAClBH,SAAS,CAAC,IAAI,CAAC;IACnB,CAAC,EAAEJ,IAAI,CAAC;EACZ,CAAC,EAAE,CAACI,SAAS,CAAC,CAAC;EAEf,IAAAI,gBAAS,EAAC,YAAM;IACZ,IAAIL,MAAM,EAAE;MACR;IACJ;IAEAE,eAAe,EAAE;IAEjB,OAAO,YAAM;MACTA,eAAe,CAACI,MAAM,EAAE;IAC5B,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,oBAAO,4DAAGN,MAAM,GAAGF,QAAQ,GAAG,IAAI,CAAI;AAC1C,CAAC;AAAC"}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_debounce","_interopRequireDefault","DebounceRender","_ref","_ref$wait","wait","children","_useState","useState","_useState2","_slicedToArray2","default","render","setRender","debouncedRender","useMemo","debounce","useEffect","cancel","createElement","Fragment","exports"],"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,GAAG,SAAjBA,cAAcA,CAAAC,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,oBAAOrB,MAAA,CAAAc,OAAA,CAAAQ,aAAA,CAAAtB,MAAA,CAAAc,OAAA,CAAAS,QAAA,QAAGR,MAAM,GAAGN,QAAQ,GAAG,IAAO,CAAC;AAC1C,CAAC;AAACe,OAAA,CAAAnB,cAAA,GAAAA,cAAA"}
package/core/Plugin.js CHANGED
@@ -18,4 +18,6 @@ var Plugin = /*#__PURE__*/_react.default.memo(function Plugin(_ref) {
18
18
  });
19
19
  }), children ? /*#__PURE__*/_react.default.createElement(_Plugins.Plugins, null, children) : null);
20
20
  });
21
- exports.Plugin = Plugin;
21
+ exports.Plugin = Plugin;
22
+
23
+ //# sourceMappingURL=Plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Plugin","React","memo","providers","children","map","provider","index"],"sources":["Plugin.tsx"],"sourcesContent":["import React from \"react\";\nimport { Provider } from \"./Provider\";\nimport { Plugins } from \"./Plugins\";\nimport { HigherOrderComponent } from \"@webiny/react-composition\";\n\ninterface PluginProps {\n providers?: HigherOrderComponent[];\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;AACA;AACA;AAQO,IAAMA,MAAM,gBAAGC,cAAK,CAACC,IAAI,CAAC,SAASF,MAAM,OAAuC;EAAA,IAApCG,SAAS,QAATA,SAAS;IAAEC,QAAQ,QAARA,QAAQ;EAClE,oBACI,4DACK,CAACD,SAAS,IAAI,EAAE,EAAEE,GAAG,CAAC,UAACC,QAAQ,EAAEC,KAAK;IAAA,oBACnC,6BAAC,kBAAQ;MAAC,GAAG,EAAEA,KAAM;MAAC,GAAG,EAAED;IAAS,EAAG;EAAA,CAC1C,CAAC,EACDF,QAAQ,gBAAG,6BAAC,gBAAO,QAAEA,QAAQ,CAAW,GAAG,IAAI,CACjD;AAEX,CAAC,CAAC;AAAC"}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_Provider","_Plugins","Plugin","React","memo","_ref","providers","children","default","createElement","Fragment","map","provider","index","Provider","key","hoc","Plugins","exports"],"sources":["Plugin.tsx"],"sourcesContent":["import React from \"react\";\nimport { Provider } from \"./Provider\";\nimport { Plugins } from \"./Plugins\";\nimport { HigherOrderComponent } from \"@webiny/react-composition\";\n\ninterface PluginProps {\n providers?: HigherOrderComponent[];\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,gBAAGC,cAAK,CAACC,IAAI,CAAC,SAASF,MAAMA,CAAAG,IAAA,EAAuC;EAAA,IAApCC,SAAS,GAAAD,IAAA,CAATC,SAAS;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;EAClE,oBACIV,MAAA,CAAAW,OAAA,CAAAC,aAAA,CAAAZ,MAAA,CAAAW,OAAA,CAAAE,QAAA,QACK,CAACJ,SAAS,IAAI,EAAE,EAAEK,GAAG,CAAC,UAACC,QAAQ,EAAEC,KAAK;IAAA,oBACnChB,MAAA,CAAAW,OAAA,CAAAC,aAAA,CAACT,SAAA,CAAAc,QAAQ;MAACC,GAAG,EAAEF,KAAM;MAACG,GAAG,EAAEJ;IAAS,CAAE,CAAC;EAAA,CAC1C,CAAC,EACDL,QAAQ,gBAAGV,MAAA,CAAAW,OAAA,CAAAC,aAAA,CAACR,QAAA,CAAAgB,OAAO,QAAEV,QAAkB,CAAC,GAAG,IAC9C,CAAC;AAEX,CAAC,CAAC;AAACW,OAAA,CAAAhB,MAAA,GAAAA,MAAA"}
package/core/Plugins.d.ts CHANGED
@@ -3,10 +3,13 @@ export declare const PluginsContext: React.Context<boolean>;
3
3
  interface PluginsProviderComponentProps {
4
4
  children: JSX.Element[];
5
5
  }
6
- export declare const PluginsProvider: React.NamedExoticComponent<PluginsProviderComponentProps>;
6
+ export declare const PluginsProvider: React.MemoExoticComponent<({ children }: PluginsProviderComponentProps) => JSX.Element>;
7
7
  /**
8
8
  * @param children
9
9
  * @deprecated This component should not be used directly. Use the <Plugin> component to create plugins.
10
10
  */
11
- export declare const Plugins: React.FC;
11
+ interface PluginsComponentsProps {
12
+ children: React.ReactNode;
13
+ }
14
+ export declare const Plugins: ({ children }: PluginsComponentsProps) => JSX.Element | null;
12
15
  export {};
package/core/Plugins.js CHANGED
@@ -42,4 +42,6 @@ var Plugins = function Plugins(_ref2) {
42
42
  }, []);
43
43
  return hasParentPlugin ? /*#__PURE__*/_react.default.createElement(_react.Fragment, null, children) : null;
44
44
  };
45
- exports.Plugins = Plugins;
45
+ exports.Plugins = Plugins;
46
+
47
+ //# sourceMappingURL=Plugins.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["PluginsContext","createContext","displayName","PluginsProviderComponent","children","PluginsProvider","memo","Plugins","useApp","addPlugin","hasParentPlugin","useContext","useEffect","Children","forEach","child"],"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: React.FC<PluginsProviderComponentProps> = ({ children }) => {\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 */\nexport const Plugins: React.FC = ({ children }) => {\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;AACA;AAEO,IAAMA,cAAc,gBAAG,IAAAC,oBAAa,EAAU,KAAK,CAAC;AAAC;AAC5DD,cAAc,CAACE,WAAW,GAAG,gBAAgB;AAK7C,IAAMC,wBAAiE,GAAG,SAApEA,wBAAiE,OAAqB;EAAA,IAAfC,QAAQ,QAARA,QAAQ;EACjF;AACJ;AACA;AACA;EACI,oBAAO,6BAAC,cAAc,CAAC,QAAQ;IAAC,KAAK,EAAE;EAAK,GAAEA,QAAQ,CAA2B;AACrF,CAAC;AAEM,IAAMC,eAAe,gBAAG,IAAAC,WAAI,EAACH,wBAAwB,CAAC;;AAE7D;AACA;AACA;AACA;AAHA;AAIO,IAAMI,OAAiB,GAAG,SAApBA,OAAiB,QAAqB;EAAA,IAAfH,QAAQ,SAARA,QAAQ;EACxC,cAAsB,IAAAI,WAAM,GAAE;IAAtBC,SAAS,WAATA,SAAS;EACjB,IAAMC,eAAe,GAAG,IAAAC,iBAAU,EAACX,cAAc,CAAC;EAElD,IAAAY,gBAAS,EAAC,YAAM;IACZ,IAAIF,eAAe,EAAE;MACjB;IACJ;IAEAG,eAAQ,CAACC,OAAO,CAACV,QAAQ,EAAE,UAAAW,KAAK;MAAA,OAAIN,SAAS,CAACM,KAAK,CAAC;IAAA,EAAC;EACzD,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOL,eAAe,gBAAG,6BAAC,eAAQ,QAAEN,QAAQ,CAAY,GAAG,IAAI;AACnE,CAAC;AAAC"}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_App","PluginsContext","createContext","exports","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,gBAAG,IAAAC,oBAAa,EAAU,KAAK,CAAC;AAACC,OAAA,CAAAF,cAAA,GAAAA,cAAA;AAC5DA,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,gBAAG,IAAAC,WAAI,EAACR,wBAAwB,CAAC;;AAE7D;AACA;AACA;AACA;AAHAF,OAAA,CAAAS,eAAA,GAAAA,eAAA;AAOO,IAAME,OAAO,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;AAACJ,OAAA,CAAAW,OAAA,GAAAA,OAAA"}
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import { HigherOrderComponent } from "../index";
3
2
  export interface ProviderProps {
4
3
  hoc: HigherOrderComponent;
@@ -6,4 +5,4 @@ export interface ProviderProps {
6
5
  /**
7
6
  * Register a new React context provider.
8
7
  */
9
- export declare const Provider: React.FC<ProviderProps>;
8
+ export declare const Provider: ({ hoc }: ProviderProps) => null;
package/core/Provider.js CHANGED
@@ -18,4 +18,6 @@ var Provider = function Provider(_ref) {
18
18
  }, []);
19
19
  return null;
20
20
  };
21
- exports.Provider = Provider;
21
+ exports.Provider = Provider;
22
+
23
+ //# sourceMappingURL=Provider.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Provider","hoc","useApp","addProvider","useEffect"],"sources":["Provider.tsx"],"sourcesContent":["import React, { useEffect } from \"react\";\nimport { HigherOrderComponent, useApp } from \"~/index\";\n\nexport interface ProviderProps {\n hoc: HigherOrderComponent;\n}\n\n/**\n * Register a new React context provider.\n */\nexport const Provider: React.FC<ProviderProps> = ({ hoc }) => {\n const { addProvider } = useApp();\n\n useEffect(() => {\n return addProvider(hoc);\n }, []);\n\n return null;\n};\n"],"mappings":";;;;;;AAAA;AACA;AAMA;AACA;AACA;AACO,IAAMA,QAAiC,GAAG,SAApCA,QAAiC,OAAgB;EAAA,IAAVC,GAAG,QAAHA,GAAG;EACnD,cAAwB,IAAAC,QAAM,GAAE;IAAxBC,WAAW,WAAXA,WAAW;EAEnB,IAAAC,gBAAS,EAAC,YAAM;IACZ,OAAOD,WAAW,CAACF,GAAG,CAAC;EAC3B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO,IAAI;AACf,CAAC;AAAC"}
1
+ {"version":3,"names":["_react","require","_","Provider","_ref","hoc","_useApp","useApp","addProvider","useEffect","exports"],"sources":["Provider.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { HigherOrderComponent, useApp } from \"~/index\";\n\nexport interface ProviderProps {\n hoc: HigherOrderComponent;\n}\n\n/**\n * Register a new React context provider.\n */\nexport const Provider = ({ hoc }: ProviderProps) => {\n const { addProvider } = useApp();\n\n useEffect(() => {\n return addProvider(hoc);\n }, []);\n\n return null;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,CAAA,GAAAD,OAAA;AAMA;AACA;AACA;AACO,IAAME,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA,EAA+B;EAAA,IAAzBC,GAAG,GAAAD,IAAA,CAAHC,GAAG;EAC1B,IAAAC,OAAA,GAAwB,IAAAC,QAAM,EAAC,CAAC;IAAxBC,WAAW,GAAAF,OAAA,CAAXE,WAAW;EAEnB,IAAAC,gBAAS,EAAC,YAAM;IACZ,OAAOD,WAAW,CAACH,GAAG,CAAC;EAC3B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO,IAAI;AACf,CAAC;AAACK,OAAA,CAAAP,QAAA,GAAAA,QAAA"}
package/core/Routes.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import React from "react";
1
+ /// <reference types="react" />
2
2
  interface RoutesProps {
3
3
  routes: JSX.Element[];
4
4
  }
5
- export declare const Routes: React.FC<RoutesProps>;
5
+ export declare const Routes: (props: RoutesProps) => JSX.Element;
6
6
  export {};
package/core/Routes.js CHANGED
@@ -39,4 +39,6 @@ var Routes = function Routes(props) {
39
39
  });
40
40
  }));
41
41
  };
42
- exports.Routes = Routes;
42
+ exports.Routes = Routes;
43
+
44
+ //# sourceMappingURL=Routes.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Routes","props","routes","plugins","byType","map","route","sort","a","b","pathA","path","pathB","includes","index","React","cloneElement","key"],"sources":["Routes.tsx"],"sourcesContent":["import React from \"react\";\nimport { plugins } from \"@webiny/plugins\";\nimport { Routes as ReactRouterRoutes } from \"@webiny/react-router\";\nimport { RoutePlugin } from \"~/types\";\n\ninterface RoutesProps {\n routes: JSX.Element[];\n}\n\nexport const Routes: React.FC<RoutesProps> = props => {\n const routes = [\n ...props.routes,\n // For backwards compatibility, we need to support the RoutePlugin routes as well.\n ...plugins.byType<RoutePlugin>(\"route\").map(({ route }) => route)\n ].sort((a, b) => {\n const pathA = a.props.path || \"*\";\n const pathB = b.props.path || \"*\";\n\n // This will sort paths at the very bottom of the list\n if (pathA === \"/\" && pathB === \"*\") {\n return -1;\n }\n\n // This will push * and / to the bottom of the list\n if (pathA === \"*\" || pathA === \"/\") {\n return 1;\n }\n\n // This will push * and / to the bottom of the list\n if ([\"*\", \"/\"].includes(pathB)) {\n return -1;\n }\n\n return 0;\n });\n\n return (\n <ReactRouterRoutes>\n {routes.map((route, index) =>\n React.cloneElement(route, { key: `${route.props.path}:${index}` })\n )}\n </ReactRouterRoutes>\n );\n};\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AAOO,IAAMA,MAA6B,GAAG,SAAhCA,MAA6B,CAAGC,KAAK,EAAI;EAClD,IAAMC,MAAM,GAAG,2CACRD,KAAK,CAACC,MAAM,oCAEZC,gBAAO,CAACC,MAAM,CAAc,OAAO,CAAC,CAACC,GAAG,CAAC;IAAA,IAAGC,KAAK,QAALA,KAAK;IAAA,OAAOA,KAAK;EAAA,EAAC,GACnEC,IAAI,CAAC,UAACC,CAAC,EAAEC,CAAC,EAAK;IACb,IAAMC,KAAK,GAAGF,CAAC,CAACP,KAAK,CAACU,IAAI,IAAI,GAAG;IACjC,IAAMC,KAAK,GAAGH,CAAC,CAACR,KAAK,CAACU,IAAI,IAAI,GAAG;;IAEjC;IACA,IAAID,KAAK,KAAK,GAAG,IAAIE,KAAK,KAAK,GAAG,EAAE;MAChC,OAAO,CAAC,CAAC;IACb;;IAEA;IACA,IAAIF,KAAK,KAAK,GAAG,IAAIA,KAAK,KAAK,GAAG,EAAE;MAChC,OAAO,CAAC;IACZ;;IAEA;IACA,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAACG,QAAQ,CAACD,KAAK,CAAC,EAAE;MAC5B,OAAO,CAAC,CAAC;IACb;IAEA,OAAO,CAAC;EACZ,CAAC,CAAC;EAEF,oBACI,6BAAC,mBAAiB,QACbV,MAAM,CAACG,GAAG,CAAC,UAACC,KAAK,EAAEQ,KAAK;IAAA,oBACrBC,cAAK,CAACC,YAAY,CAACV,KAAK,EAAE;MAAEW,GAAG,YAAKX,KAAK,CAACL,KAAK,CAACU,IAAI,cAAIG,KAAK;IAAG,CAAC,CAAC;EAAA,EACrE,CACe;AAE5B,CAAC;AAAC"}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_plugins","_reactRouter","Routes","props","routes","concat","_toConsumableArray2","default","plugins","byType","map","_ref","route","sort","a","b","pathA","path","pathB","includes","createElement","index","React","cloneElement","key","exports"],"sources":["Routes.tsx"],"sourcesContent":["import React from \"react\";\nimport { plugins } from \"@webiny/plugins\";\nimport { Routes as ReactRouterRoutes } from \"@webiny/react-router\";\nimport { RoutePlugin } from \"~/types\";\n\ninterface RoutesProps {\n routes: JSX.Element[];\n}\n\nexport const Routes = (props: RoutesProps) => {\n const routes = [\n ...props.routes,\n // For backwards compatibility, we need to support the RoutePlugin routes as well.\n ...plugins.byType<RoutePlugin>(\"route\").map(({ route }) => route)\n ].sort((a, b) => {\n const pathA = a.props.path || \"*\";\n const pathB = b.props.path || \"*\";\n\n // This will sort paths at the very bottom of the list\n if (pathA === \"/\" && pathB === \"*\") {\n return -1;\n }\n\n // This will push * and / to the bottom of the list\n if (pathA === \"*\" || pathA === \"/\") {\n return 1;\n }\n\n // This will push * and / to the bottom of the list\n if ([\"*\", \"/\"].includes(pathB)) {\n return -1;\n }\n\n return 0;\n });\n\n return (\n <ReactRouterRoutes>\n {routes.map((route, index) =>\n React.cloneElement(route, { key: `${route.props.path}:${index}` })\n )}\n </ReactRouterRoutes>\n );\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAOO,IAAMG,MAAM,GAAG,SAATA,MAAMA,CAAIC,KAAkB,EAAK;EAC1C,IAAMC,MAAM,GAAG,GAAAC,MAAA,KAAAC,mBAAA,CAAAC,OAAA,EACRJ,KAAK,CAACC,MAAM,OAAAE,mBAAA,CAAAC,OAAA,EAEZC,gBAAO,CAACC,MAAM,CAAc,OAAO,CAAC,CAACC,GAAG,CAAC,UAAAC,IAAA;IAAA,IAAGC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAA,OAAOA,KAAK;EAAA,EAAC,GACnEC,IAAI,CAAC,UAACC,CAAC,EAAEC,CAAC,EAAK;IACb,IAAMC,KAAK,GAAGF,CAAC,CAACX,KAAK,CAACc,IAAI,IAAI,GAAG;IACjC,IAAMC,KAAK,GAAGH,CAAC,CAACZ,KAAK,CAACc,IAAI,IAAI,GAAG;;IAEjC;IACA,IAAID,KAAK,KAAK,GAAG,IAAIE,KAAK,KAAK,GAAG,EAAE;MAChC,OAAO,CAAC,CAAC;IACb;;IAEA;IACA,IAAIF,KAAK,KAAK,GAAG,IAAIA,KAAK,KAAK,GAAG,EAAE;MAChC,OAAO,CAAC;IACZ;;IAEA;IACA,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAACG,QAAQ,CAACD,KAAK,CAAC,EAAE;MAC5B,OAAO,CAAC,CAAC;IACb;IAEA,OAAO,CAAC;EACZ,CAAC,CAAC;EAEF,oBACIrB,MAAA,CAAAU,OAAA,CAAAa,aAAA,CAACnB,YAAA,CAAAC,MAAiB,QACbE,MAAM,CAACM,GAAG,CAAC,UAACE,KAAK,EAAES,KAAK;IAAA,oBACrBC,cAAK,CAACC,YAAY,CAACX,KAAK,EAAE;MAAEY,GAAG,KAAAnB,MAAA,CAAKO,KAAK,CAACT,KAAK,CAACc,IAAI,OAAAZ,MAAA,CAAIgB,KAAK;IAAG,CAAC,CAAC;EAAA,CACtE,CACe,CAAC;AAE5B,CAAC;AAACI,OAAA,CAAAvB,MAAA,GAAAA,MAAA"}
@@ -10,4 +10,6 @@ exports.createProvider = createProvider;
10
10
  */
11
11
  function createProvider(hoc) {
12
12
  return hoc;
13
- }
13
+ }
14
+
15
+ //# sourceMappingURL=createProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createProvider","hoc"],"sources":["createProvider.tsx"],"sourcesContent":["import { HigherOrderComponent } from \"@webiny/react-composition\";\n\n/**\n * Creates a Higher Order Component which is meant to wrap the entire app content.\n * This is mostly useful for adding React Context providers.\n */\nexport function createProvider(hoc: HigherOrderComponent): HigherOrderComponent {\n return hoc;\n}\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACO,SAASA,cAAc,CAACC,GAAyB,EAAwB;EAC5E,OAAOA,GAAG;AACd"}
1
+ {"version":3,"names":["createProvider","hoc"],"sources":["createProvider.tsx"],"sourcesContent":["import { HigherOrderComponent } from \"@webiny/react-composition\";\n\n/**\n * Creates a Higher Order Component which is meant to wrap the entire app content.\n * This is mostly useful for adding React Context providers.\n */\nexport function createProvider(hoc: HigherOrderComponent): HigherOrderComponent {\n return hoc;\n}\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACO,SAASA,cAAcA,CAACC,GAAyB,EAAwB;EAC5E,OAAOA,GAAG;AACd"}
@@ -1,8 +1,8 @@
1
- import React from "react";
1
+ /// <reference types="react" />
2
2
  import { HigherOrderComponent } from "@webiny/react-composition";
3
3
  /**
4
4
  * Creates a component, which, when mounted, will register an app provider.
5
5
  * This is particularly useful for wrapping the entire app with custom React Context providers.
6
6
  * For more information, visit https://www.webiny.com/docs/admin-area/basics/framework.
7
7
  */
8
- export declare function createProviderPlugin(hoc: HigherOrderComponent): React.FC;
8
+ export declare function createProviderPlugin(hoc: HigherOrderComponent): () => JSX.Element;
@@ -18,4 +18,6 @@ function createProviderPlugin(hoc) {
18
18
  hoc: hoc
19
19
  });
20
20
  };
21
- }
21
+ }
22
+
23
+ //# sourceMappingURL=createProviderPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createProviderPlugin","hoc","ProviderPlugin"],"sources":["createProviderPlugin.tsx"],"sourcesContent":["import React from \"react\";\nimport { HigherOrderComponent } from \"@webiny/react-composition\";\nimport { Provider } from \"./Provider\";\n\n/**\n * Creates a component, which, when mounted, will register an app provider.\n * This is particularly useful for wrapping the entire app with custom React Context providers.\n * For more information, visit https://www.webiny.com/docs/admin-area/basics/framework.\n */\nexport function createProviderPlugin(hoc: HigherOrderComponent): React.FC {\n return function ProviderPlugin() {\n return <Provider hoc={hoc} />;\n };\n}\n"],"mappings":";;;;;;;AAAA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACO,SAASA,oBAAoB,CAACC,GAAyB,EAAY;EACtE,OAAO,SAASC,cAAc,GAAG;IAC7B,oBAAO,6BAAC,kBAAQ;MAAC,GAAG,EAAED;IAAI,EAAG;EACjC,CAAC;AACL"}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_Provider","createProviderPlugin","hoc","ProviderPlugin","default","createElement","Provider"],"sources":["createProviderPlugin.tsx"],"sourcesContent":["import React from \"react\";\nimport { HigherOrderComponent } from \"@webiny/react-composition\";\nimport { Provider } from \"./Provider\";\n\n/**\n * Creates a component, which, when mounted, will register an app provider.\n * This is particularly useful for wrapping the entire app with custom React Context providers.\n * For more information, visit https://www.webiny.com/docs/admin-area/basics/framework.\n */\nexport function createProviderPlugin(hoc: HigherOrderComponent) {\n return function ProviderPlugin() {\n return <Provider hoc={hoc} />;\n };\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,SAASE,oBAAoBA,CAACC,GAAyB,EAAE;EAC5D,OAAO,SAASC,cAAcA,CAAA,EAAG;IAC7B,oBAAON,MAAA,CAAAO,OAAA,CAAAC,aAAA,CAACL,SAAA,CAAAM,QAAQ;MAACJ,GAAG,EAAEA;IAAI,CAAE,CAAC;EACjC,CAAC;AACL"}
@@ -9,4 +9,6 @@ Object.defineProperty(exports, "useAutocomplete", {
9
9
  return _useAutocomplete.useAutocomplete;
10
10
  }
11
11
  });
12
- var _useAutocomplete = require("./useAutocomplete");
12
+ var _useAutocomplete = require("./useAutocomplete");
13
+
14
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { useAutocomplete } from \"./useAutocomplete\";\n"],"mappings":";;;;;;;;;;;AAAA"}
1
+ {"version":3,"names":["_useAutocomplete","require"],"sources":["index.ts"],"sourcesContent":["export { useAutocomplete } from \"./useAutocomplete\";\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA"}