@scopieflows/app-copper 0.1.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 (112) hide show
  1. package/README.md +7 -0
  2. package/package.json +28 -0
  3. package/src/i18n/de.json +285 -0
  4. package/src/i18n/es.json +285 -0
  5. package/src/i18n/fr.json +285 -0
  6. package/src/i18n/ja.json +285 -0
  7. package/src/i18n/nl.json +285 -0
  8. package/src/i18n/pt.json +285 -0
  9. package/src/i18n/translation.json +285 -0
  10. package/src/i18n/zh.json +285 -0
  11. package/src/index.d.ts +4 -0
  12. package/src/index.js +94 -0
  13. package/src/index.js.map +1 -0
  14. package/src/lib/actions/convert-lead.d.ts +23 -0
  15. package/src/lib/actions/convert-lead.js +52 -0
  16. package/src/lib/actions/convert-lead.js.map +1 -0
  17. package/src/lib/actions/create-activity.d.ts +15 -0
  18. package/src/lib/actions/create-activity.js +108 -0
  19. package/src/lib/actions/create-activity.js.map +1 -0
  20. package/src/lib/actions/create-company.d.ts +21 -0
  21. package/src/lib/actions/create-company.js +103 -0
  22. package/src/lib/actions/create-company.js.map +1 -0
  23. package/src/lib/actions/create-lead.d.ts +14 -0
  24. package/src/lib/actions/create-lead.js +101 -0
  25. package/src/lib/actions/create-lead.js.map +1 -0
  26. package/src/lib/actions/create-opportunity.d.ts +24 -0
  27. package/src/lib/actions/create-opportunity.js +69 -0
  28. package/src/lib/actions/create-opportunity.js.map +1 -0
  29. package/src/lib/actions/create-person.d.ts +13 -0
  30. package/src/lib/actions/create-person.js +122 -0
  31. package/src/lib/actions/create-person.js.map +1 -0
  32. package/src/lib/actions/create-project.d.ts +7 -0
  33. package/src/lib/actions/create-project.js +35 -0
  34. package/src/lib/actions/create-project.js.map +1 -0
  35. package/src/lib/actions/create-task.d.ts +27 -0
  36. package/src/lib/actions/create-task.js +142 -0
  37. package/src/lib/actions/create-task.js.map +1 -0
  38. package/src/lib/actions/search-for-a-company.d.ts +40 -0
  39. package/src/lib/actions/search-for-a-company.js +258 -0
  40. package/src/lib/actions/search-for-a-company.js.map +1 -0
  41. package/src/lib/actions/search-for-a-lead.d.ts +52 -0
  42. package/src/lib/actions/search-for-a-lead.js +274 -0
  43. package/src/lib/actions/search-for-a-lead.js.map +1 -0
  44. package/src/lib/actions/search-for-a-person.d.ts +54 -0
  45. package/src/lib/actions/search-for-a-person.js +235 -0
  46. package/src/lib/actions/search-for-a-person.js.map +1 -0
  47. package/src/lib/actions/search-for-a-project.d.ts +24 -0
  48. package/src/lib/actions/search-for-a-project.js +165 -0
  49. package/src/lib/actions/search-for-a-project.js.map +1 -0
  50. package/src/lib/actions/search-for-an-activity.d.ts +22 -0
  51. package/src/lib/actions/search-for-an-activity.js +130 -0
  52. package/src/lib/actions/search-for-an-activity.js.map +1 -0
  53. package/src/lib/actions/search-for-an-opportunity.d.ts +74 -0
  54. package/src/lib/actions/search-for-an-opportunity.js +334 -0
  55. package/src/lib/actions/search-for-an-opportunity.js.map +1 -0
  56. package/src/lib/actions/update-company.d.ts +23 -0
  57. package/src/lib/actions/update-company.js +135 -0
  58. package/src/lib/actions/update-company.js.map +1 -0
  59. package/src/lib/actions/update-lead.d.ts +13 -0
  60. package/src/lib/actions/update-lead.js +136 -0
  61. package/src/lib/actions/update-lead.js.map +1 -0
  62. package/src/lib/actions/update-opportunity.d.ts +34 -0
  63. package/src/lib/actions/update-opportunity.js +89 -0
  64. package/src/lib/actions/update-opportunity.js.map +1 -0
  65. package/src/lib/actions/update-person.d.ts +13 -0
  66. package/src/lib/actions/update-person.js +155 -0
  67. package/src/lib/actions/update-person.js.map +1 -0
  68. package/src/lib/actions/update-project.d.ts +16 -0
  69. package/src/lib/actions/update-project.js +56 -0
  70. package/src/lib/actions/update-project.js.map +1 -0
  71. package/src/lib/common/constants.d.ts +35 -0
  72. package/src/lib/common/constants.js +54 -0
  73. package/src/lib/common/constants.js.map +1 -0
  74. package/src/lib/common/props.d.ts +168 -0
  75. package/src/lib/common/props.js +679 -0
  76. package/src/lib/common/props.js.map +1 -0
  77. package/src/lib/common/requests.d.ts +33 -0
  78. package/src/lib/common/requests.js +320 -0
  79. package/src/lib/common/requests.js.map +1 -0
  80. package/src/lib/triggers/new-activity.d.ts +14 -0
  81. package/src/lib/triggers/new-activity.js +74 -0
  82. package/src/lib/triggers/new-activity.js.map +1 -0
  83. package/src/lib/triggers/new-lead.d.ts +14 -0
  84. package/src/lib/triggers/new-lead.js +45 -0
  85. package/src/lib/triggers/new-lead.js.map +1 -0
  86. package/src/lib/triggers/new-person.d.ts +14 -0
  87. package/src/lib/triggers/new-person.js +45 -0
  88. package/src/lib/triggers/new-person.js.map +1 -0
  89. package/src/lib/triggers/new-task.d.ts +14 -0
  90. package/src/lib/triggers/new-task.js +45 -0
  91. package/src/lib/triggers/new-task.js.map +1 -0
  92. package/src/lib/triggers/updated-lead-status.d.ts +14 -0
  93. package/src/lib/triggers/updated-lead-status.js +66 -0
  94. package/src/lib/triggers/updated-lead-status.js.map +1 -0
  95. package/src/lib/triggers/updated-lead.d.ts +14 -0
  96. package/src/lib/triggers/updated-lead.js +45 -0
  97. package/src/lib/triggers/updated-lead.js.map +1 -0
  98. package/src/lib/triggers/updated-opportunity-stage.d.ts +14 -0
  99. package/src/lib/triggers/updated-opportunity-stage.js +73 -0
  100. package/src/lib/triggers/updated-opportunity-stage.js.map +1 -0
  101. package/src/lib/triggers/updated-opportunity-status.d.ts +14 -0
  102. package/src/lib/triggers/updated-opportunity-status.js +66 -0
  103. package/src/lib/triggers/updated-opportunity-status.js.map +1 -0
  104. package/src/lib/triggers/updated-opportunity.d.ts +14 -0
  105. package/src/lib/triggers/updated-opportunity.js +45 -0
  106. package/src/lib/triggers/updated-opportunity.js.map +1 -0
  107. package/src/lib/triggers/updated-project.d.ts +14 -0
  108. package/src/lib/triggers/updated-project.js +45 -0
  109. package/src/lib/triggers/updated-project.js.map +1 -0
  110. package/src/lib/triggers/updated-task.d.ts +14 -0
  111. package/src/lib/triggers/updated-task.js +45 -0
  112. package/src/lib/triggers/updated-task.js.map +1 -0
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateLead = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const constants_1 = require("../common/constants");
7
+ const props_1 = require("../common/props");
8
+ const requests_1 = require("../common/requests");
9
+ exports.updateLead = (0, pieces_framework_1.createAction)({
10
+ auth: constants_1.CopperAuth,
11
+ name: 'updateLead',
12
+ displayName: 'Update Lead',
13
+ description: 'Updates an existing lead.',
14
+ props: {
15
+ leadId: (0, props_1.leadDropdown)(['auth']),
16
+ fields: pieces_framework_1.Property.DynamicProperties({
17
+ displayName: '',
18
+ description: '',
19
+ refreshers: ['auth', 'leadId'],
20
+ required: false,
21
+ auth: constants_1.CopperAuth,
22
+ props: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, leadId }) {
23
+ var _b, _c, _d, _e, _f;
24
+ if (!auth || !leadId)
25
+ return {};
26
+ const lead = JSON.parse(leadId);
27
+ const map = {
28
+ name: pieces_framework_1.Property.ShortText({
29
+ displayName: 'Full Name',
30
+ required: true,
31
+ defaultValue: lead.name,
32
+ }),
33
+ email: pieces_framework_1.Property.ShortText({
34
+ displayName: 'Email',
35
+ required: true,
36
+ defaultValue: lead.email.email,
37
+ }),
38
+ category: pieces_framework_1.Property.ShortText({
39
+ displayName: 'Category of the email address (e.g., work, personal)',
40
+ required: true,
41
+ defaultValue: lead.email.category,
42
+ }),
43
+ phone_numbers: pieces_framework_1.Property.Array({
44
+ displayName: 'Phone Numbers',
45
+ required: false,
46
+ properties: {
47
+ number: pieces_framework_1.Property.ShortText({
48
+ displayName: 'Number',
49
+ required: true,
50
+ }),
51
+ category: pieces_framework_1.Property.ShortText({
52
+ displayName: 'Category (e.g., mobile, work, personal)',
53
+ required: true,
54
+ }),
55
+ },
56
+ defaultValue: lead.phone_numbers,
57
+ }),
58
+ address_street: pieces_framework_1.Property.ShortText({
59
+ displayName: 'Street',
60
+ required: false,
61
+ defaultValue: (_b = lead.address) === null || _b === void 0 ? void 0 : _b.street,
62
+ }),
63
+ address_city: pieces_framework_1.Property.ShortText({
64
+ displayName: 'City',
65
+ required: false,
66
+ defaultValue: (_c = lead.address) === null || _c === void 0 ? void 0 : _c.city,
67
+ }),
68
+ address_state: pieces_framework_1.Property.ShortText({
69
+ displayName: 'State/Region',
70
+ required: false,
71
+ defaultValue: (_d = lead.address) === null || _d === void 0 ? void 0 : _d.state,
72
+ }),
73
+ address_postal_code: pieces_framework_1.Property.ShortText({
74
+ displayName: 'Postal Code',
75
+ required: false,
76
+ defaultValue: (_e = lead.address) === null || _e === void 0 ? void 0 : _e.postal_code,
77
+ }),
78
+ address_country: pieces_framework_1.Property.ShortText({
79
+ displayName: 'Country',
80
+ required: false,
81
+ defaultValue: (_f = lead.address) === null || _f === void 0 ? void 0 : _f.country,
82
+ }),
83
+ };
84
+ return map;
85
+ }),
86
+ }),
87
+ },
88
+ run(context) {
89
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
90
+ const fields = context.propsValue.fields;
91
+ const leadId = context.propsValue.leadId;
92
+ const lead = JSON.parse(leadId);
93
+ const { name, email, category, address_street, address_city, address_state, address_postal_code, address_country, phone_numbers, } = fields;
94
+ const normPhones = (Array.isArray(phone_numbers) ? phone_numbers : [])
95
+ .map((p) => {
96
+ var _a;
97
+ return ({
98
+ number: String((_a = p === null || p === void 0 ? void 0 : p.number) !== null && _a !== void 0 ? _a : '').trim(),
99
+ category: (0, constants_1.isNonEmptyStr)(p === null || p === void 0 ? void 0 : p.category)
100
+ ? String(p.category).trim()
101
+ : undefined,
102
+ });
103
+ })
104
+ .filter((p) => (0, constants_1.isNonEmptyStr)(p.number));
105
+ const address = [
106
+ address_street,
107
+ address_city,
108
+ address_state,
109
+ address_postal_code,
110
+ address_country,
111
+ ].some(constants_1.isNonEmptyStr)
112
+ ? {
113
+ street: (0, constants_1.isNonEmptyStr)(address_street)
114
+ ? address_street.trim()
115
+ : undefined,
116
+ city: (0, constants_1.isNonEmptyStr)(address_city) ? address_city.trim() : undefined,
117
+ state: (0, constants_1.isNonEmptyStr)(address_state)
118
+ ? address_state.trim()
119
+ : undefined,
120
+ postal_code: (0, constants_1.isNonEmptyStr)(address_postal_code)
121
+ ? address_postal_code.trim()
122
+ : undefined,
123
+ country: (0, constants_1.isNonEmptyStr)(address_country)
124
+ ? address_country.trim()
125
+ : undefined,
126
+ }
127
+ : undefined;
128
+ const body = Object.assign(Object.assign({ name, email: {
129
+ email,
130
+ category,
131
+ } }, (normPhones.length ? { phone_numbers: normPhones } : {})), (address ? { address } : {}));
132
+ return yield requests_1.CopperApiService.updateLead(context.auth, lead.id, body);
133
+ });
134
+ },
135
+ });
136
+ //# sourceMappingURL=update-lead.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-lead.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/copper/src/lib/actions/update-lead.ts"],"names":[],"mappings":";;;;AAAA,oEAIuC;AACvC,mDAAgE;AAChE,2CAA+D;AAC/D,iDAAsD;AAEzC,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACrC,IAAI,EAAE,sBAAU;IAChB,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,2BAA2B;IACxC,KAAK,EAAE;QACL,MAAM,EAAE,IAAA,oBAAY,EAAC,CAAC,MAAM,CAAC,CAAC;QAC9B,MAAM,EAAE,2BAAQ,CAAC,iBAAiB,CAAC;YACjC,WAAW,EAAE,EAAE;YACf,WAAW,EAAE,EAAE;YACf,UAAU,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;YAC9B,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,sBAAU;YAChB,KAAK,EAAE,KAAyB,EAAE,oDAApB,EAAE,IAAI,EAAE,MAAM,EAAE;;gBAC5B,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM;o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,KAAK;oBACL,QAAQ;iBACT,IACE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GACxD,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAChC,CAAC;YAEF,OAAO,MAAM,2BAAgB,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QACxE,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,34 @@
1
+ export declare const updateOpportunity: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").CustomAuthProperty<{
2
+ email: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
3
+ apiKey: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
4
+ }>, {
5
+ opportunityId: import("@scopieflows/pieces-framework").DropdownProperty<unknown, true, import("@scopieflows/pieces-framework").CustomAuthProperty<{
6
+ email: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
7
+ apiKey: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
8
+ }>> | import("@scopieflows/pieces-framework").DropdownProperty<unknown, false, import("@scopieflows/pieces-framework").CustomAuthProperty<{
9
+ email: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
10
+ apiKey: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
11
+ }>>;
12
+ updateFields: import("@scopieflows/pieces-framework").DynamicProperties<false, import("@scopieflows/pieces-framework").CustomAuthProperty<{
13
+ email: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
14
+ apiKey: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
15
+ }>>;
16
+ pipelineId: import("@scopieflows/pieces-framework").DropdownProperty<unknown, true, import("@scopieflows/pieces-framework").CustomAuthProperty<{
17
+ email: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
18
+ apiKey: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
19
+ }>> | import("@scopieflows/pieces-framework").DropdownProperty<unknown, false, import("@scopieflows/pieces-framework").CustomAuthProperty<{
20
+ email: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
21
+ apiKey: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
22
+ }>>;
23
+ pipelineStageId: import("@scopieflows/pieces-framework").DropdownProperty<any, false, import("@scopieflows/pieces-framework").CustomAuthProperty<{
24
+ email: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
25
+ apiKey: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
26
+ }>>;
27
+ primaryContactId: import("@scopieflows/pieces-framework").DropdownProperty<unknown, true, import("@scopieflows/pieces-framework").CustomAuthProperty<{
28
+ email: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
29
+ apiKey: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
30
+ }>> | import("@scopieflows/pieces-framework").DropdownProperty<unknown, false, import("@scopieflows/pieces-framework").CustomAuthProperty<{
31
+ email: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
32
+ apiKey: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
33
+ }>>;
34
+ }>;
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateOpportunity = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const constants_1 = require("../common/constants");
7
+ const props_1 = require("../common/props");
8
+ const requests_1 = require("../common/requests");
9
+ exports.updateOpportunity = (0, pieces_framework_1.createAction)({
10
+ auth: constants_1.CopperAuth,
11
+ name: 'updateOpportunity',
12
+ displayName: 'Update Opportunity',
13
+ description: 'Updates an opportunity using match criteria.',
14
+ props: {
15
+ opportunityId: (0, props_1.opportunityDropdown)({
16
+ refreshers: ['auth'],
17
+ required: true,
18
+ }),
19
+ updateFields: pieces_framework_1.Property.DynamicProperties({
20
+ auth: constants_1.CopperAuth,
21
+ displayName: '',
22
+ description: '',
23
+ required: false,
24
+ refreshers: ['auth', 'opportunityId'],
25
+ props: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, opportunityId, }) {
26
+ if (!auth || !opportunityId)
27
+ return {};
28
+ const opportunity = JSON.parse(opportunityId);
29
+ return {
30
+ name: pieces_framework_1.Property.ShortText({
31
+ displayName: 'Name',
32
+ description: 'The name of the opportunity',
33
+ required: true,
34
+ defaultValue: opportunity.name,
35
+ }),
36
+ };
37
+ }),
38
+ }),
39
+ pipelineId: (0, props_1.pipelinesDropdown)({ refreshers: ['auth'] }),
40
+ pipelineStageId: pieces_framework_1.Property.Dropdown({
41
+ auth: constants_1.CopperAuth,
42
+ displayName: 'Pipeline Stage',
43
+ description: 'Select a stage',
44
+ refreshers: ['auth', 'pipelineId'],
45
+ required: false,
46
+ options(_a) {
47
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, pipelineId }) {
48
+ if (!auth) {
49
+ return {
50
+ disabled: true,
51
+ placeholder: 'Connect your Copper account first',
52
+ options: [],
53
+ };
54
+ }
55
+ if (!pipelineId) {
56
+ return {
57
+ disabled: true,
58
+ placeholder: 'Select a pipeline first',
59
+ options: [],
60
+ };
61
+ }
62
+ const pipeline = JSON.parse(pipelineId);
63
+ const stages = pipeline.stages;
64
+ return {
65
+ options: stages.map((stage) => ({
66
+ label: stage.name,
67
+ value: stage.id,
68
+ })),
69
+ };
70
+ });
71
+ },
72
+ }),
73
+ primaryContactId: (0, props_1.primaryContactsDropdown)({ refreshers: ['auth'] }),
74
+ },
75
+ run(context) {
76
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
77
+ const { updateFields, primaryContactId, pipelineId, pipelineStageId, opportunityId, } = context.propsValue;
78
+ const pipeline = JSON.parse(pipelineId);
79
+ const opportunity = JSON.parse(opportunityId);
80
+ return yield requests_1.CopperApiService.updateOpportunity(context.auth, opportunity.id, {
81
+ name: updateFields.name,
82
+ primary_contact_id: primaryContactId,
83
+ pipeline_id: pipeline.id,
84
+ pipeline_stage_id: pipelineStageId,
85
+ });
86
+ });
87
+ },
88
+ });
89
+ //# sourceMappingURL=update-opportunity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-opportunity.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/copper/src/lib/actions/update-opportunity.ts"],"names":[],"mappings":";;;;AAAA,oEAIuC;AACvC,mDAAiD;AACjD,2CAIyB;AACzB,iDAAsD;AAEzC,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,sBAAU;IAChB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,8CAA8C;IAC3D,KAAK,EAAE;QACL,aAAa,EAAE,IAAA,2BAAmB,EAAC;YACjC,UAAU,EAAE,CAAC,MAAM,CAAC;YACpB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,YAAY,EAAE,2BAAQ,CAAC,iBAAiB,CAAC;YACvC,IAAI,EAAE,sBAAU;YAChB,WAAW,EAAE,EAAE;YACf,WAAW,EAAE,EAAE;YACf,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,CAAC,MAAM,EAAE,eAAe,CAAC;YACrC,KAAK,EAAE,KAG4B,EAAE,oDAHvB,EACZ,IAAI,EACJ,aAAa,GACT;gBACJ,IAAI,CAAC,IAAI,IAAI,CAAC,aAAa;oBAAE,OAAO,EAAE,CAAC;gBAEvC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;gBAE9C,OAAO;oBACL,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;wBACvB,WAAW,EAAE,MAAM;wBACnB,WAAW,EAAE,6BAA6B;wBAC1C,QAAQ,EAAE,IAAI;wBACd,YAAY,EAAE,WAAW,CAAC,IAAI;qBAC/B,CAAC;iBACH,CAAC;YACJ,CAAC,CAAA;SACF,CAAC;QACF,UAAU,EAAE,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KAAK,CAAC,UAAoB,CAAC,CAAC;YAClD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,aAAuB,CAAC,CAAC;YAExD,OAAO,MAAM,2BAAgB,CAAC,iBAAiB,CAC7C,OAAO,CAAC,IAAI,EACZ,WAAW,CAAC,EAAE,EACd;gBACE,IAAI,EAAG,YAAoB,CAAC,IAAI;gBAChC,kBAAkB,EAAE,gBAAgB;gBACpC,WAAW,EAAE,QAAQ,CAAC,EAAE;gBACxB,iBAAiB,EAAE,eAAe;aACnC,CACF,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ export declare const updatePerson: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").CustomAuthProperty<{
2
+ email: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
3
+ apiKey: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
4
+ }>, {
5
+ personId: import("@scopieflows/pieces-framework").DropdownProperty<unknown, true, import("@scopieflows/pieces-framework").CustomAuthProperty<{
6
+ email: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
7
+ apiKey: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
8
+ }>>;
9
+ fields: import("@scopieflows/pieces-framework").DynamicProperties<false, import("@scopieflows/pieces-framework").CustomAuthProperty<{
10
+ email: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
11
+ apiKey: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
12
+ }>>;
13
+ }>;
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updatePerson = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const constants_1 = require("../common/constants");
7
+ const props_1 = require("../common/props");
8
+ const requests_1 = require("../common/requests");
9
+ exports.updatePerson = (0, pieces_framework_1.createAction)({
10
+ auth: constants_1.CopperAuth,
11
+ name: 'updatePerson',
12
+ displayName: 'Update Person',
13
+ description: 'Updates a person based on matching criteria.',
14
+ props: {
15
+ personId: (0, props_1.peopleDropdown)(['auth']),
16
+ fields: pieces_framework_1.Property.DynamicProperties({
17
+ displayName: '',
18
+ description: '',
19
+ refreshers: ['auth', 'personId'],
20
+ required: false,
21
+ auth: constants_1.CopperAuth,
22
+ props: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, personId }) {
23
+ var _b, _c, _d, _e, _f;
24
+ if (!auth || !personId)
25
+ return {};
26
+ const person = JSON.parse(personId);
27
+ const map = {
28
+ name: pieces_framework_1.Property.ShortText({
29
+ displayName: 'Full Name',
30
+ required: true,
31
+ defaultValue: person.name,
32
+ }),
33
+ emails: pieces_framework_1.Property.Array({
34
+ displayName: 'Emails',
35
+ required: true,
36
+ properties: {
37
+ email: pieces_framework_1.Property.ShortText({
38
+ displayName: 'Email',
39
+ required: true,
40
+ }),
41
+ category: pieces_framework_1.Property.ShortText({
42
+ displayName: 'Category (e.g., work, personal)',
43
+ required: true,
44
+ }),
45
+ },
46
+ defaultValue: person.emails,
47
+ }),
48
+ phone_numbers: pieces_framework_1.Property.Array({
49
+ displayName: 'Phone Numbers',
50
+ required: false,
51
+ properties: {
52
+ number: pieces_framework_1.Property.ShortText({
53
+ displayName: 'Number',
54
+ required: true,
55
+ }),
56
+ category: pieces_framework_1.Property.ShortText({
57
+ displayName: 'Category (e.g., mobile, work, personal)',
58
+ required: true,
59
+ }),
60
+ },
61
+ defaultValue: person.phone_numbers,
62
+ }),
63
+ address_street: pieces_framework_1.Property.ShortText({
64
+ displayName: 'Street',
65
+ required: false,
66
+ defaultValue: (_b = person.address) === null || _b === void 0 ? void 0 : _b.street,
67
+ }),
68
+ address_city: pieces_framework_1.Property.ShortText({
69
+ displayName: 'City',
70
+ required: false,
71
+ defaultValue: (_c = person.address) === null || _c === void 0 ? void 0 : _c.city,
72
+ }),
73
+ address_state: pieces_framework_1.Property.ShortText({
74
+ displayName: 'State/Region',
75
+ required: false,
76
+ defaultValue: (_d = person.address) === null || _d === void 0 ? void 0 : _d.state,
77
+ }),
78
+ address_postal_code: pieces_framework_1.Property.ShortText({
79
+ displayName: 'Postal Code',
80
+ required: false,
81
+ defaultValue: (_e = person.address) === null || _e === void 0 ? void 0 : _e.postal_code,
82
+ }),
83
+ address_country: pieces_framework_1.Property.ShortText({
84
+ displayName: 'Country',
85
+ required: false,
86
+ defaultValue: (_f = person.address) === null || _f === void 0 ? void 0 : _f.country,
87
+ }),
88
+ };
89
+ return map;
90
+ }),
91
+ }),
92
+ },
93
+ run(context) {
94
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
95
+ const fields = context.propsValue.fields;
96
+ const personId = context.propsValue.personId;
97
+ const person = JSON.parse(personId);
98
+ const { name, emails, address_street, address_city, address_state, address_postal_code, address_country, phone_numbers, } = fields;
99
+ const normEmails = (Array.isArray(emails) ? emails : [])
100
+ .map((row) => {
101
+ var _a;
102
+ return ({
103
+ email: String((_a = row === null || row === void 0 ? void 0 : row.email) !== null && _a !== void 0 ? _a : '')
104
+ .trim()
105
+ .toLowerCase(),
106
+ category: (0, constants_1.isNonEmptyStr)(row === null || row === void 0 ? void 0 : row.category)
107
+ ? String(row.category).trim()
108
+ : undefined,
109
+ });
110
+ })
111
+ .filter((e) => (0, constants_1.isNonEmptyStr)(e.email));
112
+ if (normEmails.length === 0)
113
+ throw new Error('Please provide at least one valid email.');
114
+ const seen = new Set();
115
+ const dedupedEmails = normEmails.filter((e) => !seen.has(e.email) && (seen.add(e.email), true));
116
+ const normPhones = (Array.isArray(phone_numbers) ? phone_numbers : [])
117
+ .map((p) => {
118
+ var _a;
119
+ return ({
120
+ number: String((_a = p === null || p === void 0 ? void 0 : p.number) !== null && _a !== void 0 ? _a : '').trim(),
121
+ category: (0, constants_1.isNonEmptyStr)(p === null || p === void 0 ? void 0 : p.category)
122
+ ? String(p.category).trim()
123
+ : undefined,
124
+ });
125
+ })
126
+ .filter((p) => (0, constants_1.isNonEmptyStr)(p.number));
127
+ const address = [
128
+ address_street,
129
+ address_city,
130
+ address_state,
131
+ address_postal_code,
132
+ address_country,
133
+ ].some(constants_1.isNonEmptyStr)
134
+ ? {
135
+ street: (0, constants_1.isNonEmptyStr)(address_street)
136
+ ? address_street.trim()
137
+ : undefined,
138
+ city: (0, constants_1.isNonEmptyStr)(address_city) ? address_city.trim() : undefined,
139
+ state: (0, constants_1.isNonEmptyStr)(address_state)
140
+ ? address_state.trim()
141
+ : undefined,
142
+ postal_code: (0, constants_1.isNonEmptyStr)(address_postal_code)
143
+ ? address_postal_code.trim()
144
+ : undefined,
145
+ country: (0, constants_1.isNonEmptyStr)(address_country)
146
+ ? address_country.trim()
147
+ : undefined,
148
+ }
149
+ : undefined;
150
+ const body = Object.assign(Object.assign({ name, emails: dedupedEmails }, (normPhones.length ? { phone_numbers: normPhones } : {})), (address ? { address } : {}));
151
+ return yield requests_1.CopperApiService.updatePerson(context.auth, person.id, body);
152
+ });
153
+ },
154
+ });
155
+ //# sourceMappingURL=update-person.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-person.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/copper/src/lib/actions/update-person.ts"],"names":[],"mappings":";;;;AAAA,oEAIuC;AACvC,mDAAgE;AAChE,2CAAiD;AACjD,iDAAsD;AAEzC,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACvC,IAAI,EAAE,sBAAU;IAChB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,8CAA8C;IAC3D,KAAK,EAAE;QACL,QAAQ,EAAE,IAAA,sBAAc,EAAC,CAAC,MAAM,CAAC,CAAC;QAClC,MAAM,EAAE,2BAAQ,CAAC,iBAAiB,CAAC;YACjC,WAAW,EAAE,EAAE;YACf,WAAW,EAAE,EAAE;YACf,UAAU,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC;YAChC,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,sBAAU;YA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AC,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GACxD,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAChC,CAAC;YAEF,OAAO,MAAM,2BAAgB,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,EAAG,IAAI,CAAC,CAAC;QAC7E,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ export declare const updateProject: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").CustomAuthProperty<{
2
+ email: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
3
+ apiKey: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
4
+ }>, {
5
+ projectId: import("@scopieflows/pieces-framework").DropdownProperty<unknown, true, import("@scopieflows/pieces-framework").CustomAuthProperty<{
6
+ email: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
7
+ apiKey: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
8
+ }>> | import("@scopieflows/pieces-framework").DropdownProperty<unknown, false, import("@scopieflows/pieces-framework").CustomAuthProperty<{
9
+ email: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
10
+ apiKey: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
11
+ }>>;
12
+ updateFields: import("@scopieflows/pieces-framework").DynamicProperties<false, import("@scopieflows/pieces-framework").CustomAuthProperty<{
13
+ email: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
14
+ apiKey: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
15
+ }>>;
16
+ }>;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateProject = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const constants_1 = require("../common/constants");
7
+ const props_1 = require("../common/props");
8
+ const requests_1 = require("../common/requests");
9
+ exports.updateProject = (0, pieces_framework_1.createAction)({
10
+ auth: constants_1.CopperAuth,
11
+ name: 'updateProject',
12
+ displayName: 'Update Project',
13
+ description: 'Updates a project record.',
14
+ props: {
15
+ projectId: (0, props_1.projectsDropdown)({ refreshers: ['auth'], required: true }),
16
+ updateFields: pieces_framework_1.Property.DynamicProperties({
17
+ displayName: '',
18
+ description: '',
19
+ refreshers: ['auth', 'projectId'],
20
+ auth: constants_1.CopperAuth,
21
+ required: false,
22
+ props: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, projectId }) {
23
+ if (!auth || !projectId)
24
+ return {};
25
+ const project = JSON.parse(projectId);
26
+ const map = {
27
+ name: pieces_framework_1.Property.ShortText({
28
+ displayName: 'Name',
29
+ description: 'The name of the project',
30
+ required: true,
31
+ defaultValue: project.name,
32
+ }),
33
+ details: pieces_framework_1.Property.ShortText({
34
+ displayName: 'Details',
35
+ description: 'The details of the project',
36
+ required: false,
37
+ defaultValue: project.details,
38
+ }),
39
+ };
40
+ return map;
41
+ }),
42
+ }),
43
+ },
44
+ run(context) {
45
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
46
+ const { projectId, updateFields } = context.propsValue;
47
+ const { name, details } = updateFields;
48
+ const project = JSON.parse(projectId);
49
+ return yield requests_1.CopperApiService.updateProject(context.auth, project.id, {
50
+ name,
51
+ details,
52
+ });
53
+ });
54
+ },
55
+ });
56
+ //# sourceMappingURL=update-project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-project.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/copper/src/lib/actions/update-project.ts"],"names":[],"mappings":";;;;AAAA,oEAIuC;AACvC,mDAAiD;AACjD,2CAAmD;AACnD,iDAAsD;AAEzC,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,sBAAU;IAChB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,gBAAgB;IAC7B,W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,MAAM,2BAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAG;gBACrE,IAAI;gBACJ,OAAO;aACR,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { AppConnectionValueForAuthProperty } from '@scopieflows/pieces-framework';
2
+ export declare const BASE_URL = "https://api.copper.com/developer_api";
3
+ export declare const CopperAuth: import("@scopieflows/pieces-framework").CustomAuthProperty<{
4
+ email: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
5
+ apiKey: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
6
+ }>;
7
+ export declare const API_ENDPOINTS: {
8
+ USERS: string;
9
+ WEBHOOKS: string;
10
+ PEOPLE: string;
11
+ LEADS: string;
12
+ COMPANIES: string;
13
+ OPPORTUNITIES: string;
14
+ TASKS: string;
15
+ PIPELINES: string;
16
+ PROJECTS: string;
17
+ };
18
+ export type CopperAuthType = AppConnectionValueForAuthProperty<typeof CopperAuth>;
19
+ export declare const isNonEmptyStr: (v: any) => boolean;
20
+ export declare const toUnix: (iso?: string | null) => number | undefined;
21
+ export type CopperActivity = {
22
+ id: number;
23
+ name?: string;
24
+ details?: string;
25
+ assignee_id?: number;
26
+ custom_activity_type_id?: number;
27
+ parent?: {
28
+ type: 'person' | 'company' | 'lead' | 'opportunity' | 'project';
29
+ id: number;
30
+ };
31
+ activity_date?: number;
32
+ date_created: number;
33
+ date_modified?: number;
34
+ tags?: string[];
35
+ };
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toUnix = exports.isNonEmptyStr = exports.API_ENDPOINTS = exports.CopperAuth = exports.BASE_URL = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const requests_1 = require("./requests");
7
+ const shared_1 = require("@scopieflows/shared");
8
+ exports.BASE_URL = 'https://api.copper.com/developer_api';
9
+ exports.CopperAuth = pieces_framework_1.PieceAuth.CustomAuth({
10
+ description: '',
11
+ required: true,
12
+ props: {
13
+ email: pieces_framework_1.Property.ShortText({
14
+ displayName: 'Email Address',
15
+ description: 'Email Address of the Token Owner',
16
+ required: true,
17
+ }),
18
+ apiKey: pieces_framework_1.Property.ShortText({
19
+ displayName: 'API Key',
20
+ description: 'Your API Key in settings > integrations',
21
+ required: true,
22
+ }),
23
+ },
24
+ validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
25
+ try {
26
+ yield requests_1.CopperApiService.fetchCurrentUser({ props: auth, type: shared_1.AppConnectionType.CUSTOM_AUTH });
27
+ return {
28
+ valid: true,
29
+ };
30
+ }
31
+ catch (err) {
32
+ return {
33
+ valid: false,
34
+ error: "Invalid API Credentials, please check your credentials and try again"
35
+ };
36
+ }
37
+ }),
38
+ });
39
+ exports.API_ENDPOINTS = {
40
+ USERS: '/users',
41
+ WEBHOOKS: '/webhooks',
42
+ PEOPLE: '/people',
43
+ LEADS: '/leads',
44
+ COMPANIES: '/companies',
45
+ OPPORTUNITIES: '/opportunities',
46
+ TASKS: '/tasks',
47
+ PIPELINES: '/pipelines',
48
+ PROJECTS: '/projects',
49
+ };
50
+ const isNonEmptyStr = (v) => typeof v === 'string' && v.trim().length > 0;
51
+ exports.isNonEmptyStr = isNonEmptyStr;
52
+ const toUnix = (iso) => iso ? Math.floor(new Date(iso).getTime() / 1000) : undefined;
53
+ exports.toUnix = toUnix;
54
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/copper/src/lib/common/constants.ts"],"names":[],"mappings":";;;;AAAA,oEAAuG;AACvG,yCAA8C;AAC9C,gDAAwD;AAE3C,QAAA,QAAQ,GAAG,sCAAsC,CAAC;AAElD,QAAA,UAAU,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC7C,WAAW,EAAE,EAAE;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