@activepieces/piece-pipedrive 0.8.7 → 0.8.8
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 +8 -14
- package/src/index.js +13 -117
- package/src/index.d.ts +0 -2
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/actions/add-follower.d.ts +0 -6
- package/src/lib/actions/add-follower.d.ts.map +0 -1
- package/src/lib/actions/add-follower.js +0 -88
- package/src/lib/actions/add-follower.js.map +0 -1
- package/src/lib/actions/add-label-to-person.d.ts +0 -5
- package/src/lib/actions/add-label-to-person.d.ts.map +0 -1
- package/src/lib/actions/add-label-to-person.js +0 -48
- package/src/lib/actions/add-label-to-person.js.map +0 -1
- package/src/lib/actions/add-product-to-deal.d.ts +0 -13
- package/src/lib/actions/add-product-to-deal.d.ts.map +0 -1
- package/src/lib/actions/add-product-to-deal.js +0 -111
- package/src/lib/actions/add-product-to-deal.js.map +0 -1
- package/src/lib/actions/attach-file.d.ts +0 -10
- package/src/lib/actions/attach-file.d.ts.map +0 -1
- package/src/lib/actions/attach-file.js +0 -67
- package/src/lib/actions/attach-file.js.map +0 -1
- package/src/lib/actions/create-activity.d.ts +0 -17
- package/src/lib/actions/create-activity.d.ts.map +0 -1
- package/src/lib/actions/create-activity.js +0 -61
- package/src/lib/actions/create-activity.js.map +0 -1
- package/src/lib/actions/create-deal.d.ts +0 -18
- package/src/lib/actions/create-deal.d.ts.map +0 -1
- package/src/lib/actions/create-deal.js +0 -74
- package/src/lib/actions/create-deal.js.map +0 -1
- package/src/lib/actions/create-lead.d.ts +0 -14
- package/src/lib/actions/create-lead.d.ts.map +0 -1
- package/src/lib/actions/create-lead.js +0 -80
- package/src/lib/actions/create-lead.js.map +0 -1
- package/src/lib/actions/create-note.d.ts +0 -12
- package/src/lib/actions/create-note.d.ts.map +0 -1
- package/src/lib/actions/create-note.js +0 -75
- package/src/lib/actions/create-note.js.map +0 -1
- package/src/lib/actions/create-organization.d.ts +0 -9
- package/src/lib/actions/create-organization.d.ts.map +0 -1
- package/src/lib/actions/create-organization.js +0 -66
- package/src/lib/actions/create-organization.js.map +0 -1
- package/src/lib/actions/create-person.d.ts +0 -14
- package/src/lib/actions/create-person.d.ts.map +0 -1
- package/src/lib/actions/create-person.js +0 -91
- package/src/lib/actions/create-person.js.map +0 -1
- package/src/lib/actions/create-product.d.ts +0 -16
- package/src/lib/actions/create-product.d.ts.map +0 -1
- package/src/lib/actions/create-product.js +0 -112
- package/src/lib/actions/create-product.js.map +0 -1
- package/src/lib/actions/find-activity.d.ts +0 -9
- package/src/lib/actions/find-activity.d.ts.map +0 -1
- package/src/lib/actions/find-activity.js +0 -101
- package/src/lib/actions/find-activity.js.map +0 -1
- package/src/lib/actions/find-deal.d.ts +0 -5
- package/src/lib/actions/find-deal.d.ts.map +0 -1
- package/src/lib/actions/find-deal.js +0 -111
- package/src/lib/actions/find-deal.js.map +0 -1
- package/src/lib/actions/find-deals-associated-with-person.d.ts +0 -4
- package/src/lib/actions/find-deals-associated-with-person.d.ts.map +0 -1
- package/src/lib/actions/find-deals-associated-with-person.js +0 -64
- package/src/lib/actions/find-deals-associated-with-person.js.map +0 -1
- package/src/lib/actions/find-leads.d.ts +0 -5
- package/src/lib/actions/find-leads.d.ts.map +0 -1
- package/src/lib/actions/find-leads.js +0 -73
- package/src/lib/actions/find-leads.js.map +0 -1
- package/src/lib/actions/find-notes.d.ts +0 -5
- package/src/lib/actions/find-notes.d.ts.map +0 -1
- package/src/lib/actions/find-notes.js +0 -76
- package/src/lib/actions/find-notes.js.map +0 -1
- package/src/lib/actions/find-organization.d.ts +0 -5
- package/src/lib/actions/find-organization.d.ts.map +0 -1
- package/src/lib/actions/find-organization.js +0 -111
- package/src/lib/actions/find-organization.js.map +0 -1
- package/src/lib/actions/find-person.d.ts +0 -5
- package/src/lib/actions/find-person.d.ts.map +0 -1
- package/src/lib/actions/find-person.js +0 -109
- package/src/lib/actions/find-person.js.map +0 -1
- package/src/lib/actions/find-product.d.ts +0 -4
- package/src/lib/actions/find-product.d.ts.map +0 -1
- package/src/lib/actions/find-product.js +0 -65
- package/src/lib/actions/find-product.js.map +0 -1
- package/src/lib/actions/find-products.d.ts +0 -5
- package/src/lib/actions/find-products.d.ts.map +0 -1
- package/src/lib/actions/find-products.js +0 -86
- package/src/lib/actions/find-products.js.map +0 -1
- package/src/lib/actions/find-user.d.ts +0 -5
- package/src/lib/actions/find-user.d.ts.map +0 -1
- package/src/lib/actions/find-user.js +0 -59
- package/src/lib/actions/find-user.js.map +0 -1
- package/src/lib/actions/get-note.d.ts +0 -4
- package/src/lib/actions/get-note.d.ts.map +0 -1
- package/src/lib/actions/get-note.js +0 -45
- package/src/lib/actions/get-note.js.map +0 -1
- package/src/lib/actions/get-product.d.ts +0 -4
- package/src/lib/actions/get-product.d.ts.map +0 -1
- package/src/lib/actions/get-product.js +0 -52
- package/src/lib/actions/get-product.js.map +0 -1
- package/src/lib/actions/update-activity.d.ts +0 -18
- package/src/lib/actions/update-activity.d.ts.map +0 -1
- package/src/lib/actions/update-activity.js +0 -65
- package/src/lib/actions/update-activity.js.map +0 -1
- package/src/lib/actions/update-deal.d.ts +0 -19
- package/src/lib/actions/update-deal.d.ts.map +0 -1
- package/src/lib/actions/update-deal.js +0 -73
- package/src/lib/actions/update-deal.js.map +0 -1
- package/src/lib/actions/update-lead.d.ts +0 -15
- package/src/lib/actions/update-lead.d.ts.map +0 -1
- package/src/lib/actions/update-lead.js +0 -77
- package/src/lib/actions/update-lead.js.map +0 -1
- package/src/lib/actions/update-organization.d.ts +0 -10
- package/src/lib/actions/update-organization.d.ts.map +0 -1
- package/src/lib/actions/update-organization.js +0 -63
- package/src/lib/actions/update-organization.js.map +0 -1
- package/src/lib/actions/update-person.d.ts +0 -15
- package/src/lib/actions/update-person.d.ts.map +0 -1
- package/src/lib/actions/update-person.js +0 -84
- package/src/lib/actions/update-person.js.map +0 -1
- package/src/lib/actions/update-product.d.ts +0 -17
- package/src/lib/actions/update-product.d.ts.map +0 -1
- package/src/lib/actions/update-product.js +0 -119
- package/src/lib/actions/update-product.js.map +0 -1
- package/src/lib/auth.d.ts +0 -2
- package/src/lib/auth.d.ts.map +0 -1
- package/src/lib/auth.js +0 -22
- package/src/lib/auth.js.map +0 -1
- package/src/lib/common/constants.d.ts +0 -4
- package/src/lib/common/constants.d.ts.map +0 -1
- package/src/lib/common/constants.js +0 -64
- package/src/lib/common/constants.js.map +0 -1
- package/src/lib/common/index.d.ts +0 -25
- package/src/lib/common/index.d.ts.map +0 -1
- package/src/lib/common/index.js +0 -260
- package/src/lib/common/index.js.map +0 -1
- package/src/lib/common/props.d.ts +0 -144
- package/src/lib/common/props.d.ts.map +0 -1
- package/src/lib/common/props.js +0 -893
- package/src/lib/common/props.js.map +0 -1
- package/src/lib/common/types.d.ts +0 -370
- package/src/lib/common/types.d.ts.map +0 -1
- package/src/lib/common/types.js +0 -3
- package/src/lib/common/types.js.map +0 -1
- package/src/lib/trigger/activity-matching-filter.d.ts +0 -11
- package/src/lib/trigger/activity-matching-filter.d.ts.map +0 -1
- package/src/lib/trigger/activity-matching-filter.js +0 -182
- package/src/lib/trigger/activity-matching-filter.js.map +0 -1
- package/src/lib/trigger/deal-matching-filter.d.ts +0 -15
- package/src/lib/trigger/deal-matching-filter.d.ts.map +0 -1
- package/src/lib/trigger/deal-matching-filter.js +0 -247
- package/src/lib/trigger/deal-matching-filter.js.map +0 -1
- package/src/lib/trigger/new-activity.d.ts +0 -3
- package/src/lib/trigger/new-activity.d.ts.map +0 -1
- package/src/lib/trigger/new-activity.js +0 -134
- package/src/lib/trigger/new-activity.js.map +0 -1
- package/src/lib/trigger/new-deal.d.ts +0 -3
- package/src/lib/trigger/new-deal.d.ts.map +0 -1
- package/src/lib/trigger/new-deal.js +0 -141
- package/src/lib/trigger/new-deal.js.map +0 -1
- package/src/lib/trigger/new-lead.d.ts +0 -3
- package/src/lib/trigger/new-lead.d.ts.map +0 -1
- package/src/lib/trigger/new-lead.js +0 -129
- package/src/lib/trigger/new-lead.js.map +0 -1
- package/src/lib/trigger/new-note.d.ts +0 -3
- package/src/lib/trigger/new-note.d.ts.map +0 -1
- package/src/lib/trigger/new-note.js +0 -81
- package/src/lib/trigger/new-note.js.map +0 -1
- package/src/lib/trigger/new-organization.d.ts +0 -3
- package/src/lib/trigger/new-organization.d.ts.map +0 -1
- package/src/lib/trigger/new-organization.js +0 -116
- package/src/lib/trigger/new-organization.js.map +0 -1
- package/src/lib/trigger/new-person.d.ts +0 -3
- package/src/lib/trigger/new-person.d.ts.map +0 -1
- package/src/lib/trigger/new-person.js +0 -126
- package/src/lib/trigger/new-person.js.map +0 -1
- package/src/lib/trigger/organization-matching-filter.d.ts +0 -11
- package/src/lib/trigger/organization-matching-filter.d.ts.map +0 -1
- package/src/lib/trigger/organization-matching-filter.js +0 -154
- package/src/lib/trigger/organization-matching-filter.js.map +0 -1
- package/src/lib/trigger/person-matching-filter.d.ts +0 -11
- package/src/lib/trigger/person-matching-filter.d.ts.map +0 -1
- package/src/lib/trigger/person-matching-filter.js +0 -161
- package/src/lib/trigger/person-matching-filter.js.map +0 -1
- package/src/lib/trigger/updated-deal-stage.d.ts +0 -11
- package/src/lib/trigger/updated-deal-stage.d.ts.map +0 -1
- package/src/lib/trigger/updated-deal-stage.js +0 -226
- package/src/lib/trigger/updated-deal-stage.js.map +0 -1
- package/src/lib/trigger/updated-deal.d.ts +0 -19
- package/src/lib/trigger/updated-deal.d.ts.map +0 -1
- package/src/lib/trigger/updated-deal.js +0 -325
- package/src/lib/trigger/updated-deal.js.map +0 -1
- package/src/lib/trigger/updated-organization.d.ts +0 -3
- package/src/lib/trigger/updated-organization.d.ts.map +0 -1
- package/src/lib/trigger/updated-organization.js +0 -113
- package/src/lib/trigger/updated-organization.js.map +0 -1
- package/src/lib/trigger/updated-person.d.ts +0 -3
- package/src/lib/trigger/updated-person.d.ts.map +0 -1
- package/src/lib/trigger/updated-person.js +0 -123
- package/src/lib/trigger/updated-person.js.map +0 -1
package/src/lib/common/props.js
DELETED
|
@@ -1,893 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.activityCommonProps = exports.personCommonProps = exports.organizationCommonProps = exports.leadCommonProps = exports.dealCommonProps = exports.dealIdProp = exports.activityTypeIdProp = exports.leadIdProp = exports.visibleToProp = exports.productIdProp = exports.leadLabelIdsProp = exports.labelIdsProp = exports.personIdProp = exports.dealStageIdProp = exports.dealPipelineIdProp = exports.organizationIdProp = exports.filterIdProp = exports.ownerIdProp = exports.searchFieldValueProp = exports.searchFieldProp = void 0;
|
|
4
|
-
exports.fetchFiltersOptions = fetchFiltersOptions;
|
|
5
|
-
exports.fetchActivityTypesOptions = fetchActivityTypesOptions;
|
|
6
|
-
exports.fetchPipelinesOptions = fetchPipelinesOptions;
|
|
7
|
-
exports.fetchPersonsOptions = fetchPersonsOptions;
|
|
8
|
-
exports.fetchOwnersOptions = fetchOwnersOptions;
|
|
9
|
-
exports.createPropertyDefinition = createPropertyDefinition;
|
|
10
|
-
exports.retrieveObjectCustomProperties = retrieveObjectCustomProperties;
|
|
11
|
-
exports.customFieldsProp = customFieldsProp;
|
|
12
|
-
const tslib_1 = require("tslib");
|
|
13
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
14
|
-
const _1 = require(".");
|
|
15
|
-
const auth_1 = require("../auth");
|
|
16
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
17
|
-
const shared_1 = require("@activepieces/shared");
|
|
18
|
-
/**
|
|
19
|
-
* Fetches options for Pipedrive filters.
|
|
20
|
-
* @param auth Pipedrive authentication.
|
|
21
|
-
* @param type The type of object for the filter (e.g., 'deals', 'people', 'org').
|
|
22
|
-
* @returns Dropdown options for filters.
|
|
23
|
-
*/
|
|
24
|
-
function fetchFiltersOptions(auth, type) {
|
|
25
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
const filters = yield (0, _1.pipedriveApiCall)({
|
|
27
|
-
accessToken: auth.access_token,
|
|
28
|
-
apiDomain: auth.data['api_domain'],
|
|
29
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
30
|
-
resourceUri: '/v1/filters',
|
|
31
|
-
query: {
|
|
32
|
-
type: type,
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
const options = [];
|
|
36
|
-
for (const filter of filters.data) {
|
|
37
|
-
options.push({
|
|
38
|
-
label: filter.name,
|
|
39
|
-
value: filter.id,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
return options;
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Fetches options for Pipedrive activity types.
|
|
47
|
-
* @param auth Pipedrive authentication.
|
|
48
|
-
* @returns Dropdown options for activity types.
|
|
49
|
-
*/
|
|
50
|
-
function fetchActivityTypesOptions(auth) {
|
|
51
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
const activityTypes = yield (0, _1.pipedriveApiCall)({
|
|
53
|
-
accessToken: auth.access_token,
|
|
54
|
-
apiDomain: auth.data['api_domain'],
|
|
55
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
56
|
-
resourceUri: '/v1/activityTypes',
|
|
57
|
-
});
|
|
58
|
-
const options = [];
|
|
59
|
-
for (const type of activityTypes.data) {
|
|
60
|
-
options.push({
|
|
61
|
-
label: type.name,
|
|
62
|
-
value: type.key_string,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
return options;
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Fetches options for Pipedrive pipelines.
|
|
70
|
-
* @param auth Pipedrive authentication.
|
|
71
|
-
* @returns Dropdown options for pipelines.
|
|
72
|
-
*/
|
|
73
|
-
function fetchPipelinesOptions(auth) {
|
|
74
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
const pipelines = yield (0, _1.pipedrivePaginatedV2ApiCall)({
|
|
76
|
-
accessToken: auth.access_token,
|
|
77
|
-
apiDomain: auth.data['api_domain'],
|
|
78
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
79
|
-
resourceUri: '/v2/pipelines',
|
|
80
|
-
});
|
|
81
|
-
const options = [];
|
|
82
|
-
for (const pipeline of pipelines) {
|
|
83
|
-
options.push({
|
|
84
|
-
label: pipeline.name,
|
|
85
|
-
value: pipeline.id,
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
return options;
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Fetches options for Pipedrive persons.
|
|
93
|
-
* @param auth Pipedrive authentication.
|
|
94
|
-
* @returns Dropdown options for persons.
|
|
95
|
-
*/
|
|
96
|
-
function fetchPersonsOptions(auth) {
|
|
97
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
98
|
-
const persons = yield (0, _1.pipedriveApiCall)({
|
|
99
|
-
accessToken: auth.access_token,
|
|
100
|
-
apiDomain: auth.data['api_domain'],
|
|
101
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
102
|
-
resourceUri: '/v1/persons',
|
|
103
|
-
query: {
|
|
104
|
-
sort_by: 'update_time',
|
|
105
|
-
sort_direction: 'desc',
|
|
106
|
-
},
|
|
107
|
-
});
|
|
108
|
-
const options = [];
|
|
109
|
-
for (const person of persons.data) {
|
|
110
|
-
options.push({
|
|
111
|
-
label: person.name,
|
|
112
|
-
value: person.id,
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
return options;
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Fetches options for Pipedrive users (owners).
|
|
120
|
-
* @param auth Pipedrive authentication.
|
|
121
|
-
* @returns Dropdown options for owners.
|
|
122
|
-
*/
|
|
123
|
-
function fetchOwnersOptions(auth) {
|
|
124
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
125
|
-
const users = yield (0, _1.pipedriveApiCall)({
|
|
126
|
-
accessToken: auth.access_token,
|
|
127
|
-
apiDomain: auth.data['api_domain'],
|
|
128
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
129
|
-
resourceUri: '/v1/users:(id,email)',
|
|
130
|
-
});
|
|
131
|
-
const options = [];
|
|
132
|
-
for (const user of users.data) {
|
|
133
|
-
options.push({
|
|
134
|
-
label: user.email,
|
|
135
|
-
value: user.id,
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
return options;
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Creates a property definition for a custom field based on its Pipedrive field type.
|
|
143
|
-
* @param property The Pipedrive custom field definition.
|
|
144
|
-
* @returns A Property.ShortText, Property.LongText, Property.StaticDropdown, Property.StaticMultiSelectDropdown, or Property.Number.
|
|
145
|
-
*/
|
|
146
|
-
function createPropertyDefinition(property) {
|
|
147
|
-
switch (property.field_type) {
|
|
148
|
-
case 'varchar':
|
|
149
|
-
case 'varchar_auto':
|
|
150
|
-
case 'phone':
|
|
151
|
-
return pieces_framework_1.Property.ShortText({
|
|
152
|
-
displayName: property.name,
|
|
153
|
-
required: false,
|
|
154
|
-
});
|
|
155
|
-
case 'text':
|
|
156
|
-
case 'address':
|
|
157
|
-
return pieces_framework_1.Property.LongText({
|
|
158
|
-
displayName: property.name,
|
|
159
|
-
required: false,
|
|
160
|
-
});
|
|
161
|
-
case 'enum':
|
|
162
|
-
return pieces_framework_1.Property.StaticDropdown({
|
|
163
|
-
displayName: property.name,
|
|
164
|
-
required: false,
|
|
165
|
-
options: {
|
|
166
|
-
disabled: false,
|
|
167
|
-
options: property.options
|
|
168
|
-
? property.options.map((option) => {
|
|
169
|
-
return {
|
|
170
|
-
label: option.label,
|
|
171
|
-
value: option.id,
|
|
172
|
-
};
|
|
173
|
-
})
|
|
174
|
-
: [],
|
|
175
|
-
},
|
|
176
|
-
});
|
|
177
|
-
case 'set':
|
|
178
|
-
return pieces_framework_1.Property.StaticMultiSelectDropdown({
|
|
179
|
-
displayName: property.name,
|
|
180
|
-
required: false,
|
|
181
|
-
options: {
|
|
182
|
-
disabled: false,
|
|
183
|
-
options: property.options
|
|
184
|
-
? property.options.map((option) => {
|
|
185
|
-
return {
|
|
186
|
-
label: option.label,
|
|
187
|
-
value: option.id,
|
|
188
|
-
};
|
|
189
|
-
})
|
|
190
|
-
: [],
|
|
191
|
-
},
|
|
192
|
-
});
|
|
193
|
-
case 'double':
|
|
194
|
-
case 'monetary':
|
|
195
|
-
return pieces_framework_1.Property.Number({
|
|
196
|
-
displayName: property.name,
|
|
197
|
-
required: false,
|
|
198
|
-
});
|
|
199
|
-
case 'time':
|
|
200
|
-
case 'timerange':
|
|
201
|
-
return pieces_framework_1.Property.ShortText({
|
|
202
|
-
displayName: property.name,
|
|
203
|
-
description: 'Please enter time in HH:mm:ss format.',
|
|
204
|
-
required: false,
|
|
205
|
-
});
|
|
206
|
-
case 'int':
|
|
207
|
-
return pieces_framework_1.Property.Number({
|
|
208
|
-
displayName: property.name,
|
|
209
|
-
required: false,
|
|
210
|
-
});
|
|
211
|
-
case 'date':
|
|
212
|
-
case 'daterange':
|
|
213
|
-
return pieces_framework_1.Property.DateTime({
|
|
214
|
-
displayName: property.name,
|
|
215
|
-
description: 'Please enter date in YYYY-MM-DD format.',
|
|
216
|
-
required: false,
|
|
217
|
-
});
|
|
218
|
-
default:
|
|
219
|
-
return null;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Retrieves custom properties for a given Pipedrive object type.
|
|
224
|
-
* @param auth Pipedrive authentication.
|
|
225
|
-
* @param objectType The type of object (e.g., 'person', 'deal', 'organization', 'product', 'lead').
|
|
226
|
-
* @returns Dynamic properties for custom fields.
|
|
227
|
-
*/
|
|
228
|
-
function retrieveObjectCustomProperties(auth, objectType) {
|
|
229
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
230
|
-
let endpoint = '';
|
|
231
|
-
switch (objectType) {
|
|
232
|
-
case 'person':
|
|
233
|
-
endpoint = '/v1/personFields';
|
|
234
|
-
break;
|
|
235
|
-
case 'deal':
|
|
236
|
-
case 'lead':
|
|
237
|
-
endpoint = '/v1/dealFields';
|
|
238
|
-
break;
|
|
239
|
-
case 'organization':
|
|
240
|
-
endpoint = '/v1/organizationFields';
|
|
241
|
-
break;
|
|
242
|
-
case 'product':
|
|
243
|
-
endpoint = '/v1/productFields';
|
|
244
|
-
break;
|
|
245
|
-
}
|
|
246
|
-
const customFields = yield (0, _1.pipedrivePaginatedV1ApiCall)({
|
|
247
|
-
accessToken: auth.access_token,
|
|
248
|
-
apiDomain: auth.data['api_domain'],
|
|
249
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
250
|
-
resourceUri: endpoint,
|
|
251
|
-
});
|
|
252
|
-
const props = {};
|
|
253
|
-
for (const field of customFields) {
|
|
254
|
-
if (!field.edit_flag) {
|
|
255
|
-
continue;
|
|
256
|
-
}
|
|
257
|
-
const propertyDefinition = createPropertyDefinition(field);
|
|
258
|
-
if (propertyDefinition) {
|
|
259
|
-
props[field.key] = propertyDefinition;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
return props;
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Property definition for selecting a search field for an object type.
|
|
267
|
-
* @param objectType The type of object (e.g., 'deal', 'person').
|
|
268
|
-
*/
|
|
269
|
-
const searchFieldProp = (objectType) => pieces_framework_1.Property.Dropdown({
|
|
270
|
-
auth: auth_1.pipedriveAuth,
|
|
271
|
-
displayName: 'Field to search by',
|
|
272
|
-
required: true,
|
|
273
|
-
refreshers: [],
|
|
274
|
-
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
275
|
-
if (!auth) {
|
|
276
|
-
return {
|
|
277
|
-
disabled: true,
|
|
278
|
-
options: [],
|
|
279
|
-
placeholder: 'Please connect your account.',
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
const authValue = auth;
|
|
283
|
-
let endpoint = '';
|
|
284
|
-
switch (objectType) {
|
|
285
|
-
case 'person':
|
|
286
|
-
endpoint = '/v1/personFields';
|
|
287
|
-
break;
|
|
288
|
-
case 'deal':
|
|
289
|
-
case 'lead':
|
|
290
|
-
endpoint = '/v1/dealFields';
|
|
291
|
-
break;
|
|
292
|
-
case 'organization':
|
|
293
|
-
endpoint = '/v1/organizationFields';
|
|
294
|
-
break;
|
|
295
|
-
case 'product':
|
|
296
|
-
endpoint = '/v1/productFields';
|
|
297
|
-
break;
|
|
298
|
-
}
|
|
299
|
-
const response = yield (0, _1.pipedrivePaginatedV1ApiCall)({
|
|
300
|
-
accessToken: authValue.access_token,
|
|
301
|
-
apiDomain: authValue.data['api_domain'],
|
|
302
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
303
|
-
resourceUri: endpoint,
|
|
304
|
-
});
|
|
305
|
-
const options = [];
|
|
306
|
-
for (const field of response) {
|
|
307
|
-
if (!(0, shared_1.isNil)(field.id)) {
|
|
308
|
-
options.push({
|
|
309
|
-
label: field.name,
|
|
310
|
-
value: field.id.toString(),
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
return {
|
|
315
|
-
disabled: false,
|
|
316
|
-
options,
|
|
317
|
-
};
|
|
318
|
-
}),
|
|
319
|
-
});
|
|
320
|
-
exports.searchFieldProp = searchFieldProp;
|
|
321
|
-
/**
|
|
322
|
-
* Property definition for the value of a search field.
|
|
323
|
-
* Dynamically renders based on the selected searchField's type.
|
|
324
|
-
* @param objectType The type of object (e.g., 'deal', 'person').
|
|
325
|
-
*/
|
|
326
|
-
const searchFieldValueProp = (objectType) => pieces_framework_1.Property.DynamicProperties({
|
|
327
|
-
auth: auth_1.pipedriveAuth,
|
|
328
|
-
displayName: 'Field Value',
|
|
329
|
-
required: true,
|
|
330
|
-
refreshers: ['searchField'],
|
|
331
|
-
props: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, searchField }) {
|
|
332
|
-
if (!auth || !searchField)
|
|
333
|
-
return {};
|
|
334
|
-
const authValue = auth;
|
|
335
|
-
const props = {};
|
|
336
|
-
let endpoint = '';
|
|
337
|
-
switch (objectType) {
|
|
338
|
-
case 'person':
|
|
339
|
-
endpoint = '/v1/personFields';
|
|
340
|
-
break;
|
|
341
|
-
case 'deal':
|
|
342
|
-
case 'lead':
|
|
343
|
-
endpoint = '/v1/dealFields';
|
|
344
|
-
break;
|
|
345
|
-
case 'organization':
|
|
346
|
-
endpoint = '/v1/organizationFields';
|
|
347
|
-
break;
|
|
348
|
-
case 'product':
|
|
349
|
-
endpoint = '/v1/productFields';
|
|
350
|
-
break;
|
|
351
|
-
}
|
|
352
|
-
const response = yield (0, _1.pipedriveApiCall)({
|
|
353
|
-
accessToken: authValue.access_token,
|
|
354
|
-
apiDomain: authValue.data['api_domain'],
|
|
355
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
356
|
-
resourceUri: `${endpoint}/${searchField}`,
|
|
357
|
-
});
|
|
358
|
-
const propertyDefinition = response.data.field_type === 'set'
|
|
359
|
-
? pieces_framework_1.Property.StaticDropdown({
|
|
360
|
-
displayName: response.data.name,
|
|
361
|
-
required: false,
|
|
362
|
-
options: {
|
|
363
|
-
disabled: false,
|
|
364
|
-
options: response.data.options
|
|
365
|
-
? response.data.options.map((option) => {
|
|
366
|
-
return {
|
|
367
|
-
label: option.label,
|
|
368
|
-
value: option.id.toString(),
|
|
369
|
-
};
|
|
370
|
-
})
|
|
371
|
-
: [],
|
|
372
|
-
},
|
|
373
|
-
})
|
|
374
|
-
: createPropertyDefinition(response.data);
|
|
375
|
-
if (propertyDefinition) {
|
|
376
|
-
props['field_value'] = propertyDefinition;
|
|
377
|
-
}
|
|
378
|
-
else {
|
|
379
|
-
props['field_value'] = pieces_framework_1.Property.ShortText({
|
|
380
|
-
displayName: response.data.name,
|
|
381
|
-
required: false,
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
return props;
|
|
385
|
-
}),
|
|
386
|
-
});
|
|
387
|
-
exports.searchFieldValueProp = searchFieldValueProp;
|
|
388
|
-
const ownerIdProp = (displayName, required = false) => pieces_framework_1.Property.Dropdown({
|
|
389
|
-
auth: auth_1.pipedriveAuth,
|
|
390
|
-
displayName,
|
|
391
|
-
refreshers: [],
|
|
392
|
-
required,
|
|
393
|
-
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
394
|
-
if (!auth) {
|
|
395
|
-
return {
|
|
396
|
-
disabled: true,
|
|
397
|
-
options: [],
|
|
398
|
-
placeholder: 'Please connect your account.',
|
|
399
|
-
};
|
|
400
|
-
}
|
|
401
|
-
const authValue = auth;
|
|
402
|
-
const options = yield fetchOwnersOptions(authValue);
|
|
403
|
-
return {
|
|
404
|
-
disabled: false,
|
|
405
|
-
options,
|
|
406
|
-
};
|
|
407
|
-
}),
|
|
408
|
-
});
|
|
409
|
-
exports.ownerIdProp = ownerIdProp;
|
|
410
|
-
const filterIdProp = (type, required = false) => pieces_framework_1.Property.Dropdown({
|
|
411
|
-
auth: auth_1.pipedriveAuth,
|
|
412
|
-
displayName: 'Filter',
|
|
413
|
-
refreshers: [],
|
|
414
|
-
required,
|
|
415
|
-
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
416
|
-
if (!auth) {
|
|
417
|
-
return {
|
|
418
|
-
disabled: true,
|
|
419
|
-
options: [],
|
|
420
|
-
placeholder: 'Please connect your account.',
|
|
421
|
-
};
|
|
422
|
-
}
|
|
423
|
-
const authValue = auth;
|
|
424
|
-
const options = yield fetchFiltersOptions(authValue, type);
|
|
425
|
-
return {
|
|
426
|
-
disabled: false,
|
|
427
|
-
options,
|
|
428
|
-
};
|
|
429
|
-
}),
|
|
430
|
-
});
|
|
431
|
-
exports.filterIdProp = filterIdProp;
|
|
432
|
-
const organizationIdProp = (required = false) => pieces_framework_1.Property.Number({
|
|
433
|
-
displayName: 'Organization ID',
|
|
434
|
-
description: 'You can use Find Organization action to retrieve org ID.',
|
|
435
|
-
required,
|
|
436
|
-
});
|
|
437
|
-
exports.organizationIdProp = organizationIdProp;
|
|
438
|
-
const dealPipelineIdProp = (required = false) => pieces_framework_1.Property.Dropdown({
|
|
439
|
-
auth: auth_1.pipedriveAuth,
|
|
440
|
-
displayName: 'Pipeline',
|
|
441
|
-
refreshers: [],
|
|
442
|
-
required,
|
|
443
|
-
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
444
|
-
if (!auth) {
|
|
445
|
-
return {
|
|
446
|
-
disabled: true,
|
|
447
|
-
options: [],
|
|
448
|
-
placeholder: 'Please connect your account.',
|
|
449
|
-
};
|
|
450
|
-
}
|
|
451
|
-
const authValue = auth;
|
|
452
|
-
const options = yield fetchPipelinesOptions(authValue);
|
|
453
|
-
return {
|
|
454
|
-
disabled: false,
|
|
455
|
-
options,
|
|
456
|
-
};
|
|
457
|
-
}),
|
|
458
|
-
});
|
|
459
|
-
exports.dealPipelineIdProp = dealPipelineIdProp;
|
|
460
|
-
const dealStageIdProp = (required = false) => pieces_framework_1.Property.Dropdown({
|
|
461
|
-
auth: auth_1.pipedriveAuth,
|
|
462
|
-
displayName: 'Stage',
|
|
463
|
-
description: 'If a stage is chosen above, the pipeline field will be ignored.',
|
|
464
|
-
required,
|
|
465
|
-
refreshers: [],
|
|
466
|
-
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
467
|
-
if (!auth) {
|
|
468
|
-
return {
|
|
469
|
-
placeholder: 'Please connect your account.',
|
|
470
|
-
disabled: true,
|
|
471
|
-
options: [],
|
|
472
|
-
};
|
|
473
|
-
}
|
|
474
|
-
const authValue = auth;
|
|
475
|
-
const response = yield (0, _1.pipedrivePaginatedV2ApiCall)({
|
|
476
|
-
accessToken: authValue.access_token,
|
|
477
|
-
apiDomain: authValue.data['api_domain'],
|
|
478
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
479
|
-
resourceUri: '/v2/stages',
|
|
480
|
-
});
|
|
481
|
-
const options = [];
|
|
482
|
-
for (const stage of response) {
|
|
483
|
-
options.push({
|
|
484
|
-
label: `${stage.name}`,
|
|
485
|
-
value: stage.id,
|
|
486
|
-
});
|
|
487
|
-
}
|
|
488
|
-
return {
|
|
489
|
-
disabled: false,
|
|
490
|
-
options,
|
|
491
|
-
};
|
|
492
|
-
}),
|
|
493
|
-
});
|
|
494
|
-
exports.dealStageIdProp = dealStageIdProp;
|
|
495
|
-
const personIdProp = (required = false) => pieces_framework_1.Property.Number({
|
|
496
|
-
displayName: 'Person ID',
|
|
497
|
-
description: 'You can use Find Person action to retrieve person ID.',
|
|
498
|
-
required,
|
|
499
|
-
});
|
|
500
|
-
exports.personIdProp = personIdProp;
|
|
501
|
-
const labelIdsProp = (objectType, labelFieldName, required = false) => pieces_framework_1.Property.MultiSelectDropdown({
|
|
502
|
-
auth: auth_1.pipedriveAuth,
|
|
503
|
-
displayName: 'Label',
|
|
504
|
-
required,
|
|
505
|
-
refreshers: [],
|
|
506
|
-
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
507
|
-
if (!auth) {
|
|
508
|
-
return {
|
|
509
|
-
disabled: true,
|
|
510
|
-
options: [],
|
|
511
|
-
placeholder: 'Please connect your account.',
|
|
512
|
-
};
|
|
513
|
-
}
|
|
514
|
-
const authValue = auth;
|
|
515
|
-
let endpoint = '';
|
|
516
|
-
switch (objectType) {
|
|
517
|
-
case 'person':
|
|
518
|
-
endpoint = '/v1/personFields';
|
|
519
|
-
break;
|
|
520
|
-
case 'deal':
|
|
521
|
-
endpoint = '/v1/dealFields';
|
|
522
|
-
break;
|
|
523
|
-
case 'organization':
|
|
524
|
-
endpoint = '/v1/organizationFields';
|
|
525
|
-
break;
|
|
526
|
-
}
|
|
527
|
-
const customFieldsResponse = yield (0, _1.pipedrivePaginatedV1ApiCall)({
|
|
528
|
-
accessToken: authValue.access_token,
|
|
529
|
-
apiDomain: authValue.data['api_domain'],
|
|
530
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
531
|
-
resourceUri: endpoint,
|
|
532
|
-
});
|
|
533
|
-
// Find the specific label field within the custom fields response
|
|
534
|
-
const labelField = customFieldsResponse.find((field) => field.key === labelFieldName);
|
|
535
|
-
const options = [];
|
|
536
|
-
if (labelField && labelField.options) {
|
|
537
|
-
for (const option of labelField.options) {
|
|
538
|
-
options.push({
|
|
539
|
-
label: option.label,
|
|
540
|
-
value: option.id,
|
|
541
|
-
});
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
return {
|
|
545
|
-
disabled: false,
|
|
546
|
-
options,
|
|
547
|
-
};
|
|
548
|
-
}),
|
|
549
|
-
});
|
|
550
|
-
exports.labelIdsProp = labelIdsProp;
|
|
551
|
-
const leadLabelIdsProp = (required = false) => pieces_framework_1.Property.MultiSelectDropdown({
|
|
552
|
-
auth: auth_1.pipedriveAuth,
|
|
553
|
-
displayName: 'Label',
|
|
554
|
-
required,
|
|
555
|
-
refreshers: [],
|
|
556
|
-
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
557
|
-
if (!auth) {
|
|
558
|
-
return {
|
|
559
|
-
disabled: true,
|
|
560
|
-
options: [],
|
|
561
|
-
placeholder: 'Please connect your account.',
|
|
562
|
-
};
|
|
563
|
-
}
|
|
564
|
-
const authValue = auth;
|
|
565
|
-
const leadLabelsResponse = yield (0, _1.pipedriveApiCall)({
|
|
566
|
-
accessToken: authValue.access_token,
|
|
567
|
-
apiDomain: authValue.data['api_domain'],
|
|
568
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
569
|
-
resourceUri: '/v1/leadLabels',
|
|
570
|
-
});
|
|
571
|
-
const options = [];
|
|
572
|
-
for (const option of leadLabelsResponse.data) {
|
|
573
|
-
options.push({
|
|
574
|
-
label: `${option.name} (${option.color})`,
|
|
575
|
-
value: option.id,
|
|
576
|
-
});
|
|
577
|
-
}
|
|
578
|
-
return {
|
|
579
|
-
disabled: false,
|
|
580
|
-
options,
|
|
581
|
-
};
|
|
582
|
-
}),
|
|
583
|
-
});
|
|
584
|
-
exports.leadLabelIdsProp = leadLabelIdsProp;
|
|
585
|
-
const productIdProp = (required = false) => pieces_framework_1.Property.Number({
|
|
586
|
-
displayName: 'Product ID',
|
|
587
|
-
description: 'You can use Find Product action to retrieve product ID.',
|
|
588
|
-
required,
|
|
589
|
-
});
|
|
590
|
-
exports.productIdProp = productIdProp;
|
|
591
|
-
/**
|
|
592
|
-
* Property definition for 'Visible To' setting.
|
|
593
|
-
*/
|
|
594
|
-
exports.visibleToProp = pieces_framework_1.Property.StaticDropdown({
|
|
595
|
-
displayName: 'Visible To',
|
|
596
|
-
required: false,
|
|
597
|
-
options: {
|
|
598
|
-
disabled: false,
|
|
599
|
-
options: [
|
|
600
|
-
{
|
|
601
|
-
label: 'Owner & followers',
|
|
602
|
-
value: 1,
|
|
603
|
-
},
|
|
604
|
-
{
|
|
605
|
-
label: 'Entire company',
|
|
606
|
-
value: 3,
|
|
607
|
-
},
|
|
608
|
-
],
|
|
609
|
-
},
|
|
610
|
-
});
|
|
611
|
-
const leadIdProp = (required = false) => pieces_framework_1.Property.ShortText({
|
|
612
|
-
displayName: 'Lead ID',
|
|
613
|
-
required,
|
|
614
|
-
});
|
|
615
|
-
exports.leadIdProp = leadIdProp;
|
|
616
|
-
const activityTypeIdProp = (required = false) => pieces_framework_1.Property.Dropdown({
|
|
617
|
-
auth: auth_1.pipedriveAuth,
|
|
618
|
-
displayName: 'Activity Type',
|
|
619
|
-
refreshers: [],
|
|
620
|
-
required,
|
|
621
|
-
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
622
|
-
if (!auth) {
|
|
623
|
-
return {
|
|
624
|
-
disabled: true,
|
|
625
|
-
options: [],
|
|
626
|
-
placeholder: 'Please connect your account.',
|
|
627
|
-
};
|
|
628
|
-
}
|
|
629
|
-
const authValue = auth;
|
|
630
|
-
const options = yield fetchActivityTypesOptions(authValue);
|
|
631
|
-
return {
|
|
632
|
-
disabled: false,
|
|
633
|
-
options,
|
|
634
|
-
};
|
|
635
|
-
}),
|
|
636
|
-
});
|
|
637
|
-
exports.activityTypeIdProp = activityTypeIdProp;
|
|
638
|
-
const dealIdProp = (required = false) => pieces_framework_1.Property.Number({
|
|
639
|
-
displayName: 'Deal ID',
|
|
640
|
-
description: 'You can use Find Deal action to retrieve deal ID.',
|
|
641
|
-
required,
|
|
642
|
-
});
|
|
643
|
-
exports.dealIdProp = dealIdProp;
|
|
644
|
-
exports.dealCommonProps = {
|
|
645
|
-
creationTime: pieces_framework_1.Property.DateTime({
|
|
646
|
-
displayName: 'Creation Time',
|
|
647
|
-
required: false,
|
|
648
|
-
}),
|
|
649
|
-
status: pieces_framework_1.Property.StaticDropdown({
|
|
650
|
-
displayName: 'Status',
|
|
651
|
-
required: false,
|
|
652
|
-
options: {
|
|
653
|
-
disabled: false,
|
|
654
|
-
options: [
|
|
655
|
-
{
|
|
656
|
-
label: 'Open',
|
|
657
|
-
value: 'open',
|
|
658
|
-
},
|
|
659
|
-
{
|
|
660
|
-
label: 'Won',
|
|
661
|
-
value: 'won',
|
|
662
|
-
},
|
|
663
|
-
{
|
|
664
|
-
label: 'Lost',
|
|
665
|
-
value: 'lost',
|
|
666
|
-
},
|
|
667
|
-
{
|
|
668
|
-
label: 'Deleted',
|
|
669
|
-
value: 'deleted',
|
|
670
|
-
},
|
|
671
|
-
],
|
|
672
|
-
},
|
|
673
|
-
}),
|
|
674
|
-
stageId: (0, exports.dealStageIdProp)(false),
|
|
675
|
-
pipelineId: (0, exports.dealPipelineIdProp)(false),
|
|
676
|
-
ownerId: (0, exports.ownerIdProp)('Owner', false),
|
|
677
|
-
organizationId: (0, exports.organizationIdProp)(false),
|
|
678
|
-
personId: (0, exports.personIdProp)(false),
|
|
679
|
-
labelIds: (0, exports.labelIdsProp)('deal', 'label', false),
|
|
680
|
-
probability: pieces_framework_1.Property.Number({
|
|
681
|
-
displayName: 'Probability',
|
|
682
|
-
required: false,
|
|
683
|
-
}),
|
|
684
|
-
expectedCloseDate: pieces_framework_1.Property.DateTime({
|
|
685
|
-
displayName: 'Expected Close Date',
|
|
686
|
-
required: false,
|
|
687
|
-
description: 'Please enter date in YYYY-MM-DD format.',
|
|
688
|
-
}),
|
|
689
|
-
dealValue: pieces_framework_1.Property.Number({
|
|
690
|
-
displayName: 'Value',
|
|
691
|
-
required: false,
|
|
692
|
-
}),
|
|
693
|
-
dealValueCurrency: pieces_framework_1.Property.ShortText({
|
|
694
|
-
displayName: 'Currency',
|
|
695
|
-
required: false,
|
|
696
|
-
description: 'Please enter currency code (e.g., "USD", "EUR").',
|
|
697
|
-
}),
|
|
698
|
-
visibleTo: exports.visibleToProp,
|
|
699
|
-
customfields: customFieldsProp('deal'),
|
|
700
|
-
};
|
|
701
|
-
/**
|
|
702
|
-
* Common properties for Lead actions.
|
|
703
|
-
*/
|
|
704
|
-
exports.leadCommonProps = {
|
|
705
|
-
ownerId: (0, exports.ownerIdProp)('Owner', false),
|
|
706
|
-
organizationId: (0, exports.organizationIdProp)(false),
|
|
707
|
-
personId: (0, exports.personIdProp)(false),
|
|
708
|
-
labelIds: (0, exports.leadLabelIdsProp)(false),
|
|
709
|
-
expectedCloseDate: pieces_framework_1.Property.DateTime({
|
|
710
|
-
displayName: 'Expected Close Date',
|
|
711
|
-
required: false,
|
|
712
|
-
description: 'Please enter date in YYYY-MM-DD format.',
|
|
713
|
-
}),
|
|
714
|
-
visibleTo: exports.visibleToProp,
|
|
715
|
-
channel: pieces_framework_1.Property.Dropdown({
|
|
716
|
-
auth: auth_1.pipedriveAuth,
|
|
717
|
-
displayName: 'Channel',
|
|
718
|
-
required: false,
|
|
719
|
-
refreshers: [],
|
|
720
|
-
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
721
|
-
var _b;
|
|
722
|
-
if (!auth) {
|
|
723
|
-
return {
|
|
724
|
-
disabled: true,
|
|
725
|
-
options: [],
|
|
726
|
-
placeholder: 'Please connect your account.',
|
|
727
|
-
};
|
|
728
|
-
}
|
|
729
|
-
const authValue = auth;
|
|
730
|
-
const customFieldsResponse = yield (0, _1.pipedrivePaginatedV1ApiCall)({
|
|
731
|
-
accessToken: authValue.access_token,
|
|
732
|
-
apiDomain: authValue.data['api_domain'],
|
|
733
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
734
|
-
resourceUri: '/v1/dealFields:(key,name,options)',
|
|
735
|
-
});
|
|
736
|
-
const channelField = customFieldsResponse.find((field) => field.key === 'channel');
|
|
737
|
-
const options = [];
|
|
738
|
-
if (channelField) {
|
|
739
|
-
for (const option of (_b = channelField.options) !== null && _b !== void 0 ? _b : []) {
|
|
740
|
-
options.push({
|
|
741
|
-
label: option.label,
|
|
742
|
-
value: option.id,
|
|
743
|
-
});
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
return {
|
|
747
|
-
disabled: false,
|
|
748
|
-
options,
|
|
749
|
-
};
|
|
750
|
-
}),
|
|
751
|
-
}),
|
|
752
|
-
leadValue: pieces_framework_1.Property.Number({
|
|
753
|
-
displayName: 'Lead Value Amount',
|
|
754
|
-
required: false,
|
|
755
|
-
}),
|
|
756
|
-
leadValueCurrency: pieces_framework_1.Property.ShortText({
|
|
757
|
-
displayName: 'Lead Value Currency',
|
|
758
|
-
required: false,
|
|
759
|
-
description: 'The currency of the lead value (e.g., "USD", "EUR").',
|
|
760
|
-
}),
|
|
761
|
-
customfields: customFieldsProp('lead'),
|
|
762
|
-
};
|
|
763
|
-
/**
|
|
764
|
-
* Common properties for Organization actions.
|
|
765
|
-
*/
|
|
766
|
-
exports.organizationCommonProps = {
|
|
767
|
-
ownerId: (0, exports.ownerIdProp)('Owner', false),
|
|
768
|
-
visibleTo: exports.visibleToProp,
|
|
769
|
-
labelIds: (0, exports.labelIdsProp)('organization', 'label_ids', false),
|
|
770
|
-
address: pieces_framework_1.Property.LongText({
|
|
771
|
-
displayName: 'Address',
|
|
772
|
-
required: false,
|
|
773
|
-
}),
|
|
774
|
-
customfields: customFieldsProp('organization'),
|
|
775
|
-
};
|
|
776
|
-
exports.personCommonProps = {
|
|
777
|
-
ownerId: (0, exports.ownerIdProp)('Owner', false),
|
|
778
|
-
organizationId: (0, exports.organizationIdProp)(false),
|
|
779
|
-
email: pieces_framework_1.Property.Array({
|
|
780
|
-
displayName: 'Email',
|
|
781
|
-
required: false,
|
|
782
|
-
}),
|
|
783
|
-
phone: pieces_framework_1.Property.Array({
|
|
784
|
-
displayName: 'Phone',
|
|
785
|
-
required: false,
|
|
786
|
-
}),
|
|
787
|
-
labelIds: (0, exports.labelIdsProp)('person', 'label_ids', false),
|
|
788
|
-
firstName: pieces_framework_1.Property.ShortText({
|
|
789
|
-
displayName: 'First Name',
|
|
790
|
-
required: false,
|
|
791
|
-
}),
|
|
792
|
-
lastName: pieces_framework_1.Property.ShortText({
|
|
793
|
-
displayName: 'Last Name',
|
|
794
|
-
required: false,
|
|
795
|
-
}),
|
|
796
|
-
visibleTo: exports.visibleToProp,
|
|
797
|
-
marketing_status: pieces_framework_1.Property.StaticDropdown({
|
|
798
|
-
displayName: 'Marketing Status',
|
|
799
|
-
description: 'Marketing opt-in status',
|
|
800
|
-
required: false,
|
|
801
|
-
options: {
|
|
802
|
-
disabled: false,
|
|
803
|
-
options: [
|
|
804
|
-
{
|
|
805
|
-
label: 'No Consent',
|
|
806
|
-
value: 'no_consent',
|
|
807
|
-
},
|
|
808
|
-
{
|
|
809
|
-
label: 'Unsubscribed',
|
|
810
|
-
value: 'unsubscribed',
|
|
811
|
-
},
|
|
812
|
-
{
|
|
813
|
-
label: 'Subscribed',
|
|
814
|
-
value: 'subscribed',
|
|
815
|
-
},
|
|
816
|
-
{
|
|
817
|
-
label: 'Archived',
|
|
818
|
-
value: 'archived',
|
|
819
|
-
},
|
|
820
|
-
],
|
|
821
|
-
},
|
|
822
|
-
}),
|
|
823
|
-
customfields: customFieldsProp('person'),
|
|
824
|
-
};
|
|
825
|
-
exports.activityCommonProps = {
|
|
826
|
-
organizationId: (0, exports.organizationIdProp)(false),
|
|
827
|
-
personId: (0, exports.personIdProp)(false),
|
|
828
|
-
dealId: (0, exports.dealIdProp)(false),
|
|
829
|
-
leadId: (0, exports.leadIdProp)(false),
|
|
830
|
-
assignTo: (0, exports.ownerIdProp)('Assign To', false),
|
|
831
|
-
type: (0, exports.activityTypeIdProp)(false),
|
|
832
|
-
dueDate: pieces_framework_1.Property.DateTime({
|
|
833
|
-
displayName: 'Due Date',
|
|
834
|
-
required: false,
|
|
835
|
-
description: 'Please enter date in YYYY-MM-DD format.',
|
|
836
|
-
}),
|
|
837
|
-
dueTime: pieces_framework_1.Property.ShortText({
|
|
838
|
-
displayName: 'Due Time',
|
|
839
|
-
required: false,
|
|
840
|
-
description: 'Please enter time in HH:MM format.',
|
|
841
|
-
}),
|
|
842
|
-
duration: pieces_framework_1.Property.ShortText({
|
|
843
|
-
displayName: 'Duration',
|
|
844
|
-
required: false,
|
|
845
|
-
description: 'Please enter time in HH:MM format (e.g., "01:30" for 1 hour 30 minutes).',
|
|
846
|
-
}),
|
|
847
|
-
isDone: pieces_framework_1.Property.Checkbox({
|
|
848
|
-
displayName: 'Mark as Done?',
|
|
849
|
-
required: false,
|
|
850
|
-
defaultValue: false,
|
|
851
|
-
}),
|
|
852
|
-
busy: pieces_framework_1.Property.StaticDropdown({
|
|
853
|
-
displayName: 'Free or Busy',
|
|
854
|
-
required: false,
|
|
855
|
-
options: {
|
|
856
|
-
disabled: false,
|
|
857
|
-
options: [
|
|
858
|
-
{
|
|
859
|
-
label: 'Free',
|
|
860
|
-
value: 'free',
|
|
861
|
-
},
|
|
862
|
-
{
|
|
863
|
-
label: 'Busy',
|
|
864
|
-
value: 'busy',
|
|
865
|
-
},
|
|
866
|
-
],
|
|
867
|
-
},
|
|
868
|
-
}),
|
|
869
|
-
note: pieces_framework_1.Property.LongText({
|
|
870
|
-
displayName: 'Note',
|
|
871
|
-
required: false,
|
|
872
|
-
}),
|
|
873
|
-
publicDescription: pieces_framework_1.Property.LongText({
|
|
874
|
-
displayName: 'Public Description',
|
|
875
|
-
required: false,
|
|
876
|
-
}),
|
|
877
|
-
};
|
|
878
|
-
// Helper function for custom fields property definition
|
|
879
|
-
function customFieldsProp(objectType) {
|
|
880
|
-
return pieces_framework_1.Property.DynamicProperties({
|
|
881
|
-
auth: auth_1.pipedriveAuth,
|
|
882
|
-
displayName: 'Custom Fields',
|
|
883
|
-
required: false,
|
|
884
|
-
refreshers: [],
|
|
885
|
-
props: (_a) => tslib_1.__awaiter(this, [_a], void 0, function* ({ auth }) {
|
|
886
|
-
if (!auth)
|
|
887
|
-
return {};
|
|
888
|
-
const authValue = auth;
|
|
889
|
-
return yield retrieveObjectCustomProperties(authValue, objectType);
|
|
890
|
-
}),
|
|
891
|
-
});
|
|
892
|
-
}
|
|
893
|
-
//# sourceMappingURL=props.js.map
|