@growth-operations/ui-shared 1.6.17 → 1.7.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.
package/package.json
CHANGED
|
@@ -27,7 +27,12 @@ const SOURCES = {
|
|
|
27
27
|
return results.map((f) => ({ label: f.name, value: f.id }));
|
|
28
28
|
},
|
|
29
29
|
lists: async (context, token, opts) => {
|
|
30
|
-
const { lists = [] } = await getLists(
|
|
30
|
+
const { lists = [] } = await getLists(
|
|
31
|
+
context,
|
|
32
|
+
token,
|
|
33
|
+
opts?.query ?? "",
|
|
34
|
+
opts?.objectTypeId ?? null
|
|
35
|
+
);
|
|
31
36
|
return lists.map((l) => ({ label: l.name, value: String(l.listId) }));
|
|
32
37
|
},
|
|
33
38
|
pipelines: async (context, token, opts) => {
|
|
@@ -61,7 +66,7 @@ export function OptionSelect({
|
|
|
61
66
|
// url is null/absent the link is skipped, so callers can pass an "Edit" action
|
|
62
67
|
// gated on a selected value.
|
|
63
68
|
actions = [],
|
|
64
|
-
// Extra source args (pipelineId/objectType for pipelineStages, query for lists)
|
|
69
|
+
// Extra source args (pipelineId/objectType for pipelineStages, query/objectTypeId for lists)
|
|
65
70
|
...opts
|
|
66
71
|
}) {
|
|
67
72
|
const [options, setOptions] = useState([]);
|
|
@@ -75,6 +80,7 @@ export function OptionSelect({
|
|
|
75
80
|
pipelineId: opts.pipelineId,
|
|
76
81
|
objectType: opts.objectType,
|
|
77
82
|
query: opts.query,
|
|
83
|
+
objectTypeId: opts.objectTypeId,
|
|
78
84
|
});
|
|
79
85
|
|
|
80
86
|
useStrictModeEffect(
|
package/src/sdk/hubspot/lists.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
// HubSpot
|
|
1
|
+
// HubSpot list fetcher (for list-selection pickers).
|
|
2
2
|
//
|
|
3
3
|
// Paginates crm/v3/lists/search until all DYNAMIC lists are collected. The POST
|
|
4
4
|
// body is a plain OBJECT — callHubSpotApi sends it as-is (NEVER JSON.stringify).
|
|
5
5
|
import { buildHubSpotUrl, callHubSpotApi } from "./base";
|
|
6
6
|
|
|
7
7
|
// context is accepted for signature consistency. query: optional name filter.
|
|
8
|
-
|
|
8
|
+
// objectTypeId: optional HubSpot object type id (e.g. "0-1" for contacts, or a
|
|
9
|
+
// custom object's numeric type id) to scope results to lists built on that
|
|
10
|
+
// object — omit to search across all objects, as before.
|
|
11
|
+
export async function getLists(context, token, query = "", objectTypeId = null) {
|
|
9
12
|
const url = buildHubSpotUrl("crm/v3/lists/search");
|
|
10
13
|
const allLists = [];
|
|
11
14
|
let offset = 0;
|
|
@@ -18,6 +21,7 @@ export async function getLists(context, token, query = "") {
|
|
|
18
21
|
count: count,
|
|
19
22
|
offset: offset,
|
|
20
23
|
processingTypes: ["DYNAMIC"],
|
|
24
|
+
...(objectTypeId ? { objectTypeId } : {}),
|
|
21
25
|
};
|
|
22
26
|
|
|
23
27
|
const response = await callHubSpotApi(url, token, "POST", payload);
|