@agnocon/piece-bigin-by-zoho 0.1.6
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/LICENSE.MIT-AP +24 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +72 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/actions/create-call.d.ts +16 -0
- package/dist/lib/actions/create-call.d.ts.map +1 -0
- package/dist/lib/actions/create-call.js +162 -0
- package/dist/lib/actions/create-call.js.map +1 -0
- package/dist/lib/actions/create-company.d.ts +14 -0
- package/dist/lib/actions/create-company.d.ts.map +1 -0
- package/dist/lib/actions/create-company.js +108 -0
- package/dist/lib/actions/create-company.js.map +1 -0
- package/dist/lib/actions/create-contact.d.ts +18 -0
- package/dist/lib/actions/create-contact.d.ts.map +1 -0
- package/dist/lib/actions/create-contact.js +130 -0
- package/dist/lib/actions/create-contact.js.map +1 -0
- package/dist/lib/actions/create-event.d.ts +18 -0
- package/dist/lib/actions/create-event.d.ts.map +1 -0
- package/dist/lib/actions/create-event.js +360 -0
- package/dist/lib/actions/create-event.js.map +1 -0
- package/dist/lib/actions/create-pipeline-record.d.ts +16 -0
- package/dist/lib/actions/create-pipeline-record.d.ts.map +1 -0
- package/dist/lib/actions/create-pipeline-record.js +219 -0
- package/dist/lib/actions/create-pipeline-record.js.map +1 -0
- package/dist/lib/actions/create-task.d.ts +16 -0
- package/dist/lib/actions/create-task.d.ts.map +1 -0
- package/dist/lib/actions/create-task.js +380 -0
- package/dist/lib/actions/create-task.js.map +1 -0
- package/dist/lib/actions/search-company-record.d.ts +5 -0
- package/dist/lib/actions/search-company-record.d.ts.map +1 -0
- package/dist/lib/actions/search-company-record.js +58 -0
- package/dist/lib/actions/search-company-record.js.map +1 -0
- package/dist/lib/actions/search-contact-record.d.ts +5 -0
- package/dist/lib/actions/search-contact-record.d.ts.map +1 -0
- package/dist/lib/actions/search-contact-record.js +82 -0
- package/dist/lib/actions/search-contact-record.js.map +1 -0
- package/dist/lib/actions/search-pipeline-records.d.ts +5 -0
- package/dist/lib/actions/search-pipeline-records.d.ts.map +1 -0
- package/dist/lib/actions/search-pipeline-records.js +53 -0
- package/dist/lib/actions/search-pipeline-records.js.map +1 -0
- package/dist/lib/actions/search-product.d.ts +5 -0
- package/dist/lib/actions/search-product.d.ts.map +1 -0
- package/dist/lib/actions/search-product.js +60 -0
- package/dist/lib/actions/search-product.js.map +1 -0
- package/dist/lib/actions/search-user.d.ts +7 -0
- package/dist/lib/actions/search-user.d.ts.map +1 -0
- package/dist/lib/actions/search-user.js +75 -0
- package/dist/lib/actions/search-user.js.map +1 -0
- package/dist/lib/actions/update-company.d.ts +7 -0
- package/dist/lib/actions/update-company.d.ts.map +1 -0
- package/dist/lib/actions/update-company.js +224 -0
- package/dist/lib/actions/update-company.js.map +1 -0
- package/dist/lib/actions/update-contact.d.ts +7 -0
- package/dist/lib/actions/update-contact.d.ts.map +1 -0
- package/dist/lib/actions/update-contact.js +248 -0
- package/dist/lib/actions/update-contact.js.map +1 -0
- package/dist/lib/actions/update-event.d.ts +13 -0
- package/dist/lib/actions/update-event.d.ts.map +1 -0
- package/dist/lib/actions/update-event.js +466 -0
- package/dist/lib/actions/update-event.js.map +1 -0
- package/dist/lib/actions/update-pipeline-record.d.ts +14 -0
- package/dist/lib/actions/update-pipeline-record.d.ts.map +1 -0
- package/dist/lib/actions/update-pipeline-record.js +205 -0
- package/dist/lib/actions/update-pipeline-record.js.map +1 -0
- package/dist/lib/actions/update-task.d.ts +13 -0
- package/dist/lib/actions/update-task.d.ts.map +1 -0
- package/dist/lib/actions/update-task.js +449 -0
- package/dist/lib/actions/update-task.js.map +1 -0
- package/dist/lib/auth.d.ts +2 -0
- package/dist/lib/auth.d.ts.map +1 -0
- package/dist/lib/auth.js +59 -0
- package/dist/lib/auth.js.map +1 -0
- package/dist/lib/common/constants.d.ts +23 -0
- package/dist/lib/common/constants.d.ts.map +1 -0
- package/dist/lib/common/constants.js +72 -0
- package/dist/lib/common/constants.js.map +1 -0
- package/dist/lib/common/helpers.d.ts +11 -0
- package/dist/lib/common/helpers.d.ts.map +1 -0
- package/dist/lib/common/helpers.js +40 -0
- package/dist/lib/common/helpers.js.map +1 -0
- package/dist/lib/common/props.d.ts +10 -0
- package/dist/lib/common/props.d.ts.map +1 -0
- package/dist/lib/common/props.js +217 -0
- package/dist/lib/common/props.js.map +1 -0
- package/dist/lib/common/request.d.ts +35 -0
- package/dist/lib/common/request.d.ts.map +1 -0
- package/dist/lib/common/request.js +226 -0
- package/dist/lib/common/request.js.map +1 -0
- package/dist/lib/triggers/company-updated.d.ts +3 -0
- package/dist/lib/triggers/company-updated.d.ts.map +1 -0
- package/dist/lib/triggers/company-updated.js +66 -0
- package/dist/lib/triggers/company-updated.js.map +1 -0
- package/dist/lib/triggers/contact-updated.d.ts +3 -0
- package/dist/lib/triggers/contact-updated.d.ts.map +1 -0
- package/dist/lib/triggers/contact-updated.js +66 -0
- package/dist/lib/triggers/contact-updated.js.map +1 -0
- package/dist/lib/triggers/new-call-created.d.ts +3 -0
- package/dist/lib/triggers/new-call-created.d.ts.map +1 -0
- package/dist/lib/triggers/new-call-created.js +66 -0
- package/dist/lib/triggers/new-call-created.js.map +1 -0
- package/dist/lib/triggers/new-company-created.d.ts +3 -0
- package/dist/lib/triggers/new-company-created.d.ts.map +1 -0
- package/dist/lib/triggers/new-company-created.js +66 -0
- package/dist/lib/triggers/new-company-created.js.map +1 -0
- package/dist/lib/triggers/new-contact-created.d.ts +3 -0
- package/dist/lib/triggers/new-contact-created.d.ts.map +1 -0
- package/dist/lib/triggers/new-contact-created.js +75 -0
- package/dist/lib/triggers/new-contact-created.js.map +1 -0
- package/dist/lib/triggers/new-event-created.d.ts +3 -0
- package/dist/lib/triggers/new-event-created.d.ts.map +1 -0
- package/dist/lib/triggers/new-event-created.js +66 -0
- package/dist/lib/triggers/new-event-created.js.map +1 -0
- package/dist/lib/triggers/new-pipeline-record.d.ts +3 -0
- package/dist/lib/triggers/new-pipeline-record.d.ts.map +1 -0
- package/dist/lib/triggers/new-pipeline-record.js +66 -0
- package/dist/lib/triggers/new-pipeline-record.js.map +1 -0
- package/dist/lib/triggers/new-task-created.d.ts +3 -0
- package/dist/lib/triggers/new-task-created.d.ts.map +1 -0
- package/dist/lib/triggers/new-task-created.js +66 -0
- package/dist/lib/triggers/new-task-created.js.map +1 -0
- package/dist/lib/triggers/pipeline-record-updated.d.ts +3 -0
- package/dist/lib/triggers/pipeline-record-updated.d.ts.map +1 -0
- package/dist/lib/triggers/pipeline-record-updated.js +66 -0
- package/dist/lib/triggers/pipeline-record-updated.js.map +1 -0
- package/package.json +46 -0
- package/src/index.ts +72 -0
- package/src/lib/actions/create-call.ts +168 -0
- package/src/lib/actions/create-company.ts +124 -0
- package/src/lib/actions/create-contact.ts +151 -0
- package/src/lib/actions/create-event.ts +399 -0
- package/src/lib/actions/create-pipeline-record.ts +255 -0
- package/src/lib/actions/create-task.ts +426 -0
- package/src/lib/actions/search-company-record.ts +57 -0
- package/src/lib/actions/search-contact-record.ts +79 -0
- package/src/lib/actions/search-pipeline-records.ts +52 -0
- package/src/lib/actions/search-product.ts +60 -0
- package/src/lib/actions/search-user.ts +70 -0
- package/src/lib/actions/update-company.ts +235 -0
- package/src/lib/actions/update-contact.ts +261 -0
- package/src/lib/actions/update-event.ts +528 -0
- package/src/lib/actions/update-pipeline-record.ts +235 -0
- package/src/lib/actions/update-task.ts +499 -0
- package/src/lib/auth.ts +57 -0
- package/src/lib/common/constants.ts +68 -0
- package/src/lib/common/helpers.ts +46 -0
- package/src/lib/common/props.ts +270 -0
- package/src/lib/common/request.ts +285 -0
- package/src/lib/triggers/company-updated.ts +69 -0
- package/src/lib/triggers/contact-updated.ts +65 -0
- package/src/lib/triggers/new-call-created.ts +69 -0
- package/src/lib/triggers/new-company-created.ts +69 -0
- package/src/lib/triggers/new-contact-created.ts +75 -0
- package/src/lib/triggers/new-event-created.ts +69 -0
- package/src/lib/triggers/new-pipeline-record.ts +69 -0
- package/src/lib/triggers/new-task-created.ts +69 -0
- package/src/lib/triggers/pipeline-record-updated.ts +69 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.newTaskCreated = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/bigin-by-zoho/src/lib/triggers/new-task-created.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const constants_1 = require("../common/constants");
|
|
9
|
+
const auth_1 = require("../auth");
|
|
10
|
+
const request_1 = require("../common/request");
|
|
11
|
+
const CACHE_KEY = 'bigin_new_task_created_trigger';
|
|
12
|
+
exports.newTaskCreated = (0, pieces_framework_1.createTrigger)({
|
|
13
|
+
auth: auth_1.biginAuth,
|
|
14
|
+
name: 'newTaskCreated',
|
|
15
|
+
displayName: 'New Task Created',
|
|
16
|
+
description: 'Triggers when a new task is created',
|
|
17
|
+
aiMetadata: {
|
|
18
|
+
description: 'Fires when a new task is created in Bigin CRM, via a Tasks.create webhook. Represents a newly added piece of follow-up work.',
|
|
19
|
+
},
|
|
20
|
+
props: {},
|
|
21
|
+
sampleData: {},
|
|
22
|
+
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
23
|
+
onEnable(context) {
|
|
24
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
try {
|
|
26
|
+
const channel_id = Date.now().toString();
|
|
27
|
+
const { api_domain } = context.auth.data;
|
|
28
|
+
const webhookData = {
|
|
29
|
+
watch: [
|
|
30
|
+
{
|
|
31
|
+
channel_id,
|
|
32
|
+
events: ['Tasks.create'],
|
|
33
|
+
notify_url: context.webhookUrl,
|
|
34
|
+
token: constants_1.ZOHO_WEBHOOK_TOKEN,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
yield request_1.biginApiService.createWebhook(context.auth.access_token, webhookData, api_domain);
|
|
39
|
+
yield context.store.put(CACHE_KEY, channel_id);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
console.error('Failed to enable Zoho webhook');
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
onDisable(context) {
|
|
47
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const channel_id = (yield context.store.get(CACHE_KEY));
|
|
49
|
+
if (!channel_id)
|
|
50
|
+
return;
|
|
51
|
+
const { api_domain } = context.auth.data;
|
|
52
|
+
yield request_1.biginApiService.deleteWebhook(context.auth.access_token, api_domain, channel_id);
|
|
53
|
+
yield context.store.delete(CACHE_KEY);
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
run(context) {
|
|
57
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const { token } = context.payload.body;
|
|
59
|
+
if (token !== constants_1.ZOHO_WEBHOOK_TOKEN) {
|
|
60
|
+
throw new Error('Invalid webhook token');
|
|
61
|
+
}
|
|
62
|
+
return [context.payload.body];
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=new-task-created.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-task-created.js","sourceRoot":"","sources":["../../../src/lib/triggers/new-task-created.ts"],"names":[],"mappings":";;;;AAAA,iHAAiH;AACjH,qEAAqE;AACrE,gEAA2E;AAC3E,mDAAyD;AACzD,kCAAoC;AACpC,+CAAoD;AAEpD,MAAM,SAAS,GAAG,gCAAgC,CAAC;AAEtC,QAAA,cAAc,GAAG,IAAA,gCAAa,EAAC;IAC1C,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,qCAAqC;IAClD,UAAU,EAAE;QACV,WAAW,EAAE,8HAA8H;KAC5I;IACD,KAAK,EAAE,EAAE;IACT,UAAU,EAAE,EAAE;IACd,IAAI,EAAE,kCAAe,CAAC,OAAO;IACvB,QAAQ,CAAC,OAAO;;YACpB,IAAI,CAAC;gBACH,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;gBACzC,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;gBAEzC,MAAM,WAAW,GAAG;oBAClB,KAAK,EAAE;wBACL;4BACE,UAAU;4BACV,MAAM,EAAE,CAAC,cAAc,CAAC;4BACxB,UAAU,EAAE,OAAO,CAAC,UAAU;4BAC9B,KAAK,EAAE,8BAAkB;yBAC1B;qBACF;iBACF,CAAC;gBAEF,MAAM,yBAAe,CAAC,aAAa,CACjC,OAAO,CAAC,IAAI,CAAC,YAAY,EACzB,WAAW,EACX,UAAU,CACX,CAAC;gBAEF,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;YACjD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;YACjD,CAAC;QACH,CAAC;KAAA;IACK,SAAS,CAAC,OAAO;;YACrB,MAAM,UAAU,GAAG,CAAC,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAW,CAAC;YAClE,IAAI,CAAC,UAAU;gBAAE,OAAO;YAExB,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;YAEzC,MAAM,yBAAe,CAAC,aAAa,CACjC,OAAO,CAAC,IAAI,CAAC,YAAY,EACzB,UAAU,EACV,UAAU,CACX,CAAC;YAEF,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACxC,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,IAAW,CAAC;YAE9C,IAAI,KAAK,KAAK,8BAAkB,EAAE,CAAC;gBACjC,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;YAC3C,CAAC;YAED,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@agnocon/pieces-framework';
|
|
2
|
+
export declare const pipelineRecordUpdated: import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>, {}>;
|
|
3
|
+
//# sourceMappingURL=pipeline-record-updated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline-record-updated.d.ts","sourceRoot":"","sources":["../../../src/lib/triggers/pipeline-record-updated.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAO3E,eAAO,MAAM,qBAAqB,ssBA6DhC,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pipelineRecordUpdated = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/bigin-by-zoho/src/lib/triggers/pipeline-record-updated.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const constants_1 = require("../common/constants");
|
|
9
|
+
const auth_1 = require("../auth");
|
|
10
|
+
const request_1 = require("../common/request");
|
|
11
|
+
const CACHE_KEY = 'bigin_pipeline_record_updated_trigger';
|
|
12
|
+
exports.pipelineRecordUpdated = (0, pieces_framework_1.createTrigger)({
|
|
13
|
+
auth: auth_1.biginAuth,
|
|
14
|
+
name: 'pipelineRecordUpdated',
|
|
15
|
+
displayName: 'Pipeline Record Updated',
|
|
16
|
+
description: 'Triggers when a pipeline record is updated',
|
|
17
|
+
aiMetadata: {
|
|
18
|
+
description: 'Fires when an existing pipeline record (deal) is edited in Bigin CRM, via a Pipelines.edit webhook. Represents a change to a deal already in the CRM, such as a stage or amount update.',
|
|
19
|
+
},
|
|
20
|
+
props: {},
|
|
21
|
+
sampleData: {},
|
|
22
|
+
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
23
|
+
onEnable(context) {
|
|
24
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
try {
|
|
26
|
+
const channel_id = Date.now().toString();
|
|
27
|
+
const { api_domain } = context.auth.data;
|
|
28
|
+
const webhookData = {
|
|
29
|
+
watch: [
|
|
30
|
+
{
|
|
31
|
+
channel_id,
|
|
32
|
+
events: ['Pipelines.edit'],
|
|
33
|
+
notify_url: context.webhookUrl,
|
|
34
|
+
token: constants_1.ZOHO_WEBHOOK_TOKEN,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
yield request_1.biginApiService.createWebhook(context.auth.access_token, webhookData, api_domain);
|
|
39
|
+
yield context.store.put(CACHE_KEY, channel_id);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
console.error('Failed to enable Zoho webhook');
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
onDisable(context) {
|
|
47
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const channel_id = (yield context.store.get(CACHE_KEY));
|
|
49
|
+
if (!channel_id)
|
|
50
|
+
return;
|
|
51
|
+
const { api_domain } = context.auth.data;
|
|
52
|
+
yield request_1.biginApiService.deleteWebhook(context.auth.access_token, api_domain, channel_id);
|
|
53
|
+
yield context.store.delete(CACHE_KEY);
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
run(context) {
|
|
57
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const { token } = context.payload.body;
|
|
59
|
+
if (token !== constants_1.ZOHO_WEBHOOK_TOKEN) {
|
|
60
|
+
throw new Error('Invalid webhook token');
|
|
61
|
+
}
|
|
62
|
+
return [context.payload.body];
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=pipeline-record-updated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline-record-updated.js","sourceRoot":"","sources":["../../../src/lib/triggers/pipeline-record-updated.ts"],"names":[],"mappings":";;;;AAAA,wHAAwH;AACxH,qEAAqE;AACrE,gEAA2E;AAC3E,mDAAyD;AACzD,kCAAoC;AACpC,+CAAoD;AAEpD,MAAM,SAAS,GAAG,uCAAuC,CAAC;AAE7C,QAAA,qBAAqB,GAAG,IAAA,gCAAa,EAAC;IACjD,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,yBAAyB;IACtC,WAAW,EAAE,4CAA4C;IACzD,UAAU,EAAE;QACV,WAAW,EAAE,yLAAyL;KACvM;IACD,KAAK,EAAE,EAAE;IACT,UAAU,EAAE,EAAE;IACd,IAAI,EAAE,kCAAe,CAAC,OAAO;IACvB,QAAQ,CAAC,OAAO;;YACpB,IAAI,CAAC;gBACH,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;gBACzC,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;gBAEzC,MAAM,WAAW,GAAG;oBAClB,KAAK,EAAE;wBACL;4BACE,UAAU;4BACV,MAAM,EAAE,CAAC,gBAAgB,CAAC;4BAC1B,UAAU,EAAE,OAAO,CAAC,UAAU;4BAC9B,KAAK,EAAE,8BAAkB;yBAC1B;qBACF;iBACF,CAAC;gBAEF,MAAM,yBAAe,CAAC,aAAa,CACjC,OAAO,CAAC,IAAI,CAAC,YAAY,EACzB,WAAW,EACX,UAAU,CACX,CAAC;gBAEF,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;YACjD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;YACjD,CAAC;QACH,CAAC;KAAA;IACK,SAAS,CAAC,OAAO;;YACrB,MAAM,UAAU,GAAG,CAAC,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAW,CAAC;YAClE,IAAI,CAAC,UAAU;gBAAE,OAAO;YAExB,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;YAEzC,MAAM,yBAAe,CAAC,aAAa,CACjC,OAAO,CAAC,IAAI,CAAC,YAAY,EACzB,UAAU,EACV,UAAU,CACX,CAAC;YAEF,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACxC,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,IAAW,CAAC;YAE9C,IAAI,KAAK,KAAK,8BAAkB,EAAE,CAAC;gBACjC,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;YAC3C,CAAC;YAED,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agnocon/piece-bigin-by-zoho",
|
|
3
|
+
"version": "0.1.6",
|
|
4
|
+
"description": "AgnoCon bigin by zoho connector",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"require": "./dist/index.js",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"src",
|
|
17
|
+
"LICENSE.MIT-AP"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc -p tsconfig.json",
|
|
21
|
+
"vendor": "node ../scripts/vendor-ap.mjs piece-bigin-by-zoho"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@agnocon/core-utils": "0.2.0",
|
|
25
|
+
"@agnocon/piece-types": "0.3.1",
|
|
26
|
+
"@agnocon/pieces-common": "0.12.8",
|
|
27
|
+
"@agnocon/pieces-framework": "0.36.0",
|
|
28
|
+
"tslib": "2.6.2"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "20.17.6",
|
|
32
|
+
"typescript": "5.5.4"
|
|
33
|
+
},
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"agnocon": {
|
|
36
|
+
"originVersion": "0.1.6"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "restricted",
|
|
40
|
+
"tag": "latest"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"agnocon",
|
|
44
|
+
"connector"
|
|
45
|
+
]
|
|
46
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
|
|
2
|
+
import { createPiece, PieceAuth, Property } from "@agnocon/pieces-framework";
|
|
3
|
+
import { DATA_CENTER_REGIONS } from "./lib/common/constants";
|
|
4
|
+
import { getZohoBiginAccountAuthorizationUrl } from "./lib/common/helpers";
|
|
5
|
+
import { newContactCreated } from "./lib/triggers/new-contact-created";
|
|
6
|
+
import { PieceCategory } from '@agnocon/pieces-framework';
|
|
7
|
+
import { companyUpdated } from "./lib/triggers/company-updated";
|
|
8
|
+
import { contactUpdated } from "./lib/triggers/contact-updated";
|
|
9
|
+
import { newCallCreated } from "./lib/triggers/new-call-created";
|
|
10
|
+
import { newCompanyCreated } from "./lib/triggers/new-company-created";
|
|
11
|
+
import { newTaskCreated } from "./lib/triggers/new-task-created";
|
|
12
|
+
import { newEventCreated } from "./lib/triggers/new-event-created";
|
|
13
|
+
import { newPipelineRecordCreated } from "./lib/triggers/new-pipeline-record";
|
|
14
|
+
import { pipelineRecordUpdated } from "./lib/triggers/pipeline-record-updated";
|
|
15
|
+
import { createCompany } from "./lib/actions/create-company";
|
|
16
|
+
import { updateCompany } from "./lib/actions/update-company";
|
|
17
|
+
import { createContact } from "./lib/actions/create-contact";
|
|
18
|
+
import { updateContact } from "./lib/actions/update-contact";
|
|
19
|
+
import { createTask } from "./lib/actions/create-task";
|
|
20
|
+
import { updateTask } from "./lib/actions/update-task";
|
|
21
|
+
import { createCall } from "./lib/actions/create-call";
|
|
22
|
+
import { biginApiService } from "./lib/common/request";
|
|
23
|
+
import { createEvent } from "./lib/actions/create-event";
|
|
24
|
+
import { updateEvent } from "./lib/actions/update-event";
|
|
25
|
+
import { createPipelineRecord } from "./lib/actions/create-pipeline-record";
|
|
26
|
+
import { updatePipelineRecord } from "./lib/actions/update-pipeline-record";
|
|
27
|
+
import { searchPipelineRecord } from "./lib/actions/search-pipeline-records";
|
|
28
|
+
import { searchCompanyRecord } from "./lib/actions/search-company-record";
|
|
29
|
+
import { searchContactRecord } from "./lib/actions/search-contact-record";
|
|
30
|
+
import { searchProductRecord } from "./lib/actions/search-product";
|
|
31
|
+
import { searchUser } from "./lib/actions/search-user";
|
|
32
|
+
import { biginAuth } from './lib/auth';
|
|
33
|
+
|
|
34
|
+
export const biginByZoho = createPiece({
|
|
35
|
+
displayName: 'Bigin by Zoho CRM',
|
|
36
|
+
description:
|
|
37
|
+
'Bigin by Zoho CRM is a lightweight CRM designed for small businesses to manage contacts, companies, deals (pipeline records), tasks, calls, and events.',
|
|
38
|
+
auth: biginAuth,
|
|
39
|
+
minimumSupportedRelease: '0.36.1',
|
|
40
|
+
categories: [PieceCategory.SALES_AND_CRM],
|
|
41
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/bigin-by-zoho.png',
|
|
42
|
+
authors: ['gs03dev'],
|
|
43
|
+
actions: [
|
|
44
|
+
createCompany,
|
|
45
|
+
updateCompany,
|
|
46
|
+
createContact,
|
|
47
|
+
updateContact,
|
|
48
|
+
createTask,
|
|
49
|
+
updateTask,
|
|
50
|
+
createCall,
|
|
51
|
+
createEvent,
|
|
52
|
+
updateEvent,
|
|
53
|
+
createPipelineRecord,
|
|
54
|
+
updatePipelineRecord,
|
|
55
|
+
searchPipelineRecord,
|
|
56
|
+
searchCompanyRecord,
|
|
57
|
+
searchContactRecord,
|
|
58
|
+
searchProductRecord,
|
|
59
|
+
searchUser
|
|
60
|
+
],
|
|
61
|
+
triggers: [
|
|
62
|
+
newContactCreated,
|
|
63
|
+
contactUpdated,
|
|
64
|
+
newCompanyCreated,
|
|
65
|
+
companyUpdated,
|
|
66
|
+
newCallCreated,
|
|
67
|
+
newTaskCreated,
|
|
68
|
+
newEventCreated,
|
|
69
|
+
newPipelineRecordCreated,
|
|
70
|
+
pipelineRecordUpdated,
|
|
71
|
+
],
|
|
72
|
+
});
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { createAction, Property } from '@agnocon/pieces-framework';
|
|
2
|
+
import { biginAuth } from '../auth';
|
|
3
|
+
import { contactsDropdown, tagsDropdown, usersDropdown } from '../common/props';
|
|
4
|
+
import { biginApiService } from '../common/request';
|
|
5
|
+
import { formatDateTime, getSafeLabel, handleDropdownError } from '../common/helpers';
|
|
6
|
+
|
|
7
|
+
export const createCall = createAction({
|
|
8
|
+
auth: biginAuth,
|
|
9
|
+
name: 'createCall',
|
|
10
|
+
displayName: 'Create Call',
|
|
11
|
+
description: 'Creates a Call Log Entry Record',
|
|
12
|
+
audience: 'both',
|
|
13
|
+
aiMetadata: { description: 'Logs a call in Bigin CRM with a required start time, duration in minutes, and type (Outbound, Inbound, or Missed), plus optional subject, description, agenda, reminder, dialed number, owner, contact, and a related Pipeline or Company record. Use to record a phone interaction. Not idempotent: each call creates a new call log entry.', idempotent: false },
|
|
14
|
+
props: {
|
|
15
|
+
callStartTime: Property.DateTime({
|
|
16
|
+
displayName: 'Call Start Time',
|
|
17
|
+
description: 'Provide the start time of the call in ISO8601 format.',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
callDuration: Property.Number({
|
|
21
|
+
displayName: 'Call Duration (minutes)',
|
|
22
|
+
description:
|
|
23
|
+
'Provide the duration of the call in minutes (numeric). For example, 30 for a 30-minute call.',
|
|
24
|
+
required: true,
|
|
25
|
+
}),
|
|
26
|
+
callType: Property.StaticDropdown({
|
|
27
|
+
displayName: 'Call Type',
|
|
28
|
+
description: 'Type of call',
|
|
29
|
+
required: true,
|
|
30
|
+
options: {
|
|
31
|
+
options: [
|
|
32
|
+
{ label: 'Outbound', value: 'Outbound' },
|
|
33
|
+
{ label: 'Inbound', value: 'Inbound' },
|
|
34
|
+
{ label: 'Missed', value: 'Missed' },
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
}),
|
|
38
|
+
owner: usersDropdown,
|
|
39
|
+
contactName: contactsDropdown,
|
|
40
|
+
subject: Property.ShortText({
|
|
41
|
+
displayName: 'Subject',
|
|
42
|
+
description: 'Subject of the call',
|
|
43
|
+
required: false,
|
|
44
|
+
}),
|
|
45
|
+
description: Property.LongText({
|
|
46
|
+
displayName: 'Description',
|
|
47
|
+
description: 'Description or notes about the call',
|
|
48
|
+
required: false,
|
|
49
|
+
}),
|
|
50
|
+
callAgenda: Property.LongText({
|
|
51
|
+
displayName: 'Call Agenda',
|
|
52
|
+
description: 'Agenda or purpose of the call',
|
|
53
|
+
required: false,
|
|
54
|
+
}),
|
|
55
|
+
reminder: Property.DateTime({
|
|
56
|
+
displayName: 'Reminder',
|
|
57
|
+
description: 'Reminder date and time for the call',
|
|
58
|
+
required: false,
|
|
59
|
+
}),
|
|
60
|
+
dialledNumber: Property.ShortText({
|
|
61
|
+
displayName: 'Dialed Number',
|
|
62
|
+
description: 'Provide the number dialed for the call.',
|
|
63
|
+
required: false,
|
|
64
|
+
}),
|
|
65
|
+
relatedModule: Property.StaticDropdown({
|
|
66
|
+
displayName: 'Related Module',
|
|
67
|
+
description: 'Select the type of entity the call is related to.',
|
|
68
|
+
required: false,
|
|
69
|
+
defaultValue: 'Pipelines',
|
|
70
|
+
options: {
|
|
71
|
+
options: [
|
|
72
|
+
{ label: 'Pipelines', value: 'Pipelines' },
|
|
73
|
+
{ label: 'Companies', value: 'Companies' },
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
}),
|
|
77
|
+
relatedTo: Property.Dropdown({
|
|
78
|
+
auth: biginAuth,
|
|
79
|
+
displayName: 'Related To',
|
|
80
|
+
description: 'Select the specific record the call is related to.',
|
|
81
|
+
required: false,
|
|
82
|
+
refreshers: ['auth', 'relatedModule'],
|
|
83
|
+
defaultValue: {},
|
|
84
|
+
options: async ({ auth, relatedModule }): Promise<any> => {
|
|
85
|
+
if (!auth) return handleDropdownError('Please connect first');
|
|
86
|
+
if (!relatedModule) return { options: [] };
|
|
87
|
+
|
|
88
|
+
const { access_token, data } = auth;
|
|
89
|
+
const api_domain = data['api_domain'];
|
|
90
|
+
|
|
91
|
+
const fetchMap: Record<string, () => Promise<any>> = {
|
|
92
|
+
Pipelines: () =>
|
|
93
|
+
biginApiService.fetchPipelinesRecords(access_token, api_domain),
|
|
94
|
+
Companies: () =>
|
|
95
|
+
biginApiService.fetchCompanies(access_token, api_domain),
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const fetchFn = fetchMap[relatedModule as keyof typeof fetchMap];
|
|
99
|
+
|
|
100
|
+
const response = await fetchFn();
|
|
101
|
+
|
|
102
|
+
const records = response?.data || [];
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
options: records.map((item: any) => ({
|
|
106
|
+
label: getSafeLabel(item),
|
|
107
|
+
value: item.id,
|
|
108
|
+
})),
|
|
109
|
+
};
|
|
110
|
+
},
|
|
111
|
+
}),
|
|
112
|
+
tag: tagsDropdown('Calls'),
|
|
113
|
+
},
|
|
114
|
+
async run({ auth, propsValue }) {
|
|
115
|
+
try {
|
|
116
|
+
const { access_token, data } = auth;
|
|
117
|
+
const api_domain = data['api_domain'];
|
|
118
|
+
const payload: any = {
|
|
119
|
+
Call_Start_Time: formatDateTime(propsValue.callStartTime),
|
|
120
|
+
Call_Duration: Number(propsValue.callDuration),
|
|
121
|
+
Call_Type: propsValue.callType,
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
if (propsValue.subject) payload.Subject = propsValue.subject;
|
|
125
|
+
if (propsValue.description) payload.Description = propsValue.description;
|
|
126
|
+
if (propsValue.callAgenda) payload.Call_Agenda = propsValue.callAgenda;
|
|
127
|
+
if (propsValue.reminder) payload.Reminder = formatDateTime(propsValue.reminder);
|
|
128
|
+
if (propsValue.dialledNumber)
|
|
129
|
+
payload.Dialled_Number = propsValue.dialledNumber;
|
|
130
|
+
if (propsValue.owner) payload.Owner = { id: propsValue.owner };
|
|
131
|
+
if (propsValue.contactName)
|
|
132
|
+
payload.Contact_Name = { id: propsValue.contactName };
|
|
133
|
+
|
|
134
|
+
if (propsValue.relatedTo && propsValue.relatedModule) {
|
|
135
|
+
const relatedModuleMap = {
|
|
136
|
+
Pipelines: 'Deals',
|
|
137
|
+
Companies: 'Accounts',
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
payload.$related_module =
|
|
141
|
+
relatedModuleMap[
|
|
142
|
+
propsValue.relatedModule as keyof typeof relatedModuleMap
|
|
143
|
+
] || 'Deals';
|
|
144
|
+
payload.Related_To = { id: propsValue.relatedTo };
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (propsValue.tag) payload.Tag = propsValue.tag.map((t: any) => ({ name: t }));
|
|
148
|
+
|
|
149
|
+
const response = await biginApiService.createCall(
|
|
150
|
+
access_token,
|
|
151
|
+
api_domain,
|
|
152
|
+
{ data: [payload] }
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
return {
|
|
156
|
+
message: 'Call log Entry created successfully',
|
|
157
|
+
data: response.data[0],
|
|
158
|
+
};
|
|
159
|
+
} catch (error: any) {
|
|
160
|
+
console.error('Error creating call log entry:', error);
|
|
161
|
+
throw new Error(
|
|
162
|
+
error instanceof Error
|
|
163
|
+
? `Failed to create call log entry: ${error.message}`
|
|
164
|
+
: 'Failed to create call log entry due to an unknown error'
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
});
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { biginAuth } from '../auth';
|
|
2
|
+
import { createAction, Property } from '@agnocon/pieces-framework';
|
|
3
|
+
import { tagsDropdown, usersDropdown } from '../common/props';
|
|
4
|
+
import { biginApiService } from '../common/request';
|
|
5
|
+
|
|
6
|
+
export const createCompany = createAction({
|
|
7
|
+
auth: biginAuth,
|
|
8
|
+
name: 'createCompany',
|
|
9
|
+
displayName: 'Create Company',
|
|
10
|
+
description: 'Creates a Company Record',
|
|
11
|
+
audience: 'both',
|
|
12
|
+
aiMetadata: { description: 'Creates a new company (account) record in Bigin CRM with a name plus optional phone, website, billing address, owner, tags, and description. Use to add an organization the business deals with. Not idempotent: each call creates a new company even if one with the same name already exists, so search first if you need to avoid duplicates.', idempotent: false },
|
|
13
|
+
props: {
|
|
14
|
+
accountName: Property.ShortText({
|
|
15
|
+
displayName: 'Account Name',
|
|
16
|
+
description: 'Provide the name of the company',
|
|
17
|
+
required: true,
|
|
18
|
+
}),
|
|
19
|
+
phone: Property.ShortText({
|
|
20
|
+
displayName: 'Phone',
|
|
21
|
+
description: 'Provide a phone number for the company',
|
|
22
|
+
required: false,
|
|
23
|
+
}),
|
|
24
|
+
website: Property.ShortText({
|
|
25
|
+
displayName: 'Website',
|
|
26
|
+
description: 'Provide a website URL for the company',
|
|
27
|
+
required: false,
|
|
28
|
+
}),
|
|
29
|
+
tag: tagsDropdown('Accounts'),
|
|
30
|
+
description: Property.LongText({
|
|
31
|
+
displayName: 'Description',
|
|
32
|
+
description:
|
|
33
|
+
'Provide additional descriptions or notes related to the company',
|
|
34
|
+
required: false,
|
|
35
|
+
}),
|
|
36
|
+
owner: usersDropdown,
|
|
37
|
+
billingStreet: Property.ShortText({
|
|
38
|
+
displayName: 'Billing Street',
|
|
39
|
+
description: 'The street address of the company',
|
|
40
|
+
required: false,
|
|
41
|
+
}),
|
|
42
|
+
billingCity: Property.ShortText({
|
|
43
|
+
displayName: 'Billing City',
|
|
44
|
+
description: 'The city where the company is located',
|
|
45
|
+
required: false,
|
|
46
|
+
}),
|
|
47
|
+
billingState: Property.ShortText({
|
|
48
|
+
displayName: 'Billing State',
|
|
49
|
+
description: 'The state or province where the company is located',
|
|
50
|
+
required: false,
|
|
51
|
+
}),
|
|
52
|
+
billingCountry: Property.ShortText({
|
|
53
|
+
displayName: 'Billing Country',
|
|
54
|
+
description: 'The country of the company',
|
|
55
|
+
required: false,
|
|
56
|
+
}),
|
|
57
|
+
billingCode: Property.ShortText({
|
|
58
|
+
displayName: 'Billing Code',
|
|
59
|
+
description: 'The ZIP or postal code of the company',
|
|
60
|
+
required: false,
|
|
61
|
+
}),
|
|
62
|
+
},
|
|
63
|
+
async run(context) {
|
|
64
|
+
try {
|
|
65
|
+
const {
|
|
66
|
+
accountName,
|
|
67
|
+
owner,
|
|
68
|
+
phone,
|
|
69
|
+
website,
|
|
70
|
+
tag,
|
|
71
|
+
description,
|
|
72
|
+
billingStreet,
|
|
73
|
+
billingCity,
|
|
74
|
+
billingState,
|
|
75
|
+
billingCountry,
|
|
76
|
+
billingCode,
|
|
77
|
+
} = context.propsValue;
|
|
78
|
+
|
|
79
|
+
const record: Record<string, any> = {
|
|
80
|
+
Account_Name: accountName,
|
|
81
|
+
Phone: phone,
|
|
82
|
+
Website: website,
|
|
83
|
+
Description: description,
|
|
84
|
+
Billing_Street: billingStreet,
|
|
85
|
+
Billing_City: billingCity,
|
|
86
|
+
Billing_State: billingState,
|
|
87
|
+
Billing_Country: billingCountry,
|
|
88
|
+
Billing_Code: billingCode,
|
|
89
|
+
Owner: owner ? { id: owner } : undefined,
|
|
90
|
+
Tag: Array.isArray(tag) && tag.length > 0 ? tag.map((t) => ({ name: t })) : undefined,
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
Object.keys(record).forEach((k) => {
|
|
94
|
+
const v = (record as any)[k];
|
|
95
|
+
if (
|
|
96
|
+
v === undefined ||
|
|
97
|
+
v === null ||
|
|
98
|
+
(typeof v === 'string' && v.trim() === '') ||
|
|
99
|
+
(Array.isArray(v) && v.length === 0)
|
|
100
|
+
) {
|
|
101
|
+
delete (record as any)[k];
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const response = await biginApiService.createCompany(
|
|
106
|
+
context.auth.access_token,
|
|
107
|
+
(context.auth as any).api_domain,
|
|
108
|
+
{ data: [record] }
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
message: 'Company created successfully',
|
|
113
|
+
data: response.data[0],
|
|
114
|
+
};
|
|
115
|
+
} catch (error: any) {
|
|
116
|
+
console.error('Error creating company:', error);
|
|
117
|
+
throw new Error(
|
|
118
|
+
error instanceof Error
|
|
119
|
+
? `Failed to create company: ${error.message}`
|
|
120
|
+
: 'Failed to create company due to an unknown error'
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
});
|