@segment/action-destinations 3.229.0 → 3.229.1-test-action-cli-157ef7e2.6
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.
- package/dist/destinations/blackbaud-raisers-edge-nxt/utils/index.d.ts +1 -1
- package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.d.ts +1 -0
- package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.js +184 -0
- package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.js.map +1 -0
- package/dist/destinations/engage/utils/track.d.ts +17 -17
- package/dist/destinations/klaviyo/addProfileToList/generated-types.d.ts +4 -0
- package/dist/destinations/klaviyo/addProfileToList/generated-types.js +3 -0
- package/dist/destinations/klaviyo/addProfileToList/generated-types.js.map +1 -0
- package/dist/destinations/klaviyo/addProfileToList/index.d.ts +5 -0
- package/dist/destinations/klaviyo/addProfileToList/index.js +48 -0
- package/dist/destinations/klaviyo/addProfileToList/index.js.map +1 -0
- package/dist/destinations/klaviyo/properties.d.ts +3 -0
- package/dist/destinations/klaviyo/properties.js +21 -0
- package/dist/destinations/klaviyo/properties.js.map +1 -0
- package/dist/destinations/klaviyo/removeProfileToList/generated-types.d.ts +4 -0
- package/dist/destinations/klaviyo/removeProfileToList/generated-types.js +3 -0
- package/dist/destinations/klaviyo/removeProfileToList/generated-types.js.map +1 -0
- package/dist/destinations/klaviyo/removeProfileToList/index.d.ts +5 -0
- package/dist/destinations/klaviyo/removeProfileToList/index.js +43 -0
- package/dist/destinations/klaviyo/removeProfileToList/index.js.map +1 -0
- package/dist/destinations/linkedin-conversions/api/api.test.d.ts +1 -0
- package/dist/destinations/linkedin-conversions/api/api.test.js +220 -0
- package/dist/destinations/linkedin-conversions/api/api.test.js.map +1 -0
- package/dist/destinations/mixpanel/utils.d.ts +13 -0
- package/dist/destinations/mixpanel/utils.js +117 -0
- package/dist/destinations/mixpanel/utils.js.map +1 -0
- package/dist/destinations/moengage/index.js +4 -0
- package/dist/destinations/moengage/index.js.map +1 -1
- package/dist/destinations/movable-ink/categoryView/generated-types.d.ts +22 -0
- package/dist/destinations/movable-ink/categoryView/generated-types.js +3 -0
- package/dist/destinations/movable-ink/categoryView/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/categoryView/index.d.ts +5 -0
- package/dist/destinations/movable-ink/categoryView/index.js +43 -0
- package/dist/destinations/movable-ink/categoryView/index.js.map +1 -0
- package/dist/destinations/movable-ink/conversion/generated-types.d.ts +20 -0
- package/dist/destinations/movable-ink/conversion/generated-types.js +3 -0
- package/dist/destinations/movable-ink/conversion/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/conversion/index.d.ts +5 -0
- package/dist/destinations/movable-ink/conversion/index.js +45 -0
- package/dist/destinations/movable-ink/conversion/index.js.map +1 -0
- package/dist/destinations/movable-ink/fields.d.ts +21 -0
- package/dist/destinations/movable-ink/fields.js +236 -0
- package/dist/destinations/movable-ink/fields.js.map +1 -0
- package/dist/destinations/movable-ink/identify/generated-types.d.ts +7 -0
- package/dist/destinations/movable-ink/identify/generated-types.js +3 -0
- package/dist/destinations/movable-ink/identify/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/identify/index.d.ts +5 -0
- package/dist/destinations/movable-ink/identify/index.js +32 -0
- package/dist/destinations/movable-ink/identify/index.js.map +1 -0
- package/dist/destinations/movable-ink/productAdded/generated-types.d.ts +22 -0
- package/dist/destinations/movable-ink/productAdded/generated-types.js +3 -0
- package/dist/destinations/movable-ink/productAdded/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/productAdded/index.d.ts +5 -0
- package/dist/destinations/movable-ink/productAdded/index.js +43 -0
- package/dist/destinations/movable-ink/productAdded/index.js.map +1 -0
- package/dist/destinations/movable-ink/productViewed/generated-types.d.ts +21 -0
- package/dist/destinations/movable-ink/productViewed/generated-types.js +3 -0
- package/dist/destinations/movable-ink/productViewed/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/productViewed/index.d.ts +5 -0
- package/dist/destinations/movable-ink/productViewed/index.js +43 -0
- package/dist/destinations/movable-ink/productViewed/index.js.map +1 -0
- package/dist/destinations/movable-ink/search/generated-types.d.ts +12 -0
- package/dist/destinations/movable-ink/search/generated-types.js +3 -0
- package/dist/destinations/movable-ink/search/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/search/index.d.ts +5 -0
- package/dist/destinations/movable-ink/search/index.js +43 -0
- package/dist/destinations/movable-ink/search/index.js.map +1 -0
- package/dist/destinations/movable-ink/sendCustomEvent/generated-types.d.ts +25 -0
- package/dist/destinations/movable-ink/sendCustomEvent/generated-types.js +3 -0
- package/dist/destinations/movable-ink/sendCustomEvent/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/sendCustomEvent/index.d.ts +5 -0
- package/dist/destinations/movable-ink/sendCustomEvent/index.js +48 -0
- package/dist/destinations/movable-ink/sendCustomEvent/index.js.map +1 -0
- package/dist/destinations/trackey/group.types.d.ts +11 -0
- package/dist/destinations/trackey/group.types.js +3 -0
- package/dist/destinations/trackey/group.types.js.map +1 -0
- package/dist/destinations/trackey/identify.types.d.ts +11 -0
- package/dist/destinations/trackey/identify.types.js +3 -0
- package/dist/destinations/trackey/identify.types.js.map +1 -0
- package/dist/destinations/trackey/track.types.d.ts +12 -0
- package/dist/destinations/trackey/track.types.js +3 -0
- package/dist/destinations/trackey/track.types.js.map +1 -0
- package/package.json +3 -3
|
@@ -9,7 +9,7 @@ export declare const dateStringToFuzzyDate: (dateString: string | number) => fal
|
|
|
9
9
|
y: string;
|
|
10
10
|
};
|
|
11
11
|
export declare const augmentFieldsWithConstituentFields: (fields: Record<string, InputField>) => Record<string, InputField>;
|
|
12
|
-
export declare const splitConstituentPayload: (payload: CreateOrUpdateIndividualConstituentPayload) => (Partial<
|
|
12
|
+
export declare const splitConstituentPayload: (payload: CreateOrUpdateIndividualConstituentPayload) => (Partial<Address> | Partial<OnlinePresence> | Partial<Phone> | Partial<Constituent>)[];
|
|
13
13
|
export declare const buildConstituentPayloadFromPayload: (payload: StringIndexedObject) => Partial<CreateOrUpdateIndividualConstituentPayload>;
|
|
14
14
|
export declare const buildGiftDataFromPayload: (constituentId: string, payload: CreateGiftPayload) => Partial<Gift>;
|
|
15
15
|
export declare const buildConstituentActionDataFromPayload: (constituentId: string, payload: CreateConstituentAction) => Partial<ConstituentAction>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,184 @@
|
|
|
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 test_data_1 = require("../../../../lib/test-data");
|
|
8
|
+
const index_1 = __importDefault(require("../../index"));
|
|
9
|
+
const nock_1 = __importDefault(require("nock"));
|
|
10
|
+
const testDestination = actions_core_1.createTestIntegration(index_1.default);
|
|
11
|
+
const actionSlug = 'updateUserProfile';
|
|
12
|
+
const destinationSlug = 'Braze';
|
|
13
|
+
const seedName = `${destinationSlug}#${actionSlug}`;
|
|
14
|
+
const receivedAt = '2021-08-03T17:40:04.055Z';
|
|
15
|
+
const settings = {
|
|
16
|
+
app_id: 'my-app-id',
|
|
17
|
+
api_key: 'my-api-key',
|
|
18
|
+
endpoint: 'https://rest.iad-01.braze.com'
|
|
19
|
+
};
|
|
20
|
+
describe(`Testing snapshot for ${destinationSlug}'s ${actionSlug} destination action:`, () => {
|
|
21
|
+
it('required fields', async () => {
|
|
22
|
+
const action = index_1.default.actions[actionSlug];
|
|
23
|
+
const [eventData, settingsData] = test_data_1.generateTestData(seedName, index_1.default, action, true);
|
|
24
|
+
nock_1.default(/.*/).persist().get(/.*/).reply(200);
|
|
25
|
+
nock_1.default(/.*/).persist().post(/.*/).reply(200);
|
|
26
|
+
nock_1.default(/.*/).persist().put(/.*/).reply(200);
|
|
27
|
+
const event = actions_core_1.createTestEvent({
|
|
28
|
+
properties: eventData
|
|
29
|
+
});
|
|
30
|
+
const responses = await testDestination.testAction(actionSlug, {
|
|
31
|
+
event: event,
|
|
32
|
+
mapping: event.properties,
|
|
33
|
+
settings: settingsData,
|
|
34
|
+
auth: undefined
|
|
35
|
+
});
|
|
36
|
+
const request = responses[0].request;
|
|
37
|
+
const rawBody = await request.text();
|
|
38
|
+
try {
|
|
39
|
+
const json = JSON.parse(rawBody);
|
|
40
|
+
expect(json).toMatchSnapshot();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
expect(rawBody).toMatchSnapshot();
|
|
45
|
+
}
|
|
46
|
+
expect(request.headers).toMatchSnapshot();
|
|
47
|
+
});
|
|
48
|
+
it('all fields', async () => {
|
|
49
|
+
const action = index_1.default.actions[actionSlug];
|
|
50
|
+
const [eventData, settingsData] = test_data_1.generateTestData(seedName, index_1.default, action, false);
|
|
51
|
+
nock_1.default(/.*/).persist().get(/.*/).reply(200);
|
|
52
|
+
nock_1.default(/.*/).persist().post(/.*/).reply(200);
|
|
53
|
+
nock_1.default(/.*/).persist().put(/.*/).reply(200);
|
|
54
|
+
const event = actions_core_1.createTestEvent({
|
|
55
|
+
properties: eventData
|
|
56
|
+
});
|
|
57
|
+
const responses = await testDestination.testAction(actionSlug, {
|
|
58
|
+
event: event,
|
|
59
|
+
mapping: event.properties,
|
|
60
|
+
settings: settingsData,
|
|
61
|
+
auth: undefined
|
|
62
|
+
});
|
|
63
|
+
const request = responses[0].request;
|
|
64
|
+
const rawBody = await request.text();
|
|
65
|
+
try {
|
|
66
|
+
const json = JSON.parse(rawBody);
|
|
67
|
+
expect(json).toMatchSnapshot();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
expect(rawBody).toMatchSnapshot();
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
it('it should work with batched events', async () => {
|
|
75
|
+
nock_1.default('https://rest.iad-01.braze.com').post('/users/track').reply(200, {});
|
|
76
|
+
const events = [
|
|
77
|
+
actions_core_1.createTestEvent({
|
|
78
|
+
event: 'Test Event 1',
|
|
79
|
+
type: 'track',
|
|
80
|
+
receivedAt,
|
|
81
|
+
properties: {}
|
|
82
|
+
}),
|
|
83
|
+
actions_core_1.createTestEvent({
|
|
84
|
+
event: 'Test Event 2',
|
|
85
|
+
type: 'track',
|
|
86
|
+
receivedAt,
|
|
87
|
+
properties: {}
|
|
88
|
+
})
|
|
89
|
+
];
|
|
90
|
+
const responses = await testDestination.testBatchAction(actionSlug, {
|
|
91
|
+
events,
|
|
92
|
+
useDefaultMappings: true,
|
|
93
|
+
mapping: {
|
|
94
|
+
external_id: {
|
|
95
|
+
'@path': '$.userId'
|
|
96
|
+
},
|
|
97
|
+
user_alias: {},
|
|
98
|
+
braze_id: {
|
|
99
|
+
'@path': '$.properties.braze_id'
|
|
100
|
+
},
|
|
101
|
+
name: {
|
|
102
|
+
'@path': '$.event'
|
|
103
|
+
},
|
|
104
|
+
time: {
|
|
105
|
+
'@path': '$.receivedAt'
|
|
106
|
+
},
|
|
107
|
+
properties: {
|
|
108
|
+
'@path': '$.properties'
|
|
109
|
+
},
|
|
110
|
+
products: {
|
|
111
|
+
'@path': '$.properties.products'
|
|
112
|
+
},
|
|
113
|
+
enable_batching: true,
|
|
114
|
+
_update_existing_only: true
|
|
115
|
+
},
|
|
116
|
+
settings: {
|
|
117
|
+
...settings
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
expect(responses.length).toBe(1);
|
|
121
|
+
expect(responses[0].status).toBe(200);
|
|
122
|
+
expect(responses[0].options.headers).toMatchSnapshot();
|
|
123
|
+
expect(responses[0].options.json).toMatchSnapshot();
|
|
124
|
+
});
|
|
125
|
+
it('it should work with a single batched events', async () => {
|
|
126
|
+
nock_1.default('https://rest.iad-01.braze.com').post('/users/track').reply(200, {});
|
|
127
|
+
const events = [
|
|
128
|
+
actions_core_1.createTestEvent({
|
|
129
|
+
event: 'Test Event 1',
|
|
130
|
+
type: 'track',
|
|
131
|
+
receivedAt,
|
|
132
|
+
properties: {
|
|
133
|
+
products: [
|
|
134
|
+
{
|
|
135
|
+
quantity: 1,
|
|
136
|
+
product_id: 'Bowflex Treadmill 10',
|
|
137
|
+
price: 100
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
quantity: 2,
|
|
141
|
+
product_id: 'Bowflex Treadmill 20',
|
|
142
|
+
price: 200
|
|
143
|
+
}
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
})
|
|
147
|
+
];
|
|
148
|
+
const responses = await testDestination.testBatchAction(actionSlug, {
|
|
149
|
+
events,
|
|
150
|
+
useDefaultMappings: true,
|
|
151
|
+
mapping: {
|
|
152
|
+
external_id: {
|
|
153
|
+
'@path': '$.userId'
|
|
154
|
+
},
|
|
155
|
+
user_alias: {},
|
|
156
|
+
braze_id: {
|
|
157
|
+
'@path': '$.properties.braze_id'
|
|
158
|
+
},
|
|
159
|
+
name: {
|
|
160
|
+
'@path': '$.event'
|
|
161
|
+
},
|
|
162
|
+
time: {
|
|
163
|
+
'@path': '$.receivedAt'
|
|
164
|
+
},
|
|
165
|
+
properties: {
|
|
166
|
+
'@path': '$.properties'
|
|
167
|
+
},
|
|
168
|
+
products: {
|
|
169
|
+
'@path': '$.properties.products'
|
|
170
|
+
},
|
|
171
|
+
enable_batching: true,
|
|
172
|
+
_update_existing_only: true
|
|
173
|
+
},
|
|
174
|
+
settings: {
|
|
175
|
+
...settings
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
expect(responses.length).toBe(1);
|
|
179
|
+
expect(responses[0].status).toBe(200);
|
|
180
|
+
expect(responses[0].options.headers).toMatchSnapshot();
|
|
181
|
+
expect(responses[0].options.json).toMatchSnapshot();
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
//# sourceMappingURL=snapshot.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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wBACD;4BACE,QAAQ,EAAE,CAAC;4BACX,UAAU,EAAE,sBAAsB;4BAClC,KAAK,EAAE,GAAG;yBACX;qBACF;iBACF;aACF,CAAC;SACH,CAAA;QAED,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC,eAAe,CAAC,UAAU,EAAE;YAClE,MAAM;YACN,kBAAkB,EAAE,IAAI;YACxB,OAAO,EAAE;gBACP,WAAW,EAAE;oBACX,OAAO,EAAE,UAAU;iBACpB;gBACD,UAAU,EAAE,EAAE;gBACd,QAAQ,EAAE;oBACR,OAAO,EAAE,uBAAuB;iBACjC;gBACD,IAAI,EAAE;oBACJ,OAAO,EAAE,SAAS;iBACnB;gBACD,IAAI,EAAE;oBACJ,OAAO,EAAE,cAAc;iBACxB;gBACD,UAAU,EAAE;oBACV,OAAO,EAAE,cAAc;iBACxB;gBACD,QAAQ,EAAE;oBACR,OAAO,EAAE,uBAAuB;iBACjC;gBACD,eAAe,EAAE,IAAI;gBACrB,qBAAqB,EAAE,IAAI;aAC5B;YACD,QAAQ,EAAE;gBACR,GAAG,QAAQ;aACZ;SACF,CAAC,CAAA;QAEF,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAChC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACrC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,CAAA;QACtD,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAA;IACrD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ContextFromDecorator } from './operationTracking';
|
|
2
2
|
export declare const track: ((decoratorArgs?: ({
|
|
3
|
+
shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
|
|
4
|
+
} & {
|
|
3
5
|
onError?: ((ctx: import("./operationTracking").OperationErrorHandlerContext<import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>>) => void) | undefined;
|
|
4
|
-
} &
|
|
6
|
+
} & {
|
|
5
7
|
onTry?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
|
|
6
8
|
onFinally?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
|
|
7
|
-
} & {
|
|
8
|
-
shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
|
|
9
|
-
} & {
|
|
9
|
+
} & import("./operationTracking").OperationLoggerDecoratorArgs & {
|
|
10
10
|
wrapIntegrationError?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => import("@segment/actions-core/*").IntegrationError | [message: string, code: string, status: number]) | undefined;
|
|
11
11
|
}) | undefined) => import("./operationTracking").GenericMethodDecorator<(this: any, ...args: any[]) => any>) & {
|
|
12
12
|
getCurrentOperation(classInstance: any): (import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & {
|
|
@@ -15,8 +15,13 @@ export declare const track: ((decoratorArgs?: ({
|
|
|
15
15
|
}) | undefined;
|
|
16
16
|
} & {
|
|
17
17
|
_contextType: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
tags: string[];
|
|
19
|
+
sharedContext: {
|
|
20
|
+
tags: string[];
|
|
21
|
+
};
|
|
22
|
+
decoratorArgs?: {
|
|
23
|
+
shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
|
|
24
|
+
} | undefined;
|
|
20
25
|
} & {
|
|
21
26
|
decoratorArgs?: {
|
|
22
27
|
onError?: ((ctx: import("./operationTracking").OperationErrorHandlerContext<import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>>) => void) | undefined;
|
|
@@ -25,10 +30,8 @@ export declare const track: ((decoratorArgs?: ({
|
|
|
25
30
|
parent?: (import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & any) | undefined;
|
|
26
31
|
sharedContext: {};
|
|
27
32
|
} & {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
decoratorArgs?: import("./operationTracking").OperationLoggerDecoratorArgs | undefined;
|
|
31
|
-
sharedContext: import("./operationTracking").OperationLoggerSharedContext;
|
|
33
|
+
start?: number | undefined;
|
|
34
|
+
duration?: number | undefined;
|
|
32
35
|
} & {
|
|
33
36
|
onFinally: (() => void)[];
|
|
34
37
|
decoratorArgs?: {
|
|
@@ -36,13 +39,10 @@ export declare const track: ((decoratorArgs?: ({
|
|
|
36
39
|
onFinally?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
|
|
37
40
|
} | undefined;
|
|
38
41
|
} & {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
decoratorArgs?: {
|
|
44
|
-
shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
|
|
45
|
-
} | undefined;
|
|
42
|
+
logs: string[];
|
|
43
|
+
logMetadata?: Record<string, unknown> | undefined;
|
|
44
|
+
decoratorArgs?: import("./operationTracking").OperationLoggerDecoratorArgs | undefined;
|
|
45
|
+
sharedContext: import("./operationTracking").OperationLoggerSharedContext;
|
|
46
46
|
} & {
|
|
47
47
|
decoratorArgs?: {
|
|
48
48
|
wrapIntegrationError?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => import("@segment/actions-core/*").IntegrationError | [message: string, code: string, status: number]) | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/addProfileToList/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
4
|
+
const functions_1 = require("../functions");
|
|
5
|
+
const properties_1 = require("../properties");
|
|
6
|
+
const action = {
|
|
7
|
+
title: 'Add To List',
|
|
8
|
+
description: 'Add to list',
|
|
9
|
+
fields: {
|
|
10
|
+
email: { ...properties_1.email },
|
|
11
|
+
list_id: { ...properties_1.external_id }
|
|
12
|
+
},
|
|
13
|
+
perform: async (request, { payload }) => {
|
|
14
|
+
const { email, list_id } = payload;
|
|
15
|
+
if (!list_id || !email) {
|
|
16
|
+
throw new actions_core_1.IntegrationError("Insert the ID of the default list that you'd like to subscribe users", 'Missing required fields', 400);
|
|
17
|
+
}
|
|
18
|
+
const listData = {
|
|
19
|
+
data: [
|
|
20
|
+
{
|
|
21
|
+
type: 'profile'
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
};
|
|
25
|
+
try {
|
|
26
|
+
const profileData = await functions_1.createProfile(request, email);
|
|
27
|
+
const id = JSON.parse(profileData?.content)?.data?.id;
|
|
28
|
+
if (id) {
|
|
29
|
+
listData.data[0].id = id;
|
|
30
|
+
return await functions_1.executeProfileList(request, 'POST', listData, list_id);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
const { response } = error;
|
|
35
|
+
if (response?.status === 409) {
|
|
36
|
+
const content = JSON.parse(response?.content);
|
|
37
|
+
const id = content?.errors[0]?.meta?.duplicate_profile_id;
|
|
38
|
+
if (id) {
|
|
39
|
+
listData.data[0].id = id;
|
|
40
|
+
return await functions_1.executeProfileList(request, 'POST', listData, list_id);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
throw new Error('An error occurred while processing the request');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
exports.default = action;
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/addProfileToList/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAI1E,4CAAgE;AAChE,8CAAkD;AAElD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,aAAa;IAC1B,MAAM,EAAE;QACN,KAAK,EAAE,EAAE,GAAG,kBAAK,EAAE;QACnB,OAAO,EAAE,EAAE,GAAG,wBAAW,EAAE;KAC5B;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACtC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAA;QAClC,IAAI,CAAC,OAAO,IAAI,CAAC,KAAK,EAAE;YACtB,MAAM,IAAI,+BAAgB,CACxB,sEAAsE,EACtE,yBAAyB,EACzB,GAAG,CACJ,CAAA;SACF;QACD,MAAM,QAAQ,GAAa;YACzB,IAAI,EAAE;gBACJ;oBACE,IAAI,EAAE,SAAS;iBAChB;aACF;SACF,CAAA;QAED,IAAI;YACF,MAAM,WAAW,GAA2B,MAAM,yBAAa,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;YAC/E,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,EAAE,CAAA;YAErD,IAAI,EAAE,EAAE;gBACN,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAA;gBACxB,OAAO,MAAM,8BAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;aACpE;SACF;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAwB,CAAA;YAE7C,IAAI,QAAQ,EAAE,MAAM,KAAK,GAAG,EAAE;gBAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;gBAC7C,MAAM,EAAE,GAAG,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,oBAAoB,CAAA;gBAEzD,IAAI,EAAE,EAAE;oBACN,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAA;oBAExB,OAAO,MAAM,8BAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;iBACpE;aACF;YAED,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAA;SAClE;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.email = exports.external_id = void 0;
|
|
4
|
+
exports.external_id = {
|
|
5
|
+
label: 'External Id',
|
|
6
|
+
description: `'Insert the ID of the default list that you'd like to subscribe users to when you call .identify().'`,
|
|
7
|
+
type: 'string',
|
|
8
|
+
default: {
|
|
9
|
+
'@path': '$.context.personas.external_id'
|
|
10
|
+
},
|
|
11
|
+
unsafe_hidden: true
|
|
12
|
+
};
|
|
13
|
+
exports.email = {
|
|
14
|
+
label: 'Email',
|
|
15
|
+
description: 'Email of User',
|
|
16
|
+
type: 'string',
|
|
17
|
+
default: {
|
|
18
|
+
'@path': '$.traits.email'
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/properties.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GAAe;IACrC,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,sGAAsG;IACnH,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,gCAAgC;KAC1C;IACD,aAAa,EAAE,IAAI;CACpB,CAAA;AAEY,QAAA,KAAK,GAAe;IAC/B,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,eAAe;IAC5B,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,gBAAgB;KAC1B;CACF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/removeProfileToList/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
4
|
+
const functions_1 = require("../functions");
|
|
5
|
+
const properties_1 = require("../properties");
|
|
6
|
+
const action = {
|
|
7
|
+
title: 'Remove profile from list',
|
|
8
|
+
description: 'Remove profile from list',
|
|
9
|
+
fields: {
|
|
10
|
+
email: { ...properties_1.email },
|
|
11
|
+
list_id: { ...properties_1.external_id }
|
|
12
|
+
},
|
|
13
|
+
perform: async (request, { payload }) => {
|
|
14
|
+
const { email, list_id } = payload;
|
|
15
|
+
if (!email || !list_id) {
|
|
16
|
+
throw new actions_core_1.IntegrationError("Insert the ID of the default list that you'd like to subscribe users", 'Missing required fields', 400);
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const profileData = await functions_1.getProfile(request, email);
|
|
20
|
+
const v = JSON.parse(profileData.content);
|
|
21
|
+
if (Object.keys(v).length !== 0) {
|
|
22
|
+
console.log(v);
|
|
23
|
+
const listData = {
|
|
24
|
+
data: [
|
|
25
|
+
{
|
|
26
|
+
type: 'profile',
|
|
27
|
+
id: v.data[0].id
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
};
|
|
31
|
+
const list = await functions_1.executeProfileList(request, 'DELETE', listData, list_id);
|
|
32
|
+
return list;
|
|
33
|
+
}
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
console.log(error);
|
|
38
|
+
throw new Error('An error occurred while processing the request');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
exports.default = action;
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/removeProfileToList/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAK1E,4CAA6D;AAC7D,8CAAkD;AAElD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,0BAA0B;IACjC,WAAW,EAAE,0BAA0B;IACvC,MAAM,EAAE;QACN,KAAK,EAAE,EAAE,GAAG,kBAAK,EAAE;QACnB,OAAO,EAAE,EAAE,GAAG,wBAAW,EAAE;KAC5B;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACtC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAA;QAClC,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,EAAE;YACtB,MAAM,IAAI,+BAAgB,CACxB,sEAAsE,EACtE,yBAAyB,EACzB,GAAG,CACJ,CAAA;SACF;QACD,IAAI;YACF,MAAM,WAAW,GAA2B,MAAM,sBAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;YAC5E,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;YACzC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC/B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;gBACd,MAAM,QAAQ,GAAa;oBACzB,IAAI,EAAE;wBACJ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