@hubspot/ui-extensions 0.8.2 → 0.8.3

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.
@@ -221,3 +221,14 @@ export declare const List: "List" & {
221
221
  readonly props?: types.ListProps | undefined;
222
222
  readonly children?: true | undefined;
223
223
  } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"List", types.ListProps, true>>;
224
+ export declare const Toggle: "Toggle" & {
225
+ readonly type?: "Toggle" | undefined;
226
+ readonly props?: types.ToggleProps | undefined;
227
+ readonly children?: true | undefined;
228
+ } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Toggle", types.ToggleProps, true>>;
229
+ /** @experimental */
230
+ export declare const Panel: "Panel" & {
231
+ readonly type?: "Panel" | undefined;
232
+ readonly props?: types.PanelProps | undefined;
233
+ readonly children?: true | undefined;
234
+ } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Panel", types.PanelProps, true>>;
@@ -47,3 +47,8 @@ export const DateInput = createRemoteReactComponent('DateInput');
47
47
  export const Checkbox = createRemoteReactComponent('Checkbox');
48
48
  export const RadioButton = createRemoteReactComponent('RadioButton');
49
49
  export const List = createRemoteReactComponent('List');
50
+ export const Toggle = createRemoteReactComponent('Toggle');
51
+ /** @experimental */
52
+ export const Panel = createRemoteReactComponent('Panel', {
53
+ fragmentProps: ['footer'],
54
+ });
@@ -1,4 +1,4 @@
1
- import { CrmAssociationPivotProps, CrmAssociationTableProps, CrmDataHighlightProps, CrmObjectPropertyProps, CrmPropertyListProps, CrmReportProps, CrmAssociationPropertyListProps, CrmStageTrackerProps, CrmActionButtonProps, CrmActionLinkProps, CrmCardActionsProps } from '../types';
1
+ import { CrmAssociationPivotProps, CrmAssociationTableProps, CrmDataHighlightProps, CrmObjectPropertyProps, CrmPropertyListProps, CrmReportProps, CrmAssociationPropertyListProps, CrmStageTrackerProps, CrmStatisticsProps, CrmActionButtonProps, CrmActionLinkProps, CrmCardActionsProps } from '../types';
2
2
  declare const CrmObjectProperty: "CrmObjectProperty" & {
3
3
  readonly type?: "CrmObjectProperty" | undefined;
4
4
  readonly props?: CrmObjectPropertyProps | undefined;
@@ -39,6 +39,11 @@ declare const CrmStageTracker: "CrmStageTracker" & {
39
39
  readonly props?: CrmStageTrackerProps | undefined;
40
40
  readonly children?: true | undefined;
41
41
  } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"CrmStageTracker", CrmStageTrackerProps, true>>;
42
+ declare const CrmStatistics: "CrmStatistics" & {
43
+ readonly type?: "CrmStatistics" | undefined;
44
+ readonly props?: CrmStatisticsProps | undefined;
45
+ readonly children?: true | undefined;
46
+ } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"CrmStatistics", CrmStatisticsProps, true>>;
42
47
  declare const CrmActionButton: "CrmActionButton" & {
43
48
  readonly type?: "CrmActionButton" | undefined;
44
49
  readonly props?: CrmActionButtonProps | undefined;
@@ -54,4 +59,4 @@ declare const CrmCardActions: "CrmCardActions" & {
54
59
  readonly props?: CrmCardActionsProps | undefined;
55
60
  readonly children?: true | undefined;
56
61
  } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"CrmCardActions", CrmCardActionsProps, true>>;
57
- export { CrmObjectProperty, CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmAssociationPropertyList, CrmStageTracker, CrmActionButton, CrmActionLink, CrmCardActions, };
62
+ export { CrmObjectProperty, CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmAssociationPropertyList, CrmStageTracker, CrmStatistics, CrmActionButton, CrmActionLink, CrmCardActions, };
@@ -7,7 +7,8 @@ const CrmReport = createExtensionComponent('CrmReport');
7
7
  const CrmAssociationPivot = createExtensionComponent('CrmAssociationPivot');
8
8
  const CrmAssociationPropertyList = createExtensionComponent('CrmAssociationPropertyList');
9
9
  const CrmStageTracker = createExtensionComponent('CrmStageTracker');
10
+ const CrmStatistics = createExtensionComponent('CrmStatistics');
10
11
  const CrmActionButton = createExtensionComponent('CrmActionButton');
11
12
  const CrmActionLink = createExtensionComponent('CrmActionLink');
12
13
  const CrmCardActions = createExtensionComponent('CrmCardActions');
13
- export { CrmObjectProperty, CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmAssociationPropertyList, CrmStageTracker, CrmActionButton, CrmActionLink, CrmCardActions, };
14
+ export { CrmObjectProperty, CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmAssociationPropertyList, CrmStageTracker, CrmStatistics, CrmActionButton, CrmActionLink, CrmCardActions, };
@@ -1,2 +1,2 @@
1
- import { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmObjectProperty, CrmAssociationPropertyList, CrmStageTracker, CrmActionButton, CrmActionLink, CrmCardActions } from './components';
2
- export { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmObjectProperty, CrmAssociationPropertyList, CrmStageTracker, CrmActionButton, CrmActionLink, CrmCardActions, };
1
+ import { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmObjectProperty, CrmAssociationPropertyList, CrmStageTracker, CrmStatistics, CrmActionButton, CrmActionLink, CrmCardActions } from './components';
2
+ export { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmObjectProperty, CrmAssociationPropertyList, CrmStageTracker, CrmStatistics, CrmActionButton, CrmActionLink, CrmCardActions, };
package/dist/crm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmObjectProperty, CrmAssociationPropertyList, CrmStageTracker, CrmActionButton, CrmActionLink, CrmCardActions, } from './components';
2
- export { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmObjectProperty, CrmAssociationPropertyList, CrmStageTracker, CrmActionButton, CrmActionLink, CrmCardActions, };
1
+ import { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmObjectProperty, CrmAssociationPropertyList, CrmStageTracker, CrmStatistics, CrmActionButton, CrmActionLink, CrmCardActions, } from './components';
2
+ export { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmObjectProperty, CrmAssociationPropertyList, CrmStageTracker, CrmStatistics, CrmActionButton, CrmActionLink, CrmCardActions, };
package/dist/types.d.ts CHANGED
@@ -987,10 +987,24 @@ export interface PortalContext {
987
987
  timezone: string;
988
988
  }
989
989
  /** @ignore */
990
- export interface Context {
990
+ export interface CrmRecordContext {
991
+ objectId: number;
992
+ objectTypeId: string;
993
+ }
994
+ /** @ignore */
995
+ export interface BaseContext {
991
996
  user: UserContext;
992
997
  portal: PortalContext;
993
998
  }
999
+ /** @ignore */
1000
+ export interface CrmContext extends BaseContext {
1001
+ location: 'crm.record.tab' | 'crm.record.sidebar';
1002
+ crm: CrmRecordContext;
1003
+ }
1004
+ /** @ignore */
1005
+ export interface GenericContext extends BaseContext {
1006
+ location: 'uie.playground.middle';
1007
+ }
994
1008
  export interface StackProps {
995
1009
  distance?: AllDistances;
996
1010
  children?: React.ReactNode;
@@ -1202,6 +1216,7 @@ export interface ExtensionPointContract {
1202
1216
  actions?: {
1203
1217
  [k: string]: ExtensionPointAction;
1204
1218
  } | {};
1219
+ context: BaseContext;
1205
1220
  customComponents: Record<string, ComponentType<any>>;
1206
1221
  }
1207
1222
  /** @ignore */
@@ -1218,22 +1233,27 @@ export type FetchCrmObjectPropertiesAction = (properties: string[]) => Promise<R
1218
1233
  /** @ignore */
1219
1234
  export type OpenIframeModalAction = (action: OpenIframeActionPayload) => void;
1220
1235
  /** @ignore */
1236
+ export type refreshObjectPropertiesAction = () => void;
1237
+ /** @ignore */
1221
1238
  export interface CrmMiddleExtensionPoint extends ExtensionPointContract {
1222
1239
  actions: {
1223
1240
  addAlert: AddAlertAction;
1224
1241
  reloadPage: ReloadPageAction;
1225
1242
  fetchCrmObjectProperties: FetchCrmObjectPropertiesAction;
1226
1243
  openIframeModal: OpenIframeModalAction;
1244
+ refreshObjectProperties?: refreshObjectPropertiesAction;
1227
1245
  };
1246
+ context: CrmContext;
1228
1247
  customComponents: {
1229
1248
  CrmPropertyList: ComponentType<CrmPropertyListProps>;
1230
1249
  CrmAssociationTable: ComponentType<CrmAssociationTableProps>;
1231
1250
  CrmDataHighlight: ComponentType<CrmDataHighlightProps>;
1232
1251
  CrmReport: ComponentType<CrmReportProps>;
1233
1252
  CrmAssociationPivot: ComponentType<CrmAssociationPivotProps>;
1234
- CrmObjectProperty?: ComponentType<CrmObjectPropertyProps>;
1235
- CrmAssociationPropertyList?: ComponentType<CrmAssociationPropertyListProps>;
1236
- CrmStageTracker?: ComponentType<CrmStageTrackerProps>;
1253
+ CrmObjectProperty: ComponentType<CrmObjectPropertyProps>;
1254
+ CrmAssociationPropertyList: ComponentType<CrmAssociationPropertyListProps>;
1255
+ CrmStageTracker: ComponentType<CrmStageTrackerProps>;
1256
+ CrmStatistics?: ComponentType<CrmStatisticsProps>;
1237
1257
  CrmActionButton?: ComponentType<CrmActionButtonProps>;
1238
1258
  CrmActionLink?: ComponentType<CrmActionLinkProps>;
1239
1259
  CrmCardActions?: ComponentType<CrmCardActionsProps>;
@@ -1246,7 +1266,9 @@ export interface CrmSidebarExtensionPoint extends ExtensionPointContract {
1246
1266
  reloadPage: ReloadPageAction;
1247
1267
  fetchCrmObjectProperties: FetchCrmObjectPropertiesAction;
1248
1268
  openIframeModal: OpenIframeModalAction;
1269
+ refreshObjectProperties?: refreshObjectPropertiesAction;
1249
1270
  };
1271
+ context: CrmContext;
1250
1272
  customComponents: {
1251
1273
  [k: string]: never;
1252
1274
  };
@@ -1323,6 +1345,34 @@ export interface CrmStageTrackerProps {
1323
1345
  showProperties?: boolean;
1324
1346
  }
1325
1347
  /** @ignore */
1348
+ interface BaseCrmStatisticItem {
1349
+ label: string;
1350
+ }
1351
+ /** @ignore */
1352
+ interface FilterGroup {
1353
+ filters: Array<CrmSearchFilter>;
1354
+ }
1355
+ /** @ignore */
1356
+ interface BasicMetricItem extends BaseCrmStatisticItem {
1357
+ statisticType: 'SUM' | 'AVG' | 'MIN' | 'MAX' | 'DISTINCT_APPROX' | 'COUNT';
1358
+ propertyName: string;
1359
+ filterGroups?: Array<FilterGroup>;
1360
+ }
1361
+ /** @ignore */
1362
+ interface PercentileMetricItem extends BaseCrmStatisticItem {
1363
+ statisticType: 'PERCENTILES';
1364
+ propertyName: string;
1365
+ percentile: number;
1366
+ filterGroups?: Array<FilterGroup>;
1367
+ }
1368
+ /** @ignore */
1369
+ type CrmStatisticItem = BasicMetricItem | PercentileMetricItem;
1370
+ /** @ignore */
1371
+ export interface CrmStatisticsProps {
1372
+ objectTypeId: string;
1373
+ statistics: Array<CrmStatisticItem>;
1374
+ }
1375
+ /** @ignore */
1326
1376
  interface ObjectCoordinates {
1327
1377
  objectTypeId: string;
1328
1378
  objectId: number;
@@ -1404,6 +1454,7 @@ interface RemotePlaygroundExtensionPoint extends ExtensionPointContract {
1404
1454
  actions: {
1405
1455
  warn: () => void;
1406
1456
  };
1457
+ context: GenericContext;
1407
1458
  customComponents: {
1408
1459
  ExampleCrmComponent: ComponentType<ExampleCrmComponentProps>;
1409
1460
  };
@@ -1420,10 +1471,17 @@ export interface ExampleCrmComponentProps {
1420
1471
  count: number;
1421
1472
  }
1422
1473
  /** @ignore */
1474
+ export type PanelAction = (panelId: string) => void;
1475
+ /** @ignore */
1476
+ export interface GlobalActions {
1477
+ openPanel: PanelAction;
1478
+ closePanel: PanelAction;
1479
+ }
1480
+ /** @ignore */
1423
1481
  export interface ExtensionPointApi<ExtensionPointName extends keyof ExtensionPoints> {
1424
- context: Context;
1425
1482
  runServerlessFunction: ServerlessFuncRunner;
1426
- actions: ExtensionPoints[ExtensionPointName]['actions'];
1483
+ actions: ExtensionPoints[ExtensionPointName]['actions'] & GlobalActions;
1484
+ context: ExtensionPoints[ExtensionPointName]['context'];
1427
1485
  }
1428
1486
  /** @ignore */
1429
1487
  interface OpenIframeActionPayload {
@@ -1786,4 +1844,118 @@ export interface ListProps {
1786
1844
  */
1787
1845
  variant?: 'unordered' | 'unordered-styled' | 'ordered' | 'ordered-styled' | 'inline' | 'inline-divided';
1788
1846
  }
1847
+ /**
1848
+ * The props type for {@link !components.Toggle}.
1849
+ *
1850
+ * @category Component Props
1851
+ */
1852
+ export interface ToggleProps {
1853
+ /**
1854
+ * The current status of the input.
1855
+ */
1856
+ checked?: boolean;
1857
+ /**
1858
+ * When set to `true`, the option cannot be selected.
1859
+ */
1860
+ readonly?: boolean;
1861
+ /**
1862
+ * The unique identifier for the toggle element.
1863
+ */
1864
+ name?: string;
1865
+ /**
1866
+ * The size variation of the toggle.
1867
+ *
1868
+ * @defaultValue `"default"`
1869
+ */
1870
+ size?: TShirtSizes['sm'] | TShirtSizes['xs'] | 'default';
1871
+ /**
1872
+ * A function that is called when the `checked` input status changes.
1873
+ *
1874
+ * @event
1875
+ */
1876
+ onChange?: (checked: boolean) => void;
1877
+ /**
1878
+ * When set to `true`, the option will be selected by default. Use it to
1879
+ * set the default `checked` state when the component is **uncontrolled**.
1880
+ */
1881
+ initialIsChecked?: boolean;
1882
+ /**
1883
+ * The companion text of for Toggle. It can be displayed on top,
1884
+ * inline, or hidden. When hidden, it will remain usable for screen readers.
1885
+ */
1886
+ label: string;
1887
+ /**
1888
+ * Controls the display setting of the label prop.
1889
+ *
1890
+ * @defaultValue `"inline"`
1891
+ */
1892
+ labelDisplay?: 'inline' | 'top' | 'hidden';
1893
+ /**
1894
+ * The text that appears on the Toggle when `checked={true}`.
1895
+ *
1896
+ * @defaultValue `"ON"`
1897
+ */
1898
+ textChecked?: string;
1899
+ /**
1900
+ * The text that appears on the Toggle when `checked={false}`.
1901
+ *
1902
+ * @defaultValue `"ON"`
1903
+ */
1904
+ textUnchecked?: string;
1905
+ }
1906
+ export interface PanelProps {
1907
+ /**
1908
+ * Accessibility label.
1909
+ *
1910
+ */
1911
+ 'aria-label'?: string;
1912
+ /**
1913
+ * The main content of the panel when it opens.
1914
+ *
1915
+ */
1916
+ children?: React.ReactNode;
1917
+ /**
1918
+ * A unique ID for the panel
1919
+ *
1920
+ */
1921
+ id: string;
1922
+ /**
1923
+ * A function that will be invoked when the panel has finished opening.
1924
+ *
1925
+ */
1926
+ onOpen?: () => void;
1927
+ /**
1928
+ * A function that will be invoked when the panel has finished closing.
1929
+ *
1930
+ */
1931
+ onClose?: () => void;
1932
+ /**
1933
+ * The width of the panel
1934
+ *
1935
+ * @defaultValue `"sm"`
1936
+ */
1937
+ width?: TShirtSizes['sm'] | TShirtSizes['md'] | TShirtSizes['lg'];
1938
+ /**
1939
+ * The title of the panel
1940
+ *
1941
+ */
1942
+ title?: string;
1943
+ /**
1944
+ * The Footer of the panel
1945
+ *
1946
+ */
1947
+ footer?: React.ReactNode;
1948
+ /**
1949
+ * When set to `true`, the table will not have side padding.
1950
+ *
1951
+ * @defaultValue `false`
1952
+ */
1953
+ flush?: boolean;
1954
+ /**
1955
+ * The variant of the panel
1956
+ *
1957
+ * @defaultValue `"default"`
1958
+ */
1959
+ variant?: 'modal' | 'default';
1960
+ }
1789
1961
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/ui-extensions",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -50,5 +50,5 @@
50
50
  "devDependencies": {
51
51
  "typescript": "5.0.4"
52
52
  },
53
- "gitHead": "19c43b6956e7a2397e0b4435b3829bd3e3b5e5bc"
53
+ "gitHead": "ab25629916c542f19bf8cde83a10ad8bd225078f"
54
54
  }