@hubspot/ui-extensions 0.12.4 → 0.13.1

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 (85) hide show
  1. package/dist/__generated__/version.d.ts +2 -0
  2. package/dist/__generated__/version.js +4 -0
  3. package/dist/__tests__/crm/hooks/useAssociations.spec.js +79 -0
  4. package/dist/__tests__/crm/utils/fetchAssociations.spec.js +0 -10
  5. package/dist/__tests__/experimental/hooks/useCrmSearch.spec.js +586 -0
  6. package/dist/__tests__/experimental/hooks/utils/fetchCrmSearch.spec.js +217 -0
  7. package/dist/__tests__/hooks/useDebounce.spec.js +123 -0
  8. package/dist/__tests__/hooks/utils/useFetchLifecycle.spec.js +324 -0
  9. package/dist/__tests__/internal/hook-utils.spec.js +17 -0
  10. package/dist/__tests__/test-d/extension-points.test-d.js +1 -0
  11. package/dist/crm/hooks/useAssociations.d.ts +3 -3
  12. package/dist/crm/hooks/useAssociations.js +55 -139
  13. package/dist/crm/hooks/useCrmProperties.js +29 -125
  14. package/dist/crm/utils/fetchAssociations.js +0 -3
  15. package/dist/experimental/hooks/useCrmSearch.d.ts +2 -0
  16. package/dist/experimental/hooks/useCrmSearch.js +206 -0
  17. package/dist/experimental/hooks/utils/fetchCrmSearch.d.ts +6 -0
  18. package/dist/experimental/hooks/utils/fetchCrmSearch.js +39 -0
  19. package/dist/experimental/index.d.ts +1 -0
  20. package/dist/experimental/index.js +1 -0
  21. package/dist/hooks/useDebounce.d.ts +19 -0
  22. package/dist/hooks/useDebounce.js +32 -0
  23. package/dist/hooks/utils/useFetchLifecycle.d.ts +35 -0
  24. package/dist/hooks/utils/useFetchLifecycle.js +103 -0
  25. package/dist/index.d.ts +1 -0
  26. package/dist/index.js +1 -0
  27. package/dist/internal/hook-utils.d.ts +6 -0
  28. package/dist/internal/hook-utils.js +16 -1
  29. package/dist/{experimental/pages → pages}/components/page-routes.d.ts +1 -2
  30. package/dist/{experimental/pages → pages}/components/page-routes.js +0 -4
  31. package/dist/{experimental/pages → pages}/create-page-router.d.ts +1 -3
  32. package/dist/{experimental/pages → pages}/create-page-router.js +1 -3
  33. package/dist/{experimental/pages → pages}/create-page-router.test.js +2 -2
  34. package/dist/{experimental/pages → pages}/hooks.d.ts +0 -1
  35. package/dist/{experimental/pages → pages}/hooks.js +0 -1
  36. package/dist/pages/index.d.ts +6 -1
  37. package/dist/pages/index.js +4 -1
  38. package/dist/{experimental/pages → pages}/internal/page-router-internal-types.d.ts +1 -1
  39. package/dist/pages/internal/useAppPageLocation.d.ts +1 -0
  40. package/dist/{experimental/pages → pages}/internal/useAppPageLocation.js +2 -2
  41. package/dist/{experimental/pages → pages}/types.d.ts +1 -2
  42. package/dist/pages/types.js +1 -0
  43. package/dist/shared/types/actions.d.ts +12 -2
  44. package/dist/shared/types/components/table.d.ts +16 -0
  45. package/dist/shared/types/context.d.ts +6 -0
  46. package/dist/shared/types/crm.d.ts +4 -0
  47. package/dist/shared/types/experimental.d.ts +1 -1
  48. package/dist/shared/types/extension-points.d.ts +9 -3
  49. package/dist/shared/types/extension-points.js +1 -0
  50. package/dist/shared/types/hooks.d.ts +72 -0
  51. package/dist/shared/types/hooks.js +1 -0
  52. package/dist/shared/types/shared.d.ts +8 -0
  53. package/dist/shared/types/worker-globals.d.ts +5 -0
  54. package/dist/testing/__tests__/createRenderer.spec.js +1 -1
  55. package/dist/testing/internal/mocks/index.d.ts +1 -1
  56. package/dist/testing/internal/mocks/mock-extension-point-api.js +21 -1
  57. package/dist/testing/internal/mocks/mock-hooks.js +26 -0
  58. package/dist/testing/internal/types-internal.d.ts +2 -0
  59. package/dist/testing/types.d.ts +11 -1
  60. package/dist/utils/pagination.d.ts +0 -9
  61. package/package.json +3 -2
  62. package/dist/experimental/pages/index.d.ts +0 -6
  63. package/dist/experimental/pages/index.js +0 -4
  64. package/dist/experimental/pages/internal/useAppPageLocation.d.ts +0 -1
  65. package/dist/shared/types/pages/app-pages-types.d.ts +0 -75
  66. package/dist/shared/types/pages/components/page-routes.d.ts +0 -115
  67. package/dist/shared/types/pages/index.d.ts +0 -1
  68. package/dist/shared/types/pages.d.ts +0 -1
  69. /package/dist/{experimental/pages/create-page-router.test.d.ts → __tests__/experimental/hooks/useCrmSearch.spec.d.ts} +0 -0
  70. /package/dist/{experimental/pages/internal/trie-router.test.d.ts → __tests__/experimental/hooks/utils/fetchCrmSearch.spec.d.ts} +0 -0
  71. /package/dist/{experimental/pages/types.js → __tests__/hooks/useDebounce.spec.d.ts} +0 -0
  72. /package/dist/{shared/types/pages.js → __tests__/hooks/utils/useFetchLifecycle.spec.d.ts} +0 -0
  73. /package/dist/{shared/types/pages/app-pages-types.js → __tests__/internal/hook-utils.spec.d.ts} +0 -0
  74. /package/dist/{experimental/pages → pages}/components/index.d.ts +0 -0
  75. /package/dist/{experimental/pages → pages}/components/index.js +0 -0
  76. /package/dist/{shared/types/pages/components/page-routes.js → pages/create-page-router.test.d.ts} +0 -0
  77. /package/dist/{experimental/pages → pages}/internal/app-page-route-context.d.ts +0 -0
  78. /package/dist/{experimental/pages → pages}/internal/app-page-route-context.js +0 -0
  79. /package/dist/{experimental/pages → pages}/internal/convert-page-routes-react-elements.d.ts +0 -0
  80. /package/dist/{experimental/pages → pages}/internal/convert-page-routes-react-elements.js +0 -0
  81. /package/dist/{experimental/pages → pages}/internal/page-router-internal-types.js +0 -0
  82. /package/dist/{experimental/pages → pages}/internal/trie-router.d.ts +0 -0
  83. /package/dist/{experimental/pages → pages}/internal/trie-router.js +0 -0
  84. /package/dist/{shared/types/pages/index.js → pages/internal/trie-router.test.d.ts} +0 -0
  85. /package/dist/{experimental/pages → pages}/internal/trie-router.test.js +0 -0
