@webiny/app 6.0.0-alpha.0 → 6.0.0-alpha.2

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 (57) hide show
  1. package/App.d.ts +2 -2
  2. package/App.js.map +1 -1
  3. package/apollo-client/InMemoryCache.d.ts +3 -2
  4. package/apollo-client/InMemoryCache.js.map +1 -1
  5. package/apollo-client/IntrospectionFragmentMatcher.d.ts +2 -2
  6. package/apollo-client/IntrospectionFragmentMatcher.js.map +1 -1
  7. package/components/Image.d.ts +1 -1
  8. package/components/Image.js.map +1 -1
  9. package/components/Routes.js.map +1 -1
  10. package/contexts/Ui/index.js.map +1 -1
  11. package/core/Plugin.d.ts +1 -1
  12. package/core/Plugin.js.map +1 -1
  13. package/core/Provider.d.ts +1 -1
  14. package/core/Provider.js.map +1 -1
  15. package/core/Routes.js.map +1 -1
  16. package/core/createProvider.d.ts +2 -2
  17. package/core/createProvider.js.map +1 -1
  18. package/core/createProviderPlugin.d.ts +1 -1
  19. package/core/createProviderPlugin.js.map +1 -1
  20. package/hooks/useAutocomplete/useAutocomplete.d.ts +1 -1
  21. package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
  22. package/hooks/useDataList/useDataList.d.ts +2 -2
  23. package/hooks/useDataList/useDataList.js.map +1 -1
  24. package/hooks/useUi.d.ts +1 -1
  25. package/hooks/useUi.js.map +1 -1
  26. package/index.d.ts +1 -1
  27. package/index.js +1 -1
  28. package/index.js.map +1 -1
  29. package/package.json +10 -10
  30. package/plugins/AddQuerySelectionPlugin.d.ts +1 -1
  31. package/plugins/AddQuerySelectionPlugin.js +0 -1
  32. package/plugins/AddQuerySelectionPlugin.js.map +1 -1
  33. package/plugins/ApolloDynamicLink.d.ts +3 -2
  34. package/plugins/ApolloDynamicLink.js.map +1 -1
  35. package/plugins/ApolloLinkPlugin.d.ts +1 -1
  36. package/plugins/ApolloLinkPlugin.js.map +1 -1
  37. package/plugins/ConsoleLinkPlugin.js.map +1 -1
  38. package/plugins/LocaleHeaderLinkPlugin.d.ts +1 -1
  39. package/plugins/LocaleHeaderLinkPlugin.js.map +1 -1
  40. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +1 -1
  41. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
  42. package/plugins/RoutePlugin.d.ts +1 -1
  43. package/plugins/RoutePlugin.js.map +1 -1
  44. package/plugins/TenantHeaderLinkPlugin.d.ts +1 -1
  45. package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
  46. package/plugins/ViewPlugin.d.ts +1 -1
  47. package/plugins/ViewPlugin.js.map +1 -1
  48. package/plugins/image.d.ts +1 -1
  49. package/plugins/image.js.map +1 -1
  50. package/plugins/index.d.ts +2 -2
  51. package/plugins/index.js.map +1 -1
  52. package/renderApp.d.ts +1 -1
  53. package/renderApp.js.map +1 -1
  54. package/types.d.ts +3 -3
  55. package/types.js.map +1 -1
  56. package/utils/legacyPluginToReactComponent.d.ts +1 -1
  57. package/utils/legacyPluginToReactComponent.js.map +1 -1
