@segment/action-destinations 3.28.1-alpha.1 → 3.30.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/dist/destinations/index.js +0 -1
  2. package/dist/destinations/index.js.map +1 -1
  3. package/dist/destinations/mixpanel/groupIdentifyUser/generated-types.d.ts +1 -1
  4. package/dist/destinations/mixpanel/groupIdentifyUser/index.d.ts +1 -1
  5. package/dist/destinations/mixpanel/groupIdentifyUser/index.js +10 -8
  6. package/dist/destinations/mixpanel/groupIdentifyUser/index.js.map +1 -1
  7. package/dist/destinations/pipedrive/createUpdateActivity/generated-types.d.ts +17 -0
  8. package/dist/destinations/{facebook-conversions-api/addToCart → pipedrive/createUpdateActivity}/generated-types.js +0 -0
  9. package/dist/destinations/pipedrive/createUpdateActivity/generated-types.js.map +1 -0
  10. package/dist/destinations/{facebook-conversions-api/custom → pipedrive/createUpdateActivity}/index.d.ts +1 -1
  11. package/dist/destinations/pipedrive/createUpdateActivity/index.js +157 -0
  12. package/dist/destinations/pipedrive/createUpdateActivity/index.js.map +1 -0
  13. package/dist/destinations/pipedrive/createUpdateDeal/generated-types.d.ts +18 -0
  14. package/dist/destinations/{facebook-conversions-api/custom → pipedrive/createUpdateDeal}/generated-types.js +0 -0
  15. package/dist/destinations/pipedrive/createUpdateDeal/generated-types.js.map +1 -0
  16. package/dist/destinations/{facebook-conversions-api/pageView → pipedrive/createUpdateDeal}/index.d.ts +1 -1
  17. package/dist/destinations/pipedrive/createUpdateDeal/index.js +174 -0
  18. package/dist/destinations/pipedrive/createUpdateDeal/index.js.map +1 -0
  19. package/dist/destinations/pipedrive/createUpdateLead/generated-types.d.ts +15 -0
  20. package/dist/destinations/{facebook-conversions-api → pipedrive/createUpdateLead}/generated-types.js +0 -0
  21. package/dist/destinations/pipedrive/createUpdateLead/generated-types.js.map +1 -0
  22. package/dist/destinations/{facebook-conversions-api/initiateCheckout → pipedrive/createUpdateLead}/index.d.ts +1 -1
  23. package/dist/destinations/pipedrive/createUpdateLead/index.js +129 -0
  24. package/dist/destinations/pipedrive/createUpdateLead/index.js.map +1 -0
  25. package/dist/destinations/pipedrive/createUpdateNote/generated-types.d.ts +11 -0
  26. package/dist/destinations/{facebook-conversions-api/initiateCheckout → pipedrive/createUpdateNote}/generated-types.js +0 -0
  27. package/dist/destinations/pipedrive/createUpdateNote/generated-types.js.map +1 -0
  28. package/dist/destinations/{facebook-conversions-api/addToCart → pipedrive/createUpdateNote}/index.d.ts +1 -1
  29. package/dist/destinations/pipedrive/createUpdateNote/index.js +115 -0
  30. package/dist/destinations/pipedrive/createUpdateNote/index.js.map +1 -0
  31. package/dist/destinations/pipedrive/createUpdateOrganization/generated-types.d.ts +5 -4
  32. package/dist/destinations/pipedrive/createUpdateOrganization/index.js +38 -30
  33. package/dist/destinations/pipedrive/createUpdateOrganization/index.js.map +1 -1
  34. package/dist/destinations/pipedrive/createUpdatePerson/generated-types.d.ts +6 -5
  35. package/dist/destinations/pipedrive/createUpdatePerson/index.js +39 -55
  36. package/dist/destinations/pipedrive/createUpdatePerson/index.js.map +1 -1
  37. package/dist/destinations/pipedrive/generated-types.d.ts +3 -0
  38. package/dist/destinations/pipedrive/index.js +31 -2
  39. package/dist/destinations/pipedrive/index.js.map +1 -1
  40. package/dist/destinations/pipedrive/pipedriveApi/activities.d.ts +17 -0
  41. package/dist/destinations/pipedrive/pipedriveApi/activities.js +11 -0
  42. package/dist/destinations/pipedrive/pipedriveApi/activities.js.map +1 -0
  43. package/dist/destinations/pipedrive/pipedriveApi/deals.d.ts +18 -0
  44. package/dist/destinations/pipedrive/pipedriveApi/deals.js +8 -0
  45. package/dist/destinations/pipedrive/pipedriveApi/deals.js.map +1 -0
  46. package/dist/destinations/pipedrive/pipedriveApi/domain.d.ts +19 -0
  47. package/dist/destinations/pipedrive/pipedriveApi/domain.js +3 -0
  48. package/dist/destinations/pipedrive/pipedriveApi/domain.js.map +1 -0
  49. package/dist/destinations/pipedrive/pipedriveApi/leads.d.ts +12 -0
  50. package/dist/destinations/pipedrive/pipedriveApi/leads.js +8 -0
  51. package/dist/destinations/pipedrive/pipedriveApi/leads.js.map +1 -0
  52. package/dist/destinations/pipedrive/pipedriveApi/notes.d.ts +11 -0
  53. package/dist/destinations/pipedrive/pipedriveApi/notes.js +8 -0
  54. package/dist/destinations/pipedrive/pipedriveApi/notes.js.map +1 -0
  55. package/dist/destinations/pipedrive/pipedriveApi/organizations.d.ts +8 -0
  56. package/dist/destinations/pipedrive/pipedriveApi/organizations.js +19 -0
  57. package/dist/destinations/pipedrive/pipedriveApi/organizations.js.map +1 -0
  58. package/dist/destinations/pipedrive/pipedriveApi/persons.d.ts +10 -0
  59. package/dist/destinations/pipedrive/pipedriveApi/persons.js +19 -0
  60. package/dist/destinations/pipedrive/pipedriveApi/persons.js.map +1 -0
  61. package/dist/destinations/pipedrive/pipedriveApi/pipedrive-client.d.ts +29 -0
  62. package/dist/destinations/pipedrive/pipedriveApi/pipedrive-client.js +118 -0
  63. package/dist/destinations/pipedrive/pipedriveApi/pipedrive-client.js.map +1 -0
  64. package/dist/lib/test-data.js +9 -2
  65. package/dist/lib/test-data.js.map +1 -1
  66. package/package.json +3 -4
  67. package/dist/destinations/facebook-conversions-api/addToCart/generated-types.d.ts +0 -37
  68. package/dist/destinations/facebook-conversions-api/addToCart/generated-types.js.map +0 -1
  69. package/dist/destinations/facebook-conversions-api/addToCart/index.js +0 -84
  70. package/dist/destinations/facebook-conversions-api/addToCart/index.js.map +0 -1
  71. package/dist/destinations/facebook-conversions-api/constants.d.ts +0 -4
  72. package/dist/destinations/facebook-conversions-api/constants.js +0 -485
  73. package/dist/destinations/facebook-conversions-api/constants.js.map +0 -1
  74. package/dist/destinations/facebook-conversions-api/custom/generated-types.d.ts +0 -30
  75. package/dist/destinations/facebook-conversions-api/custom/generated-types.js.map +0 -1
  76. package/dist/destinations/facebook-conversions-api/custom/index.js +0 -58
  77. package/dist/destinations/facebook-conversions-api/custom/index.js.map +0 -1
  78. package/dist/destinations/facebook-conversions-api/fb-capi-properties.d.ts +0 -13
  79. package/dist/destinations/facebook-conversions-api/fb-capi-properties.js +0 -100
  80. package/dist/destinations/facebook-conversions-api/fb-capi-properties.js.map +0 -1
  81. package/dist/destinations/facebook-conversions-api/fb-capi-user-data.d.ts +0 -7
  82. package/dist/destinations/facebook-conversions-api/fb-capi-user-data.js +0 -227
  83. package/dist/destinations/facebook-conversions-api/fb-capi-user-data.js.map +0 -1
  84. package/dist/destinations/facebook-conversions-api/generated-types.d.ts +0 -3
  85. package/dist/destinations/facebook-conversions-api/generated-types.js.map +0 -1
  86. package/dist/destinations/facebook-conversions-api/index.d.ts +0 -4
  87. package/dist/destinations/facebook-conversions-api/index.js +0 -51
  88. package/dist/destinations/facebook-conversions-api/index.js.map +0 -1
  89. package/dist/destinations/facebook-conversions-api/initiateCheckout/generated-types.d.ts +0 -37
  90. package/dist/destinations/facebook-conversions-api/initiateCheckout/generated-types.js.map +0 -1
  91. package/dist/destinations/facebook-conversions-api/initiateCheckout/index.js +0 -89
  92. package/dist/destinations/facebook-conversions-api/initiateCheckout/index.js.map +0 -1
  93. package/dist/destinations/facebook-conversions-api/pageView/generated-types.d.ts +0 -26
  94. package/dist/destinations/facebook-conversions-api/pageView/generated-types.js +0 -3
  95. package/dist/destinations/facebook-conversions-api/pageView/generated-types.js.map +0 -1
  96. package/dist/destinations/facebook-conversions-api/pageView/index.js +0 -43
  97. package/dist/destinations/facebook-conversions-api/pageView/index.js.map +0 -1
  98. package/dist/destinations/facebook-conversions-api/purchase/generated-types.d.ts +0 -38
  99. package/dist/destinations/facebook-conversions-api/purchase/generated-types.js +0 -3
  100. package/dist/destinations/facebook-conversions-api/purchase/generated-types.js.map +0 -1
  101. package/dist/destinations/facebook-conversions-api/purchase/index.d.ts +0 -5
  102. package/dist/destinations/facebook-conversions-api/purchase/index.js +0 -92
  103. package/dist/destinations/facebook-conversions-api/purchase/index.js.map +0 -1
  104. package/dist/destinations/facebook-conversions-api/search/generated-types.d.ts +0 -37
  105. package/dist/destinations/facebook-conversions-api/search/generated-types.js +0 -3
  106. package/dist/destinations/facebook-conversions-api/search/generated-types.js.map +0 -1
  107. package/dist/destinations/facebook-conversions-api/search/index.d.ts +0 -5
  108. package/dist/destinations/facebook-conversions-api/search/index.js +0 -91
  109. package/dist/destinations/facebook-conversions-api/search/index.js.map +0 -1
  110. package/dist/destinations/facebook-conversions-api/viewContent/generated-types.d.ts +0 -38
  111. package/dist/destinations/facebook-conversions-api/viewContent/generated-types.js +0 -3
  112. package/dist/destinations/facebook-conversions-api/viewContent/generated-types.js.map +0 -1
  113. package/dist/destinations/facebook-conversions-api/viewContent/index.d.ts +0 -5
  114. package/dist/destinations/facebook-conversions-api/viewContent/index.js +0 -85
  115. package/dist/destinations/facebook-conversions-api/viewContent/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/pipedrive/index.ts"],"names":[],"mappings":";;;;;AAAA,0FAAiE;AACjE,8EAAqD;AAIrD,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,OAAO;IACb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,+FAA+F;gBAC5G,IAAI,EAAE,QAAQ;gBAEd,QAAQ,EAAE,IAAI;aACf;YACD,QAAQ,EAAE;gBACR,KAAK,EAAE,WAAW;gBAClB,WAAW,EACT,qHAAqH;gBACvH,IAAI,EAAE,QAAQ;gBAEd,QAAQ,EAAE,IAAI;aACf;SACF;QACD,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;YAC5C,OAAO,OAAO,CAAC,WAAW,QAAQ,CAAC,MAAM,gCAAgC,CAAC,CAAA;QAC5E,CAAC;KACF;IAED,aAAa,CAAC,EAAE,QAA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AAE,KAAK;aAChB;SACF;QACD,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;YAC5C,OAAO,OAAO,CAAC,WAAW,QAAQ,CAAC,MAAM,gCAAgC,CAAC,CAAA;QAC5E,CAAC;KACF;IAED,aAAa,CAAC,EAAE,QAAQ,EAAE;QACxB,OAAO;YACL,YAAY,EAAE;gBACZ,SAAS,EAAE,QAAQ,CAAC,QAAQ;aAC7B;SACF,CAAA;IACH,CAAC;IAED,OAAO,EAAE;QACP,wBAAwB,EAAxB,kCAAwB;QACxB,kBAAkB,EAAlB,4BAAkB;QAClB,oBAAoB,EAApB,8BAAoB;QACpB,gBAAgB,EAAhB,0BAAgB;QAChB,gBAAgB,EAAhB,0BAAgB;QAChB,gBAAgB,EAAhB,0BAAgB;KACjB;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -0,0 +1,17 @@
