@segment/action-destinations 3.50.2-alpha.0 → 3.50.3

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 (29) hide show
  1. package/dist/destinations/adobe-target/adobeTarget_operations.js +1 -2
  2. package/dist/destinations/adobe-target/adobeTarget_operations.js.map +1 -1
  3. package/dist/destinations/close/createUpdateContactAndLead/generated-types.d.ts +4 -0
  4. package/dist/destinations/close/createUpdateContactAndLead/index.js +31 -8
  5. package/dist/destinations/close/createUpdateContactAndLead/index.js.map +1 -1
  6. package/dist/destinations/close/generated-types.d.ts +1 -0
  7. package/dist/destinations/close/index.js +13 -0
  8. package/dist/destinations/close/index.js.map +1 -1
  9. package/dist/destinations/salesforce/case/generated-types.d.ts +10 -0
  10. package/dist/destinations/salesforce/case/generated-types.js +3 -0
  11. package/dist/destinations/salesforce/case/generated-types.js.map +1 -0
  12. package/dist/destinations/salesforce/case/index.d.ts +5 -0
  13. package/dist/destinations/salesforce/case/index.js +36 -0
  14. package/dist/destinations/salesforce/case/index.js.map +1 -0
  15. package/dist/destinations/salesforce/index.js +3 -1
  16. package/dist/destinations/salesforce/index.js.map +1 -1
  17. package/dist/destinations/salesforce/sf-object-to-shape.js +9 -1
  18. package/dist/destinations/salesforce/sf-object-to-shape.js.map +1 -1
  19. package/dist/destinations/salesforce/sf-types.d.ts +6 -2
  20. package/dist/destinations/tiktok-conversions/generated-types.d.ts +1 -1
  21. package/dist/destinations/tiktok-conversions/index.js +75 -21
  22. package/dist/destinations/tiktok-conversions/index.js.map +1 -1
  23. package/dist/destinations/tiktok-conversions/reportWebEvent/formatter.d.ts +3 -3
  24. package/dist/destinations/tiktok-conversions/reportWebEvent/formatter.js +9 -3
  25. package/dist/destinations/tiktok-conversions/reportWebEvent/formatter.js.map +1 -1
  26. package/dist/destinations/tiktok-conversions/reportWebEvent/generated-types.d.ts +17 -6
  27. package/dist/destinations/tiktok-conversions/reportWebEvent/index.js +123 -28
  28. package/dist/destinations/tiktok-conversions/reportWebEvent/index.js.map +1 -1
  29. package/package.json +2 -2
@@ -32,9 +32,8 @@ class AdobeTarget {
32
32
  }
33
33
  };