package/App.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { RouteProps } from "@webiny/react-router";
3
- import { GenericComponent, Decorator, DecoratorsCollection } from "@webiny/react-composition";
2
+ import type { RouteProps } from "@webiny/react-router";
3
+ import type { GenericComponent, Decorator, DecoratorsCollection } from "@webiny/react-composition";
4
4
  interface State {
5
5
  plugins: JSX.Element[];
6
6
  providers: Decorator<GenericComponent<ProviderProps>>[];
package/App.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["React","createContext","useContext","useMemo","useState","useCallback","BrowserRouter","Route","CompositionProvider","compose","Routes","SortRoutes","DebounceRender","PluginsProvider","RouterWithConfig","useRouterConfig","AppContainer","AppContext","undefined","displayName","useApp","appContext","Error","AppBase","debounceRender","routes","providers","children","state","setState","plugins","addProvider","component","findIndex","m","addPlugin","element","AppRouter","routerConfig","combinedRoutes","map","r","createElement","path","key","length","Providers","wait","Provider","value","App","decorators","props","Object","assign"],"sources":["App.tsx"],"sourcesContent":["import React, { createContext, useContext, useMemo, useState, useCallback } from \"react\";\nimport { BrowserRouter, RouteProps, Route } from \"@webiny/react-router\";\nimport {\n CompositionProvider,\n GenericComponent,\n compose,\n Decorator,\n DecoratorsCollection\n} from \"@webiny/react-composition\";\nimport { Routes as SortRoutes } from \"./core/Routes\";\nimport { DebounceRender } from \"./core/DebounceRender\";\nimport { PluginsProvider } from \"./core/Plugins\";\nimport { RouterWithConfig, useRouterConfig } from \"./config/RouterConfig\";\nimport { AppContainer } from \"./AppContainer\";\n\ninterface State {\n plugins: JSX.Element[];\n providers: Decorator<GenericComponent<ProviderProps>>[];\n}\n\ninterface AppContext extends State {\n addProvider(hoc: Decorator<GenericComponent<ProviderProps>>): void;\n\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<Decorator<GenericComponent<ProviderProps>>>;\n decorators?: DecoratorsCollection;\n children?: React.ReactNode | React.ReactNode[];\n}\n\ninterface ProviderProps {\n children: React.ReactNode;\n}\n\ntype ComponentWithChildren = React.ComponentType<{ children?: React.ReactNode }>;\n\nexport const AppBase = ({\n debounceRender = 50,\n routes = [],\n providers = [],\n children\n}: AppProps) => {\n const [state, setState] = useState<State>({\n plugins: [],\n providers\n });\n\n const addProvider = useCallback((component: Decorator<any>) => {\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: JSX.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 addProvider,\n addPlugin\n }),\n [state]\n );\n\n const AppRouter = useMemo(() => {\n return function AppRouter() {\n const routerConfig = useRouterConfig();\n const combinedRoutes = [...routes, ...routerConfig.routes].map(r => {\n return <Route path={r.path} element={r.element} key={r.path} />;\n });\n\n return <SortRoutes key={routes.length} routes={combinedRoutes} />;\n };\n }, [routes]);\n\n const Providers = useMemo(() => {\n return compose(...(state.providers || []))(({ children }: ProviderProps) => {\n return <DebounceRender wait={debounceRender}>{children}</DebounceRender>;\n });\n }, [state.providers.length]) as ComponentWithChildren;\n\n Providers.displayName = \"Providers\";\n\n return (\n <AppContext.Provider value={appContext}>\n {children}\n <AppContainer>\n <BrowserRouter>\n <Providers>\n <PluginsProvider>{state.plugins}</PluginsProvider>\n <DebounceRender wait={debounceRender}>\n <RouterWithConfig>\n <AppRouter />\n </RouterWithConfig>\n </DebounceRender>\n </Providers>\n </BrowserRouter>\n </AppContainer>\n </AppContext.Provider>\n );\n};\n\nexport const App = ({ decorators, ...props }: AppProps) => {\n return (\n <CompositionProvider decorators={decorators}>\n <AppBase decorators={decorators} {...props} />\n </CompositionProvider>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,UAAU,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,WAAW,QAAQ,OAAO;AACxF,SAASC,aAAa,EAAcC,KAAK,QAAQ,sBAAsB;AACvE,SACIC,mBAAmB,EAEnBC,OAAO,QAGJ,2BAA2B;AAClC,SAASC,MAAM,IAAIC,UAAU;AAC7B,SAASC,cAAc;AACvB,SAASC,eAAe;AACxB,SAASC,gBAAgB,EAAEC,eAAe;AAC1C,SAASC,YAAY;AAarB,MAAMC,UAAU,gBAAGhB,aAAa,CAAyBiB,SAAS,CAAC;AAEnED,UAAU,CAACE,WAAW,GAAG,YAAY;AAErC,OAAO,MAAMC,MAAM,GAAGA,CAAA,KAAM;EACxB,MAAMC,UAAU,GA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AAA,CAAC9B,cAAc;IAACmC,IAAI,EAAEvB;EAAe,gBACjCxB,KAAA,CAAA0C,aAAA,CAAC5B,gBAAgB,qBACbd,KAAA,CAAA0C,aAAA,CAACL,SAAS,MAAE,CACE,CACN,CACT,CACA,CACL,CACG,CAAC;AAE9B,CAAC;AAED,OAAO,MAAMa,GAAG,GAAGA,CAAC;EAAEC,UAAU;EAAE,GAAGC;AAAgB,CAAC,KAAK;EACvD,oBACIpD,KAAA,CAAA0C,aAAA,CAAClC,mBAAmB;IAAC2C,UAAU,EAAEA;EAAW,gBACxCnD,KAAA,CAAA0C,aAAA,CAACnB,OAAO,EAAA8B,MAAA,CAAAC,MAAA;IAACH,UAAU,EAAEA;EAAW,GAAKC,KAAK,CAAG,CAC5B,CAAC;AAE9B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","createContext","useContext","useMemo","useState","useCallback","BrowserRouter","Route","CompositionProvider","compose","Routes","SortRoutes","DebounceRender","PluginsProvider","RouterWithConfig","useRouterConfig","AppContainer","AppContext","undefined","displayName","useApp","appContext","Error","AppBase","debounceRender","routes","providers","children","state","setState","plugins","addProvider","component","findIndex","m","addPlugin","element","AppRouter","routerConfig","combinedRoutes","map","r","createElement","path","key","length","Providers","wait","Provider","value","App","decorators","props","Object","assign"],"sources":["App.tsx"],"sourcesContent":["import React, { createContext, useContext, useMemo, useState, useCallback } from \"react\";\nimport type { RouteProps } from \"@webiny/react-router\";\nimport { BrowserRouter, Route } from \"@webiny/react-router\";\nimport type { GenericComponent, Decorator, DecoratorsCollection } from \"@webiny/react-composition\";\nimport { CompositionProvider, compose } from \"@webiny/react-composition\";\nimport { Routes as SortRoutes } from \"./core/Routes\";\nimport { DebounceRender } from \"./core/DebounceRender\";\nimport { PluginsProvider } from \"./core/Plugins\";\nimport { RouterWithConfig, useRouterConfig } from \"./config/RouterConfig\";\nimport { AppContainer } from \"./AppContainer\";\n\ninterface State {\n plugins: JSX.Element[];\n providers: Decorator<GenericComponent<ProviderProps>>[];\n}\n\ninterface AppContext extends State {\n addProvider(hoc: Decorator<GenericComponent<ProviderProps>>): void;\n\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<Decorator<GenericComponent<ProviderProps>>>;\n decorators?: DecoratorsCollection;\n children?: React.ReactNode | React.ReactNode[];\n}\n\ninterface ProviderProps {\n children: React.ReactNode;\n}\n\ntype ComponentWithChildren = React.ComponentType<{ children?: React.ReactNode }>;\n\nexport const AppBase = ({\n debounceRender = 50,\n routes = [],\n providers = [],\n children\n}: AppProps) => {\n const [state, setState] = useState<State>({\n plugins: [],\n providers\n });\n\n const addProvider = useCallback((component: Decorator<any>) => {\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: JSX.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 addProvider,\n addPlugin\n }),\n [state]\n );\n\n const AppRouter = useMemo(() => {\n return function AppRouter() {\n const routerConfig = useRouterConfig();\n const combinedRoutes = [...routes, ...routerConfig.routes].map(r => {\n return <Route path={r.path} element={r.element} key={r.path} />;\n });\n\n return <SortRoutes key={routes.length} routes={combinedRoutes} />;\n };\n }, [routes]);\n\n const Providers = useMemo(() => {\n return compose(...(state.providers || []))(({ children }: ProviderProps) => {\n return <DebounceRender wait={debounceRender}>{children}</DebounceRender>;\n });\n }, [state.providers.length]) as ComponentWithChildren;\n\n Providers.displayName = \"Providers\";\n\n return (\n <AppContext.Provider value={appContext}>\n {children}\n <AppContainer>\n <BrowserRouter>\n <Providers>\n <PluginsProvider>{state.plugins}</PluginsProvider>\n <DebounceRender wait={debounceRender}>\n <RouterWithConfig>\n <AppRouter />\n </RouterWithConfig>\n </DebounceRender>\n </Providers>\n </BrowserRouter>\n </AppContainer>\n </AppContext.Provider>\n );\n};\n\nexport const App = ({ decorators, ...props }: AppProps) => {\n return (\n <CompositionProvider decorators={decorators}>\n <AppBase decorators={decorators} {...props} />\n </CompositionProvider>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,UAAU,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,WAAW,QAAQ,OAAO;AAExF,SAASC,aAAa,EAAEC,KAAK,QAAQ,sBAAsB;AAE3D,SAASC,mBAAmB,EAAEC,OAAO,QAAQ,2BAA2B;AACxE,SAASC,MAAM,IAAIC,UAAU;AAC7B,SAASC,cAAc;AACvB,SAASC,eAAe;AACxB,SAASC,gBAAgB,EAAEC,eAAe;AAC1C,SAASC,YAAY;AAarB,MAAMC,UAAU,gBAAGhB,aAAa,CAAyBiB,SAAS,CAAC;AAEnED,UAAU,CAACE,WAAW,GAAG,YAAY;AAErC,OAAO,MAAMC,MAAM,GAAGA,CAAA,KAAM;EACxB,MAAMC,UAAU,GAAGnB,UAAU,CAACe,UAAU,CAAC;EACzC,IAAI,CAACI,UAAU,EAAE;IACb,MAAMC,KAAK,CACP,0FACJ,CAAC;EACL;EACA,OAAOD,UAAU;AACrB,CAAC;AAgBD,OAAO,MAAME,OAAO,GAAGA,CAAC;EACpBC,cAAc,GAAG,EAAE;EACnBC,MAAM,GAAG,EAAE;EACXC,SAAS,GAAG,EAAE;EACdC;AACM,CAAC,KAAK;EACZ,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGzB,QAAQ,CAAQ;IACtC0B,OAAO,EAAE,EAAE;IACXJ;EACJ,CAAC,CAAC;EAEF,MAAMK,WAAW,GAAG1B,WAAW,CAAE2B,SAAyB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AEA;EAAW,GAAKC,KAAK,CAAG,CAC5B,CAAC;AAE9B,CAAC","ignoreList":[]}
@@ -1,5 +1,6 @@
1
- import { InMemoryCache as BaseInMemoryCache, InMemoryCacheConfig } from "apollo-cache-inmemory";
2
- import { DocumentNode } from "graphql";
1
+ import type { InMemoryCacheConfig } from "apollo-cache-inmemory";
2
+ import { InMemoryCache as BaseInMemoryCache } from "apollo-cache-inmemory";
3
+ import type { DocumentNode } from "graphql";
3
4
  export declare class InMemoryCache extends BaseInMemoryCache {
4
5
  private readonly transformPlugins;
5
6
  constructor(config?: InMemoryCacheConfig);
@@ -1 +1 @@
1
- {"version":3,"names":["InMemoryCache","BaseInMemoryCache","plugins","AddQuerySelectionPlugin","ApolloLinkPlugin","constructor","config","transformPlugins","byType","type","filter","pl","transformDocument","document","operationName","definitions","name","value","addSelectionToQuery"],"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,SAASA,aAAa,IAAIC,iBAAiB,QAA6B,uBAAuB;AAE/F,SAASC,OAAO,QAAQ,iBAAiB;AACzC,SAASC,uBAAuB;AAChC,SAASC,gBAAgB;AAEzB,OAAO,MAAMJ,aAAa,SAASC,iBAAiB,CAAC;EAGjDI,WAAWA,CAACC,MAA4B,EAAE;IACtC,KAAK,CAACA,MAAM,CAAC;IAEb,IAAI,CAACC,gBAAgB,GAAGL,OAAO,CAC1BM,MAAM,CAA0BJ,gBAAgB,CAACK,IAAI,CAAC,CACtDC,MAAM,CAACC,EAAE,IAAIA,EAAE,YAAYR,uBAAuB,CAAC;EAC5D;EAEgBS,iBAAiBA,CAACC,QAAsB,EAAgB;IACpE;IACA,MAAMC,aAAa,GAAGD,QAAQ,CAACE,WAAW,CAAC,CAAC,CAAC,CAACC,IAAI,CAACC,KAAK;IAExD,KAAK,MAAMN,EAAE,IAAI,IAAI,CAACJ,gBAAgB,EAAE;MACpCI,EAAE,CAACO,mBAAmB,CAACJ,aAAa,EAAED,QAAQ,CAAC;IACnD;IAEA,OAAO,KAAK,CAACD,iBAAiB,CAACC,QAAQ,CAAC;EAC5C;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["InMemoryCache","BaseInMemoryCache","plugins","AddQuerySelectionPlugin","ApolloLinkPlugin","constructor","config","transformPlugins","byType","type","filter","pl","transformDocument","document","operationName","definitions","name","value","addSelectionToQuery"],"sources":["InMemoryCache.ts"],"sourcesContent":["import type { InMemoryCacheConfig } from \"apollo-cache-inmemory\";\nimport { InMemoryCache as BaseInMemoryCache } from \"apollo-cache-inmemory\";\nimport type { 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":"AACA,SAASA,aAAa,IAAIC,iBAAiB,QAAQ,uBAAuB;AAE1E,SAASC,OAAO,QAAQ,iBAAiB;AACzC,SAASC,uBAAuB;AAChC,SAASC,gBAAgB;AAEzB,OAAO,MAAMJ,aAAa,SAASC,iBAAiB,CAAC;EAGjDI,WAAWA,CAACC,MAA4B,EAAE;IACtC,KAAK,CAACA,MAAM,CAAC;IAEb,IAAI,CAACC,gBAAgB,GAAGL,OAAO,CAC1BM,MAAM,CAA0BJ,gBAAgB,CAACK,IAAI,CAAC,CACtDC,MAAM,CAACC,EAAE,IAAIA,EAAE,YAAYR,uBAAuB,CAAC;EAC5D;EAEgBS,iBAAiBA,CAACC,QAAsB,EAAgB;IACpE;IACA,MAAMC,aAAa,GAAGD,QAAQ,CAACE,WAAW,CAAC,CAAC,CAAC,CAACC,IAAI,CAACC,KAAK;IAExD,KAAK,MAAMN,EAAE,IAAI,IAAI,CAACJ,gBAAgB,EAAE;MACpCI,EAAE,CAACO,mBAAmB,CAACJ,aAAa,EAAED,QAAQ,CAAC;IACnD;IAEA,OAAO,KAAK,CAACD,iBAAiB,CAACC,QAAQ,CAAC;EAC5C;AACJ","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import { IdValue } from "apollo-utilities";
2
- import { ReadStoreContext, FragmentMatcherInterface, IntrospectionResultData } from "apollo-cache-inmemory";
1
+ import type { IdValue } from "apollo-utilities";
2
+ import type { ReadStoreContext, FragmentMatcherInterface, IntrospectionResultData } from "apollo-cache-inmemory";
3
3
  export declare class IntrospectionFragmentMatcher implements FragmentMatcherInterface {
4
4
  private readonly isReady;
5
5
  private readonly possibleTypesMap;
@@ -1 +1 @@
1
- {"version":3,"names":["invariant","IntrospectionFragmentMatcher","possibleTypesMap","constructor","options","introspectionQueryResultData","parseIntrospectionResult","isReady","match","bind","idValue","typeCondition","context","obj","store","get","id","isRootQuery","__typename","JSON","stringify","implementingTypes","indexOf","introspectionResultData","typeMap","__schema","types","forEach","type","kind","name","possibleTypes","map","implementingType"],"sources":["IntrospectionFragmentMatcher.ts"],"sourcesContent":["import { IdValue } from \"apollo-utilities\";\nimport { invariant } from \"ts-invariant\";\n\nimport {\n ReadStoreContext,\n FragmentMatcherInterface,\n PossibleTypesMap,\n IntrospectionResultData\n} from \"apollo-cache-inmemory\";\n\nexport class IntrospectionFragmentMatcher implements FragmentMatcherInterface {\n private readonly isReady: boolean;\n private readonly possibleTypesMap: PossibleTypesMap = {};\n\n constructor(options?: { introspectionQueryResultData?: IntrospectionResultData }) {\n if (options && options.introspectionQueryResultData) {\n this.possibleTypesMap = this.parseIntrospectionResult(\n options.introspectionQueryResultData\n );\n this.isReady = true;\n } else {\n this.isReady = false;\n }\n\n this.match = this.match.bind(this);\n }\n\n public match(idValue: IdValue, typeCondition: string, context: ReadStoreContext) {\n invariant(this.isReady, \"FragmentMatcher.match() was called before FragmentMatcher.init()\");\n\n const obj = context.store.get(idValue.id);\n const isRootQuery = idValue.id === \"ROOT_QUERY\";\n\n if (!obj) {\n // https://github.com/apollographql/apollo-client/pull/4620\n return isRootQuery;\n }\n\n const { __typename = isRootQuery && \"Query\" } = obj;\n\n invariant(\n __typename,\n `Cannot match fragment because __typename property is missing: ${JSON.stringify(obj)}`\n );\n\n if (__typename === typeCondition) {\n return true;\n }\n\n const implementingTypes = this.possibleTypesMap[typeCondition];\n if (__typename && implementingTypes && implementingTypes.indexOf(__typename) > -1) {\n return true;\n }\n\n return false;\n }\n\n private parseIntrospectionResult(\n introspectionResultData: IntrospectionResultData\n ): PossibleTypesMap {\n const typeMap: PossibleTypesMap = {};\n introspectionResultData.__schema.types.forEach(type => {\n if (type.kind === \"UNION\" || type.kind === \"INTERFACE\") {\n typeMap[type.name] = type.possibleTypes.map(\n implementingType =>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OAAO,IAAI;IACf;IAEA,OAAO,KAAK;EAChB;EAEQZ,wBAAwBA,CAC5BiB,uBAAgD,EAChC;IAChB,MAAMC,OAAyB,GAAG,CAAC,CAAC;IACpCD,uBAAuB,CAACE,QAAQ,CAACC,KAAK,CAACC,OAAO,CAACC,IAAI,IAAI;MACnD,IAAIA,IAAI,CAACC,IAAI,KAAK,OAAO,IAAID,IAAI,CAACC,IAAI,KAAK,WAAW,EAAE;QACpDL,OAAO,CAACI,IAAI,CAACE,IAAI,CAAC,GAAGF,IAAI,CAACG,aAAa,CAACC,GAAG,CACvCC,gBAAgB,IAAIA,gBAAgB,CAACH,IACzC,CAAC;MACL;IACJ,CAAC,CAAC;IACF,OAAON,OAAO;EAClB;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["invariant","IntrospectionFragmentMatcher","possibleTypesMap","constructor","options","introspectionQueryResultData","parseIntrospectionResult","isReady","match","bind","idValue","typeCondition","context","obj","store","get","id","isRootQuery","__typename","JSON","stringify","implementingTypes","indexOf","introspectionResultData","typeMap","__schema","types","forEach","type","kind","name","possibleTypes","map","implementingType"],"sources":["IntrospectionFragmentMatcher.ts"],"sourcesContent":["import type { IdValue } from \"apollo-utilities\";\nimport { invariant } from \"ts-invariant\";\n\nimport type {\n ReadStoreContext,\n FragmentMatcherInterface,\n PossibleTypesMap,\n IntrospectionResultData\n} from \"apollo-cache-inmemory\";\n\nexport class IntrospectionFragmentMatcher implements FragmentMatcherInterface {\n private readonly isReady: boolean;\n private readonly possibleTypesMap: PossibleTypesMap = {};\n\n constructor(options?: { introspectionQueryResultData?: IntrospectionResultData }) {\n if (options && options.introspectionQueryResultData) {\n this.possibleTypesMap = this.parseIntrospectionResult(\n options.introspectionQueryResultData\n );\n this.isReady = true;\n } else {\n this.isReady = false;\n }\n\n this.match = this.match.bind(this);\n }\n\n public match(idValue: IdValue, typeCondition: string, context: ReadStoreContext) {\n invariant(this.isReady, \"FragmentMatcher.match() was called before FragmentMatcher.init()\");\n\n const obj = context.store.get(idValue.id);\n const isRootQuery = idValue.id === \"ROOT_QUERY\";\n\n if (!obj) {\n // https://github.com/apollographql/apollo-client/pull/4620\n return isRootQuery;\n }\n\n const { __typename = isRootQuery && \"Query\" } = obj;\n\n invariant(\n __typename,\n `Cannot match fragment because __typename property is missing: ${JSON.stringify(obj)}`\n );\n\n if (__typename === typeCondition) {\n return true;\n }\n\n const implementingTypes = this.possibleTypesMap[typeCondition];\n if (__typename && implementingTypes && implementingTypes.indexOf(__typename) > -1) {\n return true;\n }\n\n return false;\n }\n\n private parseIntrospectionResult(\n introspectionResultData: IntrospectionResultData\n ): PossibleTypesMap {\n const typeMap: PossibleTypesMap = {};\n introspectionResultData.__schema.types.forEach(type => {\n if (type.kind === \"UNION\" || type.kind === \"INTERFACE\") {\n typeMap[type.name] = type.possibleTypes.map(\n implementingType => implementingType.name\n );\n }\n });\n return typeMap;\n }\n}\n"],"mappings":"AACA,SAASA,SAAS,QAAQ,cAAc;AASxC,OAAO,MAAMC,4BAA4B,CAAqC;EAEzDC,gBAAgB,GAAqB,CAAC,CAAC;EAExDC,WAAWA,CAACC,OAAoE,EAAE;IAC9E,IAAIA,OAAO,IAAIA,OAAO,CAACC,4BAA4B,EAAE;MACjD,IAAI,CAACH,gBAAgB,GAAG,IAAI,CAACI,wBAAwB,CACjDF,OAAO,CAACC,4BACZ,CAAC;MACD,IAAI,CAACE,OAAO,GAAG,IAAI;IACvB,CAAC,MAAM;MACH,IAAI,CAACA,OAAO,GAAG,KAAK;IACxB;IAEA,IAAI,CAACC,KAAK,GAAG,IAAI,CAACA,KAAK,CAACC,IAAI,CAAC,IAAI,CAAC;EACtC;EAEOD,KAAKA,CAACE,OAAgB,EAAEC,aAAqB,EAAEC,OAAyB,EAAE;IAC7EZ,SAAS,CAAC,IAAI,CAACO,OAAO,EAAE,kEAAkE,CAAC;IAE3F,MAAMM,GAAG,GAAGD,OAAO,CAACE,KAAK,CAACC,GAAG,CAACL,OAAO,CAACM,EAAE,CAAC;IACzC,MAAMC,WAAW,GAAGP,OAAO,CAACM,EAAE,KAAK,YAAY;IAE/C,IAAI,CAACH,GAAG,EAAE;MACN;MACA,OAAOI,WAAW;IACtB;IAEA,MAAM;MAAEC,UAAU,GAAGD,WAAW,IAAI;IAAQ,CAAC,GAAGJ,GAAG;IAEnDb,SAAS,CACLkB,UAAU,EACV,iEAAiEC,IAAI,CAACC,SAAS,CAACP,GAAG,CAAC,EACxF,CAAC;IAED,IAAIK,UAAU,KAAKP,aAAa,EAAE;MAC9B,OAAO,IAAI;IACf;IAEA,MAAMU,iBAAiB,GAAG,IAAI,CAACnB,gBAAgB,CAACS,aAAa,CAAC;IAC9D,IAAIO,UAAU,IAAIG,iBAAiB,IAAIA,iBAAiB,CAACC,OAAO,CAACJ,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE;MAC/E,OAAO,IAAI;IACf;IAEA,OAAO,KAAK;EAChB;EAEQZ,wBAAwBA,CAC5BiB,uBAAgD,EAChC;IAChB,MAAMC,OAAyB,GAAG,CAAC,CAAC;IACpCD,uBAAuB,CAACE,QAAQ,CAACC,KAAK,CAACC,OAAO,CAACC,IAAI,IAAI;MACnD,IAAIA,IAAI,CAACC,IAAI,KAAK,OAAO,IAAID,IAAI,CAACC,IAAI,KAAK,WAAW,EAAE;QACpDL,OAAO,CAACI,IAAI,CAACE,IAAI,CAAC,GAAGF,IAAI,CAACG,aAAa,CAACC,GAAG,CACvCC,gBAAgB,IAAIA,gBAAgB,CAACH,IACzC,CAAC;MACL;IACJ,CAAC,CAAC;IACF,OAAON,OAAO;EAClB;AACJ","ignoreList":[]}
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- import { ImageProps } from "../types";
2
+ import type { ImageProps } from "../types";
3
3
  export declare const Image: ({ preset: presetName, ...props }: ImageProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
@@ -1 +1 @@
1
- {"version":3,"names":["invariant","plugins","get","Image","preset","presetName","props","plugin","byName","Error","transform","src","getImageSrc","render"],"sources":["Image.tsx"],"sourcesContent":["import invariant from \"invariant\";\nimport { plugins } from \"@webiny/plugins\";\nimport get from \"lodash/get\";\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,OAAOA,SAAS,MAAM,WAAW;AACjC,SAASC,OAAO,QAAQ,iBAAiB;AACzC,OAAOC,GAAG,MAAM,YAAY;AAG5B,OAAO,MAAMC,KAAK,GAAGA,CAAC;EAAEC,MAAM,EAAEC,UAAU;EAAE,GAAGC;AAAkB,CAAC,KAAK;EACnE,MAAMC,MAAM,GAAGN,OAAO,CAACO,MAAM,CAAuB,iBAAiB,CAAC;EACtE,IAAI,CAACD,MAAM,EAAE;IACT,MAAM,IAAIE,KAAK,CAAC,8DAA8D,CAAC;EACnF;EAEA,IAAIJ,UAAU,EAAE;IACZ,MAAMD,MAAM,GAAGF,GAAG,CAACK,MAAM,EAAE,WAAWF,UAAU,EAAE,CAAC;IACnDL,SAAS,CAACI,MAAM,EAAE,qBAAqBC,UAAU,cAAc,CAAC;IAChEC,KAAK,CAACI,SAAS,GAAGN,MAAM;EAC5B;EAEA,IAAIE,KAAK,CAACI,SAAS,EAAE;IACjBJ,KAAK,CAACK,GAAG,GAAGJ,MAAM,CAACK,WAAW,CAACN,KAAK,CAAC;EACzC;EAEA,OAAOC,MAAM,CAACM,MAAM,CAACP,KAAK,CAAC;AAC/B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["invariant","plugins","get","Image","preset","presetName","props","plugin","byName","Error","transform","src","getImageSrc","render"],"sources":["Image.tsx"],"sourcesContent":["import invariant from \"invariant\";\nimport { plugins } from \"@webiny/plugins\";\nimport get from \"lodash/get\";\nimport type { 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,OAAOA,SAAS,MAAM,WAAW;AACjC,SAASC,OAAO,QAAQ,iBAAiB;AACzC,OAAOC,GAAG,MAAM,YAAY;AAG5B,OAAO,MAAMC,KAAK,GAAGA,CAAC;EAAEC,MAAM,EAAEC,UAAU;EAAE,GAAGC;AAAkB,CAAC,KAAK;EACnE,MAAMC,MAAM,GAAGN,OAAO,CAACO,MAAM,CAAuB,iBAAiB,CAAC;EACtE,IAAI,CAACD,MAAM,EAAE;IACT,MAAM,IAAIE,KAAK,CAAC,8DAA8D,CAAC;EACnF;EAEA,IAAIJ,UAAU,EAAE;IACZ,MAAMD,MAAM,GAAGF,GAAG,CAACK,MAAM,EAAE,WAAWF,UAAU,EAAE,CAAC;IACnDL,SAAS,CAACI,MAAM,EAAE,qBAAqBC,UAAU,cAAc,CAAC;IAChEC,KAAK,CAACI,SAAS,GAAGN,MAAM;EAC5B;EAEA,IAAIE,KAAK,CAACI,SAAS,EAAE;IACjBJ,KAAK,CAACK,GAAG,GAAGJ,MAAM,CAACK,WAAW,CAACN,KAAK,CAAC;EACzC;EAEA,OAAOC,MAAM,CAACM,MAAM,CAACP,KAAK,CAAC;AAC/B,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["React","plugins","Routes","ReactRouterRoutes","routes","byType","sort","a","b","pathA","route","props","path","pathB","includes","createElement","map","name","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":"AAAA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,OAAO,QAAQ,iBAAiB;AACzC,SAASC,MAAM,IAAIC,iBAAiB,QAAQ,sBAAsB;AAGlE,OAAO,MAAMD,MAAM,GAAGA,CAAA,KAAM;EACxB;EACA,MAAME,MAAM,GAAG,CAAC,GAAGH,OAAO,CAACI,MAAM,CAAc,OAAO,CAAC,CAAC,CAACC,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAK;IACpE,MAAMC,KAAK,GAAGF,CAAC,CAACG,KAAK,CAACC,KAAK,CAACC,IAAI,IAAI,GAAG;IACvC,MAAMC,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,oBACIb,KAAA,CAAAe,aAAA,CAACZ,iBAAiB,QACbC,MAAM,CAACY,GAAG,CAAC,CAAC;IAAEN,KAAK;IAAEO;EAAK,CAAC,kBAAKjB,KAAK,CAACkB,YAAY,CAACR,KAAK,EAAE;IAAES,GAAG,EAAEF;EAAK,CAAC,CAAC,CAC1D,CAAC;AAE5B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","plugins","Routes","ReactRouterRoutes","routes","byType","sort","a","b","pathA","route","props","path","pathB","includes","createElement","map","name","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 type { 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":"AAAA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,OAAO,QAAQ,iBAAiB;AACzC,SAASC,MAAM,IAAIC,iBAAiB,QAAQ,sBAAsB;AAGlE,OAAO,MAAMD,MAAM,GAAGA,CAAA,KAAM;EACxB;EACA,MAAME,MAAM,GAAG,CAAC,GAAGH,OAAO,CAACI,MAAM,CAAc,OAAO,CAAC,CAAC,CAACC,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAK;IACpE,MAAMC,KAAK,GAAGF,CAAC,CAACG,KAAK,CAACC,KAAK,CAACC,IAAI,IAAI,GAAG;IACvC,MAAMC,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,oBACIb,KAAA,CAAAe,aAAA,CAACZ,iBAAiB,QACbC,MAAM,CAACY,GAAG,CAAC,CAAC;IAAEN,KAAK;IAAEO;EAAK,CAAC,kBAAKjB,KAAK,CAACkB,YAAY,CAACR,KAAK,EAAE;IAAES,GAAG,EAAEF;EAAK,CAAC,CAAC,CAC1D,CAAC;AAE5B,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["React","plugins","UiContext","createContext","UiProvider","Component","state","ui","setData","setter","setState","render","value","uiStatePlugins","byType","createElement","Provider","map","pl","cloneElement","key","name","props","children"],"sources":["index.tsx"],"sourcesContent":["import React from \"react\";\nimport { 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,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,OAAO,QAAQ,iBAAiB;AAEzC,OAAO,MAAMC,SAAS,gBAAGF,KAAK,CAACG,aAAa,CAAsB,CAAC,CAAC,CAAC;AAqBrE,OAAO,MAAMC,UAAU,SAASJ,KAAK,CAACK,SAAS,CAAe;EAC1CC,KAAK,GAAU;IAC3BC,EAAE,EAAE,CAAC;EACT,CAAC;EAEgBC,OAAO,GAAIC,MAAoB,IAAW;IACvD,OAAO,IAAI,CAACC,QAAQ,CAAEJ,KAAY,IAAK;MACnC,OAAO;QAAEC,EAAE,EAAE;UAAE,GAAGD,KAAK,CAACC,EAAE;UAAE,GAAGE,MAAM,CAACH,KAAK,CAACC,EAAE;QAAE;MAAE,CAAC;IACvD,CAAC,CAAC;EACN,CAAC;EAEeI,MAAMA,CAAA,EAAG;IACrB,MAAMC,KAAqB,GAAG;MAAE,GAAG,IAAI,CAACN,KAAK,CAACC,EAAE;MAAEG,QAAQ,EAAE,IAAI,CAACF;IAAQ,CAAC;IAC1E,MAAMK,cAAc,GAAGZ,OAAO,CAACa,MAAM,CAAgB,UAAU,CAAC;IAChE,oBACId,KAAA,CAAAe,aAAA,CAACb,SAAS,CAACc,QAAQ;MAACJ,KAAK,EAAEA;IAAM,GAC5BC,cAAc,CAACI,GAAG,CAACC,EAAE,iBAAIlB,KAAK,CAACmB,YAAY,CAACD,EAAE,CAACP,MAAM,CAAC,CAAC,EAAE;MAAES,GAAG,EAAEF,EAAE,CAACG;IAAK,CAAC,CAAC,CAAC,EAC3E,IAAI,CAACC,KAAK,CAACC,QACI,CAAC;EAE7B;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["React","plugins","UiContext","createContext","UiProvider","Component","state","ui","setData","setter","setState","render","value","uiStatePlugins","byType","createElement","Provider","map","pl","cloneElement","key","name","props","children"],"sources":["index.tsx"],"sourcesContent":["import React from \"react\";\nimport type { UiStatePlugin } from \"~/types\";\nimport { plugins } from \"@webiny/plugins\";\n\nexport const UiContext = React.createContext<Record<string, any>>({});\n\ntype Props = Record<string, any>;\n\ntype State = {\n ui: { [key: string]: any };\n};\n\ninterface UiData {\n [key: string]: any;\n}\n\ninterface UiDataSetter {\n (ui: UiData): UiData;\n}\n\nexport interface UiContextValue {\n setState: (setter: UiDataSetter) => void;\n [key: string]: any;\n}\n\nexport class UiProvider extends React.Component<Props, State> {\n public override state: State = {\n ui: {}\n };\n\n private readonly setData = (setter: UiDataSetter): void => {\n return this.setState((state: State) => {\n return { ui: { ...state.ui, ...setter(state.ui) } };\n });\n };\n\n public override render() {\n const value: UiContextValue = { ...this.state.ui, setState: this.setData };\n const uiStatePlugins = plugins.byType<UiStatePlugin>(\"ui-state\");\n return (\n <UiContext.Provider value={value}>\n {uiStatePlugins.map(pl => React.cloneElement(pl.render(), { key: pl.name }))}\n {this.props.children}\n </UiContext.Provider>\n );\n }\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,OAAO,QAAQ,iBAAiB;AAEzC,OAAO,MAAMC,SAAS,gBAAGF,KAAK,CAACG,aAAa,CAAsB,CAAC,CAAC,CAAC;AAqBrE,OAAO,MAAMC,UAAU,SAASJ,KAAK,CAACK,SAAS,CAAe;EAC1CC,KAAK,GAAU;IAC3BC,EAAE,EAAE,CAAC;EACT,CAAC;EAEgBC,OAAO,GAAIC,MAAoB,IAAW;IACvD,OAAO,IAAI,CAACC,QAAQ,CAAEJ,KAAY,IAAK;MACnC,OAAO;QAAEC,EAAE,EAAE;UAAE,GAAGD,KAAK,CAACC,EAAE;UAAE,GAAGE,MAAM,CAACH,KAAK,CAACC,EAAE;QAAE;MAAE,CAAC;IACvD,CAAC,CAAC;EACN,CAAC;EAEeI,MAAMA,CAAA,EAAG;IACrB,MAAMC,KAAqB,GAAG;MAAE,GAAG,IAAI,CAACN,KAAK,CAACC,EAAE;MAAEG,QAAQ,EAAE,IAAI,CAACF;IAAQ,CAAC;IAC1E,MAAMK,cAAc,GAAGZ,OAAO,CAACa,MAAM,CAAgB,UAAU,CAAC;IAChE,oBACId,KAAA,CAAAe,aAAA,CAACb,SAAS,CAACc,QAAQ;MAACJ,KAAK,EAAEA;IAAM,GAC5BC,cAAc,CAACI,GAAG,CAACC,EAAE,iBAAIlB,KAAK,CAACmB,YAAY,CAACD,EAAE,CAACP,MAAM,CAAC,CAAC,EAAE;MAAES,GAAG,EAAEF,EAAE,CAACG;IAAK,CAAC,CAAC,CAAC,EAC3E,IAAI,CAACC,KAAK,CAACC,QACI,CAAC;EAE7B;AACJ","ignoreList":[]}
package/core/Plugin.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { GenericComponent, Decorator } from "@webiny/react-composition";
2
+ import type { GenericComponent, Decorator } from "@webiny/react-composition";
3
3
  interface PluginProps {
4
4
  providers?: Decorator<GenericComponent>[];
5
5
  children?: React.ReactNode;
@@ -1 +1 @@
1
- {"version":3,"names":["React","Provider","Plugins","Plugin","memo","providers","children","createElement","Fragment","map","provider","index","key","hoc"],"sources":["Plugin.tsx"],"sourcesContent":["import React from \"react\";\nimport { Provider } from \"./Provider\";\nimport { Plugins } from \"./Plugins\";\nimport { GenericComponent, Decorator } from \"@webiny/react-composition\";\n\ninterface PluginProps {\n providers?: Decorator<GenericComponent>[];\n children?: React.ReactNode;\n}\n\nexport const Plugin = React.memo(function Plugin({ providers, children }: PluginProps) {\n return (\n <>\n {(providers || []).map((provider, index) => (\n <Provider key={index} hoc={provider} />\n ))}\n {children ? <Plugins>{children}</Plugins> : null}\n </>\n );\n});\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ;AACjB,SAASC,OAAO;AAQhB,OAAO,MAAMC,MAAM,gBAAGH,KAAK,CAACI,IAAI,CAAC,SAASD,MAAMA,CAAC;EAAEE,SAAS;EAAEC;AAAsB,CAAC,EAAE;EACnF,oBACIN,KAAA,CAAAO,aAAA,CAAAP,KAAA,CAAAQ,QAAA,QACK,CAACH,SAAS,IAAI,EAAE,EAAEI,GAAG,CAAC,CAACC,QAAQ,EAAEC,KAAK,kBACnCX,KAAA,CAAAO,aAAA,CAACN,QAAQ;IAACW,GAAG,EAAED,KAAM;IAACE,GAAG,EAAEH;EAAS,CAAE,CACzC,CAAC,EACDJ,QAAQ,gBAAGN,KAAA,CAAAO,aAAA,CAACL,OAAO,QAAEI,QAAkB,CAAC,GAAG,IAC9C,CAAC;AAEX,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","Provider","Plugins","Plugin","memo","providers","children","createElement","Fragment","map","provider","index","key","hoc"],"sources":["Plugin.tsx"],"sourcesContent":["import React from \"react\";\nimport { Provider } from \"./Provider\";\nimport { Plugins } from \"./Plugins\";\nimport type { GenericComponent, Decorator } from \"@webiny/react-composition\";\n\ninterface PluginProps {\n providers?: Decorator<GenericComponent>[];\n children?: React.ReactNode;\n}\n\nexport const Plugin = React.memo(function Plugin({ providers, children }: PluginProps) {\n return (\n <>\n {(providers || []).map((provider, index) => (\n <Provider key={index} hoc={provider} />\n ))}\n {children ? <Plugins>{children}</Plugins> : null}\n </>\n );\n});\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ;AACjB,SAASC,OAAO;AAQhB,OAAO,MAAMC,MAAM,gBAAGH,KAAK,CAACI,IAAI,CAAC,SAASD,MAAMA,CAAC;EAAEE,SAAS;EAAEC;AAAsB,CAAC,EAAE;EACnF,oBACIN,KAAA,CAAAO,aAAA,CAAAP,KAAA,CAAAQ,QAAA,QACK,CAACH,SAAS,IAAI,EAAE,EAAEI,GAAG,CAAC,CAACC,QAAQ,EAAEC,KAAK,kBACnCX,KAAA,CAAAO,aAAA,CAACN,QAAQ;IAACW,GAAG,EAAED,KAAM;IAACE,GAAG,EAAEH;EAAS,CAAE,CACzC,CAAC,EACDJ,QAAQ,gBAAGN,KAAA,CAAAO,aAAA,CAACL,OAAO,QAAEI,QAAkB,CAAC,GAAG,IAC9C,CAAC;AAEX,CAAC,CAAC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { GenericComponent, Decorator } from "../index";
1
+ import type { GenericComponent, Decorator } from "../index";
2
2
  export interface ProviderProps {
3
3
  hoc: Decorator<GenericComponent>;
4
4
  }
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useApp","Provider","hoc","addProvider"],"sources":["Provider.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { GenericComponent, Decorator, 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;AACjC,SAAsCC,MAAM;AAM5C;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":[]}
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":[]}
@@ -1 +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 { 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
+ {"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,5 +1,5 @@
1
- import React from "react";
2
- import { Decorator, GenericComponent } from "@webiny/react-composition";
1
+ import type React from "react";
2
+ import type { Decorator, GenericComponent } from "@webiny/react-composition";
3
3
  export interface ChildrenProps {
4
4
  children: React.ReactNode;
5
5
  }
@@ -1 +1 @@
1
- {"version":3,"names":["createProvider","decorator"],"sources":["createProvider.tsx"],"sourcesContent":["import React from \"react\";\nimport { 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
+ {"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,5 +1,5 @@
1
1
  import React from "react";
2
- import { GenericComponent, Decorator } from "@webiny/react-composition";
2
+ import type { GenericComponent, Decorator } from "@webiny/react-composition";
3
3
  /**
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.
@@ -1 +1 @@
1
- {"version":3,"names":["React","Provider","createProviderPlugin","decorator","ProviderPlugin","createElement","hoc"],"sources":["createProviderPlugin.tsx"],"sourcesContent":["import React from \"react\";\nimport { 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
+ {"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,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 +1 @@
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 { 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
+ {"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,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;
@@ -1 +1 @@
1
- {"version":3,"names":["useState","useEffect","useRef","useCallback","useQuery","useRouter","get","isEqual","prepareLoadListParams","getData","getError","getMeta","useDataList","params","multiSelectedItems","multiSelect","history","location","routerHook","getQueryOptions","variables","client","queryData","query","prevLoadParamsRef","dataListProps","data","meta","error","loading","init","refresh","refetch","__loadParams","setPerPage","perPage","preparedParams","limit","parseInt","after","undefined","before","setNextPage","cursor","setPreviousPage","setSearch","search","setWhere","where","setSorters","sort","items","value","Array","isArray","returnItems","forEach","item","includes","splice","indexOf","push","isSelected","URLSearchParams","id","select","set","toString","isMultiSelected","isNoneMultiSelected","length","getMultiSelected","multiSelectAll","isAllMultiSelected","prev","current"],"sources":["useDataList.ts"],"sourcesContent":["import { useState, useEffect, useRef, useCallback } from \"react\";\nimport { useQuery } from \"@apollo/react-hooks\";\nimport { useRouter } from \"@webiny/react-router\";\nimport get from \"lodash/get\";\nimport isEqual from \"lodash/isEqual\";\nimport { prepareLoadListParams } from \"./utils\";\nimport { getData, getError, getMeta } from \"./functions\";\n\nimport { DocumentNode } from \"graphql\";\nimport { ApolloClient } from \"apollo-client\";\n\nexport interface UseDataListParams {\n useRouter?: boolean;\n variables?: ((params: UseDataListParams) => any) | object;\n client?: ApolloClient<any>;\n query: DocumentNode;\n getData?: (data: any) => any;\n getMeta?: (data: any) => any;\n getError?: (data: any) => any;\n}\n\nexport interface DataListProps {\n __loadParams: any;\n refresh: (params?: any) => void;\n data: any[];\n meta: any;\n error: any;\n loading: boolean;\n isSelected: (item: any) => boolean;\n select: (item: any) => void;\n isMultiSelected: (item: any) => boolean;\n isNoneMultiSelected: () => boolean;\n isAllMultiSelected: () => boolean;\n multiSelectAll: (value: boolean) => void;\n getMultiSelected: () => any[];\n setSearch: (search: any) => void;\n setWhere: (where: any) => void;\n setSorters: (sort: any) => void;\n setPerPage: (perPage: number) => void;\n setPreviousPage: (cursor: string) => void;\n setNextPage: (cursor: string) => void;\n multiSelect: (items: string | string[], value?: boolean) => void;\n init: () => void;\n}\n\nconst useDataList = (params: UseDataListParams) => {\n const [multiSelectedItems, multiSelect] = useState<string[]>([]);\n\n let history = null;\n /**\n * TODO: figure out the location type.\n */\n let location: any = null;\n const routerHook = useRouter();\n\n if (params.useRouter !== false) {\n history = routerHook.history;\n location = routerHook.location;\n }\n\n const getQueryOptions = useCallback(() => {\n let variables = params.variables;\n if (typeof variables === \"function\") {\n variables = variables(params);\n }\n\n return {\n client: params.client,\n variables: {\n ...variables,\n ...prepareLoadListParams(location)\n }\n };\n }, []);\n\n const queryData = useQuery(params.query, getQueryOptions());\n const prevLoadParamsRef = useRef({});\n\n const dataListProps: DataListProps = {\n data: get(params, \"getData\", getData)(queryData.data),\n meta: get(params, \"getMeta\", getMeta)(queryData.data),\n error: get(params, \"getError\", getError)(queryData.data),\n\n loading: queryData.loading,\n init() {\n this.refresh();\n },\n refresh(params = null): void {\n // Refresh multi select first.\n multiSelect([]);\n\n if (!params) {\n queryData.refetch(dataListProps.__loadParams);\n return;\n }\n\n // if (history) {\n // redirectToRouteWithQueryParams(params, { history, location });\n // return;\n // }\n\n queryData.refetch(params);\n },\n setPerPage(perPage: number): void {\n const preparedParams = {\n ...dataListProps.__loadParams,\n limit: parseInt(\"\" + perPage),\n after: undefined,\n before: undefined\n };\n this.refresh(preparedParams);\n },\n setNextPage(cursor: string): void {\n const preparedParams = {\n ...dataListProps.__loadParams,\n after: cursor,\n before: undefined\n };\n this.refresh(preparedParams);\n },\n setPreviousPage(cursor: string): void {\n const preparedParams = {\n ...dataListProps.__loadParams,\n after: undefined,\n before: cursor\n };\n this.refresh(preparedParams);\n },\n setSearch(search): void {\n const preparedParams = {\n ...dataListProps.__loadParams,\n search,\n after: undefined,\n before: undefined\n };\n this.refresh(preparedParams);\n },\n setWhere(where): void {\n const preparedParams = {\n ...dataListProps.__loadParams,\n where,\n after: undefined,\n before: undefined\n };\n this.refresh(preparedParams);\n },\n setSorters(sort): void {\n const preparedParams = {\n ...dataListProps.__loadParams,\n sort,\n after: undefined,\n before: undefined\n };\n this.refresh(preparedParams);\n },\n multiSelect(items, value): void {\n if (!Array.isArray(items)) {\n items = [items];\n }\n\n const returnItems = [...multiSelectedItems];\n\n items.forEach(item => {\n if (value === undefined) {\n returnItems.includes(item)\n ? returnItems.splice(returnItems.indexOf(item), 1)\n : returnItems.push(item);\n } else {\n if (value === true) {\n !returnItems.includes(item) && returnItems.push(item);\n } else {\n returnItems.includes(item) &&\n returnItems.splice(returnItems.indexOf(item), 1);\n }\n }\n });\n\n multiSelect(returnItems);\n },\n isSelected(item) {\n const query = new URLSearchParams(location.search);\n return query.get(\"id\") === item.id;\n },\n select(item) {\n const query = new URLSearchParams(location.search);\n query.set(\"id\", item.id);\n history.push({ search: query.toString() });\n },\n isMultiSelected(item) {\n if (!Array.isArray(multiSelectedItems)) {\n return false;\n }\n\n return multiSelectedItems.includes(item);\n },\n isNoneMultiSelected() {\n return multiSelectedItems.length === 0;\n },\n getMultiSelected() {\n return multiSelectedItems;\n },\n multiSelectAll(value: boolean): void {\n const { data } = dataListProps;\n if (Array.isArray(data)) {\n dataListProps.multiSelect(data, value);\n } else {\n dataListProps.multiSelect([], value);\n }\n },\n isAllMultiSelected(): boolean {\n const { data } = dataListProps;\n\n return Array.isArray(data) && multiSelectedItems.length === data.length;\n },\n\n __loadParams: prepareLoadListParams(location)\n };\n\n useEffect(() => {\n const params = {\n prev: prevLoadParamsRef.current,\n current: dataListProps.__loadParams\n };\n\n if (!isEqual(params.prev, params.current)) {\n dataListProps.init();\n }\n\n prevLoadParamsRef.current = params.current;\n });\n\n return dataListProps;\n};\n\nexport { useDataList };\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,SAAS,EAAEC,MAAM,EAAEC,WAAW,QAAQ,OAAO;AAChE,SAASC,QAAQ,QAAQ,qBAAqB;AAC9C,SAASC,SAAS,QAAQ,sBAAsB;AAChD,OAAOC,GAAG,MAAM,YAAY;AAC5B,OAAOC,OAAO,MAAM,gBAAgB;AACpC,SAASC,qBAAqB;AAC9B,SAASC,OAAO,EAAEC,QAAQ,EAAEC,OAAO;AAuCnC,MAAMC,WAAW,GAAIC,MAAyB,IAAK;EAC/C,MAAM,CAACC,kBAAkB,EAAEC,WAAW,CAAC,GAAGf,QAAQ,CAAW,EAAE,CAAC;EAEhE,IAAIgB,OAAO,GAAG,IAAI;EAClB;AACJ;AACA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Y,EAAEzB,qBAAqB,CAACS,QAAQ;EAChD,CAAC;EAEDhB,SAAS,CAAC,MAAM;IACZ,MAAMY,MAAM,GAAG;MACX6D,IAAI,EAAElD,iBAAiB,CAACmD,OAAO;MAC/BA,OAAO,EAAElD,aAAa,CAACQ;IAC3B,CAAC;IAED,IAAI,CAAC1B,OAAO,CAACM,MAAM,CAAC6D,IAAI,EAAE7D,MAAM,CAAC8D,OAAO,CAAC,EAAE;MACvClD,aAAa,CAACK,IAAI,CAAC,CAAC;IACxB;IAEAN,iBAAiB,CAACmD,OAAO,GAAG9D,MAAM,CAAC8D,OAAO;EAC9C,CAAC,CAAC;EAEF,OAAOlD,aAAa;AACxB,CAAC;AAED,SAASb,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["useState","useEffect","useRef","useCallback","useQuery","useRouter","get","isEqual","prepareLoadListParams","getData","getError","getMeta","useDataList","params","multiSelectedItems","multiSelect","history","location","routerHook","getQueryOptions","variables","client","queryData","query","prevLoadParamsRef","dataListProps","data","meta","error","loading","init","refresh","refetch","__loadParams","setPerPage","perPage","preparedParams","limit","parseInt","after","undefined","before","setNextPage","cursor","setPreviousPage","setSearch","search","setWhere","where","setSorters","sort","items","value","Array","isArray","returnItems","forEach","item","includes","splice","indexOf","push","isSelected","URLSearchParams","id","select","set","toString","isMultiSelected","isNoneMultiSelected","length","getMultiSelected","multiSelectAll","isAllMultiSelected","prev","current"],"sources":["useDataList.ts"],"sourcesContent":["import { useState, useEffect, useRef, useCallback } from \"react\";\nimport { useQuery } from \"@apollo/react-hooks\";\nimport { useRouter } from \"@webiny/react-router\";\nimport get from \"lodash/get\";\nimport isEqual from \"lodash/isEqual\";\nimport { prepareLoadListParams } from \"./utils\";\nimport { getData, getError, getMeta } from \"./functions\";\n\nimport type { DocumentNode } from \"graphql\";\nimport type { ApolloClient } from \"apollo-client\";\n\nexport interface UseDataListParams {\n useRouter?: boolean;\n variables?: ((params: UseDataListParams) => any) | object;\n client?: ApolloClient<any>;\n query: DocumentNode;\n getData?: (data: any) => any;\n getMeta?: (data: any) => any;\n getError?: (data: any) => any;\n}\n\nexport interface DataListProps {\n __loadParams: any;\n refresh: (params?: any) => void;\n data: any[];\n meta: any;\n error: any;\n loading: boolean;\n isSelected: (item: any) => boolean;\n select: (item: any) => void;\n isMultiSelected: (item: any) => boolean;\n isNoneMultiSelected: () => boolean;\n isAllMultiSelected: () => boolean;\n multiSelectAll: (value: boolean) => void;\n getMultiSelected: () => any[];\n setSearch: (search: any) => void;\n setWhere: (where: any) => void;\n setSorters: (sort: any) => void;\n setPerPage: (perPage: number) => void;\n setPreviousPage: (cursor: string) => void;\n setNextPage: (cursor: string) => void;\n multiSelect: (items: string | string[], value?: boolean) => void;\n init: () => void;\n}\n\nconst useDataList = (params: UseDataListParams) => {\n const [multiSelectedItems, multiSelect] = useState<string[]>([]);\n\n let history = null;\n /**\n * TODO: figure out the location type.\n */\n let location: any = null;\n const routerHook = useRouter();\n\n if (params.useRouter !== false) {\n history = routerHook.history;\n location = routerHook.location;\n }\n\n const getQueryOptions = useCallback(() => {\n let variables = params.variables;\n if (typeof variables === \"function\") {\n variables = variables(params);\n }\n\n return {\n client: params.client,\n variables: {\n ...variables,\n ...prepareLoadListParams(location)\n }\n };\n }, []);\n\n const queryData = useQuery(params.query, getQueryOptions());\n const prevLoadParamsRef = useRef({});\n\n const dataListProps: DataListProps = {\n data: get(params, \"getData\", getData)(queryData.data),\n meta: get(params, \"getMeta\", getMeta)(queryData.data),\n error: get(params, \"getError\", getError)(queryData.data),\n\n loading: queryData.loading,\n init() {\n this.refresh();\n },\n refresh(params = null): void {\n // Refresh multi select first.\n multiSelect([]);\n\n if (!params) {\n queryData.refetch(dataListProps.__loadParams);\n return;\n }\n\n // if (history) {\n // redirectToRouteWithQueryParams(params, { history, location });\n // return;\n // }\n\n queryData.refetch(params);\n },\n setPerPage(perPage: number): void {\n const preparedParams = {\n ...dataListProps.__loadParams,\n limit: parseInt(\"\" + perPage),\n after: undefined,\n before: undefined\n };\n this.refresh(preparedParams);\n },\n setNextPage(cursor: string): void {\n const preparedParams = {\n ...dataListProps.__loadParams,\n after: cursor,\n before: undefined\n };\n this.refresh(preparedParams);\n },\n setPreviousPage(cursor: string): void {\n const preparedParams = {\n ...dataListProps.__loadParams,\n after: undefined,\n before: cursor\n };\n this.refresh(preparedParams);\n },\n setSearch(search): void {\n const preparedParams = {\n ...dataListProps.__loadParams,\n search,\n after: undefined,\n before: undefined\n };\n this.refresh(preparedParams);\n },\n setWhere(where): void {\n const preparedParams = {\n ...dataListProps.__loadParams,\n where,\n after: undefined,\n before: undefined\n };\n this.refresh(preparedParams);\n },\n setSorters(sort): void {\n const preparedParams = {\n ...dataListProps.__loadParams,\n sort,\n after: undefined,\n before: undefined\n };\n this.refresh(preparedParams);\n },\n multiSelect(items, value): void {\n if (!Array.isArray(items)) {\n items = [items];\n }\n\n const returnItems = [...multiSelectedItems];\n\n items.forEach(item => {\n if (value === undefined) {\n returnItems.includes(item)\n ? returnItems.splice(returnItems.indexOf(item), 1)\n : returnItems.push(item);\n } else {\n if (value === true) {\n !returnItems.includes(item) && returnItems.push(item);\n } else {\n returnItems.includes(item) &&\n returnItems.splice(returnItems.indexOf(item), 1);\n }\n }\n });\n\n multiSelect(returnItems);\n },\n isSelected(item) {\n const query = new URLSearchParams(location.search);\n return query.get(\"id\") === item.id;\n },\n select(item) {\n const query = new URLSearchParams(location.search);\n query.set(\"id\", item.id);\n history.push({ search: query.toString() });\n },\n isMultiSelected(item) {\n if (!Array.isArray(multiSelectedItems)) {\n return false;\n }\n\n return multiSelectedItems.includes(item);\n },\n isNoneMultiSelected() {\n return multiSelectedItems.length === 0;\n },\n getMultiSelected() {\n return multiSelectedItems;\n },\n multiSelectAll(value: boolean): void {\n const { data } = dataListProps;\n if (Array.isArray(data)) {\n dataListProps.multiSelect(data, value);\n } else {\n dataListProps.multiSelect([], value);\n }\n },\n isAllMultiSelected(): boolean {\n const { data } = dataListProps;\n\n return Array.isArray(data) && multiSelectedItems.length === data.length;\n },\n\n __loadParams: prepareLoadListParams(location)\n };\n\n useEffect(() => {\n const params = {\n prev: prevLoadParamsRef.current,\n current: dataListProps.__loadParams\n };\n\n if (!isEqual(params.prev, params.current)) {\n dataListProps.init();\n }\n\n prevLoadParamsRef.current = params.current;\n });\n\n return dataListProps;\n};\n\nexport { useDataList };\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,SAAS,EAAEC,MAAM,EAAEC,WAAW,QAAQ,OAAO;AAChE,SAASC,QAAQ,QAAQ,qBAAqB;AAC9C,SAASC,SAAS,QAAQ,sBAAsB;AAChD,OAAOC,GAAG,MAAM,YAAY;AAC5B,OAAOC,OAAO,MAAM,gBAAgB;AACpC,SAASC,qBAAqB;AAC9B,SAASC,OAAO,EAAEC,QAAQ,EAAEC,OAAO;AAuCnC,MAAMC,WAAW,GAAIC,MAAyB,IAAK;EAC/C,MAAM,CAACC,kBAAkB,EAAEC,WAAW,CAAC,GAAGf,QAAQ,CAAW,EAAE,CAAC;EAEhE,IAAIgB,OAAO,GAAG,IAAI;EAClB;AACJ;AACA;EACI,IAAIC,QAAa,GAAG,IAAI;EACxB,MAAMC,UAAU,GAAGb,SAAS,CAAC,CAAC;EAE9B,IAAIQ,MAAM,CAACR,SAAS,KAAK,KAAK,EAAE;IAC5BW,OAAO,GAAGE,UAAU,CAACF,OAAO;IAC5BC,QAAQ,GAAGC,UAAU,CAACD,QAAQ;EAClC;EAEA,MAAME,eAAe,GAAGhB,WAAW,CAAC,MAAM;IACtC,IAAIiB,SAAS,GAAGP,MAAM,CAACO,SAAS;IAChC,IAAI,OAAOA,SAAS,KAAK,UAAU,EAAE;MACjCA,SAAS,GAAGA,SAAS,CAACP,MAAM,CAAC;IACjC;IAEA,OAAO;MACHQ,MAAM,EAAER,MAAM,CAACQ,MAAM;MACrBD,SAAS,EAAE;QACP,GAAGA,SAAS;QACZ,GAAGZ,qBAAqB,CAACS,QAAQ;MACrC;IACJ,CAAC;EACL,CAAC,EAAE,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;IAC5C,CAAC;IACDY,mBAAmBA,CAAA,EAAG;MAClB,OAAOvD,kBAAkB,CAACwD,MAAM,KAAK,CAAC;IAC1C,CAAC;IACDC,gBAAgBA,CAAA,EAAG;MACf,OAAOzD,kBAAkB;IAC7B,CAAC;IACD0D,cAAcA,CAACpB,KAAc,EAAQ;MACjC,MAAM;QAAE1B;MAAK,CAAC,GAAGD,aAAa;MAC9B,IAAI4B,KAAK,CAACC,OAAO,CAAC5B,IAAI,CAAC,EAAE;QACrBD,aAAa,CAACV,WAAW,CAACW,IAAI,EAAE0B,KAAK,CAAC;MAC1C,CAAC,MAAM;QACH3B,aAAa,CAACV,WAAW,CAAC,EAAE,EAAEqC,KAAK,CAAC;MACxC;IACJ,CAAC;IACDqB,kBAAkBA,CAAA,EAAY;MAC1B,MAAM;QAAE/C;MAAK,CAAC,GAAGD,aAAa;MAE9B,OAAO4B,KAAK,CAACC,OAAO,CAAC5B,IAAI,CAAC,IAAIZ,kBAAkB,CAACwD,MAAM,KAAK5C,IAAI,CAAC4C,MAAM;IAC3E,CAAC;IAEDrC,YAAY,EAAEzB,qBAAqB,CAACS,QAAQ;EAChD,CAAC;EAEDhB,SAAS,CAAC,MAAM;IACZ,MAAMY,MAAM,GAAG;MACX6D,IAAI,EAAElD,iBAAiB,CAACmD,OAAO;MAC/BA,OAAO,EAAElD,aAAa,CAACQ;IAC3B,CAAC;IAED,IAAI,CAAC1B,OAAO,CAACM,MAAM,CAAC6D,IAAI,EAAE7D,MAAM,CAAC8D,OAAO,CAAC,EAAE;MACvClD,aAAa,CAACK,IAAI,CAAC,CAAC;IACxB;IAEAN,iBAAiB,CAACmD,OAAO,GAAG9D,MAAM,CAAC8D,OAAO;EAC9C,CAAC,CAAC;EAEF,OAAOlD,aAAa;AACxB,CAAC;AAED,SAASb,WAAW","ignoreList":[]}
package/hooks/useUi.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { UiContextValue } from "../contexts/Ui";
1
+ import type { UiContextValue } from "../contexts/Ui";
2
2
  export declare const useUi: () => UiContextValue;
@@ -1 +1 @@
1
- {"version":3,"names":["useContext","UiContext","useUi"],"sources":["useUi.ts"],"sourcesContent":["import { useContext } from \"react\";\nimport { UiContext, UiContextValue } from \"~/contexts/Ui\";\n\nexport const useUi = () => {\n return useContext(UiContext) as UiContextValue;\n};\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,SAAS;AAElB,OAAO,MAAMC,KAAK,GAAGA,CAAA,KAAM;EACvB,OAAOF,UAAU,CAACC,SAAS,CAAC;AAChC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useContext","UiContext","useUi"],"sources":["useUi.ts"],"sourcesContent":["import { useContext } from \"react\";\nimport type { UiContextValue } from \"~/contexts/Ui\";\nimport { UiContext } from \"~/contexts/Ui\";\n\nexport const useUi = () => {\n return useContext(UiContext) as UiContextValue;\n};\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,OAAO;AAElC,SAASC,SAAS;AAElB,OAAO,MAAMC,KAAK,GAAGA,CAAA,KAAM;EACvB,OAAOF,UAAU,CAACC,SAAS,CAAC;AAChC,CAAC","ignoreList":[]}
package/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { AddQuerySelectionPlugin } from "./plugins/AddQuerySelectionPlugin";
2
2
  export { ApolloLinkPlugin } from "./plugins/ApolloLinkPlugin";
3
3
  export { RoutePlugin } from "./plugins/RoutePlugin";
4
- export { ApolloCacheObjectIdPlugin, ApolloCacheObject } from "./plugins/ApolloCacheObjectIdPlugin";
4
+ export { ApolloCacheObjectIdPlugin, type ApolloCacheObject } from "./plugins/ApolloCacheObjectIdPlugin";
5
5
  export * from "@webiny/react-composition";
6
6
  export type { HigherOrderComponent, ComposeProps, ComposableFC } from "@webiny/react-composition";
7
7
  export * from "./App";
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export { AddQuerySelectionPlugin } from "./plugins/AddQuerySelectionPlugin";
2
2
  export { ApolloLinkPlugin } from "./plugins/ApolloLinkPlugin";
3
3
  export { RoutePlugin } from "./plugins/RoutePlugin";
4
- export { ApolloCacheObjectIdPlugin, ApolloCacheObject } from "./plugins/ApolloCacheObjectIdPlugin";
4
+ export { ApolloCacheObjectIdPlugin } from "./plugins/ApolloCacheObjectIdPlugin";
5
5
 
6
6
  // Composition - we re-export this for ease of use
7
7
  export * from "@webiny/react-composition";
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["AddQuerySelectionPlugin","ApolloLinkPlugin","RoutePlugin","ApolloCacheObjectIdPlugin","ApolloCacheObject"],"sources":["index.ts"],"sourcesContent":["export { AddQuerySelectionPlugin } from \"./plugins/AddQuerySelectionPlugin\";\nexport { ApolloLinkPlugin } from \"./plugins/ApolloLinkPlugin\";\nexport { RoutePlugin } from \"./plugins/RoutePlugin\";\nexport { ApolloCacheObjectIdPlugin, ApolloCacheObject } from \"./plugins/ApolloCacheObjectIdPlugin\";\n\n// Composition - we re-export this for ease of use\nexport * from \"@webiny/react-composition\";\nexport type { HigherOrderComponent, ComposeProps, ComposableFC } from \"@webiny/react-composition\";\n\n// App framework\nexport * from \"./App\";\nexport * from \"./AppContainer\";\nexport type { AppProps } from \"./App\";\nexport * from \"./core/Plugins\";\nexport * from \"./core/Plugin\";\nexport * from \"./core/Provider\";\nexport * from \"./core/DebounceRender\";\nexport * from \"./core/createProvider\";\nexport * from \"./core/createProviderPlugin\";\nexport * from \"./renderApp\";\nexport * from \"./utils/createGenericContext\";\n"],"mappings":"AAAA,SAASA,uBAAuB;AAChC,SAASC,gBAAgB;AACzB,SAASC,WAAW;AACpB,SAASC,yBAAyB,EAAEC,iBAAiB;;AAErD;AACA,cAAc,2BAA2B;AAGzC;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"names":["AddQuerySelectionPlugin","ApolloLinkPlugin","RoutePlugin","ApolloCacheObjectIdPlugin"],"sources":["index.ts"],"sourcesContent":["export { AddQuerySelectionPlugin } from \"./plugins/AddQuerySelectionPlugin\";\nexport { ApolloLinkPlugin } from \"./plugins/ApolloLinkPlugin\";\nexport { RoutePlugin } from \"./plugins/RoutePlugin\";\nexport {\n ApolloCacheObjectIdPlugin,\n type ApolloCacheObject\n} from \"./plugins/ApolloCacheObjectIdPlugin\";\n\n// Composition - we re-export this for ease of use\nexport * from \"@webiny/react-composition\";\nexport type { HigherOrderComponent, ComposeProps, ComposableFC } from \"@webiny/react-composition\";\n\n// App framework\nexport * from \"./App\";\nexport * from \"./AppContainer\";\nexport type { AppProps } from \"./App\";\nexport * from \"./core/Plugins\";\nexport * from \"./core/Plugin\";\nexport * from \"./core/Provider\";\nexport * from \"./core/DebounceRender\";\nexport * from \"./core/createProvider\";\nexport * from \"./core/createProviderPlugin\";\nexport * from \"./renderApp\";\nexport * from \"./utils/createGenericContext\";\n"],"mappings":"AAAA,SAASA,uBAAuB;AAChC,SAASC,gBAAgB;AACzB,SAASC,WAAW;AACpB,SACIC,yBAAyB;;AAI7B;AACA,cAAc,2BAA2B;AAGzC;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/app",
3
- "version": "6.0.0-alpha.0",
3
+ "version": "6.0.0-alpha.2",
4
4
  "main": "index.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,13 +17,13 @@
17
17
  "@apollo/react-hooks": "3.1.5",
18
18
  "@emotion/styled": "11.10.6",
19
19
  "@types/react": "18.2.79",
20
- "@webiny/i18n": "6.0.0-alpha.0",
21
- "@webiny/i18n-react": "6.0.0-alpha.0",
22
- "@webiny/plugins": "6.0.0-alpha.0",
23
- "@webiny/react-composition": "6.0.0-alpha.0",
24
- "@webiny/react-properties": "6.0.0-alpha.0",
25
- "@webiny/react-router": "6.0.0-alpha.0",
26
- "@webiny/ui": "6.0.0-alpha.0",
20
+ "@webiny/i18n": "6.0.0-alpha.2",
21
+ "@webiny/i18n-react": "6.0.0-alpha.2",
22
+ "@webiny/plugins": "6.0.0-alpha.2",
23
+ "@webiny/react-composition": "6.0.0-alpha.2",
24
+ "@webiny/react-properties": "6.0.0-alpha.2",
25
+ "@webiny/react-router": "6.0.0-alpha.2",
26
+ "@webiny/ui": "6.0.0-alpha.2",
27
27
  "apollo-cache": "1.3.5",
28
28
  "apollo-cache-inmemory": "1.6.6",
29
29
  "apollo-client": "2.6.10",
@@ -47,7 +47,7 @@
47
47
  "devDependencies": {
48
48
  "@types/lodash": "4.17.13",
49
49
  "@types/warning": "3.0.0",
50
- "@webiny/project-utils": "6.0.0-alpha.0",
50
+ "@webiny/project-utils": "6.0.0-alpha.2",
51
51
  "rimraf": "6.0.1",
52
52
  "typescript": "5.3.3"
53
53
  },
@@ -66,5 +66,5 @@
66
66
  ]
67
67
  }
68
68
  },
69
- "gitHead": "a5b28fed7a242d8f56712197a8ea83aa6d2ed101"
69
+ "gitHead": "7c9e8fbfd62a57ece5f880dbad6c864636b0355e"
70
70
  }
@@ -1,5 +1,5 @@
1
1
  import { ApolloLink } from "apollo-link";
2
- import { DocumentNode } from "graphql";
2
+ import type { DocumentNode } from "graphql";
3
3
  import { ApolloLinkPlugin } from "./ApolloLinkPlugin";
4
4
  declare module "graphql" {
5
5
  interface DocumentNode {
@@ -1,5 +1,4 @@
1
1
  import { ApolloLink } from "apollo-link";
2
- import { DocumentNode } from "graphql";
3
2
  import { ApolloLinkPlugin } from "./ApolloLinkPlugin";
4
3
  export class AddQuerySelectionPlugin extends ApolloLinkPlugin {
5
4
  constructor(config) {
@@ -1 +1 @@
1
- {"version":3,"names":["ApolloLink","DocumentNode","ApolloLinkPlugin","AddQuerySelectionPlugin","constructor","config","createLink","operation","forward","operationName","addSelectionToQuery","query","document","isProcessed","markProcessed","addSelection","selectionPath","firstQueryDefinition","definitions","selectionSet","tree","selections","fields","split","fieldLoop","field","selection","name","value","push","hasOwnProperty","__webiny__","Set","has","cacheKey","add"],"sources":["AddQuerySelectionPlugin.ts"],"sourcesContent":["import { ApolloLink } from \"apollo-link\";\nimport { DocumentNode } from \"graphql\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin\";\nimport { ExecutableDefinitionNode, FieldNode } from \"graphql/language/ast\";\n\ndeclare module \"graphql\" {\n interface DocumentNode {\n __webiny__: Set<string>;\n }\n}\n\ninterface Config {\n operationName: string;\n selectionPath: string;\n addSelection: DocumentNode;\n}\n\nexport class AddQuerySelectionPlugin extends ApolloLinkPlugin {\n private readonly config: Config;\n\n constructor(config: Config) {\n super();\n this.config = config;\n }\n\n public override createLink(): ApolloLink {\n return new ApolloLink((operation, forward) => {\n if (operation.operationName !== this.config.operationName) {\n return forward(operation);\n }\n\n this.addSelectionToQuery(operation.operationName, operation.query);\n\n return forward(operation);\n });\n }\n\n public addSelectionToQuery(operationName: string, document: DocumentNode): void {\n if (operationName !== this.config.operationName) {\n return;\n }\n\n // If this plugin already processed the given document (documents are always passed by reference),\n // then we don't want to apply the selection again, to avoid adding duplicate selections.\n if (this.isProcessed(document)) {\n return;\n }\n\n this.markProcessed(document);\n\n const { addSelection, selectionPath } = this.config;\n\n const firstQueryDefinition = document.definitions[0] as ExecutableDefinitionNode;\n if (!firstQueryDefinition) {\n return;\n } else if (!firstQueryDefinition.selectionSet) {\n return;\n }\n\n let tree = firstQueryDefinition.selectionSet.selections as FieldNode[];\n const fields = selectionPath.split(\".\");\n\n fieldLoop: for (const field of fields) {\n for (const selection of tree) {\n if (!selection.selectionSet) {\n continue;\n }\n if (selection.name.value === field) {\n tree = selection.selectionSet.selections as FieldNode[];\n continue fieldLoop;\n }\n }\n // If we get here, it means we didn't find the necessary selection\n return;\n }\n /**\n * We must cast because there are a lot of types that are not intertwined and TS is complaining\n */\n tree.push(\n ...((addSelection.definitions[0] as ExecutableDefinitionNode).selectionSet\n .selections as FieldNode[])\n );\n }\n\n private isProcessed(document: DocumentNode) {\n if (!document.hasOwnProperty(\"__webiny__\")) {\n document.__webiny__ = new Set();\n }\n\n return document.__webiny__.has(this.cacheKey);\n }\n\n private markProcessed(document: DocumentNode) {\n if (!document.hasOwnProperty(\"__webiny__\")) {\n document.__webiny__ = new Set();\n }\n\n document.__webiny__.add(this.cacheKey);\n }\n}\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,aAAa;AACxC,SAASC,YAAY,QAAQ,SAAS;AACtC,SAASC,gBAAgB;AAezB,OAAO,MAAMC,uBAAuB,SAASD,gBAAgB,CAAC;EAG1DE,WAAWA,CAACC,MAAc,EAAE;IACxB,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;EAEgBC,UAAUA,CAAA,EAAe;IACrC,OAAO,IAAIN,UAAU,CAAC,CAACO,SAAS,EAAEC,OAAO,KAAK;MAC1C,IAAID,SAAS,CAACE,aAAa,KAAK,IAAI,CAACJ,MAAM,CAACI,aAAa,EAAE;QACvD,OAAOD,OAAO,CAACD,SAAS,CAAC;MAC7B;MAEA,IAAI,CAACG,mBAAmB,CAACH,SAAS,CAACE,aAAa,EAAEF,SAAS,CAACI,KAAK,CAAC;MAElE,OAAOH,OAAO,CAACD,SAAS,CAAC;IAC7B,CAAC,CAAC;EACN;EAEOG,mBAAmBA,CAACD,aAAqB,EAAEG,QAAsB,EAAQ;IAC5E,IAAIH,aAAa,KAAK,IAAI,CAACJ,MAAM,CAACI,aAAa,EAAE;MAC7C;IACJ;;IAEA;IACA;IACA,IAAI,IAAI,CAACI,WAAW,CAACD,QAAQ,CAAC,EAAE;MAC5B;IACJ;IAEA,IAAI,CAACE,aAAa,CAACF,QAAQ,CAAC;IAE5B,MAAM;MAAEG,YAAY;MAAEC;IAAc,CAAC,GAAG,IAAI,CAACX,MAAM;IAEnD,MAAMY,oBAAoB,GAAGL,QAAQ,CAACM,WAAW,CAAC,CAAC,CAA6B;IAChF,IAAI,CAACD,oBAAoB,EAAE;MACvB;IACJ,CAAC,MAAM,IAAI,CAACA,oBAAoB,CAACE,YAAY,EAAE;MAC3C;IACJ;IAEA,IAAIC,IAAI,GAAGH,oBAAoB,CAACE,YAAY,CAACE,UAAyB;IACtE,MAAMC,MAAM,GAAGN,aAAa,CAACO,KAAK,CAAC,GAAG,CAAC;IAEvCC,SAAS,EAAE,KAAK,MAAMC,KAAK,IAAIH,MAAM,EAAE;MACnC,KAAK,MAAMI,SAAS,IAAIN,IAAI,EAAE;QAC1B,IAAI,CAACM,SAAS,CAACP,YAAY,EAAE;UACzB;QACJ;QACA,IAAIO,SAAS,CAACC,IAAI,CAACC,KAAK,KAAKH,KAAK,EAAE;UAChCL,IAAI,GAAGM,SAAS,CAACP,YAAY,CAACE,UAAyB;UACvD,SAASG,SAAS;QACtB;MACJ;MACA;MACA;IACJ;IACA;AACR;AACA;IACQJ,IAAI,CAACS,IAAI,CACL,GAAKd,YAAY,CAACG,WAAW,CAAC,CAAC,CAAC,CAA8BC,YAAY,CACrEE,UACT,CAAC;EACL;EAEQR,WAAWA,CAACD,QAAsB,EAAE;IACxC,IAAI,CAACA,QAAQ,CAACkB,cAAc,CAAC,YAAY,CAAC,EAAE;MACxClB,QAAQ,CAACmB,UAAU,GAAG,IAAIC,GAAG,CAAC,CAAC;IACnC;IAEA,OAAOpB,QAAQ,CAACmB,UAAU,CAACE,GAAG,CAAC,IAAI,CAACC,QAAQ,CAAC;EACjD;EAEQpB,aAAaA,CAACF,QAAsB,EAAE;IAC1C,IAAI,CAACA,QAAQ,CAACkB,cAAc,CAAC,YAAY,CAAC,EAAE;MACxClB,QAAQ,CAACmB,UAAU,GAAG,IAAIC,GAAG,CAAC,CAAC;IACnC;IAEApB,QAAQ,CAACmB,UAAU,CAACI,GAAG,CAAC,IAAI,CAACD,QAAQ,CAAC;EAC1C;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["ApolloLink","ApolloLinkPlugin","AddQuerySelectionPlugin","constructor","config","createLink","operation","forward","operationName","addSelectionToQuery","query","document","isProcessed","markProcessed","addSelection","selectionPath","firstQueryDefinition","definitions","selectionSet","tree","selections","fields","split","fieldLoop","field","selection","name","value","push","hasOwnProperty","__webiny__","Set","has","cacheKey","add"],"sources":["AddQuerySelectionPlugin.ts"],"sourcesContent":["import { ApolloLink } from \"apollo-link\";\nimport type { DocumentNode } from \"graphql\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin\";\nimport type { ExecutableDefinitionNode, FieldNode } from \"graphql/language/ast\";\n\ndeclare module \"graphql\" {\n interface DocumentNode {\n __webiny__: Set<string>;\n }\n}\n\ninterface Config {\n operationName: string;\n selectionPath: string;\n addSelection: DocumentNode;\n}\n\nexport class AddQuerySelectionPlugin extends ApolloLinkPlugin {\n private readonly config: Config;\n\n constructor(config: Config) {\n super();\n this.config = config;\n }\n\n public override createLink(): ApolloLink {\n return new ApolloLink((operation, forward) => {\n if (operation.operationName !== this.config.operationName) {\n return forward(operation);\n }\n\n this.addSelectionToQuery(operation.operationName, operation.query);\n\n return forward(operation);\n });\n }\n\n public addSelectionToQuery(operationName: string, document: DocumentNode): void {\n if (operationName !== this.config.operationName) {\n return;\n }\n\n // If this plugin already processed the given document (documents are always passed by reference),\n // then we don't want to apply the selection again, to avoid adding duplicate selections.\n if (this.isProcessed(document)) {\n return;\n }\n\n this.markProcessed(document);\n\n const { addSelection, selectionPath } = this.config;\n\n const firstQueryDefinition = document.definitions[0] as ExecutableDefinitionNode;\n if (!firstQueryDefinition) {\n return;\n } else if (!firstQueryDefinition.selectionSet) {\n return;\n }\n\n let tree = firstQueryDefinition.selectionSet.selections as FieldNode[];\n const fields = selectionPath.split(\".\");\n\n fieldLoop: for (const field of fields) {\n for (const selection of tree) {\n if (!selection.selectionSet) {\n continue;\n }\n if (selection.name.value === field) {\n tree = selection.selectionSet.selections as FieldNode[];\n continue fieldLoop;\n }\n }\n // If we get here, it means we didn't find the necessary selection\n return;\n }\n /**\n * We must cast because there are a lot of types that are not intertwined and TS is complaining\n */\n tree.push(\n ...((addSelection.definitions[0] as ExecutableDefinitionNode).selectionSet\n .selections as FieldNode[])\n );\n }\n\n private isProcessed(document: DocumentNode) {\n if (!document.hasOwnProperty(\"__webiny__\")) {\n document.__webiny__ = new Set();\n }\n\n return document.__webiny__.has(this.cacheKey);\n }\n\n private markProcessed(document: DocumentNode) {\n if (!document.hasOwnProperty(\"__webiny__\")) {\n document.__webiny__ = new Set();\n }\n\n document.__webiny__.add(this.cacheKey);\n }\n}\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,aAAa;AAExC,SAASC,gBAAgB;AAezB,OAAO,MAAMC,uBAAuB,SAASD,gBAAgB,CAAC;EAG1DE,WAAWA,CAACC,MAAc,EAAE;IACxB,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;EAEgBC,UAAUA,CAAA,EAAe;IACrC,OAAO,IAAIL,UAAU,CAAC,CAACM,SAAS,EAAEC,OAAO,KAAK;MAC1C,IAAID,SAAS,CAACE,aAAa,KAAK,IAAI,CAACJ,MAAM,CAACI,aAAa,EAAE;QACvD,OAAOD,OAAO,CAACD,SAAS,CAAC;MAC7B;MAEA,IAAI,CAACG,mBAAmB,CAACH,SAAS,CAACE,aAAa,EAAEF,SAAS,CAACI,KAAK,CAAC;MAElE,OAAOH,OAAO,CAACD,SAAS,CAAC;IAC7B,CAAC,CAAC;EACN;EAEOG,mBAAmBA,CAACD,aAAqB,EAAEG,QAAsB,EAAQ;IAC5E,IAAIH,aAAa,KAAK,IAAI,CAACJ,MAAM,CAACI,aAAa,EAAE;MAC7C;IACJ;;IAEA;IACA;IACA,IAAI,IAAI,CAACI,WAAW,CAACD,QAAQ,CAAC,EAAE;MAC5B;IACJ;IAEA,IAAI,CAACE,aAAa,CAACF,QAAQ,CAAC;IAE5B,MAAM;MAAEG,YAAY;MAAEC;IAAc,CAAC,GAAG,IAAI,CAACX,MAAM;IAEnD,MAAMY,oBAAoB,GAAGL,QAAQ,CAACM,WAAW,CAAC,CAAC,CAA6B;IAChF,IAAI,CAACD,oBAAoB,EAAE;MACvB;IACJ,CAAC,MAAM,IAAI,CAACA,oBAAoB,CAACE,YAAY,EAAE;MAC3C;IACJ;IAEA,IAAIC,IAAI,GAAGH,oBAAoB,CAACE,YAAY,CAACE,UAAyB;IACtE,MAAMC,MAAM,GAAGN,aAAa,CAACO,KAAK,CAAC,GAAG,CAAC;IAEvCC,SAAS,EAAE,KAAK,MAAMC,KAAK,IAAIH,MAAM,EAAE;MACnC,KAAK,MAAMI,SAAS,IAAIN,IAAI,EAAE;QAC1B,IAAI,CAACM,SAAS,CAACP,YAAY,EAAE;UACzB;QACJ;QACA,IAAIO,SAAS,CAACC,IAAI,CAACC,KAAK,KAAKH,KAAK,EAAE;UAChCL,IAAI,GAAGM,SAAS,CAACP,YAAY,CAACE,UAAyB;UACvD,SAASG,SAAS;QACtB;MACJ;MACA;MACA;IACJ;IACA;AACR;AACA;IACQJ,IAAI,CAACS,IAAI,CACL,GAAKd,YAAY,CAACG,WAAW,CAAC,CAAC,CAAC,CAA8BC,YAAY,CACrEE,UACT,CAAC;EACL;EAEQR,WAAWA,CAACD,QAAsB,EAAE;IACxC,IAAI,CAACA,QAAQ,CAACkB,cAAc,CAAC,YAAY,CAAC,EAAE;MACxClB,QAAQ,CAACmB,UAAU,GAAG,IAAIC,GAAG,CAAC,CAAC;IACnC;IAEA,OAAOpB,QAAQ,CAACmB,UAAU,CAACE,GAAG,CAAC,IAAI,CAACC,QAAQ,CAAC;EACjD;EAEQpB,aAAaA,CAACF,QAAsB,EAAE;IAC1C,IAAI,CAACA,QAAQ,CAACkB,cAAc,CAAC,YAAY,CAAC,EAAE;MACxClB,QAAQ,CAACmB,UAAU,GAAG,IAAIC,GAAG,CAAC,CAAC;IACnC;IAEApB,QAAQ,CAACmB,UAAU,CAACI,GAAG,CAAC,IAAI,CAACD,QAAQ,CAAC;EAC1C;AACJ","ignoreList":[]}
@@ -1,5 +1,6 @@
1
- import { ApolloLink, NextLink } from "apollo-link";
2
- import { Operation } from "apollo-link/lib/types";
1
+ import type { NextLink } from "apollo-link";
2
+ import { ApolloLink } from "apollo-link";
3
+ import type { Operation } from "apollo-link/lib/types";
3
4
  export declare class ApolloDynamicLink extends ApolloLink {
4
5
  private cache;
5
6
  request(operation: Operation, forward: NextLink): any;
@@ -1 +1 @@
1
- {"version":3,"names":["ApolloLink","plugins","createLink","plugin","e","console","error","ApolloDynamicLink","cache","Map","request","operation","forward","linkPlugins","byType","length","cacheKey","map","pl","join","has","links","filter","Boolean","set","from","get"],"sources":["ApolloDynamicLink.ts"],"sourcesContent":["import { ApolloLink, NextLink } from \"apollo-link\";\nimport { plugins } from \"@webiny/plugins\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin\";\nimport { Operation } from \"apollo-link/lib/types\";\n\nfunction createLink(plugin: ApolloLinkPlugin) {\n try {\n return plugin.createLink();\n } catch (e) {\n console.error(`Caught an error while executing \"createLink\" on plugin`, plugin);\n console.error(e);\n }\n return null;\n}\n\nexport class ApolloDynamicLink extends ApolloLink {\n private cache = new Map();\n\n public override request(operation: Operation, forward: NextLink) {\n const linkPlugins = plugins.byType<ApolloLinkPlugin>(\"apollo-link\");\n\n if (!linkPlugins.length) {\n return forward(operation);\n }\n\n const cacheKey = linkPlugins.map(pl => pl.cacheKey).join(\",\");\n\n if (!this.cache.has(cacheKey)) {\n /**\n * We filter out falsy items from the linkPlugins because there might be some error while creating link.\n */\n const links = linkPlugins.map(createLink).filter(Boolean) as ApolloLink[];\n this.cache.set(cacheKey, ApolloLink.from(links));\n }\n\n return this.cache.get(cacheKey).request(operation, forward);\n }\n}\n"],"mappings":"AAAA,SAASA,UAAU,QAAkB,aAAa;AAClD,SAASC,OAAO,QAAQ,iBAAiB;AAIzC,SAASC,UAAUA,CAACC,MAAwB,EAAE;EAC1C,IAAI;IACA,OAAOA,MAAM,CAACD,UAAU,CAAC,CAAC;EAC9B,CAAC,CAAC,OAAOE,CAAC,EAAE;IACRC,OAAO,CAACC,KAAK,CAAC,wDAAwD,EAAEH,MAAM,CAAC;IAC/EE,OAAO,CAACC,KAAK,CAACF,CAAC,CAAC;EACpB;EACA,OAAO,IAAI;AACf;AAEA,OAAO,MAAMG,iBAAiB,SAASP,UAAU,CAAC;EACtCQ,KAAK,GAAG,IAAIC,GAAG,CAAC,CAAC;EAETC,OAAOA,CAACC,SAAoB,EAAEC,OAAiB,EAAE;IAC7D,MAAMC,WAAW,GAAGZ,OAAO,CAACa,MAAM,CAAmB,aAAa,CAAC;IAEnE,IAAI,CAACD,WAAW,CAACE,MAAM,EAAE;MACrB,OAAOH,OAAO,CAACD,SAAS,CAAC;IAC7B;IAEA,MAAMK,QAAQ,GAAGH,WAAW,CAACI,GAAG,CAACC,EAAE,IAAIA,EAAE,CAACF,QAAQ,CAAC,CAACG,IAAI,CAAC,GAAG,CAAC;IAE7D,IAAI,CAAC,IAAI,CAACX,KAAK,CAACY,GAAG,CAACJ,QAAQ,CAAC,EAAE;MAC3B;AACZ;AACA;MACY,MAAMK,KAAK,GAAGR,WAAW,CAACI,GAAG,CAACf,UAAU,CAAC,CAACoB,MAAM,CAACC,OAAO,CAAiB;MACzE,IAAI,CAACf,KAAK,CAACgB,GAAG,CAACR,QAAQ,EAAEhB,UAAU,CAACyB,IAAI,CAACJ,KAAK,CAAC,CAAC;IACpD;IAEA,OAAO,IAAI,CAACb,KAAK,CAACkB,GAAG,CAACV,QAAQ,CAAC,CAACN,OAAO,CAACC,SAAS,EAAEC,OAAO,CAAC;EAC/D;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["ApolloLink","plugins","createLink","plugin","e","console","error","ApolloDynamicLink","cache","Map","request","operation","forward","linkPlugins","byType","length","cacheKey","map","pl","join","has","links","filter","Boolean","set","from","get"],"sources":["ApolloDynamicLink.ts"],"sourcesContent":["import type { NextLink } from \"apollo-link\";\nimport { ApolloLink } from \"apollo-link\";\nimport { plugins } from \"@webiny/plugins\";\nimport type { ApolloLinkPlugin } from \"./ApolloLinkPlugin\";\nimport type { Operation } from \"apollo-link/lib/types\";\n\nfunction createLink(plugin: ApolloLinkPlugin) {\n try {\n return plugin.createLink();\n } catch (e) {\n console.error(`Caught an error while executing \"createLink\" on plugin`, plugin);\n console.error(e);\n }\n return null;\n}\n\nexport class ApolloDynamicLink extends ApolloLink {\n private cache = new Map();\n\n public override request(operation: Operation, forward: NextLink) {\n const linkPlugins = plugins.byType<ApolloLinkPlugin>(\"apollo-link\");\n\n if (!linkPlugins.length) {\n return forward(operation);\n }\n\n const cacheKey = linkPlugins.map(pl => pl.cacheKey).join(\",\");\n\n if (!this.cache.has(cacheKey)) {\n /**\n * We filter out falsy items from the linkPlugins because there might be some error while creating link.\n */\n const links = linkPlugins.map(createLink).filter(Boolean) as ApolloLink[];\n this.cache.set(cacheKey, ApolloLink.from(links));\n }\n\n return this.cache.get(cacheKey).request(operation, forward);\n }\n}\n"],"mappings":"AACA,SAASA,UAAU,QAAQ,aAAa;AACxC,SAASC,OAAO,QAAQ,iBAAiB;AAIzC,SAASC,UAAUA,CAACC,MAAwB,EAAE;EAC1C,IAAI;IACA,OAAOA,MAAM,CAACD,UAAU,CAAC,CAAC;EAC9B,CAAC,CAAC,OAAOE,CAAC,EAAE;IACRC,OAAO,CAACC,KAAK,CAAC,wDAAwD,EAAEH,MAAM,CAAC;IAC/EE,OAAO,CAACC,KAAK,CAACF,CAAC,CAAC;EACpB;EACA,OAAO,IAAI;AACf;AAEA,OAAO,MAAMG,iBAAiB,SAASP,UAAU,CAAC;EACtCQ,KAAK,GAAG,IAAIC,GAAG,CAAC,CAAC;EAETC,OAAOA,CAACC,SAAoB,EAAEC,OAAiB,EAAE;IAC7D,MAAMC,WAAW,GAAGZ,OAAO,CAACa,MAAM,CAAmB,aAAa,CAAC;IAEnE,IAAI,CAACD,WAAW,CAACE,MAAM,EAAE;MACrB,OAAOH,OAAO,CAACD,SAAS,CAAC;IAC7B;IAEA,MAAMK,QAAQ,GAAGH,WAAW,CAACI,GAAG,CAACC,EAAE,IAAIA,EAAE,CAACF,QAAQ,CAAC,CAACG,IAAI,CAAC,GAAG,CAAC;IAE7D,IAAI,CAAC,IAAI,CAACX,KAAK,CAACY,GAAG,CAACJ,QAAQ,CAAC,EAAE;MAC3B;AACZ;AACA;MACY,MAAMK,KAAK,GAAGR,WAAW,CAACI,GAAG,CAACf,UAAU,CAAC,CAACoB,MAAM,CAACC,OAAO,CAAiB;MACzE,IAAI,CAACf,KAAK,CAACgB,GAAG,CAACR,QAAQ,EAAEhB,UAAU,CAACyB,IAAI,CAACJ,KAAK,CAAC,CAAC;IACpD;IAEA,OAAO,IAAI,CAACb,KAAK,CAACkB,GAAG,CAACV,QAAQ,CAAC,CAACN,OAAO,CAACC,SAAS,EAAEC,OAAO,CAAC;EAC/D;AACJ","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { ApolloLink } from "apollo-link";
1
+ import type { ApolloLink } from "apollo-link";
2
2
  import { Plugin } from "@webiny/plugins";
3
3
  export interface ApolloLinkFactory {
4
4
  (): ApolloLink;
@@ -1 +1 @@
1
- {"version":3,"names":["nanoid","Plugin","ApolloLinkPlugin","type","constructor","factory","cacheKey","createLink","cache","Error","name"],"sources":["ApolloLinkPlugin.ts"],"sourcesContent":["import { ApolloLink } from \"apollo-link\";\nimport { nanoid } from \"nanoid\";\nimport { Plugin } from \"@webiny/plugins\";\n\nexport interface ApolloLinkFactory {\n (): ApolloLink;\n}\n\nexport class ApolloLinkPlugin extends Plugin {\n public static override readonly type: string = \"apollo-link\";\n public readonly cacheKey;\n private readonly factory?: ApolloLinkFactory;\n private cache?: ApolloLink;\n\n constructor(factory?: ApolloLinkFactory) {\n super();\n this.factory = factory;\n this.cacheKey = nanoid();\n }\n\n public createLink(): ApolloLink {\n if (this.cache) {\n return this.cache;\n }\n\n if (typeof this.factory === \"function\") {\n this.cache = this.factory();\n\n return this.cache;\n }\n\n throw Error(\n `Missing ApolloLinkFactory in plugin \"${this.name}\"! Either pass a factory to ApolloLinkPlugin constructor or extend the class and override the \"createLink\" method.`\n );\n }\n}\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,QAAQ;AAC/B,SAASC,MAAM,QAAQ,iBAAiB;AAMxC,OAAO,MAAMC,gBAAgB,SAASD,MAAM,CAAC;EACzC,OAAgCE,IAAI,GAAW,aAAa;EAK5DC,WAAWA,CAACC,OAA2B,EAAE;IACrC,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,QAAQ,GAAGN,MAAM,CAAC,CAAC;EAC5B;EAEOO,UAAUA,CAAA,EAAe;IAC5B,IAAI,IAAI,CAACC,KAAK,EAAE;MACZ,OAAO,IAAI,CAACA,KAAK;IACrB;IAEA,IAAI,OAAO,IAAI,CAACH,OAAO,KAAK,UAAU,EAAE;MACpC,IAAI,CAACG,KAAK,GAAG,IAAI,CAACH,OAAO,CAAC,CAAC;MAE3B,OAAO,IAAI,CAACG,KAAK;IACrB;IAEA,MAAMC,KAAK,CACP,wCAAwC,IAAI,CAACC,IAAI,oHACrD,CAAC;EACL;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["nanoid","Plugin","ApolloLinkPlugin","type","constructor","factory","cacheKey","createLink","cache","Error","name"],"sources":["ApolloLinkPlugin.ts"],"sourcesContent":["import type { ApolloLink } from \"apollo-link\";\nimport { nanoid } from \"nanoid\";\nimport { Plugin } from \"@webiny/plugins\";\n\nexport interface ApolloLinkFactory {\n (): ApolloLink;\n}\n\nexport class ApolloLinkPlugin extends Plugin {\n public static override readonly type: string = \"apollo-link\";\n public readonly cacheKey;\n private readonly factory?: ApolloLinkFactory;\n private cache?: ApolloLink;\n\n constructor(factory?: ApolloLinkFactory) {\n super();\n this.factory = factory;\n this.cacheKey = nanoid();\n }\n\n public createLink(): ApolloLink {\n if (this.cache) {\n return this.cache;\n }\n\n if (typeof this.factory === \"function\") {\n this.cache = this.factory();\n\n return this.cache;\n }\n\n throw Error(\n `Missing ApolloLinkFactory in plugin \"${this.name}\"! Either pass a factory to ApolloLinkPlugin constructor or extend the class and override the \"createLink\" method.`\n );\n }\n}\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,QAAQ;AAC/B,SAASC,MAAM,QAAQ,iBAAiB;AAMxC,OAAO,MAAMC,gBAAgB,SAASD,MAAM,CAAC;EACzC,OAAgCE,IAAI,GAAW,aAAa;EAK5DC,WAAWA,CAACC,OAA2B,EAAE;IACrC,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,QAAQ,GAAGN,MAAM,CAAC,CAAC;EAC5B;EAEOO,UAAUA,CAAA,EAAe;IAC5B,IAAI,IAAI,CAACC,KAAK,EAAE;MACZ,OAAO,IAAI,CAACA,KAAK;IACrB;IAEA,IAAI,OAAO,IAAI,CAACH,OAAO,KAAK,UAAU,EAAE;MACpC,IAAI,CAACG,KAAK,GAAG,IAAI,CAACH,OAAO,CAAC,CAAC;MAE3B,OAAO,IAAI,CAACG,KAAK;IACrB;IAEA,MAAMC,KAAK,CACP,wCAAwC,IAAI,CAACC,IAAI,oHACrD,CAAC;EACL;AACJ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["ApolloLink","ApolloLinkPlugin","ConsoleLinkPlugin","createLink","operation","forward","firstDefinition","query","definitions","isQuery","map","data","extensions","Array","isArray","console","length","variables","JSON","stringify","groupCollapsed","operationName","forEach","log","method","args","groupEnd"],"sources":["ConsoleLinkPlugin.ts"],"sourcesContent":["import { ApolloLink, FetchResult as BaseFetchResult } from \"apollo-link\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin\";\nimport { OperationDefinitionNode } from \"graphql/language/ast\";\n\ninterface Log {\n args: any[];\n method: \"error\" | \"info\" | \"log\" | \"warn\";\n}\n\ninterface FetchResult extends BaseFetchResult {\n extensions?: {\n console?: Log[];\n };\n}\n\n/**\n * This link checks for presence of `extensions.console` in the response and logs all items to browser console.\n */\nexport class ConsoleLinkPlugin extends ApolloLinkPlugin {\n public override createLink() {\n return new ApolloLink((operation, forward) => {\n const firstDefinition = operation.query.definitions[0] as OperationDefinitionNode;\n const isQuery = firstDefinition[\"operation\"] === \"query\";\n\n return forward(operation).map((data: FetchResult) => {\n if (\n data.extensions &&\n Array.isArray(data.extensions.console) &&\n data.extensions.console.length\n ) {\n const variables = isQuery\n ? JSON.stringify(operation.variables)\n : \"{ see request details in the Network tab }\";\n console.groupCollapsed(\n `Logs for graphQL ${isQuery ? \"query\" : \"mutation\"}: %c${\n operation.operationName || \"anonymous operation\"\n } %c${variables}%c`,\n \"color: #fa5a28\",\n \"color: #6b6b6b\",\n \"color: black\"\n );\n data.extensions.console.forEach((log: Log) => {\n console[log.method](...log.args);\n });\n console.groupEnd();\n }\n\n return data;\n });\n });\n }\n}\n"],"mappings":"AAAA,SAASA,UAAU,QAAwC,aAAa;AACxE,SAASC,gBAAgB;AAczB;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,SAASD,gBAAgB,CAAC;EACpCE,UAAUA,CAAA,EAAG;IACzB,OAAO,IAAIH,UAAU,CAAC,CAACI,SAAS,EAAEC,OAAO,KAAK;MAC1C,MAAMC,eAAe,GAAGF,SAAS,CAACG,KAAK,CAACC,WAAW,CAAC,CAAC,CAA4B;MACjF,MAAMC,OAAO,GAAGH,eAAe,CAAC,WAAW,CAAC,KAAK,OAAO;MAExD,OAAOD,OAAO,CAACD,SAAS,CAAC,CAACM,GAAG,CAAEC,IAAiB,IAAK;QACjD,IACIA,IAAI,CAACC,UAAU,IACfC,KAAK,CAACC,OAAO,CAACH,IAAI,CAACC,UAAU,CAACG,OAAO,CAAC,IACtCJ,IAAI,CAACC,UAAU,CAACG,OAAO,CAACC,MAAM,EAChC;UACE,MAAMC,SAAS,GAAGR,OAAO,GACnBS,IAAI,CAACC,SAAS,CAACf,SAAS,CAACa,SAAS,CAAC,GACnC,4CAA4C;UAClDF,OAAO,CAACK,cAAc,CAClB,oBAAoBX,OAAO,GAAG,OAAO,GAAG,UAAU,OAC9CL,SAAS,CAACiB,aAAa,IAAI,qBAAqB,MAC9CJ,SAAS,IAAI,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,cACJ,CAAC;UACDN,IAAI,CAACC,UAAU,CAACG,OAAO,CAACO,OAAO,CAAEC,GAAQ,IAAK;YAC1CR,OAAO,CAACQ,GAAG,CAACC,MAAM,CAAC,CAAC,GAAGD,GAAG,CAACE,IAAI,CAAC;UACpC,CAAC,CAAC;UACFV,OAAO,CAACW,QAAQ,CAAC,CAAC;QACtB;QAEA,OAAOf,IAAI;MACf,CAAC,CAAC;IACN,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["ApolloLink","ApolloLinkPlugin","ConsoleLinkPlugin","createLink","operation","forward","firstDefinition","query","definitions","isQuery","map","data","extensions","Array","isArray","console","length","variables","JSON","stringify","groupCollapsed","operationName","forEach","log","method","args","groupEnd"],"sources":["ConsoleLinkPlugin.ts"],"sourcesContent":["import type { FetchResult as BaseFetchResult } from \"apollo-link\";\nimport { ApolloLink } from \"apollo-link\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin\";\nimport type { OperationDefinitionNode } from \"graphql/language/ast\";\n\ninterface Log {\n args: any[];\n method: \"error\" | \"info\" | \"log\" | \"warn\";\n}\n\ninterface FetchResult extends BaseFetchResult {\n extensions?: {\n console?: Log[];\n };\n}\n\n/**\n * This link checks for presence of `extensions.console` in the response and logs all items to browser console.\n */\nexport class ConsoleLinkPlugin extends ApolloLinkPlugin {\n public override createLink() {\n return new ApolloLink((operation, forward) => {\n const firstDefinition = operation.query.definitions[0] as OperationDefinitionNode;\n const isQuery = firstDefinition[\"operation\"] === \"query\";\n\n return forward(operation).map((data: FetchResult) => {\n if (\n data.extensions &&\n Array.isArray(data.extensions.console) &&\n data.extensions.console.length\n ) {\n const variables = isQuery\n ? JSON.stringify(operation.variables)\n : \"{ see request details in the Network tab }\";\n console.groupCollapsed(\n `Logs for graphQL ${isQuery ? \"query\" : \"mutation\"}: %c${\n operation.operationName || \"anonymous operation\"\n } %c${variables}%c`,\n \"color: #fa5a28\",\n \"color: #6b6b6b\",\n \"color: black\"\n );\n data.extensions.console.forEach((log: Log) => {\n console[log.method](...log.args);\n });\n console.groupEnd();\n }\n\n return data;\n });\n });\n }\n}\n"],"mappings":"AACA,SAASA,UAAU,QAAQ,aAAa;AACxC,SAASC,gBAAgB;AAczB;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,SAASD,gBAAgB,CAAC;EACpCE,UAAUA,CAAA,EAAG;IACzB,OAAO,IAAIH,UAAU,CAAC,CAACI,SAAS,EAAEC,OAAO,KAAK;MAC1C,MAAMC,eAAe,GAAGF,SAAS,CAACG,KAAK,CAACC,WAAW,CAAC,CAAC,CAA4B;MACjF,MAAMC,OAAO,GAAGH,eAAe,CAAC,WAAW,CAAC,KAAK,OAAO;MAExD,OAAOD,OAAO,CAACD,SAAS,CAAC,CAACM,GAAG,CAAEC,IAAiB,IAAK;QACjD,IACIA,IAAI,CAACC,UAAU,IACfC,KAAK,CAACC,OAAO,CAACH,IAAI,CAACC,UAAU,CAACG,OAAO,CAAC,IACtCJ,IAAI,CAACC,UAAU,CAACG,OAAO,CAACC,MAAM,EAChC;UACE,MAAMC,SAAS,GAAGR,OAAO,GACnBS,IAAI,CAACC,SAAS,CAACf,SAAS,CAACa,SAAS,CAAC,GACnC,4CAA4C;UAClDF,OAAO,CAACK,cAAc,CAClB,oBAAoBX,OAAO,GAAG,OAAO,GAAG,UAAU,OAC9CL,SAAS,CAACiB,aAAa,IAAI,qBAAqB,MAC9CJ,SAAS,IAAI,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,cACJ,CAAC;UACDN,IAAI,CAACC,UAAU,CAACG,OAAO,CAACO,OAAO,CAAEC,GAAQ,IAAK;YAC1CR,OAAO,CAACQ,GAAG,CAACC,MAAM,CAAC,CAAC,GAAGD,GAAG,CAACE,IAAI,CAAC;UACpC,CAAC,CAAC;UACFV,OAAO,CAACW,QAAQ,CAAC,CAAC;QACtB;QAEA,OAAOf,IAAI;MACf,CAAC,CAAC;IACN,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import { ApolloLinkPlugin } from "./ApolloLinkPlugin";
2
- import { ApolloLink } from "apollo-link";
2
+ import type { ApolloLink } from "apollo-link";
3
3
  /**
4
4
  * Append `x-i18n-locale` header from URL query (necessary for prerendering service).
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"names":["setContext","ApolloLinkPlugin","getLocaleCode","LocaleHeaderLinkPlugin","constructor","locale","createLink","_","headers"],"sources":["LocaleHeaderLinkPlugin.ts"],"sourcesContent":["import { setContext } from \"apollo-link-context\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin\";\nimport { ApolloLink } from \"apollo-link\";\nimport { getLocaleCode } from \"~/utils\";\n\n/**\n * Append `x-i18n-locale` header from URL query (necessary for prerendering service).\n */\nexport class LocaleHeaderLinkPlugin extends ApolloLinkPlugin {\n private readonly locale: string;\n\n constructor(locale?: string) {\n super();\n\n this.locale = locale || (getLocaleCode() as string);\n }\n\n public override createLink(): ApolloLink {\n return setContext((_, { headers }) => {\n if (this.locale) {\n return {\n headers: {\n ...headers,\n \"x-i18n-locale\": `content:${this.locale};`\n }\n };\n }\n\n return { headers };\n });\n }\n}\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,qBAAqB;AAChD,SAASC,gBAAgB;AAEzB,SAASC,aAAa;;AAEtB;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,SAASF,gBAAgB,CAAC;EAGzDG,WAAWA,CAACC,MAAe,EAAE;IACzB,KAAK,CAAC,CAAC;IAEP,IAAI,CAACA,MAAM,GAAGA,MAAM,IAAKH,aAAa,CAAC,CAAY;EACvD;EAEgBI,UAAUA,CAAA,EAAe;IACrC,OAAON,UAAU,CAAC,CAACO,CAAC,EAAE;MAAEC;IAAQ,CAAC,KAAK;MAClC,IAAI,IAAI,CAACH,MAAM,EAAE;QACb,OAAO;UACHG,OAAO,EAAE;YACL,GAAGA,OAAO;YACV,eAAe,EAAE,WAAW,IAAI,CAACH,MAAM;UAC3C;QACJ,CAAC;MACL;MAEA,OAAO;QAAEG;MAAQ,CAAC;IACtB,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["setContext","ApolloLinkPlugin","getLocaleCode","LocaleHeaderLinkPlugin","constructor","locale","createLink","_","headers"],"sources":["LocaleHeaderLinkPlugin.ts"],"sourcesContent":["import { setContext } from \"apollo-link-context\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin\";\nimport type { ApolloLink } from \"apollo-link\";\nimport { getLocaleCode } from \"~/utils\";\n\n/**\n * Append `x-i18n-locale` header from URL query (necessary for prerendering service).\n */\nexport class LocaleHeaderLinkPlugin extends ApolloLinkPlugin {\n private readonly locale: string;\n\n constructor(locale?: string) {\n super();\n\n this.locale = locale || (getLocaleCode() as string);\n }\n\n public override createLink(): ApolloLink {\n return setContext((_, { headers }) => {\n if (this.locale) {\n return {\n headers: {\n ...headers,\n \"x-i18n-locale\": `content:${this.locale};`\n }\n };\n }\n\n return { headers };\n });\n }\n}\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,qBAAqB;AAChD,SAASC,gBAAgB;AAEzB,SAASC,aAAa;;AAEtB;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,SAASF,gBAAgB,CAAC;EAGzDG,WAAWA,CAACC,MAAe,EAAE;IACzB,KAAK,CAAC,CAAC;IAEP,IAAI,CAACA,MAAM,GAAGA,MAAM,IAAKH,aAAa,CAAC,CAAY;EACvD;EAEgBI,UAAUA,CAAA,EAAe;IACrC,OAAON,UAAU,CAAC,CAACO,CAAC,EAAE;MAAEC;IAAQ,CAAC,KAAK;MAClC,IAAI,IAAI,CAACH,MAAM,EAAE;QACb,OAAO;UACHG,OAAO,EAAE;YACL,GAAGA,OAAO;YACV,eAAe,EAAE,WAAW,IAAI,CAACH,MAAM;UAC3C;QACJ,CAAC;MACL;MAEA,OAAO;QAAEG;MAAQ,CAAC;IACtB,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { ServerError, ServerParseError } from "apollo-link-http-common";
1
+ import type { ServerError, ServerParseError } from "apollo-link-http-common";
2
2
  interface CreateErrorOverlayParams {
3
3
  query: string;
4
4
  networkError: Error | ServerError | ServerParseError;
@@ -1 +1 @@
1
- {"version":3,"names":["React","render","ErrorOverlay","createErrorOverlay","params","query","networkError","document","getElementById","container","createElement","id","body","getElementsByTagName","appendChild"],"sources":["createErrorOverlay.tsx"],"sourcesContent":["import React from \"react\";\n/**\n * TODO fix with react 19\n */\n// eslint-disable-next-line react/no-deprecated\nimport { render } from \"react-dom\";\nimport ErrorOverlay from \"./ErrorOverlay\";\nimport { ServerError, ServerParseError } from \"apollo-link-http-common\";\n\ninterface CreateErrorOverlayParams {\n query: string;\n networkError: Error | ServerError | ServerParseError;\n}\nconst createErrorOverlay = (params: CreateErrorOverlayParams): void => {\n const { query, networkError } = params;\n // If the element already present in DOM, return immediately.\n if (document.getElementById(\"overlay-root\")) {\n return;\n }\n // Create root element to hold React tree.\n const container: HTMLDivElement = document.createElement(\"div\");\n container.id = \"overlay-root\";\n // Insert root element into body.\n const body: HTMLBodyElement = document.getElementsByTagName(\"body\")[0];\n body.appendChild(container);\n // Mount the ErrorOverlay component into root element.\n render(<ErrorOverlay query={query} networkError={networkError} />, container);\n};\n\nexport default createErrorOverlay;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB;AACA;AACA;AACA;AACA,SAASC,MAAM,QAAQ,WAAW;AAClC,OAAOC,YAAY;AAOnB,MAAMC,kBAAkB,GAAIC,MAAgC,IAAW;EACnE,MAAM;IAAEC,KAAK;IAAEC;EAAa,CAAC,GAAGF,MAAM;EACtC;EACA,IAAIG,QAAQ,CAACC,cAAc,CAAC,cAAc,CAAC,EAAE;IACzC;EACJ;EACA;EACA,MAAMC,SAAyB,GAAGF,QAAQ,CAACG,aAAa,CAAC,KAAK,CAAC;EAC/DD,SAAS,CAACE,EAAE,GAAG,cAAc;EAC7B;EACA,MAAMC,IAAqB,GAAGL,QAAQ,CAACM,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;EACtED,IAAI,CAACE,WAAW,CAACL,SAAS,CAAC;EAC3B;EACAR,MAAM,cAACD,KAAA,CAAAU,aAAA,CAACR,YAAY;IAACG,KAAK,EAAEA,KAAM;IAACC,YAAY,EAAEA;EAAa,CAAE,CAAC,EAAEG,SAAS,CAAC;AACjF,CAAC;AAED,eAAeN,kBAAkB","ignoreList":[]}
1
+ {"version":3,"names":["React","render","ErrorOverlay","createErrorOverlay","params","query","networkError","document","getElementById","container","createElement","id","body","getElementsByTagName","appendChild"],"sources":["createErrorOverlay.tsx"],"sourcesContent":["import React from \"react\";\n/**\n * TODO fix with react 19\n */\n// eslint-disable-next-line react/no-deprecated\nimport { render } from \"react-dom\";\nimport ErrorOverlay from \"./ErrorOverlay\";\nimport type { ServerError, ServerParseError } from \"apollo-link-http-common\";\n\ninterface CreateErrorOverlayParams {\n query: string;\n networkError: Error | ServerError | ServerParseError;\n}\nconst createErrorOverlay = (params: CreateErrorOverlayParams): void => {\n const { query, networkError } = params;\n // If the element already present in DOM, return immediately.\n if (document.getElementById(\"overlay-root\")) {\n return;\n }\n // Create root element to hold React tree.\n const container: HTMLDivElement = document.createElement(\"div\");\n container.id = \"overlay-root\";\n // Insert root element into body.\n const body: HTMLBodyElement = document.getElementsByTagName(\"body\")[0];\n body.appendChild(container);\n // Mount the ErrorOverlay component into root element.\n render(<ErrorOverlay query={query} networkError={networkError} />, container);\n};\n\nexport default createErrorOverlay;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB;AACA;AACA;AACA;AACA,SAASC,MAAM,QAAQ,WAAW;AAClC,OAAOC,YAAY;AAOnB,MAAMC,kBAAkB,GAAIC,MAAgC,IAAW;EACnE,MAAM;IAAEC,KAAK;IAAEC;EAAa,CAAC,GAAGF,MAAM;EACtC;EACA,IAAIG,QAAQ,CAACC,cAAc,CAAC,cAAc,CAAC,EAAE;IACzC;EACJ;EACA;EACA,MAAMC,SAAyB,GAAGF,QAAQ,CAACG,aAAa,CAAC,KAAK,CAAC;EAC/DD,SAAS,CAACE,EAAE,GAAG,cAAc;EAC7B;EACA,MAAMC,IAAqB,GAAGL,QAAQ,CAACM,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;EACtED,IAAI,CAACE,WAAW,CAACL,SAAS,CAAC;EAC3B;EACAR,MAAM,cAACD,KAAA,CAAAU,aAAA,CAACR,YAAY;IAACG,KAAK,EAAEA,KAAM;IAACC,YAAY,EAAEA;EAAa,CAAE,CAAC,EAAEG,SAAS,CAAC;AACjF,CAAC;AAED,eAAeN,kBAAkB","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import type * as React from "react";
2
2
  import { Plugin } from "@webiny/plugins";
3
3
  interface Config {
4
4
  route: React.ReactElement | null;
@@ -1 +1 @@
1
- {"version":3,"names":["Plugin","RoutePlugin","type","constructor","config","_config","route"],"sources":["RoutePlugin.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Plugin } from \"@webiny/plugins\";\n\ninterface Config {\n route: React.ReactElement | null;\n}\n\nexport class RoutePlugin extends Plugin {\n public static override readonly type: string = \"route\";\n private _config: Partial<Config>;\n\n constructor(config?: Config) {\n super();\n this._config = config || {};\n }\n\n get route(): Config[\"route\"] {\n if (!this._config.route) {\n return null;\n }\n return this._config.route;\n }\n}\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,iBAAiB;AAMxC,OAAO,MAAMC,WAAW,SAASD,MAAM,CAAC;EACpC,OAAgCE,IAAI,GAAW,OAAO;EAGtDC,WAAWA,CAACC,MAAe,EAAE;IACzB,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,OAAO,GAAGD,MAAM,IAAI,CAAC,CAAC;EAC/B;EAEA,IAAIE,KAAKA,CAAA,EAAoB;IACzB,IAAI,CAAC,IAAI,CAACD,OAAO,CAACC,KAAK,EAAE;MACrB,OAAO,IAAI;IACf;IACA,OAAO,IAAI,CAACD,OAAO,CAACC,KAAK;EAC7B;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["Plugin","RoutePlugin","type","constructor","config","_config","route"],"sources":["RoutePlugin.tsx"],"sourcesContent":["import type * as React from \"react\";\nimport { Plugin } from \"@webiny/plugins\";\n\ninterface Config {\n route: React.ReactElement | null;\n}\n\nexport class RoutePlugin extends Plugin {\n public static override readonly type: string = \"route\";\n private _config: Partial<Config>;\n\n constructor(config?: Config) {\n super();\n this._config = config || {};\n }\n\n get route(): Config[\"route\"] {\n if (!this._config.route) {\n return null;\n }\n return this._config.route;\n }\n}\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,iBAAiB;AAMxC,OAAO,MAAMC,WAAW,SAASD,MAAM,CAAC;EACpC,OAAgCE,IAAI,GAAW,OAAO;EAGtDC,WAAWA,CAACC,MAAe,EAAE;IACzB,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,OAAO,GAAGD,MAAM,IAAI,CAAC,CAAC;EAC/B;EAEA,IAAIE,KAAKA,CAAA,EAAoB;IACzB,IAAI,CAAC,IAAI,CAACD,OAAO,CAACC,KAAK,EAAE;MACrB,OAAO,IAAI;IACf;IACA,OAAO,IAAI,CAACD,OAAO,CAACC,KAAK;EAC7B;AACJ","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import { ApolloLinkPlugin } from "./ApolloLinkPlugin";
2
- import { ApolloLink } from "apollo-link";
2
+ import type { ApolloLink } from "apollo-link";
3
3
  /**
4
4
  * Append `x-tenant` header from URL query (necessary for prerendering service).
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"names":["setContext","ApolloLinkPlugin","getTenantId","TenantHeaderLinkPlugin","constructor","tenant","name","createLink","_","headers"],"sources":["TenantHeaderLinkPlugin.ts"],"sourcesContent":["import { setContext } from \"apollo-link-context\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin\";\nimport { ApolloLink } from \"apollo-link\";\nimport { getTenantId } from \"~/utils\";\n\n/**\n * Append `x-tenant` header from URL query (necessary for prerendering service).\n */\nexport class TenantHeaderLinkPlugin extends ApolloLinkPlugin {\n private readonly tenant: string;\n\n public constructor(tenant?: string) {\n super();\n this.name = \"tenant-header-link\";\n\n this.tenant = tenant || (getTenantId() as string);\n }\n\n public override createLink(): ApolloLink {\n return setContext((_, { headers }) => {\n // If tenant header is already set, do not overwrite it.\n if (headers && \"x-tenant\" in headers) {\n return { headers };\n }\n\n if (this.tenant) {\n return {\n headers: {\n ...headers,\n \"x-tenant\": this.tenant\n }\n };\n }\n\n return { headers };\n });\n }\n}\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,qBAAqB;AAChD,SAASC,gBAAgB;AAEzB,SAASC,WAAW;;AAEpB;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,SAASF,gBAAgB,CAAC;EAGlDG,WAAWA,CAACC,MAAe,EAAE;IAChC,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,IAAI,GAAG,oBAAoB;IAEhC,IAAI,CAACD,MAAM,GAAGA,MAAM,IAAKH,WAAW,CAAC,CAAY;EACrD;EAEgBK,UAAUA,CAAA,EAAe;IACrC,OAAOP,UAAU,CAAC,CAACQ,CAAC,EAAE;MAAEC;IAAQ,CAAC,KAAK;MAClC;MACA,IAAIA,OAAO,IAAI,UAAU,IAAIA,OAAO,EAAE;QAClC,OAAO;UAAEA;QAAQ,CAAC;MACtB;MAEA,IAAI,IAAI,CAACJ,MAAM,EAAE;QACb,OAAO;UACHI,OAAO,EAAE;YACL,GAAGA,OAAO;YACV,UAAU,EAAE,IAAI,CAACJ;UACrB;QACJ,CAAC;MACL;MAEA,OAAO;QAAEI;MAAQ,CAAC;IACtB,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["setContext","ApolloLinkPlugin","getTenantId","TenantHeaderLinkPlugin","constructor","tenant","name","createLink","_","headers"],"sources":["TenantHeaderLinkPlugin.ts"],"sourcesContent":["import { setContext } from \"apollo-link-context\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin\";\nimport type { ApolloLink } from \"apollo-link\";\nimport { getTenantId } from \"~/utils\";\n\n/**\n * Append `x-tenant` header from URL query (necessary for prerendering service).\n */\nexport class TenantHeaderLinkPlugin extends ApolloLinkPlugin {\n private readonly tenant: string;\n\n public constructor(tenant?: string) {\n super();\n this.name = \"tenant-header-link\";\n\n this.tenant = tenant || (getTenantId() as string);\n }\n\n public override createLink(): ApolloLink {\n return setContext((_, { headers }) => {\n // If tenant header is already set, do not overwrite it.\n if (headers && \"x-tenant\" in headers) {\n return { headers };\n }\n\n if (this.tenant) {\n return {\n headers: {\n ...headers,\n \"x-tenant\": this.tenant\n }\n };\n }\n\n return { headers };\n });\n }\n}\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,qBAAqB;AAChD,SAASC,gBAAgB;AAEzB,SAASC,WAAW;;AAEpB;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,SAASF,gBAAgB,CAAC;EAGlDG,WAAWA,CAACC,MAAe,EAAE;IAChC,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,IAAI,GAAG,oBAAoB;IAEhC,IAAI,CAACD,MAAM,GAAGA,MAAM,IAAKH,WAAW,CAAC,CAAY;EACrD;EAEgBK,UAAUA,CAAA,EAAe;IACrC,OAAOP,UAAU,CAAC,CAACQ,CAAC,EAAE;MAAEC;IAAQ,CAAC,KAAK;MAClC;MACA,IAAIA,OAAO,IAAI,UAAU,IAAIA,OAAO,EAAE;QAClC,OAAO;UAAEA;QAAQ,CAAC;MACtB;MAEA,IAAI,IAAI,CAACJ,MAAM,EAAE;QACb,OAAO;UACHI,OAAO,EAAE;YACL,GAAGA,OAAO;YACV,UAAU,EAAE,IAAI,CAACJ;UACrB;QACJ,CAAC;MACL;MAEA,OAAO;QAAEI;MAAQ,CAAC;IACtB,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import type * as React from "react";
2
2
  import { Plugin } from "@webiny/plugins";
3
3
  interface Config<Props> {
4
4
  name: string;
@@ -1 +1 @@
1
- {"version":3,"names":["Plugin","ViewPlugin","type","constructor","config","_config","key","name","render","props"],"sources":["ViewPlugin.ts"],"sourcesContent":["import * as React from \"react\";\nimport { Plugin } from \"@webiny/plugins\";\n\ninterface Config<Props> {\n name: string;\n render(props: Props): React.ReactElement | null;\n}\n\nexport class ViewPlugin<Props = any> extends Plugin {\n public static override readonly type: string = \"view\";\n private readonly _config: Partial<Config<Props>>;\n\n public constructor(config?: Config<Props>) {\n super();\n this._config = config || {};\n }\n\n get key() {\n return this._config.name;\n }\n\n public render(props: Props) {\n if (!this._config.render) {\n return null;\n }\n return this._config.render(props);\n }\n}\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,iBAAiB;AAOxC,OAAO,MAAMC,UAAU,SAAsBD,MAAM,CAAC;EAChD,OAAgCE,IAAI,GAAW,MAAM;EAG9CC,WAAWA,CAACC,MAAsB,EAAE;IACvC,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,OAAO,GAAGD,MAAM,IAAI,CAAC,CAAC;EAC/B;EAEA,IAAIE,GAAGA,CAAA,EAAG;IACN,OAAO,IAAI,CAACD,OAAO,CAACE,IAAI;EAC5B;EAEOC,MAAMA,CAACC,KAAY,EAAE;IACxB,IAAI,CAAC,IAAI,CAACJ,OAAO,CAACG,MAAM,EAAE;MACtB,OAAO,IAAI;IACf;IACA,OAAO,IAAI,CAACH,OAAO,CAACG,MAAM,CAACC,KAAK,CAAC;EACrC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["Plugin","ViewPlugin","type","constructor","config","_config","key","name","render","props"],"sources":["ViewPlugin.ts"],"sourcesContent":["import type * as React from \"react\";\nimport { Plugin } from \"@webiny/plugins\";\n\ninterface Config<Props> {\n name: string;\n render(props: Props): React.ReactElement | null;\n}\n\nexport class ViewPlugin<Props = any> extends Plugin {\n public static override readonly type: string = \"view\";\n private readonly _config: Partial<Config<Props>>;\n\n public constructor(config?: Config<Props>) {\n super();\n this._config = config || {};\n }\n\n get key() {\n return this._config.name;\n }\n\n public render(props: Props) {\n if (!this._config.render) {\n return null;\n }\n return this._config.render(props);\n }\n}\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,iBAAiB;AAOxC,OAAO,MAAMC,UAAU,SAAsBD,MAAM,CAAC;EAChD,OAAgCE,IAAI,GAAW,MAAM;EAG9CC,WAAWA,CAACC,MAAsB,EAAE;IACvC,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,OAAO,GAAGD,MAAM,IAAI,CAAC,CAAC;EAC/B;EAEA,IAAIE,GAAGA,CAAA,EAAG;IACN,OAAO,IAAI,CAACD,OAAO,CAACE,IAAI;EAC5B;EAEOC,MAAMA,CAACC,KAAY,EAAE;IACxB,IAAI,CAAC,IAAI,CAACJ,OAAO,CAACG,MAAM,EAAE;MACtB,OAAO,IAAI;IACf;IACA,OAAO,IAAI,CAACH,OAAO,CAACG,MAAM,CAACC,KAAK,CAAC;EACrC;AACJ","ignoreList":[]}
@@ -1,3 +1,3 @@
1
- import { ImageComponentPlugin } from "../types";
1
+ import type { ImageComponentPlugin } from "../types";
2
2
  declare const _default: () => ImageComponentPlugin;
3
3
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"names":["React","Image","SUPPORTED_IMAGE_RESIZE_WIDTHS","getSupportedImageResizeWidth","width","output","i","length","sanitizeTransformArgs","args","undefined","parseInt","getSizes","endsWith","isFixedImageWidth","Number","isFinite","getSrcSetAutoSizes","max","maxWidth","filter","supportedWidth","convertTransformToQueryParams","transform","Object","keys","map","key","join","imagePlugin","name","type","presets","avatar","getImageSrc","props","src","startsWith","sanitizedParams","params","render","srcSet","srcSetInitial","imageProps","sizes","forcedWidth","style","srcSetAutoWidths","forEach","createElement","assign"],"sources":["image.tsx"],"sourcesContent":["import React from \"react\";\nimport { Image } from \"@webiny/ui/Image\";\nimport { ImageComponentPlugin } from \"~/types\";\n\nconst SUPPORTED_IMAGE_RESIZE_WIDTHS = [100, 300, 500, 750, 1000, 1500, 2500];\n\n/**\n * Width of the image should not be just any random number. For optimization reasons,\n * we only allow the ones listed in SUPPORTED_IMAGE_RESIZE_WIDTHS list (Webiny Cloud supports only these).\n */\nconst getSupportedImageResizeWidth = (width: number) => {\n let output = SUPPORTED_IMAGE_RESIZE_WIDTHS[0];\n let i = SUPPORTED_IMAGE_RESIZE_WIDTHS.length;\n while (i >= 0) {\n if (width === SUPPORTED_IMAGE_RESIZE_WIDTHS[i]) {\n output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i];\n break;\n }\n\n if (width > SUPPORTED_IMAGE_RESIZE_WIDTHS[i]) {\n // Use next larger width. If there isn't any, use current.\n output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i + 1];\n if (!output) {\n output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i];\n }\n break;\n }\n\n i--;\n }\n\n return output;\n};\n\ninterface SanitizeTransformArgsParams {\n width?: string;\n}\ninterface SanitizeTransformArgsResult {\n width?: number;\n}\n/**\n * Currently we only allow \"width\" as a transform option.\n * @param args\n */\nconst sanitizeTransformArgs = (args?: SanitizeTransformArgsParams): SanitizeTransformArgsResult => {\n const output: SanitizeTransformArgsResult = {};\n if (!args || args.width === undefined || args.width === null) {\n return output;\n }\n const width = parseInt(args.width);\n if (width > 0) {\n output.width = getSupportedImageResizeWidth(width);\n }\n\n return output;\n};\n\nconst getSizes = (width?: string | number): string | undefined => {\n if (typeof width !== \"string\") {\n return undefined;\n }\n // Check if width was set as percentage, with \"%\" in the value.\n if (width.endsWith(\"%\")) {\n return `${parseInt(width)}vw`;\n }\n // Check if width was set as viewport width, with \"vw\" in the value.\n if (width.endsWith(\"vw\")) {\n return `${parseInt(width)}vw`;\n }\n\n // Check if width was set as relative, with \"em\" in the value.\n if (width.endsWith(\"em\")) {\n return `${parseInt(width)}em`;\n }\n\n return undefined;\n};\n\nconst isFixedImageWidth = (width?: number | string) => {\n if (Number.isFinite(width)) {\n return true;\n }\n\n if (typeof width === \"string\" && width.endsWith(\"px\")) {\n return true;\n }\n return false;\n};\n\nconst getSrcSetAutoSizes = (max?: string | number) => {\n max = isFixedImageWidth(max) ? parseInt(\"\" + max) : 2500;\n const maxWidth = getSupportedImageResizeWidth(max);\n return SUPPORTED_IMAGE_RESIZE_WIDTHS.filter((supportedWidth: number) => {\n return supportedWidth <= maxWidth;\n });\n};\n\nconst convertTransformToQueryParams = (transform: Record<string, any>): string => {\n return Object.keys(transform)\n .map(key => `${key}=${transform[key]}`)\n .join(\"&\");\n};\n\nexport default () => {\n const imagePlugin: ImageComponentPlugin = {\n name: \"image-component\",\n type: \"image-component\",\n presets: {\n avatar: { width: 300 }\n },\n getImageSrc: (props?: Record<string, any>) => {\n if (!props) {\n return \"\";\n }\n\n const { src, transform } = props;\n if (!transform) {\n return src;\n }\n\n if (!src || src.startsWith(\"data:\") || src.endsWith(\"svg\")) {\n return src;\n }\n\n const sanitizedParams = sanitizeTransformArgs(transform);\n const params = convertTransformToQueryParams(sanitizedParams);\n return src + \"?\" + params;\n },\n render(props) {\n const { transform, srcSet: srcSetInitial, ...imageProps } = props;\n let srcSet: any = srcSetInitial;\n let sizes: string | undefined;\n const src = imageProps.src;\n if (srcSet && srcSet === \"auto\") {\n srcSet = {};\n\n // Check if image width was forced, and additionally if width was set as pixels, with \"px\" in the value.\n const forcedWidth = props.width || (props.style && props.style.width);\n const srcSetAutoWidths = getSrcSetAutoSizes(forcedWidth);\n srcSetAutoWidths.forEach(width => {\n srcSet[width + \"w\"] = imagePlugin.getImageSrc({\n src,\n transform: { ...transform, width }\n });\n });\n sizes = getSizes(forcedWidth);\n }\n\n return <Image {...imageProps} srcSet={srcSet} src={src} sizes={sizes} />;\n }\n };\n\n return imagePlugin;\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,QAAQ,kBAAkB;AAGxC,MAAMC,6BAA6B,GAAG,C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AW,CAACK,WAAW,CAAC;YAC1CE,GAAG;YACHb,SAAS,EAAE;cAAE,GAAGA,SAAS;cAAEnB;YAAM;UACrC,CAAC,CAAC;QACN,CAAC,CAAC;QACFwC,KAAK,GAAGhC,QAAQ,CAACiC,WAAW,CAAC;MACjC;MAEA,oBAAO7C,KAAA,CAAAiD,aAAA,CAAChD,KAAK,EAAAuB,MAAA,CAAA0B,MAAA,KAAKP,UAAU;QAAEF,MAAM,EAAEA,MAAO;QAACL,GAAG,EAAEA,GAAI;QAACQ,KAAK,EAAEA;MAAM,EAAE,CAAC;IAC5E;EACJ,CAAC;EAED,OAAOf,WAAW;AACtB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","Image","SUPPORTED_IMAGE_RESIZE_WIDTHS","getSupportedImageResizeWidth","width","output","i","length","sanitizeTransformArgs","args","undefined","parseInt","getSizes","endsWith","isFixedImageWidth","Number","isFinite","getSrcSetAutoSizes","max","maxWidth","filter","supportedWidth","convertTransformToQueryParams","transform","Object","keys","map","key","join","imagePlugin","name","type","presets","avatar","getImageSrc","props","src","startsWith","sanitizedParams","params","render","srcSet","srcSetInitial","imageProps","sizes","forcedWidth","style","srcSetAutoWidths","forEach","createElement","assign"],"sources":["image.tsx"],"sourcesContent":["import React from \"react\";\nimport { Image } from \"@webiny/ui/Image\";\nimport type { ImageComponentPlugin } from \"~/types\";\n\nconst SUPPORTED_IMAGE_RESIZE_WIDTHS = [100, 300, 500, 750, 1000, 1500, 2500];\n\n/**\n * Width of the image should not be just any random number. For optimization reasons,\n * we only allow the ones listed in SUPPORTED_IMAGE_RESIZE_WIDTHS list (Webiny Cloud supports only these).\n */\nconst getSupportedImageResizeWidth = (width: number) => {\n let output = SUPPORTED_IMAGE_RESIZE_WIDTHS[0];\n let i = SUPPORTED_IMAGE_RESIZE_WIDTHS.length;\n while (i >= 0) {\n if (width === SUPPORTED_IMAGE_RESIZE_WIDTHS[i]) {\n output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i];\n break;\n }\n\n if (width > SUPPORTED_IMAGE_RESIZE_WIDTHS[i]) {\n // Use next larger width. If there isn't any, use current.\n output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i + 1];\n if (!output) {\n output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i];\n }\n break;\n }\n\n i--;\n }\n\n return output;\n};\n\ninterface SanitizeTransformArgsParams {\n width?: string;\n}\ninterface SanitizeTransformArgsResult {\n width?: number;\n}\n/**\n * Currently we only allow \"width\" as a transform option.\n * @param args\n */\nconst sanitizeTransformArgs = (args?: SanitizeTransformArgsParams): SanitizeTransformArgsResult => {\n const output: SanitizeTransformArgsResult = {};\n if (!args || args.width === undefined || args.width === null) {\n return output;\n }\n const width = parseInt(args.width);\n if (width > 0) {\n output.width = getSupportedImageResizeWidth(width);\n }\n\n return output;\n};\n\nconst getSizes = (width?: string | number): string | undefined => {\n if (typeof width !== \"string\") {\n return undefined;\n }\n // Check if width was set as percentage, with \"%\" in the value.\n if (width.endsWith(\"%\")) {\n return `${parseInt(width)}vw`;\n }\n // Check if width was set as viewport width, with \"vw\" in the value.\n if (width.endsWith(\"vw\")) {\n return `${parseInt(width)}vw`;\n }\n\n // Check if width was set as relative, with \"em\" in the value.\n if (width.endsWith(\"em\")) {\n return `${parseInt(width)}em`;\n }\n\n return undefined;\n};\n\nconst isFixedImageWidth = (width?: number | string) => {\n if (Number.isFinite(width)) {\n return true;\n }\n\n if (typeof width === \"string\" && width.endsWith(\"px\")) {\n return true;\n }\n return false;\n};\n\nconst getSrcSetAutoSizes = (max?: string | number) => {\n max = isFixedImageWidth(max) ? parseInt(\"\" + max) : 2500;\n const maxWidth = getSupportedImageResizeWidth(max);\n return SUPPORTED_IMAGE_RESIZE_WIDTHS.filter((supportedWidth: number) => {\n return supportedWidth <= maxWidth;\n });\n};\n\nconst convertTransformToQueryParams = (transform: Record<string, any>): string => {\n return Object.keys(transform)\n .map(key => `${key}=${transform[key]}`)\n .join(\"&\");\n};\n\nexport default () => {\n const imagePlugin: ImageComponentPlugin = {\n name: \"image-component\",\n type: \"image-component\",\n presets: {\n avatar: { width: 300 }\n },\n getImageSrc: (props?: Record<string, any>) => {\n if (!props) {\n return \"\";\n }\n\n const { src, transform } = props;\n if (!transform) {\n return src;\n }\n\n if (!src || src.startsWith(\"data:\") || src.endsWith(\"svg\")) {\n return src;\n }\n\n const sanitizedParams = sanitizeTransformArgs(transform);\n const params = convertTransformToQueryParams(sanitizedParams);\n return src + \"?\" + params;\n },\n render(props) {\n const { transform, srcSet: srcSetInitial, ...imageProps } = props;\n let srcSet: any = srcSetInitial;\n let sizes: string | undefined;\n const src = imageProps.src;\n if (srcSet && srcSet === \"auto\") {\n srcSet = {};\n\n // Check if image width was forced, and additionally if width was set as pixels, with \"px\" in the value.\n const forcedWidth = props.width || (props.style && props.style.width);\n const srcSetAutoWidths = getSrcSetAutoSizes(forcedWidth);\n srcSetAutoWidths.forEach(width => {\n srcSet[width + \"w\"] = imagePlugin.getImageSrc({\n src,\n transform: { ...transform, width }\n });\n });\n sizes = getSizes(forcedWidth);\n }\n\n return <Image {...imageProps} srcSet={srcSet} src={src} sizes={sizes} />;\n }\n };\n\n return imagePlugin;\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,QAAQ,kBAAkB;AAGxC,MAAMC,6BAA6B,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;;AAE5E;AACA;AACA;AACA;AACA,MAAMC,4BAA4B,GAAIC,KAAa,IAAK;EACpD,IAAIC,MAAM,GAAGH,6BAA6B,CAAC,CAAC,CAAC;EAC7C,IAAII,CAAC,GAAGJ,6BAA6B,CAACK,MAAM;EAC5C,OAAOD,CAAC,IAAI,CAAC,EAAE;IACX,IAAIF,KAAK,KAAKF,6BAA6B,CAACI,CAAC,CAAC,EAAE;MAC5CD,MAAM,GAAGH,6BAA6B,CAACI,CAAC,CAA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;AACtB,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import { ReactNode } from "react";
2
- import { Plugin } from "@webiny/plugins/types";
1
+ import type { ReactNode } from "react";
2
+ import type { Plugin } from "@webiny/plugins/types";
3
3
  import imagePlugin from "./image";
4
4
  export { imagePlugin };
5
5
  type RenderPluginOptions<T> = {
@@ -1 +1 @@
1
- {"version":3,"names":["React","warning","plugins","imagePlugin","PluginComponent","props","children","PluginsComponent","renderPlugin","name","params","options","wrapper","fn","plugin","byName","content","createElement","key","cloneElement","renderPlugins","type","filter","v","reverse","byType","pl","map","Boolean"],"sources":["index.tsx"],"sourcesContent":["import React, { ReactNode } from \"react\";\nimport warning from \"warning\";\nimport { plugins } from \"@webiny/plugins\";\nimport { Plugin } from \"@webiny/plugins/types\";\nimport imagePlugin from \"./image\";\n\nexport { imagePlugin };\n\ntype RenderPluginOptions<T> = {\n wrapper?: boolean;\n fn?: string;\n filter?: (value: T, index: number, array: T[]) => boolean;\n reverse?: boolean;\n};\n\ninterface RenderPlugin {\n <T extends Plugin = Plugin>(name: string, params?: any, options?: RenderPluginOptions<T>):\n | ReactNode\n | ReactNode[];\n}\n\ninterface RenderPlugins {\n <T extends Plugin = Plugin>(type: string, params?: any, options?: RenderPluginOptions<T>):\n | ReactNode\n | ReactNode[];\n}\n\ninterface PluginComponentProps {\n name: string;\n params: Record<string, any>;\n fn: string;\n children: React.ReactNode;\n}\nconst PluginComponent = (props: PluginComponentProps) => {\n return props.children as React.ReactElement;\n};\ninterface PluginsComponentProps {\n type: string;\n params: Record<string, any>;\n fn: string;\n children: React.ReactNode;\n}\nconst PluginsComponent = (props: PluginsComponentProps) => {\n return props.children as React.ReactElement;\n};\n\nexport const renderPlugin: RenderPlugin = (name, params = {}, options = {}) => {\n const { wrapper = true, fn = \"render\" } = options;\n\n const plugin = plugins.byName(name);\n warning(plugin, `No such plugin \"${name}\"`);\n\n if (!plugin) {\n return null;\n }\n\n const content = plugin[fn](params);\n if (content) {\n return wrapper ? (\n <PluginComponent key={plugin.name} name={name} params={params} fn={fn}>\n {content}\n </PluginComponent>\n ) : (\n React.cloneElement(content, { key: plugin.name })\n );\n }\n return null;\n};\n\nexport const renderPlugins: RenderPlugins = (type, params = {}, options = {}) => {\n const { wrapper = true, fn = \"render\", filter = v => v, reverse } = options;\n\n const content = plugins\n .byType(type)\n .filter(pl => {\n /**\n * TODO @ts-refactor Problem with possibility of a different subtype.\n */\n // @ts-expect-error\n return filter(pl);\n })\n /**\n * We cast as string because renderPlugin checks for the plugin.name\n */\n .map(plugin => renderPlugin(plugin.name as string, params, { wrapper, fn }))\n .filter(Boolean);\n\n if (reverse) {\n content.reverse();\n }\n\n return wrapper ? (\n <PluginsComponent type={type} params={params} fn={fn}>\n {content}\n </PluginsComponent>\n ) : (\n content\n );\n};\n\nexport default [imagePlugin];\n"],"mappings":"AAAA,OAAOA,KAAK,MAAqB,OAAO;AACxC,OAAOC,OAAO,MAAM,SAAS;AAC7B,SAASC,OAAO,QAAQ,iBAAiB;AAEzC,OAAOC,WAAW;AAElB,SAASA,WAAW;AA2BpB,MAAMC,eAAe,GAAIC,KAA2B,IAAK;EACrD,OAAOA,KAAK,CAACC,QAAQ;AACzB,CAAC;AAOD,MAAMC,gBAAgB,GAAIF,KAA4B,IAAK;EACvD,OAAOA,KAAK,CAACC,QAAQ;AACzB,CAAC;AAED,OAAO,MAAME,YAA0B,GAAGA,CAACC,IAAI,EAAEC,MAAM,GAAG,CAAC,CAAC,EAAEC,OAAO,GAAG,CAAC,CAAC,KAAK;EAC3E,MAAM;IAAEC,OAAO,GAAG,IAAI;IAAEC,EAAE,GAAG;EAAS,CAAC,GAAGF,OAAO;EAEjD,MAAMG,MAAM,GAAGZ,OAAO,CAACa,MAAM,CAACN,IAAI,CAAC;EACnCR,OAAO,CAACa,MAAM,EAAE,mBAAmBL,IAAI,GAAG,CAAC;EAE3C,IAAI,CAACK,MAAM,EAAE;IACT,OAAO,IAAI;EACf;EAEA,MAAME,OAAO,GAA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BA,OACH;AACL,CAAC;AAED,eAAe,CAACb,WAAW,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","warning","plugins","imagePlugin","PluginComponent","props","children","PluginsComponent","renderPlugin","name","params","options","wrapper","fn","plugin","byName","content","createElement","key","cloneElement","renderPlugins","type","filter","v","reverse","byType","pl","map","Boolean"],"sources":["index.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport React from \"react\";\nimport warning from \"warning\";\nimport { plugins } from \"@webiny/plugins\";\nimport type { Plugin } from \"@webiny/plugins/types\";\nimport imagePlugin from \"./image\";\n\nexport { imagePlugin };\n\ntype RenderPluginOptions<T> = {\n wrapper?: boolean;\n fn?: string;\n filter?: (value: T, index: number, array: T[]) => boolean;\n reverse?: boolean;\n};\n\ninterface RenderPlugin {\n <T extends Plugin = Plugin>(name: string, params?: any, options?: RenderPluginOptions<T>):\n | ReactNode\n | ReactNode[];\n}\n\ninterface RenderPlugins {\n <T extends Plugin = Plugin>(type: string, params?: any, options?: RenderPluginOptions<T>):\n | ReactNode\n | ReactNode[];\n}\n\ninterface PluginComponentProps {\n name: string;\n params: Record<string, any>;\n fn: string;\n children: React.ReactNode;\n}\nconst PluginComponent = (props: PluginComponentProps) => {\n return props.children as React.ReactElement;\n};\ninterface PluginsComponentProps {\n type: string;\n params: Record<string, any>;\n fn: string;\n children: React.ReactNode;\n}\nconst PluginsComponent = (props: PluginsComponentProps) => {\n return props.children as React.ReactElement;\n};\n\nexport const renderPlugin: RenderPlugin = (name, params = {}, options = {}) => {\n const { wrapper = true, fn = \"render\" } = options;\n\n const plugin = plugins.byName(name);\n warning(plugin, `No such plugin \"${name}\"`);\n\n if (!plugin) {\n return null;\n }\n\n const content = plugin[fn](params);\n if (content) {\n return wrapper ? (\n <PluginComponent key={plugin.name} name={name} params={params} fn={fn}>\n {content}\n </PluginComponent>\n ) : (\n React.cloneElement(content, { key: plugin.name })\n );\n }\n return null;\n};\n\nexport const renderPlugins: RenderPlugins = (type, params = {}, options = {}) => {\n const { wrapper = true, fn = \"render\", filter = v => v, reverse } = options;\n\n const content = plugins\n .byType(type)\n .filter(pl => {\n /**\n * TODO @ts-refactor Problem with possibility of a different subtype.\n */\n // @ts-expect-error\n return filter(pl);\n })\n /**\n * We cast as string because renderPlugin checks for the plugin.name\n */\n .map(plugin => renderPlugin(plugin.name as string, params, { wrapper, fn }))\n .filter(Boolean);\n\n if (reverse) {\n content.reverse();\n }\n\n return wrapper ? (\n <PluginsComponent type={type} params={params} fn={fn}>\n {content}\n </PluginsComponent>\n ) : (\n content\n );\n};\n\nexport default [imagePlugin];\n"],"mappings":"AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,OAAO,MAAM,SAAS;AAC7B,SAASC,OAAO,QAAQ,iBAAiB;AAEzC,OAAOC,WAAW;AAElB,SAASA,WAAW;AA2BpB,MAAMC,eAAe,GAAIC,KAA2B,IAAK;EACrD,OAAOA,KAAK,CAACC,QAAQ;AACzB,CAAC;AAOD,MAAMC,gBAAgB,GAAIF,KAA4B,IAAK;EACvD,OAAOA,KAAK,CAACC,QAAQ;AACzB,CAAC;AAED,OAAO,MAAME,YAA0B,GAAGA,CAACC,IAAI,EAAEC,MAAM,GAAG,CAAC,CAAC,EAAEC,OAAO,GAAG,CAAC,CAAC,KAAK;EAC3E,MAAM;IAAEC,OAAO,GAAG,IAAI;IAAEC,EAAE,GAAG;EAAS,CAAC,GAAGF,OAAO;EAEjD,MAAMG,MAAM,GAAGZ,OAAO,CAACa,MAAM,CAACN,IAAI,CAAC;EACnCR,OAAO,CAACa,MAAM,EAAE,mBAAmBL,IAAI,GAAG,CAAC;EAE3C,IAAI,CAACK,MAAM,EAAE;IACT,OAAO,IAAI;EACf;EAEA,MAAME,OAAO,GAAGF,MAAM,CAACD,EAAE,CAAC,CAACH,MAAM,CAAC;EAClC,IAAIM,OAAO,EAAE;IACT,OAAOJ,OAAO,gBACVZ,KAAA,CAAAiB,aAAA,CAACb,eAAe;MAACc,GAAG,EAAEJ,MAAM,CAACL,IAAK;MAACA,IAAI,EAAEA,IAAK;MAACC,MAAM,EAAEA,MAAO;MAACG,EAAE,EAAEA;IAAG,GACjEG,OACY,CAAC,iBAElBhB,KAAK,CAACmB,YAAY,CAACH,OAAO,EAAE;MAAEE,GAAG,EAAEJ,MAAM,CAACL;IAAK,CAAC,CAAC,CACpD;EACL;EACA,OAAO,IAAI;AACf,CAAC;AAED,OAAO,MAAMW,aAA4B,GAAGA,CAACC,IAAI,EAAEX,MAAM,GAAG,CAAC,CAAC,EAAEC,OAAO,GAAG,CAAC,CAAC,KAAK;EAC7E,MAAM;IAAEC,OAAO,GAAG,IAAI;IAAEC,EAAE,GAAG,QAAQ;IAAES,MAAM,GAAGC,CAAC,IAAIA,CAAC;IAAEC;EAAQ,CAAC,GAAGb,OAAO;EAE3E,MAAMK,OAAO,GAAGd,OAAO,CAClBuB,MAAM,CAACJ,IAAI,CAAC,CACZC,MAAM,CAACI,EAAE,IAAI;IACV;AACZ;AACA;IACY;IACA,OAAOJ,MAAM,CAACI,EAAE,CAAC;EACrB,CAAC;EACD;AACR;AACA,KAFQ,CAGCC,GAAG,CAACb,MAAM,IAAIN,YAAY,CAACM,MAAM,CAACL,IAAI,EAAYC,MAAM,EAAE;IAAEE,OAAO;IAAEC;EAAG,CAAC,CAAC,CAAC,CAC3ES,MAAM,CAACM,OAAO,CAAC;EAEpB,IAAIJ,OAAO,EAAE;IACTR,OAAO,CAACQ,OAAO,CAAC,CAAC;EACrB;EAEA,OAAOZ,OAAO,gBACVZ,KAAA,CAAAiB,aAAA,CAACV,gBAAgB;IAACc,IAAI,EAAEA,IAAK;IAACX,MAAM,EAAEA,MAAO;IAACG,EAAE,EAAEA;EAAG,GAChDG,OACa,CAAC,GAEnBA,OACH;AACL,CAAC;AAED,eAAe,CAACb,WAAW,CAAC","ignoreList":[]}
package/renderApp.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { Root } from "react-dom/client";
1
+ import type { Root } from "react-dom/client";
2
2
  export declare const renderApp: (app: JSX.Element) => Root;
package/renderApp.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["ReactDOMClient","renderApp","app","container","document","getElementById","root","createRoot","render"],"sources":["renderApp.tsx"],"sourcesContent":["import ReactDOMClient, { Root } from \"react-dom/client\";\n\nexport const renderApp = (app: JSX.Element): Root => {\n const container = document.getElementById(\"root\")!;\n\n const root = ReactDOMClient.createRoot(container);\n root.render(app);\n return root;\n};\n"],"mappings":"AAAA,OAAOA,cAAc,MAAgB,kBAAkB;AAEvD,OAAO,MAAMC,SAAS,GAAIC,GAAgB,IAAW;EACjD,MAAMC,SAAS,GAAGC,QAAQ,CAACC,cAAc,CAAC,MAAM,CAAE;EAElD,MAAMC,IAAI,GAAGN,cAAc,CAACO,UAAU,CAACJ,SAAS,CAAC;EACjDG,IAAI,CAACE,MAAM,CAACN,GAAG,CAAC;EAChB,OAAOI,IAAI;AACf,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["ReactDOMClient","renderApp","app","container","document","getElementById","root","createRoot","render"],"sources":["renderApp.tsx"],"sourcesContent":["import type { Root } from \"react-dom/client\";\nimport ReactDOMClient from \"react-dom/client\";\n\nexport const renderApp = (app: JSX.Element): Root => {\n const container = document.getElementById(\"root\")!;\n\n const root = ReactDOMClient.createRoot(container);\n root.render(app);\n return root;\n};\n"],"mappings":"AACA,OAAOA,cAAc,MAAM,kBAAkB;AAE7C,OAAO,MAAMC,SAAS,GAAIC,GAAgB,IAAW;EACjD,MAAMC,SAAS,GAAGC,QAAQ,CAACC,cAAc,CAAC,MAAM,CAAE;EAElD,MAAMC,IAAI,GAAGN,cAAc,CAACO,UAAU,CAACJ,SAAS,CAAC;EACjDG,IAAI,CAACE,MAAM,CAACN,GAAG,CAAC;EAChB,OAAOI,IAAI;AACf,CAAC","ignoreList":[]}
package/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import * as React from "react";
1
+ import type * as React from "react";
2
2
  import { Plugin } from "@webiny/plugins/types";
3
- import { ApolloClient } from "apollo-client";
4
- import { CSSProperties } from "react";
3
+ import type { ApolloClient } from "apollo-client";
4
+ import type { CSSProperties } from "react";
5
5
  export type GenericRecordKey = string | number | symbol;
6
6
  export type GenericRecord<K extends GenericRecordKey = GenericRecordKey, V = any> = Record<K, V>;
7
7
  export type UploadOptions = {
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["Plugin"],"sources":["types.ts"],"sourcesContent":["import * as React from \"react\";\nimport { Plugin } from \"@webiny/plugins/types\";\nimport { ApolloClient } from \"apollo-client\";\nimport { CSSProperties } from \"react\";\n\nexport type GenericRecordKey = string | number | symbol;\n\nexport type GenericRecord<K extends GenericRecordKey = GenericRecordKey, V = any> = Record<K, V>;\n\nexport type UploadOptions = {\n apolloClient: ApolloClient<object>;\n onProgress?: (params: { sent: number; total: number; percentage: number }) => void;\n};\n\nexport type UiStatePlugin = Plugin & {\n type: \"ui-state\";\n render(): React.ReactElement;\n};\n\nexport interface UploadedFile {\n id: string;\n name: string;\n type: string;\n size: number;\n key: string;\n}\n\nexport type FileUploaderPlugin = Plugin & {\n type: \"file-uploader\";\n name: \"file-uploader\";\n upload(file: File, options: UploadOptions): Promise<UploadedFile>;\n};\n\nexport { Plugin };\n\nexport interface ImageProps {\n src: string;\n preset?: string;\n transform?: {\n [key: string]: any;\n };\n // \"auto\" is a special keyword - if present, plugins insert their own srcSet.\n srcSet?: { [key: string]: any } | \"auto\";\n className?: string;\n title?: string;\n alt?: string;\n style?: CSSProperties;\n width?: string | number;\n height?: string | number;\n}\n\n/**\n * \"getImageSrc\" has to be defined as a separate property, so its functionality can be reused outside of\n * the Image component. This is ideal in cases where manual creation of image src is needed.\n */\nexport type ImageComponentPlugin = Plugin & {\n type: \"image-component\";\n render: (props: ImageProps) => React.ReactElement;\n getImageSrc: (props?: Record<string, any>) => string;\n presets: { [key: string]: any };\n};\n\n/**\n * Enables registering new routes.\n * @see https://docs.webiny.com/docs/webiny-apps/admin/development/plugins-reference/app#route\n */\nexport type RoutePlugin = Plugin & {\n type: \"route\";\n route: React.ReactElement;\n};\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,uBAAuB;AAgC9C,SAASA,MAAM;;AAkBf;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"names":["Plugin"],"sources":["types.ts"],"sourcesContent":["import type * as React from \"react\";\nimport { Plugin } from \"@webiny/plugins/types\";\nimport type { ApolloClient } from \"apollo-client\";\nimport type { CSSProperties } from \"react\";\n\nexport type GenericRecordKey = string | number | symbol;\n\nexport type GenericRecord<K extends GenericRecordKey = GenericRecordKey, V = any> = Record<K, V>;\n\nexport type UploadOptions = {\n apolloClient: ApolloClient<object>;\n onProgress?: (params: { sent: number; total: number; percentage: number }) => void;\n};\n\nexport type UiStatePlugin = Plugin & {\n type: \"ui-state\";\n render(): React.ReactElement;\n};\n\nexport interface UploadedFile {\n id: string;\n name: string;\n type: string;\n size: number;\n key: string;\n}\n\nexport type FileUploaderPlugin = Plugin & {\n type: \"file-uploader\";\n name: \"file-uploader\";\n upload(file: File, options: UploadOptions): Promise<UploadedFile>;\n};\n\nexport { Plugin };\n\nexport interface ImageProps {\n src: string;\n preset?: string;\n transform?: {\n [key: string]: any;\n };\n // \"auto\" is a special keyword - if present, plugins insert their own srcSet.\n srcSet?: { [key: string]: any } | \"auto\";\n className?: string;\n title?: string;\n alt?: string;\n style?: CSSProperties;\n width?: string | number;\n height?: string | number;\n}\n\n/**\n * \"getImageSrc\" has to be defined as a separate property, so its functionality can be reused outside of\n * the Image component. This is ideal in cases where manual creation of image src is needed.\n */\nexport type ImageComponentPlugin = Plugin & {\n type: \"image-component\";\n render: (props: ImageProps) => React.ReactElement;\n getImageSrc: (props?: Record<string, any>) => string;\n presets: { [key: string]: any };\n};\n\n/**\n * Enables registering new routes.\n * @see https://docs.webiny.com/docs/webiny-apps/admin/development/plugins-reference/app#route\n */\nexport type RoutePlugin = Plugin & {\n type: \"route\";\n route: React.ReactElement;\n};\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,uBAAuB;AAgC9C,SAASA,MAAM;;AAkBf;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import type React from "react";
2
2
  export interface LegacyPluginToReactComponentParams<TProps extends Record<string, any>> {
3
3
  pluginType: string;
4
4
  componentDisplayName: string;
@@ -1 +1 @@
1
- {"version":3,"names":["useRegisterLegacyPlugin","legacyPluginToReactComponent","params","Component","props","plugin","Object","assign","type","pluginType","mapProps","displayName","componentDisplayName"],"sources":["legacyPluginToReactComponent.ts"],"sourcesContent":["import React from \"react\";\nimport { useRegisterLegacyPlugin } from \"~/hooks/useRegisterLegacyPlugin\";\n\nexport interface LegacyPluginToReactComponentParams<TProps extends Record<string, any>> {\n pluginType: string;\n componentDisplayName: string;\n mapProps?: (props: TProps) => TProps;\n}\n\nexport const legacyPluginToReactComponent = function <TProps extends Record<string, any>>(\n params: LegacyPluginToReactComponentParams<TProps>\n) {\n const Component: React.ComponentType<TProps> = props => {\n const plugin = Object.assign(\n { type: params.pluginType },\n params.mapProps ? params.mapProps(props) : props\n );\n useRegisterLegacyPlugin(plugin);\n return null;\n };\n\n Component.displayName = params.componentDisplayName;\n\n return Component;\n};\n"],"mappings":"AACA,SAASA,uBAAuB;AAQhC,OAAO,MAAMC,4BAA4B,GAAG,SAAAA,CACxCC,MAAkD,EACpD;EACE,MAAMC,SAAsC,GAAGC,KAAK,IAAI;IACpD,MAAMC,MAAM,GAAGC,MAAM,CAACC,MAAM,CACxB;MAAEC,IAAI,EAAEN,MAAM,CAACO;IAAW,CAAC,EAC3BP,MAAM,CAACQ,QAAQ,GAAGR,MAAM,CAACQ,QAAQ,CAACN,KAAK,CAAC,GAAGA,KAC/C,CAAC;IACDJ,uBAAuB,CAACK,MAAM,CAAC;IAC/B,OAAO,IAAI;EACf,CAAC;EAEDF,SAAS,CAACQ,WAAW,GAAGT,MAAM,CAACU,oBAAoB;EAEnD,OAAOT,SAAS;AACpB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useRegisterLegacyPlugin","legacyPluginToReactComponent","params","Component","props","plugin","Object","assign","type","pluginType","mapProps","displayName","componentDisplayName"],"sources":["legacyPluginToReactComponent.ts"],"sourcesContent":["import type React from \"react\";\nimport { useRegisterLegacyPlugin } from \"~/hooks/useRegisterLegacyPlugin\";\n\nexport interface LegacyPluginToReactComponentParams<TProps extends Record<string, any>> {\n pluginType: string;\n componentDisplayName: string;\n mapProps?: (props: TProps) => TProps;\n}\n\nexport const legacyPluginToReactComponent = function <TProps extends Record<string, any>>(\n params: LegacyPluginToReactComponentParams<TProps>\n) {\n const Component: React.ComponentType<TProps> = props => {\n const plugin = Object.assign(\n { type: params.pluginType },\n params.mapProps ? params.mapProps(props) : props\n );\n useRegisterLegacyPlugin(plugin);\n return null;\n };\n\n Component.displayName = params.componentDisplayName;\n\n return Component;\n};\n"],"mappings":"AACA,SAASA,uBAAuB;AAQhC,OAAO,MAAMC,4BAA4B,GAAG,SAAAA,CACxCC,MAAkD,EACpD;EACE,MAAMC,SAAsC,GAAGC,KAAK,IAAI;IACpD,MAAMC,MAAM,GAAGC,MAAM,CAACC,MAAM,CACxB;MAAEC,IAAI,EAAEN,MAAM,CAACO;IAAW,CAAC,EAC3BP,MAAM,CAACQ,QAAQ,GAAGR,MAAM,CAACQ,QAAQ,CAACN,KAAK,CAAC,GAAGA,KAC/C,CAAC;IACDJ,uBAAuB,CAACK,MAAM,CAAC;IAC/B,OAAO,IAAI;EACf,CAAC;EAEDF,SAAS,CAACQ,WAAW,GAAGT,MAAM,CAACU,oBAAoB;EAEnD,OAAOT,SAAS;AACpB,CAAC","ignoreList":[]}