@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,38 +0,0 @@
1
- export interface Payload {
2
- action_source: string;
3
- currency: string;
4
- event_time: string;
5
- user_data: {
6
- externalId?: string;
7
- email?: string;
8
- phone?: string;
9
- gender?: string;
10
- dateOfBirth?: string;
11
- lastName?: string;
12
- firstName?: string;
13
- city?: string;
14
- state?: string;
15
- zip?: string;
16
- country?: string;
17
- client_ip_address?: string;
18
- client_user_agent?: string;
19
- fbc?: string;
20
- fbp?: string;
21
- subscriptionID?: string;
22
- leadID?: number;
23
- fbLoginID?: number;
24
- };
25
- value: number;
26
- content_ids?: string[];
27
- content_name?: string;
28
- content_type?: string;
29
- contents?: {
30
- id?: string;
31
- quantity?: number;
32
- item_price?: number;
33
- delivery_category?: string;
34
- }[];
35
- event_id?: string;
36
- event_source_url?: string;
37
- num_items?: number;
38
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=generated-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/facebook-conversions-api/purchase/generated-types.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- import { ActionDefinition } from '@segment/actions-core';
2
- import type { Settings } from '../generated-types';
3
- import type { Payload } from './generated-types';
4
- declare const action: ActionDefinition<Settings, Payload>;
5
- export default action;
@@ -1,92 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const actions_core_1 = require("@segment/actions-core");
4
- const constants_1 = require("../constants");
5
- const fb_capi_properties_1 = require("../fb-capi-properties");
6
- const fb_capi_user_data_1 = require("../fb-capi-user-data");
7
- const action = {
8
- title: 'Purchase',
9
- description: 'Send event when a user completes a purchase',
10
- defaultSubscription: 'type = "track" and event = "Order Completed"',
11
- fields: {
12
- action_source: { ...fb_capi_properties_1.action_source, required: true },
13
- currency: { ...fb_capi_properties_1.currency, required: true },
14
- event_time: { ...fb_capi_properties_1.event_time, required: true },
15
- user_data: fb_capi_user_data_1.user_data_field,
16
- value: {
17
- ...fb_capi_properties_1.value,
18
- required: true,
19
- default: { '@path': '$.properties.revenue' }
20
- },
21
- content_ids: fb_capi_properties_1.content_ids,
22
- content_name: fb_capi_properties_1.content_name,
23
- content_type: fb_capi_properties_1.content_type,
24
- contents: {
25
- ...fb_capi_properties_1.contents,
26
- default: {
27
- '@arrayPath': ["$.properties.products", {
28
- id: {
29
- '@path': '$.product_id'
30
- },
31
- quantity: {
32
- '@path': '$.quantity'
33
- },
34
- item_price: {
35
- '@path': '$.price'
36
- }
37
- }]
38
- }
39
- },
40
- event_id: fb_capi_properties_1.event_id,
41
- event_source_url: fb_capi_properties_1.event_source_url,
42
- num_items: fb_capi_properties_1.num_items,
43
- },
44
- perform: (request, { payload, settings }) => {
45
- if (!constants_1.CURRENCY_ISO_CODES.has(payload.currency)) {
46
- throw new actions_core_1.IntegrationError(`${payload.currency} is not a valid currency code.`, 'Misconfigured required field', 400);
47
- }
48
- if (!payload.user_data) {
49
- throw new actions_core_1.IntegrationError('Must include at least one user data property', 'Misconfigured required field', 400);
50
- }
51
- if (payload.action_source === 'website' && payload.user_data.client_user_agent === undefined) {
52
- throw new actions_core_1.IntegrationError('If action source is "Website" then client_user_agent must be defined', 'Misconfigured required field', 400);
53
- }
54
- const valid_delivery_categories = ['in_store', 'curbside', 'home_delivery'];
55
- if (payload.contents) {
56
- payload.contents.forEach((obj, index) => {
57
- if (!obj.id) {
58
- throw new actions_core_1.IntegrationError("Contents objects must include an 'id' parameter.", 'Misconfigured required field', 400);
59
- }
60
- if (obj.delivery_category && !valid_delivery_categories.includes(obj.delivery_category)) {
61
- throw new actions_core_1.IntegrationError(`contents[${index}].delivery_category must be one of {in_store, home_delivery, curbside}.`, 'Misconfigured field', 400);
62
- }
63
- });
64
- }
65
- return request(`https://graph.facebook.com/v${constants_1.API_VERSION}/${settings.pixelId}/events`, {
66
- method: 'POST',
67
- json: {
68
- data: [
69
- {
70
- event_name: 'Purchase',
71
- event_time: payload.event_time,
72
- action_source: payload.action_source,
73
- event_source_url: payload.event_source_url,
74
- event_id: payload.event_id,
75
- user_data: fb_capi_user_data_1.hash_user_data({ user_data: payload.user_data }),
76
- custom_data: {
77
- currency: payload.currency,
78
- value: payload.value,
79
- content_ids: payload.content_ids,
80
- content_name: payload.content_name,
81
- content_type: payload.content_type,
82
- contents: payload.contents,
83
- num_items: payload.num_items,
84
- }
85
- }
86
- ]
87
- }
88
- });
89
- }
90
- };
91
- exports.default = action;
92
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/facebook-conversions-api/purchase/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAG1E,4CAA8D;AAC9D,8DAA4K;AAC5K,4DAAsE;AAEtE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,UAAU;IACjB,WAAW,EAAE,6CAA6C;IAC1D,mBAAmB,EAAE,8CAA8C;IACnE,MAAM,EAAE;QACN,aAAa,EAAE,EAAE,GAAG,kCAAa,EAAE,QAAQ,EAAE,IAAI,EAAE;QACnD,QAA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,EAAE,OAAO,CAAC,QAAQ;4BAC1B,SAAS,EAAE,OAAO,CAAC,SAAS;yBAC7B;qBACF;iBACF;aACF;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -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_category?: string;
25
- content_ids?: string[];
26
- contents?: {
27
- id?: string;
28
- quantity?: number;
29
- item_price?: number;
30
- delivery_category?: string;
31
- }[];
32
- currency?: string;
33
- event_id?: string;
34
- event_source_url?: string;
35
- search_string?: string;
36
- value?: number;
37
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=generated-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/facebook-conversions-api/search/generated-types.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- import { ActionDefinition } from '@segment/actions-core';
2
- import type { Settings } from '../generated-types';
3
- import type { Payload } from './generated-types';
4
- declare const action: ActionDefinition<Settings, Payload>;
5
- export default action;
@@ -1,91 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const actions_core_1 = require("@segment/actions-core");
4
- const constants_1 = require("../constants");
5
- const fb_capi_properties_1 = require("../fb-capi-properties");
6
- const fb_capi_user_data_1 = require("../fb-capi-user-data");
7
- const action = {
8
- title: 'Search',
9
- description: 'Send event when a user searches content or products',
10
- defaultSubscription: 'type = "track" and event = "Products Searched"',
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_category: fb_capi_properties_1.content_category,
16
- content_ids: fb_capi_properties_1.content_ids,
17
- contents: {
18
- ...fb_capi_properties_1.contents,
19
- default: [{
20
- id: {
21
- '@path': '$.properties.product_id'
22
- },
23
- quantity: {
24
- '@path': '$.properties.quantity'
25
- },
26
- item_price: {
27
- '@path': '$.properties.price'
28
- }
29
- }]
30
- },
31
- currency: fb_capi_properties_1.currency,
32
- event_id: fb_capi_properties_1.event_id,
33
- event_source_url: fb_capi_properties_1.event_source_url,
34
- search_string: {
35
- label: 'Search String',
36
- description: 'A search query made by a user. This must be a string.',
37
- type: 'string',
38
- default: {
39
- '@path': '$.properties.query'
40
- }
41
- },
42
- value: fb_capi_properties_1.value
43
- },
44
- perform: (request, { payload, settings }) => {
45
- if (payload.currency && !constants_1.CURRENCY_ISO_CODES.has(payload.currency)) {
46
- throw new actions_core_1.IntegrationError(`${payload.currency} is not a valid currency code.`, 'Misconfigured required field', 400);
47
- }
48
- if (!payload.user_data) {
49
- throw new actions_core_1.IntegrationError('Must include at least one user data property', 'Misconfigured required field', 400);
50
- }
51
- if (payload.action_source === 'website' && payload.user_data.client_user_agent === undefined) {
52
- throw new actions_core_1.IntegrationError('If action source is "Website" then client_user_agent must be defined', 'Misconfigured required field', 400);
53
- }
54
- const valid_delivery_categories = ['in_store', 'curbside', 'home_delivery'];
55
- if (payload.contents) {
56
- payload.contents.forEach((obj, index) => {
57
- if (!obj.id) {
58
- throw new actions_core_1.IntegrationError("Contents objects must include an 'id' parameter.", 'Misconfigured required field', 400);
59
- }
60
- if (obj.delivery_category && !valid_delivery_categories.includes(obj.delivery_category)) {
61
- throw new actions_core_1.IntegrationError(`contents[${index}].delivery_category must be one of {in_store, home_delivery, curbside}.`, 'Misconfigured field', 400);
62
- }
63
- });
64
- }
65
- return request(`https://graph.facebook.com/v${constants_1.API_VERSION}/${settings.pixelId}/events`, {
66
- method: 'POST',
67
- json: {
68
- data: [
69
- {
70
- event_name: 'Search',
71
- event_time: payload.event_time,
72
- action_source: payload.action_source,
73
- event_id: payload.event_id,
74
- event_source_url: payload.event_source_url,
75
- user_data: fb_capi_user_data_1.hash_user_data({ user_data: payload.user_data }),
76
- custom_data: {
77
- currency: payload.currency,
78
- content_ids: payload.content_ids,
79
- contents: payload.contents,
80
- content_category: payload.content_category,
81
- value: payload.value,
82
- search_string: payload.search_string
83
- }
84
- }
85
- ]
86
- }
87
- });
88
- }
89
- };
90
- exports.default = action;
91
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/facebook-conversions-api/search/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAG1E,4CAA8D;AAC9D,8DAAuJ;AACvJ,4DAAsE;AAEtE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,QAAQ;IACf,WAAW,EAAE,qDAAqD;IAClE,mBAAmB,EAAE,gDAAgD;IACrE,MAAM,EAAE;QACN,aAAa,EAAE,EAAE,GAAG,kCAAa,EAAE,QAAQ,EAAE,IAAI,EAAE;QACnD,UAAU,EAAE,EAAE,GAAG,+BAAU,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC7C,SAAS,EAAE,mCAAe;QAC1B,gBAAgB,EAAE,qCAAgB;QAClC,WAAW,EAAE,gCAAW;QACxB,QAAQ,EAAE;YACR,GAAG,6BAAQ;YACX,OAAO,EAAE,CAAC;oBACR,EAAE,EAAE;wBACF,OAAO,EAAE,yBAAyB;qBACnC;oBACD,QAAQ,EAAE;wBACR,OAAO,EAAE,uBAAuB;qBACjC;oBACD,UAAU,EAAE;wBACV,OAAO,EAAE,oBAAoB;qBAC9B;iBACF,CAAC;SACH;QACD,QAAQ,EAAE,6BAAQ;QAClB,QAAQ,EAAE,6BAAQ;QAClB,gBAA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AM,IAAI,+BAAgB,CACxB,YAAY,KAAK,yEAAyE,EAC1F,qBAAqB,EACrB,GAAG,CACJ,CAAA;iBACF;YACH,CAAC,CAAC,CAAA;SACH;QAED,OAAO,OAAO,CAAC,+BAA+B,uBAAW,IAAI,QAAQ,CAAC,OAAO,SAAS,EAAE;YACtF,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,IAAI,EAAE;oBACJ;wBACE,UAAU,EAAE,QAAQ;wBACpB,UAAU,EAAE,OAAO,CAAC,UAAU;wBAC9B,aAAa,EAAE,OAAO,CAAC,aAAa;wBACpC,QAAQ,EAAE,OAAO,CAAC,QAAQ;wBAC1B,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;wBAC1C,SAAS,EAAE,kCAAc,CAAC,EAAC,SAAS,EAAE,OAAO,CAAC,SAAS,EAAC,CAAC;wBACzD,WAAW,EAAE;4BACX,QAAQ,EAAE,OAAO,CAAC,QAAQ;4BAC1B,WAAW,EAAE,OAAO,CAAC,WAAW;4BAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ;4BAC1B,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;4BAC1C,KAAK,EAAE,OAAO,CAAC,KAAK;4BACpB,aAAa,EAAE,OAAO,CAAC,aAAa;yBACrC;qBACF;iBACF;aACF;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -1,38 +0,0 @@
1
- export interface Payload {
2
- user_data: {
3
- externalId?: string;
4
- email?: string;
5
- phone?: string;
6
- gender?: string;
7
- dateOfBirth?: string;
8
- lastName?: string;
9
- firstName?: string;
10
- city?: string;
11
- state?: string;
12
- zip?: string;
13
- country?: string;
14
- client_ip_address?: string;
15
- client_user_agent?: string;
16
- fbc?: string;
17
- fbp?: string;
18
- subscriptionID?: string;
19
- leadID?: number;
20
- fbLoginID?: number;
21
- };
22
- event_time: string;
23
- action_source: string;
24
- event_id?: string;
25
- event_source_url?: string;
26
- content_ids?: string[];
27
- content_category?: string;
28
- content_name?: string;
29
- content_type?: string;
30
- contents?: {
31
- id?: string;
32
- quantity?: number;
33
- item_price?: number;
34
- delivery_category?: string;
35
- }[];
36
- currency?: string;
37
- value?: number;
38
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=generated-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/facebook-conversions-api/viewContent/generated-types.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- import { ActionDefinition } from '@segment/actions-core';
2
- import type { Settings } from '../generated-types';
3
- import type { Payload } from './generated-types';
4
- declare const action: ActionDefinition<Settings, Payload>;
5
- export default action;
@@ -1,85 +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 fb_capi_user_data_1 = require("../fb-capi-user-data");
6
- const constants_1 = require("../constants");
7
- const action = {
8
- title: 'View Content',
9
- description: 'Send event when a user views content or a product',
10
- defaultSubscription: 'type = "track" and event = "Product Viewed"',
11
- fields: {
12
- user_data: fb_capi_user_data_1.user_data_field,
13
- event_time: { ...fb_capi_properties_1.event_time, required: true },
14
- action_source: { ...fb_capi_properties_1.action_source, required: true },
15
- event_id: fb_capi_properties_1.event_id,
16
- event_source_url: fb_capi_properties_1.event_source_url,
17
- content_ids: { ...fb_capi_properties_1.content_ids, default: { '@path': '$.properties.product_id' } },
18
- content_category: fb_capi_properties_1.content_category,
19
- content_name: fb_capi_properties_1.content_name,
20
- content_type: fb_capi_properties_1.content_type,
21
- contents: {
22
- ...fb_capi_properties_1.contents,
23
- default: [{
24
- id: {
25
- '@path': '$.properties.product_id'
26
- },
27
- quantity: {
28
- '@path': '$.properties.quantity'
29
- },
30
- item_price: {
31
- '@path': '$.properties.price'
32
- }
33
- }]
34
- },
35
- currency: fb_capi_properties_1.currency,
36
- value: { ...fb_capi_properties_1.value, default: { '@path': '$.properties.price' } }
37
- },
38
- perform: (request, { payload, settings }) => {
39
- if (payload.currency && !constants_1.CURRENCY_ISO_CODES.has(payload.currency)) {
40
- throw new actions_core_1.IntegrationError(`${payload.currency} is not a valid currency code.`, 'Misconfigured required field', 400);
41
- }
42
- if (!payload.user_data) {
43
- throw new actions_core_1.IntegrationError('Must include at least one user data property', 'Misconfigured required field', 400);
44
- }
45
- if (payload.action_source === 'website' && payload.user_data.client_user_agent === undefined) {
46
- throw new actions_core_1.IntegrationError('If action source is "Website" then client_user_agent must be defined', 'Misconfigured required field', 400);
47
- }
48
- const valid_delivery_categories = ['in_store', 'curbside', 'home_delivery'];
49
- if (payload.contents) {
50
- payload.contents.forEach((obj, index) => {
51
- if (!obj.id) {
52
- throw new actions_core_1.IntegrationError("Contents objects must include an 'id' parameter.", 'Misconfigured required field', 400);
53
- }
54
- if (obj.delivery_category && !valid_delivery_categories.includes(obj.delivery_category)) {
55
- throw new actions_core_1.IntegrationError(`contents[${index}].delivery_category must be one of {in_store, home_delivery, curbside}.`, 'Misconfigured field', 400);
56
- }
57
- });
58
- }
59
- return request(`https://graph.facebook.com/v${constants_1.API_VERSION}/${settings.pixelId}/events`, {
60
- method: 'POST',
61
- json: {
62
- data: [
63
- {
64
- event_name: 'ViewContent',
65
- event_time: payload.event_time,
66
- action_source: payload.action_source,
67
- event_id: payload.event_id,
68
- event_source_url: payload.event_source_url,
69
- user_data: fb_capi_user_data_1.hash_user_data({ user_data: payload.user_data }),
70
- custom_data: {
71
- currency: payload.currency,
72
- value: payload.value,
73
- content_ids: payload.content_ids,
74
- content_name: payload.content_name,
75
- content_type: payload.content_type,
76
- contents: payload.contents
77
- }
78
- }
79
- ]
80
- }
81
- });
82
- }
83
- };
84
- exports.default = action;
85
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/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