34
34
  this.lookupProfile = async (userId, clientCode) => {
35
- const url = `https://${clientCode}.tt.omtrdc.net/rest/v1/profiles/thirdPartyId/${userId}?client=${clientCode}`;
36
35
  try {
37
- await this.request(url, { method: 'get' });
36
+ await this.request(`https://${clientCode}.tt.omtrdc.net/rest/v1/profiles/thirdPartyId/${userId}?client=${clientCode}`, { method: 'get' });
38
37
  }
39
38
  catch (error) {
40
39
  return new actions_core_1.IntegrationError('No profile found in Adobe Target with this mbox3rdPartyId', 'Profile not found', 404);
@@ -1 +1 @@
1
- {"version":3,"file":"adobeTarget_operations.js","sourceRoot":"","sources":["../../../src/destinations/adobe-target/adobeTarget_operations.ts"],"names":[],"mappings":";;AAAA,wDAAuE;AAEvE,SAAS,gBAAgB,CAAC,GAAyB,EAAE,UAAU,GAAG,EAAE,EAAE,aAAsC,EAAE;IAC5G,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QAC/B,MAAM,cAAc,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAA;QAChE,IAAI,OAAO,GAAG,CAAC,GAAG,CAAC,KAAK,QAAQ,IAAI,GAAG,CAAC,GAAG,CAAC,EAAE;YAC5C,UAAU,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAA;SACjD;aAAM;YACL,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,cAAc,EAAE,UAAU,CAAC,CAAA;SACvD;IACH,CAAC,CAAC,CAAA;IACF,OAAO,UAAU,CAAA;AACnB,CAAC;AACD,MAAM,mBAAmB,GAAG,CAAC,MAAmD,EAAE,EAAE,CAClF,MAAM,CAAC,IAAI,CA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;QACpB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;CA4BF;AAvCD,8BAuCC"}
1
+ {"version":3,"file":"adobeTarget_operations.js","sourceRoot":"","sources":["../../../src/destinations/adobe-target/adobeTarget_operations.ts"],"names":[],"mappings":";;AAAA,wDAAuE;AAEvE,SAAS,gBAAgB,CAAC,GAAyB,EAAE,UAAU,GAAG,EAAE,EAAE,aAAsC,EAAE;IAC5G,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QAC/B,MAAM,cAAc,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAA;QAChE,IAAI,OAAO,GAAG,CAAC,GAAG,CAAC,KAAK,QAAQ,IAAI,GAAG,CAAC,GAAG,CAAC,EAAE;YAC5C,UAAU,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAA;SACjD;aAAM;YACL,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,cAAc,EAAE,UAAU,CAAC,CAAA;SACvD;IACH,CAAC,CAAC,CAAA;IACF,OAAO,UAAU,CAAA;AACnB,CAAC;AACD,MAAM,mBAAmB,GAAG,CAAC,MAAmD,EAAE,EAAE,CAClF,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;KAChB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,WAAW,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;KACxD,IAAI,CAAC,GAAG,CAAC,CAAA;AAEd,MAAqB,WAAW;IAM9B,YAAY,MAAc,EAAE,UAAkB,EAAE,MAAc,EAAE,OAAsB;QAOtF,kBAAa,GAAG,KAAK,IAAI,EAAE;YACzB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;YAClE,IAAI,GAAG,EAAE;gBACP,MAAM,GAAG,CAAA;aACV;iBAAM;gBACL,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;gBAC5C,MAAM,UAAU,GAAG,WAAW,IAAI,CAAC,UAAU,qBAC3C,IAAI,CAAC,UACP,kCAAkC,IAAI,CAAC,MAAM,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAA;gBAE9E,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;oBAC9B,MAAM,EAAE,MAAM;iBACf,CAAC,CAAA;aACH;QACH,CAAC,CAAA;QAEO,kBAAa,GAAG,KAAK,EAAE,MAAc,EAAE,UAAkB,EAAyC,EAAE;YAC1G,IAAI;gBACF,MAAM,IAAI,CAAC,OAAO,CAChB,WAAW,UAAU,gDAAgD,MAAM,WAAW,UAAU,EAAE,EAClG,EAAE,MAAM,EAAE,KAAK,EAAE,CAClB,CAAA;aACF;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,IAAI,+BAAgB,CAAC,2DAA2D,EAAE,mBAAmB,EAAE,GAAG,CAAC,CAAA;aACnH;YAED,OAAO,SAAS,CAAA;QAClB,CAAC,CAAA;QAjCC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;CA8BF;AAzCD,8BAyCC"}
@@ -1,5 +1,9 @@
1
1
  export interface Payload {
2
2
  lead_name?: string;
3
+ lead_external_id?: string;
4
+ lead_custom_fields?: {
5
+ [k: string]: unknown;
6
+ };
3
7
  contact_name?: string;
4
8
  contact_email?: string;
5
9
  contact_phone?: string;
@@ -2,21 +2,43 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const action = {
4
4
  title: 'Create or Update Contact and Lead',
5
- description: '',
5
+ description: 'Create or Update Contact and/or Lead. At first Close will try to find ' +
6
+ 'Lead via Lead Company ID. If Lead is not found, Close will try to find ' +
7
+ 'a Contact either via Contact User ID or via Contact Email. If Contact is ' +
8
+ 'not found, Close will create a new Lead and Contact. It will also create ' +
9
+ 'a new Lead and Contact if Contact is found but exists under a Lead with ' +
10
+ 'different Lead Company ID. In case that Close finds find multiple ' +
11
+ 'Contacts with the same Contact User ID or Contact Email, Close will ' +
12
+ 'update up to 10 Contacts, ordered by creation date.',
6
13
  defaultSubscription: 'type = "identify"',
7
14
  fields: {
8
15
  lead_name: {
9
16
  label: 'Lead Name',
10
- description: '',
17
+ description: 'The name of the Lead.',
11
18
  type: 'string',
12
19
  required: false,
13
20
  default: {
14
21
  '@path': '$.traits.company.name'
15
22
  }
16
23
  },
24
+ lead_external_id: {
25
+ label: 'Lead Company ID',
26
+ description: 'Your ID that identifies the Lead. Lead Custom Field ID for Company must be defined in the global integration settings.',
27
+ type: 'string',
28
+ required: false,
29
+ default: {
30
+ '@path': '$.traits.company.id'
31
+ }
32
+ },
33
+ lead_custom_fields: {
34
+ label: 'Lead Custom Fields',
35
+ description: 'Custom Fields to set on the Lead. Key should be Custom Field ID (`cf_xxxx`).',
36
+ type: 'object',
37
+ required: false
38
+ },
17
39
  contact_name: {
18
40
  label: 'Contact Name',
19
- description: '',
41
+ description: 'The name of the Contact.',
20
42
  type: 'string',
21
43
  required: false,
22
44
  default: {
@@ -25,7 +47,7 @@ const action = {
25
47
  },
26
48
  contact_email: {
27
49
  label: 'Contact Email',
28
- description: '',
50
+ description: 'Can be used for looking up the Contact. If the Contact already has different email address, this value will be appended.',
29
51
  type: 'string',
30
52
  required: false,
31
53
  default: {
@@ -34,7 +56,7 @@ const action = {
34
56
  },
35
57
  contact_phone: {
36
58
  label: 'Contact Phone',
37
- description: '',
59
+ description: 'If the Contact already has different phone number, this value will be appended.',
38
60
  type: 'string',
39
61
  required: false,
40
62
  default: {
@@ -43,7 +65,7 @@ const action = {
43
65
  },
44
66
  contact_url: {
45
67
  label: 'Contact URL',
46
- description: '',
68
+ description: 'If the Contact already has different URL, this value will be appended.',
47
69
  type: 'string',
48
70
  required: false,
49
71
  default: {
@@ -52,7 +74,7 @@ const action = {
52
74
  },
53
75
  contact_title: {
54
76
  label: 'Contact Title',
55
- description: '',
77
+ description: 'The title of the Contact.',
56
78
  type: 'string',
57
79
  required: false,
58
80
  default: {
@@ -77,7 +99,8 @@ const action = {
77
99
  },
78
100
  perform: (request, data) => {
79
101
  const settings = {
80
- contact_custom_field_id_for_user_id: data.settings.contact_custom_field_id_for_user_id
102
+ contact_custom_field_id_for_user_id: data.settings.contact_custom_field_id_for_user_id,
103
+ lead_custom_field_id_for_company_id: data.settings.lead_custom_field_id_for_company_id
81
104
  };
82
105
  return request('https://services.close.com/webhooks/segment/actions/create-update-contact-and-lead/', {
83
106
  method: 'post',
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/close/createUpdateContactAndLead/index.ts"],"names":[],"mappings":";;AAIA,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,mCAAmC;IAC1C,WAAW,EAAE,EAAE;IACf,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,EAAE;YACf,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,uBAAuB;aACjC;SACF;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,cAAc;YACrB,WAAW,EAAE,EAAE;YACf,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,eAAe;aACzB;SACF;QACD,aAA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AAQ,EAAE;SACjD,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/close/createUpdateContactAndLead/index.ts"],"names":[],"mappings":";;AAIA,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,mCAAmC;IAC1C,WAAW,EACT,wEAAwE;QACxE,yEAAyE;QACzE,2EAA2E;QAC3E,2EAA2E;QAC3E,0EAA0E;QAC1E,oEAAoE;QACpE,sEAAsE;QACtE,qDAAqD;IACvD,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,uBAAuB;YACpC,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,uBAAuB;aACjC;SACF;QACD,gBAAgB,EAAE;YAChB,KAAK,EAAE,iBAAiB;YACxB,WAAW,EACT,wHAAwH;YAC1H,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,qBAAqB;aAC/B;SACF;QACD,kBAAkB,EAAE;YAClB,KAAK,EAAE,oBAAoB;YAC3B,WAAW,EAAE,8EAA8E;YAC3F,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,cAAc;YACrB,WAAW,EAAE,0BAA0B;YACvC,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,eAAe;aACzB;SACF;QACD,aAAa,EAAE;YACb,KAAK,EAAE,eAAe;YACtB,WAAW,EACT,0HAA0H;YAC5H,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,gBAAgB;aAC1B;SACF;QACD,aAAa,EAAE;YAC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{
2
2
  api_key: string;
3
+ lead_custom_field_id_for_company_id?: string;
3
4
  contact_custom_field_id_for_user_id?: string;
4
5
  }
@@ -17,6 +17,19 @@ const destination = {
17
17
  type: 'string',
18
18
  required: true
19
19
  },
20
+ lead_custom_field_id_for_company_id: {
21
+ label: 'Lead Custom Field ID for Company ID',
22
+ description: "Enter the ID of a Lead Custom Field that'll be " +
23
+ "used to store Company ID. You'll need to create this Lead " +
24
+ 'Custom Field in Close first, and then the integration will use ' +
25
+ 'this field to store the Company ID when creating new contacts, ' +
26
+ 'and/or will be used as a lookup key when updating existing ' +
27
+ 'Lead. If this field is not filled out, it will only ' +
28
+ "lookup and de-dupe based on Contact's email.",
29
+ type: 'string',
30
+ default: '',
31
+ required: false
32
+ },
20
33
  contact_custom_field_id_for_user_id: {
21
34
  label: 'Contact Custom Field ID for User ID',
22
35
  description: "Enter the ID of a Contact Custom Field that'll be " +
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/close/index.ts"],"names":[],"mappings":";;;;;AAGA,8FAAqE;AAErE,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,OAAO;QACf,MAAM,EAAE;YACN,OAAO,EAAE;gBACP,KAAK,EAAE,SAAS;gBAChB,WAAW,EAAE,qBAAqB;gBAClC,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,mCAAmC,EAAE;gBACnC,KAAK,EAAE,qCAAqC;gBAC5C,WAAW,EACT,oDAAoD;oBACpD,4DAA4D;oBAC5D,iEAAiE;oBACjE,8DAA8D;oBAC9D,6DAA6D;oBAC7D,0DAA0D;oBAC1D,oCAAoC;gBACtC,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,KAAK;aAChB;SACF;QACD,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE;YAC9B,OAAO,OAAO,CAAC,kCAAkC,CAAC,CAAA;QACpD,CAAC;KACF;IAED,aAAa,CAAC,EAAE,QAAQ,EAAE;QACxB,OAAO;YACL,QAAQ,EAAE,QAAQ,CAAC,OAAO;YAC1B,QAAQ,EAAE,EAAE;SACb,CAAA;IACH,CAAC;IAQD,OAAO,EAAE;QACP,0BAA0B,EAA1B,oCAA0B;KAC3B;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/close/index.ts"],"names":[],"mappings":";;;;;AAGA,8FAAqE;AAErE,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,OAAO;QACf,MAAM,EAAE;YACN,OAAO,EAAE;gBACP,KAAK,EAAE,SAAS;gBAChB,WAAW,EAAE,qBAAqB;gBAClC,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,mCAAmC,EAAE;gBACnC,KAAK,EAAE,qCAAqC;gBAC5C,WAAW,EACT,iDAAiD;oBACjD,4DAA4D;oBAC5D,iEAAiE;oBACjE,iEAAiE;oBACjE,6DAA6D;oBAC7D,sDAAsD;oBACtD,8CAA8C;gBAChD,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,KAAK;aAChB;YACD,mCAAmC,EAAE;gBACnC,KAAK,EAAE,qCAAqC;gBAC5C,WAAW,EACT,oDAAoD;oBACpD,4DAA4D;oBAC5D,iEAAiE;oBACjE,8DAA8D;oBAC9D,6DAA6D;oBAC7D,0DAA0D;oBAC1D,oCAAoC;gBACtC,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,KAAK;aAChB;SACF;QACD,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE;YAC9B,OAAO,OAAO,CAAC,kCAAkC,CAAC,CAAA;QACpD,CAAC;KACF;IAED,aAAa,CAAC,EAAE,QAAQ,EAAE;QACxB,OAAO;YACL,QAAQ,EAAE,QAAQ,CAAC,OAAO;YAC1B,QAAQ,EAAE,EAAE;SACb,CAAA;IACH,CAAC;IAQD,OAAO,EAAE;QACP,0BAA0B,EAA1B,oCAA0B;KAC3B;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -0,0 +1,10 @@
1
+ export interface Payload {
2
+ operation: string;
3
+ traits?: {
4
+ [k: string]: unknown;
5
+ };
6
+ description?: string;
7
+ customFields?: {
8
+ [k: string]: unknown;
9
+ };
10
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce/case/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { 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;
@@ -0,0 +1,36 @@
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 sf_properties_1 = require("../sf-properties");
7
+ const sf_operations_1 = __importDefault(require("../sf-operations"));
8
+ const action = {
9
+ title: 'Case',
10
+ description: 'Case action',
11
+ fields: {
12
+ operation: sf_properties_1.operation,
13
+ traits: sf_properties_1.traits,
14
+ description: {
15
+ label: 'Description',
16
+ description: 'A text description of the case.',
17
+ type: 'string'
18
+ },
19
+ customFields: sf_properties_1.customFields
20
+ },
21
+ perform: async (request, { settings, payload }) => {
22
+ const sf = new sf_operations_1.default(settings.instanceUrl, request);
23
+ if (payload.operation === 'create') {
24
+ return await sf.createRecord(payload, 'Case');
25
+ }
26
+ sf_properties_1.validateLookup(payload);
27
+ if (payload.operation === 'update') {
28
+ return await sf.updateRecord(payload, 'Case');
29
+ }
30
+ if (payload.operation === 'upsert') {
31
+ return await sf.upsertRecord(payload, 'Case');
32
+ }
33
+ }
34
+ };
35
+ exports.default = action;
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce/case/index.ts"],"names":[],"mappings":";;;;;AAGA,oDAAkF;AAClF,qEAAyC;AAEzC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,MAAM;IACb,WAAW,EAAE,aAAa;IAC1B,MAAM,EAAE;QACN,SAAS,EAAE,yBAAS;QACpB,MAAM,EAAE,sBAAM;QACd,WAAW,EAAE;YACX,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,iCAAiC;YAC9C,IAAI,EAAE,QAAQ;SACf;QACD,YAAY,EAAE,4BAAY;KAC3B;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAChD,MAAM,EAAE,GAAe,IAAI,uBAAU,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;QAEpE,IAAI,OAAO,CAAC,SAAS,KAAK,QAAQ,EAAE;YAClC,OAAO,MAAM,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;SAC9C;QAED,8BAAc,CAAC,OAAO,CAAC,CAAA;QAEvB,IAAI,OAAO,CAAC,SAAS,KAAK,QAAQ,EAAE;YAClC,OAAO,MAAM,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;SAC9C;QAED,IAAI,OAAO,CAAC,SAAS,KAAK,QAAQ,EAAE;YAClC,OAAO,MAAM,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;SAC9C;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const case_1 = __importDefault(require("./case"));
6
7
  const lead_1 = __importDefault(require("./lead"));
7
8
  const customObject_1 = __importDefault(require("./customObject"));
8
9
  const destination = {
@@ -41,7 +42,8 @@ const destination = {
41
42
  },
42
43
  actions: {
43
44
  lead: lead_1.default,
44
- customObject: customObject_1.default
45
+ customObject: customObject_1.default,
46
+ cases: case_1.default
45
47
  }
46
48
  };
47
49
  exports.default = destination;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/salesforce/index.ts"],"names":[],"mappings":";;;;;AAEA,kDAAyB;AACzB,kEAAyC;AAMzC,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,WAAW,EAAE;gBACX,KAAK,EAAE,cAAc;gBACrB,WAAW,EACT,2HAA2H;gBAC7H,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;SACF;QACD,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YAE9C,MAAM,GAAG,GAAG,MAAM,OAAO,CAAuB,oDAAoD,EAAE;gBACpG,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,IAAI,eAAe,CAAC;oBACxB,aAAa,EAAE,IAAI,CAAC,YAAY;oBAChC,SAAS,EAAE,IAAI,CAAC,QAAQ;oBACxB,aAAa,EAAE,IAAI,CAAC,YAAY;oBAChC,UAAU,EAAE,eAAe;iBAC5B,CAAC;aACH,CAAC,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C,EAAE,IAAI,EAAE;QACpB,OAAO;YACL,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,IAAI,EAAE,WAAW,EAAE;aAC7C;SACF,CAAA;IACH,CAAC;IAED,OAAO,EAAE;QACP,IAAI,EAAJ,cAAI;QACJ,YAAY,EAAZ,sBAAY;QACZ,KAAK,EAAL,cAAK;KACN;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -14,7 +14,15 @@ const LeadShape = (payload) => {
14
14
  Email: payload.email
15
15
  };
16
16
  };
17
- const objectToShape = new Map([['lead', LeadShape]]);
17
+ const CaseShape = (payload) => {
18
+ return {
19
+ Description: payload.description
20
+ };
21
+ };
22
+ const objectToShape = new Map([
23
+ ['lead', LeadShape],
24
+ ['case', CaseShape]
25
+ ]);
18
26
  const mapObjectToShape = (payload, sobject) => {
19
27
  const shapeFunction = objectToShape.get(sobject.toLowerCase());
20
28
  if (!shapeFunction) {
@@ -1 +1 @@
1
- {"version":3,"file":"sf-object-to-shape.js","sourceRoot":"","sources":["../../../src/destinations/salesforce/sf-object-to-shape.ts"],"names":[],"mappings":";;;AAEA,MAAM,SAAS,GAAG,CAAC,OAAuB,EAAqB,EAAE;IAC/D,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,SAAS;QAC3B,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,SAAS,EAAE,OAAO,CAAC,UAAU;QAC7B,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,UAAU,EAAE,OAAO,CAAC,WAAW;QAC/B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,CAAA;AAE7C,MAAM,gBAAgB,GAAG,C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C,CAAA;IAE9D,IAAI,CAAC,aAAa,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,2BAA2B,OAAO,EAAE,CAAC,CAAA;KACtD;IAED,OAAO,aAAa,CAAC,OAAO,CAAC,CAAA;AAC/B,CAAC,CAAA;AARY,QAAA,gBAAgB,oBAQ5B"}
@@ -1,6 +1,7 @@
1
1
  import type { Payload as LeadPayload } from './lead/generated-types';
2
2
  import type { Payload as CustomPayload } from './customObject/generated-types';
3
- export declare type GenericPayload = Partial<LeadPayload & CustomPayload>;
3
+ import type { Payload as CasePayload } from './case/generated-types';
4
+ export declare type GenericPayload = Partial<LeadPayload & CustomPayload & CasePayload>;
4
5
  export declare type LeadBaseShapeType = {
5
6
  LastName?: string;
6
7
  Company?: string;
@@ -12,4 +13,7 @@ export declare type LeadBaseShapeType = {
12
13
  City?: string;
13
14
  Email?: string;
14
15
  };
15
- export declare type GenericBaseShape = Partial<LeadBaseShapeType>;
16
+ export declare type CaseBaseShapeType = {
17
+ Description?: string;
18
+ };
19
+ export declare type GenericBaseShape = Partial<LeadBaseShapeType & CaseBaseShapeType>;
@@ -1,4 +1,4 @@
1
1
  export interface Settings {
2
2
  accessToken: string;
3
- pixel_code: string;
3
+ pixelCode: string;
4
4
  }
@@ -5,50 +5,104 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const actions_core_1 = require("@segment/actions-core");
7
7
  const reportWebEvent_1 = __importDefault(require("./reportWebEvent"));
8
- const presets = [
9
- {
10
- name: 'Initiate Checkout',
11
- subscribe: 'event = "Checkout Started"',
12
- partnerAction: 'reportWebEvent',
13
- mapping: {
14
- ...actions_core_1.defaultValues(reportWebEvent_1.default.fields),
15
- event: 'IntiateCheckout'
16
- }
8
+ const productProperties = {
9
+ price: {
10
+ '@path': '$.price'
11
+ },
12
+ quantity: {
13
+ '@path': '$.quantity'
14
+ },
15
+ content_type: {
16
+ '@path': '$.category'
17
17
  },
18
+ content_id: {
19
+ '@path': '$.product_id'
20
+ }
21
+ };
22
+ const singleProductContents = {
23
+ ...actions_core_1.defaultValues(reportWebEvent_1.default.fields),
24
+ contents: {
25
+ '@arrayPath': [
26
+ '$.properties',
27
+ {
28
+ ...productProperties
29
+ }
30
+ ]
31
+ }
32
+ };
33
+ const multiProductContents = {
34
+ ...actions_core_1.defaultValues(reportWebEvent_1.default.fields),
35
+ contents: {
36
+ '@arrayPath': [
37
+ '$.properties.products',
38
+ {
39
+ ...productProperties
40
+ }
41
+ ]
42
+ }
43
+ };
44
+ const presets = [
18
45
  {
19
46
  name: 'View Content',
20
47
  subscribe: 'type="page"',
21
48
  partnerAction: 'reportWebEvent',
22
49
  mapping: {
23
- ...actions_core_1.defaultValues(reportWebEvent_1.default.fields),
50
+ ...singleProductContents,
24
51
  event: 'ViewContent'
25
52
  }
26
53
  },
27
54
  {
28
- name: 'Products Searched',
55
+ name: 'Search',
29
56
  subscribe: 'event = "Products Searched"',
30
57
  partnerAction: 'reportWebEvent',
31
58
  mapping: {
32
- ...actions_core_1.defaultValues(reportWebEvent_1.default.fields),
59
+ ...singleProductContents,
33
60
  event: 'Search'
34
61
  }
35
62
  },
63
+ {
64
+ name: 'Add to Wishlist',
65
+ subscribe: 'event = "Product Added to Wishlist"',
66
+ partnerAction: 'reportWebEvent',
67
+ mapping: {
68
+ ...singleProductContents,
69
+ event: 'AddToWishlist'
70
+ }
71
+ },
72
+ {
73
+ name: 'Add to Cart',
74
+ subscribe: 'event = "Product Added"',
75
+ partnerAction: 'reportWebEvent',
76
+ mapping: {
77
+ ...singleProductContents,
78
+ event: 'AddToCart'
79
+ }
80
+ },
81
+ {
82
+ name: 'Initiate Checkout',
83
+ subscribe: 'event = "Checkout Started"',
84
+ partnerAction: 'reportWebEvent',
85
+ mapping: {
86
+ ...multiProductContents,
87
+ event: 'InitiateCheckout'
88
+ }
89
+ },
36
90
  {
37
91
  name: 'Add Payment Info',
38
92
  subscribe: 'event = "Payment Info Entered"',
39
93
  partnerAction: 'reportWebEvent',
40
94
  mapping: {
41
- ...actions_core_1.defaultValues(reportWebEvent_1.default.fields),
95
+ ...multiProductContents,
42
96
  event: 'AddPaymentInfo'
43
97
  }
44
98
  },
45
99
  {
46
- name: 'Order Completed',
100
+ name: 'Place an Order',
47
101
  subscribe: 'event = "Order Completed"',
48
102
  partnerAction: 'reportWebEvent',
49
103
  mapping: {
50
- ...actions_core_1.defaultValues(reportWebEvent_1.default.fields),
51
- event: 'PlaceOrder'
104
+ ...multiProductContents,
105
+ event: 'PlaceAnOrder'
52
106
  }
53
107
  }
54
108
  ];
@@ -61,14 +115,14 @@ const destination = {
61
115
  fields: {
62
116
  accessToken: {
63
117
  label: 'Access Token',
64
- description: "TikTok Long Term Access Token. You can generate this from the TikTok Marketing API portal. Please follow TikTok's [Authorization guide](https://ads.tiktok.com/athena/docs/index.html?plat_id=-1&doc_id=100010&id=100681&key=e98b971a296ae45d8e35a22fba032d1c06f5973de9aab73ce07b82f230cf3afd) for more info.",
118
+ description: 'Your TikTok Access Token. Please see TikToks [Events API documentation](https://ads.tiktok.com/marketing_api/docs?id=1701890979375106) for information on how to generate an access token via the TikTok Ads Manager or API.',
65
119
  type: 'string',
66
120
  required: true
67
121
  },
68
- pixel_code: {
122
+ pixelCode: {
69
123
  label: 'Pixel Code',
70
124
  type: 'string',
71
- description: 'An ID for your pixel. Required to send events to the TikTok pixel.',
125
+ description: 'Your TikTok Pixel ID. Please see TikTok’s [Events API documentation](https://ads.tiktok.com/marketing_api/docs?id=1701890979375106) for information on how to find this value.',
72
126
  required: true
73
127
  }
74
128
  },
@@ -76,8 +130,8 @@ const destination = {
76
130
  return request('https://business-api.tiktok.com/open_api/v1.2/pixel/track/', {
77
131
  method: 'post',
78
132
  json: {
79
- pixel_code: settings.pixel_code,
80
- event: "Test Event",
133
+ pixel_code: settings.pixelCode,
134
+ event: 'Test Event',
81
135
  timestamp: '',
82
136
  context: {}
83
137
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/tiktok-conversions/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAqD;AAGrD,sEAA6C;AAG7C,MAAM,OAAO,GAAqC;IAChD;QACE,IAAI,EAAE,mBAAmB;QACzB,SAAS,EAAE,4BAA4B;QACvC,aAAa,EAAE,gBAAgB;QAC/B,OAAO,EAAE;YACP,GAAG,4BAAa,CAAC,wBAAc,CAAC,MAAM,CAAC;YACvC,KAAK,EAAE,iBAAiB;SACzB;KACF;IACD;QACE,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,aAAa;QACxB,aAAa,EAAE,gBAAgB;QAC/B,OAAO,EAAE;YACP,GAAG,4BAAa,CAAC,wBAAc,CAAC,MAAM,CAAC;YACvC,KAAK,EAAE,aAAa;SACrB;KACF;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,SAAS,EAAE,6BAA6B;QACxC,aAAa,EAAE,gBAAgB;QAC/B,OAAO,EAAE;YACP,GAAG,4BAAa,CAAC,wBAAc,CAAC,MAAM,CAAC;YACvC,KAAK,EAAE,QAAQ;SAChB;KACF;IACD;QACE,IAAI,EAAE,kBAAkB;QACxB,SAAS,EAAE,gCAAgC;QAC3C,aAAa,EAAE,gBAAgB;QAC/B,OAAO,EAAE;YACP,GAAG,4BAAa,CAAC,wBAAc,CAAC,MAAM,CAAC;YACvC,KAAK,EAAE,gBAAgB;SACxB;KACF;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,SAAS,EAAE,2BAA2B;QACtC,aAAa,EAAE,gBAAgB;QAC/B,OAAO,EAAE;YACP,GAAG,4BAAa,CAAC,wBAAc,CAAC,MAAM,CAAC;YACvC,KAAK,EAAE,YAAY;SACpB;KACF;CACF,CAAA;AAED,MAAM,WAAW,GAAoC;IAInD,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,WAAW,EAAE;gBACX,KAAK,EAAE,cAAc;gBACrB,WAAW,EACT,+SAA+S;gBACjT,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,UAAU,EAAE;gBACV,KAAK,EAAE,YAAY;gBACnB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,oEAAoE;gBACjF,QAAQ,EAAE,IAAI;aACf;SACF;QACD,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;YAG5C,OAAO,OAAO,CAAC,4DAA4D,EAAE;gBAC3E,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE;oBACJ,UAAU,EAAE,QAAQ,CAAC,UAAU;oBAC/B,KAAK,EAAE,YAAY;oBACnB,SAAS,EAAE,EAAE;oBACb,OAAO,EAAE,EAAE;iBACZ;aACF,CAAC,CAAA;QACJ,CAAC;KACF;IACD,aAAa,CAAC,EAAE,QAAQ,EAAE;QACxB,OAAO;YACL,OAAO,EAAE,EAAE,cAAc,EAAE,QAAQ,CAAC,WAAW,EAAE;SAClD,CAAA;IACH,CAAC;IACD,OAAO;IACP,OAAO,EAAE;QACP,cAAc,EAAd,wBAAc;KACf;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/tiktok-conversions/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAqD;AAGrD,sEAA6C;AAE7C,MAAM,iBAAiB,GAAG;IACxB,KAAK,EAAE;QACL,OAAO,EAAE,SAAS;KACnB;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,YAAY;KACtB;IACD,YAAY,EAAE;QACZ,OAAO,EAAE,YAAY;KACtB;IACD,UAAU,EAAE;QACV,OAAO,EAAE,cAAc;KACxB;CACF,CAAA;AAED,MAAM,qBAAqB,GAAG;IAC5B,GAAG,4BAAa,CAAC,wBAAc,CAAC,MAAM,CAAC;IACvC,QAAQ,EAAE;QACR,YA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,EAAE,gBAAgB;QACtB,SAAS,EAAE,2BAA2B;QACtC,aAAa,EAAE,gBAAgB;QAC/B,OAAO,EAAE;YACP,GAAG,oBAAoB;YACvB,KAAK,EAAE,cAAc;SACtB;KACF;CACF,CAAA;AAED,MAAM,WAAW,GAAoC;IAInD,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,WAAW,EAAE;gBACX,KAAK,EAAE,cAAc;gBACrB,WAAW,EACT,+NAA+N;gBACjO,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,SAAS,EAAE;gBACT,KAAK,EAAE,YAAY;gBACnB,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,gLAAgL;gBAClL,QAAQ,EAAE,IAAI;aACf;SACF;QACD,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;YAG5C,OAAO,OAAO,CAAC,4DAA4D,EAAE;gBAC3E,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE;oBACJ,UAAU,EAAE,QAAQ,CAAC,SAAS;oBAC9B,KAAK,EAAE,YAAY;oBACnB,SAAS,EAAE,EAAE;oBACb,OAAO,EAAE,EAAE;iBACZ;aACF,CAAC,CAAA;QACJ,CAAC;KACF;IACD,aAAa,CAAC,EAAE,QAAQ,EAAE;QACxB,OAAO;YACL,OAAO,EAAE,EAAE,cAAc,EAAE,QAAQ,CAAC,WAAW,EAAE;SAClD,CAAA;IACH,CAAC;IACD,OAAO;IACP,OAAO,EAAE;QACP,cAAc,EAAd,wBAAc;KACf;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -1,3 +1,3 @@
1
- export declare function formatEmail(email: string): string;
2
- export declare function formatUserId(userId: string): string;
3
- export declare function formatPhone(phone?: string): string;
1
+ export declare function formatEmail(email: string | undefined): string | undefined;
2
+ export declare function formatUserId(userId: string | undefined): string | undefined;
3
+ export declare function formatPhone(phone: string | undefined): string | undefined;
@@ -3,16 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.formatPhone = exports.formatUserId = exports.formatEmail = void 0;
4
4
  const crypto_1 = require("crypto");
5
5
  function formatEmail(email) {
6
- return hashAndEncode(email.toLowerCase());
6
+ if (email) {
7
+ return hashAndEncode(email.toLowerCase());
8
+ }
9
+ return undefined;
7
10
  }
8
11
  exports.formatEmail = formatEmail;
9
12
  function formatUserId(userId) {
10
- return hashAndEncode(userId.toLowerCase().trim());
13
+ if (userId) {
14
+ return hashAndEncode(userId.toLowerCase().trim());
15
+ }
16
+ return undefined;
11
17
  }
12
18
  exports.formatUserId = formatUserId;
13
19
  function formatPhone(phone) {
14
20
  if (!phone)
15
- return '';
21
+ return undefined;
16
22
  const validatedPhone = phone.match(/[0-9]{0,14}/g);
17
23
  if (validatedPhone === null) {
18
24
  throw new Error(`${phone} is not a valid E.164 phone number.`);
@@ -1 +1 @@
1
- {"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../../../src/destinations/tiktok-conversions/reportWebEvent/formatter.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AAKnC,SAAgB,WAAW,CAAC,KAAa;IACvC,OAAO,aAAa,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAA;AAC3C,CAAC;AAFD,kCAEC;AAOD,SAAgB,YAAY,CAAC,MAAc;IACzC,OAAO,aAAa,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,CAAA;AACnD,CAAC;AAFD,oCAEC;AAOD,SAAgB,WAAW,CAAC,KAAc;IACxC,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAA;IAErB,MAAM,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;IAClD,IAAI,cAAc,KAAK,IAAI,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,qCAAqC,CAAC,CAAA;KAC/D;IAED,IAAI,cAAc,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,CAAA;IAEvD,cAAc,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;IAChD,OAAO,aAAa,CAAC,cAAc,CAAC,CAAA;AACtC,CAAC;AAZD,kCAYC;AAED,SAAS,aAAa,CAAC,QAAgB;IACrC,OAAO,mBAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC5D,CAAC"}
1
+ {"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../../../src/destinations/tiktok-conversions/reportWebEvent/formatter.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AAKnC,SAAgB,WAAW,CAAC,KAAyB;IACnD,IAAI,KAAK,EAAE;QACT,OAAO,aAAa,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAA;KAC1C;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AALD,kCAKC;AAOD,SAAgB,YAAY,CAAC,MAA0B;IACrD,IAAI,MAAM,EAAE;QACV,OAAO,aAAa,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,CAAA;KAClD;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AALD,oCAKC;AAOD,SAAgB,WAAW,CAAC,KAAyB;IACnD,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAA;IAE5B,MAAM,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;IAClD,IAAI,cAAc,KAAK,IAAI,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,qCAAqC,CAAC,CAAA;KAC/D;IAED,IAAI,cAAc,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,CAAA;IAEvD,cAAc,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;IAChD,OAAO,aAAa,CAAC,cAAc,CAAC,CAAA;AACtC,CAAC;AAZD,kCAYC;AAED,SAAS,aAAa,CAAC,QAAgB;IACrC,OAAO,mBAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC5D,CAAC"}
@@ -1,13 +1,24 @@
1
1
  export interface Payload {
2
- event?: string;
2
+ event: string;
3
3
  event_id?: string;
4
4
  timestamp?: string;
5
- type?: string;
6
- properties?: {
7
- [k: string]: unknown;
8
- };
9
5
  phone_number?: string;
10
6
  email?: string;
11
- external_id: string;
7
+ external_id?: string;
12
8
  ttclid?: string;
9
+ url?: string;
10
+ referrer?: string;
11
+ ip?: string;
12
+ user_agent?: string;
13
+ contents?: {
14
+ price?: number;
15
+ quantity?: number;
16
+ content_type?: string;
17
+ content_id?: string;
18
+ }[];
19
+ currency?: string;
20
+ value?: number;
21
+ description?: string;
22
+ query?: string;
23
+ test_event_code?: string;
13
24
  }
@@ -8,10 +8,8 @@ const action = {
8
8
  event: {
9
9
  label: 'Event Name',
10
10
  type: 'string',
11
- description: 'Conversion event name. Please refer to the "Supported Web Events" section on this [page](https://ads.tiktok.com/marketing_api/docs?id=1701890979375106) for accepted event names.',
12
- default: {
13
- '@path': '$.event'
14
- }
11
+ required: true,
12
+ description: 'Conversion event name. Please refer to the "Supported Web Events" section on in TikTok’s [Events API documentation](https://ads.tiktok.com/marketing_api/docs?id=1701890979375106) for accepted event names.'
15
13
  },
16
14
  event_id: {
17
15
  label: 'Event ID',
@@ -24,25 +22,14 @@ const action = {
24
22
  timestamp: {
25
23
  label: 'Event Timestamp',
26
24
  type: 'string',
27
- description: 'Timestamp that the event took place, in ISO 8601 format.'
28
- },
29
- type: {
30
- label: 'Segment Event Type',
31
- description: 'The Segment event type, e.g. "page".',
32
- type: 'string',
25
+ description: 'Timestamp that the event took place, in ISO 8601 format.',
33
26
  default: {
34
- '@path': '$.type'
27
+ '@path': '$.timestamp'
35
28
  }
36
29
  },
37
- properties: {
38
- label: 'Properties associated with the event',
39
- description: 'Additional properties such as content info, description, and currency.',
40
- type: 'object',
41
- required: false
42
- },
43
30
  phone_number: {
44
31
  label: 'Phone Number',
45
- description: 'Phone number of the user who triggered the conversion event, in E.164 standard format, e.g. +14150000000.',
32
+ description: 'Phone number of the user who triggered the conversion event, in E.164 standard format, e.g. +14150000000. Segment will hash this value before sending to TikTok.',
46
33
  type: 'string',
47
34
  default: {
48
35
  '@if': {
@@ -54,7 +41,7 @@ const action = {
54
41
  },
55
42
  email: {
56
43
  label: 'Email',
57
- description: 'Email address of the user who triggered the conversion event.',
44
+ description: 'Email address of the user who triggered the conversion event. Segment will hash this value before sending to TikTok.',
58
45
  type: 'string',
59
46
  format: 'email',
60
47
  default: {
@@ -67,9 +54,8 @@ const action = {
67
54
  },
68
55
  external_id: {
69
56
  label: 'External ID',
70
- description: 'Uniquely identifies the user who triggered the conversion event.',
57
+ description: 'Uniquely identifies the user who triggered the conversion event. Segment will hash this value before sending to TikTok.',
71
58
  type: 'string',
72
- required: true,
73
59
  default: {
74
60
  '@if': {
75
61
  exists: { '@path': '$.userId' },
@@ -89,24 +75,120 @@ const action = {
89
75
  else: { '@path': '$.traits.ttclid' }
90
76
  }
91
77
  }
78
+ },
79
+ url: {
80
+ label: 'Page URL',
81
+ type: 'string',
82
+ description: 'The page URL where the conversion event took place.',
83
+ default: {
84
+ '@path': '$.context.page.url'
85
+ }
86
+ },
87
+ referrer: {
88
+ label: 'Page Referrer',
89
+ type: 'string',
90
+ description: 'The page referrer.',
91
+ default: {
92
+ '@path': '$.context.page.referrer'
93
+ }
94
+ },
95
+ ip: {
96
+ label: 'IP Address',
97
+ type: 'string',
98
+ description: 'IP address of the browser.',
99
+ default: {
100
+ '@path': '$.context.ip'
101
+ }
102
+ },
103
+ user_agent: {
104
+ label: 'User Agent',
105
+ type: 'string',
106
+ description: 'User agent from the user’s device.',
107
+ default: {
108
+ '@path': '$.context.userAgent'
109
+ }
110
+ },
111
+ contents: {
112
+ label: 'Contents',
113
+ type: 'object',
114
+ multiple: true,
115
+ description: 'Related items in a web event.',
116
+ properties: {
117
+ price: {
118
+ label: 'Price',
119
+ description: 'Price of the item.',
120
+ type: 'number'
121
+ },
122
+ quantity: {
123
+ label: 'Quantity',
124
+ description: 'Number of items.',
125
+ type: 'number'
126
+ },
127
+ content_type: {
128
+ label: 'Content Type',
129
+ description: 'Type of the product item.',
130
+ type: 'string'
131
+ },
132
+ content_id: {
133
+ label: 'Content ID',
134
+ description: 'ID of the product item.',
135
+ type: 'string'
136
+ }
137
+ }
138
+ },
139
+ currency: {
140
+ label: 'Currency',
141
+ type: 'string',
142
+ description: 'Currency for the value specified as ISO 4217 code.',
143
+ default: {
144
+ '@path': '$.properties.currency'
145
+ }
146
+ },
147
+ value: {
148
+ label: 'Value',
149
+ type: 'number',
150
+ description: 'Value of the order or items sold.',
151
+ default: {
152
+ '@if': {
153
+ exists: { '@path': '$.properties.value' },
154
+ then: { '@path': '$.properties.value' },
155
+ else: { '@path': '$.properties.revenue' }
156
+ }
157
+ }
158
+ },
159
+ description: {
160
+ label: 'Description',
161
+ type: 'string',
162
+ description: 'A string description of the web event.'
163
+ },
164
+ query: {
165
+ label: 'Query',
166
+ type: 'string',
167
+ description: 'The text string that was searched for.',
168
+ default: {
169
+ '@path': '$.properties.query'
170
+ }
171
+ },
172
+ test_event_code: {
173
+ label: 'Test Event Code',
174
+ type: 'string',
175
+ description: 'Use this field to specify that events should be test events rather than actual traffic. You can find your Test Event Code in your TikTok Events Manager under the "Test Event" tab. You\'ll want to remove your Test Event Code when sending real traffic through this integration.'
92
176
  }
93
177
  },
94
178
  perform: (request, { payload, settings }) => {
95
- const eventId = payload.event_id
96
- ? payload.event_id.toString() + '_' + (Math.random() + 1).toString(36).substring(7)
97
- : '';
98
179
  const userData = {
99
180
  hashedExternalId: formatter_1.formatUserId(payload.external_id),
100
- hashedEmail: formatter_1.formatEmail(payload.email || ''),
181
+ hashedEmail: formatter_1.formatEmail(payload.email),
101
182
  hashedPhoneNumber: formatter_1.formatPhone(payload.phone_number)
102
183
  };
103
184
  return request('https://business-api.tiktok.com/open_api/v1.2/pixel/track/', {
104
185
  method: 'post',
105
186
  json: {
106
- pixel_code: settings.pixel_code,
187
+ pixel_code: settings.pixelCode,
107
188
  event: payload.event,
108
- event_id: eventId,
189
+ event_id: payload.event_id ? `${payload.event_id}_seg` : undefined,
109
190
  timestamp: payload.timestamp,
191
+ test_event_code: payload.test_event_code,
110
192
  context: {
111
193
  user: {
112
194
  external_id: userData.hashedExternalId,
@@ -115,7 +197,20 @@ const action = {
115
197
  },
116
198
  ad: {
117
199
  callback: payload.ttclid
118
- }
200
+ },
201
+ page: {
202
+ url: payload.url,
203
+ referrer: payload.referrer
204
+ },
205
+ ip: payload.ip,
206
+ user_agent: payload.user_agent
207
+ },
208
+ properties: {
209
+ contents: payload.contents,
210
+ currency: payload.currency,
211
+ value: payload.value,
212
+ description: payload.description,
213
+ query: payload.query
119
214
  }
120
215
  }
121
216
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/tiktok-conversions/reportWebEvent/index.ts"],"names":[],"mappings":";;AAGA,2CAAoE;AAEpE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,kBAAkB;IACzB,WAAW,EACT,6JAA6J;IAC/J,MAAM,EAAE;QACN,KAAK,EAAE;YACL,KAAK,EAAE,YAAY;YACnB,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,mLAAmL;YACrL,OAAO,EAAE;gBACP,OAAO,EAAE,SAAS;aACnB;SACF;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,UAAU;YACjB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,wDAAwD;YACrE,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QAC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AAgB;wBACtC,YAAY,EAAE,QAAQ,CAAC,iBAAiB;wBACxC,KAAK,EAAE,QAAQ,CAAC,WAAW;qBAC5B;oBACD,EAAE,EAAE;wBACF,QAAQ,EAAE,OAAO,CAAC,MAAM;qBACzB;iBACF;aACF;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/tiktok-conversions/reportWebEvent/index.ts"],"names":[],"mappings":";;AAGA,2CAAoE;AAEpE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,kBAAkB;IACzB,WAAW,EACT,6JAA6J;IAC/J,MAAM,EAAE;QACN,KAAK,EAAE;YACL,KAAK,EAAE,YAAY;YACnB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,WAAW,EACT,8MAA8M;SACjN;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,UAAU;YACjB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,wDAAwD;YACrE,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,SAAS,EAAE;YACT,KAAK,EAAE,iBAAiB;YACxB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,0DAA0D;YACvE,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QAED,YAAY,EAAE;YACZ,KAAK,EAAE,cAAc;YACrB,WAAW,EACT,kKAAkK;YACpK,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;oBACzC,IAAI,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;oBACvC,IAAI,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;iBACpC;aACF;SACF;QACD,KAAK,EAAE;YACL,KAAK,EAAE,OAAO;YACd,WAAW,EACT,sHAAsH;YACxH,IAAI,EAAE,QAAQ;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,QAAQ;qBAC3B;oBACD,EAAE,EAAE,OAAO,CAAC,EAAE;oBACd,UAAU,EAAE,OAAO,CAAC,UAAU;iBAC/B;gBACD,UAAU,EAAE;oBACV,QAAQ,EAAE,OAAO,CAAC,QAAQ;oBAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;oBAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;oBACpB,WAAW,EAAE,OAAO,CAAC,WAAW;oBAChC,KAAK,EAAE,OAAO,CAAC,KAAK;iBACrB;aACF;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
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.50.2-alpha.0",
4
+ "version": "3.50.3",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/segmentio/action-destinations",
@@ -62,5 +62,5 @@
62
62
  "<rootDir>/test/setup-after-env.ts"
63
63
  ]
64
64
  },
65
- "gitHead": "e444c1150d5ac0132b6f176a2b566318c074521d"
65
+ "gitHead": "1ccd50ed7faf5a1c87f16f47f4a7d8404fee7dba"
66
66
  }