@segment/action-destinations 3.221.1-add-tar-release-pipeline.11 → 3.221.1-onSubscriptionSave-core.12

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 (42) hide show
  1. package/dist/destinations/braze-cohorts/syncAudiences/index.js +1 -2
  2. package/dist/destinations/braze-cohorts/syncAudiences/index.js.map +1 -1
  3. package/dist/destinations/engage/utils/track.d.ts +9 -9
  4. package/dist/destinations/klaviyo/config.d.ts +2 -0
  5. package/dist/destinations/klaviyo/config.js +6 -0
  6. package/dist/destinations/klaviyo/config.js.map +1 -0
  7. package/dist/destinations/klaviyo/index.js +9 -5
  8. package/dist/destinations/klaviyo/index.js.map +1 -1
  9. package/dist/destinations/klaviyo/orderCompleted/generated-types.d.ts +21 -0
  10. package/dist/destinations/klaviyo/orderCompleted/generated-types.js +3 -0
  11. package/dist/destinations/klaviyo/orderCompleted/generated-types.js.map +1 -0
  12. package/dist/destinations/klaviyo/orderCompleted/index.d.ts +5 -0
  13. package/dist/destinations/klaviyo/orderCompleted/index.js +143 -0
  14. package/dist/destinations/klaviyo/orderCompleted/index.js.map +1 -0
  15. package/dist/destinations/klaviyo/trackEvent/generated-types.d.ts +16 -0
  16. package/dist/destinations/klaviyo/trackEvent/generated-types.js +3 -0
  17. package/dist/destinations/klaviyo/trackEvent/generated-types.js.map +1 -0
  18. package/dist/destinations/klaviyo/trackEvent/index.d.ts +5 -0
  19. package/dist/destinations/klaviyo/trackEvent/index.js +115 -0
  20. package/dist/destinations/klaviyo/trackEvent/index.js.map +1 -0
  21. package/dist/destinations/klaviyo/types.d.ts +61 -0
  22. package/dist/destinations/klaviyo/types.js +8 -0
  23. package/dist/destinations/klaviyo/types.js.map +1 -0
  24. package/dist/destinations/klaviyo/upsertProfile/generated-types.d.ts +21 -1
  25. package/dist/destinations/klaviyo/upsertProfile/index.js +150 -5
  26. package/dist/destinations/klaviyo/upsertProfile/index.js.map +1 -1
  27. package/dist/destinations/liveramp-audiences/audienceEnteredSFTP.types.d.ts +16 -0
  28. package/dist/destinations/liveramp-audiences/audienceEnteredSFTP.types.js +3 -0
  29. package/dist/destinations/liveramp-audiences/audienceEnteredSFTP.types.js.map +1 -0
  30. package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.d.ts +4 -0
  31. package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.js +3 -0
  32. package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.js.map +1 -0
  33. package/dist/destinations/yahoo-audiences/createCustomerNode/index.d.ts +5 -0
  34. package/dist/destinations/yahoo-audiences/createCustomerNode/index.js +33 -0
  35. package/dist/destinations/yahoo-audiences/createCustomerNode/index.js.map +1 -0
  36. package/dist/destinations/yahoo-audiences/createSegment/generated-types.d.ts +6 -0
  37. package/dist/destinations/yahoo-audiences/createSegment/generated-types.js +3 -0
  38. package/dist/destinations/yahoo-audiences/createSegment/generated-types.js.map +1 -0
  39. package/dist/destinations/yahoo-audiences/createSegment/index.d.ts +5 -0
  40. package/dist/destinations/yahoo-audiences/createSegment/index.js +45 -0
  41. package/dist/destinations/yahoo-audiences/createSegment/index.js.map +1 -0
  42. package/package.json +4 -4
@@ -97,8 +97,7 @@ const action = {
97
97
  }
98
98
  }
99
99
  },
