@segment/action-destinations 3.28.1-alpha.1 → 3.30.1
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/destinations/index.js +0 -1
- package/dist/destinations/index.js.map +1 -1
- package/dist/destinations/mixpanel/groupIdentifyUser/generated-types.d.ts +1 -1
- package/dist/destinations/mixpanel/groupIdentifyUser/index.d.ts +1 -1
- package/dist/destinations/mixpanel/groupIdentifyUser/index.js +10 -8
- package/dist/destinations/mixpanel/groupIdentifyUser/index.js.map +1 -1
- package/dist/destinations/pipedrive/createUpdateActivity/generated-types.d.ts +17 -0
- package/dist/destinations/{facebook-conversions-api/addToCart → pipedrive/createUpdateActivity}/generated-types.js +0 -0
- package/dist/destinations/pipedrive/createUpdateActivity/generated-types.js.map +1 -0
- package/dist/destinations/{facebook-conversions-api/custom → pipedrive/createUpdateActivity}/index.d.ts +1 -1
- package/dist/destinations/pipedrive/createUpdateActivity/index.js +157 -0
- package/dist/destinations/pipedrive/createUpdateActivity/index.js.map +1 -0
- package/dist/destinations/pipedrive/createUpdateDeal/generated-types.d.ts +18 -0
- package/dist/destinations/{facebook-conversions-api/custom → pipedrive/createUpdateDeal}/generated-types.js +0 -0
- package/dist/destinations/pipedrive/createUpdateDeal/generated-types.js.map +1 -0
- package/dist/destinations/{facebook-conversions-api/pageView → pipedrive/createUpdateDeal}/index.d.ts +1 -1
- package/dist/destinations/pipedrive/createUpdateDeal/index.js +174 -0
- package/dist/destinations/pipedrive/createUpdateDeal/index.js.map +1 -0
- package/dist/destinations/pipedrive/createUpdateLead/generated-types.d.ts +15 -0
- package/dist/destinations/{facebook-conversions-api → pipedrive/createUpdateLead}/generated-types.js +0 -0
- package/dist/destinations/pipedrive/createUpdateLead/generated-types.js.map +1 -0
- package/dist/destinations/{facebook-conversions-api/initiateCheckout → pipedrive/createUpdateLead}/index.d.ts +1 -1
- package/dist/destinations/pipedrive/createUpdateLead/index.js +129 -0
- package/dist/destinations/pipedrive/createUpdateLead/index.js.map +1 -0
- package/dist/destinations/pipedrive/createUpdateNote/generated-types.d.ts +11 -0
- package/dist/destinations/{facebook-conversions-api/initiateCheckout → pipedrive/createUpdateNote}/generated-types.js +0 -0
- package/dist/destinations/pipedrive/createUpdateNote/generated-types.js.map +1 -0
- package/dist/destinations/{facebook-conversions-api/addToCart → pipedrive/createUpdateNote}/index.d.ts +1 -1
- package/dist/destinations/pipedrive/createUpdateNote/index.js +115 -0
- package/dist/destinations/pipedrive/createUpdateNote/index.js.map +1 -0
- package/dist/destinations/pipedrive/createUpdateOrganization/generated-types.d.ts +5 -4
- package/dist/destinations/pipedrive/createUpdateOrganization/index.js +38 -30
- package/dist/destinations/pipedrive/createUpdateOrganization/index.js.map +1 -1
- package/dist/destinations/pipedrive/createUpdatePerson/generated-types.d.ts +6 -5
- package/dist/destinations/pipedrive/createUpdatePerson/index.js +39 -55
- package/dist/destinations/pipedrive/createUpdatePerson/index.js.map +1 -1
- package/dist/destinations/pipedrive/generated-types.d.ts +3 -0
- package/dist/destinations/pipedrive/index.js +31 -2
- package/dist/destinations/pipedrive/index.js.map +1 -1
- package/dist/destinations/pipedrive/pipedriveApi/activities.d.ts +17 -0
- package/dist/destinations/pipedrive/pipedriveApi/activities.js +11 -0
- package/dist/destinations/pipedrive/pipedriveApi/activities.js.map +1 -0
- package/dist/destinations/pipedrive/pipedriveApi/deals.d.ts +18 -0
- package/dist/destinations/pipedrive/pipedriveApi/deals.js +8 -0
- package/dist/destinations/pipedrive/pipedriveApi/deals.js.map +1 -0
- package/dist/destinations/pipedrive/pipedriveApi/domain.d.ts +19 -0
- package/dist/destinations/pipedrive/pipedriveApi/domain.js +3 -0
- package/dist/destinations/pipedrive/pipedriveApi/domain.js.map +1 -0
- package/dist/destinations/pipedrive/pipedriveApi/leads.d.ts +12 -0
- package/dist/destinations/pipedrive/pipedriveApi/leads.js +8 -0
- package/dist/destinations/pipedrive/pipedriveApi/leads.js.map +1 -0
- package/dist/destinations/pipedrive/pipedriveApi/notes.d.ts +11 -0
- package/dist/destinations/pipedrive/pipedriveApi/notes.js +8 -0
- package/dist/destinations/pipedrive/pipedriveApi/notes.js.map +1 -0
- package/dist/destinations/pipedrive/pipedriveApi/organizations.d.ts +8 -0
- package/dist/destinations/pipedrive/pipedriveApi/organizations.js +19 -0
- package/dist/destinations/pipedrive/pipedriveApi/organizations.js.map +1 -0
- package/dist/destinations/pipedrive/pipedriveApi/persons.d.ts +10 -0
- package/dist/destinations/pipedrive/pipedriveApi/persons.js +19 -0
- package/dist/destinations/pipedrive/pipedriveApi/persons.js.map +1 -0
- package/dist/destinations/pipedrive/pipedriveApi/pipedrive-client.d.ts +29 -0
- package/dist/destinations/pipedrive/pipedriveApi/pipedrive-client.js +118 -0
- package/dist/destinations/pipedrive/pipedriveApi/pipedrive-client.js.map +1 -0
- package/dist/lib/test-data.js +9 -2
- package/dist/lib/test-data.js.map +1 -1
- package/package.json +3 -4
- package/dist/destinations/facebook-conversions-api/addToCart/generated-types.d.ts +0 -37
- package/dist/destinations/facebook-conversions-api/addToCart/generated-types.js.map +0 -1
- package/dist/destinations/facebook-conversions-api/addToCart/index.js +0 -84
- package/dist/destinations/facebook-conversions-api/addToCart/index.js.map +0 -1
- package/dist/destinations/facebook-conversions-api/constants.d.ts +0 -4
- package/dist/destinations/facebook-conversions-api/constants.js +0 -485
- package/dist/destinations/facebook-conversions-api/constants.js.map +0 -1
- package/dist/destinations/facebook-conversions-api/custom/generated-types.d.ts +0 -30
- package/dist/destinations/facebook-conversions-api/custom/generated-types.js.map +0 -1
- package/dist/destinations/facebook-conversions-api/custom/index.js +0 -58
- package/dist/destinations/facebook-conversions-api/custom/index.js.map +0 -1
- package/dist/destinations/facebook-conversions-api/fb-capi-properties.d.ts +0 -13
- package/dist/destinations/facebook-conversions-api/fb-capi-properties.js +0 -100
- package/dist/destinations/facebook-conversions-api/fb-capi-properties.js.map +0 -1
- package/dist/destinations/facebook-conversions-api/fb-capi-user-data.d.ts +0 -7
- package/dist/destinations/facebook-conversions-api/fb-capi-user-data.js +0 -227
- package/dist/destinations/facebook-conversions-api/fb-capi-user-data.js.map +0 -1
- package/dist/destinations/facebook-conversions-api/generated-types.d.ts +0 -3
- package/dist/destinations/facebook-conversions-api/generated-types.js.map +0 -1
- package/dist/destinations/facebook-conversions-api/index.d.ts +0 -4
- package/dist/destinations/facebook-conversions-api/index.js +0 -51
- package/dist/destinations/facebook-conversions-api/index.js.map +0 -1
- package/dist/destinations/facebook-conversions-api/initiateCheckout/generated-types.d.ts +0 -37
- package/dist/destinations/facebook-conversions-api/initiateCheckout/generated-types.js.map +0 -1
- package/dist/destinations/facebook-conversions-api/initiateCheckout/index.js +0 -89
- package/dist/destinations/facebook-conversions-api/initiateCheckout/index.js.map +0 -1
- package/dist/destinations/facebook-conversions-api/pageView/generated-types.d.ts +0 -26
- package/dist/destinations/facebook-conversions-api/pageView/generated-types.js +0 -3
- package/dist/destinations/facebook-conversions-api/pageView/generated-types.js.map +0 -1
- package/dist/destinations/facebook-conversions-api/pageView/index.js +0 -43
- package/dist/destinations/facebook-conversions-api/pageView/index.js.map +0 -1
- package/dist/destinations/facebook-conversions-api/purchase/generated-types.d.ts +0 -38
- package/dist/destinations/facebook-conversions-api/purchase/generated-types.js +0 -3
- package/dist/destinations/facebook-conversions-api/purchase/generated-types.js.map +0 -1
- package/dist/destinations/facebook-conversions-api/purchase/index.d.ts +0 -5
- package/dist/destinations/facebook-conversions-api/purchase/index.js +0 -92
- package/dist/destinations/facebook-conversions-api/purchase/index.js.map +0 -1
- package/dist/destinations/facebook-conversions-api/search/generated-types.d.ts +0 -37
- package/dist/destinations/facebook-conversions-api/search/generated-types.js +0 -3
- package/dist/destinations/facebook-conversions-api/search/generated-types.js.map +0 -1
- package/dist/destinations/facebook-conversions-api/search/index.d.ts +0 -5
- package/dist/destinations/facebook-conversions-api/search/index.js +0 -91
- package/dist/destinations/facebook-conversions-api/search/index.js.map +0 -1
- package/dist/destinations/facebook-conversions-api/viewContent/generated-types.d.ts +0 -38
- package/dist/destinations/facebook-conversions-api/viewContent/generated-types.js +0 -3
- package/dist/destinations/facebook-conversions-api/viewContent/generated-types.js.map +0 -1
- package/dist/destinations/facebook-conversions-api/viewContent/index.d.ts +0 -5
- package/dist/destinations/facebook-conversions-api/viewContent/index.js +0 -85
- package/dist/destinations/facebook-conversions-api/viewContent/index.js.map +0 -1
|
@@ -28,7 +28,6 @@ const path_1 = __importDefault(require("path"));
|
|
|
28
28
|
exports.destinations = {};
|
|
29
29
|
exports.manifest = {};
|
|
30
30
|
register('60f64ae3eaebd66d17d28e9f', './1plusx');
|
|
31
|
-
register('61806e472cd47ea1104885fc', './facebook-conversions-api');
|
|
32
31
|
register('5f7dd6d21ad74f3842b1fc47', './amplitude');
|
|
33
32
|
register('60f9d0d048950c356be2e4da', './braze');
|
|
34
33
|
register('5f7dd78fe27ce7ff2b8bfa37', './customerio');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/destinations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,wDAAmD;AACnD,gDAAuB;AAWV,QAAA,YAAY,GAA0C,EAAE,CAAA;AACxD,QAAA,QAAQ,GAAsC,EAAE,CAAA;AAU7D,QAAQ,CAAC,0BAA0B,EAAE,UAAU,CAAC,CAAA;AAChD,QAAQ,CAAC,0BAA0B,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/destinations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,wDAAmD;AACnD,gDAAuB;AAWV,QAAA,YAAY,GAA0C,EAAE,CAAA;AACxD,QAAA,QAAQ,GAAsC,EAAE,CAAA;AAU7D,QAAQ,CAAC,0BAA0B,EAAE,UAAU,CAAC,CAAA;AAChD,QAAQ,CAAC,0BAA0B,EAAE,aAAa,CAAC,CAAA;AACnD,QAAQ,CAAC,0BAA0B,EAAE,SAAS,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,CAAC,CAAA;IAGxE,IAAI,CAAC,WAAW,EAAE,IAAI,IAAI,OAAO,WAAW,EAAE,OAAO,KAAK,QAAQ,EAAE;QAClE,OAAO,IAAI,CAAA;KACZ;IAED,OAAO,WAAW,CAAA;AACpB,CAAC;AAED,KAAK,UAAU,uBAAuB,CAAC,GAAW;IAChD,MAAM,WAAW,GAAG,oBAAY,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAA;IAExE,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,IAAI,CAAA;KACZ;IAGD,OAAO,IAAI,0BAAW,CAAC,WAAyC,CAAC,CAAA;AACnE,CAAC;AAED,SAAgB,kBAAkB,CAAC,EAAU;IAC3C,MAAM,WAAW,GAAG,gBAAQ,CAAC,EAAE,CAAC,CAAA;IAEhC,IAAI,CAAC,WAAW,EAAE,UAAU,EAAE;QAC5B,OAAO,IAAI,CAAA;KACZ;IAED,OAAO,IAAI,0BAAW,CAAC,WAAW,CAAC,UAAU,CAAC,CAAA;AAChD,CAAC;AARD,gDAQC;AAEM,KAAK,UAAU,uBAAuB,CAAC,WAAmB;IAC/D,OAAO,kBAAkB,CAAC,WAAW,CAAC,IAAI,uBAAuB,CAAC,WAAW,CAAC,CAAA;AAChF,CAAC;AAFD,0DAEC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ActionDefinition } from '@segment/actions-core';
|
|
2
2
|
import type { Settings } from '../generated-types';
|
|
3
3
|
import type { Payload } from './generated-types';
|
|
4
4
|
declare const action: ActionDefinition<Settings, Payload>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
3
4
|
const action = {
|
|
4
5
|
title: 'Group Identify User',
|
|
5
6
|
description: 'Updates or adds properties to a group profile. The profile is created if it does not exist.',
|
|
@@ -8,29 +9,30 @@ const action = {
|
|
|
8
9
|
group_key: {
|
|
9
10
|
label: 'Group Key',
|
|
10
11
|
type: 'string',
|
|
11
|
-
description: 'The group key',
|
|
12
|
-
|
|
12
|
+
description: 'The group key. If this is not set, it is defaulted to "name".',
|
|
13
|
+
default: 'name'
|
|
13
14
|
},
|
|
14
15
|
traits: {
|
|
15
16
|
label: 'Group Properties',
|
|
16
17
|
type: 'object',
|
|
17
|
-
description: 'Properties to set on the group profile',
|
|
18
|
+
description: 'Properties to set on the group profile. Make sure to have a field that corresponds to the above group key.',
|
|
18
19
|
default: {
|
|
19
20
|
'@path': '$.traits'
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
},
|
|
23
24
|
perform: (request, { payload, settings }) => {
|
|
25
|
+
const group_key = payload.group_key || 'name';
|
|
24
26
|
if (!payload.traits) {
|
|
25
|
-
throw new
|
|
27
|
+
throw new actions_core_1.IntegrationError('"traits" is a required field', 'Missing required fields');
|
|
26
28
|
}
|
|
27
|
-
if (!payload.traits[
|
|
28
|
-
throw new
|
|
29
|
+
if (!payload.traits[group_key]) {
|
|
30
|
+
throw new actions_core_1.IntegrationError('Group traits does not include proper group key', 'Misconfigured required field');
|
|
29
31
|
}
|
|
30
32
|
const data = {
|
|
31
33
|
$token: settings.projectToken,
|
|
32
|
-
$group_key:
|
|
33
|
-
$group_id: payload.traits[
|
|
34
|
+
$group_key: group_key,
|
|
35
|
+
$group_id: payload.traits[group_key],
|
|
34
36
|
$set: payload.traits
|
|
35
37
|
};
|
|
36
38
|
return request('https://api.mixpanel.com/groups#group-set', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/mixpanel/groupIdentifyUser/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/mixpanel/groupIdentifyUser/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAI1E,MAAM,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
+
export interface Payload {
|
|
2
|
+
activity_id?: number;
|
|
3
|
+
person_match_field?: string;
|
|
4
|
+
person_match_value?: string;
|
|
5
|
+
organization_match_field?: string;
|
|
6
|
+
organization_match_value?: string;
|
|
7
|
+
deal_match_field?: string;
|
|
8
|
+
deal_match_value?: string;
|
|
9
|
+
subject?: string;
|
|
10
|
+
type?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
note?: string;
|
|
13
|
+
due_date?: string;
|
|
14
|
+
due_time?: string;
|
|
15
|
+
duration?: string;
|
|
16
|
+
done?: boolean;
|
|
17
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/pipedrive/createUpdateActivity/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionDefinition } from '@segment/actions-core';
|
|
1
|
+
import type { ActionDefinition } from '@segment/actions-core';
|
|
2
2
|
import type { Settings } from '../generated-types';
|
|
3
3
|
import type { Payload } from './generated-types';
|
|
4
4
|
declare const action: ActionDefinition<Settings, Payload>;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const activities_1 = require("../pipedriveApi/activities");
|
|
7
|
+
const pipedrive_client_1 = __importDefault(require("../pipedriveApi/pipedrive-client"));
|
|
8
|
+
const fieldHandler = pipedrive_client_1.default.fieldHandler;
|
|
9
|
+
const action = {
|
|
10
|
+
title: 'Create or update an Activity',
|
|
11
|
+
description: "Update an Activity in Pipedrive or create one if it doesn't exist.",
|
|
12
|
+
defaultSubscription: 'type = "track"',
|
|
13
|
+
fields: {
|
|
14
|
+
activity_id: {
|
|
15
|
+
label: 'Activity ID',
|
|
16
|
+
description: 'ID of Activity in Pipedrive to Update. If left empty, a new one will be created',
|
|
17
|
+
type: 'integer',
|
|
18
|
+
required: false
|
|
19
|
+
},
|
|
20
|
+
person_match_field: {
|
|
21
|
+
label: 'Person match field',
|
|
22
|
+
description: 'If present, used instead of field in settings to find existing person in Pipedrive.',
|
|
23
|
+
type: 'string',
|
|
24
|
+
required: false,
|
|
25
|
+
dynamic: true,
|
|
26
|
+
default: 'id'
|
|
27
|
+
},
|
|
28
|
+
person_match_value: {
|
|
29
|
+
label: 'Person match value',
|
|
30
|
+
description: 'Value to find existing person by',
|
|
31
|
+
type: 'string',
|
|
32
|
+
required: false,
|
|
33
|
+
default: {
|
|
34
|
+
'@path': '$.userId'
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
organization_match_field: {
|
|
38
|
+
label: 'Organization match field',
|
|
39
|
+
description: 'If present, used instead of field in settings to find existing organization in Pipedrive.',
|
|
40
|
+
type: 'string',
|
|
41
|
+
required: false,
|
|
42
|
+
dynamic: true,
|
|
43
|
+
default: 'id'
|
|
44
|
+
},
|
|
45
|
+
organization_match_value: {
|
|
46
|
+
label: 'Organization match value',
|
|
47
|
+
description: 'Value to find existing organization by',
|
|
48
|
+
type: 'string',
|
|
49
|
+
required: false,
|
|
50
|
+
default: {
|
|
51
|
+
'@path': '$.userId'
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
deal_match_field: {
|
|
55
|
+
label: 'Deal match field',
|
|
56
|
+
description: 'If present, used instead of field in settings to find existing deal in Pipedrive.',
|
|
57
|
+
type: 'string',
|
|
58
|
+
required: false,
|
|
59
|
+
dynamic: true,
|
|
60
|
+
default: 'id'
|
|
61
|
+
},
|
|
62
|
+
deal_match_value: {
|
|
63
|
+
label: 'Deal match value',
|
|
64
|
+
description: 'Value to find existing deal by',
|
|
65
|
+
type: 'string',
|
|
66
|
+
required: false,
|
|
67
|
+
default: {
|
|
68
|
+
'@path': '$.userId'
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
subject: {
|
|
72
|
+
label: 'Activity Subject',
|
|
73
|
+
description: 'Subject of the Activity. When value for subject is not set, it will be given a default value `Call`.',
|
|
74
|
+
type: 'string',
|
|
75
|
+
required: false
|
|
76
|
+
},
|
|
77
|
+
type: {
|
|
78
|
+
label: 'Type',
|
|
79
|
+
description: 'Type of the Activity. This is in correlation with the key_string parameter of ActivityTypes. When value for type is not set, it will be given a default value `Call`',
|
|
80
|
+
type: 'string',
|
|
81
|
+
required: false
|
|
82
|
+
},
|
|
83
|
+
description: {
|
|
84
|
+
label: 'Description',
|
|
85
|
+
description: 'Additional details about the Activity that is synced to your external calendar. Unlike the note added to the Activity, the description is publicly visible to any guests added to the Activity.',
|
|
86
|
+
type: 'string',
|
|
87
|
+
required: false
|
|
88
|
+
},
|
|
89
|
+
note: {
|
|
90
|
+
label: 'Note',
|
|
91
|
+
description: 'Note of the Activity (HTML format)',
|
|
92
|
+
type: 'string',
|
|
93
|
+
required: false
|
|
94
|
+
},
|
|
95
|
+
due_date: {
|
|
96
|
+
label: 'Due Date',
|
|
97
|
+
description: 'Due date of the Activity. Format: YYYY-MM-DD',
|
|
98
|
+
type: 'string',
|
|
99
|
+
required: false
|
|
100
|
+
},
|
|
101
|
+
due_time: {
|
|
102
|
+
label: 'Due Time',
|
|
103
|
+
description: 'Due time of the Activity in UTC. Format: HH:MM',
|
|
104
|
+
type: 'string',
|
|
105
|
+
required: false
|
|
106
|
+
},
|
|
107
|
+
duration: {
|
|
108
|
+
label: 'Duration',
|
|
109
|
+
description: 'Duration of the Activity. Format: HH:MM',
|
|
110
|
+
type: 'string',
|
|
111
|
+
required: false
|
|
112
|
+
},
|
|
113
|
+
done: {
|
|
114
|
+
label: 'Done',
|
|
115
|
+
description: 'Whether the Activity is done or not.',
|
|
116
|
+
type: 'boolean',
|
|
117
|
+
required: false
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
dynamicFields: {
|
|
121
|
+
person_match_field: fieldHandler('person'),
|
|
122
|
+
organization_match_field: fieldHandler('organization'),
|
|
123
|
+
deal_match_field: fieldHandler('deal'),
|
|
124
|
+
type: async (request, { settings }) => {
|
|
125
|
+
const client = new pipedrive_client_1.default(settings, request);
|
|
126
|
+
return client.getActivityTypes();
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
perform: async (request, { payload, settings }) => {
|
|
130
|
+
const client = new pipedrive_client_1.default(settings, request);
|
|
131
|
+
const personSearchField = payload.person_match_field || settings.personField || 'id';
|
|
132
|
+
const organizationSearchField = payload.organization_match_field || settings.organizationField || 'id';
|
|
133
|
+
const dealSearchField = payload.deal_match_field || settings.dealField || 'id';
|
|
134
|
+
const [personId, organizationId, dealId] = await Promise.all([
|
|
135
|
+
client.getId('person', personSearchField, payload.person_match_value),
|
|
136
|
+
client.getId('organization', organizationSearchField, payload.organization_match_value),
|
|
137
|
+
client.getId('deal', dealSearchField, payload.deal_match_value)
|
|
138
|
+
]);
|
|
139
|
+
const activity = {
|
|
140
|
+
id: payload.activity_id,
|
|
141
|
+
subject: payload.subject,
|
|
142
|
+
type: payload.type,
|
|
143
|
+
public_description: payload.description,
|
|
144
|
+
note: payload.note,
|
|
145
|
+
due_date: payload.due_date,
|
|
146
|
+
due_time: payload.due_time,
|
|
147
|
+
duration: payload.duration,
|
|
148
|
+
done: payload.done,
|
|
149
|
+
person_id: personId || undefined,
|
|
150
|
+
org_id: organizationId || undefined,
|
|
151
|
+
deal_id: dealId || undefined
|
|
152
|
+
};
|
|
153
|
+
return activities_1.createUpdateActivity(client, activity);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
exports.default = action;
|
|
157
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/pipedrive/createUpdateActivity/index.ts"],"names":[],"mappings":";;;;;AAGA,2DAA2E;AAC3E,wFAA8D;AAE9D,MAAM,YAAY,GAAG,0BAAe,C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,EAAE,OAAO,CAAC,QAAQ;YAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,SAAS,EAAE,QAAQ,IAAI,SAAS;YAChC,MAAM,EAAE,cAAc,IAAI,SAAS;YACnC,OAAO,EAAE,MAAM,IAAI,SAAS;SAC7B,CAAA;QAED,OAAO,iCAAoB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;IAC/C,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
deal_match_field?: string;
|
|
3
|
+
deal_match_value?: string;
|
|
4
|
+
person_match_field?: string;
|
|
5
|
+
person_match_value?: string;
|
|
6
|
+
organization_match_field?: string;
|
|
7
|
+
organization_match_value?: string;
|
|
8
|
+
title: string;
|
|
9
|
+
value?: string;
|
|
10
|
+
currency?: string;
|
|
11
|
+
stage_id?: number;
|
|
12
|
+
status?: string;
|
|
13
|
+
expected_close_date?: string;
|
|
14
|
+
probability?: number;
|
|
15
|
+
lost_reason?: string;
|
|
16
|
+
visible_to?: number;
|
|
17
|
+
add_time?: string | number;
|
|
18
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/pipedrive/createUpdateDeal/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionDefinition } from '@segment/actions-core';
|
|
1
|
+
import type { ActionDefinition } from '@segment/actions-core';
|
|
2
2
|
import type { Settings } from '../generated-types';
|
|
3
3
|
import type { Payload } from './generated-types';
|
|
4
4
|
declare const action: ActionDefinition<Settings, Payload>;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const pipedrive_client_1 = __importDefault(require("../pipedriveApi/pipedrive-client"));
|
|
7
|
+
const deals_1 = require("../pipedriveApi/deals");
|
|
8
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
9
|
+
const fieldHandler = pipedrive_client_1.default.fieldHandler;
|
|
10
|
+
const action = {
|
|
11
|
+
title: 'Create or Update a Deal',
|
|
12
|
+
description: "Update a Deal in Pipedrive or create it if it doesn't exist yet.",
|
|
13
|
+
defaultSubscription: 'type = "track"',
|
|
14
|
+
fields: {
|
|
15
|
+
deal_match_field: {
|
|
16
|
+
label: 'Deal match field',
|
|
17
|
+
description: 'If present, used instead of field in settings to find existing deal in Pipedrive.',
|
|
18
|
+
type: 'string',
|
|
19
|
+
required: false,
|
|
20
|
+
dynamic: true,
|
|
21
|
+
default: 'id'
|
|
22
|
+
},
|
|
23
|
+
deal_match_value: {
|
|
24
|
+
label: 'Deal match value',
|
|
25
|
+
description: 'Value to find existing deal by',
|
|
26
|
+
type: 'string',
|
|
27
|
+
required: false,
|
|
28
|
+
default: {
|
|
29
|
+
'@path': '$.userId'
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
person_match_field: {
|
|
33
|
+
label: 'Person match field',
|
|
34
|
+
description: 'If present, used instead of field in settings to find existing person in Pipedrive.',
|
|
35
|
+
type: 'string',
|
|
36
|
+
required: false,
|
|
37
|
+
dynamic: true,
|
|
38
|
+
default: 'id'
|
|
39
|
+
},
|
|
40
|
+
person_match_value: {
|
|
41
|
+
label: 'Person match value',
|
|
42
|
+
description: 'Value to find existing person by. Required unless organization_match_value present',
|
|
43
|
+
type: 'string',
|
|
44
|
+
required: false,
|
|
45
|
+
default: {
|
|
46
|
+
'@path': '$.userId'
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
organization_match_field: {
|
|
50
|
+
label: 'Organization match field',
|
|
51
|
+
description: 'If present, used instead of field in settings to find existing organization in Pipedrive.',
|
|
52
|
+
type: 'string',
|
|
53
|
+
required: false,
|
|
54
|
+
dynamic: true,
|
|
55
|
+
default: 'id'
|
|
56
|
+
},
|
|
57
|
+
organization_match_value: {
|
|
58
|
+
label: 'Organization match value',
|
|
59
|
+
description: 'Value to find existing organization by. Required unless person_match_value present',
|
|
60
|
+
type: 'string',
|
|
61
|
+
required: false,
|
|
62
|
+
default: {
|
|
63
|
+
'@path': '$.userId'
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
title: {
|
|
67
|
+
label: 'Title',
|
|
68
|
+
description: 'Deal title (required for new Leads)',
|
|
69
|
+
type: 'string',
|
|
70
|
+
required: true
|
|
71
|
+
},
|
|
72
|
+
value: {
|
|
73
|
+
label: 'Value',
|
|
74
|
+
description: 'Value of the deal. If omitted, value will be set to 0.',
|
|
75
|
+
type: 'string',
|
|
76
|
+
required: false
|
|
77
|
+
},
|
|
78
|
+
currency: {
|
|
79
|
+
label: 'Currency',
|
|
80
|
+
description: 'Currency of the deal. Accepts a 3-character currency code. If omitted, currency will be set to the default currency of the authorized user.',
|
|
81
|
+
type: 'string',
|
|
82
|
+
required: false
|
|
83
|
+
},
|
|
84
|
+
stage_id: {
|
|
85
|
+
label: 'Stage ID',
|
|
86
|
+
description: "The ID of a stage this Deal will be placed in a pipeline (note that you can't supply the ID of the pipeline as this will be assigned automatically based on stage_id). If omitted, the deal will be placed in the first stage of the default pipeline.",
|
|
87
|
+
type: 'number',
|
|
88
|
+
required: false
|
|
89
|
+
},
|
|
90
|
+
status: {
|
|
91
|
+
label: 'Status',
|
|
92
|
+
description: 'Deal status - open, won, lost or deleted. If omitted, status will be set to open.',
|
|
93
|
+
type: 'string',
|
|
94
|
+
choices: [
|
|
95
|
+
{ label: 'Open', value: 'open' },
|
|
96
|
+
{ label: 'Won', value: 'won' },
|
|
97
|
+
{ label: 'Lost', value: 'lost' },
|
|
98
|
+
{ label: 'Deleted', value: 'deleted' }
|
|
99
|
+
],
|
|
100
|
+
required: false
|
|
101
|
+
},
|
|
102
|
+
expected_close_date: {
|
|
103
|
+
label: 'Expected Close Date',
|
|
104
|
+
description: 'The expected close date of the Deal. In ISO 8601 format: YYYY-MM-DD.',
|
|
105
|
+
type: 'string',
|
|
106
|
+
required: false
|
|
107
|
+
},
|
|
108
|
+
probability: {
|
|
109
|
+
label: 'Success Probability',
|
|
110
|
+
description: 'Deal success probability percentage. Used/shown only when deal_probability for the pipeline of the deal is enabled.',
|
|
111
|
+
type: 'number',
|
|
112
|
+
required: false
|
|
113
|
+
},
|
|
114
|
+
lost_reason: {
|
|
115
|
+
label: 'Lost Reason',
|
|
116
|
+
description: 'Optional message about why the deal was lost (to be used when status=lost)',
|
|
117
|
+
type: 'string',
|
|
118
|
+
required: false
|
|
119
|
+
},
|
|
120
|
+
visible_to: {
|
|
121
|
+
label: 'Visible To',
|
|
122
|
+
description: 'Visibility of the deal. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user. 1 -Owner & followers (private), 3 - Entire company (shared)',
|
|
123
|
+
type: 'integer',
|
|
124
|
+
choices: [
|
|
125
|
+
{ label: 'Owner & followers (private)', value: 1 },
|
|
126
|
+
{ label: 'Entire company (shared)', value: 3 }
|
|
127
|
+
],
|
|
128
|
+
required: false
|
|
129
|
+
},
|
|
130
|
+
add_time: {
|
|
131
|
+
label: 'Created At',
|
|
132
|
+
description: 'If the deal is created, use this timestamp as the creation timestamp. Format: YYY-MM-DD HH:MM:SS',
|
|
133
|
+
type: 'datetime',
|
|
134
|
+
required: false
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
dynamicFields: {
|
|
138
|
+
person_match_field: fieldHandler('person'),
|
|
139
|
+
organization_match_field: fieldHandler('organization'),
|
|
140
|
+
deal_match_field: fieldHandler('deal')
|
|
141
|
+
},
|
|
142
|
+
perform: async (request, { payload, settings }) => {
|
|
143
|
+
const client = new pipedrive_client_1.default(settings, request);
|
|
144
|
+
const personSearchField = payload.person_match_field || settings.personField || 'id';
|
|
145
|
+
const organizationSearchField = payload.organization_match_field || settings.organizationField || 'id';
|
|
146
|
+
const dealSearchField = payload.deal_match_field || settings.dealField || 'id';
|
|
147
|
+
const [personId, organizationId, dealId] = await Promise.all([
|
|
148
|
+
client.getId('person', personSearchField, payload.person_match_value),
|
|
149
|
+
client.getId('organization', organizationSearchField, payload.organization_match_value),
|
|
150
|
+
client.getId('deal', dealSearchField, payload.deal_match_value)
|
|
151
|
+
]);
|
|
152
|
+
const deal = {
|
|
153
|
+
id: dealId || undefined,
|
|
154
|
+
title: payload.title,
|
|
155
|
+
value: payload.value,
|
|
156
|
+
currency: payload.currency,
|
|
157
|
+
stage_id: payload.stage_id,
|
|
158
|
+
status: payload.status,
|
|
159
|
+
expected_close_date: payload.expected_close_date,
|
|
160
|
+
probability: payload.probability,
|
|
161
|
+
lost_reason: payload.lost_reason,
|
|
162
|
+
visible_to: payload.visible_to,
|
|
163
|
+
add_time: payload.add_time ? `${payload.add_time}` : undefined,
|
|
164
|
+
person_id: personId || undefined,
|
|
165
|
+
org_id: organizationId || undefined
|
|
166
|
+
};
|
|
167
|
+
if (!deal.id && !deal.person_id && !deal.org_id) {
|
|
168
|
+
throw new actions_core_1.IntegrationError('No related organization or person, unable to create deal!', 'INVALID_REQUEST_DATA', 400);
|
|
169
|
+
}
|
|
170
|
+
return deals_1.createUpdateDeal(client, deal);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
exports.default = action;
|
|
174
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/pipedrive/createUpdateDeal/index.ts"],"names":[],"mappings":";;;;;AAGA,wFAA8D;AAC9D,iDAA8D;AAC9D,wDAAwD;AAExD,MAAM,YAAY,GAAG,0BAAe,CAAC,YAAY,CAAA;AAEjD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,yBAAyB;IAChC,WAAW,EAAE,kEAA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,IAAI,GAAS;YACjB,EAAE,EAAE,MAAM,IAAI,SAAS;YACvB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;YAChD,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS;YAC9D,SAAS,EAAE,QAAQ,IAAI,SAAS;YAChC,MAAM,EAAE,cAAc,IAAI,SAAS;SACpC,CAAA;QAED,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAC/C,MAAM,IAAI,+BAAgB,CACxB,2DAA2D,EAC3D,sBAAsB,EACtB,GAAG,CACJ,CAAA;SACF;QAED,OAAO,wBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IACvC,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
lead_id?: number;
|
|
3
|
+
person_match_field?: string;
|
|
4
|
+
person_match_value?: string;
|
|
5
|
+
organization_match_field?: string;
|
|
6
|
+
organization_match_value?: string;
|
|
7
|
+
title: string;
|
|
8
|
+
value?: {
|
|
9
|
+
amount?: number;
|
|
10
|
+
currency?: string;
|
|
11
|
+
};
|
|
12
|
+
expected_close_date?: string;
|
|
13
|
+
visible_to?: number;
|
|
14
|
+
add_time?: string | number;
|
|
15
|
+
}
|
package/dist/destinations/{facebook-conversions-api → pipedrive/createUpdateLead}/generated-types.js
RENAMED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/pipedrive/createUpdateLead/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionDefinition } from '@segment/actions-core';
|
|
1
|
+
import type { ActionDefinition } from '@segment/actions-core';
|
|
2
2
|
import type { Settings } from '../generated-types';
|
|
3
3
|
import type { Payload } from './generated-types';
|
|
4
4
|
declare const action: ActionDefinition<Settings, Payload>;
|