@webiny/app 0.0.0-unstable.fcdad0bc61 → 0.0.0-unstable.fdd9228b5d

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 (203) hide show
  1. package/App.d.ts +26 -0
  2. package/App.js +95 -0
  3. package/App.js.map +1 -0
  4. package/AppContainer.d.ts +23 -0
  5. package/AppContainer.js +9 -0
  6. package/AppContainer.js.map +1 -0
  7. package/apollo-client/InMemoryCache.d.ts +3 -2
  8. package/apollo-client/InMemoryCache.js +17 -76
  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 +12 -32
  15. package/components/Image.js.map +1 -1
  16. package/components/Routes.d.ts +2 -2
  17. package/components/Routes.js +21 -34
  18. package/components/Routes.js.map +1 -1
  19. package/components/View.d.ts +1 -1
  20. package/components/View.js +15 -37
  21. package/components/View.js.map +1 -1
  22. package/components/index.js +3 -20
  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 +8 -16
  32. package/config.js.map +1 -1
  33. package/contexts/Ui/index.d.ts +4 -8
  34. package/contexts/Ui/index.js +29 -89
  35. package/contexts/Ui/index.js.map +1 -1
  36. package/core/DebounceRender.d.ts +12 -0
  37. package/core/DebounceRender.js +31 -0
  38. package/core/DebounceRender.js.map +1 -0
  39. package/core/Plugin.d.ts +8 -0
  40. package/core/Plugin.js +14 -0
  41. package/core/Plugin.js.map +1 -0
  42. package/core/Plugins.d.ts +15 -0
  43. package/core/Plugins.js +39 -0
  44. package/core/Plugins.js.map +1 -0
  45. package/core/Provider.d.ts +8 -0
  46. package/core/Provider.js +18 -0
  47. package/core/Provider.js.map +1 -0
  48. package/core/Routes.d.ts +6 -0
  49. package/core/Routes.js +34 -0
  50. package/core/Routes.js.map +1 -0
  51. package/core/createProvider.d.ts +10 -0
  52. package/core/createProvider.js +9 -0
  53. package/core/createProvider.js.map +1 -0
  54. package/core/createProviderPlugin.d.ts +8 -0
  55. package/core/createProviderPlugin.js +17 -0
  56. package/core/createProviderPlugin.js.map +1 -0
  57. package/hooks/useAutocomplete/index.js +2 -12
  58. package/hooks/useAutocomplete/index.js.map +1 -1
  59. package/hooks/useAutocomplete/useAutocomplete.d.ts +1 -1
  60. package/hooks/useAutocomplete/useAutocomplete.js +10 -25
  61. package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
  62. package/hooks/useDataList/functions/getData.js +3 -15
  63. package/hooks/useDataList/functions/getData.js.map +1 -1
  64. package/hooks/useDataList/functions/getError.js +3 -15
  65. package/hooks/useDataList/functions/getError.js.map +1 -1
  66. package/hooks/useDataList/functions/getMeta.js +3 -15
  67. package/hooks/useDataList/functions/getMeta.js.map +1 -1
  68. package/hooks/useDataList/functions/index.js +4 -30
  69. package/hooks/useDataList/functions/index.js.map +1 -1
  70. package/hooks/useDataList/functions/searchDataByKey.js +5 -16
  71. package/hooks/useDataList/functions/searchDataByKey.js.map +1 -1
  72. package/hooks/useDataList/index.js +2 -12
  73. package/hooks/useDataList/index.js.map +1 -1
  74. package/hooks/useDataList/useDataList.d.ts +2 -2
  75. package/hooks/useDataList/useDataList.js +82 -107
  76. package/hooks/useDataList/useDataList.js.map +1 -1
  77. package/hooks/useDataList/utils/index.js +3 -22
  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 +33 -43
  81. package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -1
  82. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +11 -16
  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 +13 -14
  88. package/hooks/useHandler.js.map +1 -1
  89. package/hooks/useHandlers.d.ts +3 -3
  90. package/hooks/useHandlers.js +14 -21
  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 +5 -14
  97. package/hooks/useUi.js.map +1 -1
  98. package/i18n/i18n.js +6 -20
  99. package/i18n/i18n.js.map +1 -1
  100. package/i18n/index.js +2 -14
  101. package/i18n/index.js.map +1 -1
  102. package/index.d.ts +14 -1
  103. package/index.js +18 -35
  104. package/index.js.map +1 -1
  105. package/package.json +25 -30
  106. package/plugins/AddQuerySelectionPlugin.d.ts +9 -2
  107. package/plugins/AddQuerySelectionPlugin.js +64 -124
  108. package/plugins/AddQuerySelectionPlugin.js.map +1 -1
  109. package/plugins/ApolloCacheObjectIdPlugin.js +13 -50
  110. package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -1
  111. package/plugins/ApolloDynamicLink.d.ts +3 -2
  112. package/plugins/ApolloDynamicLink.js +20 -72
  113. package/plugins/ApolloDynamicLink.js.map +1 -1
  114. package/plugins/ApolloLinkPlugin.d.ts +1 -1
  115. package/plugins/ApolloLinkPlugin.js +19 -60
  116. package/plugins/ApolloLinkPlugin.js.map +1 -1
  117. package/plugins/ConsoleLinkPlugin.js +21 -58
  118. package/plugins/ConsoleLinkPlugin.js.map +1 -1
  119. package/plugins/LocaleHeaderLinkPlugin.d.ts +1 -6
  120. package/plugins/LocaleHeaderLinkPlugin.js +24 -69
  121. package/plugins/LocaleHeaderLinkPlugin.js.map +1 -1
  122. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +1 -1
  123. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +41 -72
  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 -19
  127. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
  128. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +1 -1
  129. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +24 -31
  130. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
  131. package/plugins/NetworkErrorLinkPlugin.js +24 -59
  132. package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
  133. package/plugins/OmitTypenameLinkPlugin.js +13 -47
  134. package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
  135. package/plugins/RoutePlugin.d.ts +1 -1
  136. package/plugins/RoutePlugin.js +13 -50
  137. package/plugins/RoutePlugin.js.map +1 -1
  138. package/plugins/TenantHeaderLinkPlugin.d.ts +1 -6
  139. package/plugins/TenantHeaderLinkPlugin.js +31 -77
  140. package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
  141. package/plugins/ViewPlugin.d.ts +1 -1
  142. package/plugins/ViewPlugin.js +16 -55
  143. package/plugins/ViewPlugin.js.map +1 -1
  144. package/plugins/image.d.ts +1 -1
  145. package/plugins/image.js +55 -94
  146. package/plugins/image.js.map +1 -1
  147. package/plugins/index.d.ts +3 -3
  148. package/plugins/index.js +34 -78
  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 +12 -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
