@activepieces/piece-zendesk-sell 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +7 -0
  2. package/package.json +32 -0
  3. package/src/index.d.ts +4 -0
  4. package/src/index.js +77 -0
  5. package/src/index.js.map +1 -0
  6. package/src/lib/actions/create_contact.d.ts +16 -0
  7. package/src/lib/actions/create_contact.js +105 -0
  8. package/src/lib/actions/create_contact.js.map +1 -0
  9. package/src/lib/actions/create_deal.d.ts +16 -0
  10. package/src/lib/actions/create_deal.js +64 -0
  11. package/src/lib/actions/create_deal.js.map +1 -0
  12. package/src/lib/actions/create_lead.d.ts +19 -0
  13. package/src/lib/actions/create_lead.js +103 -0
  14. package/src/lib/actions/create_lead.js.map +1 -0
  15. package/src/lib/actions/create_note.d.ts +11 -0
  16. package/src/lib/actions/create_note.js +103 -0
  17. package/src/lib/actions/create_note.js.map +1 -0
  18. package/src/lib/actions/find_company.d.ts +8 -0
  19. package/src/lib/actions/find_company.js +57 -0
  20. package/src/lib/actions/find_company.js.map +1 -0
  21. package/src/lib/actions/find_contact.d.ts +10 -0
  22. package/src/lib/actions/find_contact.js +65 -0
  23. package/src/lib/actions/find_contact.js.map +1 -0
  24. package/src/lib/actions/find_deal.d.ts +7 -0
  25. package/src/lib/actions/find_deal.js +68 -0
  26. package/src/lib/actions/find_deal.js.map +1 -0
  27. package/src/lib/actions/find_lead.d.ts +13 -0
  28. package/src/lib/actions/find_lead.js +66 -0
  29. package/src/lib/actions/find_lead.js.map +1 -0
  30. package/src/lib/actions/find_user.d.ts +10 -0
  31. package/src/lib/actions/find_user.js +81 -0
  32. package/src/lib/actions/find_user.js.map +1 -0
  33. package/src/lib/actions/update_contact.d.ts +17 -0
  34. package/src/lib/actions/update_contact.js +87 -0
  35. package/src/lib/actions/update_contact.js.map +1 -0
  36. package/src/lib/actions/update_deal.d.ts +18 -0
  37. package/src/lib/actions/update_deal.js +73 -0
  38. package/src/lib/actions/update_deal.js.map +1 -0
  39. package/src/lib/common/auth.d.ts +8 -0
  40. package/src/lib/common/auth.js +54 -0
  41. package/src/lib/common/auth.js.map +1 -0
  42. package/src/lib/common/client.d.ts +4 -0
  43. package/src/lib/common/client.js +28 -0
  44. package/src/lib/common/client.js.map +1 -0
  45. package/src/lib/common/props.d.ts +11 -0
  46. package/src/lib/common/props.js +216 -0
  47. package/src/lib/common/props.js.map +1 -0
  48. package/src/lib/triggers/deal_enters_stage.d.ts +20 -0
  49. package/src/lib/triggers/deal_enters_stage.js +106 -0
  50. package/src/lib/triggers/deal_enters_stage.js.map +1 -0
  51. package/src/lib/triggers/new_contact.d.ts +11 -0
  52. package/src/lib/triggers/new_contact.js +75 -0
  53. package/src/lib/triggers/new_contact.js.map +1 -0
  54. package/src/lib/triggers/new_deal.d.ts +11 -0
  55. package/src/lib/triggers/new_deal.js +73 -0
  56. package/src/lib/triggers/new_deal.js.map +1 -0
  57. package/src/lib/triggers/new_lead.d.ts +11 -0
  58. package/src/lib/triggers/new_lead.js +74 -0
  59. package/src/lib/triggers/new_lead.js.map +1 -0
  60. package/src/lib/triggers/new_note.d.ts +11 -0
  61. package/src/lib/triggers/new_note.js +70 -0
  62. package/src/lib/triggers/new_note.js.map +1 -0
  63. package/src/lib/triggers/updated_contact.d.ts +11 -0
  64. package/src/lib/triggers/updated_contact.js +75 -0
  65. package/src/lib/triggers/updated_contact.js.map +1 -0
  66. package/src/lib/triggers/updated_deal.d.ts +11 -0
  67. package/src/lib/triggers/updated_deal.js +71 -0
  68. package/src/lib/triggers/updated_deal.js.map +1 -0
  69. package/src/lib/triggers/updated_lead.d.ts +11 -0
  70. package/src/lib/triggers/updated_lead.js +77 -0
  71. package/src/lib/triggers/updated_lead.js.map +1 -0
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # pieces-zendesk-sell
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build pieces-zendesk-sell` to build the library.
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@activepieces/piece-zendesk-sell",
3
+ "version": "0.0.1",
4
+ "type": "commonjs",
5
+ "main": "./src/index.js",
6
+ "types": "./src/index.d.ts",
7
+ "dependencies": {
8
+ "@sinclair/typebox": "0.34.11",
9
+ "axios": "1.8.3",
10
+ "axios-retry": "4.4.1",
11
+ "deepmerge-ts": "7.1.0",
12
+ "mime-types": "2.1.35",
13
+ "nanoid": "3.3.8",
14
+ "semver": "7.6.0",
15
+ "tslib": "^2.3.0",
16
+ "zod": "3.25.76",
17
+ "@activepieces/pieces-common": "0.8.1",
18
+ "@activepieces/pieces-framework": "0.20.1",
19
+ "@activepieces/shared": "0.25.1"
20
+ },
21
+ "overrides": {
22
+ "@tryfabric/martian": {
23
+ "@notionhq/client": "$@notionhq/client"
24
+ },
25
+ "vite": {
26
+ "rollup": "npm:@rollup/wasm-node"
27
+ }
28
+ },
29
+ "resolutions": {
30
+ "rollup": "npm:@rollup/wasm-node"
31
+ }
32
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export declare const zendeskSell: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ api_token: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>>;
package/src/index.js ADDED
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.zendeskSell = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const shared_1 = require("@activepieces/shared");
7
+ const pieces_common_1 = require("@activepieces/pieces-common");
8
+ const buffer_1 = require("buffer");
9
+ // Auth
10
+ const auth_1 = require("./lib/common/auth");
11
+ const client_1 = require("./lib/common/client");
12
+ // Actions
13
+ const create_contact_1 = require("./lib/actions/create_contact");
14
+ const create_lead_1 = require("./lib/actions/create_lead");
15
+ const create_deal_1 = require("./lib/actions/create_deal");
16
+ const create_note_1 = require("./lib/actions/create_note");
17
+ const update_contact_1 = require("./lib/actions/update_contact");
18
+ const update_deal_1 = require("./lib/actions/update_deal");
19
+ const find_deal_1 = require("./lib/actions/find_deal");
20
+ const find_contact_1 = require("./lib/actions/find_contact");
21
+ const find_lead_1 = require("./lib/actions/find_lead");
22
+ const find_company_1 = require("./lib/actions/find_company");
23
+ const find_user_1 = require("./lib/actions/find_user");
24
+ // Triggers
25
+ const new_contact_1 = require("./lib/triggers/new_contact");
26
+ const new_lead_1 = require("./lib/triggers/new_lead");
27
+ const new_deal_1 = require("./lib/triggers/new_deal");
28
+ const updated_lead_1 = require("./lib/triggers/updated_lead");
29
+ const updated_contact_1 = require("./lib/triggers/updated_contact");
30
+ const updated_deal_1 = require("./lib/triggers/updated_deal");
31
+ const deal_enters_stage_1 = require("./lib/triggers/deal_enters_stage");
32
+ const new_note_1 = require("./lib/triggers/new_note");
33
+ exports.zendeskSell = (0, pieces_framework_1.createPiece)({
34
+ displayName: "Zendesk-sell",
35
+ description: "Sales CRM for pipeline management, lead tracking, and contact organization.",
36
+ auth: auth_1.zendeskSellAuth,
37
+ minimumSupportedRelease: '0.3.61',
38
+ logoUrl: "https://cdn.activepieces.com/pieces/zendesk-sell.png",
39
+ authors: ['Pranith124', 'onyedikachi-david'],
40
+ categories: [shared_1.PieceCategory.SALES_AND_CRM],
41
+ actions: [
42
+ create_contact_1.createContact,
43
+ create_lead_1.createLead,
44
+ create_deal_1.createDeal,
45
+ update_contact_1.updateContact,
46
+ update_deal_1.updateDeal,
47
+ create_note_1.createNote,
48
+ find_deal_1.findDeal,
49
+ find_contact_1.findContact,
50
+ find_lead_1.findLead,
51
+ find_company_1.findCompany,
52
+ find_user_1.findUser,
53
+ (0, pieces_common_1.createCustomApiCallAction)({
54
+ auth: auth_1.zendeskSellAuth,
55
+ baseUrl: () => client_1.ZENDESK_SELL_API_URL,
56
+ authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
57
+ const { email, api_token } = auth;
58
+ const credentials = `${email}/token:${api_token}`;
59
+ const encodedCredentials = buffer_1.Buffer.from(credentials).toString('base64');
60
+ return {
61
+ Authorization: `Basic ${encodedCredentials}`,
62
+ };
63
+ })
64
+ })
65
+ ],
66
+ triggers: [
67
+ new_contact_1.newContact,
68
+ new_lead_1.newLead,
69
+ new_deal_1.newDeal,
70
+ updated_lead_1.updatedLead,
71
+ updated_contact_1.updatedContact,
72
+ updated_deal_1.updatedDeal,
73
+ deal_enters_stage_1.dealEntersStage,
74
+ new_note_1.newNote
75
+ ],
76
+ });
77
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/zendesk-sell/src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAA6D;AAC7D,iDAAqD;AACrD,+DAAwE;AACxE,mCAAgC;AAEhC,OAAO;AACP,4CAAqE;AACrE,gDAA2D;AAE3D,UAAU;AACV,iEAA6D;AAC7D,2DAAuD;AACvD,2DAAuD;AACvD,2DAAuD;AACvD,iEAA6D;AAC7D,2DAAuD;AACvD,uDAAmD;AACnD,6DAAyD;AACzD,uDAAmD;AACnD,6DAAyD;AACzD,uDAAmD;AAEnD,WAAW;AACX,4DAAwD;AACxD,sDAAkD;AAClD,sDAAkD;AAClD,8DAA0D;AAC1D,oEAAgE;AAChE,8DAA0D;AAC1D,wEAAmE;AACnE,sDAAkD;AAErC,QAAA,WAAW,GAAG,IAAA,8BAAW,EAAC;IACrC,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,6EAA6E;IAC1F,IAAI,EAAE,sBAAe;IACrB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,sDAAsD;IAC/D,OAAO,EAAE,CAAC,YAAY,EAAE,mBAAmB,CAAC;IAC5C,UAAU,EAAE,CAAC,sBAAa,CAAC,aAAa,CAAC;IACzC,OAAO,EAAE;QACP,8BAAa;QACb,wBAAU;QACV,wBAAU;QACV,8BAAa;QACb,wBAAU;QACV,wBAAU;QACV,oBAAQ;QACR,0BAAW;QACX,oBAAQ;QACR,0BAAW;QACX,oBAAQ;QACR,IAAA,yCAAyB,EAAC;YACtB,IAAI,EAAE,sBAAe;YACrB,OAAO,EAAE,GAAG,EAAE,CAAC,6BAAoB;YACnC,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBACxB,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAuB,CAAC;gBACrD,MAAM,WAAW,GAAG,GAAG,KAAK,UAAU,SAAS,EAAE,CAAC;gBAClD,MAAM,kBAAkB,GAAG,eAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBACvE,OAAO;oBACH,aAAa,EAAE,SAAS,kBAAkB,EAAE;iBAC/C,CAAC;YACN,CAAC,CAAA;SACJ,CAAC;KACH;IACD,QAAQ,EAAE;QACR,wBAAU;QACV,kBAAO;QACP,kBAAO;QACP,0BAAW;QACX,gCAAc;QACd,0BAAW;QACX,mCAAe;QACf,kBAAO;KACR;CACF,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ export declare const createContact: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ api_token: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {
5
+ is_organization: import("@activepieces/pieces-framework").CheckboxProperty<true>;
6
+ name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
7
+ last_name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
8
+ first_name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
9
+ email: import("@activepieces/pieces-framework").ShortTextProperty<false>;
10
+ phone: import("@activepieces/pieces-framework").ShortTextProperty<false>;
11
+ mobile: import("@activepieces/pieces-framework").ShortTextProperty<false>;
12
+ tags: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<string, false>;
13
+ address: import("@activepieces/pieces-framework").JsonProperty<false>;
14
+ custom_fields: import("@activepieces/pieces-framework").JsonProperty<false>;
15
+ other_fields: import("@activepieces/pieces-framework").JsonProperty<false>;
16
+ }>;
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createContact = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const pieces_common_1 = require("@activepieces/pieces-common");
7
+ const auth_1 = require("../common/auth");
8
+ const client_1 = require("../common/client");
9
+ const props_1 = require("../common/props");
10
+ exports.createContact = (0, pieces_framework_1.createAction)({
11
+ auth: auth_1.zendeskSellAuth,
12
+ name: 'create_contact',
13
+ displayName: 'Create Contact',
14
+ description: 'Create a new contact.',
15
+ props: {
16
+ is_organization: pieces_framework_1.Property.Checkbox({
17
+ displayName: 'Is Organization',
18
+ description: 'Check this box if the contact is an organization.',
19
+ required: true,
20
+ defaultValue: false,
21
+ }),
22
+ name: pieces_framework_1.Property.ShortText({
23
+ displayName: 'Organization Name',
24
+ description: 'The name of the organization. Required if "Is Organization" is checked.',
25
+ required: false,
26
+ }),
27
+ last_name: pieces_framework_1.Property.ShortText({
28
+ displayName: 'Last Name',
29
+ description: 'The last name of the individual. Required if "Is Organization" is not checked.',
30
+ required: false,
31
+ }),
32
+ first_name: pieces_framework_1.Property.ShortText({
33
+ displayName: 'First Name',
34
+ required: false,
35
+ }),
36
+ email: pieces_framework_1.Property.ShortText({
37
+ displayName: 'Email',
38
+ description: "The contact's primary email address.",
39
+ required: false,
40
+ }),
41
+ phone: pieces_framework_1.Property.ShortText({
42
+ displayName: 'Phone',
43
+ description: "The contact's phone number.",
44
+ required: false,
45
+ }),
46
+ mobile: pieces_framework_1.Property.ShortText({
47
+ displayName: 'Mobile Phone',
48
+ description: "The contact's mobile phone number.",
49
+ required: false,
50
+ }),
51
+ tags: props_1.zendeskSellCommon.tags('contact'),
52
+ address: pieces_framework_1.Property.Json({
53
+ displayName: 'Address',
54
+ description: 'An object containing address details (e.g., {"line1": "2726 Smith Street", "city": "Hyannis", "country": "US"}).',
55
+ required: false,
56
+ defaultValue: {
57
+ "line1": "",
58
+ "city": "",
59
+ "postal_code": "",
60
+ "state": "",
61
+ "country": ""
62
+ }
63
+ }),
64
+ custom_fields: pieces_framework_1.Property.Json({
65
+ displayName: 'Custom Fields',
66
+ description: 'A key-value object for any custom fields (e.g., {"referral_website": "http://www.example.com"}).',
67
+ required: false,
68
+ defaultValue: {}
69
+ }),
70
+ other_fields: pieces_framework_1.Property.Json({
71
+ displayName: 'Other Fields',
72
+ description: 'Enter additional fields as a JSON object (e.g., {"title": "CEO", "website": "http://example.com"}).',
73
+ required: false,
74
+ defaultValue: {}
75
+ })
76
+ },
77
+ run(context) {
78
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
79
+ const { auth, propsValue } = context;
80
+ const { is_organization, name, last_name, other_fields } = propsValue, otherProps = tslib_1.__rest(propsValue, ["is_organization", "name", "last_name", "other_fields"]);
81
+ if (is_organization && !name) {
82
+ throw new Error('Organization Name is required when "Is Organization" is checked.');
83
+ }
84
+ if (!is_organization && !last_name) {
85
+ throw new Error('Last Name is required for an individual contact.');
86
+ }
87
+ const rawBody = Object.assign(Object.assign({ is_organization }, otherProps), (other_fields || {}));
88
+ if (is_organization) {
89
+ rawBody['name'] = name;
90
+ }
91
+ else {
92
+ rawBody['last_name'] = last_name;
93
+ }
94
+ const cleanedBody = Object.entries(rawBody).reduce((acc, [key, value]) => {
95
+ if (value !== undefined && value !== null && value !== '') {
96
+ acc[key] = value;
97
+ }
98
+ return acc;
99
+ }, {});
100
+ const response = yield (0, client_1.callZendeskApi)(pieces_common_1.HttpMethod.POST, 'v2/contacts', auth, { data: cleanedBody });
101
+ return response.body;
102
+ });
103
+ },
104
+ });
105
+ //# sourceMappingURL=create_contact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create_contact.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/zendesk-sell/src/lib/actions/create_contact.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,yCAAkE;AAClE,6CAAkD;AAClD,2CAAoD;AAEvC,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACtC,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,uBAAuB;IACpC,KAAK,EAAE;QACH,eAAe,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC/B,WAAW,EAAE,iBAAiB;YAC9B,WAAW,EAAE,mDAAmD;YAChE,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,KAAK;SACtB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACrB,WAAW,EAAE,mBAAmB;YAChC,WAAW,EAAE,yEAAyE;YACtF,QAAQ,EAAE,KAAK;SAClB,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,gFAAgF;YAC7F,QAAQ,EAAE,KAAK;SAClB,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,KAAK;SAClB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,sCAAsC;YACnD,QAAQ,EAAE,KAAK;SAClB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,6BAA6B;YAC1C,QAAQ,EAAE,KAAK;SAClB,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,cAAc;YAC3B,WAAW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;YAEF,IAAI,eAAe,EAAE,CAAC;gBAClB,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;YAC3B,CAAC;iBAAM,CAAC;gBACJ,OAAO,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC;YACrC,CAAC;YAGD,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;gBACrE,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;oBACxD,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;gBACrB,CAAC;gBACD,OAAO,GAAG,CAAC;YACf,CAAC,EAAE,EAA6B,CAAC,CAAC;YAElC,MAAM,QAAQ,GAAG,MAAM,IAAA,uBAAc,EACjC,0BAAU,CAAC,IAAI,EACf,aAAa,EACb,IAAuB,EACvB,EAAE,IAAI,EAAE,WAAW,EAAE,CACxB,CAAC;YAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;QACzB,CAAC;KAAA;CACJ,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ export declare const createDeal: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ api_token: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {
5
+ name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
6
+ contact_id: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
7
+ value: import("@activepieces/pieces-framework").ShortTextProperty<false>;
8
+ currency: import("@activepieces/pieces-framework").ShortTextProperty<false>;
9
+ pipeline_id: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
10
+ stage_id: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
11
+ owner_id: import("@activepieces/pieces-framework").DropdownProperty<number, false>;
12
+ source_id: import("@activepieces/pieces-framework").DropdownProperty<number, false>;
13
+ hot: import("@activepieces/pieces-framework").CheckboxProperty<false>;
14
+ tags: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<string, false>;
15
+ custom_fields: import("@activepieces/pieces-framework").JsonProperty<false>;
16
+ }>;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createDeal = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const pieces_common_1 = require("@activepieces/pieces-common");
7
+ const auth_1 = require("../common/auth");
8
+ const client_1 = require("../common/client");
9
+ const props_1 = require("../common/props");
10
+ exports.createDeal = (0, pieces_framework_1.createAction)({
11
+ auth: auth_1.zendeskSellAuth,
12
+ name: 'create_deal',
13
+ displayName: 'Create Deal',
14
+ description: 'Create a new deal under an existing contact.',
15
+ props: {
16
+ name: pieces_framework_1.Property.ShortText({
17
+ displayName: 'Deal Name',
18
+ required: true,
19
+ }),
20
+ contact_id: props_1.zendeskSellCommon.contact(true),
21
+ value: pieces_framework_1.Property.ShortText({
22
+ displayName: 'Value',
23
+ description: 'The monetary value of the deal (e.g., 15000).',
24
+ required: false,
25
+ }),
26
+ currency: pieces_framework_1.Property.ShortText({
27
+ displayName: 'Currency',
28
+ description: '3-character currency code (e.g., USD).',
29
+ required: false,
30
+ }),
31
+ pipeline_id: props_1.zendeskSellCommon.pipeline(false),
32
+ stage_id: props_1.zendeskSellCommon.stage(false),
33
+ owner_id: props_1.zendeskSellCommon.owner(),
34
+ source_id: props_1.zendeskSellCommon.leadSource(),
35
+ hot: pieces_framework_1.Property.Checkbox({
36
+ displayName: 'Hot Deal?',
37
+ description: 'Check this box to mark the deal as "hot".',
38
+ required: false,
39
+ }),
40
+ tags: props_1.zendeskSellCommon.tags('deal'), // Optional Tags
41
+ custom_fields: pieces_framework_1.Property.Json({
42
+ displayName: 'Custom Fields',
43
+ description: 'A key-value object for any custom fields.',
44
+ required: false,
45
+ defaultValue: {}
46
+ }),
47
+ },
48
+ run(context) {
49
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
50
+ const { auth, propsValue } = context;
51
+ const { pipeline_id } = propsValue, otherProps = tslib_1.__rest(propsValue, ["pipeline_id"]);
52
+ const rawBody = Object.assign({}, otherProps);
53
+ const cleanedBody = Object.entries(rawBody).reduce((acc, [key, value]) => {
54
+ if (value !== undefined && value !== null && value !== '') {
55
+ acc[key] = value;
56
+ }
57
+ return acc;
58
+ }, {});
59
+ const response = yield (0, client_1.callZendeskApi)(pieces_common_1.HttpMethod.POST, 'v2/deals', auth, { data: cleanedBody });
60
+ return response.body;
61
+ });
62
+ },
63
+ });
64
+ //# sourceMappingURL=create_deal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create_deal.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/zendesk-sell/src/lib/actions/create_deal.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,yCAAkE;AAClE,6CAAkD;AAClD,2CAAoD;AAEvC,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACnC,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,8CAA8C;IAC3D,KAAK,EAAE;QACH,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACrB,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,UAAU,EAAE,yBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC;QAC3C,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,+CAA+C;YAC5D,QAAQ,EAAE,KAAK;SAClB,CA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CAAC;YACf,CAAC,EAAE,EAA6B,CAAC,CAAC;YAElC,MAAM,QAAQ,GAAG,MAAM,IAAA,uBAAc,EACjC,0BAAU,CAAC,IAAI,EACf,UAAU,EACV,IAAuB,EACvB,EAAE,IAAI,EAAE,WAAW,EAAE,CACxB,CAAC;YAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;QACzB,CAAC;KAAA;CACJ,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ export declare const createLead: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ api_token: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {
5
+ last_name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
6
+ organization_name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
7
+ first_name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
8
+ owner_id: import("@activepieces/pieces-framework").DropdownProperty<number, false>;
9
+ source_id: import("@activepieces/pieces-framework").DropdownProperty<number, false>;
10
+ status: import("@activepieces/pieces-framework").ShortTextProperty<false>;
11
+ title: import("@activepieces/pieces-framework").ShortTextProperty<false>;
12
+ email: import("@activepieces/pieces-framework").ShortTextProperty<false>;
13
+ phone: import("@activepieces/pieces-framework").ShortTextProperty<false>;
14
+ mobile: import("@activepieces/pieces-framework").ShortTextProperty<false>;
15
+ tags: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<string, false>;
16
+ address: import("@activepieces/pieces-framework").JsonProperty<false>;
17
+ custom_fields: import("@activepieces/pieces-framework").JsonProperty<false>;
18
+ other_fields: import("@activepieces/pieces-framework").JsonProperty<false>;
19
+ }>;
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createLead = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const pieces_common_1 = require("@activepieces/pieces-common");
7
+ const auth_1 = require("../common/auth");
8
+ const client_1 = require("../common/client");
9
+ const props_1 = require("../common/props");
10
+ exports.createLead = (0, pieces_framework_1.createAction)({
11
+ auth: auth_1.zendeskSellAuth,
12
+ name: 'create_lead',
13
+ displayName: 'Create Lead',
14
+ description: 'Create a new lead record.',
15
+ props: {
16
+ last_name: pieces_framework_1.Property.ShortText({
17
+ displayName: 'Last Name',
18
+ description: "The lead's last name. Required if Organization Name is empty.",
19
+ required: false,
20
+ }),
21
+ organization_name: pieces_framework_1.Property.ShortText({
22
+ displayName: 'Organization Name',
23
+ description: "The lead's organization name. Required if Last Name is empty.",
24
+ required: false,
25
+ }),
26
+ first_name: pieces_framework_1.Property.ShortText({
27
+ displayName: 'First Name',
28
+ required: false,
29
+ }),
30
+ owner_id: props_1.zendeskSellCommon.owner(),
31
+ source_id: props_1.zendeskSellCommon.leadSource(),
32
+ status: pieces_framework_1.Property.ShortText({
33
+ displayName: 'Status',
34
+ description: 'The current status of the lead (e.g., "New").',
35
+ required: false,
36
+ }),
37
+ title: pieces_framework_1.Property.ShortText({
38
+ displayName: 'Title',
39
+ description: "The lead's job title.",
40
+ required: false,
41
+ }),
42
+ email: pieces_framework_1.Property.ShortText({
43
+ displayName: 'Email',
44
+ description: "The lead's email address.",
45
+ required: false,
46
+ }),
47
+ phone: pieces_framework_1.Property.ShortText({
48
+ displayName: 'Phone',
49
+ description: "The lead's phone number.",
50
+ required: false,
51
+ }),
52
+ mobile: pieces_framework_1.Property.ShortText({
53
+ displayName: 'Mobile Phone',
54
+ description: "The lead's mobile phone number.",
55
+ required: false,
56
+ }),
57
+ tags: props_1.zendeskSellCommon.tags('lead'),
58
+ address: pieces_framework_1.Property.Json({
59
+ displayName: 'Address',
60
+ description: 'An object containing address details (e.g., {"line1": "123 Main St", "city": "Anytown"}).',
61
+ required: false,
62
+ defaultValue: {
63
+ "line1": "",
64
+ "city": "",
65
+ "postal_code": "",
66
+ "state": "",
67
+ "country": ""
68
+ }
69
+ }),
70
+ custom_fields: pieces_framework_1.Property.Json({
71
+ displayName: 'Custom Fields',
72
+ description: 'A key-value object for any custom fields (e.g., {"known_via": "tom"}).',
73
+ required: false,
74
+ defaultValue: {}
75
+ }),
76
+ other_fields: pieces_framework_1.Property.Json({
77
+ displayName: 'Other Fields',
78
+ description: 'Enter additional fields as a JSON object (e.g., {"description": "I know him via Tom", "website": "http://example.com"}).',
79
+ required: false,
80
+ defaultValue: {}
81
+ })
82
+ },
83
+ run(context) {
84
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
85
+ const { auth, propsValue } = context;
86
+ const { last_name, organization_name, other_fields } = propsValue, otherProps = tslib_1.__rest(propsValue, ["last_name", "organization_name", "other_fields"]);
87
+ if (!last_name && !organization_name) {
88
+ throw new Error('Either Last Name or Organization Name is required to create a lead.');
89
+ }
90
+ const rawBody = Object.assign(Object.assign({ last_name,
91
+ organization_name }, otherProps), (other_fields || {}));
92
+ const cleanedBody = Object.entries(rawBody).reduce((acc, [key, value]) => {
93
+ if (value !== undefined && value !== null && value !== '') {
94
+ acc[key] = value;
95
+ }
96
+ return acc;
97
+ }, {});
98
+ const response = yield (0, client_1.callZendeskApi)(pieces_common_1.HttpMethod.POST, 'v2/leads', auth, { data: cleanedBody });
99
+ return response.body;
100
+ });
101
+ },
102
+ });
103
+ //# sourceMappingURL=create_lead.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create_lead.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/zendesk-sell/src/lib/actions/create_lead.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,yCAAkE;AAClE,6CAAkD;AAClD,2CAAoD;AAEvC,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACnC,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,2BAA2B;IACxC,KAAK,EAAE;QACH,SAAS,EAAE,2BAAQ,CAAC,S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D,OAAO,GAAG,CAAC;YACf,CAAC,EAAE,EAA6B,CAAC,CAAC;YAElC,MAAM,QAAQ,GAAG,MAAM,IAAA,uBAAc,EACjC,0BAAU,CAAC,IAAI,EACf,UAAU,EACV,IAAuB,EACvB,EAAE,IAAI,EAAE,WAAW,EAAE,CACxB,CAAC;YAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;QACzB,CAAC;KAAA;CACJ,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ export declare const createNote: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ api_token: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {
5
+ resource_type: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
6
+ dynamic_resource_id: import("@activepieces/pieces-framework").DynamicProperties<true>;
7
+ content: import("@activepieces/pieces-framework").LongTextProperty<true>;
8
+ is_important: import("@activepieces/pieces-framework").CheckboxProperty<false>;
9
+ type: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
10
+ tags: import("@activepieces/pieces-framework").ArrayProperty<false>;
11
+ }>;
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createNote = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const pieces_common_1 = require("@activepieces/pieces-common");
7
+ const auth_1 = require("../common/auth");
8
+ const client_1 = require("../common/client");
9
+ const props_1 = require("../common/props");
10
+ exports.createNote = (0, pieces_framework_1.createAction)({
11
+ auth: auth_1.zendeskSellAuth,
12
+ name: 'create_note',
13
+ displayName: 'Create Note',
14
+ description: 'Add a note to a deal, lead, or contact.',
15
+ props: {
16
+ resource_type: pieces_framework_1.Property.StaticDropdown({
17
+ displayName: 'Resource Type',
18
+ description: 'The type of resource to attach the note to.',
19
+ required: true,
20
+ options: {
21
+ options: [
22
+ { label: 'Lead', value: 'lead' },
23
+ { label: 'Contact', value: 'contact' },
24
+ { label: 'Deal', value: 'deal' },
25
+ ]
26
+ }
27
+ }),
28
+ dynamic_resource_id: pieces_framework_1.Property.DynamicProperties({
29
+ displayName: 'Resource ID',
30
+ description: 'Select the specific resource to attach the note to.',
31
+ required: true,
32
+ refreshers: ['resource_type'],
33
+ props: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
34
+ const resourceType = context['resource_type'];
35
+ const fields = {};
36
+ if (!resourceType)
37
+ return {};
38
+ switch (resourceType) {
39
+ case 'lead':
40
+ fields['resource_id'] = props_1.zendeskSellCommon.lead(true);
41
+ break;
42
+ case 'contact':
43
+ fields['resource_id'] = props_1.zendeskSellCommon.contact(true);
44
+ break;
45
+ case 'deal':
46
+ fields['resource_id'] = props_1.zendeskSellCommon.deal(true);
47
+ break;
48
+ }
49
+ return fields;
50
+ })
51
+ }),
52
+ content: pieces_framework_1.Property.LongText({
53
+ displayName: 'Content',
54
+ description: 'The content of the note.',
55
+ required: true,
56
+ }),
57
+ is_important: pieces_framework_1.Property.Checkbox({
58
+ displayName: 'Important',
59
+ description: 'Mark the note as important (starred).',
60
+ required: false,
61
+ }),
62
+ type: pieces_framework_1.Property.StaticDropdown({
63
+ displayName: 'Visibility',
64
+ description: 'Define the note\'s visibility.',
65
+ required: false,
66
+ options: {
67
+ options: [
68
+ { label: 'Regular (Default)', value: 'regular' },
69
+ { label: 'Restricted (Creator only)', value: 'restricted' },
70
+ ]
71
+ }
72
+ }),
73
+ tags: pieces_framework_1.Property.Array({
74
+ displayName: 'Tags',
75
+ description: 'An array of tags to add to the note (e.g., ["premium", "follow-up"]).',
76
+ required: false,
77
+ }),
78
+ },
79
+ run(context) {
80
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
81
+ const { auth, propsValue } = context;
82
+ const { resource_type, dynamic_resource_id } = propsValue, otherProps = tslib_1.__rest(propsValue, ["resource_type", "dynamic_resource_id"]);
83
+ const resource_id = dynamic_resource_id === null || dynamic_resource_id === void 0 ? void 0 : dynamic_resource_id.resource_id;
84
+ if (!resource_id) {
85
+ throw new Error('Resource ID is missing. Please select a resource.');
86
+ }
87
+ const rawBody = Object.assign({ resource_type,
88
+ resource_id }, otherProps);
89
+ const cleanedBody = Object.entries(rawBody).reduce((acc, [key, value]) => {
90
+ if (value !== undefined && value !== null && value !== '') {
91
+ acc[key] = value;
92
+ }
93
+ if (key === 'is_important' && value === false) {
94
+ acc[key] = value;
95
+ }
96
+ return acc;
97
+ }, {});
98
+ const response = yield (0, client_1.callZendeskApi)(pieces_common_1.HttpMethod.POST, 'v2/notes', auth, { data: cleanedBody });
99
+ return response.body;
100
+ });
101
+ },
102
+ });
103
+ //# sourceMappingURL=create_note.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create_note.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/zendesk-sell/src/lib/actions/create_note.ts"],"names":[],"mappings":";;;;AAAA,qEAA2F;AAC3F,+DAAyD;AACzD,yCAAkE;AAClE,6CAAkD;AAClD,2CAAoD;AAEvC,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACnC,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,yCAAyC;IACtD,KAAK,EAAE;QACH,aAAa,EAAE,2BAAQ,CAAC,cAAc,CAAC;YACnC,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACL,OAAO,EAAE;oBACL,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;oBAChC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;oBACtC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;iBACnC;aACJ;SACJ,CAAC;QACF,mBAAmB,EAAE,2BAAQ,CAAC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U,EACV,IAAuB,EACvB,EAAE,IAAI,EAAE,WAAW,EAAE,CACxB,CAAC;YAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;QACzB,CAAC;KAAA;CACJ,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare const findCompany: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ api_token: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {
5
+ name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
6
+ email: import("@activepieces/pieces-framework").ShortTextProperty<false>;
7
+ phone: import("@activepieces/pieces-framework").ShortTextProperty<false>;
8
+ }>;