@hubspot/ui-extensions 0.0.1-prealpha.6 → 0.0.1-prealpha.7

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.
package/README.md CHANGED
@@ -13,6 +13,7 @@
13
13
  - [Heading](#heading)
14
14
  - [Image](#image)
15
15
  - [Input](#input)
16
+ - [Link](#link)
16
17
  - [LoadingSpinner](#loadingspinner)
17
18
  - [ProgressBar](#progressbar)
18
19
  - [Select](#select)
@@ -29,6 +30,7 @@
29
30
  - [TableRow](#tablerow)
30
31
  - [Tag](#tag)
31
32
  - [Text](#text)
33
+ - [Textarea](#textarea)
32
34
  - [Tile](#tile)
33
35
 
34
36
  ## Components
@@ -115,8 +117,8 @@ interface ButtonProps {
115
117
  | `onClick` | `() => void` `(optional)` | `N/A` | A function that will be invoked when the button is clicked. It receives no arguments and it's return value is ignored|
116
118
  | `href` | `string(optional)`| `N/A` | A URL that will be opened when the button is clicked. If the value is a URL external to HubSpot it will be opened in a new tab. |
117
119
  | `disabled` | `boolean(optional)` | `N/A` | Determines if the button should be disabled or not.|
118
- | `variant` | ` 'primary' | 'secondary' | 'destructive'` `(optional)` |`'secondary'`| Sets the color variation of the button |
119
- | `type` | `'button' \| 'reset' \| 'submit'` `(optional)` | `'button'`| Sets the HTML attribute "role" of the button |
120
+ | `variant` | `'primary' \| 'secondary' \| 'destructive'` `(optional)` | `'secondary'` | Sets the color variation of the button |
121
+ | `type` | `'button' \| 'reset' \| 'submit'` `(optional)` | `'button'` | Sets the HTML attribute "role" of the button |
120
122
 
121
123
  ##### Usage
122
124
  ```javascript
@@ -385,7 +387,7 @@ interface EmptyStateProps {
385
387
  | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
386
388
  | `flush` | `boolean(optional)` | `false` | Removes the default vertical margins for the component. |
387
389
  | `imageWidth` | `number(optional)` | `250`| The max-width for the image container. |
388
- | `layout` | `'horizontal' | 'vertical'` `(optional)` | `'horizontal'` | Sets the layout direction for the content. |
390
+ | `layout` | `'horizontal' \| 'vertical'` `(optional)` | `'horizontal'` | Sets the layout direction for the content. |
389
391
  | `reverseOrder` | `boolean(optional)` | `false` | Swaps the visual order of the text (primary) and image (secondary) content. This ensures the primary content is still presented first to assistive technology. |
390
392
  | `title` | `string(optional)` | `Intl("All is not lost.")` | The text for the title header rendered above the `children`. |
391
393
 
@@ -427,7 +429,7 @@ interface ErrorStateProps {
427
429
  | - | - | - | - |
428
430
  | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
429
431
  | `title` | `string(optional)` | `Intl("All is not lost.")` | The text for the title header rendered above the `children`. |
430
- | `type` | `'error' | 'support' | 'lock'` `(optional)` | `'error'` | Sets the type of error image that will be shown. |
432
+ | `type` | `'error' \| 'support' \| 'lock'` `(optional)` | `'error'` | Sets the type of error image that will be shown. |
431
433
 
432
434
  ##### Usage
433
435
  ```javascript
@@ -556,7 +558,7 @@ interface InputProps {
556
558
  name: string;
557
559
  value?: string;
558
560
  required?: boolean;
559
- readonly?: boolean;
561
+ readOnly?: boolean;
560
562
  description?: string;
561
563
  tooltip?: string;
562
564
  placeholder?: string;
@@ -574,7 +576,7 @@ interface InputProps {
574
576
  | `name` | `string` | `N/A`| The unique identifier for the input element, this could be thought of as the HTML5 [Input element's name attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name) |
575
577
  | `value` | `string(optional)` | `''`| The value of the input |
576
578
  | `required` | `boolean(optional)` | `false`| Determines if the required indicator should be displayed |
577
- | `readonly` | `boolean(optional)` | `false`| Determines if the field is editable or not. |
579
+ | `readOnly` | `boolean(optional)` | `false`| Determines if the field is editable or not. |
578
580
  | `description` | `string(optional)` | `N/A`| Instructional message to display to the user to help understand the purpose of the input. |
579
581
  | `tooltip` | `string(optional)` | `N/A`| Text that will appear in a tooltip next to the input label. |
580
582
  | `placeholder` | `string(optional)` | `N/A`| Text that appears in the input when it has no value set. |
@@ -626,6 +628,33 @@ const Extension = () => {
626
628
  }
627
629
  ```
628
630
 
631
+ ### Link
632
+
633
+ ##### Import
634
+ ```javascript
635
+ import { Link } from '@hubspot/ui-extensions';
636
+ ```
637
+
638
+ ##### Props
639
+ ```typescript
640
+ export interface LinkProps {
641
+ href: string;
642
+ variant?: 'primary' | 'destructive' | 'light' | 'dark';
643
+ children: ReactNode;
644
+ }
645
+ ```
646
+ | Prop | Type | Default | Description |
647
+ | --- | --- | --- | --- |
648
+ | `href` | `string`| `N/A` | A URL that will be opened when the link is clicked. If the value is a URL external to HubSpot it will be opened in a new tab. |
649
+ | `variant` | `'primary' \| 'light' \| 'dark' \| 'destructive'` `(optional)` | `'primary'` | Sets the color variation of the link |
650
+ | `children` | `ReactNode` | `N/A`| Sets the content that will render inside the component. |
651
+
652
+ ##### Usage
653
+ ```javascript
654
+ const Extension = () => {
655
+ return <Link href="https://app.hubspot.com/">HubSpot</Link>
656
+ }
657
+ ```
629
658
  ### LoadingSpinner
630
659
 
631
660
  ##### Import
@@ -712,7 +741,7 @@ interface SelectProps {
712
741
  name: string;
713
742
  value?: string | number | boolean;
714
743
  required?: boolean;
715
- readonly?: boolean;
744
+ readOnly?: boolean;
716
745
  description?: string;
717
746
  tooltip?: string;
718
747
  placeholder?: string;
@@ -732,7 +761,7 @@ interface SelectProps {
732
761
  | `name` | `string` | `N/A`| The unique identifier for the select element. |
733
762
  | `value` | `string \| number \| boolean` | `''`| The value of the select input. |
734
763
  | `required` | `boolean` | `false`| Determines if the required indicator should be displayed |
735
- | `readonly` | `boolean` | `false`| Determines if the field is editable or not. |
764
+ | `readOnly` | `boolean` | `false`| Determines if the field is editable or not. |
736
765
  | `description` | `string` | `N/A`| Instructional message to display to the user to help understand the purpose of the input. |
737
766
  | `tooltip` | `string` | `N/A`| Text that will appear in a tooltip next to the input label. |
738
767
  | `placeholder` | `string` | `N/A`| Text that appears in the input when it has no value set. |
@@ -1368,6 +1397,96 @@ const Extension = () => {
1368
1397
  }
1369
1398
  ```
1370
1399
 
1400
+ ### Textarea
1401
+
1402
+ ##### Import
1403
+ ```javascript
1404
+ import { Textarea } from '@hubspot/ui-extensions';
1405
+ ```
1406
+
1407
+ ##### Props
1408
+ ```typescript
1409
+ interface TextareaProps {
1410
+ label: string;
1411
+ name: string;
1412
+ value?: string;
1413
+ required?: boolean;
1414
+ readOnly?: boolean;
1415
+ description?: string;
1416
+ tooltip?: string;
1417
+ placeholder?: string;
1418
+ error?: boolean;
1419
+ validationMessage?: string;
1420
+ onChange?: (value: string) => void;
1421
+ onInput?: (value: string) => void;
1422
+ onBlur?: (value: string) => void;
1423
+ onFocus?: (value: string) => void;
1424
+ cols?: number;
1425
+ maxLength?: number;
1426
+ rows?: number;
1427
+ resize?: 'vertical' | 'horizontal' | 'both' | 'none';
1428
+ }
1429
+ ```
1430
+ | Prop | Type | Default | Description |
1431
+ | - | - | - | - |
1432
+ | `label` | `string` | `N/A`| The label text to display for the textarea element |
1433
+ | `name` | `string` | `N/A`| The unique identifier for the textarea element, this could be thought of as the HTML5 [Textarea element's name attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#name) |
1434
+ | `value` | `string(optional)` | `''`| The value of the textarea |
1435
+ | `required` | `boolean(optional)` | `false`| Determines if the required indicator should be displayed |
1436
+ | `readOnly` | `boolean(optional)` | `false`| Determines if the field is editable or not. |
1437
+ | `description` | `string(optional)` | `N/A`| Instructional message to display to the user to help understand the purpose of the textarea. |
1438
+ | `tooltip` | `string(optional)` | `N/A`| Text that will appear in a tooltip next to the textarea label. |
1439
+ | `placeholder` | `string(optional)` | `N/A`| Text that appears in the textarea when it has no value set. |
1440
+ | `error` | `boolean(optional)` | `false`| If set to true, `validationMessage` is displayed as an error message, if it was provided. The textarea will also render it's error state to let the user know there is an error. If false, `validationMessage` is displayed as a success message. |
1441
+ | `validationMessage` | `string(optional)` | `''`| The text to show if the textarea has an error. |
1442
+ | `onChange` | `(value: string) => void(optional)` | `N/A` | A callback function that is invoked when the value is committed. Currently these times are `onBlur` of the textarea and when the user submits the form. |
1443
+ | `onInput` | `(value: string) => void(optional)` | `N/A`| A function that is called and passed the value every time the field is edited by the user. It is recommended that you do not use this value to update state, that is what `onChange` should be used for. Instead this should be used for validation. |
1444
+ | `onBlur` | `(value: string) => void(optional)` | `N/A`| A function that is called and passed the value every time the field loses focus. |
1445
+ | `onFocus` | `(value: string) => void(optional)` | `N/A`| A function that is called and passed the value every time the field gets focused. |
1446
+ | `cols` | `number(optional)` | `N/A` | The visible width of the text control, in average character widths. |
1447
+ | `rows` | `number(optional)` | `N/A` | The number of visible text lines for the control. |
1448
+ | `maxLength` | `number(optional)` | `N/A` | The maximum number of characters (UTF-16 code units) that the user can enter. If this value isn't specified, the user can enter an unlimited number of characters. |
1449
+ | `resize` | `'vertical' \| 'horizontal' \| 'both' \| 'none'` `(optional)`| `'vertical'` | Sets whether an element is resizable, and if so, in which directions. |
1450
+
1451
+ ##### Usage
1452
+ ```javascript
1453
+ import { useState } from 'react';
1454
+
1455
+ const Extension = () => {
1456
+ const [ desciptiption, setDescription ] = useState('');
1457
+ const [ validationMessage, setValidationMessage ] = useState('');
1458
+ const [ isValid, setIsValid ] = useState(true);
1459
+
1460
+ return (
1461
+ <Form>
1462
+ <Textarea
1463
+ label="Description"
1464
+ name="description"
1465
+ tooltip="Provide as much detail as possible"
1466
+ description="Please include a link"
1467
+ placeholder="My desription"
1468
+ required={true}
1469
+ error={!isValid}
1470
+ validationMessage={validationMessage}
1471
+ onChange={(value) => {
1472
+ setDescription(value)
1473
+ }}
1474
+ onInput={(value) => {
1475
+ if (!value.includes('http')) {
1476
+ setValidationMessage('A link must be included.');
1477
+ setIsValid(false);
1478
+ } else {
1479
+ setValidationMessage('Valid description!')
1480
+ setIsValid(true);
1481
+ }
1482
+ }}
1483
+ />
1484
+ </Form>
1485
+ );
1486
+ }
1487
+ ```
1488
+
1489
+
1371
1490
  ### Tile
1372
1491
 
1373
1492
  ##### Import
@@ -1,4 +1,4 @@
1
- import type { AlertProps, ButtonProps, ButtonRowProps, CardProps, DescriptionListProps, DescriptionListItemProps, DividerProps, EmptyStateProps, ErrorStateProps, FormProps, HeadingProps, ImageProps, InputProps, LoadingSpinnerProps, ProgressBarProps, SelectProps, TagProps, TextProps, TileProps, StackProps, StatisticsProps, StatisticsItemProps, StatisticsTrendProps, TableProps, TableElementProps } from './types';
1
+ import type { AlertProps, ButtonProps, ButtonRowProps, CardProps, DescriptionListProps, DescriptionListItemProps, DividerProps, EmptyStateProps, ErrorStateProps, FormProps, HeadingProps, ImageProps, InputProps, TextareaProps, LoadingSpinnerProps, ProgressBarProps, SelectProps, TagProps, TextProps, TileProps, StackProps, StatisticsProps, StatisticsItemProps, StatisticsTrendProps, TableProps, TableElementProps, LinkProps } from './types';
2
2
  declare const Alert: "Alert" & {
3
3
  readonly type?: "Alert" | undefined;
4
4
  readonly props?: AlertProps | undefined;
@@ -64,6 +64,11 @@ declare const Input: "Input" & {
64
64
  readonly props?: InputProps | undefined;
65
65
  readonly children?: true | undefined;
66
66
  } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Input", InputProps, true>>;
67
+ declare const Textarea: "Textarea" & {
68
+ readonly type?: "Textarea" | undefined;
69
+ readonly props?: TextareaProps | undefined;
70
+ readonly children?: true | undefined;
71
+ } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Textarea", TextareaProps, true>>;
67
72
  declare const LoadingSpinner: "LoadingSpinner" & {
68
73
  readonly type?: "LoadingSpinner" | undefined;
69
74
  readonly props?: LoadingSpinnerProps | undefined;
@@ -149,4 +154,9 @@ declare const TableHead: "TableHead" & {
149
154
  readonly props?: TableElementProps | undefined;
150
155
  readonly children?: true | undefined;
151
156
  } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"TableHead", TableElementProps, true>>;
152
- export { Alert, Button, ButtonRow, Card, DescriptionList, DescriptionListItem, Divider, EmptyState, ErrorState, Form, Heading, Image, Input, LoadingSpinner, ProgressBar, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, Table, TableFooter, TableCell, TableRow, TableBody, TableHeader, TableHead, Tag, Text, Tile, };
157
+ declare const Link: "Link" & {
158
+ readonly type?: "Link" | undefined;
159
+ readonly props?: LinkProps | undefined;
160
+ readonly children?: true | undefined;
161
+ } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Link", LinkProps, true>>;
162
+ export { Alert, Button, ButtonRow, Card, DescriptionList, DescriptionListItem, Divider, EmptyState, ErrorState, Form, Heading, Image, Input, Textarea, LoadingSpinner, Link, ProgressBar, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, Table, TableFooter, TableCell, TableRow, TableBody, TableHeader, TableHead, Tag, Text, Tile, };
@@ -12,6 +12,7 @@ const Form = createRemoteReactComponent('Form');
12
12
  const Heading = createRemoteReactComponent('Heading');
13
13
  const Image = createRemoteReactComponent('Image');
14
14
  const Input = createRemoteReactComponent('Input');
15
+ const Textarea = createRemoteReactComponent('Textarea');
15
16
  const LoadingSpinner = createRemoteReactComponent('LoadingSpinner');
16
17
  const ProgressBar = createRemoteReactComponent('ProgressBar');
17
18
  const Select = createRemoteReactComponent('Select');
@@ -29,4 +30,5 @@ const TableRow = createRemoteReactComponent('TableRow');
29
30
  const TableBody = createRemoteReactComponent('TableBody');
30
31
  const TableHeader = createRemoteReactComponent('TableHeader');
31
32
  const TableHead = createRemoteReactComponent('TableHead');
32
- export { Alert, Button, ButtonRow, Card, DescriptionList, DescriptionListItem, Divider, EmptyState, ErrorState, Form, Heading, Image, Input, LoadingSpinner, ProgressBar, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, Table, TableFooter, TableCell, TableRow, TableBody, TableHeader, TableHead, Tag, Text, Tile, };
33
+ const Link = createRemoteReactComponent('Link');
34
+ export { Alert, Button, ButtonRow, Card, DescriptionList, DescriptionListItem, Divider, EmptyState, ErrorState, Form, Heading, Image, Input, Textarea, LoadingSpinner, Link, ProgressBar, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, Table, TableFooter, TableCell, TableRow, TableBody, TableHeader, TableHead, Tag, Text, Tile, };
@@ -1,12 +1,12 @@
1
- import { CrmAssociationsTableProps, CrmPropertyListProps } from '../types';
1
+ import { CrmAssociationTableProps, CrmPropertyListProps } from '../types';
2
2
  declare const CrmPropertyList: "CrmPropertyList" & {
3
3
  readonly type?: "CrmPropertyList" | undefined;
4
4
  readonly props?: CrmPropertyListProps | undefined;
5
5
  readonly children?: true | undefined;
6
6
  } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"CrmPropertyList", CrmPropertyListProps, true>>;
7
- declare const CrmAssociationsTable: "CrmAssociationsTable" & {
8
- readonly type?: "CrmAssociationsTable" | undefined;
9
- readonly props?: CrmAssociationsTableProps | undefined;
7
+ declare const CrmAssociationTable: "CrmAssociationTable" & {
8
+ readonly type?: "CrmAssociationTable" | undefined;
9
+ readonly props?: CrmAssociationTableProps | undefined;
10
10
  readonly children?: true | undefined;
11
- } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"CrmAssociationsTable", CrmAssociationsTableProps, true>>;
12
- export { CrmPropertyList, CrmAssociationsTable };
11
+ } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"CrmAssociationTable", CrmAssociationTableProps, true>>;
12
+ export { CrmPropertyList, CrmAssociationTable };
@@ -1,4 +1,4 @@
1
1
  import { createExtensionComponent } from '../utils/createExtensionComponent';
2
2
  const CrmPropertyList = createExtensionComponent('CrmPropertyList');
3
- const CrmAssociationsTable = createExtensionComponent('CrmAssociationsTable');
4
- export { CrmPropertyList, CrmAssociationsTable };
3
+ const CrmAssociationTable = createExtensionComponent('CrmAssociationTable');
4
+ export { CrmPropertyList, CrmAssociationTable };
@@ -1,2 +1,2 @@
1
- import { CrmPropertyList, CrmAssociationsTable } from './components';
2
- export { CrmPropertyList, CrmAssociationsTable };
1
+ import { CrmPropertyList, CrmAssociationTable } from './components';
2
+ export { CrmPropertyList, CrmAssociationTable };
package/dist/crm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { CrmPropertyList, CrmAssociationsTable } from './components';
2
- export { CrmPropertyList, CrmAssociationsTable };
1
+ import { CrmPropertyList, CrmAssociationTable } from './components';
2
+ export { CrmPropertyList, CrmAssociationTable };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { Alert, Button, ButtonRow, Card, DescriptionList, DescriptionListItem, Divider, EmptyState, ErrorState, Form, Heading, Image, Input, LoadingSpinner, ProgressBar, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, Table, TableFooter, TableCell, TableRow, TableBody, TableHeader, TableHead, Tag, Text, Tile, } from './coreComponents';
1
+ export { Alert, Button, ButtonRow, Card, DescriptionList, DescriptionListItem, Divider, EmptyState, ErrorState, Form, Heading, Image, Input, LoadingSpinner, ProgressBar, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, Table, TableFooter, TableCell, TableRow, TableBody, TableHeader, TableHead, Tag, Text, Textarea, Tile, Link, } from './coreComponents';
2
2
  export { hubspot } from './hubspot';
3
3
  export * from './types';
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { Alert, Button, ButtonRow, Card, DescriptionList, DescriptionListItem, Divider, EmptyState, ErrorState, Form, Heading, Image, Input, LoadingSpinner, ProgressBar, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, Table, TableFooter, TableCell, TableRow, TableBody, TableHeader, TableHead, Tag, Text, Tile, } from './coreComponents';
1
+ export { Alert, Button, ButtonRow, Card, DescriptionList, DescriptionListItem, Divider, EmptyState, ErrorState, Form, Heading, Image, Input, LoadingSpinner, ProgressBar, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, Table, TableFooter, TableCell, TableRow, TableBody, TableHeader, TableHead, Tag, Text, Textarea, Tile, Link, } from './coreComponents';
2
2
  export { hubspot } from './hubspot';
3
3
  export * from './types';
package/dist/types.d.ts CHANGED
@@ -6,12 +6,12 @@ export interface AlertProps {
6
6
  variant?: 'info' | 'warning' | 'success' | 'error' | 'danger';
7
7
  }
8
8
  export interface ButtonProps {
9
- text: string;
10
9
  onClick?: () => void;
11
10
  href?: string;
12
11
  disabled?: boolean;
13
12
  variant?: 'primary' | 'secondary' | 'destructive';
14
13
  type?: 'button' | 'reset' | 'submit';
14
+ children: ReactNode;
15
15
  }
16
16
  export interface ButtonRowProps {
17
17
  children: ReactNode;
@@ -66,7 +66,7 @@ export interface InputProps {
66
66
  name: string;
67
67
  value?: string;
68
68
  required?: boolean;
69
- readonly?: boolean;
69
+ readOnly?: boolean;
70
70
  description?: string;
71
71
  tooltip?: string;
72
72
  placeholder?: string;
@@ -77,6 +77,12 @@ export interface InputProps {
77
77
  onBlur?: (value: string) => void;
78
78
  onFocus?: (value: string) => void;
79
79
  }
80
+ export interface TextareaProps extends InputProps {
81
+ cols?: number;
82
+ maxLength?: number;
83
+ rows?: number;
84
+ resize?: 'vertical' | 'horizontal' | 'both' | 'none';
85
+ }
80
86
  export interface ProgressBarProps {
81
87
  title?: string;
82
88
  showPercentage?: boolean;
@@ -90,7 +96,7 @@ export interface SelectProps {
90
96
  name: string;
91
97
  value?: string | number;
92
98
  required?: boolean;
93
- readonly?: boolean;
99
+ readOnly?: boolean;
94
100
  description?: string;
95
101
  tooltip?: string;
96
102
  placeholder?: string;
@@ -107,19 +113,17 @@ export interface TagProps {
107
113
  onClick?: () => void;
108
114
  variant?: 'default' | 'warning' | 'success' | 'error';
109
115
  }
110
- interface BaseTextProps {
111
- variant?: 'bodytext' | 'microcopy';
112
- tagName?: 'p' | 'span' | 'small';
116
+ export interface TextFormatOptions {
117
+ fontWeight?: 'regular' | 'bold' | 'demibold';
118
+ italic?: boolean;
119
+ lineDecoration?: 'none' | 'underline' | 'strikethrough';
113
120
  }
114
- export interface PlainTextProps extends BaseTextProps {
115
- format?: 'plaintext';
121
+ export type TextProps = {
122
+ variant?: 'bodytext' | 'microcopy';
123
+ inline?: boolean;
116
124
  children: ReactNode;
117
- }
118
- export interface MarkdownTextProps extends BaseTextProps {
119
- format: 'markdown';
120
- text: string;
121
- }
122
- export type TextProps = PlainTextProps | MarkdownTextProps;
125
+ format?: TextFormatOptions;
126
+ };
123
127
  export interface TileProps {
124
128
  children: ReactNode;
125
129
  flush?: boolean;
@@ -166,21 +170,55 @@ export interface StatisticsProps {
166
170
  children: ReactNode;
167
171
  }
168
172
  export interface ServerlessRunnerParams {
173
+ /**
174
+ * Name of the serverless function
175
+ */
169
176
  name: string;
170
- payload: Record<string, unknown>;
171
- onError?: () => void;
177
+ /**
178
+ * Names of CRM object properties to be retrieved and supplied to the function as `context.propertiesToSend`
179
+ */
180
+ propertiesToSend?: string[];
181
+ /**
182
+ * Additional parameters to be supplied to the function as `context.parameters`
183
+ */
184
+ parameters?: JsonValue;
185
+ /**
186
+ * @deprecated Optional payload supplied to the function as `context.event.payload`.
187
+ * Support for this param may be removed in the future. Use `parameters` instead.
188
+ */
189
+ payload?: JsonValue;
190
+ }
191
+ export declare enum ServerlessExecutionStatus {
192
+ Success = "SUCCESS",
193
+ Error = "ERROR"
194
+ }
195
+ export type ServerlessExecutionResult = {
196
+ status: ServerlessExecutionStatus.Success;
197
+ response: JsonValue;
198
+ } | {
199
+ status: ServerlessExecutionStatus.Error;
200
+ message: string;
201
+ };
202
+ export type ServerlessFuncRunner = (params: ServerlessRunnerParams) => Promise<ServerlessExecutionResult>;
203
+ export interface ServerlessExecutionRequest {
204
+ appId: number;
205
+ extensibleCardId: number;
206
+ serverlessFunction: string;
207
+ location: keyof ExtensionPoints;
208
+ objectQuery?: {
209
+ objectId: number;
210
+ objectTypeId: string;
211
+ objectPropertyNames: string[];
212
+ };
213
+ parameters?: JsonValue;
214
+ event?: {
215
+ type: 'SERVERLESS_ACTION_HOOK';
216
+ payload: JsonValue;
217
+ };
172
218
  }
173
- export type ServerlessFuncRunner = (params: ServerlessRunnerParams) => Promise<any>;
174
- export interface ServerlessSuccessResponse {
219
+ export interface ServerlessExecutionResponse {
175
220
  logId: string;
176
- response: {
177
- message?: {
178
- type: 'SUCCESS' | 'ERROR';
179
- body: string;
180
- } | string;
181
- context?: Record<string, unknown>;
182
- section?: Record<string, unknown>;
183
- };
221
+ response?: JsonValue;
184
222
  }
185
223
  export interface ServerlessErrorResponse {
186
224
  responseJSON?: {
@@ -215,10 +253,7 @@ export type AddAlertAction = (args: {
215
253
  message: string;
216
254
  }) => void;
217
255
  export type ReloadPageAction = () => void;
218
- export type FetchCrmObjectPropertiesAction = (properties: string[]) => Promise<{
219
- name: string;
220
- value: string;
221
- }[]>;
256
+ export type FetchCrmObjectPropertiesAction = (properties: string[]) => Promise<Record<string, string>>;
222
257
  export type OpenIframeModalAction = (action: OpenIframeActionPayload) => void;
223
258
  export interface CrmMiddleExtensionPoint extends ExtensionPointContract {
224
259
  actions: {
@@ -228,8 +263,8 @@ export interface CrmMiddleExtensionPoint extends ExtensionPointContract {
228
263
  openIframeModal: OpenIframeModalAction;
229
264
  };
230
265
  customComponents: {
231
- CrmPropertyList?: ComponentType<CrmPropertyListProps>;
232
- CrmAssociationsTable?: ComponentType<CrmAssociationsTableProps>;
266
+ CrmPropertyList: ComponentType<CrmPropertyListProps>;
267
+ CrmAssociationTable: ComponentType<CrmAssociationTableProps>;
233
268
  };
234
269
  }
235
270
  export interface CrmPropertyListProps {
@@ -246,7 +281,7 @@ interface CrmSearchFilter {
246
281
  highValue?: string | number;
247
282
  property: string;
248
283
  }
249
- export interface CrmAssociationsTableProps {
284
+ export interface CrmAssociationTableProps {
250
285
  objectTypeId: string;
251
286
  propertyColumns: Array<string>;
252
287
  quickFilterProperties?: Array<string>;
@@ -326,4 +361,12 @@ export declare class RemoteEvent<V> {
326
361
  targetValue: V;
327
362
  constructor(value: V, event: Event);
328
363
  }
364
+ export interface LinkProps {
365
+ children: ReactNode;
366
+ href: string;
367
+ variant?: 'primary' | 'destructive' | 'light' | 'dark';
368
+ }
369
+ export type JsonValue = string | number | boolean | null | JsonValue[] | {
370
+ [key: string]: JsonValue;
371
+ };
329
372
  export {};
package/dist/types.js CHANGED
@@ -1,3 +1,8 @@
1
+ export var ServerlessExecutionStatus;
2
+ (function (ServerlessExecutionStatus) {
3
+ ServerlessExecutionStatus["Success"] = "SUCCESS";
4
+ ServerlessExecutionStatus["Error"] = "ERROR";
5
+ })(ServerlessExecutionStatus || (ServerlessExecutionStatus = {}));
1
6
  export class RemoteEvent {
2
7
  type;
3
8
  bubbles;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/ui-extensions",
3
- "version": "0.0.1-prealpha.6",
3
+ "version": "0.0.1-prealpha.7",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -48,5 +48,5 @@
48
48
  "devDependencies": {
49
49
  "typescript": "5.0.4"
50
50
  },
51
- "gitHead": "1dfa4048c08a39c6f50a5f87e92eddf1b19dde5c"
51
+ "gitHead": "b5968f431fe29ee9977e6aacdd9b9ab3aa08af0c"
52
52
  }