@@ -0,0 +1,72 @@
1
+ export interface PaginationResult {
2
+ hasNextPage: boolean;
3
+ hasPreviousPage: boolean;
4
+ currentPage: number;
5
+ pageSize: number;
6
+ nextPage: () => void;
7
+ previousPage: () => void;
8
+ reset: () => void;
9
+ }
10
+ export type FormattingOptions = {
11
+ date?: {
12
+ format?: string;
13
+ relative?: boolean;
14
+ };
15
+ dateTime?: {
16
+ format?: string;
17
+ relative?: boolean;
18
+ };
19
+ currency?: {
20
+ addSymbol?: boolean;
21
+ };
22
+ };
23
+ export type FetchHookOptions = {
24
+ propertiesToFormat?: string[] | 'all';
25
+ formattingOptions?: FormattingOptions;
26
+ };
27
+ export type CrmSearchFilter = {
28
+ propertyName: string;
29
+ operator: string;
30
+ value?: string | number | boolean;
31
+ values?: (string | number | boolean)[];
32
+ highValue?: string | number | boolean;
33
+ };
34
+ export type CrmSearchFilterGroup = {
35
+ filters: CrmSearchFilter[];
36
+ };
37
+ export type CrmSearchSort = {
38
+ propertyName: string;
39
+ direction: 'ASCENDING' | 'DESCENDING';
40
+ };
41
+ export type FetchCrmSearchRequest = {
42
+ objectType: string;
43
+ properties?: string[];
44
+ query?: string;
45
+ filterGroups?: CrmSearchFilterGroup[];
46
+ sorts?: CrmSearchSort[];
47
+ pageSize?: number;
48
+ after?: string;
49
+ };
50
+ export type CrmSearchResultItem = {
51
+ objectId: number;
52
+ properties: Record<string, string | null>;
53
+ };
54
+ export type CrmSearchResponse = {
55
+ results: CrmSearchResultItem[];
56
+ total: number;
57
+ hasMore: boolean;
58
+ after?: string;
59
+ };
60
+ export type UseCrmSearchOptions = {
61
+ propertiesToFormat?: 'all' | string[];
62
+ formattingOptions?: FetchHookOptions['formattingOptions'];
63
+ };
64
+ export interface UseCrmSearchResult {
65
+ results: CrmSearchResultItem[];
66
+ total: number;
67
+ error: Error | null;
68
+ isLoading: boolean;
69
+ isRefetching: boolean;
70
+ pagination: PaginationResult;
71
+ refetch: () => Promise<void>;
72
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,13 @@
1
1
  import type { ComponentType, ReactElement, ReactNode } from 'react';
2
2
  export type UnknownComponentProps = Record<string, any>;
3
+ /**
4
+ * Represents a JSON-serializable value. Functions, Symbols, BigInts, and
5
+ * circular references are not JSON-serializable and will cause issues with
6
+ * utilities that rely on `JSON.stringify` for comparison.
7
+ */
8
+ export type JsonSerializable = string | number | boolean | null | undefined | JsonSerializable[] | {
9
+ [key: string]: JsonSerializable;
10
+ };
3
11
  /**
4
12
  * Represents a HubSpot-provided React component.
5
13
  */
@@ -1,5 +1,6 @@
1
1
  import type { HubspotExtendFunction } from './extend.ts';
2
2
  import type { ExtensionPointApiActions, ExtensionPointApiContext, ExtensionPointFullApi, ExtensionPoints } from './extension-points.ts';
3
+ import type { FetchCrmSearchRequest, FetchHookOptions } from './hooks.ts';
3
4
  import type { Logger } from './logger.ts';
4
5
  import type { AppPageLocation } from './shared.ts';
5
6
  export interface WorkersApi {
@@ -19,6 +20,10 @@ export interface WorkersApi {
19
20
  * Hook added to worker globals so page router can access the current app page location at runtime.
20
21
  */
21
22
  useAppPageLocation: () => AppPageLocation;
23
+ /**
24
+ * Runner for the CRM search hook, proxies search requests to the host.
25
+ */
26
+ fetchCrmSearch: (request: FetchCrmSearchRequest, options?: FetchHookOptions) => Promise<Response>;
22
27
  }
23
28
  export interface WorkerGlobalsInternal {
24
29
  /**
@@ -18,6 +18,6 @@ describe('createRenderer', () => {
18
18
  catch (error) {
19
19
  errorMessage = String(error);
20
20
  }
21
- expect(errorMessage).toBe(`InvalidExtensionPointLocationError: Invalid extension point location of "INVALID_LOCATION". Allowed locations are: "crm.preview", "crm.record.sidebar", "crm.record.tab", "helpdesk.sidebar", "uie.playground.middle", "settings", "home"`);
21
+ expect(errorMessage).toBe(`InvalidExtensionPointLocationError: Invalid extension point location of "INVALID_LOCATION". Allowed locations are: "crm.preview", "crm.record.sidebar", "crm.record.tab", "helpdesk.sidebar", "uie.playground.middle", "settings", "home", "pages"`);
22
22
  });
23
23
  });
@@ -1,4 +1,4 @@
1
- import { type useAppPageLocation } from '../../../experimental/pages/internal/useAppPageLocation.tsx';
1
+ import { type useAppPageLocation } from '../../../pages/internal/useAppPageLocation.tsx';
2
2
  import type { ExtensionPointLocation } from '../../../shared/types/extension-points.ts';
3
3
  import type { RendererMocks } from '../../types.ts';
4
4
  import { type MocksAppPageLocationStore } from './mock-app-page-location.tsx';
@@ -22,8 +22,9 @@ const createMockUiePlatformActions = () => {
22
22
  return {
23
23
  copyTextToClipboard: async () => { },
24
24
  closeOverlay: () => { },
25
- reloadPage: () => { },
25
+ navigateToPage: () => { },
26
26
  openIframeModal: () => { },
27
+ reloadPage: () => { },
27
28
  };
28
29
  };
29
30
  const createMockSettingsActions = () => {
@@ -36,6 +37,11 @@ const createMockAppHomeActions = () => {
36
37
  addAlert: () => { },
37
38
  };
38
39
  };
40
+ const createMockPagesActions = () => {
41
+ return {
42
+ addAlert: () => { },
43
+ };
44
+ };
39
45
  const createFakeEmail = () => `${fakePrefix}email@example.com`;
40
46
  const createFakeFirstName = () => `${fakePrefix}firstName`;
41
47
  const createFakeLastName = () => `${fakePrefix}lastName`;
@@ -156,6 +162,20 @@ const mockCreators = {
156
162
  },
157
163
  };
158
164
  },
165
+ pages: () => {
166
+ return {
167
+ runServerlessFunction: createMockServerlessFuncRunner(),
168
+ actions: {
169
+ ...createMockPagesActions(),
170
+ ...createMockUiePlatformActions(),
171
+ },
172
+ context: {
173
+ location: 'pages',
174
+ user: createFakeUser(),
175
+ portal: createFakePortalContext(),
176
+ },
177
+ };
178
+ },
159
179
  };
160
180
  export const createMockExtensionPointApi = (extensionPointLocation) => {
161
181
  const mockCreator = mockCreators[extensionPointLocation];
@@ -67,6 +67,32 @@ export const createMockHooks = () => {
67
67
  },
68
68
  };
69
69
  },
70
+ useCrmSearch: (config) => {
71
+ const { properties: propertyNames } = config;
72
+ const properties = createFakeProperties(propertyNames);
73
+ return {
74
+ results: [
75
+ {
76
+ objectId: 456,
77
+ properties,
78
+ },
79
+ ],
80
+ total: 1,
81
+ error: null,
82
+ isLoading: false,
83
+ isRefetching: false,
84
+ refetch: async () => { },
85
+ pagination: {
86
+ hasNextPage: false,
87
+ hasPreviousPage: false,
88
+ currentPage: 1,
89
+ pageSize: 10,
90
+ nextPage: () => { },
91
+ previousPage: () => { },
92
+ reset: () => { },
93
+ },
94
+ };
95
+ },
70
96
  useExtensionContext: () => {
71
97
  const { mocks } = useRequiredMocksContext();
72
98
  return mocks.context;
@@ -1,5 +1,6 @@
1
1
  import type { RemoteComponent, RemoteFragment, RemoteRoot, RemoteText } from '@remote-ui/core';
2
2
  import type { useAssociations, useCrmProperties } from '../../crm/index.ts';
3
+ import type { useCrmSearch } from '../../experimental/hooks/useCrmSearch.ts';
3
4
  import type { useExtensionActions } from '../../hooks/useExtensionActions.tsx';
4
5
  import type { useExtensionApi } from '../../hooks/useExtensionApi.tsx';
5
6
  import type { useExtensionContext } from '../../hooks/useExtensionContext.tsx';
@@ -62,6 +63,7 @@ export type RenderedNodeInternal = RenderedElementNodeInternal | RenderedTextNod
62
63
  export interface RendererMockHooksInternal {
63
64
  useCrmProperties: typeof useCrmProperties;
64
65
  useAssociations: typeof useAssociations;
66
+ useCrmSearch: typeof useCrmSearch;
65
67
  useExtensionContext: typeof useExtensionContext;
66
68
  useExtensionActions: typeof useExtensionActions;
67
69
  useExtensionApi: typeof useExtensionApi;
@@ -1,9 +1,10 @@
1
1
  import type { SpyImpl } from 'tinyspy';
2
2
  import type { useAssociations, useCrmProperties } from '../crm/index.ts';
3
- import type { useAppPageLocation } from '../experimental/pages/internal/useAppPageLocation.tsx';
3
+ import type { useCrmSearch } from '../experimental/hooks/useCrmSearch.ts';
4
4
  import type { useExtensionActions } from '../hooks/useExtensionActions.tsx';
5
5
  import type { useExtensionApi } from '../hooks/useExtensionApi.tsx';
6
6
  import type { useExtensionContext } from '../hooks/useExtensionContext.tsx';
7
+ import type { useAppPageLocation } from '../pages/internal/useAppPageLocation.tsx';
7
8
  import type { ExtensionPointApi, ExtensionPointApiActions, ExtensionPointLocation } from '../shared/types/extension-points.ts';
8
9
  import type { ServerlessFuncRunner } from '../shared/types/http-requests.ts';
9
10
  import type { AppPageLocation, HubSpotReactComponent, HubSpotReactFragmentProp, UnknownComponentProps } from '../shared/types/shared.ts';
@@ -281,6 +282,15 @@ export interface RendererMocks<TExtensionPointLocation extends ExtensionPointLoc
281
282
  * information about spies and the supported API.
282
283
  */
283
284
  useAssociations: FunctionSpy<typeof useAssociations>;
285
+ /**
286
+ * A spy for the `useCrmSearch` hook function.
287
+ * The spy can be used to track the calls to the hook function and also control the
288
+ * return result of the hook function.
289
+ *
290
+ * See the [tinyspy](https://github.com/tiny-spy/tinyspy) library for more
291
+ * information about spies and the supported API.
292
+ */
293
+ useCrmSearch: FunctionSpy<typeof useCrmSearch>;
284
294
  /**
285
295
  * A spy for the `useExtensionContext` hook function.
286
296
  * The spy can be used to track the calls to the hook function and also control the
@@ -1,12 +1,3 @@
1
- export interface PaginationResult {
2
- hasNextPage: boolean;
3
- hasPreviousPage: boolean;
4
- currentPage: number;
5
- pageSize: number;
6
- nextPage: () => void;
7
- previousPage: () => void;
8
- reset: () => void;
9
- }
10
1
  export declare const DEFAULT_PAGE_SIZE = 10;
11
2
  /**
12
3
  * Calculate pagination flags based on current page and API hasMore flag
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/ui-extensions",
3
- "version": "0.12.4",
3
+ "version": "0.13.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -15,7 +15,7 @@
15
15
  "exports": {
16
16
  ".": "./dist/index.js",
17
17
  "./crm": "./dist/crm/index.js",
18
- "./experimental/pages": "./dist/experimental/pages/index.js",
18
+ "./pages": "./dist/pages/index.js",
19
19
  "./pages/home": "./dist/pages/home/index.js",
20
20
  "./experimental": "./dist/experimental/index.js",
21
21
  "./testing": "./dist/testing/index.js",
@@ -77,6 +77,7 @@
77
77
  "format:check": "prettier --check . --ignore-path ../../.prettierignore",
78
78
  "lint": "eslint src/",
79
79
  "lint:fix": "eslint src/ --fix",
80
+ "generate": "node scripts/generate-version.js",
80
81
  "tsc": "tsc",
81
82
  "test": "vitest run && tsd",
82
83
  "test:coverage": "vitest run --coverage",
@@ -1,6 +0,0 @@
1
- export * from './components/index.ts';
2
- export * from './create-page-router.tsx';
3
- export * from './hooks.ts';
4
- export type * from './types.ts';
5
- export type * from '../../shared/types/pages/components/index.ts';
6
- export { PageBreadcrumbs, PageHeader, PageLink, PageTitle, } from '../../shared/remoteComponents.tsx';
@@ -1,4 +0,0 @@
1
- export * from "./components/index.js";
2
- export * from "./create-page-router.js";
3
- export * from "./hooks.js";
4
- export { PageBreadcrumbs, PageHeader, PageLink, PageTitle, } from "../../shared/remoteComponents.js";
@@ -1 +0,0 @@
1
- export declare const useAppPageLocation: () => import("../../../index.ts").AppPageLocation;
@@ -1,75 +0,0 @@
1
- import type { ComponentType, ReactElement } from 'react';
2
- import type { EmptyProps, ReactFragmentProps } from '../shared.ts';
3
- import type { PageRoutesProps } from './components/page-routes.ts';
4
- /**
5
- * The props type for a PageRouter component.
6
- */
7
- export type PageRouterProps = EmptyProps;
8
- /**
9
- * Represents the current page route that has been matched by the page router.
10
- */
11
- export interface MatchedPageRoute {
12
- /**
13
- * The id of the route that has been matched.
14
- */
15
- routeId?: string;
16
- /**
17
- * The path of the route that has been matched.
18
- */
19
- path: string;
20
- /**
21
- * The parameters of the route that has been matched.
22
- */
23
- params: Record<string, string>;
24
- }
25
- /**
26
- * The component type for the page router that handles rendering matched routes.
27
- *
28
- * @experimental This component is experimental. Avoid using it in production due to potential breaking changes. Your feedback is valuable for improvements. Stay tuned for updates.
29
- */
30
- export type PageRouterComponent = ComponentType<PageRouterProps>;
31
- /**
32
- * The function type for [createPageRouter](https://developers.hubspot.com/docs/apps/developer-platform/add-features/ui-extensibility/app-pages/reference#createpagerouter).
33
- *
34
- * Example usage:
35
- *
36
- * ```tsx
37
- * const PageRouter = createPageRouter(
38
- * <PageRoutes layoutComponent={AppLayout}>
39
- * <PageRoutes.IndexRoute component={HomePage} id="home" />
40
- * <PageRoutes.Route path="/docs" component={DocsPage} />
41
- * <PageRoutes path="/customers" layoutComponent={CustomersLayout}>
42
- * <PageRoutes.IndexRoute component={ListCustomersPage} />
43
- * <PageRoutes.Route path="/:customerId" component={ViewCustomerPage} />
44
- * </PageRoutes>
45
- * <PageRoutes.AnyRoute component={NotFoundPage} />
46
- * </PageRoutes>
47
- * );
48
- *
49
- * function AppPages() {
50
- * return <PageRouter />;
51
- * }
52
- *
53
- * hubspot.extend<"pages">(() => <AppPages />);
54
- * ```
55
- *
56
- * @param routes The routes to render.
57
- * @returns The page router component.
58
- *
59
- * @experimental This function is experimental. Avoid using it in production due to potential breaking changes. Your feedback is valuable for improvements. Stay tuned for updates.
60
- */
61
- export type CreatePageRouterFunction = (reactPageRoutesElement: ReactElement<PageRoutesProps> | ReactElement<ReactFragmentProps>) => PageRouterComponent;
62
- /**
63
- * The function type for [usePageRoute](https://developers.hubspot.com/docs/apps/developer-platform/add-features/ui-extensibility/app-pages/reference#usepageroute).
64
- *
65
- * Example usage:
66
- *
67
- * ```tsx
68
- * const pageRoute = usePageRoute();
69
- * ```
70
- *
71
- * @returns The current page route.
72
- *
73
- * @experimental This hook is experimental. Avoid using it in production due to potential breaking changes. Your feedback is valuable for improvements. Stay tuned for updates.
74
- */
75
- export type UsePageRouteHook = () => MatchedPageRoute;
@@ -1,115 +0,0 @@
1
- import type { ComponentType, ReactNode } from 'react';
2
- import type { EmptyProps } from '../../shared.ts';
3
- /**
4
- * The props type for the layout component of [PageRoutes](https://developers.hubspot.com/docs/apps/developer-platform/add-features/ui-extensibility/ui-components/app-page-components/page-routes#pageroutes).
5
- */
6
- export interface PageRoutesLayoutProps {
7
- /**
8
- * The content to render inside the layout.
9
- */
10
- children: ReactNode;
11
- }
12
- interface BaseRouteProps {
13
- /**
14
- * The component to render when the route is matched.
15
- */
16
- component: ComponentType<EmptyProps>;
17
- /**
18
- * A unique identifier for the route.
19
- */
20
- id?: string;
21
- }
22
- /**
23
- * The props type for [PageRoutes.IndexRoute](https://developers.hubspot.com/docs/apps/developer-platform/add-features/ui-extensibility/ui-components/app-page-components/page-routes#pageroutes-indexroute).
24
- */
25
- export type IndexRouteProps = BaseRouteProps;
26
- /**
27
- * The props type for [PageRoutes.Route](https://developers.hubspot.com/docs/apps/developer-platform/add-features/ui-extensibility/ui-components/app-page-components/page-routes#pageroutes-route).
28
- */
29
- export interface RouteProps extends BaseRouteProps {
30
- /**
31
- * The path pattern of the route to match.
32
- */
33
- path: string;
34
- }
35
- /**
36
- * The props type for [PageRoutes.AnyRoute](https://developers.hubspot.com/docs/apps/developer-platform/add-features/ui-extensibility/ui-components/app-page-components/page-routes#pageroutes-anyroute).
37
- */
38
- export type AnyRouteProps = BaseRouteProps;
39
- /**
40
- * The component type for the layout component of [PageRoutes](https://developers.hubspot.com/docs/apps/developer-platform/add-features/ui-extensibility/ui-components/app-page-components/page-routes#pageroutes).
41
- */
42
- export type PageRoutesLayoutComponent = ComponentType<PageRoutesLayoutProps>;
43
- /**
44
- * The props type for [PageRoutes](https://developers.hubspot.com/docs/apps/developer-platform/add-features/ui-extensibility/ui-components/app-page-components/page-routes#pageroutes).
45
- */
46
- export interface PageRoutesProps {
47
- /**
48
- * The path pattern of the route to include with all nested routes.
49
- */
50
- path?: string;
51
- /**
52
- * The component to render for the layout of the page routes.
53
- */
54
- layoutComponent?: PageRoutesLayoutComponent;
55
- /**
56
- * The nested route definitions.
57
- */
58
- children: ReactNode;
59
- }
60
- /**
61
- * Used as a descriptor for a collection of page routes.
62
- *
63
- * Example usage:
64
- *
65
- * ```tsx
66
- * const PageRouter = createPageRouter(<PageRoutes>
67
- * <PageRoutes.IndexRoute component={HomePage} />
68
- * <PageRoutes.Route path="/docs" component={DocsPage} />
69
- * <PageRoutes.AnyRoute component={NotFoundPage} />
70
- * </PageRoutes>);
71
- * ```
72
- *
73
- * See [PageRoutes](https://developers.hubspot.com/docs/apps/developer-platform/add-features/ui-extensibility/ui-components/app-page-components/page-routes#pageroutes) for more information.
74
- *
75
- * @experimental This component is experimental. Avoid using it in production due to potential breaking changes. Your feedback is valuable for improvements. Stay tuned for updates.
76
- */
77
- export interface PageRoutesComponent {
78
- (props: PageRoutesProps): null;
79
- /**
80
- * Used as a descriptor for an index (i.e., "/") route.
81
- *
82
- * Example usage:
83
- *
84
- * ```tsx
85
- * <PageRoutes.IndexRoute component={HomePage} />
86
- * ```
87
- *
88
- * @experimental This component is experimental. Avoid using it in production due to potential breaking changes. Your feedback is valuable for improvements. Stay tuned for updates.
89
- */
90
- IndexRoute: (props: IndexRouteProps) => null;
91
- /**
92
- * Used as a descriptor for a route with a path pattern.
93
- *
94
- * Example usage:
95
- *
96
- * ```tsx
97
- * <PageRoutes.Route path="/docs" component={DocsPage} />
98
- * ```
99
- * @experimental This component is experimental. Avoid using it in production due to potential breaking changes. Your feedback is valuable for improvements. Stay tuned for updates.
100
- */
101
- Route: (props: RouteProps) => null;
102
- /**
103
- * Used as a descriptor for a route that matches any path.
104
- *
105
- * Example usage:
106
- *
107
- * ```tsx
108
- * <PageRoutes.AnyRoute component={NotFoundPage} />
109
- * ```
110
- *
111
- * @experimental This component is experimental. Avoid using it in production due to potential breaking changes. Your feedback is valuable for improvements. Stay tuned for updates.
112
- */
113
- AnyRoute: (props: AnyRouteProps) => null;
114
- }
115
- export {};
@@ -1 +0,0 @@
1
- export type * from './components/index.ts';
@@ -1 +0,0 @@
1
- export type * from './pages/index.ts';