@webiny/app 0.0.0-unstable.e3f4727c56 → 0.0.0-unstable.eb196ccd2f

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 (206) hide show
  1. package/App.d.ts +12 -15
  2. package/App.js +72 -82
  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/apollo-client/InMemoryCache.d.ts +3 -2
  8. package/apollo-client/InMemoryCache.js +18 -54
  9. package/apollo-client/InMemoryCache.js.map +1 -1
  10. package/apollo-client/IntrospectionFragmentMatcher.d.ts +11 -0
  11. package/apollo-client/IntrospectionFragmentMatcher.js +45 -0
  12. package/apollo-client/IntrospectionFragmentMatcher.js.map +1 -0
  13. package/components/Image.d.ts +3 -3
  14. package/components/Image.js +13 -20
  15. package/components/Image.js.map +1 -1
  16. package/components/Routes.d.ts +2 -2
  17. package/components/Routes.js +15 -24
  18. package/components/Routes.js.map +1 -1
  19. package/components/View.d.ts +1 -1
  20. package/components/View.js +16 -27
  21. package/components/View.js.map +1 -1
  22. package/components/index.js +3 -18
  23. package/components/index.js.map +1 -1
  24. package/config/RouterConfig/Route.d.ts +30 -0
  25. package/config/RouterConfig/Route.js +42 -0
  26. package/config/RouterConfig/Route.js.map +1 -0
  27. package/config/RouterConfig.d.ts +32 -0
  28. package/config/RouterConfig.js +18 -0
  29. package/config/RouterConfig.js.map +1 -0
  30. package/config.d.ts +1 -1
  31. package/config.js +9 -14
  32. package/config.js.map +1 -1
  33. package/contexts/Ui/index.d.ts +4 -4
  34. package/contexts/Ui/index.js +30 -57
  35. package/contexts/Ui/index.js.map +1 -1
  36. package/core/DebounceRender.d.ts +2 -1
  37. package/core/DebounceRender.js +15 -25
  38. package/core/DebounceRender.js.map +1 -1
  39. package/core/Plugin.d.ts +2 -2
  40. package/core/Plugin.js +13 -20
  41. package/core/Plugin.js.map +1 -1
  42. package/core/Plugins.d.ts +5 -2
  43. package/core/Plugins.js +21 -27
  44. package/core/Plugins.js.map +1 -1
  45. package/core/Provider.d.ts +3 -4
  46. package/core/Provider.js +11 -14
  47. package/core/Provider.js.map +1 -1
  48. package/core/Routes.d.ts +1 -1
  49. package/core/Routes.js +16 -24
  50. package/core/Routes.js.map +1 -1
  51. package/core/createProvider.d.ts +7 -3
  52. package/core/createProvider.js +6 -10
  53. package/core/createProvider.js.map +1 -1
  54. package/core/createProviderPlugin.d.ts +2 -2
  55. package/core/createProviderPlugin.js +8 -12
  56. package/core/createProviderPlugin.js.map +1 -1
  57. package/hooks/useAutocomplete/index.js +2 -11
  58. package/hooks/useAutocomplete/index.js.map +1 -1
  59. package/hooks/useAutocomplete/useAutocomplete.d.ts +1 -1
  60. package/hooks/useAutocomplete/useAutocomplete.js +11 -17
  61. package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
  62. package/hooks/useDataList/functions/getData.js +3 -11
  63. package/hooks/useDataList/functions/getData.js.map +1 -1
  64. package/hooks/useDataList/functions/getError.js +3 -11
  65. package/hooks/useDataList/functions/getError.js.map +1 -1
  66. package/hooks/useDataList/functions/getMeta.js +3 -11
  67. package/hooks/useDataList/functions/getMeta.js.map +1 -1
  68. package/hooks/useDataList/functions/index.js +4 -26
  69. package/hooks/useDataList/functions/index.js.map +1 -1
  70. package/hooks/useDataList/functions/searchDataByKey.js +6 -11
  71. package/hooks/useDataList/functions/searchDataByKey.js.map +1 -1
  72. package/hooks/useDataList/index.js +2 -11
  73. package/hooks/useDataList/index.js.map +1 -1
  74. package/hooks/useDataList/useDataList.d.ts +2 -2
  75. package/hooks/useDataList/useDataList.js +80 -79
  76. package/hooks/useDataList/useDataList.js.map +1 -1
  77. package/hooks/useDataList/utils/index.js +3 -19
  78. package/hooks/useDataList/utils/index.js.map +1 -1
  79. package/hooks/useDataList/utils/prepareLoadListParams.d.ts +1 -2
  80. package/hooks/useDataList/utils/prepareLoadListParams.js +34 -34
  81. package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -1
  82. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +12 -15
  83. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +1 -1
  84. package/hooks/useDataList/utils/types.d.ts +21 -15
  85. package/hooks/useDataList/utils/types.js +2 -4
  86. package/hooks/useDataList/utils/types.js.map +1 -1
  87. package/hooks/useHandler.js +14 -13
  88. package/hooks/useHandler.js.map +1 -1
  89. package/hooks/useHandlers.d.ts +3 -3
  90. package/hooks/useHandlers.js +14 -18
  91. package/hooks/useHandlers.js.map +1 -1
  92. package/hooks/useRegisterLegacyPlugin.d.ts +2 -0
  93. package/hooks/useRegisterLegacyPlugin.js +11 -0
  94. package/hooks/useRegisterLegacyPlugin.js.map +1 -0
  95. package/hooks/useUi.d.ts +1 -1
  96. package/hooks/useUi.js +6 -11
  97. package/hooks/useUi.js.map +1 -1
  98. package/i18n/i18n.js +6 -13
  99. package/i18n/i18n.js.map +1 -1
  100. package/i18n/index.js +2 -12
  101. package/i18n/index.js.map +1 -1
  102. package/index.d.ts +4 -2
  103. package/index.js +19 -146
  104. package/index.js.map +1 -1
  105. package/package.json +25 -33
  106. package/plugins/AddQuerySelectionPlugin.d.ts +9 -2
  107. package/plugins/AddQuerySelectionPlugin.js +65 -94
  108. package/plugins/AddQuerySelectionPlugin.js.map +1 -1
  109. package/plugins/ApolloCacheObjectIdPlugin.js +14 -36
  110. package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -1
  111. package/plugins/ApolloDynamicLink.d.ts +3 -2
  112. package/plugins/ApolloDynamicLink.js +21 -50
  113. package/plugins/ApolloDynamicLink.js.map +1 -1
  114. package/plugins/ApolloLinkPlugin.d.ts +1 -1
  115. package/plugins/ApolloLinkPlugin.js +20 -44
  116. package/plugins/ApolloLinkPlugin.js.map +1 -1
  117. package/plugins/ConsoleLinkPlugin.js +22 -44
  118. package/plugins/ConsoleLinkPlugin.js.map +1 -1
  119. package/plugins/LocaleHeaderLinkPlugin.d.ts +1 -6
  120. package/plugins/LocaleHeaderLinkPlugin.js +25 -49
  121. package/plugins/LocaleHeaderLinkPlugin.js.map +1 -1
  122. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +1 -1
  123. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +41 -52
  124. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -1
  125. package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +8 -4
  126. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +76 -16
  127. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
  128. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +1 -1
  129. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +18 -18
  130. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
  131. package/plugins/NetworkErrorLinkPlugin.js +24 -42
  132. package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
  133. package/plugins/OmitTypenameLinkPlugin.js +13 -33
  134. package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
  135. package/plugins/RoutePlugin.d.ts +1 -1
  136. package/plugins/RoutePlugin.js +14 -36
  137. package/plugins/RoutePlugin.js.map +1 -1
  138. package/plugins/TenantHeaderLinkPlugin.d.ts +1 -6
  139. package/plugins/TenantHeaderLinkPlugin.js +32 -56
  140. package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
  141. package/plugins/ViewPlugin.d.ts +1 -1
  142. package/plugins/ViewPlugin.js +17 -41
  143. package/plugins/ViewPlugin.js.map +1 -1
  144. package/plugins/image.d.ts +1 -1
  145. package/plugins/image.js +48 -54
  146. package/plugins/image.js.map +1 -1
  147. package/plugins/index.d.ts +3 -3
  148. package/plugins/index.js +35 -58
  149. package/plugins/index.js.map +1 -1
  150. package/react-butterfiles/Files.d.ts +69 -0
  151. package/react-butterfiles/Files.js +227 -0
  152. package/react-butterfiles/Files.js.map +1 -0
  153. package/react-butterfiles/index.d.ts +2 -0
  154. package/react-butterfiles/index.js +4 -0
  155. package/react-butterfiles/index.js.map +1 -0
  156. package/react-butterfiles/utils/generateId.d.ts +1 -0
  157. package/react-butterfiles/utils/generateId.js +5 -0
  158. package/react-butterfiles/utils/generateId.js.map +1 -0
  159. package/react-butterfiles/utils/readFileContent.d.ts +1 -0
  160. package/react-butterfiles/utils/readFileContent.js +15 -0
  161. package/react-butterfiles/utils/readFileContent.js.map +1 -0
  162. package/renderApp.d.ts +2 -0
  163. package/renderApp.js +9 -0
  164. package/renderApp.js.map +1 -0
  165. package/types.d.ts +24 -27
  166. package/types.js +13 -11
  167. package/types.js.map +1 -1
  168. package/utils/createGenericContext.d.ts +13 -0
  169. package/utils/createGenericContext.js +25 -0
  170. package/utils/createGenericContext.js.map +1 -0
  171. package/utils/createHashing.d.ts +2 -0
  172. package/utils/createHashing.js +18 -0
  173. package/utils/createHashing.js.map +1 -0
  174. package/utils/getApiUrl.d.ts +1 -0
  175. package/utils/getApiUrl.js +5 -0
  176. package/utils/getApiUrl.js.map +1 -0
  177. package/utils/getGqlApiUrl.d.ts +1 -0
  178. package/utils/getGqlApiUrl.js +6 -0
  179. package/utils/getGqlApiUrl.js.map +1 -0
  180. package/utils/getHeadlessCmsGqlApiUrl.d.ts +5 -0
  181. package/utils/getHeadlessCmsGqlApiUrl.js +12 -0
  182. package/utils/getHeadlessCmsGqlApiUrl.js.map +1 -0
  183. package/utils/getLocaleCode.d.ts +6 -0
  184. package/utils/getLocaleCode.js +33 -0
  185. package/utils/getLocaleCode.js.map +1 -0
  186. package/utils/getPrerenderId.d.ts +6 -0
  187. package/utils/getPrerenderId.js +5 -0
  188. package/utils/getPrerenderId.js.map +1 -0
  189. package/utils/getTenantId.d.ts +6 -0
  190. package/utils/getTenantId.js +45 -0
  191. package/utils/getTenantId.js.map +1 -0
  192. package/utils/index.d.ts +10 -0
  193. package/utils/index.js +12 -0
  194. package/utils/index.js.map +1 -0
  195. package/utils/isLocalhost.d.ts +1 -0
  196. package/utils/isLocalhost.js +7 -0
  197. package/utils/isLocalhost.js.map +1 -0
  198. package/utils/isPrerendering.d.ts +1 -0
  199. package/utils/isPrerendering.js +5 -0
  200. package/utils/isPrerendering.js.map +1 -0
  201. package/utils/legacyPluginToReactComponent.d.ts +7 -0
  202. package/utils/legacyPluginToReactComponent.js +14 -0
  203. package/utils/legacyPluginToReactComponent.js.map +1 -0
  204. package/core/AddRoute.d.ts +0 -3
  205. package/core/AddRoute.js +0 -19
  206. package/core/AddRoute.js.map +0 -1
