@hubspot/ui-extensions 0.12.4 → 0.13.0

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 (64) hide show
  1. package/dist/__tests__/crm/hooks/useAssociations.spec.js +28 -0
  2. package/dist/__tests__/hooks/useDebounce.spec.js +123 -0
  3. package/dist/__tests__/hooks/utils/useFetchLifecycle.spec.js +324 -0
  4. package/dist/__tests__/internal/hook-utils.spec.js +17 -0
  5. package/dist/__tests__/test-d/extension-points.test-d.js +1 -0
  6. package/dist/crm/hooks/useAssociations.d.ts +2 -2
  7. package/dist/crm/hooks/useAssociations.js +44 -137
  8. package/dist/crm/hooks/useCrmProperties.js +29 -125
  9. package/dist/hooks/useDebounce.d.ts +19 -0
  10. package/dist/hooks/useDebounce.js +32 -0
  11. package/dist/hooks/utils/useFetchLifecycle.d.ts +35 -0
  12. package/dist/hooks/utils/useFetchLifecycle.js +103 -0
  13. package/dist/index.d.ts +1 -0
  14. package/dist/index.js +1 -0
  15. package/dist/internal/hook-utils.d.ts +6 -0
  16. package/dist/internal/hook-utils.js +16 -1
  17. package/dist/{experimental/pages → pages}/components/page-routes.d.ts +1 -2
  18. package/dist/{experimental/pages → pages}/components/page-routes.js +0 -4
  19. package/dist/{experimental/pages → pages}/create-page-router.d.ts +1 -3
  20. package/dist/{experimental/pages → pages}/create-page-router.js +1 -3
  21. package/dist/{experimental/pages → pages}/create-page-router.test.js +2 -2
  22. package/dist/{experimental/pages → pages}/hooks.d.ts +0 -1
  23. package/dist/{experimental/pages → pages}/hooks.js +0 -1
  24. package/dist/pages/index.d.ts +6 -1
  25. package/dist/pages/index.js +4 -1
  26. package/dist/{experimental/pages → pages}/internal/page-router-internal-types.d.ts +1 -1
  27. package/dist/pages/internal/useAppPageLocation.d.ts +1 -0
  28. package/dist/{experimental/pages → pages}/internal/useAppPageLocation.js +2 -2
  29. package/dist/{experimental/pages → pages}/types.d.ts +1 -2
  30. package/dist/shared/types/actions.d.ts +12 -2
  31. package/dist/shared/types/context.d.ts +5 -0
  32. package/dist/shared/types/crm.d.ts +4 -0
  33. package/dist/shared/types/extension-points.d.ts +9 -3
  34. package/dist/shared/types/extension-points.js +1 -0
  35. package/dist/shared/types/shared.d.ts +8 -0
  36. package/dist/testing/__tests__/createRenderer.spec.js +1 -1
  37. package/dist/testing/internal/mocks/index.d.ts +1 -1
  38. package/dist/testing/internal/mocks/mock-extension-point-api.js +21 -1
  39. package/dist/testing/types.d.ts +1 -1
  40. package/package.json +2 -2
  41. package/dist/experimental/pages/index.d.ts +0 -6
  42. package/dist/experimental/pages/index.js +0 -4
  43. package/dist/experimental/pages/internal/useAppPageLocation.d.ts +0 -1
  44. package/dist/shared/types/pages/app-pages-types.d.ts +0 -75
  45. package/dist/shared/types/pages/components/page-routes.d.ts +0 -115
  46. package/dist/shared/types/pages/index.d.ts +0 -1
  47. package/dist/shared/types/pages/index.js +0 -1
  48. package/dist/shared/types/pages.d.ts +0 -1
  49. /package/dist/{experimental/pages/create-page-router.test.d.ts → __tests__/hooks/useDebounce.spec.d.ts} +0 -0
  50. /package/dist/{experimental/pages/internal/trie-router.test.d.ts → __tests__/hooks/utils/useFetchLifecycle.spec.d.ts} +0 -0
  51. /package/dist/{experimental/pages/types.js → __tests__/internal/hook-utils.spec.d.ts} +0 -0
  52. /package/dist/{experimental/pages → pages}/components/index.d.ts +0 -0
  53. /package/dist/{experimental/pages → pages}/components/index.js +0 -0
  54. /package/dist/{shared/types/pages.js → pages/create-page-router.test.d.ts} +0 -0
  55. /package/dist/{experimental/pages → pages}/internal/app-page-route-context.d.ts +0 -0
  56. /package/dist/{experimental/pages → pages}/internal/app-page-route-context.js +0 -0
  57. /package/dist/{experimental/pages → pages}/internal/convert-page-routes-react-elements.d.ts +0 -0
  58. /package/dist/{experimental/pages → pages}/internal/convert-page-routes-react-elements.js +0 -0
  59. /package/dist/{experimental/pages → pages}/internal/page-router-internal-types.js +0 -0
  60. /package/dist/{experimental/pages → pages}/internal/trie-router.d.ts +0 -0
  61. /package/dist/{experimental/pages → pages}/internal/trie-router.js +0 -0
  62. /package/dist/{shared/types/pages/app-pages-types.js → pages/internal/trie-router.test.d.ts} +0 -0
  63. /package/dist/{experimental/pages → pages}/internal/trie-router.test.js +0 -0
  64. /package/dist/{shared/types/pages/components/page-routes.js → pages/types.js} +0 -0