100
- perform: async (request, { settings, payload, stateContext, logger }) => {
101
- logger?.info('Hello world');
100
+ perform: async (request, { settings, payload, stateContext }) => {
102
101
  return processPayload(request, settings, [payload], stateContext);
103
102
  },
104
103
  performBatch: async (request, { settings, payload, stateContext }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/braze-cohorts/syncAudiences/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA+F;AAG/F,gCAAsC;AAGtC,6DAAoC;AAEpC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,+BAA+B;IAC5C,mBAAmB,EAAE,yDAAyD;IAC9E,MAAM,EAAE;QACN,WA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ACpC,MAAM,EAAE,gBAAgB,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAA;QAC/F,MAAM,oBAAoB,GAAY,gBAAgB,CAAC,GAAG,qBAAqB,EAAE,CAAY,CAAA;QAC7F,MAAM,IAAI,GAAG,oBAAoB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAA;QAE1D,IAAI,WAAW,EAAE;YACf,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;SAClC;aAAM,IAAI,SAAS,EAAE;YACpB,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;SAClC;aAAM,IAAI,UAAU,EAAE;YACrB,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;SAChC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO;QACL,QAAQ;QACR,WAAW;KACZ,CAAA;AACH,CAAC;AAED,SAAS,qBAAqB,CAAC,IAAmB;IAChD,OAAO,CAAC,CAAC,iBAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,iBAAO,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,iBAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAA;AAC1F,CAAC;AAED,kBAAe,MAAM,CAAA"}
@@ -1,10 +1,10 @@
1
1
  import { ContextFromDecorator } from './operationTracking';
2
2
  export declare const track: ((decoratorArgs?: ({
3
3
  onError?: ((ctx: import("./operationTracking").OperationErrorHandlerContext<import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>>) => void) | undefined;
4
- } & import("./operationTracking").OperationLoggerDecoratorArgs & {
4
+ } & {
5
5
  onTry?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
6
6
  onFinally?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
7
- } & {
7
+ } & import("./operationTracking").OperationLoggerDecoratorArgs & {
8
8
  shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
9
9
  } & {
10
10
  wrapIntegrationError?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => import("@segment/actions-core/*").IntegrationError | [message: string, code: string, status: number]) | undefined;
@@ -15,9 +15,6 @@ export declare const track: ((decoratorArgs?: ({
15
15
  }) | undefined;
16
16
  } & {
17
17
  _contextType: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & {
18
- start?: number | undefined;
19
- duration?: number | undefined;
20
- } & {
21
18
  decoratorArgs?: {
22
19
  onError?: ((ctx: import("./operationTracking").OperationErrorHandlerContext<import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>>) => void) | undefined;
23
20
  } | undefined;
@@ -25,16 +22,19 @@ export declare const track: ((decoratorArgs?: ({
25
22
  parent?: (import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & any) | undefined;
26
23
  sharedContext: {};
27
24
  } & {
28
- logs: string[];
29
- logMetadata?: Record<string, unknown> | undefined;
30
- decoratorArgs?: import("./operationTracking").OperationLoggerDecoratorArgs | undefined;
31
- sharedContext: import("./operationTracking").OperationLoggerSharedContext;
25
+ start?: number | undefined;
26
+ duration?: number | undefined;
32
27
  } & {
33
28
  onFinally: (() => void)[];
34
29
  decoratorArgs?: {
35
30
  onTry?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
36
31
  onFinally?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
37
32
  } | undefined;
33
+ } & {
34
+ logs: string[];
35
+ logMetadata?: Record<string, unknown> | undefined;
36
+ decoratorArgs?: import("./operationTracking").OperationLoggerDecoratorArgs | undefined;
37
+ sharedContext: import("./operationTracking").OperationLoggerSharedContext;
38
38
  } & {
39
39
  tags: string[];
40
40
  sharedContext: {
@@ -0,0 +1,2 @@
1
+ export declare const API_URL = "https://a.klaviyo.com/api";
2
+ export declare const REVISION_DATE = "2023-09-15";
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.REVISION_DATE = exports.API_URL = void 0;
4
+ exports.API_URL = 'https://a.klaviyo.com/api';
5
+ exports.REVISION_DATE = '2023-09-15';
6
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/config.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,2BAA2B,CAAA;AACrC,QAAA,aAAa,GAAG,YAAY,CAAA"}
@@ -4,7 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const upsertProfile_1 = __importDefault(require("./upsertProfile"));
7
- const API_URL = 'https://a.klaviyo.com/api';
7
+ const config_1 = require("./config");
8
+ const trackEvent_1 = __importDefault(require("./trackEvent"));
9
+ const orderCompleted_1 = __importDefault(require("./orderCompleted"));
8
10
  const destination = {
9
11
  name: 'Klaviyo (Actions)',
10
12
  slug: 'actions-klaviyo',
@@ -20,13 +22,13 @@ const destination = {
20
22
  }
21
23
  },
22
24
  testAuthentication: (request) => {
23
- return request(`${API_URL}/accounts/`, {
25
+ return request(`${config_1.API_URL}/accounts/`, {
24
26
  method: 'get'
25
27
  });
26
28
  }
27
29
  },
28
30
  onDelete: async (request, { payload }) => {
29
- return request(`${API_URL}/data-privacy-deletion-jobs/`, {
31
+ return request(`${config_1.API_URL}/data-privacy-deletion-jobs/`, {
30
32
  method: 'post',
31
33
  json: {
32
34
  data: {
@@ -48,12 +50,14 @@ const destination = {
48
50
  headers: {
49
51
  Authorization: `Klaviyo-API-Key ${settings.api_key}`,
50
52
  Accept: 'application/json',
51
- revision: new Date().toISOString().slice(0, 10)
53
+ revision: config_1.REVISION_DATE
52
54
  }
53
55
  };
54
56
  },
55
57
  actions: {
56
- upsertProfile: upsertProfile_1.default
58
+ upsertProfile: upsertProfile_1.default,
59
+ trackEvent: trackEvent_1.default,
60
+ orderCompleted: orderCompleted_1.default
57
61
  }
58
62
  };
59
63
  exports.default = destination;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/index.ts"],"names":[],"mappings":";;;;;AAGA,oEAA2C;AAE3C,MAAM,OAAO,GAAG,2BAA2B,CAAA;AAE3C,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,SAAS;gBAChB,WAAW,EAAE,wGAAwG;gBACrH,QAAQ,EAAE,IAAI;aACf;SACF;QACD,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE;YAC9B,OAAO,OAAO,CAAC,GAAG,OAAO,YAAY,EAAE;gBACrC,MAAM,EAAE,KAAK;aACd,CAAC,CAAA;QACJ,CAAC;KACF;IAED,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACvC,OAAO,OAAO,CAAC,GAAG,OAAO,8BAA8B,EAAE;YACvD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,IAAI,EAAE;oBACJ,IAAI,EAAE,2BAA2B;oBACjC,UAAU,EAAE;wBACV,OAAO,EAAE;4BACP,IAAI,EAAE;gCACJ,IAAI,EAAE,SAAS;gCACf,EAAE,EAAE,OAAO,CAAC,MAAM;6BACnB;yBACF;qBACF;iBACF;aACF;SACF,CAAC,CAAA;IACJ,CAAC;IAED,aAAa,CAAC,EAAE,QAAQ,EAAE;QACxB,OAAO;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ACF;qBACF;iBACF;aACF;SACF,CAAC,CAAA;IACJ,CAAC;IAED,aAAa,CAAC,EAAE,QAAQ,EAAE;QACxB,OAAO;YACL,OAAO,EAAE;gBACP,aAAa,EAAE,mBAAmB,QAAQ,CAAC,OAAO,EAAE;gBACpD,MAAM,EAAE,kBAAkB;gBAC1B,QAAQ,EAAE,sBAAa;aACxB;SACF,CAAA;IACH,CAAC;IAED,OAAO,EAAE;QACP,aAAa,EAAb,uBAAa;QACb,UAAU,EAAV,oBAAU;QACV,cAAc,EAAd,wBAAc;KACf;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -0,0 +1,21 @@
1
+ export interface Payload {
2
+ profile: {
3
+ email?: string;
4
+ phone_number?: string;
5
+ other_properties?: {
6
+ [k: string]: unknown;
7
+ };
8
+ };
9
+ properties: {
10
+ [k: string]: unknown;
11
+ };
12
+ time?: string | number;
13
+ value?: number;
14
+ unique_id?: string;
15
+ products?: {
16
+ value?: number;
17
+ properties?: {
18
+ [k: string]: unknown;
19
+ };
20
+ }[];
21
+ }
@@ -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/klaviyo/orderCompleted/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,143 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const actions_core_1 = require("@segment/actions-core");
4
+ const config_1 = require("../config");
5
+ const createEventData = (payload) => ({
6
+ data: {
7
+ type: 'event',
8
+ attributes: {
9
+ properties: { ...payload.properties },
10
+ time: payload.time,
11
+ value: payload.value,
12
+ metric: {
13
+ data: {
14
+ type: 'metric',
15
+ attributes: {
16
+ name: 'Order Completed'
17
+ }
18
+ }
19
+ },
20
+ profile: {
21
+ data: {
22
+ type: 'profile',
23
+ attributes: {
24
+ ...payload.profile
25
+ }
26
+ }
27
+ }
28
+ }
29
+ }
30
+ });
31
+ const sendProductRequests = async (payload, eventData, request) => {
32
+ if (payload.products && Array.isArray(payload.products)) {
33
+ const productPromises = payload?.products?.map((product) => {
34
+ eventData.data.attributes.properties = product.properties;
35
+ eventData.data.attributes.value = product.value;
36
+ eventData.data.attributes.metric.data.attributes.name = 'Ordered Product';
37
+ return request(`${config_1.API_URL}/events/`, {
38
+ method: 'POST',
39
+ json: eventData
40
+ });
41
+ });
42
+ await Promise.all(productPromises);
43
+ }
44
+ };
45
+ const action = {
46
+ title: 'Order Completed',
47
+ description: 'Order Completed Event action tracks users Order Completed events and associate it with their profile.',
48
+ defaultSubscription: 'type = "track"',
49
+ fields: {
50
+ profile: {
51
+ label: 'Profile',
52
+ description: `Properties of the profile that triggered this event.`,
53
+ type: 'object',
54
+ properties: {
55
+ email: {
56
+ label: 'Email',
57
+ type: 'string'
58
+ },
59
+ phone_number: {
60
+ label: 'Phone Number',
61
+ type: 'string'
62
+ },
63
+ other_properties: {
64
+ label: 'Other Properties',
65
+ type: 'object'
66
+ }
67
+ },
68
+ required: true
69
+ },
70
+ properties: {
71
+ description: `Properties of this event.`,
72
+ label: 'Properties',
73
+ type: 'object',
74
+ default: {
75
+ '@path': '$.properties'
76
+ },
77
+ required: true
78
+ },
79
+ time: {
80
+ label: 'Time',
81
+ description: `When this event occurred. By default, the time the request was received will be used.
82
+ The time is truncated to the second. The time must be after the year 2000 and can only
83
+ be up to 1 year in the future.
84
+ `,
85
+ type: 'datetime',
86
+ default: {
87
+ '@path': '$.timestamp'
88
+ }
89
+ },
90
+ value: {
91
+ label: 'Value',
92
+ description: 'A numeric value to associate with this event. For example, the dollar amount of a purchase.',
93
+ type: 'number'
94
+ },
95
+ unique_id: {
96
+ label: 'Unique ID',
97
+ description: `A unique identifier for an event. If the unique_id is repeated for the same
98
+ profile and metric, only the first processed event will be recorded. If this is not
99
+ present, this will use the time to the second. Using the default, this limits only one
100
+ event per profile per second.
101
+ `,
102
+ type: 'string',
103
+ default: {
104
+ '@path': '$.messageId'
105
+ }
106
+ },
107
+ products: {
108
+ label: 'Products',
109
+ description: 'List of products purchased in the order.',
110
+ multiple: true,
111
+ type: 'object',
112
+ properties: {
113
+ value: {
114
+ label: 'Value',
115
+ description: 'A numeric value to associate with this event. For example, the dollar amount of a purchase.',
116
+ type: 'number'
117
+ },
118
+ properties: {
119
+ description: `Properties of this event.`,
120
+ label: 'Properties',
121
+ type: 'object'
122
+ }
123
+ }
124
+ }
125
+ },
126
+ perform: async (request, { payload }) => {
127
+ const { email, phone_number } = payload.profile;
128
+ if (!email && !phone_number) {
129
+ throw new actions_core_1.PayloadValidationError('One of Phone Number or Email is required.');
130
+ }
131
+ const eventData = createEventData(payload);
132
+ const event = await request(`${config_1.API_URL}/events/`, {
133
+ method: 'POST',
134
+ json: eventData
135
+ });
136
+ if (event.status == 202 && Array.isArray(payload.products)) {
137
+ await sendProductRequests(payload, eventData, request);
138
+ }
139
+ return event;
140
+ }
141
+ };
142
+ exports.default = action;
143
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/orderCompleted/index.ts"],"names":[],"mappings":";;AAGA,wDAA6E;AAC7E,sCAAmC;AAGnC,MAAM,eAAe,GAAG,CAAC,OAAgB,EAAE,EAAE,CAAC,CAAC;IAC7C,IAAI,EAAE;QACJ,IAAI,EAAE,OAAO;QACb,UAAU,EAAE;YACV,UAAU,EAAE,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE;YACrC,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM,EAAE;gBACN,IAAI,EAAE;oBACJ,I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,KAAK,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,OAAO,CAAA;QAE/C,IAAI,CAAC,KAAK,IAAI,CAAC,YAAY,EAAE;YAC3B,MAAM,IAAI,qCAAsB,CAAC,2CAA2C,CAAC,CAAA;SAC9E;QAED,MAAM,SAAS,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;QAE1C,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,GAAG,gBAAO,UAAU,EAAE;YAChD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,SAAS;SAChB,CAAC,CAAA;QAEF,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC1D,MAAM,mBAAmB,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;SACvD;QACD,OAAO,KAAK,CAAA;IACd,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,16 @@
1
+ export interface Payload {
2
+ profile: {
3
+ email?: string;
4
+ phone_number?: string;
5
+ other_properties?: {
6
+ [k: string]: unknown;
7
+ };
8
+ };
9
+ metric_name: string;
10
+ properties: {
11
+ [k: string]: unknown;
12
+ };
13
+ time?: string | number;
14
+ value?: number;
15
+ unique_id?: 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/klaviyo/trackEvent/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,115 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const actions_core_1 = require("@segment/actions-core");
4
+ const config_1 = require("../config");
5
+ const action = {
6
+ title: 'Track Event',
7
+ description: 'Track user events and associate it with their profile.',
8
+ defaultSubscription: 'type = "track"',
9
+ fields: {
10
+ profile: {
11
+ label: 'Profile',
12
+ description: `Properties of the profile that triggered this event.`,
13
+ type: 'object',
14
+ properties: {
15
+ email: {
16
+ label: 'Email',
17
+ type: 'string'
18
+ },
19
+ phone_number: {
20
+ label: 'Phone Number',
21
+ type: 'string'
22
+ },
23
+ other_properties: {
24
+ label: 'Other Properties',
25
+ type: 'object'
26
+ }
27
+ },
28
+ required: true
29
+ },
30
+ metric_name: {
31
+ label: 'Metric Name',
32
+ description: 'Name of the event. Must be less than 128 characters.',
33
+ type: 'string',
34
+ default: {
35
+ '@path': '$.event'
36
+ },
37
+ required: true
38
+ },
39
+ properties: {
40
+ description: `Properties of this event.`,
41
+ label: 'Properties',
42
+ type: 'object',
43
+ default: {
44
+ '@path': '$.properties'
45
+ },
46
+ required: true
47
+ },
48
+ time: {
49
+ label: 'Time',
50
+ description: `When this event occurred. By default, the time the request was received will be used.
51
+ The time is truncated to the second. The time must be after the year 2000 and can only
52
+ be up to 1 year in the future.
53
+ `,
54
+ type: 'datetime',
55
+ default: {
56
+ '@path': '$.timestamp'
57
+ }
58
+ },
59
+ value: {
60
+ label: 'Value',
61
+ description: 'A numeric value to associate with this event. For example, the dollar amount of a purchase.',
62
+ type: 'number'
63
+ },
64
+ unique_id: {
65
+ label: 'Unique ID',
66
+ description: `A unique identifier for an event. If the unique_id is repeated for the same
67
+ profile and metric, only the first processed event will be recorded. If this is not
68
+ present, this will use the time to the second. Using the default, this limits only one
69
+ event per profile per second.
70
+ `,
71
+ type: 'string',
72
+ default: {
73
+ '@path': '$.messageId'
74
+ }
75
+ }
76
+ },
77
+ perform: (request, { payload }) => {
78
+ const { email, phone_number } = payload.profile;
79
+ if (!email && !phone_number) {
80
+ throw new actions_core_1.PayloadValidationError('One of Phone Number or Email is required.');
81
+ }
82
+ const eventData = {
83
+ data: {
84
+ type: 'event',
85
+ attributes: {
86
+ properties: { ...payload.properties },
87
+ time: payload.time,
88
+ value: payload.value,
89
+ metric: {
90
+ data: {
91
+ type: 'metric',
92
+ attributes: {
93
+ name: payload.metric_name
94
+ }
95
+ }
96
+ },
97
+ profile: {
98
+ data: {
99
+ type: 'profile',
100
+ attributes: {
101
+ ...payload.profile
102
+ }
103
+ }
104
+ }
105
+ }
106
+ }
107
+ };
108
+ return request(`${config_1.API_URL}/events/`, {
109
+ method: 'POST',
110
+ json: eventData
111
+ });
112
+ }
113
+ };
114
+ exports.default = action;
115
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/trackEvent/index.ts"],"names":[],"mappings":";;AAIA,wDAA8D;AAC9D,sCAAmC;AAEnC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,wDAAwD;IACrE,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,OAAO,EAAE;YACP,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,sDAAsD;YACnE,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,KAAK,EAAE,OAAO;oBACd,IAAI,EAAE,QAAQ;iBACf;gBACD,YAAY,EAAE;oBACZ,KAAK,EAAE,cAAc;oBACrB,IAAI,EAAE,QAAQ;iBACf;gBACD,gBAAgB,EAAE;oBAChB,KAAK,EAAE,kBAAkB;oBACzB,IAAI,EAAE,QAAQ;iBACf;aACF;YACD,QAAQ,EAAE,IAAI;SACf;QACD,WAAW,EAAE;YACX,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,sDAAsD;YACnE,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,SAAS;aACnB;YACD,QAAQ,EAAE,IAAI;SACf;QACD,UAAU,EAAE;YACV,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AAC,OAAO;6BACnB;yBACF;qBACF;iBACF;aACF;SACF,CAAA;QAED,OAAO,OAAO,CAAC,GAAG,gBAAO,UAAU,EAAE;YACnC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,SAAS;SAChB,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,61 @@
1
+ import { HTTPError } from '@segment/actions-core';
2
+ export declare class KlaviyoAPIError extends HTTPError {
3
+ response: Response & {
4
+ data: {
5
+ errors: Array<{
6
+ id: string;
7
+ status: number;
8
+ code: string;
9
+ title: string;
10
+ detail: string;
11
+ source: {
12
+ pointer: string;
13
+ };
14
+ meta: {
15
+ duplicate_profile_id: string;
16
+ };
17
+ }>;
18
+ };
19
+ content: string;
20
+ };
21
+ }
22
+ export interface ProfileData {
23
+ data: {
24
+ type: string;
25
+ id?: string;
26
+ attributes: {
27
+ email?: string;
28
+ external_id?: string;
29
+ phone_number?: string;
30
+ [key: string]: string | Record<string, unknown> | undefined;
31
+ };
32
+ };
33
+ }
34
+ export interface EventData {
35
+ data: {
36
+ type: string;
37
+ attributes: {
38
+ properties?: object;
39
+ time?: string | number;
40
+ value?: number;
41
+ metric: {
42
+ data: {
43
+ type: string;
44
+ attributes: {
45
+ name?: string;
46
+ };
47
+ };
48
+ };
49
+ profile: {
50
+ data: {
51
+ type: string;
52
+ attributes: {
53
+ email?: string;
54
+ phone_number?: string;
55
+ other_properties?: object;
56
+ };
57
+ };
58
+ };
59
+ };
60
+ };
61
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KlaviyoAPIError = void 0;
4
+ const actions_core_1 = require("@segment/actions-core");
5
+ class KlaviyoAPIError extends actions_core_1.HTTPError {
6
+ }
7
+ exports.KlaviyoAPIError = KlaviyoAPIError;
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/types.ts"],"names":[],"mappings":";;;AAAA,wDAAiD;AAEjD,MAAa,eAAgB,SAAQ,wBAAS;CAmB7C;AAnBD,0CAmBC"}
@@ -1,3 +1,23 @@
1
1
  export interface Payload {
2
- placeholder?: string;
2
+ email?: string;
3
+ phone_number?: string;
4
+ external_id?: string;
5
+ first_name?: string;
6
+ last_name?: string;
7
+ organization?: string;
8
+ title?: string;
9
+ image?: string;
10
+ location?: {
11
+ address1?: string | null;
12
+ address2?: string | null;
13
+ city?: string | null;
14
+ region?: string | null;
15
+ zip?: string | null;
16
+ latitude?: string | null;
17
+ longitude?: string | null;
18
+ country?: string | null;
19
+ };
20
+ properties?: {
21
+ [k: string]: unknown;
22
+ };
3
23
  }
@@ -1,17 +1,162 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const config_1 = require("../config");
4
+ const actions_core_1 = require("@segment/actions-core");
3
5
  const action = {
4
6
  title: 'Upsert Profile',
5
7
  description: 'Upsert user profile.',
8
+ defaultSubscription: 'type = "identify"',
6
9
  fields: {
7
- placeholder: {
8
- label: 'Placeholder',
9
- description: 'Placeholder',
10
+ email: {
11
+ label: 'Email',
12
+ description: `Individual's email address. One of External ID, Phone Number and Email required.`,
13
+ type: 'string',
14
+ format: 'email',
15
+ default: { '@path': '$.traits.email' }
16
+ },
17
+ phone_number: {
18
+ label: 'Phone Number',
19
+ description: `Individual's phone number in E.164 format. If SMS is not enabled and if you use Phone Number as identifier, then you have to provide one of Email or External ID.`,
20
+ type: 'string',
21
+ default: { '@path': '$.context.traits.phone' }
22
+ },
23
+ external_id: {
24
+ label: 'External ID',
25
+ description: `A unique identifier used by customers to associate Klaviyo profiles with profiles in an external system. One of External ID, Phone Number and Email required.`,
10
26
  type: 'string'
27
+ },
28
+ first_name: {
29
+ label: 'First Name',
30
+ description: `Individual's first name.`,
31
+ type: 'string',
32
+ default: { '@path': '$.traits.firstName' }
33
+ },
34
+ last_name: {
35
+ label: 'Last Name',
36
+ description: `Individual's last name.`,
37
+ type: 'string',
38
+ default: { '@path': '$.traits.lastName' }
39
+ },
40
+ organization: {
41
+ label: 'Organization',
42
+ description: `Name of the company or organization within the company for whom the individual works.`,
43
+ type: 'string',
44
+ default: { '@path': '$.traits.company.name' }
45
+ },
46
+ title: {
47
+ label: 'Title',
48
+ description: `Individual's job title.`,
49
+ type: 'string',
50
+ default: { '@path': '$.traits.title' }
51
+ },
52
+ image: {
53
+ label: 'Image',
54
+ description: `URL pointing to the location of a profile image.`,
55
+ type: 'string',
56
+ default: { '@path': '$.traits.avatar' }
57
+ },
58
+ location: {
59
+ label: 'Location',
60
+ description: `Individual's address.`,
61
+ type: 'object',
62
+ properties: {
63
+ address1: {
64
+ label: 'Address 1',
65
+ type: 'string',
66
+ allowNull: true
67
+ },
68
+ address2: {
69
+ label: 'Address 2',
70
+ type: 'string',
71
+ allowNull: true
72
+ },
73
+ city: {
74
+ label: 'City',
75
+ type: 'string',
76
+ allowNull: true
77
+ },
78
+ region: {
79
+ label: 'Region',
80
+ type: 'string',
81
+ allowNull: true
82
+ },
83
+ zip: {
84
+ label: 'ZIP',
85
+ type: 'string',
86
+ allowNull: true
87
+ },
88
+ latitude: {
89
+ label: 'Latitude',
90
+ type: 'string',
91
+ allowNull: true
92
+ },
93
+ longitude: {
94
+ label: 'Longitide',
95
+ type: 'string',
96
+ allowNull: true
97
+ },
98
+ country: {
99
+ label: 'Country',
100
+ type: 'string',
101
+ allowNull: true
102
+ }
103
+ },
104
+ default: {
105
+ city: { '@path': '$.traits.address.city' },
106
+ region: { '@path': '$.traits.address.state' },
107
+ zip: { '@path': '$.traits.address.postal_code' },
108
+ address1: { '@path': '$.traits.address.street' },
109
+ country: { '@path': '$.traits.address.country' }
110
+ }
111
+ },
112
+ properties: {
113
+ description: 'An object containing key/value pairs for any custom properties assigned to this profile.',
114
+ label: 'Properties',
115
+ type: 'object',
116
+ default: {
117
+ '@path': '$.properties'
118
+ }
11
119
  }
12
120
  },
13
- perform: () => {
14
- return undefined;
121
+ perform: async (request, { payload }) => {
122
+ const { email, external_id, phone_number, ...otherAttributes } = payload;
123
+ if (!email && !phone_number && !external_id) {
124
+ throw new actions_core_1.PayloadValidationError('One of External ID, Phone Number and Email is required.');
125
+ }
126
+ const profileData = {
127
+ data: {
128
+ type: 'profile',
129
+ attributes: {
130
+ email,
131
+ external_id,
132
+ phone_number,
133
+ ...otherAttributes
134
+ }
135
+ }
136
+ };
137
+ try {
138
+ const profile = await request(`${config_1.API_URL}/profiles/`, {
139
+ method: 'POST',
140
+ json: profileData
141
+ });
142
+ return profile;
143
+ }
144
+ catch (error) {
145
+ const { response } = error;
146
+ if (response?.status === 409) {
147
+ const content = JSON.parse(response?.content);
148
+ const id = content?.errors[0]?.meta?.duplicate_profile_id;
149
+ if (id) {
150
+ profileData.data.id = id;
151
+ const profile = await request(`${config_1.API_URL}/profiles/${id}`, {
152
+ method: 'PATCH',
153
+ json: profileData
154
+ });
155
+ return profile;
156
+ }
157
+ }
158
+ throw new actions_core_1.APIError('An error occurred while processing the request', 400);
159
+ }
15
160
  }
16
161
  };
17
162
  exports.default = action;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/upsertProfile/index.ts"],"names":[],"mappings":";;AAIA,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,sBAAsB;IACnC,MAAM,EAAE;QACN,WAAW,EAAE;YACX,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,aAAa;YAC1B,IAAI,EAAE,QAAQ;SACf;KACF;IACD,OAAO,EAAE,GAAG,EAAE;QACZ,OAAO,SAAS,CAAA;IAClB,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/upsertProfile/index.ts"],"names":[],"mappings":";;AAIA,sCAAmC;AACnC,wDAAwE;AAGxE,MAAM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,EAAE,EAAE;wBACzD,MAAM,EAAE,OAAO;wBACf,IAAI,EAAE,WAAW;qBAClB,CAAC,CAAA;oBACF,OAAO,OAAO,CAAA;iBACf;aACF;YAED,MAAM,IAAI,uBAAQ,CAAC,gDAAgD,EAAE,GAAG,CAAC,CAAA;SAC1E;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,16 @@
1
+ export interface Payload {
2
+ sftp_username?: string;
3
+ sftp_password?: string;
4
+ sftp_folder_path?: string;
5
+ audience_key: string;
6
+ identifier_data?: {
7
+ [k: string]: unknown;
8
+ };
9
+ unhashed_identifier_data?: {
10
+ [k: string]: unknown;
11
+ };
12
+ delimiter: string;
13
+ filename: string;
14
+ enable_batching: boolean;
15
+ batch_size?: number;
16
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=audienceEnteredSFTP.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audienceEnteredSFTP.types.js","sourceRoot":"","sources":["../../../src/destinations/liveramp-audiences/audienceEnteredSFTP.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export interface Payload {
2
+ engage_space_id: string;
3
+ customer_desc?: string;
4
+ }
@@ -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/createCustomerNode/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,33 @@
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 top-level CUSTOMER node in Yahoo taxonomy',
7
+ defaultSubscription: 'event = "Audience Entered" and event = "Audience Exited"',
8
+ description: 'Create top-level CUSTOMER node in Yahoo taxonomy',
9
+ fields: {
10
+ engage_space_id: {
11
+ label: 'Engage Space Id',
12
+ 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',
13
+ type: 'string',
14
+ required: true
15
+ },
16
+ customer_desc: {
17
+ label: 'Customer Description',
18
+ description: 'Provide a description for the Customer node in Yahoo taxonomy. This must be less then 1000 characters',
19
+ type: 'string',
20
+ required: false
21
+ }
22
+ },
23
+ perform: async (request, { settings, payload }) => {
24
+ const tx_creds = {
25
+ tx_client_key: settings.taxonomy_client_key,
26
+ tx_client_secret: settings.taxonomy_client_secret
27
+ };
28
+ const taxonomy_payload = utils_tax_1.gen_customer_taxonomy_payload(settings, payload);
29
+ return await utils_tax_2.update_taxonomy('', tx_creds, request, taxonomy_payload);
30
+ }
31
+ };
32
+ exports.default = action;
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/yahoo-audiences/createCustomerNode/index.ts"],"names":[],"mappings":";;AAGA,4CAA4D;AAC5D,4CAA8C;AAE9C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,kDAAkD;IACzD,mBAAmB,EAAE,0DAA0D;IAC/E,WAAW,EAAE,kDAAkD;IAC/D,MAAM,EAAE;QACN,eAAe,EAAE;YACf,KAAK,EAAE,iBAAiB;YACxB,WAAW,EACT,mJAAmJ;YACrJ,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,aAAa,EAAE;YACb,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EACT,uGAAuG;YACzG,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAChD,MAAM,QAAQ,GAAG;YACf,aAAa,EAAE,QAAQ,CAAC,mBAAmB;YAC3C,gBAAgB,EAAE,QAAQ,CAAC,sBAAsB;SAClD,CAAA;QACD,MAAM,gBAAgB,GAAG,yCAA6B,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QACzE,OAAO,MAAM,2BAAe,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAA;IACvE,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,6 @@
1
+ export interface Payload {
2
+ segment_audience_key: string;
3
+ segment_audience_id: string;
4
+ engage_space_id?: string;
5
+ customer_desc?: string;
6
+ }
@@ -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/createSegment/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,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"}
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.221.1-add-tar-release-pipeline.11+9ddcfb1d",
4
+ "version": "3.221.1-onSubscriptionSave-core.12+e5254f05",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/segmentio/action-destinations",
@@ -40,8 +40,8 @@
40
40
  "dependencies": {
41
41
  "@amplitude/ua-parser-js": "^0.7.25",
42
42
  "@segment/a1-notation": "^2.1.4",
43
- "@segment/actions-core": "^3.83.0",
44
- "@segment/actions-shared": "^1.65.0",
43
+ "@segment/actions-core": "^3.83.1-onSubscriptionSave-core.41+e5254f05",
44
+ "@segment/actions-shared": "^1.65.1-onSubscriptionSave-core.41+e5254f05",
45
45
  "@types/node": "^18.11.15",
46
46
  "ajv-formats": "^2.1.1",
47
47
  "aws4": "^1.12.0",
@@ -77,5 +77,5 @@
77
77
  "__tests__/__helpers__/"
78
78
  ]
79
79
  },
80
- "gitHead": "9ddcfb1d17658550784118a4a182c86e57911911"
80
+ "gitHead": "e5254f058322db4bdad5c163ca754a8fdad284da"
81
81
  }