@hubspot/ui-extensions 0.8.41 → 0.8.43
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 +2 -0
- package/dist/coreComponents.js +2 -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 +7 -1
- package/dist/experimental/index.js +3 -1
- package/dist/experimental/types.d.ts +33 -1
- package/dist/types.d.ts +3 -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;
|
|
@@ -329,6 +330,7 @@ export declare const StatisticsTrend: "StatisticsTrend" & {
|
|
|
329
330
|
* **Links:**
|
|
330
331
|
*
|
|
331
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}
|
|
332
334
|
*/
|
|
333
335
|
export declare const Table: "Table" & {
|
|
334
336
|
readonly type?: "Table" | 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'],
|
|
@@ -215,6 +216,7 @@ export const StatisticsTrend = createRemoteReactComponent('StatisticsTrend');
|
|
|
215
216
|
* **Links:**
|
|
216
217
|
*
|
|
217
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}
|
|
218
220
|
*/
|
|
219
221
|
export const Table = createRemoteReactComponent('Table');
|
|
220
222
|
/**
|
|
@@ -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;
|
|
@@ -48,4 +49,9 @@ declare const GridItem: "GridItem" & {
|
|
|
48
49
|
readonly props?: experimentalTypes.GridItemProps | undefined;
|
|
49
50
|
readonly children?: true | undefined;
|
|
50
51
|
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"GridItem", experimentalTypes.GridItemProps, true>>;
|
|
51
|
-
|
|
52
|
+
declare const SettingsView: "SettingsView" & {
|
|
53
|
+
readonly type?: "SettingsView" | undefined;
|
|
54
|
+
readonly props?: experimentalTypes.SettingsViewProps | undefined;
|
|
55
|
+
readonly children?: true | undefined;
|
|
56
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"SettingsView", experimentalTypes.SettingsViewProps, true>>;
|
|
57
|
+
export { Iframe, MediaObject, Inline, Stack2, Center, SimpleGrid, GridItem, Grid, SettingsView, };
|
|
@@ -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. */
|
|
@@ -17,4 +18,5 @@ const SimpleGrid = createRemoteReactComponent('SimpleGrid');
|
|
|
17
18
|
const Grid = createRemoteReactComponent('Grid');
|
|
18
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. */
|
|
19
20
|
const GridItem = createRemoteReactComponent('GridItem');
|
|
20
|
-
|
|
21
|
+
const SettingsView = createRemoteReactComponent('SettingsView');
|
|
22
|
+
export { Iframe, MediaObject, Inline, Stack2, Center, SimpleGrid, GridItem, Grid, SettingsView, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { RemoteFragment } from '@remote-ui/core';
|
|
3
|
-
import type { AllDistances } from '../types';
|
|
3
|
+
import type { AllDistances, ExtensionEvent, ReactionsHandler } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* @ignore
|
|
6
6
|
* @experimental do not use in production
|
|
@@ -79,4 +79,36 @@ export interface GridItemProps {
|
|
|
79
79
|
children?: ReactNode;
|
|
80
80
|
offset?: number;
|
|
81
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* @ignore
|
|
84
|
+
* @experimental do not use in production
|
|
85
|
+
*/
|
|
86
|
+
export interface SettingsViewProps {
|
|
87
|
+
/**
|
|
88
|
+
* Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components.
|
|
89
|
+
*/
|
|
90
|
+
children: ReactNode;
|
|
91
|
+
/**
|
|
92
|
+
* If set to `true`, will show the save bar with "cancel" and "save" buttons at the bottom of the page.
|
|
93
|
+
*
|
|
94
|
+
* @defaultValue `false`
|
|
95
|
+
*/
|
|
96
|
+
saveBarVisible?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Used in the save bar to let the user know how many settings they've changed and not yet saved.
|
|
99
|
+
*/
|
|
100
|
+
numberOfSettingsChanged?: number;
|
|
101
|
+
/**
|
|
102
|
+
* The function that will be invoked when the save button in the save bar is clicked.
|
|
103
|
+
*
|
|
104
|
+
* @event
|
|
105
|
+
*/
|
|
106
|
+
onSave?: ReactionsHandler<ExtensionEvent>;
|
|
107
|
+
/**
|
|
108
|
+
* The function that will be invoked when the cancel button in the save bar is clicked.
|
|
109
|
+
*
|
|
110
|
+
* @event
|
|
111
|
+
*/
|
|
112
|
+
onCancel?: ReactionsHandler<ExtensionEvent>;
|
|
113
|
+
}
|
|
82
114
|
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
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/ui-extensions",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.43",
|
|
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": "a140eea0a991c41c86030a5017b54bfd6151ab4c"
|
|
64
64
|
}
|