@kanvas/openclaw-plugin 0.1.4 → 0.1.5
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/domains/crm/index.js +27 -27
- package/package.json +8 -2
|
@@ -186,13 +186,22 @@ export class CrmService {
|
|
|
186
186
|
async updateLead(id, input) {
|
|
187
187
|
// Auto-fetch branch_id and people_id if not provided (the API requires them)
|
|
188
188
|
if (!input.branch_id || !input.people_id) {
|
|
189
|
-
const current = await this.
|
|
189
|
+
const current = await this.getLead(id);
|
|
190
190
|
const lead = current.data?.leads?.data?.[0];
|
|
191
|
-
if (lead) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
191
|
+
if (!lead) {
|
|
192
|
+
throw new Error(`Lead ${id} not found — cannot auto-fetch required fields`);
|
|
193
|
+
}
|
|
194
|
+
if (!input.branch_id) {
|
|
195
|
+
input.branch_id = lead.branch?.id;
|
|
196
|
+
if (!input.branch_id) {
|
|
197
|
+
throw new Error(`Lead ${id} has no branch_id — provide it explicitly`);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (!input.people_id) {
|
|
201
|
+
input.people_id = lead.people?.id;
|
|
202
|
+
if (!input.people_id) {
|
|
203
|
+
throw new Error(`Lead ${id} has no people_id — provide it explicitly`);
|
|
204
|
+
}
|
|
196
205
|
}
|
|
197
206
|
}
|
|
198
207
|
const mutation = `
|
|
@@ -213,24 +222,6 @@ export class CrmService {
|
|
|
213
222
|
`;
|
|
214
223
|
return this.client.query(mutation, { id, input });
|
|
215
224
|
}
|
|
216
|
-
/** Lightweight lead fetch for getting required fields (branch_id, people_id). */
|
|
217
|
-
async getLeadCore(id) {
|
|
218
|
-
const query = `
|
|
219
|
-
query GetLeadCore($first: Int!, $where: QueryLeadsWhereWhereConditions) {
|
|
220
|
-
leads(first: $first, where: $where) {
|
|
221
|
-
data {
|
|
222
|
-
id
|
|
223
|
-
branch { id }
|
|
224
|
-
people { id }
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
`;
|
|
229
|
-
return this.client.query(query, {
|
|
230
|
-
first: 1,
|
|
231
|
-
where: [{ column: "ID", operator: "EQ", value: id }],
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
225
|
async changeLeadOwner(input) {
|
|
235
226
|
return this.updateLead(String(input.leadId), {
|
|
236
227
|
branch_id: input.branch_id,
|
|
@@ -764,11 +755,20 @@ export class CrmService {
|
|
|
764
755
|
city
|
|
765
756
|
state
|
|
766
757
|
zip
|
|
767
|
-
country
|
|
768
758
|
}
|
|
769
759
|
organizations { name }
|
|
770
|
-
custom_fields {
|
|
771
|
-
|
|
760
|
+
custom_fields(first: 50) {
|
|
761
|
+
data {
|
|
762
|
+
name
|
|
763
|
+
value
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
tags(first: 50) {
|
|
767
|
+
data {
|
|
768
|
+
id
|
|
769
|
+
name
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
772
|
updated_at
|
|
773
773
|
}
|
|
774
774
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanvas/openclaw-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Connects agents to Kanvas — your company's nervous system for CRM, inventory, orders, and messaging.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/bakaphp/kanvas-openclaw-plugin"
|
|
9
9
|
},
|
|
10
|
-
"keywords": [
|
|
10
|
+
"keywords": [
|
|
11
|
+
"openclaw",
|
|
12
|
+
"kanvas",
|
|
13
|
+
"crm",
|
|
14
|
+
"plugin",
|
|
15
|
+
"ai-agent"
|
|
16
|
+
],
|
|
11
17
|
"type": "module",
|
|
12
18
|
"openclaw": {
|
|
13
19
|
"id": "kanvas",
|