@segment/action-destinations 3.219.0 → 3.220.0

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 (89) hide show
  1. package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.d.ts +1 -0
  2. package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js +8 -1
  3. package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js.map +1 -1
  4. package/dist/destinations/engage/twilio/utils/PhoneMessageSender.d.ts +0 -1
  5. package/dist/destinations/engage/twilio/utils/PhoneMessageSender.js +1 -2
  6. package/dist/destinations/engage/twilio/utils/PhoneMessageSender.js.map +1 -1
  7. package/dist/destinations/fullstory/identifyUserV2/generated-types.d.ts +1 -1
  8. package/dist/destinations/fullstory/identifyUserV2/index.js +1 -1
  9. package/dist/destinations/fullstory/identifyUserV2/index.js.map +1 -1
  10. package/dist/destinations/fullstory/index.js +1 -1
  11. package/dist/destinations/fullstory/index.js.map +1 -1
  12. package/dist/destinations/fullstory/request-params.d.ts +2 -2
  13. package/dist/destinations/fullstory/request-params.js +6 -6
  14. package/dist/destinations/fullstory/request-params.js.map +1 -1
  15. package/dist/destinations/fullstory/trackEventV2/generated-types.d.ts +1 -1
  16. package/dist/destinations/fullstory/trackEventV2/index.js +1 -1
  17. package/dist/destinations/fullstory/trackEventV2/index.js.map +1 -1
  18. package/dist/destinations/hyperengage/commonFields.d.ts +3 -0
  19. package/dist/destinations/hyperengage/commonFields.js +165 -0
  20. package/dist/destinations/hyperengage/commonFields.js.map +1 -0
  21. package/dist/destinations/hyperengage/generated-types.d.ts +4 -0
  22. package/dist/destinations/hyperengage/generated-types.js +3 -0
  23. package/dist/destinations/hyperengage/generated-types.js.map +1 -0
  24. package/dist/destinations/hyperengage/group/generated-types.d.ts +35 -0
  25. package/dist/destinations/hyperengage/group/generated-types.js +3 -0
  26. package/dist/destinations/hyperengage/group/generated-types.js.map +1 -0
  27. package/dist/destinations/hyperengage/group/index.d.ts +5 -0
  28. package/dist/destinations/hyperengage/group/index.js +81 -0
  29. package/dist/destinations/hyperengage/group/index.js.map +1 -0
  30. package/dist/destinations/hyperengage/identify/generated-types.d.ts +36 -0
  31. package/dist/destinations/hyperengage/identify/generated-types.js +3 -0
  32. package/dist/destinations/hyperengage/identify/generated-types.js.map +1 -0
  33. package/dist/destinations/hyperengage/identify/index.d.ts +5 -0
  34. package/dist/destinations/hyperengage/identify/index.js +110 -0
  35. package/dist/destinations/hyperengage/identify/index.js.map +1 -0
  36. package/dist/destinations/hyperengage/index.d.ts +4 -0
  37. package/dist/destinations/hyperengage/index.js +72 -0
  38. package/dist/destinations/hyperengage/index.js.map +1 -0
  39. package/dist/destinations/hyperengage/track/generated-types.d.ts +32 -0
  40. package/dist/destinations/hyperengage/track/generated-types.js +3 -0
  41. package/dist/destinations/hyperengage/track/generated-types.js.map +1 -0
  42. package/dist/destinations/hyperengage/track/index.d.ts +5 -0
  43. package/dist/destinations/hyperengage/track/index.js +54 -0
  44. package/dist/destinations/hyperengage/track/index.js.map +1 -0
  45. package/dist/destinations/hyperengage/validateInput.d.ts +2 -0
  46. package/dist/destinations/hyperengage/validateInput.js +90 -0
  47. package/dist/destinations/hyperengage/validateInput.js.map +1 -0
  48. package/dist/destinations/index.js +2 -0
  49. package/dist/destinations/index.js.map +1 -1
  50. package/dist/destinations/pinterest-conversions/pinterest-capi-custom-data.js +1 -1
  51. package/dist/destinations/pinterest-conversions/pinterest-capi-custom-data.js.map +1 -1
  52. package/dist/destinations/pinterest-conversions/reportConversionEvent/generated-types.d.ts +1 -1
  53. package/dist/destinations/yahoo-audiences/constants.d.ts +2 -0
  54. package/dist/destinations/yahoo-audiences/constants.js +6 -0
  55. package/dist/destinations/yahoo-audiences/constants.js.map +1 -0
  56. package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.d.ts +4 -0
  57. package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.js +3 -0
  58. package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.js.map +1 -0
  59. package/dist/destinations/yahoo-audiences/createCustomerNode/index.d.ts +5 -0
  60. package/dist/destinations/yahoo-audiences/createCustomerNode/index.js +33 -0
  61. package/dist/destinations/yahoo-audiences/createCustomerNode/index.js.map +1 -0
  62. package/dist/destinations/yahoo-audiences/createSegment/generated-types.d.ts +6 -0
  63. package/dist/destinations/yahoo-audiences/createSegment/generated-types.js +3 -0
  64. package/dist/destinations/yahoo-audiences/createSegment/generated-types.js.map +1 -0
  65. package/dist/destinations/yahoo-audiences/createSegment/index.d.ts +5 -0
  66. package/dist/destinations/yahoo-audiences/createSegment/index.js +45 -0
  67. package/dist/destinations/yahoo-audiences/createSegment/index.js.map +1 -0
  68. package/dist/destinations/yahoo-audiences/generated-types.d.ts +12 -0
  69. package/dist/destinations/yahoo-audiences/generated-types.js +3 -0
  70. package/dist/destinations/yahoo-audiences/generated-types.js.map +1 -0
  71. package/dist/destinations/yahoo-audiences/index.d.ts +4 -0
  72. package/dist/destinations/yahoo-audiences/index.js +155 -0
  73. package/dist/destinations/yahoo-audiences/index.js.map +1 -0
  74. package/dist/destinations/yahoo-audiences/types.d.ts +25 -0
  75. package/dist/destinations/yahoo-audiences/types.js +3 -0
  76. package/dist/destinations/yahoo-audiences/types.js.map +1 -0
  77. package/dist/destinations/yahoo-audiences/updateSegment/generated-types.d.ts +16 -0
  78. package/dist/destinations/yahoo-audiences/updateSegment/generated-types.js +3 -0
  79. package/dist/destinations/yahoo-audiences/updateSegment/generated-types.js.map +1 -0
  80. package/dist/destinations/yahoo-audiences/updateSegment/index.d.ts +5 -0
  81. package/dist/destinations/yahoo-audiences/updateSegment/index.js +163 -0
  82. package/dist/destinations/yahoo-audiences/updateSegment/index.js.map +1 -0
  83. package/dist/destinations/yahoo-audiences/utils-rt.d.ts +10 -0
  84. package/dist/destinations/yahoo-audiences/utils-rt.js +103 -0
  85. package/dist/destinations/yahoo-audiences/utils-rt.js.map +1 -0
  86. package/dist/destinations/yahoo-audiences/utils-tax.d.ts +10 -0
  87. package/dist/destinations/yahoo-audiences/utils-tax.js +78 -0
  88. package/dist/destinations/yahoo-audiences/utils-tax.js.map +1 -0
  89. package/package.json +2 -2
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_tax_1 = require("../utils-tax");
4
+ const utils_tax_2 = require("../utils-tax");
5
+ const action = {
6
+ title: 'Create SEGMENT sub-node in Yahoo taxonomy',
7
+ description: 'Use this action to generate SEGMENT sub-node within CUSTOMER node in Yahoo taxonomy',
8
+ defaultSubscription: 'event = "Audience Entered" and event = "Audience Exited"',
9
+ fields: {
10
+ segment_audience_key: {
11
+ label: 'Audience Key',
12
+ description: 'Provide audience key. This maps to the "Name" of the Segment node in Yahoo taxonomy',
13
+ type: 'string',
14
+ required: true
15
+ },
16
+ segment_audience_id: {
17
+ label: 'Audience Id',
18
+ description: 'Provide audience Id (aud_...) from audience URL in Segment Engage. This maps to the "Id" of the Segment node in Yahoo taxonomy',
19
+ type: 'string',
20
+ required: true
21
+ },
22
+ engage_space_id: {
23
+ label: 'Engage Space Id',
24
+ description: 'Provide Engage Space Id found in Unify > Settings > API Access. This maps to the "Id" and "Name" of the top-level Customer node in Yahoo taxonomy and specifies the parent node for your Segment node in Yahoo taxonomy',
25
+ type: 'string',
26
+ required: false
27
+ },
28
+ customer_desc: {
29
+ label: 'Space Description',
30
+ description: 'Provide the description for Segment node in Yahoo taxonomy. This must be less then 1000 characters',
31
+ type: 'string',
32
+ required: false
33
+ }
34
+ },
35
+ perform: async (request, { payload, settings }) => {
36
+ const tx_creds = {
37
+ tx_client_key: settings.taxonomy_client_key,
38
+ tx_client_secret: settings.taxonomy_client_secret
39
+ };
40
+ const body_form_data = utils_tax_1.gen_segment_subtaxonomy_payload(payload);
41
+ return await utils_tax_2.update_taxonomy(String(payload.engage_space_id), tx_creds, request, body_form_data);
42
+ }
43
+ };
44
+ exports.default = action;
45
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/yahoo-audiences/createSegment/index.ts"],"names":[],"mappings":";;AAIA,4CAA8D;AAC9D,4CAA8C;AAG9C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,2CAA2C;IAClD,WAAW,EAAE,qFAAqF;IAClG,mBAAmB,EAAE,0DAA0D;IAE/E,MAAM,EAAE;QACN,oBAAoB,EAAE;YACpB,KAAK,EAAE,cAAc;YACrB,WAAW,EAAE,qFAAqF;YAClG,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,mBAAmB,EAAE;YACnB,KAAK,EAAE,aAAa;YACpB,WAAW,EACT,gIAAgI;YAClI,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,eAAe,EAAE;YACf,KAAK,EAAE,iBAAiB;YACxB,WAAW,EACT,yNAAyN;YAC3N,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;QACD,aAAa,EAAE;YACb,KAAK,EAAE,mBAAmB;YAC1B,WAAW,EAAE,oGAAoG;YACjH,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAChD,MAAM,QAAQ,GAAG;YACf,aAAa,EAAE,QAAQ,CAAC,mBAAmB;YAC3C,gBAAgB,EAAE,QAAQ,CAAC,sBAAsB;SAClD,CAAA;QAED,MAAM,cAAc,GAAG,2CAA+B,CAAC,OAAO,CAAC,CAAA;QAC/D,OAAO,MAAM,2BAAe,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,CAAC,CAAA;IAClG,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,12 @@
1
+ export interface Settings {
2
+ mdm_id: string;
3
+ taxonomy_client_key: string;
4
+ taxonomy_client_secret: string;
5
+ engage_space_id: string;
6
+ customer_desc?: string;
7
+ }
8
+ export interface AudienceSettings {
9
+ audience_id: string;
10
+ audience_key: string;
11
+ identifier: string;
12
+ }
@@ -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/yahoo-audiences/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { AudienceDestinationDefinition } from '@segment/actions-core';
2
+ import type { Settings, AudienceSettings } from './generated-types';
3
+ declare const destination: AudienceDestinationDefinition<Settings, AudienceSettings>;
4
+ export default destination;
@@ -0,0 +1,155 @@
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 actions_core_1 = require("@segment/actions-core");
7
+ const utils_rt_1 = require("./utils-rt");
8
+ const updateSegment_1 = __importDefault(require("./updateSegment"));
9
+ const createSegment_1 = __importDefault(require("./createSegment"));
10
+ const createCustomerNode_1 = __importDefault(require("./createCustomerNode"));
11
+ const utils_tax_1 = require("./utils-tax");
12
+ const destination = {
13
+ name: 'Yahoo Audiences',
14
+ slug: 'actions-yahoo-audiences',
15
+ mode: 'cloud',
16
+ description: 'Sync Segment Engage Audiences to Yahoo Ads',
17
+ authentication: {
18
+ scheme: 'oauth2',
19
+ fields: {
20
+ mdm_id: {
21
+ label: 'MDM ID',
22
+ description: 'Yahoo MDM ID provided by Yahoo representative',
23
+ type: 'string',
24
+ required: true
25
+ },
26
+ taxonomy_client_key: {
27
+ label: 'Yahoo Taxonomy API client Id',
28
+ description: 'Taxonomy API client Id. Required to update Yahoo taxonomy',
29
+ type: 'string',
30
+ required: true
31
+ },
32
+ taxonomy_client_secret: {
33
+ label: 'Yahoo Taxonomy API client secret',
34
+ description: 'Taxonomy API client secret. Required to update Yahoo taxonomy',
35
+ type: 'password',
36
+ required: true
37
+ },
38
+ engage_space_id: {
39
+ label: 'Engage Space Id',
40
+ description: 'Engage Space Id found in Unify > Settings > API Access',
41
+ type: 'string',
42
+ required: true
43
+ },
44
+ customer_desc: {
45
+ label: 'Customer Description',
46
+ description: 'Engage space name and description',
47
+ type: 'string',
48
+ required: false
49
+ }
50
+ },
51
+ testAuthentication: async (request, { settings }) => {
52
+ const tx_creds = {
53
+ tx_client_key: settings.taxonomy_client_key,
54
+ tx_client_secret: settings.taxonomy_client_secret
55
+ };
56
+ const data = {
57
+ engage_space_id: settings.engage_space_id,
58
+ customer_desc: settings.customer_desc
59
+ };
60
+ const body_form_data = utils_tax_1.gen_customer_taxonomy_payload(settings, data);
61
+ await utils_tax_1.update_taxonomy('', tx_creds, request, body_form_data);
62
+ },
63
+ refreshAccessToken: async (request, { auth }) => {
64
+ const rt_client_key = JSON.parse(auth.clientId)['rt_api'];
65
+ const rt_client_secret = JSON.parse(auth.clientSecret)['rt_api'];
66
+ const jwt = utils_rt_1.generate_jwt(rt_client_key, rt_client_secret);
67
+ const res = await request('https://id.b2b.yahooinc.com/identity/oauth2/access_token', {
68
+ method: 'POST',
69
+ body: new URLSearchParams({
70
+ client_assertion: jwt,
71
+ client_assertion_type: 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',
72
+ grant_type: 'client_credentials',
73
+ scope: 'audience',
74
+ realm: 'dataxonline'
75
+ })
76
+ });
77
+ const rt_access_token = res.data.access_token;
78
+ return { accessToken: rt_access_token };
79
+ }
80
+ },
81
+ audienceFields: {
82
+ audience_id: {
83
+ type: 'string',
84
+ label: 'Audience Id',
85
+ description: 'Segment Audience Id (aud_...)',
86
+ required: true
87
+ },
88
+ audience_key: {
89
+ label: 'Audience key',
90
+ description: 'Segment Audience Key',
91
+ type: 'string',
92
+ required: true
93
+ },
94
+ identifier: {
95
+ label: 'User Identifier',
96
+ description: 'Specify the identifier(s) to send to Yahoo',
97
+ type: 'string',
98
+ required: true,
99
+ default: 'email',
100
+ choices: [
101
+ { value: 'email', label: 'Send email' },
102
+ { value: 'maid', label: 'Send MAID' },
103
+ { value: 'email_maid', label: 'Send email and/or MAID' }
104
+ ]
105
+ }
106
+ },
107
+ audienceConfig: {
108
+ mode: {
109
+ type: 'synced',
110
+ full_audience_sync: false
111
+ },
112
+ async createAudience(request, createAudienceInput) {
113
+ const audience_id = createAudienceInput.audienceSettings?.audience_id;
114
+ const audience_key = createAudienceInput.audienceSettings?.audience_key;
115
+ const engage_space_id = createAudienceInput.settings?.engage_space_id;
116
+ const identifier = createAudienceInput.audienceSettings?.identifier;
117
+ if (!audience_id) {
118
+ throw new actions_core_1.IntegrationError('Create Audience: missing audience Id value', 'MISSING_REQUIRED_FIELD', 400);
119
+ }
120
+ if (!audience_key) {
121
+ throw new actions_core_1.IntegrationError('Create Audience: missing audience key value', 'MISSING_REQUIRED_FIELD', 400);
122
+ }
123
+ if (!engage_space_id) {
124
+ throw new actions_core_1.IntegrationError('Create Audience: missing Engage space Id type value', 'MISSING_REQUIRED_FIELD', 400);
125
+ }
126
+ const input = {
127
+ segment_audience_id: audience_id,
128
+ segment_audience_key: audience_key,
129
+ engage_space_id: engage_space_id,
130
+ identifier: identifier
131
+ };
132
+ const body_form_data = utils_tax_1.gen_segment_subtaxonomy_payload(input);
133
+ const tx_creds = {
134
+ tx_client_key: createAudienceInput.settings.taxonomy_client_key,
135
+ tx_client_secret: createAudienceInput.settings.taxonomy_client_secret
136
+ };
137
+ await utils_tax_1.update_taxonomy(engage_space_id, tx_creds, request, body_form_data);
138
+ return { externalId: audience_id };
139
+ },
140
+ async getAudience(_, getAudienceInput) {
141
+ const audience_id = getAudienceInput.audienceSettings?.audience_id;
142
+ if (!audience_id) {
143
+ throw new actions_core_1.IntegrationError('Missing audience_id value', 'MISSING_REQUIRED_FIELD', 400);
144
+ }
145
+ return { externalId: audience_id };
146
+ }
147
+ },
148
+ actions: {
149
+ updateSegment: updateSegment_1.default,
150
+ createSegment: createSegment_1.default,
151
+ createCustomerNode: createCustomerNode_1.default
152
+ }
153
+ };
154
+ exports.default = destination;
155
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/yahoo-audiences/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAwD;AAExD,yCAAyC;AACzC,oEAA2C;AAC3C,oEAA2C;AAC3C,8EAAqD;AACrD,2CAA6G;AAM7G,MAAM,WAAW,GAA8D;IAC7E,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,yBAAyB;IAC/B,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,4CAA4C;IACzD,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,+CAA+C;gBAC5D,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,mBAAmB,EAAE;gBACnB,KAAK,EAAE,8BAA8B;gBACrC,WAAW,EAAE,2DAA2D;gBACxE,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,sBAAsB,EAAE;gBACtB,KAAK,EAAE,kCAAkC;gBACzC,WAAW,EAAE,+DAA+D;gBAC5E,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE,IAAI;aACf;YACD,eAAe,EAAE;gBACf,KAAK,EAAE,iBAAiB;gBACxB,WAAW,EAAE,wDAAwD;gBACrE,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,aAAa,EAAE;gBACb,KAAK,EAAE,sBAAsB;gBAC7B,WAAW,EAAE,mCAAmC;gBAChD,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,KAAK;aAChB;SACF;QACD,kBAAk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ACzG;YAED,IAAI,CAAC,eAAe,EAAE;gBACpB,MAAM,IAAI,+BAAgB,CAAC,qDAAqD,EAAE,wBAAwB,EAAE,GAAG,CAAC,CAAA;aACjH;YAED,MAAM,KAAK,GAAG;gBACZ,mBAAmB,EAAE,WAAW;gBAChC,oBAAoB,EAAE,YAAY;gBAClC,eAAe,EAAE,eAAe;gBAChC,UAAU,EAAE,UAAU;aACvB,CAAA;YAED,MAAM,cAAc,GAAG,2CAA+B,CAAC,KAAK,CAAC,CAAA;YAE7D,MAAM,QAAQ,GAAG;gBACf,aAAa,EAAE,mBAAmB,CAAC,QAAQ,CAAC,mBAAmB;gBAC/D,gBAAgB,EAAE,mBAAmB,CAAC,QAAQ,CAAC,sBAAsB;aACtE,CAAA;YAED,MAAM,2BAAe,CAAC,eAAe,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,CAAC,CAAA;YAEzE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,CAAA;QACpC,CAAC;QACD,KAAK,CAAC,WAAW,CAAC,CAAC,EAAE,gBAAgB;YACnC,MAAM,WAAW,GAAG,gBAAgB,CAAC,gBAAgB,EAAE,WAAW,CAAA;YAClE,IAAI,CAAC,WAAW,EAAE;gBAChB,MAAM,IAAI,+BAAgB,CAAC,2BAA2B,EAAE,wBAAwB,EAAE,GAAG,CAAC,CAAA;aACvF;YACD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,CAAA;QACpC,CAAC;KACF;IAED,OAAO,EAAE;QACP,aAAa,EAAb,uBAAa;QACb,aAAa,EAAb,uBAAa;QACb,kBAAkB,EAAlB,4BAAkB;KACnB;CACF,CAAA;AACD,kBAAe,WAAW,CAAA"}
@@ -0,0 +1,25 @@
1
+ export interface CredsObj {
2
+ tx_client_key: string;
3
+ tx_client_secret: string;
4
+ }
5
+ export interface TaxonomyObject {
6
+ id: string;
7
+ name: string;
8
+ description: string;
9
+ users: {
10
+ include: [string];
11
+ };
12
+ subTaxonomy: [
13
+ {
14
+ id: string;
15
+ name: string;
16
+ type: string;
17
+ }
18
+ ];
19
+ }
20
+ export interface YahooPayload {
21
+ schema: Array<string>;
22
+ data: Array<unknown>;
23
+ gdpr: boolean;
24
+ gdpr_euconsent?: string | undefined;
25
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/destinations/yahoo-audiences/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ export interface Payload {
2
+ segment_audience_id: string;
3
+ segment_audience_key: string;
4
+ event_attributes: {
5
+ [k: string]: unknown;
6
+ };
7
+ segment_computation_action: string;
8
+ enable_batching?: boolean;
9
+ batch_size?: number;
10
+ email?: string;
11
+ advertising_id?: string;
12
+ device_type?: string;
13
+ identifier: string;
14
+ gdpr_flag: boolean;
15
+ gdpr_euconsent?: string;
16
+ }
@@ -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/yahoo-audiences/updateSegment/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings, AudienceSettings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ declare const action: ActionDefinition<Settings, Payload, AudienceSettings>;
5
+ export default action;
@@ -0,0 +1,163 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const actions_core_1 = require("@segment/actions-core");
4
+ const utils_rt_1 = require("../utils-rt");
5
+ const action = {
6
+ title: 'Sync To Yahoo Ads Segment',
7
+ description: 'Sync Segment Audience to Yahoo Ads Segment',
8
+ defaultSubscription: 'type = "identify"',
9
+ fields: {
10
+ segment_audience_id: {
11
+ label: 'Segment Audience Id',
12
+ description: 'Segment Audience Id (aud_...). Maps to "Id" of a Segment node in Yahoo taxonomy',
13
+ type: 'hidden',
14
+ required: true,
15
+ default: {
16
+ '@path': '$.context.personas.computation_id'
17
+ }
18
+ },
19
+ segment_audience_key: {
20
+ label: 'Segment Audience Key',
21
+ description: 'Segment Audience Key. Maps to the "Name" of the Segment node in Yahoo taxonomy',
22
+ type: 'hidden',
23
+ required: true,
24
+ default: {
25
+ '@path': '$.context.personas.computation_key'
26
+ }
27
+ },
28
+ event_attributes: {
29
+ label: 'Event traits or properties. Do not modify this setting',
30
+ description: 'Event traits or properties. Do not modify this setting',
31
+ type: 'object',
32
+ readOnly: true,
33
+ required: true,
34
+ default: {
35
+ '@if': {
36
+ exists: { '@path': '$.properties' },
37
+ then: { '@path': '$.properties' },
38
+ else: { '@path': '$.traits' }
39
+ }
40
+ }
41
+ },
42
+ segment_computation_action: {
43
+ label: 'Segment Computation Action',
44
+ description: "Segment computation class used to determine if input event is from an Engage Audience'. Value must be = 'audience'.",
45
+ type: 'hidden',
46
+ required: true,
47
+ default: {
48
+ '@path': '$.context.personas.computation_class'
49
+ },
50
+ choices: [{ label: 'audience', value: 'audience' }]
51
+ },
52
+ enable_batching: {
53
+ label: 'Enable Batching',
54
+ description: 'Enable batching of requests',
55
+ type: 'boolean',
56
+ default: true,
57
+ unsafe_hidden: true
58
+ },
59
+ batch_size: {
60
+ label: 'Batch Size',
61
+ description: 'Maximum number of events to include in each batch. Actual batch sizes may be lower.',
62
+ type: 'number',
63
+ unsafe_hidden: true,
64
+ default: 1000
65
+ },
66
+ email: {
67
+ label: 'User Email',
68
+ description: 'Email address of a user',
69
+ type: 'hidden',
70
+ required: false,
71
+ default: {
72
+ '@if': {
73
+ exists: { '@path': '$.traits.email' },
74
+ then: { '@path': '$.traits.email' },
75
+ else: { '@path': '$.properties.email' }
76
+ }
77
+ }
78
+ },
79
+ advertising_id: {
80
+ label: 'User Mobile Advertising ID',
81
+ description: "User's mobile advertising Id",
82
+ type: 'hidden',
83
+ default: {
84
+ '@path': '$.context.device.advertisingId'
85
+ },
86
+ required: false
87
+ },
88
+ device_type: {
89
+ label: 'User Mobile Device Type',
90
+ description: "User's mobile device type",
91
+ type: 'hidden',
92
+ default: {
93
+ '@path': '$.context.device.type'
94
+ },
95
+ required: false
96
+ },
97
+ identifier: {
98
+ label: 'User Identifier',
99
+ description: 'Specify the identifier(s) to send to Yahoo',
100
+ type: 'string',
101
+ required: true,
102
+ default: 'email',
103
+ choices: [
104
+ { value: 'email', label: 'Send email' },
105
+ { value: 'maid', label: 'Send MAID' },
106
+ { value: 'email_maid', label: 'Send email and/or MAID' }
107
+ ]
108
+ },
109
+ gdpr_flag: {
110
+ label: 'GDPR Flag',
111
+ description: 'Set to true to indicate that audience data is subject to GDPR regulations',
112
+ type: 'boolean',
113
+ required: true,
114
+ default: false
115
+ },
116
+ gdpr_euconsent: {
117
+ label: 'GDPR Consent Attributes',
118
+ description: 'Required if GDPR flag is set to "true". Using IAB Purpose bit descriptions specify the following user consent attributes: "Storage and Access of Information", "Personalization"',
119
+ type: 'string',
120
+ required: false
121
+ }
122
+ },
123
+ perform: (request, { payload, auth, audienceSettings }) => {
124
+ const rt_access_token = auth?.accessToken;
125
+ if (!audienceSettings) {
126
+ throw new actions_core_1.IntegrationError('Bad Request: no audienceSettings found.', 'INVALID_REQUEST_DATA', 400);
127
+ }
128
+ const body = utils_rt_1.gen_update_segment_payload([payload], audienceSettings);
129
+ if (body.data.length > 0) {
130
+ return request('https://dataxonline.yahoo.com/online/audience/', {
131
+ method: 'POST',
132
+ json: body,
133
+ headers: {
134
+ Authorization: `Bearer ${rt_access_token}`
135
+ }
136
+ });
137
+ }
138
+ else {
139
+ throw new actions_core_1.PayloadValidationError('Email and / or Advertising Id not available in the profile(s)');
140
+ }
141
+ },
142
+ performBatch: (request, { payload, audienceSettings, auth }) => {
143
+ const rt_access_token = auth?.accessToken;
144
+ if (!audienceSettings) {
145
+ throw new actions_core_1.IntegrationError('Bad Request: no audienceSettings found.', 'INVALID_REQUEST_DATA', 400);
146
+ }
147
+ const body = utils_rt_1.gen_update_segment_payload(payload, audienceSettings);
148
+ if (body.data.length > 0) {
149
+ return request('https://dataxonline.yahoo.com/online/audience/', {
150
+ method: 'POST',
151
+ json: body,
152
+ headers: {
153
+ Authorization: `Bearer ${rt_access_token}`
154
+ }
155
+ });
156
+ }
157
+ else {
158
+ throw new actions_core_1.PayloadValidationError('Email and / or Advertising Id not available in the profile(s)');
159
+ }
160
+ }
161
+ };
162
+ exports.default = action;
163
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/yahoo-audiences/updateSegment/index.ts"],"names":[],"mappings":";;AACA,wDAAgF;AAGhF,0CAAwD;AAExD,MAAM,MAAM,GAA0D;IACpE,KAAK,EAAE,2BAA2B;IAClC,WAAW,EAAE,4CAA4C;IACzD,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,mBAAmB,EAAE;YACnB,KAAK,EAAE,qBAAqB;YAC5B,WAAW,EAAE,iFAAiF;YAC9F,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,mCAAmC;aAC7C;SACF;QACD,oBAAoB,EAAE;YACpB,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EAAE,gFAAgF;YAC7F,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,oCAAoC;aAC9C;SACF;QAED,gBAAgB,EAAE;YAChB,KAAK,EAAE,wDAAwD;YAC/D,WAAW,EAAE,wDAAwD;YACrE,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;oBAC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;oBACP,aAAa,EAAE,UAAU,eAAe,EAAE;iBAC3C;aACF,CAAC,CAAA;SACH;aAAM;YACL,MAAM,IAAI,qCAAsB,CAAC,+DAA+D,CAAC,CAAA;SAClG;IACH,CAAC;IACD,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,EAAE,EAAE;QAC7D,MAAM,eAAe,GAAG,IAAI,EAAE,WAAW,CAAA;QAEzC,IAAI,CAAC,gBAAgB,EAAE;YACrB,MAAM,IAAI,+BAAgB,CAAC,yCAAyC,EAAE,sBAAsB,EAAE,GAAG,CAAC,CAAA;SACnG;QACD,MAAM,IAAI,GAAG,qCAA0B,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAA;QAElE,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;YACxB,OAAO,OAAO,CAAC,gDAAgD,EAAE;gBAC/D,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,IAAI;gBACV,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,eAAe,EAAE;iBAC3C;aACF,CAAC,CAAA;SACH;aAAM;YACL,MAAM,IAAI,qCAAsB,CAAC,+DAA+D,CAAC,CAAA;SAClG;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { Payload } from './updateSegment/generated-types';
2
+ import { YahooPayload } from './types';
3
+ import { AudienceSettings } from './generated-types';
4
+ export declare function create_hash(input: string | undefined): string | undefined;
5
+ export declare function generate_jwt(client_id: string, client_secret: string): string;
6
+ export declare function get_id_schema(payload: Payload, audienceSettings: AudienceSettings): {
7
+ maid: boolean;
8
+ email: boolean;
9
+ };
10
+ export declare function gen_update_segment_payload(payloads: Payload[], audienceSettings: AudienceSettings): YahooPayload;
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.gen_update_segment_payload = exports.get_id_schema = exports.generate_jwt = exports.create_hash = void 0;
4
+ const crypto_1 = require("crypto");
5
+ const utils_tax_1 = require("./utils-tax");
6
+ function create_hash(input) {
7
+ if (input === undefined)
8
+ return;
9
+ return crypto_1.createHash('sha256').update(input).digest('hex');
10
+ }
11
+ exports.create_hash = create_hash;
12
+ function generate_jwt(client_id, client_secret) {
13
+ const random_id = utils_tax_1.gen_random_id(24);
14
+ const current_time = Math.floor(new Date().getTime() / 1000);
15
+ const url = 'https://id.b2b.yahooinc.com/identity/oauth2/access_token';
16
+ const jwt_payload = {
17
+ iss: client_id,
18
+ sub: client_id,
19
+ aud: url + '?realm=dataxonline',
20
+ jti: random_id,
21
+ exp: current_time + 3600,
22
+ iat: current_time
23
+ };
24
+ const jwt_header = {
25
+ alg: 'HS256',
26
+ typ: 'JWT'
27
+ };
28
+ const jwt_header_encoded = Buffer.from(JSON.stringify(jwt_header)).toString('base64');
29
+ const jwt_payload_encoded = Buffer.from(JSON.stringify(jwt_payload)).toString('base64');
30
+ const jwt_head_payload = jwt_header_encoded + '.' + jwt_payload_encoded;
31
+ const hash = crypto_1.createHmac('sha256', client_secret);
32
+ const signature = hash.update(jwt_head_payload).digest('base64');
33
+ const jwt = jwt_head_payload + '.' + signature;
34
+ return jwt;
35
+ }
36
+ exports.generate_jwt = generate_jwt;
37
+ function get_id_schema(payload, audienceSettings) {
38
+ const schema = {
39
+ email: false,
40
+ maid: false
41
+ };
42
+ let id_type;
43
+ audienceSettings.identifier ? (id_type = audienceSettings.identifier) : (id_type = payload.identifier);
44
+ if (id_type == 'email') {
45
+ schema.email = true;
46
+ }
47
+ if (id_type == 'maid') {
48
+ schema.maid = true;
49
+ }
50
+ if (id_type == 'email_maid') {
51
+ schema.maid = true;
52
+ schema.email = true;
53
+ }
54
+ return schema;
55
+ }
56
+ exports.get_id_schema = get_id_schema;
57
+ function gen_update_segment_payload(payloads, audienceSettings) {
58
+ const schema = get_id_schema(payloads[0], audienceSettings);
59
+ const data = [];
60
+ for (const event of payloads) {
61
+ let hashed_email = '';
62
+ if (schema.email === true && event.email) {
63
+ hashed_email = create_hash(event.email);
64
+ }
65
+ let idfa = '';
66
+ let gpsaid = '';
67
+ if (schema.maid === true && event.advertising_id) {
68
+ switch (event.device_type) {
69
+ case 'ios':
70
+ idfa = event.advertising_id;
71
+ break;
72
+ case 'android':
73
+ gpsaid = event.advertising_id;
74
+ break;
75
+ }
76
+ }
77
+ if (hashed_email == '' && idfa == '' && gpsaid == '') {
78
+ continue;
79
+ }
80
+ const ts = Math.floor(new Date().getTime() / 1000);
81
+ const seg_key = event.segment_audience_key;
82
+ let exp;
83
+ if (event.event_attributes[seg_key] === true) {
84
+ exp = ts + 90 * 24 * 60 * 60;
85
+ }
86
+ if (event.event_attributes[seg_key] === false) {
87
+ exp = 0;
88
+ }
89
+ const seg_id = event.segment_audience_id;
90
+ data.push([hashed_email, idfa, gpsaid, 'exp=' + exp + '&seg_id=' + seg_id + '&ts=' + ts]);
91
+ }
92
+ const yahoo_payload = {
93
+ schema: ['SHA256EMAIL', 'IDFA', 'GPADVID', 'SEGMENTS'],
94
+ data: data,
95
+ gdpr: payloads[0].gdpr_flag
96
+ };
97
+ if (payloads[0].gdpr_flag) {
98
+ yahoo_payload.gdpr_euconsent = payloads[0].gdpr_euconsent;
99
+ }
100
+ return yahoo_payload;
101
+ }
102
+ exports.gen_update_segment_payload = gen_update_segment_payload;
103
+ //# sourceMappingURL=utils-rt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-rt.js","sourceRoot":"","sources":["../../../src/destinations/yahoo-audiences/utils-rt.ts"],"names":[],"mappings":";;;AAAA,mCAA+C;AAG/C,2CAA2C;AAQ3C,SAAgB,WAAW,CAAC,KAAyB;IACnD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAM;IAC/B,OAAO,mBAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AACzD,CAAC;AAHD,kCAGC;A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payload as SegmentNodePayload } from './createSegment/generated-types';
2
+ import { Payload as CustomerNodePayload } from './createCustomerNode/generated-types';
3
+ import type { Settings } from './generated-types';
4
+ import { CredsObj } from './types';
5
+ import { RequestClient } from '@segment/actions-core';
6
+ export declare function gen_customer_taxonomy_payload(settings: Settings, payload: CustomerNodePayload): string;
7
+ export declare function gen_segment_subtaxonomy_payload(payload: SegmentNodePayload): string;
8
+ export declare function gen_random_id(length: number): string;
9
+ export declare function gen_oauth1_signature(client_key: string, client_secret: string, method: string, url: string): string;
10
+ export declare function update_taxonomy(engage_space_id: string, tx_creds: CredsObj, request: RequestClient, body_form_data: string): Promise<any>;