1
+ import { ModifiedResponse } from '@segment/actions-core';
2
+ import PipedriveClient from './pipedrive-client';
3
+ export interface Activity extends Record<string, unknown> {
4
+ id?: number;
5
+ subject?: string;
6
+ type?: string;
7
+ public_description?: string;
8
+ note?: string;
9
+ due_date?: string;
10
+ due_time?: string;
11
+ duration?: string;
12
+ done?: boolean | number;
13
+ deal_id?: number;
14
+ person_id?: number;
15
+ org_id?: number;
16
+ }
17
+ export declare function createUpdateActivity(client: PipedriveClient, activity: Activity): Promise<ModifiedResponse>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createUpdateActivity = void 0;
4
+ async function createUpdateActivity(client, activity) {
5
+ if (typeof activity.done !== 'undefined') {
6
+ activity.done = activity.done ? 1 : 0;
7
+ }
8
+ return client.createUpdate('activities', activity);
9
+ }
10
+ exports.createUpdateActivity = createUpdateActivity;
11
+ //# sourceMappingURL=activities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activities.js","sourceRoot":"","sources":["../../../../src/destinations/pipedrive/pipedriveApi/activities.ts"],"names":[],"mappings":";;;AAkBO,KAAK,UAAU,oBAAoB,CAAC,MAAuB,EAAE,QAAkB;IACpF,IAAI,OAAO,QAAQ,CAAC,IAAI,KAAK,WAAW,EAAE;QACxC,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KACtC;IACD,OAAO,MAAM,CAAC,YAAY,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAA;AACpD,CAAC;AALD,oDAKC"}
@@ -0,0 +1,18 @@
1
+ import { ModifiedResponse } from '@segment/actions-core';
2
+ import PipedriveClient from './pipedrive-client';
3
+ export interface Deal extends Record<string, unknown> {
4
+ title: string;
5
+ value?: string;
6
+ currency?: string;
7
+ stage_id?: number;
8
+ status?: string;
9
+ expected_close_date?: string;
10
+ probability?: number;
11
+ lost_reason?: string;
12
+ visible_to?: number;
13
+ add_time?: string;
14
+ id?: number;
15
+ person_id?: number;
16
+ org_id?: number;
17
+ }
18
+ export declare function createUpdateDeal(client: PipedriveClient, deal: Deal): Promise<ModifiedResponse>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createUpdateDeal = void 0;
4
+ async function createUpdateDeal(client, deal) {
5
+ return client.createUpdate('deals', deal);
6
+ }
7
+ exports.createUpdateDeal = createUpdateDeal;
8
+ //# sourceMappingURL=deals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deals.js","sourceRoot":"","sources":["../../../../src/destinations/pipedrive/pipedriveApi/deals.ts"],"names":[],"mappings":";;;AAqBO,KAAK,UAAU,gBAAgB,CAAC,MAAuB,EAAE,IAAU;IACxE,OAAO,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AAC3C,CAAC;AAFD,4CAEC"}
@@ -0,0 +1,19 @@
1
+ export interface PipedriveFields {
2
+ data: PipedriveField[];
3
+ additional_data: {
4
+ pagination: {
5
+ next_start?: number;
6
+ };
7
+ };
8
+ }
9
+ export interface PipedriveField {
10
+ name: string;
11
+ key: string;
12
+ }
13
+ export interface ActivityTypes {
14
+ data: ActivityType[];
15
+ }
16
+ export interface ActivityType {
17
+ name: string;
18
+ key_string: string;
19
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=domain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain.js","sourceRoot":"","sources":["../../../../src/destinations/pipedrive/pipedriveApi/domain.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import { ModifiedResponse } from '@segment/actions-core';
2
+ import PipedriveClient from './pipedrive-client';
3
+ export interface Lead extends Record<string, unknown> {
4
+ title: string;
5
+ expected_close_date?: string;
6
+ visible_to?: number;
7
+ id?: number;
8
+ person_id?: number;
9
+ organization_id?: number;
10
+ add_time?: string;
11
+ }
12
+ export declare function createUpdateLead(client: PipedriveClient, lead: Lead): Promise<ModifiedResponse>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createUpdateLead = void 0;
4
+ async function createUpdateLead(client, lead) {
5
+ return client.createUpdate('leads', lead);
6
+ }
7
+ exports.createUpdateLead = createUpdateLead;
8
+ //# sourceMappingURL=leads.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leads.js","sourceRoot":"","sources":["../../../../src/destinations/pipedrive/pipedriveApi/leads.ts"],"names":[],"mappings":";;;AAeO,KAAK,UAAU,gBAAgB,CAAC,MAAuB,EAAE,IAAU;IACxE,OAAO,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AAC3C,CAAC;AAFD,4CAEC"}
@@ -0,0 +1,11 @@
1
+ import { ModifiedResponse } from '@segment/actions-core';
2
+ import PipedriveClient from './pipedrive-client';
3
+ export interface Note extends Record<string, unknown> {
4
+ content: string;
5
+ add_time?: string;
6
+ deal_id?: number;
7
+ lead_id?: number;
8
+ person_id?: number;
9
+ org_id?: number;
10
+ }
11
+ export declare function createNote(client: PipedriveClient, note: Note): Promise<ModifiedResponse>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createNote = void 0;
4
+ async function createNote(client, note) {
5
+ return client.createUpdate('notes', note);
6
+ }
7
+ exports.createNote = createNote;
8
+ //# sourceMappingURL=notes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notes.js","sourceRoot":"","sources":["../../../../src/destinations/pipedrive/pipedriveApi/notes.ts"],"names":[],"mappings":";;;AAYO,KAAK,UAAU,UAAU,CAAC,MAAuB,EAAE,IAAU;IAClE,OAAO,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AAC3C,CAAC;AAFD,gCAEC"}
@@ -0,0 +1,8 @@
1
+ import { ModifiedResponse } from '@segment/actions-core';
2
+ import type { RequestClient } from '@segment/actions-core';
3
+ export interface Organization {
4
+ name?: string;
5
+ add_time?: string;
6
+ visible_to?: number;
7
+ }
8
+ export declare function createOrUpdateOrganizationById(request: RequestClient, domain: string, organizationId: number | null, organization: Organization): Promise<ModifiedResponse<void>>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createOrUpdateOrganizationById = void 0;
4
+ async function createOrUpdateOrganizationById(request, domain, organizationId, organization) {
5
+ if (organizationId) {
6
+ return request(`https://${domain}.pipedrive.com/api/v1/organizations/${organizationId}`, {
7
+ method: 'put',
8
+ json: organization
9
+ });
10
+ }
11
+ else {
12
+ return request(`https://${domain}.pipedrive.com/api/v1/organizations`, {
13
+ method: 'post',
14
+ json: organization
15
+ });
16
+ }
17
+ }
18
+ exports.createOrUpdateOrganizationById = createOrUpdateOrganizationById;
19
+ //# sourceMappingURL=organizations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizations.js","sourceRoot":"","sources":["../../../../src/destinations/pipedrive/pipedriveApi/organizations.ts"],"names":[],"mappings":";;;AASO,KAAK,UAAU,8BAA8B,CAClD,OAAsB,EACtB,MAAc,EACd,cAA6B,EAC7B,YAA0B;IAE1B,IAAI,cAAc,EAAE;QAElB,OAAO,OAAO,CAAC,WAAW,MAAM,uCAAuC,cAAc,EAAE,EAAE;YACvF,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,YAAY;SACnB,CAAC,CAAA;KACH;SAAM;QAEL,OAAO,OAAO,CAAC,WAAW,MAAM,qCAAqC,EAAE;YACrE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,YAAY;SACnB,CAAC,CAAA;KACH;AACH,CAAC;AAnBD,wEAmBC"}
@@ -0,0 +1,10 @@
1
+ import { ModifiedResponse } from '@segment/actions-core';
2
+ import type { RequestClient } from '@segment/actions-core';
3
+ export interface Person {
4
+ name?: string;
5
+ email?: string[];
6
+ phone?: string[];
7
+ add_time?: string;
8
+ visible_to?: number;
9
+ }
10
+ export declare function createOrUpdatePersonById(request: RequestClient, domain: string, personId: number | null, person: Person): Promise<ModifiedResponse<void>>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createOrUpdatePersonById = void 0;
4
+ async function createOrUpdatePersonById(request, domain, personId, person) {
5
+ if (personId) {
6
+ return request(`https://${domain}.pipedrive.com/api/v1/persons/${personId}`, {
7
+ method: 'put',
8
+ json: person
9
+ });
10
+ }
11
+ else {
12
+ return request(`https://${domain}.pipedrive.com/api/v1/persons`, {
13
+ method: 'post',
14
+ json: person
15
+ });
16
+ }
17
+ }
18
+ exports.createOrUpdatePersonById = createOrUpdatePersonById;
19
+ //# sourceMappingURL=persons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"persons.js","sourceRoot":"","sources":["../../../../src/destinations/pipedrive/pipedriveApi/persons.ts"],"names":[],"mappings":";;;AAWO,KAAK,UAAU,wBAAwB,CAC5C,OAAsB,EACtB,MAAc,EACd,QAAuB,EACvB,MAAc;IAEd,IAAI,QAAQ,EAAE;QAEZ,OAAO,OAAO,CAAC,WAAW,MAAM,iCAAiC,QAAQ,EAAE,EAAE;YAC3E,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,MAAM;SACb,CAAC,CAAA;KACH;SAAM;QAEL,OAAO,OAAO,CAAC,WAAW,MAAM,+BAA+B,EAAE;YAC/D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,MAAM;SACb,CAAC,CAAA;KACH;AACH,CAAC;AAnBD,4DAmBC"}
@@ -0,0 +1,29 @@
1
+ import { Settings } from '../generated-types';
2
+ import type { ExecuteInput, ModifiedResponse, RequestClient } from '@segment/actions-core';
3
+ import { DynamicFieldResponse } from '@segment/actions-core';
4
+ interface SearchFieldTypes {
5
+ deal: 'dealField';
6
+ person: 'personField';
7
+ organization: 'organizationField';
8
+ product: 'productField';
9
+ }
10
+ declare type ItemType = keyof SearchFieldTypes;
11
+ interface PipedriveFieldTypes extends SearchFieldTypes {
12
+ activity: 'activityFields';
13
+ note: 'noteFields';
14
+ }
15
+ declare class PipedriveClient {
16
+ private settings;
17
+ private _request;
18
+ constructor(settings: Settings, request: RequestClient);
19
+ getId(item: ItemType, fieldName: string, term?: string): Promise<number | null>;
20
+ getFields(item: keyof PipedriveFieldTypes): Promise<DynamicFieldResponse>;
21
+ getActivityTypes(): Promise<DynamicFieldResponse>;
22
+ createUpdate(itemPath: string, item: Record<string, unknown>): Promise<ModifiedResponse>;
23
+ post(path: string, payload: Record<string, unknown>): Promise<ModifiedResponse>;
24
+ put(path: string, payload: Record<string, unknown>): Promise<ModifiedResponse>;
25
+ reqWithPayload(path: string, payload: Record<string, unknown>, method: 'post' | 'put'): Promise<ModifiedResponse<unknown>>;
26
+ static filterPayload(payload: Record<string, unknown>): void;
27
+ static fieldHandler(fieldType: keyof PipedriveFieldTypes): (request: RequestClient, { settings }: ExecuteInput<Settings, unknown>) => Promise<DynamicFieldResponse>;
28
+ }
29
+ export default PipedriveClient;
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const get_1 = __importDefault(require("lodash/get"));
7
+ const searchFieldMap = {
8
+ deal: 'dealField',
9
+ person: 'personField',
10
+ product: 'productField',
11
+ organization: 'organizationField'
12
+ };
13
+ const pipedriveFieldMap = {
14
+ ...searchFieldMap,
15
+ activity: 'activityFields',
16
+ note: 'noteFields'
17
+ };
18
+ const cache = {};
19
+ class PipedriveClient {
20
+ constructor(settings, request) {
21
+ this.settings = settings;
22
+ this._request = request;
23
+ }
24
+ async getId(item, fieldName, term) {
25
+ if (!term) {
26
+ return null;
27
+ }
28
+ const searchParams = {
29
+ term,
30
+ field_key: fieldName,
31
+ exact_match: true,
32
+ field_type: searchFieldMap[item]
33
+ };
34
+ let result = null;
35
+ try {
36
+ const search = await this._request(`https://${this.settings.domain}.pipedrive.com/api/v1/itemSearch/field`, {
37
+ searchParams: {
38
+ ...searchParams,
39
+ exact_match: true,
40
+ return_item_ids: true
41
+ }
42
+ });
43
+ result = get_1.default(search, 'data.data[0].id', null);
44
+ }
45
+ catch (e) {
46
+ return result;
47
+ }
48
+ return result;
49
+ }
50
+ async getFields(item) {
51
+ const cachedFields = get_1.default(cache, item, []);
52
+ if (cachedFields.length > 0) {
53
+ return cachedFields;
54
+ }
55
+ const response = await this._request(`https://${this.settings.domain}.pipedrive.com/api/v1/${pipedriveFieldMap[item]}`);
56
+ const body = response.data;
57
+ const fields = body.data.map((f) => ({
58
+ label: f.name,
59
+ value: f.key
60
+ }));
61
+ const record = {
62
+ body: {
63
+ data: fields,
64
+ pagination: {}
65
+ }
66
+ };
67
+ cachedFields[item] = record;
68
+ return record;
69
+ }
70
+ async getActivityTypes() {
71
+ const response = await this._request(`https://${this.settings.domain}.pipedrive.com/api/v1/activityTypes`);
72
+ const activityTypes = response.data;
73
+ const fields = activityTypes.data.map((f) => ({
74
+ label: f.name,
75
+ value: f.key_string
76
+ }));
77
+ const record = {
78
+ body: {
79
+ data: fields,
80
+ pagination: {}
81
+ }
82
+ };
83
+ return record;
84
+ }
85
+ async createUpdate(itemPath, item) {
86
+ if (item.id) {
87
+ const id = item.id;
88
+ delete item['id'];
89
+ return this.put(`${itemPath}/${id}`, item);
90
+ }
91
+ return this.post(itemPath, item);
92
+ }
93
+ async post(path, payload) {
94
+ return this.reqWithPayload(path, payload, 'post');
95
+ }
96
+ async put(path, payload) {
97
+ return this.reqWithPayload(path, payload, 'put');
98
+ }
99
+ async reqWithPayload(path, payload, method) {
100
+ PipedriveClient.filterPayload(payload);
101
+ const urlBase = `https://${this.settings.domain}.pipedrive.com/api/v1`;
102
+ return this._request(`${urlBase}/${path}`, {
103
+ method: method,
104
+ json: payload
105
+ });
106
+ }
107
+ static filterPayload(payload) {
108
+ Object.keys(payload).forEach((key) => payload[key] === undefined && delete payload[key]);
109
+ }
110
+ static fieldHandler(fieldType) {
111
+ return async (request, { settings }) => {
112
+ const client = new PipedriveClient(settings, request);
113
+ return client.getFields(fieldType);
114
+ };
115
+ }
116
+ }
117
+ exports.default = PipedriveClient;
118
+ //# sourceMappingURL=pipedrive-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipedrive-client.js","sourceRoot":"","sources":["../../../../src/destinations/pipedrive/pipedriveApi/pipedrive-client.ts"],"names":[],"mappings":";;;;;AAEA,qDAA4B;AAa5B,MAAM,cAAc,GAAqB;IACvC,IAAI,EAAE,WAAW;IACjB,MAAM,EAAE,aAAa;IACrB,OAAO,EAAE,cAAc;IACvB,YAAY,EAAE,mBAAmB;CAClC,CAAA;AAOD,MAAM,iBAAiB,GAAwB;IAC7C,GAAG,cAAc;IACjB,QAAQ,EAAE,gBAAgB;IAC1B,IAAI,EAAE,YAAY;CACnB,CAAA;AASD,MAAM,KAAK,GA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ports, "__esModule", { value: true });
6
6
  exports.generateTestData = void 0;
7
7
  const chance_1 = __importDefault(require("chance"));
8
- function setTestData(seedName, type, fieldName, format) {
8
+ function setTestData(seedName, type, fieldName, format, choices) {
9
9
  const chance = new chance_1.default(seedName);
10
+ if (Array.isArray(choices)) {
11
+ const choice = chance.pickone(choices);
12
+ if (choice.value) {
13
+ return choice.value;
14
+ }
15
+ return choice;
16
+ }
10
17
  let val;
11
18
  switch (type) {
12
19
  case 'boolean':
@@ -62,7 +69,7 @@ function setTestData(seedName, type, fieldName, format) {
62
69
  function setData(eventData, chanceName, fieldName, field, data) {
63
70
  const { format, multiple, type } = field;
64
71
  if (!data) {
65
- data = setTestData(chanceName, type, fieldName, format);
72
+ data = setTestData(chanceName, type, fieldName, format, field.choices);
66
73
  }
67
74
  eventData[fieldName] = multiple ? [data] : data;
68
75
  return eventData;
@@ -1 +1 @@
1
- {"version":3,"file":"test-data.js","sourceRoot":"","sources":["../../src/lib/test-data.ts"],"names":[],"mappings":";;;;;;AAEA,oDAA2B;AAE3B,SAAS,WAAW,CAAC,QAAgB,EAAE,IAAY,EAAE,SAAkB,EAAE,MAAe;IACtF,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC,QAAQ,CAAC,CAAA;IAEnC,IAAI,GAAQ,CAAA;IACZ,QAAQ,IAAI,EAAE;QACZ,KAAK,SAAS;YACZ,GAAG,GAAG,MAAM,CAAC,IAAI,EAAE,CAAA;YACnB,MAAK;QACP,KAAK,UAAU;YACb,GAAG,GAAG,0BAA0B,CAAA;YAChC,MAAK;QACP,KAAK,SAAS;YACZ,GAAG,GAAG,MAAM,CAAC,OAAO,EAAE,CAAA;YACtB,MAAK;QACP,KAAK,QAAQ;YACX,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAA;YACnC,MAAK;QACP,KAAK,MAAM;YACT,GAAG,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAA;YACvB,MAAK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CAAA;aAC5E;YAED,KAAK,MAAM,YAAY,IAAI,cAAc,EAAE;gBACzC,MAAM,QAAQ,GAAG,UAAU,CAAC,YAAY,CAAC,CAAA;gBACzC,OAAO,GAAG,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAA;aAC7D;YAED,SAAS,GAAG,OAAO,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;YAC9D,SAAQ;SACT;QAED,SAAS,GAAG,OAAO,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC,CAAA;KACtD;IAED,OAAO,CAAC,SAAS,EAAE,YAAY,CAAC,CAAA;AAClC,CAAC;AA7CD,4CA6CC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@segment/action-destinations",
3
3
  "description": "Destination Actions engine and definitions.",
4
- "version": "3.28.1-alpha.1",
4
+ "version": "3.30.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/segmentio/action-destinations",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@amplitude/ua-parser-js": "^0.7.25",
41
- "@segment/actions-core": "^3.19.3-alpha.1",
41
+ "@segment/actions-core": "^3.21.0",
42
42
  "dayjs": "^1.10.7",
43
43
  "lodash": "^4.17.21",
44
44
  "mustache": "^4.2.0"
@@ -57,6 +57,5 @@
57
57
  "setupFilesAfterEnv": [
58
58
  "<rootDir>/test/setup-after-env.ts"
59
59
  ]
60
- },
61
- "gitHead": "a330e148a9e340263f80268c480c5b4d957838f5"
60
+ }
62
61
  }
@@ -1,37 +0,0 @@
1
- export interface Payload {
2
- action_source: string;
3
- event_time: string;
4
- user_data: {
5
- externalId?: string;
6
- email?: string;
7
- phone?: string;
8
- gender?: string;
9
- dateOfBirth?: string;
10
- lastName?: string;
11
- firstName?: string;
12
- city?: string;
13
- state?: string;
14
- zip?: string;
15
- country?: string;
16
- client_ip_address?: string;
17
- client_user_agent?: string;
18
- fbc?: string;
19
- fbp?: string;
20
- subscriptionID?: string;
21
- leadID?: number;
22
- fbLoginID?: number;
23
- };
24
- content_ids?: string[];
25
- content_name?: string;
26
- content_type?: string;
27
- contents?: {
28
- id?: string;
29
- quantity?: number;
30
- item_price?: number;
31
- delivery_category?: string;
32
- }[];
33
- currency?: string;
34
- event_id?: string;
35
- event_source_url?: string;
36
- value?: number;
37
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/facebook-conversions-api/addToCart/generated-types.ts"],"names":[],"mappings":""}
@@ -1,84 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const actions_core_1 = require("@segment/actions-core");
4
- const fb_capi_properties_1 = require("../fb-capi-properties");
5
- const constants_1 = require("../constants");
6
- const fb_capi_user_data_1 = require("../fb-capi-user-data");
7
- const action = {
8
- title: 'Add to Cart',
9
- description: 'Send event when a user adds a product to the shopping cart',
10
- defaultSubscription: 'type = "track" and event = "Product Added"',
11
- fields: {
12
- action_source: { ...fb_capi_properties_1.action_source, required: true },
13
- event_time: { ...fb_capi_properties_1.event_time, required: true },
14
- user_data: fb_capi_user_data_1.user_data_field,
15
- content_ids: fb_capi_properties_1.content_ids,
16
- content_name: fb_capi_properties_1.content_name,
17
- content_type: fb_capi_properties_1.content_type,
18
- contents: {
19
- ...fb_capi_properties_1.contents,
20
- default: [{
21
- id: {
22
- '@path': '$.properties.product_id'
23
- },
24
- quantity: {
25
- '@path': '$.properties.quantity'
26
- },
27
- item_price: {
28
- '@path': '$.properties.price'
29
- }
30
- }]
31
- },
32
- currency: fb_capi_properties_1.currency,
33
- event_id: fb_capi_properties_1.event_id,
34
- event_source_url: fb_capi_properties_1.event_source_url,
35
- value: { ...fb_capi_properties_1.value, default: { '@path': '$.properties.price' } }
36
- },
37
- perform: (request, { payload, settings }) => {
38
- if (payload.currency && !constants_1.CURRENCY_ISO_CODES.has(payload.currency)) {
39
- throw new actions_core_1.IntegrationError(`${payload.currency} is not a valid currency code.`, 'Misconfigured required field', 400);
40
- }
41
- if (!payload.user_data) {
42
- throw new actions_core_1.IntegrationError('Must include at least one user data property', 'Misconfigured required field', 400);
43
- }
44
- if (payload.action_source === 'website' && payload.user_data.client_user_agent === undefined) {
45
- throw new actions_core_1.IntegrationError('If action source is "Website" then client_user_agent must be defined', 'Misconfigured required field', 400);
46
- }
47
- const valid_delivery_categories = ['in_store', 'curbside', 'home_delivery'];
48
- if (payload.contents) {
49
- payload.contents.forEach((obj, index) => {
50
- if (!obj.id) {
51
- throw new actions_core_1.IntegrationError("Contents objects must include an 'id' parameter.", 'Misconfigured required field', 400);
52
- }
53
- if (obj.delivery_category && !valid_delivery_categories.includes(obj.delivery_category)) {
54
- throw new actions_core_1.IntegrationError(`contents[${index}].delivery_category must be one of {in_store, home_delivery, curbside}.`, 'Misconfigured field', 400);
55
- }
56
- });
57
- }
58
- return request(`https://graph.facebook.com/v${constants_1.API_VERSION}/${settings.pixelId}/events`, {
59
- method: 'POST',
60
- json: {
61
- data: [
62
- {
63
- event_name: 'AddToCart',
64
- event_time: payload.event_time,
65
- event_source_url: payload.event_source_url,
66
- event_id: payload.event_id,
67
- action_source: payload.action_source,
68
- user_data: fb_capi_user_data_1.hash_user_data({ user_data: payload.user_data }),
69
- custom_data: {
70
- currency: payload.currency,
71
- value: payload.value,
72
- content_ids: payload.content_ids,
73
- content_name: payload.content_name,
74
- contents: payload.contents,
75
- content_type: payload.content_type
76
- }
77
- }
78
- ]
79
- }
80
- });
81
- }
82
- };
83
- exports.default = action;
84
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/facebook-conversions-api/addToCart/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAG1E,8DAAiK;AACjK,4CAA8D;AAC9D,4DAAsE;AAEtE,MAAM,M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W;4BAChC,YAAY,EAAE,OAAO,CAAC,YAAY;4BAClC,QAAQ,EAAE,OAAO,CAAC,QAAQ;4BAC1B,YAAY,EAAE,OAAO,CAAC,YAAY;yBACnC;qBACF;iBACF;aACF;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -1,4 +0,0 @@
1
- export declare const API_VERSION = "11.0";
2
- export declare const CURRENCY_ISO_CODES: Set<string>;
3
- export declare const US_STATE_CODES: Map<string, string>;
4
- export declare const COUNTRY_CODES: Map<string, string>;