@activepieces/piece-pipedrive 0.0.0-pre1
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/README.md +7 -0
- package/package.json +17 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +22 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/add-person.action/add-person.action.d.ts +1 -0
- package/src/lib/actions/add-person.action/add-person.action.js +255 -0
- package/src/lib/actions/add-person.action/add-person.action.js.map +1 -0
- package/src/lib/common/index.d.ts +9 -0
- package/src/lib/common/index.js +45 -0
- package/src/lib/common/index.js.map +1 -0
- package/src/lib/trigger/new-activity.d.ts +1 -0
- package/src/lib/trigger/new-activity.js +123 -0
- package/src/lib/trigger/new-activity.js.map +1 -0
- package/src/lib/trigger/new-deal.d.ts +1 -0
- package/src/lib/trigger/new-deal.js +177 -0
- package/src/lib/trigger/new-deal.js.map +1 -0
- package/src/lib/trigger/new-person.d.ts +1 -0
- package/src/lib/trigger/new-person.js +127 -0
- package/src/lib/trigger/new-person.js.map +1 -0
- package/src/lib/trigger/updated-deal.d.ts +1 -0
- package/src/lib/trigger/updated-deal.js +177 -0
- package/src/lib/trigger/updated-deal.js.map +1 -0
- package/src/lib/trigger/updated-person.d.ts +1 -0
- package/src/lib/trigger/updated-person.js +127 -0
- package/src/lib/trigger/updated-person.js.map +1 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-pipedrive",
|
|
3
|
+
"version": "0.0.0-pre1",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@sinclair/typebox": "0.24.51",
|
|
6
|
+
"axios": "1.2.4",
|
|
7
|
+
"cron-validator": "1.3.1",
|
|
8
|
+
"nanoid": "3.3.4"
|
|
9
|
+
},
|
|
10
|
+
"peerDependencies": {
|
|
11
|
+
"@activepieces/framework": "0.0.1",
|
|
12
|
+
"@activepieces/shared": "0.0.1",
|
|
13
|
+
"tslib": "2.4.1"
|
|
14
|
+
},
|
|
15
|
+
"main": "./src/index.js",
|
|
16
|
+
"types": "./src/index.d.ts"
|
|
17
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pipedrive: import("@activepieces/framework").Piece;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pipedrive = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const package_json_1 = tslib_1.__importDefault(require("../package.json"));
|
|
6
|
+
const framework_1 = require("@activepieces/framework");
|
|
7
|
+
const add_person_action_1 = require("./lib/actions/add-person.action/add-person.action");
|
|
8
|
+
const new_person_1 = require("./lib/trigger/new-person");
|
|
9
|
+
const new_deal_1 = require("./lib/trigger/new-deal");
|
|
10
|
+
const new_activity_1 = require("./lib/trigger/new-activity");
|
|
11
|
+
const updated_person_1 = require("./lib/trigger/updated-person");
|
|
12
|
+
const updated_deal_1 = require("./lib/trigger/updated-deal");
|
|
13
|
+
exports.pipedrive = (0, framework_1.createPiece)({
|
|
14
|
+
name: 'pipedrive',
|
|
15
|
+
displayName: "Pipedrive",
|
|
16
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/pipedrive.png',
|
|
17
|
+
version: package_json_1.default.version,
|
|
18
|
+
actions: [add_person_action_1.addPerson],
|
|
19
|
+
authors: ['ashrafsamhouri'],
|
|
20
|
+
triggers: [new_person_1.newPerson, new_deal_1.newDeal, new_activity_1.newActivity, updated_person_1.updatedPerson, updated_deal_1.updatedDeal],
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/pipedrive/src/index.ts"],"names":[],"mappings":";;;;AAAA,2EAA0C;AAC1C,uDAAsD;AACtD,yFAA6E;AAC7E,yDAAoD;AACpD,qDAAgD;AAChD,6DAAwD;AACxD,iEAA4D;AAC5D,6DAAwD;AAE3C,QAAA,SAAS,GAAG,IAAA,uBAAW,EAAC;IACpC,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,WAAW;IACxB,OAAO,EAAE,mDAAmD;IAC3D,OAAO,EAAE,sBAAW,CAAC,OAAO;IAC7B,OAAO,EAAE,CAAC,6BAAS,CAAC;IACpB,OAAO,EAAE,CAAC,gBAAgB,CAAC;IAC3B,QAAQ,EAAE,CAAC,sBAAS,EAAE,kBAAO,EAAE,0BAAW,EAAE,8BAAa,EAAE,0BAAW,CAAC;CACvE,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const addPerson: import("@activepieces/framework").Action;
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addPerson = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const framework_1 = require("@activepieces/framework");
|
|
6
|
+
const common_1 = require("../../common");
|
|
7
|
+
exports.addPerson = (0, framework_1.createAction)({
|
|
8
|
+
name: 'add_person',
|
|
9
|
+
displayName: "Add Person",
|
|
10
|
+
description: "Add a new person to the account",
|
|
11
|
+
props: {
|
|
12
|
+
authentication: common_1.pipedriveCommon.authentication,
|
|
13
|
+
name: framework_1.Property.ShortText({
|
|
14
|
+
displayName: 'Name',
|
|
15
|
+
description: undefined,
|
|
16
|
+
required: true,
|
|
17
|
+
}),
|
|
18
|
+
owner_id: framework_1.Property.Dropdown({
|
|
19
|
+
displayName: "Owner",
|
|
20
|
+
refreshers: ["authentication"],
|
|
21
|
+
description: "The user who owns this Person's record",
|
|
22
|
+
required: false,
|
|
23
|
+
options: (propsValue) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
if (!propsValue['authentication']) {
|
|
25
|
+
return {
|
|
26
|
+
disabled: true,
|
|
27
|
+
options: [],
|
|
28
|
+
placeholder: "Connect your account"
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const authProp = propsValue['authentication'];
|
|
32
|
+
const users = (yield getUsers(authProp)).users;
|
|
33
|
+
return {
|
|
34
|
+
disabled: false,
|
|
35
|
+
options: users.map(u => {
|
|
36
|
+
return {
|
|
37
|
+
label: u.name,
|
|
38
|
+
value: u.id
|
|
39
|
+
};
|
|
40
|
+
})
|
|
41
|
+
};
|
|
42
|
+
})
|
|
43
|
+
}),
|
|
44
|
+
org_id: framework_1.Property.Dropdown({
|
|
45
|
+
displayName: "Organization",
|
|
46
|
+
refreshers: ["authentication"],
|
|
47
|
+
description: "The Org of this Person",
|
|
48
|
+
required: false,
|
|
49
|
+
options: (propsValue) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
50
|
+
if (!propsValue['authentication']) {
|
|
51
|
+
return {
|
|
52
|
+
disabled: true,
|
|
53
|
+
options: [],
|
|
54
|
+
placeholder: "Connect your account"
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const authProp = propsValue['authentication'];
|
|
58
|
+
const orgs = (yield getOrganizations(authProp)).orgs;
|
|
59
|
+
return {
|
|
60
|
+
disabled: false,
|
|
61
|
+
options: orgs.map(o => {
|
|
62
|
+
return {
|
|
63
|
+
label: o.name,
|
|
64
|
+
value: o.id
|
|
65
|
+
};
|
|
66
|
+
})
|
|
67
|
+
};
|
|
68
|
+
})
|
|
69
|
+
}),
|
|
70
|
+
email: framework_1.Property.ShortText({
|
|
71
|
+
displayName: 'Email',
|
|
72
|
+
description: undefined,
|
|
73
|
+
required: false,
|
|
74
|
+
}),
|
|
75
|
+
phone: framework_1.Property.ShortText({
|
|
76
|
+
displayName: 'Phone',
|
|
77
|
+
description: undefined,
|
|
78
|
+
required: false,
|
|
79
|
+
}),
|
|
80
|
+
marketing_status: framework_1.Property.StaticDropdown({
|
|
81
|
+
displayName: "Marketing Status",
|
|
82
|
+
description: "Marketing opt-in status",
|
|
83
|
+
required: false,
|
|
84
|
+
options: {
|
|
85
|
+
disabled: false,
|
|
86
|
+
options: [
|
|
87
|
+
{
|
|
88
|
+
label: "No Consent",
|
|
89
|
+
value: "no_consent"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
label: "Unsubscribed",
|
|
93
|
+
value: "unsubscribed"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
label: "Subscribed",
|
|
97
|
+
value: "subscribed"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
label: "Archived",
|
|
101
|
+
value: "archived"
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
}),
|
|
106
|
+
},
|
|
107
|
+
run(context) {
|
|
108
|
+
var _a, _b;
|
|
109
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
110
|
+
const configsWithoutAuthentication = Object.assign({}, context.propsValue);
|
|
111
|
+
delete configsWithoutAuthentication['authentication'];
|
|
112
|
+
const request = {
|
|
113
|
+
method: framework_1.HttpMethod.POST,
|
|
114
|
+
url: `${context.propsValue.authentication.data['api_domain']}/api/v1/persons`,
|
|
115
|
+
body: configsWithoutAuthentication,
|
|
116
|
+
authentication: {
|
|
117
|
+
type: framework_1.AuthenticationType.BEARER_TOKEN,
|
|
118
|
+
token: context.propsValue.authentication.access_token,
|
|
119
|
+
},
|
|
120
|
+
queryParams: {},
|
|
121
|
+
};
|
|
122
|
+
const result = yield framework_1.httpClient.sendRequest(request);
|
|
123
|
+
if ((_a = result.body) === null || _a === void 0 ? void 0 : _a['success']) {
|
|
124
|
+
return (_b = result.body) === null || _b === void 0 ? void 0 : _b["data"];
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
return result;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
},
|
|
131
|
+
sampleData: {
|
|
132
|
+
"id": 1,
|
|
133
|
+
"company_id": 12,
|
|
134
|
+
"owner_id": {
|
|
135
|
+
"id": 123,
|
|
136
|
+
"name": "Jane Doe",
|
|
137
|
+
"email": "jane@pipedrive.com",
|
|
138
|
+
"has_pic": 1,
|
|
139
|
+
"pic_hash": "2611ace8ac6a3afe2f69ed56f9e08c6b",
|
|
140
|
+
"active_flag": true,
|
|
141
|
+
"value": 123
|
|
142
|
+
},
|
|
143
|
+
"org_id": {
|
|
144
|
+
"name": "Org Name",
|
|
145
|
+
"people_count": 1,
|
|
146
|
+
"owner_id": 123,
|
|
147
|
+
"address": "Mustamäe tee 3a, 10615 Tallinn",
|
|
148
|
+
"active_flag": true,
|
|
149
|
+
"cc_email": "org@pipedrivemail.com",
|
|
150
|
+
"value": 1234
|
|
151
|
+
},
|
|
152
|
+
"name": "Will Smith",
|
|
153
|
+
"first_name": "Will",
|
|
154
|
+
"last_name": "Smith",
|
|
155
|
+
"open_deals_count": 2,
|
|
156
|
+
"related_open_deals_count": 2,
|
|
157
|
+
"closed_deals_count": 3,
|
|
158
|
+
"related_closed_deals_count": 3,
|
|
159
|
+
"participant_open_deals_count": 1,
|
|
160
|
+
"participant_closed_deals_count": 1,
|
|
161
|
+
"email_messages_count": 1,
|
|
162
|
+
"activities_count": 1,
|
|
163
|
+
"done_activities_count": 1,
|
|
164
|
+
"undone_activities_count": 2,
|
|
165
|
+
"files_count": 2,
|
|
166
|
+
"notes_count": 2,
|
|
167
|
+
"followers_count": 3,
|
|
168
|
+
"won_deals_count": 3,
|
|
169
|
+
"related_won_deals_count": 3,
|
|
170
|
+
"lost_deals_count": 1,
|
|
171
|
+
"related_lost_deals_count": 1,
|
|
172
|
+
"active_flag": true,
|
|
173
|
+
"phone": [
|
|
174
|
+
{
|
|
175
|
+
"value": "12345",
|
|
176
|
+
"primary": true,
|
|
177
|
+
"label": "work"
|
|
178
|
+
}
|
|
179
|
+
],
|
|
180
|
+
"email": [
|
|
181
|
+
{
|
|
182
|
+
"value": "12345@email.com",
|
|
183
|
+
"primary": true,
|
|
184
|
+
"label": "work"
|
|
185
|
+
}
|
|
186
|
+
],
|
|
187
|
+
"primary_email": "12345@email.com",
|
|
188
|
+
"first_char": "w",
|
|
189
|
+
"update_time": "2020-05-08 05:30:20",
|
|
190
|
+
"add_time": "2017-10-18 13:23:07",
|
|
191
|
+
"visible_to": "3",
|
|
192
|
+
"marketing_status": "no_consent",
|
|
193
|
+
"picture_id": {
|
|
194
|
+
"item_type": "person",
|
|
195
|
+
"item_id": 25,
|
|
196
|
+
"active_flag": true,
|
|
197
|
+
"add_time": "2020-09-08 08:17:52",
|
|
198
|
+
"update_time": "0000-00-00 00:00:00",
|
|
199
|
+
"added_by_user_id": 967055,
|
|
200
|
+
"pictures": {
|
|
201
|
+
"128": "https://pipedrive-profile-pics.s3.example.com/f8893852574273f2747bf6ef09d11cfb4ac8f269_128.jpg",
|
|
202
|
+
"512": "https://pipedrive-profile-pics.s3.example.com/f8893852574273f2747bf6ef09d11cfb4ac8f269_512.jpg"
|
|
203
|
+
},
|
|
204
|
+
"value": 4
|
|
205
|
+
},
|
|
206
|
+
"next_activity_date": "2019-11-29",
|
|
207
|
+
"next_activity_time": "11:30:00",
|
|
208
|
+
"next_activity_id": 128,
|
|
209
|
+
"last_activity_id": 34,
|
|
210
|
+
"last_activity_date": "2019-11-28",
|
|
211
|
+
"last_incoming_mail_time": "2019-05-29 18:21:42",
|
|
212
|
+
"last_outgoing_mail_time": "2019-05-30 03:45:35",
|
|
213
|
+
"label": 1,
|
|
214
|
+
"org_name": "Organization name",
|
|
215
|
+
"owner_name": "Jane Doe",
|
|
216
|
+
"cc_email": "org@pipedrivemail.com"
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
function getUsers(authProp) {
|
|
220
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
221
|
+
const request = {
|
|
222
|
+
method: framework_1.HttpMethod.GET,
|
|
223
|
+
url: `${authProp.data['api_domain']}/api/v1/users`,
|
|
224
|
+
authentication: {
|
|
225
|
+
type: framework_1.AuthenticationType.BEARER_TOKEN,
|
|
226
|
+
token: authProp.access_token,
|
|
227
|
+
},
|
|
228
|
+
queryParams: {},
|
|
229
|
+
};
|
|
230
|
+
const result = yield framework_1.httpClient.sendRequest(request);
|
|
231
|
+
return {
|
|
232
|
+
users: result.body['success'] && result.body['data'] != null ? result.body['data'] : []
|
|
233
|
+
};
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
function getOrganizations(authProp) {
|
|
237
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
238
|
+
const request = {
|
|
239
|
+
method: framework_1.HttpMethod.GET,
|
|
240
|
+
url: `${authProp.data['api_domain']}/api/v1/organizations`,
|
|
241
|
+
authentication: {
|
|
242
|
+
type: framework_1.AuthenticationType.BEARER_TOKEN,
|
|
243
|
+
token: authProp.access_token,
|
|
244
|
+
},
|
|
245
|
+
queryParams: {
|
|
246
|
+
limit: "500" // max limit is 500 (API restriction)
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
const result = yield framework_1.httpClient.sendRequest(request);
|
|
250
|
+
return {
|
|
251
|
+
orgs: result.body['success'] && result.body['data'] != null ? result.body['data'] : []
|
|
252
|
+
};
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
//# sourceMappingURL=add-person.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-person.action.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/pipedrive/src/lib/actions/add-person.action/add-person.action.ts"],"names":[],"mappings":";;;;AAAA,uDAA+I;AAC/I,yCAA+C;AAElC,QAAA,SAAS,GAAG,IAAA,wBAAY,EAAC;IAClC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,iCAAiC;IAC9C,KAAK,EAAE;QACH,cAAc,EAAE,wBAAe,CAAC,cAAc;QAC9C,IAAI,EAAE,oBAAQ,CAAC,SAAS,CAAC;YACrB,WAAW,EAAE,MAAM;YACnB,WAA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AAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAA0B,EAAE;SAClH,CAAC;IACN,CAAC;CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const pipedriveCommon: {
|
|
2
|
+
authentication: import("@activepieces/framework").OAuth2Property<true>;
|
|
3
|
+
subscribeWebhook: (object: string, action: string, webhookUrl: string, apiDomain: string, accessToken: string) => Promise<{
|
|
4
|
+
data: {
|
|
5
|
+
id: string;
|
|
6
|
+
};
|
|
7
|
+
}>;
|
|
8
|
+
unsubscribeWebhook: (webhookId: string, apiDomain: string, accessToken: string) => Promise<import("@activepieces/framework").HttpResponse<import("@activepieces/framework").HttpMessageBody>>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pipedriveCommon = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const framework_1 = require("@activepieces/framework");
|
|
6
|
+
exports.pipedriveCommon = {
|
|
7
|
+
authentication: framework_1.Property.OAuth2({
|
|
8
|
+
description: "",
|
|
9
|
+
displayName: 'Authentication',
|
|
10
|
+
authUrl: "https://oauth.pipedrive.com/oauth/authorize",
|
|
11
|
+
tokenUrl: "https://oauth.pipedrive.com/oauth/token",
|
|
12
|
+
required: true,
|
|
13
|
+
scope: ["admin", "contacts:full", "users:read"]
|
|
14
|
+
}),
|
|
15
|
+
subscribeWebhook: (object, action, webhookUrl, apiDomain, accessToken) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
const request = {
|
|
17
|
+
method: framework_1.HttpMethod.POST,
|
|
18
|
+
url: `${apiDomain}/api/v1/webhooks`,
|
|
19
|
+
body: {
|
|
20
|
+
event_object: object,
|
|
21
|
+
event_action: action,
|
|
22
|
+
subscription_url: webhookUrl,
|
|
23
|
+
},
|
|
24
|
+
authentication: {
|
|
25
|
+
type: framework_1.AuthenticationType.BEARER_TOKEN,
|
|
26
|
+
token: accessToken,
|
|
27
|
+
},
|
|
28
|
+
queryParams: {},
|
|
29
|
+
};
|
|
30
|
+
const { body: webhook } = yield framework_1.httpClient.sendRequest(request);
|
|
31
|
+
return webhook;
|
|
32
|
+
}),
|
|
33
|
+
unsubscribeWebhook: (webhookId, apiDomain, accessToken) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
34
|
+
const request = {
|
|
35
|
+
method: framework_1.HttpMethod.DELETE,
|
|
36
|
+
url: `${apiDomain}/api/v1/webhooks/${webhookId}`,
|
|
37
|
+
authentication: {
|
|
38
|
+
type: framework_1.AuthenticationType.BEARER_TOKEN,
|
|
39
|
+
token: accessToken,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
return yield framework_1.httpClient.sendRequest(request);
|
|
43
|
+
})
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/pipedrive/src/lib/common/index.ts"],"names":[],"mappings":";;;;AAAA,uDAA4G;AAE/F,QAAA,eAAe,GAAG;IAC3B,cAAc,EAAE,oBAAQ,CAAC,MAAM,CAAC;QAC5B,WAAW,EAAE,EAAE;QACf,WAAW,EAAE,gBAAgB;QAC7B,OAAO,EAAE,6CAA6C;QACtD,QAAQ,EAAE,yCAAyC;QACnD,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,YAAY,CAAC;KAClD,CAAC;IACF,gBAAgB,EAAE,CAAO,MAAc,EAAE,MAAc,EAAE,UAAkB,EAAE,SAAiB,EAAE,WAAmB,EAAE,EAAE;QACnH,MAAM,OAAO,GAAgB;YACzB,MAAM,EAAE,sBAAU,CAAC,IAAI;YACvB,GAAG,EAAE,GAAG,SAAS,kBAAkB;YACnC,IAAI,EAAE;gBACF,YAAY,EAAE,MAAM;gBACpB,YAAY,EAAE,MAAM;gBACpB,gBAAgB,EAAE,UAAU;aAC/B;YACD,cAAc,EAAE;gBACZ,IAAI,EAAE,8BAAkB,CAAC,YAAY;gBACrC,KAAK,EAAE,WAAW;aACrB;YACD,WAAW,EAAE,EAAE;SAClB,CAAC;QAEF,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,sBAAU,CAAC,WAAW,CAA2B,OAAO,CAAC,CAAC;QAC1F,OAAO,OAAO,CAAC;IACnB,CAAC,CAAA;IACD,kBAAkB,EAAE,CAAO,SAAiB,EAAE,SAAiB,EAAE,WAAmB,EAAE,EAAE;QACpF,MAAM,OAAO,GAAgB;YACzB,MAAM,EAAE,sBAAU,CAAC,MAAM;YACzB,GAAG,EAAE,GAAG,SAAS,oBAAoB,SAAS,EAAE;YAChD,cAAc,EAAE;gBACZ,IAAI,EAAE,8BAAkB,CAAC,YAAY;gBACrC,KAAK,EAAE,WAAW;aACrB;SACJ,CAAC;QACF,OAAO,MAAM,sBAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC,CAAA;CACJ,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const newActivity: import("@activepieces/framework").Trigger;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.newActivity = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const framework_1 = require("@activepieces/framework");
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
exports.newActivity = (0, framework_1.createTrigger)({
|
|
8
|
+
name: 'new_activity',
|
|
9
|
+
displayName: 'New Activity',
|
|
10
|
+
description: 'Triggers when a new activity is added',
|
|
11
|
+
props: {
|
|
12
|
+
authentication: common_1.pipedriveCommon.authentication,
|
|
13
|
+
},
|
|
14
|
+
type: framework_1.TriggerStrategy.WEBHOOK,
|
|
15
|
+
onEnable(context) {
|
|
16
|
+
var _a;
|
|
17
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const webhook = yield common_1.pipedriveCommon.subscribeWebhook('activity', 'added', context.webhookUrl, context.propsValue['authentication'].data['api_domain'], context.propsValue['authentication'].access_token);
|
|
19
|
+
yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.put('_new_activity_trigger', {
|
|
20
|
+
webhookId: webhook.data.id
|
|
21
|
+
}));
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
onDisable(context) {
|
|
25
|
+
var _a;
|
|
26
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const response = yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.get('_new_activity_trigger'));
|
|
28
|
+
if (response !== null && response !== undefined) {
|
|
29
|
+
yield common_1.pipedriveCommon.unsubscribeWebhook(response.webhookId, context.propsValue['authentication'].data['api_domain'], context.propsValue['authentication'].access_token);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
run(context) {
|
|
34
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
return [context.payload.body.current];
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
sampleData: {
|
|
39
|
+
"id": 8,
|
|
40
|
+
"company_id": 22122,
|
|
41
|
+
"user_id": 1234,
|
|
42
|
+
"done": false,
|
|
43
|
+
"type": "deadline",
|
|
44
|
+
"reference_type": "scheduler-service",
|
|
45
|
+
"reference_id": 7,
|
|
46
|
+
"conference_meeting_client": "871b8bc88d3a1202",
|
|
47
|
+
"conference_meeting_url": "https://pipedrive.zoom.us/link",
|
|
48
|
+
"conference_meeting_id": "01758746701",
|
|
49
|
+
"due_date": "2020-06-09",
|
|
50
|
+
"due_time": "10:00",
|
|
51
|
+
"duration": "01:00",
|
|
52
|
+
"busy_flag": true,
|
|
53
|
+
"add_time": "2020-06-08 12:37:56",
|
|
54
|
+
"marked_as_done_time": "2020-08-08 08:08:38",
|
|
55
|
+
"last_notification_time": "2020-08-08 12:37:56",
|
|
56
|
+
"last_notification_user_id": 7655,
|
|
57
|
+
"notification_language_id": 1,
|
|
58
|
+
"subject": "Deadline",
|
|
59
|
+
"public_description": "This is a description",
|
|
60
|
+
"calendar_sync_include_context": "",
|
|
61
|
+
"location": "Mustamäe tee 3, Tallinn, Estonia",
|
|
62
|
+
"org_id": 5,
|
|
63
|
+
"person_id": 1101,
|
|
64
|
+
"deal_id": 300,
|
|
65
|
+
"lead_id": "46c3b0e1-db35-59ca-1828-4817378dff71",
|
|
66
|
+
"active_flag": true,
|
|
67
|
+
"update_time": "2020-08-08 12:37:56",
|
|
68
|
+
"update_user_id": 5596,
|
|
69
|
+
"gcal_event_id": "",
|
|
70
|
+
"google_calendar_id": "",
|
|
71
|
+
"google_calendar_etag": "",
|
|
72
|
+
"source_timezone": "",
|
|
73
|
+
"rec_rule": "RRULE:FREQ=WEEKLY;BYDAY=WE",
|
|
74
|
+
"rec_rule_extension": "",
|
|
75
|
+
"rec_master_activity_id": 1,
|
|
76
|
+
"series": [],
|
|
77
|
+
"note": "A note for the activity",
|
|
78
|
+
"created_by_user_id": 1234,
|
|
79
|
+
"location_subpremise": "",
|
|
80
|
+
"location_street_number": "3",
|
|
81
|
+
"location_route": "Mustamäe tee",
|
|
82
|
+
"location_sublocality": "Kristiine",
|
|
83
|
+
"location_locality": "Tallinn",
|
|
84
|
+
"location_admin_area_level_1": "Harju maakond",
|
|
85
|
+
"location_admin_area_level_2": "",
|
|
86
|
+
"location_country": "Estonia",
|
|
87
|
+
"location_postal_code": "10616",
|
|
88
|
+
"location_formatted_address": "Mustamäe tee 3, 10616 Tallinn, Estonia",
|
|
89
|
+
"attendees": [
|
|
90
|
+
{
|
|
91
|
+
"email_address": "attendee@pipedrivemail.com",
|
|
92
|
+
"is_organizer": 0,
|
|
93
|
+
"name": "Attendee",
|
|
94
|
+
"person_id": 25312,
|
|
95
|
+
"status": "noreply",
|
|
96
|
+
"user_id": null
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
"participants": [
|
|
100
|
+
{
|
|
101
|
+
"person_id": 17985,
|
|
102
|
+
"primary_flag": false
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"person_id": 1101,
|
|
106
|
+
"primary_flag": true
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"org_name": "Organization",
|
|
110
|
+
"person_name": "Person",
|
|
111
|
+
"deal_title": "Deal",
|
|
112
|
+
"owner_name": "Creator",
|
|
113
|
+
"person_dropbox_bcc": "company@pipedrivemail.com",
|
|
114
|
+
"deal_dropbox_bcc": "company+deal300@pipedrivemail.com",
|
|
115
|
+
"assigned_to_user_id": 1235,
|
|
116
|
+
"file": {
|
|
117
|
+
"id": "376892,",
|
|
118
|
+
"clean_name": "Audio 10:55:07.m4a",
|
|
119
|
+
"url": "https://pipedrive-files.s3-eu-west-1.amazonaws.com/Audio-recording.m4a"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
//# sourceMappingURL=new-activity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-activity.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/pipedrive/src/lib/trigger/new-activity.ts"],"names":[],"mappings":";;;;AAAA,uDAAyE;AACzE,sCAA4C;AAE/B,QAAA,WAAW,GAAG,IAAA,yBAAa,EAAC;IACvC,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,uCAAuC;IACpD,KAAK,EAAE;QACL,cAAc,EAAE,wBAAe,CAAC,cAAc;KAC/C;IACD,IAAI,EAAE,2BAAe,CAAC,OAAO;IACvB,QAAQ,CAAC,OAAO;;;YACpB,MAAM,OAAO,GAAG,MAAM,wBAAe,CAAC,gBAAgB,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,UAAW,EAAE,OAAO,CAAC,UAAU,CAAC,gBAAgB,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E,cAAc;QAC1B,aAAa,EAAE,QAAQ;QACvB,YAAY,EAAE,MAAM;QACpB,YAAY,EAAE,SAAS;QACvB,oBAAoB,EAAE,2BAA2B;QACjD,kBAAkB,EAAE,mCAAmC;QACvD,qBAAqB,EAAE,IAAI;QAC3B,MAAM,EAAE;YACN,IAAI,EAAE,SAAS;YACf,YAAY,EAAE,oBAAoB;YAClC,KAAK,EAAE,wEAAwE;SAChF;KACF;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const newDeal: import("@activepieces/framework").Trigger;
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.newDeal = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const framework_1 = require("@activepieces/framework");
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
exports.newDeal = (0, framework_1.createTrigger)({
|
|
8
|
+
name: 'new_deal',
|
|
9
|
+
displayName: 'New Deal',
|
|
10
|
+
description: 'Triggers when a new deal is created',
|
|
11
|
+
props: {
|
|
12
|
+
authentication: common_1.pipedriveCommon.authentication,
|
|
13
|
+
},
|
|
14
|
+
type: framework_1.TriggerStrategy.WEBHOOK,
|
|
15
|
+
onEnable(context) {
|
|
16
|
+
var _a;
|
|
17
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const webhook = yield common_1.pipedriveCommon.subscribeWebhook('deal', 'added', context.webhookUrl, context.propsValue['authentication'].data['api_domain'], context.propsValue['authentication'].access_token);
|
|
19
|
+
yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.put('_new_deal_trigger', {
|
|
20
|
+
webhookId: webhook.data.id
|
|
21
|
+
}));
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
onDisable(context) {
|
|
25
|
+
var _a;
|
|
26
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const response = yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.get('_new_deal_trigger'));
|
|
28
|
+
if (response !== null && response !== undefined) {
|
|
29
|
+
yield common_1.pipedriveCommon.unsubscribeWebhook(response.webhookId, context.propsValue['authentication'].data['api_domain'], context.propsValue['authentication'].access_token);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
run(context) {
|
|
34
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
return [context.payload.body.current];
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
sampleData: {
|
|
39
|
+
"id": 1,
|
|
40
|
+
"creator_user_id": {
|
|
41
|
+
"id": 8877,
|
|
42
|
+
"name": "Creator",
|
|
43
|
+
"email": "john.doe@pipedrive.com",
|
|
44
|
+
"has_pic": false,
|
|
45
|
+
"pic_hash": null,
|
|
46
|
+
"active_flag": true,
|
|
47
|
+
"value": 8877
|
|
48
|
+
},
|
|
49
|
+
"user_id": {
|
|
50
|
+
"id": 8877,
|
|
51
|
+
"name": "Creator",
|
|
52
|
+
"email": "john.doe@pipedrive.com",
|
|
53
|
+
"has_pic": false,
|
|
54
|
+
"pic_hash": null,
|
|
55
|
+
"active_flag": true,
|
|
56
|
+
"value": 8877
|
|
57
|
+
},
|
|
58
|
+
"person_id": {
|
|
59
|
+
"active_flag": true,
|
|
60
|
+
"name": "Person",
|
|
61
|
+
"email": [
|
|
62
|
+
{
|
|
63
|
+
"label": "work",
|
|
64
|
+
"value": "person@pipedrive.com",
|
|
65
|
+
"primary": true
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"phone": [
|
|
69
|
+
{
|
|
70
|
+
"label": "work",
|
|
71
|
+
"value": "37244499911",
|
|
72
|
+
"primary": true
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"value": 1101
|
|
76
|
+
},
|
|
77
|
+
"org_id": {
|
|
78
|
+
"name": "Organization",
|
|
79
|
+
"people_count": 2,
|
|
80
|
+
"owner_id": 8877,
|
|
81
|
+
"address": "",
|
|
82
|
+
"active_flag": true,
|
|
83
|
+
"cc_email": "org@pipedrivemail.com",
|
|
84
|
+
"value": 5
|
|
85
|
+
},
|
|
86
|
+
"stage_id": 2,
|
|
87
|
+
"title": "Deal One",
|
|
88
|
+
"value": 5000,
|
|
89
|
+
"currency": "EUR",
|
|
90
|
+
"add_time": "2019-05-29 04:21:51",
|
|
91
|
+
"update_time": "2019-11-28 16:19:50",
|
|
92
|
+
"stage_change_time": "2019-11-28 15:41:22",
|
|
93
|
+
"active": true,
|
|
94
|
+
"deleted": false,
|
|
95
|
+
"status": "open",
|
|
96
|
+
"probability": null,
|
|
97
|
+
"next_activity_date": "2019-11-29",
|
|
98
|
+
"next_activity_time": "11:30:00",
|
|
99
|
+
"next_activity_id": 128,
|
|
100
|
+
"last_activity_id": null,
|
|
101
|
+
"last_activity_date": null,
|
|
102
|
+
"lost_reason": null,
|
|
103
|
+
"visible_to": "1",
|
|
104
|
+
"close_time": null,
|
|
105
|
+
"pipeline_id": 1,
|
|
106
|
+
"won_time": "2019-11-27 11:40:36",
|
|
107
|
+
"first_won_time": "2019-11-27 11:40:36",
|
|
108
|
+
"lost_time": "",
|
|
109
|
+
"products_count": 0,
|
|
110
|
+
"files_count": 0,
|
|
111
|
+
"notes_count": 2,
|
|
112
|
+
"followers_count": 0,
|
|
113
|
+
"email_messages_count": 4,
|
|
114
|
+
"activities_count": 1,
|
|
115
|
+
"done_activities_count": 0,
|
|
116
|
+
"undone_activities_count": 1,
|
|
117
|
+
"participants_count": 1,
|
|
118
|
+
"expected_close_date": "2019-06-29",
|
|
119
|
+
"last_incoming_mail_time": "2019-05-29 18:21:42",
|
|
120
|
+
"last_outgoing_mail_time": "2019-05-30 03:45:35",
|
|
121
|
+
"label": 11,
|
|
122
|
+
"stage_order_nr": 2,
|
|
123
|
+
"person_name": "Person",
|
|
124
|
+
"org_name": "Organization",
|
|
125
|
+
"next_activity_subject": "Call",
|
|
126
|
+
"next_activity_type": "call",
|
|
127
|
+
"next_activity_duration": "00:30:00",
|
|
128
|
+
"next_activity_note": "Note content",
|
|
129
|
+
"formatted_value": "€5,000",
|
|
130
|
+
"weighted_value": 5000,
|
|
131
|
+
"formatted_weighted_value": "€5,000",
|
|
132
|
+
"weighted_value_currency": "EUR",
|
|
133
|
+
"rotten_time": null,
|
|
134
|
+
"owner_name": "Creator",
|
|
135
|
+
"cc_email": "company+deal1@pipedrivemail.com",
|
|
136
|
+
"org_hidden": false,
|
|
137
|
+
"person_hidden": false,
|
|
138
|
+
"average_time_to_won": {
|
|
139
|
+
"y": 0,
|
|
140
|
+
"m": 0,
|
|
141
|
+
"d": 0,
|
|
142
|
+
"h": 0,
|
|
143
|
+
"i": 20,
|
|
144
|
+
"s": 49,
|
|
145
|
+
"total_seconds": 1249
|
|
146
|
+
},
|
|
147
|
+
"average_stage_progress": 4.99,
|
|
148
|
+
"age": {
|
|
149
|
+
"y": 0,
|
|
150
|
+
"m": 6,
|
|
151
|
+
"d": 14,
|
|
152
|
+
"h": 8,
|
|
153
|
+
"i": 57,
|
|
154
|
+
"s": 26,
|
|
155
|
+
"total_seconds": 17139446
|
|
156
|
+
},
|
|
157
|
+
"stay_in_pipeline_stages": {
|
|
158
|
+
"times_in_stages": {
|
|
159
|
+
"1": 15721267,
|
|
160
|
+
"2": 1288449,
|
|
161
|
+
"3": 4368,
|
|
162
|
+
"4": 3315,
|
|
163
|
+
"5": 26460
|
|
164
|
+
},
|
|
165
|
+
"order_of_stages": [
|
|
166
|
+
1,
|
|
167
|
+
2,
|
|
168
|
+
3,
|
|
169
|
+
4,
|
|
170
|
+
5
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
"last_activity": null,
|
|
174
|
+
"next_activity": null
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
//# sourceMappingURL=new-deal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-deal.js","sourceRoot":"","sources":["../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P,eAAe,EAAE,IAAI;SACtB;QACD,wBAAwB,EAAE,IAAI;QAC9B,KAAK,EAAE;YACL,GAAG,EAAE,CAAC;YACN,GAAG,EAAE,CAAC;YACN,GAAG,EAAE,EAAE;YACP,GAAG,EAAE,CAAC;YACN,GAAG,EAAE,EAAE;YACP,GAAG,EAAE,EAAE;YACP,eAAe,EAAE,QAAQ;SAC1B;QACD,yBAAyB,EAAE;YACzB,iBAAiB,EAAE;gBACjB,GAAG,EAAE,QAAQ;gBACb,GAAG,EAAE,OAAO;gBACZ,GAAG,EAAE,IAAI;gBACT,GAAG,EAAE,IAAI;gBACT,GAAG,EAAE,KAAK;aACX;YACD,iBAAiB,EAAE;gBACjB,CAAC;gBACD,CAAC;gBACD,CAAC;gBACD,CAAC;gBACD,CAAC;aACF;SACF;QACD,eAAe,EAAE,IAAI;QACrB,eAAe,EAAE,IAAI;KACtB;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const newPerson: import("@activepieces/framework").Trigger;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.newPerson = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const framework_1 = require("@activepieces/framework");
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
exports.newPerson = (0, framework_1.createTrigger)({
|
|
8
|
+
name: 'new_person',
|
|
9
|
+
displayName: 'New Person',
|
|
10
|
+
description: 'Triggers when a new person is created',
|
|
11
|
+
props: {
|
|
12
|
+
authentication: common_1.pipedriveCommon.authentication,
|
|
13
|
+
},
|
|
14
|
+
type: framework_1.TriggerStrategy.WEBHOOK,
|
|
15
|
+
onEnable(context) {
|
|
16
|
+
var _a;
|
|
17
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const webhook = yield common_1.pipedriveCommon.subscribeWebhook('person', 'added', context.webhookUrl, context.propsValue['authentication'].data['api_domain'], context.propsValue['authentication'].access_token);
|
|
19
|
+
yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.put('_new_person_trigger', {
|
|
20
|
+
webhookId: webhook.data.id
|
|
21
|
+
}));
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
onDisable(context) {
|
|
25
|
+
var _a;
|
|
26
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const response = yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.get('_new_person_trigger'));
|
|
28
|
+
if (response !== null && response !== undefined) {
|
|
29
|
+
yield common_1.pipedriveCommon.unsubscribeWebhook(response.webhookId, context.propsValue['authentication'].data['api_domain'], context.propsValue['authentication'].access_token);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
run(context) {
|
|
34
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
// Pipedrive will always return a list of Persons even if we are looking up a specific person
|
|
36
|
+
return [context.payload.body.current];
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
sampleData: {
|
|
40
|
+
"id": 1,
|
|
41
|
+
"company_id": 12,
|
|
42
|
+
"owner_id": {
|
|
43
|
+
"id": 123,
|
|
44
|
+
"name": "Jane Doe",
|
|
45
|
+
"email": "jane@pipedrive.com",
|
|
46
|
+
"has_pic": 1,
|
|
47
|
+
"pic_hash": "2611ace8ac6a3afe2f69ed56f9e08c6b",
|
|
48
|
+
"active_flag": true,
|
|
49
|
+
"value": 123
|
|
50
|
+
},
|
|
51
|
+
"org_id": {
|
|
52
|
+
"name": "Org Name",
|
|
53
|
+
"people_count": 1,
|
|
54
|
+
"owner_id": 123,
|
|
55
|
+
"address": "Mustamäe tee 3a, 10615 Tallinn",
|
|
56
|
+
"active_flag": true,
|
|
57
|
+
"cc_email": "org@pipedrivemail.com",
|
|
58
|
+
"value": 1234
|
|
59
|
+
},
|
|
60
|
+
"name": "Will Smith",
|
|
61
|
+
"first_name": "Will",
|
|
62
|
+
"last_name": "Smith",
|
|
63
|
+
"open_deals_count": 2,
|
|
64
|
+
"related_open_deals_count": 2,
|
|
65
|
+
"closed_deals_count": 3,
|
|
66
|
+
"related_closed_deals_count": 3,
|
|
67
|
+
"participant_open_deals_count": 1,
|
|
68
|
+
"participant_closed_deals_count": 1,
|
|
69
|
+
"email_messages_count": 1,
|
|
70
|
+
"activities_count": 1,
|
|
71
|
+
"done_activities_count": 1,
|
|
72
|
+
"undone_activities_count": 2,
|
|
73
|
+
"files_count": 2,
|
|
74
|
+
"notes_count": 2,
|
|
75
|
+
"followers_count": 3,
|
|
76
|
+
"won_deals_count": 3,
|
|
77
|
+
"related_won_deals_count": 3,
|
|
78
|
+
"lost_deals_count": 1,
|
|
79
|
+
"related_lost_deals_count": 1,
|
|
80
|
+
"active_flag": true,
|
|
81
|
+
"phone": [
|
|
82
|
+
{
|
|
83
|
+
"value": "12345",
|
|
84
|
+
"primary": true,
|
|
85
|
+
"label": "work"
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"email": [
|
|
89
|
+
{
|
|
90
|
+
"value": "12345@email.com",
|
|
91
|
+
"primary": true,
|
|
92
|
+
"label": "work"
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
"primary_email": "12345@email.com",
|
|
96
|
+
"first_char": "w",
|
|
97
|
+
"update_time": "2020-05-08 05:30:20",
|
|
98
|
+
"add_time": "2017-10-18 13:23:07",
|
|
99
|
+
"visible_to": "3",
|
|
100
|
+
"marketing_status": "no_consent",
|
|
101
|
+
"picture_id": {
|
|
102
|
+
"item_type": "person",
|
|
103
|
+
"item_id": 25,
|
|
104
|
+
"active_flag": true,
|
|
105
|
+
"add_time": "2020-09-08 08:17:52",
|
|
106
|
+
"update_time": "0000-00-00 00:00:00",
|
|
107
|
+
"added_by_user_id": 967055,
|
|
108
|
+
"pictures": {
|
|
109
|
+
"128": "https://pipedrive-profile-pics.s3.example.com/f8893852574273f2747bf6ef09d11cfb4ac8f269_128.jpg",
|
|
110
|
+
"512": "https://pipedrive-profile-pics.s3.example.com/f8893852574273f2747bf6ef09d11cfb4ac8f269_512.jpg"
|
|
111
|
+
},
|
|
112
|
+
"value": 4
|
|
113
|
+
},
|
|
114
|
+
"next_activity_date": "2019-11-29",
|
|
115
|
+
"next_activity_time": "11:30:00",
|
|
116
|
+
"next_activity_id": 128,
|
|
117
|
+
"last_activity_id": 34,
|
|
118
|
+
"last_activity_date": "2019-11-28",
|
|
119
|
+
"last_incoming_mail_time": "2019-05-29 18:21:42",
|
|
120
|
+
"last_outgoing_mail_time": "2019-05-30 03:45:35",
|
|
121
|
+
"label": 1,
|
|
122
|
+
"org_name": "Organization name",
|
|
123
|
+
"owner_name": "Jane Doe",
|
|
124
|
+
"cc_email": "org@pipedrivemail.com"
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
//# sourceMappingURL=new-person.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-person.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/pipedrive/src/lib/trigger/new-person.ts"],"names":[],"mappings":";;;;AAAA,uDAAyE;AACzE,sCAA4C;AAE/B,QAAA,SAAS,GAAG,IAAA,yBAAa,EAAC;IACrC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,uCAAuC;IACpD,KAAK,EAAE;QACL,cAAc,EAAE,wBAAe,CAAC,cAAc;KAC/C;IACD,IAAI,EAAE,2BAAe,CAAC,OAAO;IACvB,QAAQ,CAAC,OAAO;;;YACpB,MAAM,OAAO,GAAG,MAAM,wBAAe,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,UAAW,EAAE,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAE,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAE,CAAC,YAAY,CAAC,CAAC;YAC7M,MAAM,C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;QAClC,yBAAyB,EAAE,qBAAqB;QAChD,yBAAyB,EAAE,qBAAqB;QAChD,OAAO,EAAE,CAAC;QACV,UAAU,EAAE,mBAAmB;QAC/B,YAAY,EAAE,UAAU;QACxB,UAAU,EAAE,uBAAuB;KACpC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const updatedDeal: import("@activepieces/framework").Trigger;
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updatedDeal = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const framework_1 = require("@activepieces/framework");
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
exports.updatedDeal = (0, framework_1.createTrigger)({
|
|
8
|
+
name: 'updated_deal',
|
|
9
|
+
displayName: 'Updated Deal',
|
|
10
|
+
description: 'Triggers when a deal is updated',
|
|
11
|
+
props: {
|
|
12
|
+
authentication: common_1.pipedriveCommon.authentication,
|
|
13
|
+
},
|
|
14
|
+
type: framework_1.TriggerStrategy.WEBHOOK,
|
|
15
|
+
onEnable(context) {
|
|
16
|
+
var _a;
|
|
17
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const webhook = yield common_1.pipedriveCommon.subscribeWebhook('deal', 'updated', context.webhookUrl, context.propsValue['authentication'].data['api_domain'], context.propsValue['authentication'].access_token);
|
|
19
|
+
yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.put('_updated_deal_trigger', {
|
|
20
|
+
webhookId: webhook.data.id
|
|
21
|
+
}));
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
onDisable(context) {
|
|
25
|
+
var _a;
|
|
26
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const response = yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.get('_updated_deal_trigger'));
|
|
28
|
+
if (response !== null && response !== undefined) {
|
|
29
|
+
yield common_1.pipedriveCommon.unsubscribeWebhook(response.webhookId, context.propsValue['authentication'].data['api_domain'], context.propsValue['authentication'].access_token);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
run(context) {
|
|
34
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
return [context.payload.body.current];
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
sampleData: {
|
|
39
|
+
"id": 1,
|
|
40
|
+
"creator_user_id": {
|
|
41
|
+
"id": 8877,
|
|
42
|
+
"name": "Creator",
|
|
43
|
+
"email": "john.doe@pipedrive.com",
|
|
44
|
+
"has_pic": false,
|
|
45
|
+
"pic_hash": null,
|
|
46
|
+
"active_flag": true,
|
|
47
|
+
"value": 8877
|
|
48
|
+
},
|
|
49
|
+
"user_id": {
|
|
50
|
+
"id": 8877,
|
|
51
|
+
"name": "Creator",
|
|
52
|
+
"email": "john.doe@pipedrive.com",
|
|
53
|
+
"has_pic": false,
|
|
54
|
+
"pic_hash": null,
|
|
55
|
+
"active_flag": true,
|
|
56
|
+
"value": 8877
|
|
57
|
+
},
|
|
58
|
+
"person_id": {
|
|
59
|
+
"active_flag": true,
|
|
60
|
+
"name": "Person",
|
|
61
|
+
"email": [
|
|
62
|
+
{
|
|
63
|
+
"label": "work",
|
|
64
|
+
"value": "person@pipedrive.com",
|
|
65
|
+
"primary": true
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"phone": [
|
|
69
|
+
{
|
|
70
|
+
"label": "work",
|
|
71
|
+
"value": "37244499911",
|
|
72
|
+
"primary": true
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"value": 1101
|
|
76
|
+
},
|
|
77
|
+
"org_id": {
|
|
78
|
+
"name": "Organization",
|
|
79
|
+
"people_count": 2,
|
|
80
|
+
"owner_id": 8877,
|
|
81
|
+
"address": "",
|
|
82
|
+
"active_flag": true,
|
|
83
|
+
"cc_email": "org@pipedrivemail.com",
|
|
84
|
+
"value": 5
|
|
85
|
+
},
|
|
86
|
+
"stage_id": 2,
|
|
87
|
+
"title": "Deal One",
|
|
88
|
+
"value": 5000,
|
|
89
|
+
"currency": "EUR",
|
|
90
|
+
"add_time": "2019-05-29 04:21:51",
|
|
91
|
+
"update_time": "2019-11-28 16:19:50",
|
|
92
|
+
"stage_change_time": "2019-11-28 15:41:22",
|
|
93
|
+
"active": true,
|
|
94
|
+
"deleted": false,
|
|
95
|
+
"status": "open",
|
|
96
|
+
"probability": null,
|
|
97
|
+
"next_activity_date": "2019-11-29",
|
|
98
|
+
"next_activity_time": "11:30:00",
|
|
99
|
+
"next_activity_id": 128,
|
|
100
|
+
"last_activity_id": null,
|
|
101
|
+
"last_activity_date": null,
|
|
102
|
+
"lost_reason": null,
|
|
103
|
+
"visible_to": "1",
|
|
104
|
+
"close_time": null,
|
|
105
|
+
"pipeline_id": 1,
|
|
106
|
+
"won_time": "2019-11-27 11:40:36",
|
|
107
|
+
"first_won_time": "2019-11-27 11:40:36",
|
|
108
|
+
"lost_time": "",
|
|
109
|
+
"products_count": 0,
|
|
110
|
+
"files_count": 0,
|
|
111
|
+
"notes_count": 2,
|
|
112
|
+
"followers_count": 0,
|
|
113
|
+
"email_messages_count": 4,
|
|
114
|
+
"activities_count": 1,
|
|
115
|
+
"done_activities_count": 0,
|
|
116
|
+
"undone_activities_count": 1,
|
|
117
|
+
"participants_count": 1,
|
|
118
|
+
"expected_close_date": "2019-06-29",
|
|
119
|
+
"last_incoming_mail_time": "2019-05-29 18:21:42",
|
|
120
|
+
"last_outgoing_mail_time": "2019-05-30 03:45:35",
|
|
121
|
+
"label": 11,
|
|
122
|
+
"stage_order_nr": 2,
|
|
123
|
+
"person_name": "Person",
|
|
124
|
+
"org_name": "Organization",
|
|
125
|
+
"next_activity_subject": "Call",
|
|
126
|
+
"next_activity_type": "call",
|
|
127
|
+
"next_activity_duration": "00:30:00",
|
|
128
|
+
"next_activity_note": "Note content",
|
|
129
|
+
"formatted_value": "€5,000",
|
|
130
|
+
"weighted_value": 5000,
|
|
131
|
+
"formatted_weighted_value": "€5,000",
|
|
132
|
+
"weighted_value_currency": "EUR",
|
|
133
|
+
"rotten_time": null,
|
|
134
|
+
"owner_name": "Creator",
|
|
135
|
+
"cc_email": "company+deal1@pipedrivemail.com",
|
|
136
|
+
"org_hidden": false,
|
|
137
|
+
"person_hidden": false,
|
|
138
|
+
"average_time_to_won": {
|
|
139
|
+
"y": 0,
|
|
140
|
+
"m": 0,
|
|
141
|
+
"d": 0,
|
|
142
|
+
"h": 0,
|
|
143
|
+
"i": 20,
|
|
144
|
+
"s": 49,
|
|
145
|
+
"total_seconds": 1249
|
|
146
|
+
},
|
|
147
|
+
"average_stage_progress": 4.99,
|
|
148
|
+
"age": {
|
|
149
|
+
"y": 0,
|
|
150
|
+
"m": 6,
|
|
151
|
+
"d": 14,
|
|
152
|
+
"h": 8,
|
|
153
|
+
"i": 57,
|
|
154
|
+
"s": 26,
|
|
155
|
+
"total_seconds": 17139446
|
|
156
|
+
},
|
|
157
|
+
"stay_in_pipeline_stages": {
|
|
158
|
+
"times_in_stages": {
|
|
159
|
+
"1": 15721267,
|
|
160
|
+
"2": 1288449,
|
|
161
|
+
"3": 4368,
|
|
162
|
+
"4": 3315,
|
|
163
|
+
"5": 26460
|
|
164
|
+
},
|
|
165
|
+
"order_of_stages": [
|
|
166
|
+
1,
|
|
167
|
+
2,
|
|
168
|
+
3,
|
|
169
|
+
4,
|
|
170
|
+
5
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
"last_activity": null,
|
|
174
|
+
"next_activity": null
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
//# sourceMappingURL=updated-deal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updated-deal.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/pipedrive/src/lib/trigger/updated-deal.ts"],"names":[],"mappings":";;;;AAAA,uDAAyE;AACzE,sCAA4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E,CAAC;YACN,GAAG,EAAE,CAAC;YACN,GAAG,EAAE,EAAE;YACP,GAAG,EAAE,CAAC;YACN,GAAG,EAAE,EAAE;YACP,GAAG,EAAE,EAAE;YACP,eAAe,EAAE,QAAQ;SAC1B;QACD,yBAAyB,EAAE;YACzB,iBAAiB,EAAE;gBACjB,GAAG,EAAE,QAAQ;gBACb,GAAG,EAAE,OAAO;gBACZ,GAAG,EAAE,IAAI;gBACT,GAAG,EAAE,IAAI;gBACT,GAAG,EAAE,KAAK;aACX;YACD,iBAAiB,EAAE;gBACjB,CAAC;gBACD,CAAC;gBACD,CAAC;gBACD,CAAC;gBACD,CAAC;aACF;SACF;QACD,eAAe,EAAE,IAAI;QACrB,eAAe,EAAE,IAAI;KACtB;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const updatedPerson: import("@activepieces/framework").Trigger;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updatedPerson = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const framework_1 = require("@activepieces/framework");
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
exports.updatedPerson = (0, framework_1.createTrigger)({
|
|
8
|
+
name: 'updated_person',
|
|
9
|
+
displayName: 'Updated Person',
|
|
10
|
+
description: 'Triggers when a person is updated',
|
|
11
|
+
props: {
|
|
12
|
+
authentication: common_1.pipedriveCommon.authentication,
|
|
13
|
+
},
|
|
14
|
+
type: framework_1.TriggerStrategy.WEBHOOK,
|
|
15
|
+
onEnable(context) {
|
|
16
|
+
var _a;
|
|
17
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const webhook = yield common_1.pipedriveCommon.subscribeWebhook('person', 'updated', context.webhookUrl, context.propsValue['authentication'].data['api_domain'], context.propsValue['authentication'].access_token);
|
|
19
|
+
yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.put('_updated_person_trigger', {
|
|
20
|
+
webhookId: webhook.data.id
|
|
21
|
+
}));
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
onDisable(context) {
|
|
25
|
+
var _a;
|
|
26
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const response = yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.get('_updated_person_trigger'));
|
|
28
|
+
if (response !== null && response !== undefined) {
|
|
29
|
+
const webhook = yield common_1.pipedriveCommon.unsubscribeWebhook(response.webhookId, context.propsValue['authentication'].data['api_domain'], context.propsValue['authentication'].access_token);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
run(context) {
|
|
34
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
// Pipedrive will always return a list of Persons even if we are looking up a specific person
|
|
36
|
+
return [context.payload.body.current];
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
sampleData: {
|
|
40
|
+
"id": 1,
|
|
41
|
+
"company_id": 12,
|
|
42
|
+
"owner_id": {
|
|
43
|
+
"id": 123,
|
|
44
|
+
"name": "Jane Doe",
|
|
45
|
+
"email": "jane@pipedrive.com",
|
|
46
|
+
"has_pic": 1,
|
|
47
|
+
"pic_hash": "2611ace8ac6a3afe2f69ed56f9e08c6b",
|
|
48
|
+
"active_flag": true,
|
|
49
|
+
"value": 123
|
|
50
|
+
},
|
|
51
|
+
"org_id": {
|
|
52
|
+
"name": "Org Name",
|
|
53
|
+
"people_count": 1,
|
|
54
|
+
"owner_id": 123,
|
|
55
|
+
"address": "Mustamäe tee 3a, 10615 Tallinn",
|
|
56
|
+
"active_flag": true,
|
|
57
|
+
"cc_email": "org@pipedrivemail.com",
|
|
58
|
+
"value": 1234
|
|
59
|
+
},
|
|
60
|
+
"name": "Will Smith",
|
|
61
|
+
"first_name": "Will",
|
|
62
|
+
"last_name": "Smith",
|
|
63
|
+
"open_deals_count": 2,
|
|
64
|
+
"related_open_deals_count": 2,
|
|
65
|
+
"closed_deals_count": 3,
|
|
66
|
+
"related_closed_deals_count": 3,
|
|
67
|
+
"participant_open_deals_count": 1,
|
|
68
|
+
"participant_closed_deals_count": 1,
|
|
69
|
+
"email_messages_count": 1,
|
|
70
|
+
"activities_count": 1,
|
|
71
|
+
"done_activities_count": 1,
|
|
72
|
+
"undone_activities_count": 2,
|
|
73
|
+
"files_count": 2,
|
|
74
|
+
"notes_count": 2,
|
|
75
|
+
"followers_count": 3,
|
|
76
|
+
"won_deals_count": 3,
|
|
77
|
+
"related_won_deals_count": 3,
|
|
78
|
+
"lost_deals_count": 1,
|
|
79
|
+
"related_lost_deals_count": 1,
|
|
80
|
+
"active_flag": true,
|
|
81
|
+
"phone": [
|
|
82
|
+
{
|
|
83
|
+
"value": "12345",
|
|
84
|
+
"primary": true,
|
|
85
|
+
"label": "work"
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"email": [
|
|
89
|
+
{
|
|
90
|
+
"value": "12345@email.com",
|
|
91
|
+
"primary": true,
|
|
92
|
+
"label": "work"
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
"primary_email": "12345@email.com",
|
|
96
|
+
"first_char": "w",
|
|
97
|
+
"update_time": "2020-05-08 05:30:20",
|
|
98
|
+
"add_time": "2017-10-18 13:23:07",
|
|
99
|
+
"visible_to": "3",
|
|
100
|
+
"marketing_status": "no_consent",
|
|
101
|
+
"picture_id": {
|
|
102
|
+
"item_type": "person",
|
|
103
|
+
"item_id": 25,
|
|
104
|
+
"active_flag": true,
|
|
105
|
+
"add_time": "2020-09-08 08:17:52",
|
|
106
|
+
"update_time": "0000-00-00 00:00:00",
|
|
107
|
+
"added_by_user_id": 967055,
|
|
108
|
+
"pictures": {
|
|
109
|
+
"128": "https://pipedrive-profile-pics.s3.example.com/f8893852574273f2747bf6ef09d11cfb4ac8f269_128.jpg",
|
|
110
|
+
"512": "https://pipedrive-profile-pics.s3.example.com/f8893852574273f2747bf6ef09d11cfb4ac8f269_512.jpg"
|
|
111
|
+
},
|
|
112
|
+
"value": 4
|
|
113
|
+
},
|
|
114
|
+
"next_activity_date": "2019-11-29",
|
|
115
|
+
"next_activity_time": "11:30:00",
|
|
116
|
+
"next_activity_id": 128,
|
|
117
|
+
"last_activity_id": 34,
|
|
118
|
+
"last_activity_date": "2019-11-28",
|
|
119
|
+
"last_incoming_mail_time": "2019-05-29 18:21:42",
|
|
120
|
+
"last_outgoing_mail_time": "2019-05-30 03:45:35",
|
|
121
|
+
"label": 1,
|
|
122
|
+
"org_name": "Organization name",
|
|
123
|
+
"owner_name": "Jane Doe",
|
|
124
|
+
"cc_email": "org@pipedrivemail.com"
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
//# sourceMappingURL=updated-person.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updated-person.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/pipedrive/src/lib/trigger/updated-person.ts"],"names":[],"mappings":";;;;AAAA,uDAAyE;AACzE,sCAA4C;AAE/B,QAAA,aAAa,GAAG,IAAA,yBAAa,EAAC;IACzC,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,mCAAmC;IAChD,KAAK,EAAE;QACL,cAAc,EAAE,wBAAe,CAAC,cAAc;KAC/C;IACD,IAAI,EAAE,2BAAe,CAAC,OAAO;IACvB,QAAQ,CAAC,OAAO;;;YACpB,MAAM,OAAO,GAAG,MAAM,wBAAe,CAAC,gBAAgB,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,UAAW,EAAE,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAE,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAE,CAAC,YAAY,CAAC,CAAC;YAC/M,MAAM,CAAA,MAAA,OAAO,CAAC,KAAK,0CAAE,GAAG,CAAqB,yBAAy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