@@ -18,7 +18,6 @@ class PageRoutesRenderError extends Error {
18
18
  *
19
19
  * 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.
20
20
  *
21
- * @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.
22
21
  */
23
22
  export function PageRoutes(__props) {
24
23
  throw new PageRoutesRenderError('PageRoutes');
@@ -32,7 +31,6 @@ export function PageRoutes(__props) {
32
31
  * <PageRoutes.IndexRoute component={HomePage} />
33
32
  * ```
34
33
  *
35
- * @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.
36
34
  */
37
35
  PageRoutes.IndexRoute = function IndexRoute(__props) {
38
36
  throw new PageRoutesRenderError('PageRoutes.IndexRoute');
@@ -45,7 +43,6 @@ PageRoutes.IndexRoute = function IndexRoute(__props) {
45
43
  * ```tsx
46
44
  * <PageRoutes.Route path="/docs" component={DocsPage} />
47
45
  * ```
48
- * @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.
49
46
  */
50
47
  PageRoutes.Route = function Route(__props) {
51
48
  throw new PageRoutesRenderError('PageRoutes.Route');
@@ -59,7 +56,6 @@ PageRoutes.Route = function Route(__props) {
59
56
  * <PageRoutes.AnyRoute component={NotFoundPage} />
60
57
  * ```
61
58
  *
62
- * @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.
63
59
  */
64
60
  PageRoutes.AnyRoute = function AnyRoute(__props) {
65
61
  throw new PageRoutesRenderError('PageRoutes.AnyRoute');
@@ -1,5 +1,5 @@
1
1
  import { type ReactElement } from 'react';
2
- import type { ReactFragmentProps } from '../../shared/types/index.ts';
2
+ import type { ReactFragmentProps } from '../shared/types/index.ts';
3
3
  import type { PageRoutesProps } from './components/page-routes.ts';
4
4
  import type { PageRouterComponent } from './types.ts';
5
5
  /**
@@ -29,7 +29,5 @@ import type { PageRouterComponent } from './types.ts';
29
29
  *
30
30
  * @param routes The routes to render.
31
31
  * @returns The page router component.
32
- *
33
- * @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.
34
32
  */
35
33
  export declare const createPageRouter: (reactPageRoutesElement: ReactElement<PageRoutesProps> | ReactElement<ReactFragmentProps>) => PageRouterComponent;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useMemo } from 'react';
3
- import { EmptyState, Text } from "../../shared/remoteComponents.js";
3
+ import { EmptyState, Text } from "../shared/remoteComponents.js";
4
4
  import { AppPageRouteProvider } from "./internal/app-page-route-context.js";
5
5
  import { convertReactPageRoutesElement } from "./internal/convert-page-routes-react-elements.js";
6
6
  import { RouteNodeType, } from "./internal/page-router-internal-types.js";
@@ -69,8 +69,6 @@ const addRoutes = (trieRouter, seenRouteIds, routeNode, parentPath, parentLayout
69
69
  *
70
70
  * @param routes The routes to render.
71
71
  * @returns The page router component.
72
- *
73
- * @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.
74
72
  */
75
73
  export const createPageRouter = (reactPageRoutesElement) => {
76
74
  // Convert the React element to a route node and add them to a trie router.
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { describe, expect, it } from 'vitest';
3
- import { Box, Text } from "../../index.js";
4
- import { createRenderer } from "../../testing/index.js";
3
+ import { Box, Text } from "../index.js";
4
+ import { createRenderer } from "../testing/index.js";
5
5
  import { PageRoutes } from "./components/page-routes.js";
6
6
  import { createPageRouter } from "./create-page-router.js";
7
7
  import { usePageRoute } from "./hooks.js";
@@ -3,6 +3,5 @@ import type { MatchedPageRoute } from './types.ts';
3
3
  * The hook that provides the current page route to the component.
4
4
  *
5
5
  * @returns The current page route.
6
- * @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.
7
6
  */
8
7
  export declare const usePageRoute: () => MatchedPageRoute;
@@ -4,7 +4,6 @@ import { AppPageRouteContext } from "./internal/app-page-route-context.js";
4
4
  * The hook that provides the current page route to the component.
5
5
  *
6
6
  * @returns The current page route.
7
- * @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.
8
7
  */
9
8
  export const usePageRoute = () => {
10
9
  const matchedPageRoute = useContext(AppPageRouteContext);
@@ -1 +1,6 @@
1
- export { PageBreadcrumbs } from '../shared/remoteComponents.tsx';
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 +1,4 @@
1
- export { PageBreadcrumbs } from "../shared/remoteComponents.js";
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,5 +1,5 @@
1
1
  import type { ComponentType, ReactNode } from 'react';
2
- import type { EmptyProps } from '../../../shared/types/shared.ts';
2
+ import type { EmptyProps } from '../../shared/types/shared.ts';
3
3
  import type { PageRoutesLayoutComponent } from '../components/page-routes.ts';
4
4
  export interface PageRoutesLayoutProps {
5
5
  children: ReactNode;
@@ -0,0 +1 @@
1
+ export declare const useAppPageLocation: () => import("../../index.ts").AppPageLocation;
@@ -1,5 +1,5 @@
1
- import { getWorkerGlobals } from "../../../internal/global-utils.js";
2
- import { useMocksContext } from "../../../internal/hook-utils.js";
1
+ import { getWorkerGlobals } from "../../internal/global-utils.js";
2
+ import { useMocksContext } from "../../internal/hook-utils.js";
3
3
  export const useAppPageLocation = () => {
4
4
  const mocksContext = useMocksContext();
5
5
  if (!mocksContext) {
@@ -1,5 +1,5 @@
1
1
  import type { ComponentType } from 'react';
2
- import type { EmptyProps } from '../../shared/types/shared.ts';
2
+ import type { EmptyProps } from '../shared/types/shared.ts';
3
3
  /**
4
4
  * Represents the current page route that has been matched by the page router.
5
5
  */
@@ -24,6 +24,5 @@ export type PageRouterProps = EmptyProps;
24
24
  /**
25
25
  * The component type for the page router that handles rendering matched routes.
26
26
  *
27
- * @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.
28
27
  */
29
28
  export type PageRouterComponent = ComponentType<PageRouterProps>;
@@ -31,6 +31,11 @@ export type onCrmPropertiesUpdateAction = (properties: string[] | '*', callback:
31
31
  /** @ignore */
32
32
  export type CloseOverlayAction = (id: string) => void;
33
33
  /** @ignore */
34
+ export type NavigateToPageAction = (options: {
35
+ to: string;
36
+ params?: Record<string, string>;
37
+ }) => void;
38
+ /** @ignore */
34
39
  export interface CrmHostActions {
35
40
  addAlert: AddAlertAction;
36
41
  reloadPage: ReloadPageAction;
@@ -48,10 +53,15 @@ export interface AppHomeActions {
48
53
  addAlert: AddAlertAction;
49
54
  }
50
55
  /** @ignore */
56
+ export interface PagesActions {
57
+ addAlert: AddAlertAction;
58
+ }
59
+ /** @ignore */
51
60
  export interface UiePlatformActions {
52
- copyTextToClipboard: Clipboard['writeText'];
53
61
  closeOverlay: CloseOverlayAction;
54
- reloadPage: ReloadPageAction;
62
+ copyTextToClipboard: Clipboard['writeText'];
63
+ navigateToPage: NavigateToPageAction;
55
64
  openIframeModal: OpenIframeModalAction;
65
+ reloadPage: ReloadPageAction;
56
66
  }
57
67
  export {};
@@ -60,6 +60,11 @@ export interface AppHomeContext extends BaseContext {
60
60
  extension?: AppContext;
61
61
  }
62
62
  /** @ignore */
63
+ export interface PagesContext extends BaseContext {
64
+ location: 'pages';
65
+ extension?: AppContext;
66
+ }
67
+ /** @ignore */
63
68
  export interface GenericContext extends BaseContext {
64
69
  location: 'uie.playground.middle';
65
70
  }
@@ -372,6 +372,10 @@ export interface CrmActionLinkProps extends BaseActionComponent {
372
372
  * @defaultValue `"primary"`
373
373
  */
374
374
  variant?: 'primary' | 'light' | 'dark' | 'destructive';
375
+ /**
376
+ * A function that will be invoked when the link is clicked. It receives no arguments and its return value is ignored.
377
+ */
378
+ onClick?: () => void;
375
379
  }
376
380
  export interface ActionLibraryButtonCardActionConfig<SpecificActionType extends ActionType = ActionType> {
377
381
  /**
@@ -1,6 +1,6 @@
1
1
  import type { ComponentType } from 'react';
2
- import type { AppHomeActions, CrmHostActions, SettingsActions, UiePlatformActions } from './actions.ts';
3
- import type { AppHomeContext, BaseContext, CrmContext, GenericContext, SettingsContext } from './context.ts';
2
+ import type { AppHomeActions, CrmHostActions, PagesActions, SettingsActions, UiePlatformActions } from './actions.ts';
3
+ import type { AppHomeContext, BaseContext, CrmContext, GenericContext, PagesContext, SettingsContext } from './context.ts';
4
4
  import type { CrmActionButtonProps, CrmActionLinkProps, CrmAssociationPivotProps, CrmAssociationPropertyListProps, CrmAssociationStageTrackerProps, CrmAssociationTableProps, CrmCardActionsProps, CrmDataHighlightProps, CrmPropertyListProps, CrmRelativeTimelineProps, CrmReportProps, CrmSimpleDeadlineProps, CrmStageTrackerProps, CrmStatisticsProps } from './crm.ts';
5
5
  import type { ServerlessFuncRunner } from './http-requests.ts';
6
6
  import type { TypesOfReadOnlyArray } from './shared.ts';
@@ -75,6 +75,11 @@ export interface AppHomeExtensionPoint extends ExtensionPointContract {
75
75
  actions: AppHomeActions & UiePlatformActions;
76
76
  context: AppHomeContext;
77
77
  }
78
+ /** @ignore */
79
+ export interface PagesExtensionPoint extends ExtensionPointContract {
80
+ actions: PagesActions & UiePlatformActions;
81
+ context: PagesContext;
82
+ }
78
83
  export interface ExampleCrmComponentProps {
79
84
  name: string;
80
85
  size: 'sm' | 'md' | 'lg';
@@ -90,7 +95,7 @@ interface RemotePlaygroundExtensionPoint extends ExtensionPointContract {
90
95
  ExampleCrmComponent: ComponentType<ExampleCrmComponentProps>;
91
96
  };
92
97
  }
93
- export declare const EXTENSION_POINT_LOCATIONS: readonly ["crm.preview", "crm.record.sidebar", "crm.record.tab", "helpdesk.sidebar", "uie.playground.middle", "settings", "home"];
98
+ export declare const EXTENSION_POINT_LOCATIONS: readonly ["crm.preview", "crm.record.sidebar", "crm.record.tab", "helpdesk.sidebar", "uie.playground.middle", "settings", "home", "pages"];
94
99
  export type ExtensionPointLocation = TypesOfReadOnlyArray<typeof EXTENSION_POINT_LOCATIONS>;
95
100
  /** @ignore */
96
101
  interface LocationToExtensionPoint {
@@ -101,6 +106,7 @@ interface LocationToExtensionPoint {
101
106
  'helpdesk.sidebar': StandardCrmExtensionPoint;
102
107
  settings: SettingsExtensionPoint;
103
108
  home: AppHomeExtensionPoint;
109
+ pages: PagesExtensionPoint;
104
110
  }
105
111
  /**
106
112
  * While this resolves to the same result as LocationToExtensionPoint, it ensures that every location
@@ -6,4 +6,5 @@ export const EXTENSION_POINT_LOCATIONS = [
6
6
  'uie.playground.middle',
7
7
  'settings',
8
8
  'home',
9
+ 'pages',
9
10
  ];
@@ -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
  */
@@ -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];
@@ -1,9 +1,9 @@
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';
4
3
  import type { useExtensionActions } from '../hooks/useExtensionActions.tsx';
5
4
  import type { useExtensionApi } from '../hooks/useExtensionApi.tsx';
6
5
  import type { useExtensionContext } from '../hooks/useExtensionContext.tsx';
6
+ import type { useAppPageLocation } from '../pages/internal/useAppPageLocation.tsx';
7
7
  import type { ExtensionPointApi, ExtensionPointApiActions, ExtensionPointLocation } from '../shared/types/extension-points.ts';
8
8
  import type { ServerlessFuncRunner } from '../shared/types/http-requests.ts';
9
9
  import type { AppPageLocation, HubSpotReactComponent, HubSpotReactFragmentProp, UnknownComponentProps } from '../shared/types/shared.ts';
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.0",
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",
@@ -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 {};
@@ -1 +0,0 @@
1
- export type * from './pages/index.ts';