@hubspot/ui-extensions 0.8.40 → 0.8.42
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/dist/coreComponents.d.ts +5 -0
- package/dist/coreComponents.js +5 -0
- package/dist/experimental/crm/propertyManager.d.ts +8 -0
- package/dist/experimental/crm/propertyManager.js +36 -0
- package/dist/experimental/hooks/useCrmProperties.d.ts +9 -0
- package/dist/experimental/hooks/useCrmProperties.js +22 -0
- package/dist/experimental/index.d.ts +20 -1
- package/dist/experimental/index.js +8 -1
- package/dist/experimental/types.d.ts +21 -0
- package/dist/types.d.ts +4 -3
- package/package.json +5 -5
package/dist/coreComponents.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export declare const Alert: "Alert" & {
|
|
|
19
19
|
*
|
|
20
20
|
* - {@link https://developers.hubspot.com/docs/reference/ui-components/standard-components/button Docs}
|
|
21
21
|
* - {@link https://developers.hubspot.com/docs/reference/ui-components/standard-components/button#usage-examples Examples}
|
|
22
|
+
* - {@link https://github.com/HubSpot/ui-extensions-examples/tree/main/design-patterns#button Design Pattern Examples}
|
|
22
23
|
*/
|
|
23
24
|
export declare const Button: "Button" & {
|
|
24
25
|
readonly type?: "Button" | undefined;
|
|
@@ -108,6 +109,7 @@ export declare const ErrorState: "ErrorState" & {
|
|
|
108
109
|
* **Links:**
|
|
109
110
|
*
|
|
110
111
|
* - {@link https://developers.hubspot.com/docs/reference/ui-components/standard-components/form Docs}
|
|
112
|
+
* - {@link https://github.com/HubSpot/ui-extensions-examples/tree/main/design-patterns#form Design Pattern Examples}
|
|
111
113
|
*/
|
|
112
114
|
export declare const Form: "Form" & {
|
|
113
115
|
readonly type?: "Form" | undefined;
|
|
@@ -328,6 +330,7 @@ export declare const StatisticsTrend: "StatisticsTrend" & {
|
|
|
328
330
|
* **Links:**
|
|
329
331
|
*
|
|
330
332
|
* - {@link https://developers.hubspot.com/docs/reference/ui-components/standard-components/table Docs}
|
|
333
|
+
* - {@link https://github.com/HubSpot/ui-extensions-examples/tree/main/design-patterns#table Design Pattern Example}
|
|
331
334
|
*/
|
|
332
335
|
export declare const Table: "Table" & {
|
|
333
336
|
readonly type?: "Table" | undefined;
|
|
@@ -555,6 +558,7 @@ export declare const Dropdown: "Dropdown" & {
|
|
|
555
558
|
*
|
|
556
559
|
* - {@link https://developers.hubspot.com/docs/reference/ui-components/standard-components/panel Docs}
|
|
557
560
|
* - {@link https://github.com/HubSpot/ui-extensions-examples/tree/main/overlay-example Overlay Example}
|
|
561
|
+
* - {@link https://github.com/HubSpot/ui-extensions-examples/tree/main/design-patterns#panel Design Pattern Examples}
|
|
558
562
|
*/
|
|
559
563
|
export declare const Panel: "Panel" & {
|
|
560
564
|
readonly type?: "Panel" | undefined;
|
|
@@ -619,6 +623,7 @@ export declare const StepperInput: "StepperInput" & {
|
|
|
619
623
|
*
|
|
620
624
|
* - {@link https://developers.hubspot.com/docs/reference/ui-components/standard-components/modal Docs}
|
|
621
625
|
* - {@link https://github.com/HubSpot/ui-extensions-examples/tree/main/overlay-example Overlay Example}
|
|
626
|
+
* - {@link https://github.com/HubSpot/ui-extensions-examples/tree/main/design-patterns#modal Design Pattern Examples}
|
|
622
627
|
*/
|
|
623
628
|
export declare const Modal: "Modal" & {
|
|
624
629
|
readonly type?: "Modal" | undefined;
|
package/dist/coreComponents.js
CHANGED
|
@@ -15,6 +15,7 @@ export const Alert = createRemoteReactComponent('Alert');
|
|
|
15
15
|
*
|
|
16
16
|
* - {@link https://developers.hubspot.com/docs/reference/ui-components/standard-components/button Docs}
|
|
17
17
|
* - {@link https://developers.hubspot.com/docs/reference/ui-components/standard-components/button#usage-examples Examples}
|
|
18
|
+
* - {@link https://github.com/HubSpot/ui-extensions-examples/tree/main/design-patterns#button Design Pattern Examples}
|
|
18
19
|
*/
|
|
19
20
|
export const Button = createRemoteReactComponent('Button', {
|
|
20
21
|
fragmentProps: ['overlay'],
|
|
@@ -74,6 +75,7 @@ export const ErrorState = createRemoteReactComponent('ErrorState');
|
|
|
74
75
|
* **Links:**
|
|
75
76
|
*
|
|
76
77
|
* - {@link https://developers.hubspot.com/docs/reference/ui-components/standard-components/form Docs}
|
|
78
|
+
* - {@link https://github.com/HubSpot/ui-extensions-examples/tree/main/design-patterns#form Design Pattern Examples}
|
|
77
79
|
*/
|
|
78
80
|
export const Form = createRemoteReactComponent('Form');
|
|
79
81
|
/**
|
|
@@ -214,6 +216,7 @@ export const StatisticsTrend = createRemoteReactComponent('StatisticsTrend');
|
|
|
214
216
|
* **Links:**
|
|
215
217
|
*
|
|
216
218
|
* - {@link https://developers.hubspot.com/docs/reference/ui-components/standard-components/table Docs}
|
|
219
|
+
* - {@link https://github.com/HubSpot/ui-extensions-examples/tree/main/design-patterns#table Design Pattern Example}
|
|
217
220
|
*/
|
|
218
221
|
export const Table = createRemoteReactComponent('Table');
|
|
219
222
|
/**
|
|
@@ -365,6 +368,7 @@ export const Dropdown = createRemoteReactComponent('Dropdown');
|
|
|
365
368
|
*
|
|
366
369
|
* - {@link https://developers.hubspot.com/docs/reference/ui-components/standard-components/panel Docs}
|
|
367
370
|
* - {@link https://github.com/HubSpot/ui-extensions-examples/tree/main/overlay-example Overlay Example}
|
|
371
|
+
* - {@link https://github.com/HubSpot/ui-extensions-examples/tree/main/design-patterns#panel Design Pattern Examples}
|
|
368
372
|
*/
|
|
369
373
|
export const Panel = createRemoteReactComponent('Panel');
|
|
370
374
|
/**
|
|
@@ -409,6 +413,7 @@ export const StepperInput = createRemoteReactComponent('StepperInput');
|
|
|
409
413
|
*
|
|
410
414
|
* - {@link https://developers.hubspot.com/docs/reference/ui-components/standard-components/modal Docs}
|
|
411
415
|
* - {@link https://github.com/HubSpot/ui-extensions-examples/tree/main/overlay-example Overlay Example}
|
|
416
|
+
* - {@link https://github.com/HubSpot/ui-extensions-examples/tree/main/design-patterns#modal Design Pattern Examples}
|
|
412
417
|
*/
|
|
413
418
|
export const Modal = createRemoteReactComponent('Modal');
|
|
414
419
|
/**
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CrmHostActions } from 'types';
|
|
2
|
+
/**
|
|
3
|
+
* Core logic for managing CRM property interactions.
|
|
4
|
+
*/
|
|
5
|
+
export declare function createPropertyManager(actions: CrmHostActions): {
|
|
6
|
+
initializePropertyMonitoring(properties: string[], onInitialFetch: (properties: Record<string, string>) => void, onUpdate: (properties: Record<string, string>) => void): () => void;
|
|
7
|
+
refreshProperties: import("types").refreshObjectPropertiesAction;
|
|
8
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { logger } from '../../logger';
|
|
2
|
+
/**
|
|
3
|
+
* Core logic for managing CRM property interactions.
|
|
4
|
+
*/
|
|
5
|
+
export function createPropertyManager(actions) {
|
|
6
|
+
const { fetchCrmObjectProperties, onCrmPropertiesUpdate, refreshObjectProperties, } = actions;
|
|
7
|
+
let cleanup;
|
|
8
|
+
return {
|
|
9
|
+
initializePropertyMonitoring(properties, onInitialFetch, onUpdate) {
|
|
10
|
+
// Clean up any existing listeners.
|
|
11
|
+
if (cleanup) {
|
|
12
|
+
cleanup();
|
|
13
|
+
}
|
|
14
|
+
// Set up property update listener.
|
|
15
|
+
let isSubscribed = true;
|
|
16
|
+
const updateCallback = (props) => {
|
|
17
|
+
if (isSubscribed) {
|
|
18
|
+
onUpdate(props);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
onCrmPropertiesUpdate(properties, updateCallback);
|
|
22
|
+
// Fetch initial properties
|
|
23
|
+
fetchCrmObjectProperties(properties)
|
|
24
|
+
.then(onInitialFetch)
|
|
25
|
+
.catch((error) => {
|
|
26
|
+
logger.error(`Error fetching CRM object properties: ${error}`);
|
|
27
|
+
});
|
|
28
|
+
// Return cleanup function
|
|
29
|
+
cleanup = () => {
|
|
30
|
+
isSubscribed = false;
|
|
31
|
+
};
|
|
32
|
+
return cleanup;
|
|
33
|
+
},
|
|
34
|
+
refreshProperties: refreshObjectProperties,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CrmHostActions } from 'types';
|
|
2
|
+
/**
|
|
3
|
+
* A hook for using and managing CRM properties.
|
|
4
|
+
*
|
|
5
|
+
* @experimental This hook is experimental and might change or be removed in future versions.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useCrmProperties(actions: CrmHostActions, properties: string[], callback: (properties: Record<string, string>) => void, onUpdate?: (properties: Record<string, string>) => void | Promise<void> | undefined | null): {
|
|
8
|
+
onPropertyChanged: import("types").refreshObjectPropertiesAction;
|
|
9
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { createPropertyManager } from '../crm/propertyManager';
|
|
3
|
+
import { logger } from '../../logger';
|
|
4
|
+
/**
|
|
5
|
+
* A hook for using and managing CRM properties.
|
|
6
|
+
*
|
|
7
|
+
* @experimental This hook is experimental and might change or be removed in future versions.
|
|
8
|
+
*/
|
|
9
|
+
export function useCrmProperties(actions, properties, callback, onUpdate) {
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
logger.warn('useCrmProperties is an experimental hook and might change or be removed in the future.');
|
|
12
|
+
}, []);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const propertyManager = createPropertyManager(actions);
|
|
15
|
+
return propertyManager.initializePropertyMonitoring(properties, (props) => callback(props), (props) => callback(props));
|
|
16
|
+
}, [actions, properties, callback, onUpdate]);
|
|
17
|
+
// Return the refresh function
|
|
18
|
+
const propertyManager = createPropertyManager(actions);
|
|
19
|
+
return {
|
|
20
|
+
onPropertyChanged: propertyManager.refreshProperties,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type * as types from '../types';
|
|
2
2
|
import type * as experimentalTypes from './types';
|
|
3
|
+
export { useCrmProperties } from './hooks/useCrmProperties';
|
|
3
4
|
/** @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. */
|
|
4
5
|
declare const Iframe: "Iframe" & {
|
|
5
6
|
readonly type?: "Iframe" | undefined;
|
|
@@ -30,4 +31,22 @@ declare const Center: "Center" & {
|
|
|
30
31
|
readonly props?: experimentalTypes.CenterProps | undefined;
|
|
31
32
|
readonly children?: true | undefined;
|
|
32
33
|
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Center", experimentalTypes.CenterProps, true>>;
|
|
33
|
-
|
|
34
|
+
/** @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. */
|
|
35
|
+
declare const SimpleGrid: "SimpleGrid" & {
|
|
36
|
+
readonly type?: "SimpleGrid" | undefined;
|
|
37
|
+
readonly props?: experimentalTypes.SimpleGridProps | undefined;
|
|
38
|
+
readonly children?: true | undefined;
|
|
39
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"SimpleGrid", experimentalTypes.SimpleGridProps, true>>;
|
|
40
|
+
/** @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. */
|
|
41
|
+
declare const Grid: "Grid" & {
|
|
42
|
+
readonly type?: "Grid" | undefined;
|
|
43
|
+
readonly props?: experimentalTypes.GridProps | undefined;
|
|
44
|
+
readonly children?: true | undefined;
|
|
45
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Grid", experimentalTypes.GridProps, true>>;
|
|
46
|
+
/** @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. */
|
|
47
|
+
declare const GridItem: "GridItem" & {
|
|
48
|
+
readonly type?: "GridItem" | undefined;
|
|
49
|
+
readonly props?: experimentalTypes.GridItemProps | undefined;
|
|
50
|
+
readonly children?: true | undefined;
|
|
51
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"GridItem", experimentalTypes.GridItemProps, true>>;
|
|
52
|
+
export { Iframe, MediaObject, Inline, Stack2, Center, SimpleGrid, GridItem, Grid, };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createRemoteReactComponent } from '@remote-ui/react';
|
|
2
|
+
export { useCrmProperties } from './hooks/useCrmProperties';
|
|
2
3
|
/** @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. */
|
|
3
4
|
const Iframe = createRemoteReactComponent('Iframe');
|
|
4
5
|
/** @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. */
|
|
@@ -11,4 +12,10 @@ const Inline = createRemoteReactComponent('Inline');
|
|
|
11
12
|
const Stack2 = createRemoteReactComponent('Stack2');
|
|
12
13
|
/** @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. */
|
|
13
14
|
const Center = createRemoteReactComponent('Center');
|
|
14
|
-
|
|
15
|
+
/** @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. */
|
|
16
|
+
const SimpleGrid = createRemoteReactComponent('SimpleGrid');
|
|
17
|
+
/** @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. */
|
|
18
|
+
const Grid = createRemoteReactComponent('Grid');
|
|
19
|
+
/** @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. */
|
|
20
|
+
const GridItem = createRemoteReactComponent('GridItem');
|
|
21
|
+
export { Iframe, MediaObject, Inline, Stack2, Center, SimpleGrid, GridItem, Grid, };
|
|
@@ -58,4 +58,25 @@ export interface MediaObjectProps {
|
|
|
58
58
|
itemLeft?: RemoteFragment;
|
|
59
59
|
itemRight?: RemoteFragment;
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* @ignore
|
|
63
|
+
* @experimental do not use in production
|
|
64
|
+
*/
|
|
65
|
+
export interface SimpleGridProps extends BaseLayout {
|
|
66
|
+
minColumnWidth: number | string;
|
|
67
|
+
gap?: AllDistances;
|
|
68
|
+
children?: ReactNode;
|
|
69
|
+
}
|
|
70
|
+
export interface GridProps {
|
|
71
|
+
justify?: FlexJustify;
|
|
72
|
+
align?: FlexAlign;
|
|
73
|
+
gap?: AllDistances;
|
|
74
|
+
size?: number;
|
|
75
|
+
children?: ReactNode;
|
|
76
|
+
}
|
|
77
|
+
export interface GridItemProps {
|
|
78
|
+
size?: number;
|
|
79
|
+
children?: ReactNode;
|
|
80
|
+
offset?: number;
|
|
81
|
+
}
|
|
61
82
|
export {};
|
package/dist/types.d.ts
CHANGED
|
@@ -1634,6 +1634,8 @@ export interface ServerlessErrorResponse {
|
|
|
1634
1634
|
export interface ExtensionContextData {
|
|
1635
1635
|
appId: number | string;
|
|
1636
1636
|
appName?: string;
|
|
1637
|
+
cardId: string;
|
|
1638
|
+
cardTitle?: string;
|
|
1637
1639
|
location: keyof ExtensionPoints;
|
|
1638
1640
|
sourceId?: string | null;
|
|
1639
1641
|
appAccessLevel: 'PUBLIC' | 'PRIVATE';
|
|
@@ -1642,9 +1644,7 @@ export interface ExtensionContextData {
|
|
|
1642
1644
|
} | null;
|
|
1643
1645
|
}
|
|
1644
1646
|
/** @ignore */
|
|
1645
|
-
export interface
|
|
1646
|
-
cardId: string;
|
|
1647
|
-
cardTitle?: string;
|
|
1647
|
+
export interface CrmExtensionContextData extends ExtensionContextData {
|
|
1648
1648
|
objectId: number | string;
|
|
1649
1649
|
objectTypeId: string;
|
|
1650
1650
|
}
|
|
@@ -2049,6 +2049,7 @@ interface OpenIframeActionPayload {
|
|
|
2049
2049
|
uri: string;
|
|
2050
2050
|
height: number;
|
|
2051
2051
|
width: number;
|
|
2052
|
+
/** @deprecated This property is no longer functional and has no effect. Please avoid using it, as it will be removed in future updates */
|
|
2052
2053
|
associatedObjectProperties?: string[];
|
|
2053
2054
|
title?: string;
|
|
2054
2055
|
flush?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/ui-extensions",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.42",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
},
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@remote-ui/react": "
|
|
32
|
-
"@remote-ui/testing": "
|
|
33
|
-
"react": "
|
|
31
|
+
"@remote-ui/react": "5.0.2",
|
|
32
|
+
"@remote-ui/testing": "1.4.3",
|
|
33
|
+
"react": "18.2.0"
|
|
34
34
|
},
|
|
35
35
|
"engines": {
|
|
36
36
|
"node": ">=16"
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react-reconciler": "^0.29.0",
|
|
61
61
|
"typescript": "5.0.4"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "adebd2d54ad45cfedb1ab6b173eda06c8642965c"
|
|
64
64
|
}
|