package/core/Routes.js ADDED
@@ -0,0 +1,34 @@
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 || "*";
12
+
13
+ // This will sort paths at the very bottom of the list
14
+ if (pathA === "/" && pathB === "*") {
15
+ return -1;
16
+ }
17
+
18
+ // This will push * and / to the bottom of the list
19
+ if (pathA === "*" || pathA === "/") {
20
+ return 1;
21
+ }
22
+
23
+ // This will push * and / to the bottom of the list
24
+ if (["*", "/"].includes(pathB)) {
25
+ return -1;
26
+ }
27
+ return 0;
28
+ });
29
+ return /*#__PURE__*/React.createElement(ReactRouterRoutes, null, routes.map((route, index) => /*#__PURE__*/React.cloneElement(route, {
30
+ key: `${route.props.path}:${index}`
31
+ })));
32
+ };
33
+
34
+ //# sourceMappingURL=Routes.js.map
@@ -0,0 +1 @@
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":[]}
@@ -0,0 +1,10 @@
1
+ import type React from "react";
2
+ import type { Decorator, GenericComponent } from "@webiny/react-composition";
3
+ export interface ChildrenProps {
4
+ children: React.ReactNode;
5
+ }
6
+ /**
7
+ * Creates a Higher Order Component which wraps the entire app content.
8
+ * This is mostly useful for adding React Context providers.
9
+ */
10
+ export declare function createProvider(decorator: Decorator<GenericComponent<ChildrenProps>>): Decorator<GenericComponent<ChildrenProps>>;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Creates a Higher Order Component which wraps the entire app content.
3
+ * This is mostly useful for adding React Context providers.
4
+ */
5
+ export function createProvider(decorator) {
6
+ return decorator;
7
+ }
8
+
9
+ //# sourceMappingURL=createProvider.js.map
@@ -0,0 +1 @@
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":[]}
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import type { GenericComponent, Decorator } from "@webiny/react-composition";
3
+ /**
4
+ * Creates a component, which, when mounted, will register an app provider.
5
+ * This is particularly useful for wrapping the entire app with custom React Context providers.
6
+ * For more information, visit https://www.webiny.com/docs/admin-area/basics/framework.
7
+ */
8
+ export declare function createProviderPlugin(decorator: Decorator<GenericComponent>): () => React.JSX.Element;
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import { Provider } from "./Provider";
3
+
4
+ /**
5
+ * Creates a component, which, when mounted, will register an app provider.
6
+ * This is particularly useful for wrapping the entire app with custom React Context providers.
7
+ * For more information, visit https://www.webiny.com/docs/admin-area/basics/framework.
8
+ */
9
+ export function createProviderPlugin(decorator) {
10
+ return function ProviderPlugin() {
11
+ return /*#__PURE__*/React.createElement(Provider, {
12
+ hoc: decorator
13
+ });
14
+ };
15
+ }
16
+
17
+ //# sourceMappingURL=createProviderPlugin.js.map
@@ -0,0 +1 @@
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,13 +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
-
13
- 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,38 +1,23 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.useAutocomplete = void 0;
9
-
10
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
- var _debounce2 = _interopRequireDefault(require("lodash/debounce"));
13
-
14
- var _useDataList = require("../useDataList");
15
-
16
- var useAutocomplete = function useAutocomplete(props) {
17
- var dataList = (0, _useDataList.useDataList)((0, _objectSpread2.default)({
18
- useRouter: false
19
- }, 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
+ });
20
8
  return {
21
9
  options: dataList.data || [],
22
- onInput: (0, _debounce2.default)(function (query) {
10
+ onInput: debounce(query => {
23
11
  if (!query) {
24
12
  return;
25
13
  }
26
-
27
- var search = props.search || query;
28
-
14
+ let search = props.search || query;
29
15
  if (typeof search === "function") {
30
16
  search = search(query);
31
17
  }
32
-
33
18
  dataList.setSearch(search);
34
19
  }, 250)
35
20
  };
36
21
  };
37
22
 
38
- exports.useAutocomplete = useAutocomplete;
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,eAAkB,CAACC,KAAD,EAAuC;EAClE,IAAMC,QAAQ,GAAG,IAAAC,wBAAA;IAAcC,SAAS,EAAE;EAAzB,GAAmCH,KAAnC,EAAjB;EAEA,OAAO;IACHI,OAAO,EAAEH,QAAQ,CAACI,IAAT,IAAiB,EADvB;IAEHC,OAAO,EAAE,wBAAS,UAAAC,KAAK,EAAI;MACvB,IAAI,CAACA,KAAL,EAAY;QACR;MACH;;MAED,IAAIC,MAAM,GAAGR,KAAK,CAACQ,MAAN,IAAgBD,KAA7B;;MACA,IAAI,OAAOC,MAAP,KAAkB,UAAtB,EAAkC;QAC9BA,MAAM,GAAGA,MAAM,CAACD,KAAD,CAAf;MACH;;MAEDN,QAAQ,CAACQ,SAAT,CAAmBD,MAAnB;IACH,CAXQ,EAWN,GAXM;EAFN,CAAP;AAeH,CAlBM"}
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,16 +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
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _searchDataByKey = _interopRequireDefault(require("./searchDataByKey"));
11
-
12
- var _default = function _default(response) {
13
- return (0, _searchDataByKey.default)("data", response);
14
- };
15
-
16
- 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;;eAEe,kBAACA,QAAD;EAAA,OAAsC,IAAAC,wBAAA,EAAgB,MAAhB,EAAwBD,QAAxB,CAAtC;AAAA,C"}
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,16 +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
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _searchDataByKey = _interopRequireDefault(require("./searchDataByKey"));
11
-
12
- var _default = function _default(response) {
13
- return (0, _searchDataByKey.default)("error", response);
14
- };
15
-
16
- 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;;eAEe,kBAACA,QAAD;EAAA,OAAsC,IAAAC,wBAAA,EAAgB,OAAhB,EAAyBD,QAAzB,CAAtC;AAAA,C"}
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,16 +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
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _searchDataByKey = _interopRequireDefault(require("./searchDataByKey"));
11
-
12
- var _default = function _default(response) {
13
- return (0, _searchDataByKey.default)("meta", response);
14
- };
15
-
16
- 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;;eAEe,kBAACA,QAAD;EAAA,OAAsC,IAAAC,wBAAA,EAAgB,MAAhB,EAAwBD,QAAxB,CAAtC;AAAA,C"}
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,31 +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
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- Object.defineProperty(exports, "getData", {
9
- enumerable: true,
10
- get: function get() {
11
- return _getData.default;
12
- }
13
- });
14
- Object.defineProperty(exports, "getError", {
15
- enumerable: true,
16
- get: function get() {
17
- return _getError.default;
18
- }
19
- });
20
- Object.defineProperty(exports, "getMeta", {
21
- enumerable: true,
22
- get: function get() {
23
- return _getMeta.default;
24
- }
25
- });
26
-
27
- var _getData = _interopRequireDefault(require("./getData"));
28
-
29
- var _getError = _interopRequireDefault(require("./getError"));
30
-
31
- 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,29 +1,18 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var searchDataByKey = function searchDataByKey(searchKey, object) {
1
+ const searchDataByKey = (searchKey, object) => {
9
2
  if (!object || typeof object !== "object") {
10
3
  return null;
11
4
  }
12
-
13
5
  if (object[searchKey]) {
14
6
  return object[searchKey];
15
7
  }
16
-
17
- for (var key in object) {
18
- var value = searchDataByKey(searchKey, object[key]);
19
-
8
+ for (const key in object) {
9
+ const value = searchDataByKey(searchKey, object[key]);
20
10
  if (value) {
21
11
  return value;
22
12
  }
23
13
  }
24
-
25
14
  return null;
26
15
  };
16
+ export default searchDataByKey;
27
17
 
28
- var _default = searchDataByKey;
29
- exports.default = _default;
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,eAAkB,CAACC,SAAD,EAAoBC,MAApB,EAAmE;EACvF,IAAI,CAACA,MAAD,IAAW,OAAOA,MAAP,KAAkB,QAAjC,EAA2C;IACvC,OAAO,IAAP;EACH;;EAED,IAAIA,MAAM,CAACD,SAAD,CAAV,EAAuB;IACnB,OAAOC,MAAM,CAACD,SAAD,CAAb;EACH;;EAED,KAAK,IAAME,GAAX,IAAkBD,MAAlB,EAA0B;IACtB,IAAME,KAAK,GAAGJ,eAAe,CAACC,SAAD,EAAYC,MAAM,CAACC,GAAD,CAAlB,CAA7B;;IACA,IAAIC,KAAJ,EAAW;MACP,OAAOA,KAAP;IACH;EACJ;;EAED,OAAO,IAAP;AACH,CAjBD;;eAmBeJ,e"}
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,13 +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
-
13
- 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;