package/core/Plugins.js CHANGED
@@ -1,45 +1,39 @@
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 = /*#__PURE__*/(0, _react.createContext)(false);
11
- exports.PluginsContext = PluginsContext;
1
+ import React, { Fragment, Children, createContext, useContext, useEffect, memo } from "react";
2
+ import { useApp } from "../App";
3
+ export const PluginsContext = /*#__PURE__*/createContext(false);
12
4
  PluginsContext.displayName = "PluginsContext";
13
- var PluginsProviderComponent = function PluginsProviderComponent(_ref) {
14
- var children = _ref.children;
5
+ const PluginsProviderComponent = ({
6
+ children
7
+ }) => {
15
8
  /**
16
9
  * This context only serves as a safeguard. We need to warn users when they mount a plugin without using
17
10
  * the <Plugins> component. In that case, the context will not be available, and we can log warnings.
18
11
  */
19
- return /*#__PURE__*/_react.default.createElement(PluginsContext.Provider, {
12
+ return /*#__PURE__*/React.createElement(PluginsContext.Provider, {
20
13
  value: true
21
14
  }, children);
22
15
  };
23
- var PluginsProvider = /*#__PURE__*/(0, _react.memo)(PluginsProviderComponent);
16
+ export const PluginsProvider = /*#__PURE__*/memo(PluginsProviderComponent);
24
17
 
25
18
  /**
26
19
  * @param children
27
20
  * @deprecated This component should not be used directly. Use the <Plugin> component to create plugins.
28
21
  */
29
- exports.PluginsProvider = PluginsProvider;
30
- var Plugins = function Plugins(_ref2) {
31
- var children = _ref2.children;
32
- var _useApp = (0, _App.useApp)(),
33
- addPlugin = _useApp.addPlugin;
34
- var hasParentPlugin = (0, _react.useContext)(PluginsContext);
35
- (0, _react.useEffect)(function () {
22
+
23
+ export const Plugins = ({
24
+ children
25
+ }) => {
26
+ const {
27
+ addPlugin
28
+ } = useApp();
29
+ const hasParentPlugin = useContext(PluginsContext);
30
+ useEffect(() => {
36
31
  if (hasParentPlugin) {
37
32
  return;
38
33
  }
39
- _react.Children.forEach(children, function (child) {
40
- return addPlugin(child);
41
- });
34
+ Children.forEach(children, child => addPlugin(child));
42
35
  }, []);
43
- return hasParentPlugin ? /*#__PURE__*/_react.default.createElement(_react.Fragment, null, children) : null;
36
+ return hasParentPlugin ? /*#__PURE__*/React.createElement(Fragment, null, children) : null;
44
37
  };
45
- exports.Plugins = Plugins;
38
+
39
+ //# 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","Fragment","Children","createContext","useContext","useEffect","memo","useApp","PluginsContext","displayName","PluginsProviderComponent","children","createElement","Provider","value","PluginsProvider","Plugins","addPlugin","hasParentPlugin","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 = ({ 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,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,QAAQ,EAAEC,aAAa,EAAEC,UAAU,EAAEC,SAAS,EAAEC,IAAI,QAAQ,OAAO;AAC7F,SAASC,MAAM;AAEf,OAAO,MAAMC,cAAc,gBAAGL,aAAa,CAAU,KAAK,CAAC;AAC3DK,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,gBAAGT,IAAI,CAACI,wBAAwB,CAAC;;AAE7D;AACA;AACA;AACA;;AAIA,OAAO,MAAMM,OAAO,GAAGA,CAAC;EAAEL;AAAiC,CAAC,KAAK;EAC7D,MAAM;IAAEM;EAAU,CAAC,GAAGV,MAAM,CAAC,CAAC;EAC9B,MAAMW,eAAe,GAAGd,UAAU,CAACI,cAAc,CAAC;EAElDH,SAAS,CAAC,MAAM;IACZ,IAAIa,eAAe,EAAE;MACjB;IACJ;IAEAhB,QAAQ,CAACiB,OAAO,CAACR,QAAQ,EAAES,KAAK,IAAIH,SAAS,CAACG,KAAK,CAAC,CAAC;EACzD,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOF,eAAe,gBAAGlB,KAAA,CAAAY,aAAA,CAACX,QAAQ,QAAEU,QAAmB,CAAC,GAAG,IAAI;AACnE,CAAC","ignoreList":[]}
@@ -1,9 +1,8 @@
1
- import React from "react";
2
- import { HigherOrderComponent } from "../index";
1
+ import type { GenericComponent, Decorator } from "../index";
3
2
  export interface ProviderProps {
4
- hoc: HigherOrderComponent;
3
+ hoc: Decorator<GenericComponent>;
5
4
  }
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
@@ -1,21 +1,18 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Provider = void 0;
7
- var _react = require("react");
8
- var _ = require("./..");
1
+ import { useEffect } from "react";
2
+ import { useApp } from "./..";
9
3
  /**
10
4
  * Register a new React context provider.
11
5
  */
12
- var Provider = function Provider(_ref) {
13
- var hoc = _ref.hoc;
14
- var _useApp = (0, _.useApp)(),
15
- addProvider = _useApp.addProvider;
16
- (0, _react.useEffect)(function () {
6
+ export const Provider = ({
7
+ hoc
8
+ }) => {
9
+ const {
10
+ addProvider
11
+ } = useApp();
12
+ useEffect(() => {
17
13
  return addProvider(hoc);
18
14
  }, []);
19
15
  return null;
20
16
  };
21
- exports.Provider = Provider;
17
+
18
+ //# 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":["useEffect","useApp","Provider","hoc","addProvider"],"sources":["Provider.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport type { GenericComponent, Decorator } from \"~/index\";\nimport { useApp } from \"~/index\";\n\nexport interface ProviderProps {\n hoc: Decorator<GenericComponent>;\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,SAASA,SAAS,QAAQ,OAAO;AAEjC,SAASC,MAAM;AAMf;AACA;AACA;AACA,OAAO,MAAMC,QAAQ,GAAGA,CAAC;EAAEC;AAAmB,CAAC,KAAK;EAChD,MAAM;IAAEC;EAAY,CAAC,GAAGH,MAAM,CAAC,CAAC;EAEhCD,SAAS,CAAC,MAAM;IACZ,OAAOI,WAAW,CAACD,GAAG,CAAC;EAC3B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
package/core/Routes.d.ts CHANGED
@@ -2,5 +2,5 @@ import React from "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) => React.JSX.Element;
6
6
  export {};
package/core/Routes.js CHANGED
@@ -1,21 +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.Routes = void 0;
8
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
- var _react = _interopRequireDefault(require("react"));
10
- var _plugins = require("@webiny/plugins");
11
- var _reactRouter = require("@webiny/react-router");
12
- var Routes = function Routes(props) {
13
- var routes = [].concat((0, _toConsumableArray2.default)(props.routes), (0, _toConsumableArray2.default)(_plugins.plugins.byType("route").map(function (_ref) {
14
- var route = _ref.route;
15
- return route;
16
- }))).sort(function (a, b) {
17
- var pathA = a.props.path || "*";
18
- var pathB = b.props.path || "*";
1
+ import React from "react";
2
+ import { plugins } from "@webiny/plugins";
3
+ import { Routes as ReactRouterRoutes } from "@webiny/react-router";
4
+ export const Routes = props => {
5
+ const routes = [...props.routes,
6
+ // For backwards compatibility, we need to support the RoutePlugin routes as well.
7
+ ...plugins.byType("route").map(({
8
+ route
9
+ }) => route)].sort((a, b) => {
10
+ const pathA = a.props.path || "*";
11
+ const pathB = b.props.path || "*";
19
12
 
20
13
  // This will sort paths at the very bottom of the list
21
14
  if (pathA === "/" && pathB === "*") {
@@ -33,10 +26,9 @@ var Routes = function Routes(props) {
33
26
  }
34
27
  return 0;
35
28
  });
36
- return /*#__PURE__*/_react.default.createElement(_reactRouter.Routes, null, routes.map(function (route, index) {
37
- return /*#__PURE__*/_react.default.cloneElement(route, {
38
- key: "".concat(route.props.path, ":").concat(index)
39
- });
40
- }));
29
+ return /*#__PURE__*/React.createElement(ReactRouterRoutes, null, routes.map((route, index) => /*#__PURE__*/React.cloneElement(route, {
30
+ key: `${route.props.path}:${index}`
31
+ })));
41
32
  };
42
- exports.Routes = Routes;
33
+
34
+ //# 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","plugins","Routes","ReactRouterRoutes","props","routes","byType","map","route","sort","a","b","pathA","path","pathB","includes","createElement","index","cloneElement","key"],"sources":["Routes.tsx"],"sourcesContent":["import React from \"react\";\nimport { plugins } from \"@webiny/plugins\";\nimport { Routes as ReactRouterRoutes } from \"@webiny/react-router\";\nimport type { 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,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,OAAO,QAAQ,iBAAiB;AACzC,SAASC,MAAM,IAAIC,iBAAiB,QAAQ,sBAAsB;AAOlE,OAAO,MAAMD,MAAM,GAAIE,KAAkB,IAAK;EAC1C,MAAMC,MAAM,GAAG,CACX,GAAGD,KAAK,CAACC,MAAM;EACf;EACA,GAAGJ,OAAO,CAACK,MAAM,CAAc,OAAO,CAAC,CAACC,GAAG,CAAC,CAAC;IAAEC;EAAM,CAAC,KAAKA,KAAK,CAAC,CACpE,CAACC,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAK;IACb,MAAMC,KAAK,GAAGF,CAAC,CAACN,KAAK,CAACS,IAAI,IAAI,GAAG;IACjC,MAAMC,KAAK,GAAGH,CAAC,CAACP,KAAK,CAACS,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,oBACId,KAAA,CAAAgB,aAAA,CAACb,iBAAiB,QACbE,MAAM,CAACE,GAAG,CAAC,CAACC,KAAK,EAAES,KAAK,kBACrBjB,KAAK,CAACkB,YAAY,CAACV,KAAK,EAAE;IAAEW,GAAG,EAAE,GAAGX,KAAK,CAACJ,KAAK,CAACS,IAAI,IAAII,KAAK;EAAG,CAAC,CACrE,CACe,CAAC;AAE5B,CAAC","ignoreList":[]}
@@ -1,6 +1,10 @@
1
- import { HigherOrderComponent } from "@webiny/react-composition";
1
+ import type React from "react";
2
+ import type { Decorator, GenericComponent } from "@webiny/react-composition";
3
+ export interface ChildrenProps {
4
+ children: React.ReactNode;
5
+ }
2
6
  /**
3
- * Creates a Higher Order Component which is meant to wrap the entire app content.
7
+ * Creates a Higher Order Component which wraps the entire app content.
4
8
  * This is mostly useful for adding React Context providers.
5
9
  */
6
- export declare function createProvider(hoc: HigherOrderComponent): HigherOrderComponent;
10
+ export declare function createProvider(decorator: Decorator<GenericComponent<ChildrenProps>>): Decorator<GenericComponent<ChildrenProps>>;
@@ -1,13 +1,9 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createProvider = createProvider;
7
1
  /**
8
- * Creates a Higher Order Component which is meant to wrap the entire app content.
2
+ * Creates a Higher Order Component which wraps the entire app content.
9
3
  * This is mostly useful for adding React Context providers.
10
4
  */
11
- function createProvider(hoc) {
12
- return hoc;
13
- }
5
+ export function createProvider(decorator) {
6
+ return decorator;
7
+ }
8
+
9
+ //# 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","decorator"],"sources":["createProvider.tsx"],"sourcesContent":["import type React from \"react\";\nimport type { Decorator, GenericComponent } from \"@webiny/react-composition\";\n\nexport interface ChildrenProps {\n children: React.ReactNode;\n}\n\n/**\n * Creates a Higher Order Component which wraps the entire app content.\n * This is mostly useful for adding React Context providers.\n */\nexport function createProvider(\n decorator: Decorator<GenericComponent<ChildrenProps>>\n): Decorator<GenericComponent<ChildrenProps>> {\n return decorator;\n}\n"],"mappings":"AAOA;AACA;AACA;AACA;AACA,OAAO,SAASA,cAAcA,CAC1BC,SAAqD,EACX;EAC1C,OAAOA,SAAS;AACpB","ignoreList":[]}
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
- import { HigherOrderComponent } from "@webiny/react-composition";
2
+ import type { GenericComponent, Decorator } 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(decorator: Decorator<GenericComponent>): () => React.JSX.Element;
@@ -1,21 +1,17 @@
1
- "use strict";
1
+ import React from "react";
2
+ import { Provider } from "./Provider";
2
3
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createProviderPlugin = createProviderPlugin;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _Provider = require("./Provider");
10
4
  /**
11
5
  * Creates a component, which, when mounted, will register an app provider.
12
6
  * This is particularly useful for wrapping the entire app with custom React Context providers.
13
7
  * For more information, visit https://www.webiny.com/docs/admin-area/basics/framework.
14
8
  */
15
- function createProviderPlugin(hoc) {
9
+ export function createProviderPlugin(decorator) {
16
10
  return function ProviderPlugin() {
17
- return /*#__PURE__*/_react.default.createElement(_Provider.Provider, {
18
- hoc: hoc
11
+ return /*#__PURE__*/React.createElement(Provider, {
12
+ hoc: decorator
19
13
  });
20
14
  };
21
- }
15
+ }
16
+
17
+ //# 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","Provider","createProviderPlugin","decorator","ProviderPlugin","createElement","hoc"],"sources":["createProviderPlugin.tsx"],"sourcesContent":["import React from \"react\";\nimport type { GenericComponent, Decorator } 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(decorator: Decorator<GenericComponent>) {\n return function ProviderPlugin() {\n return <Provider hoc={decorator} />;\n };\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,QAAQ;;AAEjB;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAACC,SAAsC,EAAE;EACzE,OAAO,SAASC,cAAcA,CAAA,EAAG;IAC7B,oBAAOJ,KAAA,CAAAK,aAAA,CAACJ,QAAQ;MAACK,GAAG,EAAEH;IAAU,CAAE,CAAC;EACvC,CAAC;AACL","ignoreList":[]}
@@ -1,12 +1,3 @@
1
- "use strict";
1
+ export { useAutocomplete } from "./useAutocomplete";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "useAutocomplete", {
7
- enumerable: true,
8
- get: function get() {
9
- return _useAutocomplete.useAutocomplete;
10
- }
11
- });
12
- var _useAutocomplete = require("./useAutocomplete");
3
+ //# 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"],"sources":["index.ts"],"sourcesContent":["export { useAutocomplete } from \"./useAutocomplete\";\n"],"mappings":"AAAA,SAASA,eAAe","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { DocumentNode } from "graphql";
1
+ import type { DocumentNode } from "graphql";
2
2
  interface UseAutocompleteHook {
3
3
  options: any[];
4
4
  onInput(value: string): void;
@@ -1,24 +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.useAutocomplete = void 0;
8
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
- var _debounce2 = _interopRequireDefault(require("lodash/debounce"));
10
- var _useDataList = require("../useDataList");
11
- var useAutocomplete = function useAutocomplete(props) {
12
- var dataList = (0, _useDataList.useDataList)((0, _objectSpread2.default)({
13
- useRouter: false
14
- }, props));
1
+ import { useDataList } from "../useDataList";
2
+ import debounce from "lodash/debounce";
3
+ export const useAutocomplete = props => {
4
+ const dataList = useDataList({
5
+ useRouter: false,
6
+ ...props
7
+ });
15
8
  return {
16
9
  options: dataList.data || [],
17
- onInput: (0, _debounce2.default)(function (query) {
10
+ onInput: debounce(query => {
18
11
  if (!query) {
19
12
  return;
20
13
  }
21
- var search = props.search || query;
14
+ let search = props.search || query;
22
15
  if (typeof search === "function") {
23
16
  search = search(query);
24
17
  }
@@ -26,4 +19,5 @@ var useAutocomplete = function useAutocomplete(props) {
26
19
  }, 250)
27
20
  };
28
21
  };
29
- exports.useAutocomplete = useAutocomplete;
22
+
23
+ //# sourceMappingURL=useAutocomplete.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useAutocomplete","props","dataList","useDataList","useRouter","options","data","onInput","query","search","setSearch"],"sources":["useAutocomplete.ts"],"sourcesContent":["import { useDataList } from \"../useDataList\";\nimport { debounce } from \"lodash\";\nimport { DocumentNode } from \"graphql\";\n\ninterface UseAutocompleteHook {\n options: any[];\n onInput(value: string): void;\n}\n\ninterface Props {\n query: DocumentNode;\n search?: string | ((value: string) => string);\n}\n\nexport const useAutocomplete = (props: Props): UseAutocompleteHook => {\n const dataList = useDataList({ useRouter: false, ...props });\n\n return {\n options: dataList.data || [],\n onInput: debounce(query => {\n if (!query) {\n return;\n }\n\n let search = props.search || query;\n if (typeof search === \"function\") {\n search = search(query);\n }\n\n dataList.setSearch(search);\n }, 250)\n };\n};\n"],"mappings":";;;;;;;;;AAAA;AAcO,IAAMA,eAAe,GAAG,SAAlBA,eAAe,CAAIC,KAAY,EAA0B;EAClE,IAAMC,QAAQ,GAAG,IAAAC,wBAAW;IAAGC,SAAS,EAAE;EAAK,GAAKH,KAAK,EAAG;EAE5D,OAAO;IACHI,OAAO,EAAEH,QAAQ,CAACI,IAAI,IAAI,EAAE;IAC5BC,OAAO,EAAE,wBAAS,UAAAC,KAAK,EAAI;MACvB,IAAI,CAACA,KAAK,EAAE;QACR;MACJ;MAEA,IAAIC,MAAM,GAAGR,KAAK,CAACQ,MAAM,IAAID,KAAK;MAClC,IAAI,OAAOC,MAAM,KAAK,UAAU,EAAE;QAC9BA,MAAM,GAAGA,MAAM,CAACD,KAAK,CAAC;MAC1B;MAEAN,QAAQ,CAACQ,SAAS,CAACD,MAAM,CAAC;IAC9B,CAAC,EAAE,GAAG;EACV,CAAC;AACL,CAAC;AAAC"}
1
+ {"version":3,"names":["useDataList","debounce","useAutocomplete","props","dataList","useRouter","options","data","onInput","query","search","setSearch"],"sources":["useAutocomplete.ts"],"sourcesContent":["import { useDataList } from \"../useDataList\";\nimport debounce from \"lodash/debounce\";\nimport type { DocumentNode } from \"graphql\";\n\ninterface UseAutocompleteHook {\n options: any[];\n onInput(value: string): void;\n}\n\ninterface Props {\n query: DocumentNode;\n search?: string | ((value: string) => string);\n}\n\nexport const useAutocomplete = (props: Props): UseAutocompleteHook => {\n const dataList = useDataList({ useRouter: false, ...props });\n\n return {\n options: dataList.data || [],\n onInput: debounce(query => {\n if (!query) {\n return;\n }\n\n let search = props.search || query;\n if (typeof search === \"function\") {\n search = search(query);\n }\n\n dataList.setSearch(search);\n }, 250)\n };\n};\n"],"mappings":"AAAA,SAASA,WAAW;AACpB,OAAOC,QAAQ,MAAM,iBAAiB;AAatC,OAAO,MAAMC,eAAe,GAAIC,KAAY,IAA0B;EAClE,MAAMC,QAAQ,GAAGJ,WAAW,CAAC;IAAEK,SAAS,EAAE,KAAK;IAAE,GAAGF;EAAM,CAAC,CAAC;EAE5D,OAAO;IACHG,OAAO,EAAEF,QAAQ,CAACG,IAAI,IAAI,EAAE;IAC5BC,OAAO,EAAEP,QAAQ,CAACQ,KAAK,IAAI;MACvB,IAAI,CAACA,KAAK,EAAE;QACR;MACJ;MAEA,IAAIC,MAAM,GAAGP,KAAK,CAACO,MAAM,IAAID,KAAK;MAClC,IAAI,OAAOC,MAAM,KAAK,UAAU,EAAE;QAC9BA,MAAM,GAAGA,MAAM,CAACD,KAAK,CAAC;MAC1B;MAEAL,QAAQ,CAACO,SAAS,CAACD,MAAM,CAAC;IAC9B,CAAC,EAAE,GAAG;EACV,CAAC;AACL,CAAC","ignoreList":[]}
@@ -1,12 +1,4 @@
1
- "use strict";
1
+ import searchDataByKey from "./searchDataByKey";
2
+ export default response => searchDataByKey("data", response);
2
3
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _searchDataByKey = _interopRequireDefault(require("./searchDataByKey"));
9
- var _default = function _default(response) {
10
- return (0, _searchDataByKey.default)("data", response);
11
- };
12
- exports.default = _default;
4
+ //# sourceMappingURL=getData.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["response","searchDataByKey"],"sources":["getData.ts"],"sourcesContent":["import searchDataByKey from \"./searchDataByKey\";\n\nexport default (response: Record<string, string>) => searchDataByKey(\"data\", response);\n"],"mappings":";;;;;;;AAAA;AAAgD,eAEjC,kBAACA,QAAgC;EAAA,OAAK,IAAAC,wBAAe,EAAC,MAAM,EAAED,QAAQ,CAAC;AAAA;AAAA"}
1
+ {"version":3,"names":["searchDataByKey","response"],"sources":["getData.ts"],"sourcesContent":["import searchDataByKey from \"./searchDataByKey\";\n\nexport default (response: Record<string, string>) => searchDataByKey(\"data\", response);\n"],"mappings":"AAAA,OAAOA,eAAe;AAEtB,eAAgBC,QAAgC,IAAKD,eAAe,CAAC,MAAM,EAAEC,QAAQ,CAAC","ignoreList":[]}
@@ -1,12 +1,4 @@
1
- "use strict";
1
+ import searchDataByKey from "./searchDataByKey";
2
+ export default response => searchDataByKey("error", response);
2
3
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _searchDataByKey = _interopRequireDefault(require("./searchDataByKey"));
9
- var _default = function _default(response) {
10
- return (0, _searchDataByKey.default)("error", response);
11
- };
12
- exports.default = _default;
4
+ //# sourceMappingURL=getError.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["response","searchDataByKey"],"sources":["getError.ts"],"sourcesContent":["import searchDataByKey from \"./searchDataByKey\";\n\nexport default (response: Record<string, string>) => searchDataByKey(\"error\", response);\n"],"mappings":";;;;;;;AAAA;AAAgD,eAEjC,kBAACA,QAAgC;EAAA,OAAK,IAAAC,wBAAe,EAAC,OAAO,EAAED,QAAQ,CAAC;AAAA;AAAA"}
1
+ {"version":3,"names":["searchDataByKey","response"],"sources":["getError.ts"],"sourcesContent":["import searchDataByKey from \"./searchDataByKey\";\n\nexport default (response: Record<string, string>) => searchDataByKey(\"error\", response);\n"],"mappings":"AAAA,OAAOA,eAAe;AAEtB,eAAgBC,QAAgC,IAAKD,eAAe,CAAC,OAAO,EAAEC,QAAQ,CAAC","ignoreList":[]}
@@ -1,12 +1,4 @@
1
- "use strict";
1
+ import searchDataByKey from "./searchDataByKey";
2
+ export default response => searchDataByKey("meta", response);
2
3
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _searchDataByKey = _interopRequireDefault(require("./searchDataByKey"));
9
- var _default = function _default(response) {
10
- return (0, _searchDataByKey.default)("meta", response);
11
- };
12
- exports.default = _default;
4
+ //# sourceMappingURL=getMeta.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["response","searchDataByKey"],"sources":["getMeta.ts"],"sourcesContent":["import searchDataByKey from \"./searchDataByKey\";\n\nexport default (response: Record<string, string>) => searchDataByKey(\"meta\", response);\n"],"mappings":";;;;;;;AAAA;AAAgD,eAEjC,kBAACA,QAAgC;EAAA,OAAK,IAAAC,wBAAe,EAAC,MAAM,EAAED,QAAQ,CAAC;AAAA;AAAA"}
1
+ {"version":3,"names":["searchDataByKey","response"],"sources":["getMeta.ts"],"sourcesContent":["import searchDataByKey from \"./searchDataByKey\";\n\nexport default (response: Record<string, string>) => searchDataByKey(\"meta\", response);\n"],"mappings":"AAAA,OAAOA,eAAe;AAEtB,eAAgBC,QAAgC,IAAKD,eAAe,CAAC,MAAM,EAAEC,QAAQ,CAAC","ignoreList":[]}
@@ -1,27 +1,5 @@
1
- "use strict";
1
+ export { default as getData } from "./getData";
2
+ export { default as getError } from "./getError";
3
+ export { default as getMeta } from "./getMeta";
2
4
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- Object.defineProperty(exports, "getData", {
8
- enumerable: true,
9
- get: function get() {
10
- return _getData.default;
11
- }
12
- });
13
- Object.defineProperty(exports, "getError", {
14
- enumerable: true,
15
- get: function get() {
16
- return _getError.default;
17
- }
18
- });
19
- Object.defineProperty(exports, "getMeta", {
20
- enumerable: true,
21
- get: function get() {
22
- return _getMeta.default;
23
- }
24
- });
25
- var _getData = _interopRequireDefault(require("./getData"));
26
- var _getError = _interopRequireDefault(require("./getError"));
27
- var _getMeta = _interopRequireDefault(require("./getMeta"));
5
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default as getData } from \"./getData\";\nexport { default as getError } from \"./getError\";\nexport { default as getMeta } from \"./getMeta\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA"}
1
+ {"version":3,"names":["default","getData","getError","getMeta"],"sources":["index.ts"],"sourcesContent":["export { default as getData } from \"./getData\";\nexport { default as getError } from \"./getError\";\nexport { default as getMeta } from \"./getMeta\";\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,OAAO;AAC3B,SAASD,OAAO,IAAIE,QAAQ;AAC5B,SAASF,OAAO,IAAIG,OAAO","ignoreList":[]}
@@ -1,23 +1,18 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var searchDataByKey = function searchDataByKey(searchKey, object) {
1
+ const searchDataByKey = (searchKey, object) => {
8
2
  if (!object || typeof object !== "object") {
9
3
  return null;
10
4
  }
11
5
  if (object[searchKey]) {
12
6
  return object[searchKey];
13
7
  }
14
- for (var key in object) {
15
- var value = searchDataByKey(searchKey, object[key]);
8
+ for (const key in object) {
9
+ const value = searchDataByKey(searchKey, object[key]);
16
10
  if (value) {
17
11
  return value;
18
12
  }
19
13
  }
20
14
  return null;
21
15
  };
22
- var _default = searchDataByKey;
23
- exports.default = _default;
16
+ export default searchDataByKey;
17
+
18
+ //# sourceMappingURL=searchDataByKey.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["searchDataByKey","searchKey","object","key","value"],"sources":["searchDataByKey.ts"],"sourcesContent":["const searchDataByKey = (searchKey: string, object: Record<string, any>): string | null => {\n if (!object || typeof object !== \"object\") {\n return null;\n }\n\n if (object[searchKey]) {\n return object[searchKey];\n }\n\n for (const key in object) {\n const value = searchDataByKey(searchKey, object[key]);\n if (value) {\n return value;\n }\n }\n\n return null;\n};\n\nexport default searchDataByKey;\n"],"mappings":";;;;;;AAAA,IAAMA,eAAe,GAAG,SAAlBA,eAAe,CAAIC,SAAiB,EAAEC,MAA2B,EAAoB;EACvF,IAAI,CAACA,MAAM,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;IACvC,OAAO,IAAI;EACf;EAEA,IAAIA,MAAM,CAACD,SAAS,CAAC,EAAE;IACnB,OAAOC,MAAM,CAACD,SAAS,CAAC;EAC5B;EAEA,KAAK,IAAME,GAAG,IAAID,MAAM,EAAE;IACtB,IAAME,KAAK,GAAGJ,eAAe,CAACC,SAAS,EAAEC,MAAM,CAACC,GAAG,CAAC,CAAC;IACrD,IAAIC,KAAK,EAAE;MACP,OAAOA,KAAK;IAChB;EACJ;EAEA,OAAO,IAAI;AACf,CAAC;AAAC,eAEaJ,eAAe;AAAA"}
1
+ {"version":3,"names":["searchDataByKey","searchKey","object","key","value"],"sources":["searchDataByKey.ts"],"sourcesContent":["const searchDataByKey = (searchKey: string, object: Record<string, any>): string | null => {\n if (!object || typeof object !== \"object\") {\n return null;\n }\n\n if (object[searchKey]) {\n return object[searchKey];\n }\n\n for (const key in object) {\n const value = searchDataByKey(searchKey, object[key]);\n if (value) {\n return value;\n }\n }\n\n return null;\n};\n\nexport default searchDataByKey;\n"],"mappings":"AAAA,MAAMA,eAAe,GAAGA,CAACC,SAAiB,EAAEC,MAA2B,KAAoB;EACvF,IAAI,CAACA,MAAM,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;IACvC,OAAO,IAAI;EACf;EAEA,IAAIA,MAAM,CAACD,SAAS,CAAC,EAAE;IACnB,OAAOC,MAAM,CAACD,SAAS,CAAC;EAC5B;EAEA,KAAK,MAAME,GAAG,IAAID,MAAM,EAAE;IACtB,MAAME,KAAK,GAAGJ,eAAe,CAACC,SAAS,EAAEC,MAAM,CAACC,GAAG,CAAC,CAAC;IACrD,IAAIC,KAAK,EAAE;MACP,OAAOA,KAAK;IAChB;EACJ;EAEA,OAAO,IAAI;AACf,CAAC;AAED,eAAeJ,eAAe","ignoreList":[]}
@@ -1,12 +1,3 @@
1
- "use strict";
1
+ export { useDataList } from "./useDataList";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "useDataList", {
7
- enumerable: true,
8
- get: function get() {
9
- return _useDataList.useDataList;
10
- }
11
- });
12
- var _useDataList = require("./useDataList");
3
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { useDataList } from \"./useDataList\";\n"],"mappings":";;;;;;;;;;;AAAA"}
1
+ {"version":3,"names":["useDataList"],"sources":["index.ts"],"sourcesContent":["export { useDataList } from \"./useDataList\";\n"],"mappings":"AAAA,SAASA,WAAW","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import { DocumentNode } from "graphql";
2
- import { ApolloClient } from "apollo-client";
1
+ import type { DocumentNode } from "graphql";
2
+ import type { ApolloClient } from "apollo-client";
3
3
  export interface UseDataListParams {
4
4
  useRouter?: boolean;
5
5
  variables?: ((params: UseDataListParams) => any) | object;