@segment/action-destinations 3.290.0-staging-e9024c431 → 3.290.0-staging-7b9bf1814
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/customerio/test-helper.d.ts +1 -1
- package/dist/destinations/customerio/utils.d.ts +1 -1
- package/dist/destinations/engage/utils/track.d.ts +10 -10
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/SendEmailPerformer.d.ts +1 -1
- package/dist/destinations/engage-messaging-twilio/sendMobilePush/PushSender.d.ts +1 -1
- package/dist/destinations/engage-messaging-twilio/utils/PhoneMessageSender.d.ts +1 -1
- package/dist/destinations/klaviyo/addProfileToList/generated-types.d.ts +1 -0
- package/dist/destinations/klaviyo/addProfileToList/index.js +6 -5
- package/dist/destinations/klaviyo/addProfileToList/index.js.map +1 -1
- package/dist/destinations/klaviyo/functions.d.ts +2 -2
- package/dist/destinations/klaviyo/functions.js +11 -2
- package/dist/destinations/klaviyo/functions.js.map +1 -1
- package/dist/destinations/klaviyo/properties.d.ts +1 -0
- package/dist/destinations/klaviyo/properties.js +7 -1
- package/dist/destinations/klaviyo/properties.js.map +1 -1
- package/dist/destinations/klaviyo/removeProfile/generated-types.d.ts +1 -0
- package/dist/destinations/klaviyo/removeProfile/index.js +16 -7
- package/dist/destinations/klaviyo/removeProfile/index.js.map +1 -1
- package/dist/destinations/klaviyo/removeProfileFromList/generated-types.d.ts +1 -0
- package/dist/destinations/klaviyo/removeProfileFromList/index.js +10 -6
- package/dist/destinations/klaviyo/removeProfileFromList/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.d.ts +0 -1
- package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.js +0 -184
- package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.js.map +0 -1
- package/dist/destinations/engage/sendgrid/Profile.d.ts +0 -6
- package/dist/destinations/engage/sendgrid/Profile.js +0 -3
- package/dist/destinations/engage/sendgrid/Profile.js.map +0 -1
- package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.d.ts +0 -21
- package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js +0 -174
- package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js.map +0 -1
- package/dist/destinations/klaviyo/removeProfileToList/generated-types.d.ts +0 -4
- package/dist/destinations/klaviyo/removeProfileToList/generated-types.js +0 -3
- package/dist/destinations/klaviyo/removeProfileToList/generated-types.js.map +0 -1
- package/dist/destinations/klaviyo/removeProfileToList/index.d.ts +0 -5
- package/dist/destinations/klaviyo/removeProfileToList/index.js +0 -43
- package/dist/destinations/klaviyo/removeProfileToList/index.js.map +0 -1
- package/dist/destinations/mixpanel/utils.d.ts +0 -13
- package/dist/destinations/mixpanel/utils.js +0 -117
- package/dist/destinations/mixpanel/utils.js.map +0 -1
- package/dist/destinations/movable-ink/categoryView/generated-types.d.ts +0 -22
- package/dist/destinations/movable-ink/categoryView/generated-types.js +0 -3
- package/dist/destinations/movable-ink/categoryView/generated-types.js.map +0 -1
- package/dist/destinations/movable-ink/categoryView/index.d.ts +0 -5
- package/dist/destinations/movable-ink/categoryView/index.js +0 -43
- package/dist/destinations/movable-ink/categoryView/index.js.map +0 -1
- package/dist/destinations/movable-ink/conversion/generated-types.d.ts +0 -20
- package/dist/destinations/movable-ink/conversion/generated-types.js +0 -3
- package/dist/destinations/movable-ink/conversion/generated-types.js.map +0 -1
- package/dist/destinations/movable-ink/conversion/index.d.ts +0 -5
- package/dist/destinations/movable-ink/conversion/index.js +0 -45
- package/dist/destinations/movable-ink/conversion/index.js.map +0 -1
- package/dist/destinations/movable-ink/fields.d.ts +0 -21
- package/dist/destinations/movable-ink/fields.js +0 -236
- package/dist/destinations/movable-ink/fields.js.map +0 -1
- package/dist/destinations/movable-ink/identify/generated-types.d.ts +0 -7
- package/dist/destinations/movable-ink/identify/generated-types.js +0 -3
- package/dist/destinations/movable-ink/identify/generated-types.js.map +0 -1
- package/dist/destinations/movable-ink/identify/index.d.ts +0 -5
- package/dist/destinations/movable-ink/identify/index.js +0 -32
- package/dist/destinations/movable-ink/identify/index.js.map +0 -1
- package/dist/destinations/movable-ink/productAdded/generated-types.d.ts +0 -22
- package/dist/destinations/movable-ink/productAdded/generated-types.js +0 -3
- package/dist/destinations/movable-ink/productAdded/generated-types.js.map +0 -1
- package/dist/destinations/movable-ink/productAdded/index.d.ts +0 -5
- package/dist/destinations/movable-ink/productAdded/index.js +0 -43
- package/dist/destinations/movable-ink/productAdded/index.js.map +0 -1
- package/dist/destinations/movable-ink/productViewed/generated-types.d.ts +0 -21
- package/dist/destinations/movable-ink/productViewed/generated-types.js +0 -3
- package/dist/destinations/movable-ink/productViewed/generated-types.js.map +0 -1
- package/dist/destinations/movable-ink/productViewed/index.d.ts +0 -5
- package/dist/destinations/movable-ink/productViewed/index.js +0 -43
- package/dist/destinations/movable-ink/productViewed/index.js.map +0 -1
- package/dist/destinations/movable-ink/search/generated-types.d.ts +0 -12
- package/dist/destinations/movable-ink/search/generated-types.js +0 -3
- package/dist/destinations/movable-ink/search/generated-types.js.map +0 -1
- package/dist/destinations/movable-ink/search/index.d.ts +0 -5
- package/dist/destinations/movable-ink/search/index.js +0 -43
- package/dist/destinations/movable-ink/search/index.js.map +0 -1
- package/dist/destinations/movable-ink/sendCustomEvent/generated-types.d.ts +0 -25
- package/dist/destinations/movable-ink/sendCustomEvent/generated-types.js +0 -3
- package/dist/destinations/movable-ink/sendCustomEvent/generated-types.js.map +0 -1
- package/dist/destinations/movable-ink/sendCustomEvent/index.d.ts +0 -5
- package/dist/destinations/movable-ink/sendCustomEvent/index.js +0 -48
- package/dist/destinations/movable-ink/sendCustomEvent/index.js.map +0 -1
- package/dist/destinations/trackey/group.types.d.ts +0 -11
- package/dist/destinations/trackey/group.types.js +0 -3
- package/dist/destinations/trackey/group.types.js.map +0 -1
- package/dist/destinations/trackey/identify.types.d.ts +0 -11
- package/dist/destinations/trackey/identify.types.js +0 -3
- package/dist/destinations/trackey/identify.types.js.map +0 -1
- package/dist/destinations/trackey/track.types.d.ts +0 -12
- package/dist/destinations/trackey/track.types.js +0 -3
- package/dist/destinations/trackey/track.types.js.map +0 -1
- package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.d.ts +0 -4
- package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.js +0 -3
- package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.js.map +0 -1
- package/dist/destinations/yahoo-audiences/createCustomerNode/index.d.ts +0 -5
- package/dist/destinations/yahoo-audiences/createCustomerNode/index.js +0 -33
- package/dist/destinations/yahoo-audiences/createCustomerNode/index.js.map +0 -1
- package/dist/destinations/yahoo-audiences/createSegment/generated-types.d.ts +0 -6
- package/dist/destinations/yahoo-audiences/createSegment/generated-types.js +0 -3
- package/dist/destinations/yahoo-audiences/createSegment/generated-types.js.map +0 -1
- package/dist/destinations/yahoo-audiences/createSegment/index.d.ts +0 -5
- package/dist/destinations/yahoo-audiences/createSegment/index.js +0 -45
- package/dist/destinations/yahoo-audiences/createSegment/index.js.map +0 -1
- package/dist/destinations/yahoo-audiences/utils.d.ts +0 -4
- package/dist/destinations/yahoo-audiences/utils.js +0 -30
- package/dist/destinations/yahoo-audiences/utils.js.map +0 -1
|
@@ -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>;
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
import nock from 'nock';
|
|
3
3
|
import { AccountRegion } from './utils';
|
|
4
4
|
export declare const nockTrackInternalEndpoint: (region: AccountRegion) => nock.Scope;
|
|
5
|
-
export declare function getDefaultMappings(action: string): import("lodash").Dictionary<import("@segment/actions-core/destination-
|
|
5
|
+
export declare function getDefaultMappings(action: string): import("lodash").Dictionary<import("@segment/actions-core/src/destination-kit/types").FieldValue | undefined>;
|
|
6
6
|
export declare function testRunner(fn: Function): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const trackApiEndpoint: ({ accountRegion }: {
|
|
2
2
|
accountRegion?: string | undefined;
|
|
3
|
-
}) => "https://track.customer.io" | "https://track
|
|
3
|
+
}) => "https://track-eu.customer.io" | "https://track.customer.io";
|
|
4
4
|
export declare enum AccountRegion {
|
|
5
5
|
US = "US \uD83C\uDDFA\uD83C\uDDF8",
|
|
6
6
|
EU = "EU \uD83C\uDDEA\uD83C\uDDFA"
|
|
@@ -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
|
-
} & {
|
|
5
3
|
onError?: ((ctx: import("./operationTracking").OperationErrorHandlerContext<import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>>) => void) | undefined;
|
|
6
4
|
} & {
|
|
7
5
|
onTry?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
|
|
8
6
|
onFinally?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
|
|
9
7
|
} & import("./operationTracking").OperationLoggerDecoratorArgs & {
|
|
8
|
+
shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
|
|
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;
|
|
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,14 +15,6 @@ export declare const track: ((decoratorArgs?: ({
|
|
|
15
15
|
}) | undefined;
|
|
16
16
|
} & {
|
|
17
17
|
_contextType: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & {
|
|
18
|
-
tags: string[];
|
|
19
|
-
sharedContext: {
|
|
20
|
-
tags: string[];
|
|
21
|
-
};
|
|
22
|
-
decoratorArgs?: {
|
|
23
|
-
shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
|
|
24
|
-
} | undefined;
|
|
25
|
-
} & {
|
|
26
18
|
decoratorArgs?: {
|
|
27
19
|
onError?: ((ctx: import("./operationTracking").OperationErrorHandlerContext<import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>>) => void) | undefined;
|
|
28
20
|
} | undefined;
|
|
@@ -43,6 +35,14 @@ export declare const track: ((decoratorArgs?: ({
|
|
|
43
35
|
logMetadata?: Record<string, unknown> | undefined;
|
|
44
36
|
decoratorArgs?: import("./operationTracking").OperationLoggerDecoratorArgs | undefined;
|
|
45
37
|
sharedContext: import("./operationTracking").OperationLoggerSharedContext;
|
|
38
|
+
} & {
|
|
39
|
+
tags: string[];
|
|
40
|
+
sharedContext: {
|
|
41
|
+
tags: string[];
|
|
42
|
+
};
|
|
43
|
+
decoratorArgs?: {
|
|
44
|
+
shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
|
|
45
|
+
} | undefined;
|
|
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;
|
|
@@ -16,7 +16,7 @@ export declare class SendEmailPerformer extends MessageSendPerformer<Settings, P
|
|
|
16
16
|
profile: Profile;
|
|
17
17
|
[apiLookupLiquidKey]?: Record<string, unknown>;
|
|
18
18
|
}, contentType: string): Promise<any>;
|
|
19
|
-
sendToRecepient(emailProfile: ExtId<Payload>): Promise<
|
|
19
|
+
sendToRecepient(emailProfile: ExtId<Payload>): Promise<void | Response>;
|
|
20
20
|
getBodyTemplateFromS3(bodyUrl: string): Promise<string>;
|
|
21
21
|
getBodyHtml(profile: Profile, apiLookupData: Record<string, unknown>, emailProfile: {
|
|
22
22
|
id?: string | undefined;
|
|
@@ -20,7 +20,7 @@ export declare class PushSender extends TwilioMessageSender<PushPayload> {
|
|
|
20
20
|
get twilioToken(): string;
|
|
21
21
|
beforeSend(recepients: Recepient[]): Promise<void>;
|
|
22
22
|
bodyCustomDataBundle: BodyCustomDataBundle;
|
|
23
|
-
sendToRecepient(recipientDevice: Recepient): Promise<
|
|
23
|
+
sendToRecepient(recipientDevice: Recepient): Promise<void | Response>;
|
|
24
24
|
getBody(): Promise<BodyCustomDataBundle>;
|
|
25
25
|
private getTapActionPreset;
|
|
26
26
|
private removeEmpties;
|
|
@@ -7,7 +7,7 @@ export declare abstract class PhoneMessageSender<Payload extends PhoneMessagePay
|
|
|
7
7
|
abstract getBody(phone: string): Promise<URLSearchParams>;
|
|
8
8
|
get twilioHostname(): string;
|
|
9
9
|
get twilioToken(): string;
|
|
10
|
-
sendToRecepient(recepient: ExtId<Payload>): Promise<
|
|
10
|
+
sendToRecepient(recepient: ExtId<Payload>): Promise<void | Response>;
|
|
11
11
|
isSupportedExternalId(externalId: NonNullable<Payload['externalIds']>[number]): boolean;
|
|
12
12
|
getRecepients(): ExtId<Payload>[];
|
|
13
13
|
}
|
|
@@ -9,6 +9,7 @@ const action = {
|
|
|
9
9
|
defaultSubscription: 'event = "Audience Entered"',
|
|
10
10
|
fields: {
|
|
11
11
|
email: { ...properties_1.email },
|
|
12
|
+
phone_number: { ...properties_1.phone_number },
|
|
12
13
|
list_id: { ...properties_1.list_id },
|
|
13
14
|
external_id: { ...properties_1.external_id },
|
|
14
15
|
enable_batching: { ...properties_1.enable_batching },
|
|
@@ -22,15 +23,15 @@ const action = {
|
|
|
22
23
|
properties: { ...properties_1.properties }
|
|
23
24
|
},
|
|
24
25
|
perform: async (request, { payload }) => {
|
|
25
|
-
const { email, list_id, external_id, enable_batching, batch_size, ...additionalAttributes } = payload;
|
|
26
|
-
if (!email && !external_id) {
|
|
27
|
-
throw new actions_core_1.PayloadValidationError('One of
|
|
26
|
+
const { email, phone_number, list_id, external_id, enable_batching, batch_size, ...additionalAttributes } = payload;
|
|
27
|
+
if (!email && !external_id && !phone_number) {
|
|
28
|
+
throw new actions_core_1.PayloadValidationError('One of External ID, Phone Number and Email is required.');
|
|
28
29
|
}
|
|
29
|
-
const profileId = await functions_1.createProfile(request, email, external_id, additionalAttributes);
|
|
30
|
+
const profileId = await functions_1.createProfile(request, email, external_id, phone_number, additionalAttributes);
|
|
30
31
|
return await functions_1.addProfileToList(request, profileId, list_id);
|
|
31
32
|
},
|
|
32
33
|
performBatch: async (request, { payload }) => {
|
|
33
|
-
payload = payload.filter((profile) => profile.email || profile.external_id);
|
|
34
|
+
payload = payload.filter((profile) => profile.email || profile.external_id || profile.phone_number);
|
|
34
35
|
const listId = payload[0]?.list_id;
|
|
35
36
|
const importJobPayload = functions_1.createImportJobPayload(payload, listId);
|
|
36
37
|
return functions_1.sendImportJobRequest(request, importJobPayload);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/addProfileToList/index.ts"],"names":[],"mappings":";;AAAA,wDAAgF;AAGhF,4CAA4G;AAC5G,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/addProfileToList/index.ts"],"names":[],"mappings":";;AAAA,wDAAgF;AAGhF,4CAA4G;AAC5G,8CAcsB;AAEtB,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,8BAA8B;IACrC,WAAW,EAAE,qBAAqB;IAClC,mBAAmB,EAAE,4BAA4B;IACjD,MAAM,EAAE;QACN,KAAK,EAAE,EAAE,GAAG,kBAAK,EAAE;QACnB,YAAY,EAAE,EAAE,GAAG,yBAAY,EAAE;QACjC,OAAO,EAAE,EAAE,GAAG,oBAAO,EAAE;QACvB,WAAW,EAAE,EAAE,GAAG,wBAAW,EAAE;QAC/B,eAAe,EAAE,EAAE,GAAG,4BAAe,EAAE;QACvC,UAAU,EAAE,EAAE,GAAG,uBAAU,EAAE;QAC7B,UAAU,EAAE,EAAE,GAAG,uBAAU,EAAE;QAC7B,SAAS,EAAE,EAAE,GAAG,sBAAS,EAAE;QAC3B,KAAK,EAAE,EAAE,GAAG,kBAAK,EAAE;QACnB,KAAK,EAAE,EAAE,GAAG,kBAAK,EAAE;QACnB,YAAY,EAAE,EAAE,GAAG,yBAAY,EAAE;QACjC,QAAQ,EAAE,EAAE,GAAG,qBAAQ,EAAE;QACzB,UAAU,EAAE,EAAE,GAAG,uBAAU,EAAE;KAC9B;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACtC,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,GAAG,oBAAoB,EAAE,GAAG,OAAO,CAAA;QACnH,IAAI,CAAC,KAAK,IAAI,CAAC,WAAW,IAAI,CAAC,YAAY,EAAE;YAC3C,MAAM,IAAI,qCAAsB,CAAC,yDAAyD,CAAC,CAAA;SAC5F;QACD,MAAM,SAAS,GAAG,MAAM,yBAAa,CAAC,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,oBAAoB,CAAC,CAAA;QACtG,OAAO,MAAM,4BAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;IAC5D,CAAC;IACD,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAE3C,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,YAAY,CAAC,CAAA;QACnG,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAA;QAClC,MAAM,gBAAgB,GAAG,kCAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QAChE,OAAO,gCAAoB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAA;IACxD,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -5,7 +5,7 @@ import { Payload } from './upsertProfile/generated-types';
|
|
|
5
5
|
export declare function getListIdDynamicData(request: RequestClient): Promise<DynamicFieldResponse>;
|
|
6
6
|
export declare function addProfileToList(request: RequestClient, id: string, list_id: string | undefined): Promise<import("@segment/actions-core").ModifiedResponse<unknown>>;
|
|
7
7
|
export declare function removeProfileFromList(request: RequestClient, ids: string[], list_id: string): Promise<import("@segment/actions-core").ModifiedResponse<unknown>>;
|
|
8
|
-
export declare function createProfile(request: RequestClient, email: string | undefined, external_id: string | undefined, additionalAttributes: AdditionalAttributes): Promise<any>;
|
|
8
|
+
export declare function createProfile(request: RequestClient, email: string | undefined, external_id: string | undefined, phone_number: string | undefined, additionalAttributes: AdditionalAttributes): Promise<any>;
|
|
9
9
|
export declare function buildHeaders(authKey: string): {
|
|
10
10
|
Authorization: string;
|
|
11
11
|
Accept: string;
|
|
@@ -18,7 +18,7 @@ export declare const createImportJobPayload: (profiles: Payload[], listId?: stri
|
|
|
18
18
|
export declare const sendImportJobRequest: (request: RequestClient, importJobPayload: {
|
|
19
19
|
data: ImportJobPayload;
|
|
20
20
|
}) => Promise<import("@segment/actions-core").ModifiedResponse<unknown>>;
|
|
21
|
-
export declare function getProfiles(request: RequestClient, emails: string[] | undefined, external_ids: string[] | undefined): Promise<string[]>;
|
|
21
|
+
export declare function getProfiles(request: RequestClient, emails: string[] | undefined, external_ids: string[] | undefined, phoneNumbers: string[] | undefined): Promise<string[]>;
|
|
22
22
|
export declare function formatSubscribeProfile(email: string | undefined, phone_number: string | undefined, consented_at: string | number | undefined): SubscribeProfile;
|
|
23
23
|
export declare function formatSubscribeRequestBody(profiles: SubscribeProfile | SubscribeProfile[], list_id: string | undefined, custom_source: string | undefined): SubscribeEventData;
|
|
24
24
|
export declare function formatUnsubscribeRequestBody(profiles: UnsubscribeProfile | UnsubscribeProfile[], list_id: string | undefined): UnsubscribeEventData;
|
|
@@ -54,7 +54,7 @@ async function removeProfileFromList(request, ids, list_id) {
|
|
|
54
54
|
return response;
|
|
55
55
|
}
|
|
56
56
|
exports.removeProfileFromList = removeProfileFromList;
|
|
57
|
-
async function createProfile(request, email, external_id, additionalAttributes) {
|
|
57
|
+
async function createProfile(request, email, external_id, phone_number, additionalAttributes) {
|
|
58
58
|
try {
|
|
59
59
|
const profileData = {
|
|
60
60
|
data: {
|
|
@@ -62,6 +62,7 @@ async function createProfile(request, email, external_id, additionalAttributes)
|
|
|
62
62
|
attributes: {
|
|
63
63
|
email,
|
|
64
64
|
external_id,
|
|
65
|
+
phone_number,
|
|
65
66
|
...additionalAttributes
|
|
66
67
|
}
|
|
67
68
|
}
|
|
@@ -124,7 +125,7 @@ const sendImportJobRequest = async (request, importJobPayload) => {
|
|
|
124
125
|
});
|
|
125
126
|
};
|
|
126
127
|
exports.sendImportJobRequest = sendImportJobRequest;
|
|
127
|
-
async function getProfiles(request, emails, external_ids) {
|
|
128
|
+
async function getProfiles(request, emails, external_ids, phoneNumbers) {
|
|
128
129
|
const profileIds = [];
|
|
129
130
|
if (external_ids?.length) {
|
|
130
131
|
const filterId = `external_id,["${external_ids.join('","')}"]`;
|
|
@@ -142,6 +143,14 @@ async function getProfiles(request, emails, external_ids) {
|
|
|
142
143
|
const data = await response.json();
|
|
143
144
|
profileIds.push(...data.data.map((profile) => profile.id));
|
|
144
145
|
}
|
|
146
|
+
if (phoneNumbers?.length) {
|
|
147
|
+
const filterPhone = `phone_number,["${phoneNumbers.join('","')}"]`;
|
|
148
|
+
const response = await request(`${config_1.API_URL}/profiles/?filter=any(${filterPhone})`, {
|
|
149
|
+
method: 'GET'
|
|
150
|
+
});
|
|
151
|
+
const data = await response.json();
|
|
152
|
+
profileIds.push(...data.data.map((profile) => profile.id));
|
|
153
|
+
}
|
|
145
154
|
return Array.from(new Set(profileIds));
|
|
146
155
|
}
|
|
147
156
|
exports.getProfiles = getProfiles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/functions.ts"],"names":[],"mappings":";;;AAAA,wDAM8B;AAC9B,qCAAiD;AAmB1C,KAAK,UAAU,oBAAoB,CAAC,OAAsB;IAC/D,IAAI;QACF,MAAM,MAAM,GAAmB,MAAM,OAAO,CAAC,GAAG,gBAAO,SAAS,EAAE;YAChE,MAAM,EAAE,KAAK;SACd,CAAC,CAAA;QACF,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAkD,EAAE,EAAE;YACzG,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI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AAO,eAAe,CAAA;AACxB,CAAC;AATD,wDASC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.properties = exports.location = exports.image = exports.title = exports.organization = exports.last_name = exports.first_name = exports.batch_size = exports.enable_batching = exports.external_id = exports.email = exports.list_id = void 0;
|
|
3
|
+
exports.phone_number = exports.properties = exports.location = exports.image = exports.title = exports.organization = exports.last_name = exports.first_name = exports.batch_size = exports.enable_batching = exports.external_id = exports.email = exports.list_id = void 0;
|
|
4
4
|
exports.list_id = {
|
|
5
5
|
label: 'List Id',
|
|
6
6
|
description: `'Insert the ID of the default list that you'd like to subscribe users to when you call .identify().'`,
|
|
@@ -128,4 +128,10 @@ exports.properties = {
|
|
|
128
128
|
type: 'object',
|
|
129
129
|
default: { '@path': '$.properties.properties' }
|
|
130
130
|
};
|
|
131
|
+
exports.phone_number = {
|
|
132
|
+
label: 'Phone Number',
|
|
133
|
+
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.`,
|
|
134
|
+
type: 'string',
|
|
135
|
+
default: { '@path': '$.context.traits.phone' }
|
|
136
|
+
};
|
|
131
137
|
//# sourceMappingURL=properties.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/properties.ts"],"names":[],"mappings":";;;AAEa,QAAA,OAAO,GAAe;IACjC,KAAK,EAAE,SAAS;IAChB,WAAW,EAAE,sGAAsG;IACnH,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,yCAAyC;KACnD;IACD,aAAa,EAAE,IAAI;IACnB,QAAQ,EAAE,IAAI;CACf,CAAA;AAEY,QAAA,KAAK,GAAe;IAC/B,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,qCAAqC;IAClD,IAAI,EAAE,QAAQ;IACd,OAAO,EA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,UAAU,GAAe;IACpC,WAAW,EAAE,0FAA0F;IACvG,KAAK,EAAE,YAAY;IACnB,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,EAAE,OAAO,EAAE,yBAAyB,EAAE;CAChD,CAAA"}
|
|
1
|
+
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/properties.ts"],"names":[],"mappings":";;;AAEa,QAAA,OAAO,GAAe;IACjC,KAAK,EAAE,SAAS;IAChB,WAAW,EAAE,sGAAsG;IACnH,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,yCAAyC;KACnD;IACD,aAAa,EAAE,IAAI;IACnB,QAAQ,EAAE,IAAI;CACf,CAAA;AAEY,QAAA,KAAK,GAAe;IAC/B,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,qCAAqC;IAClD,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,wBAAwB;KAClC;CACF,CAAA;AAEY,QAAA,WAAW,GAAe;IACrC,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,iJAAiJ;IAC9J,IAAI,EAAE,QAAQ;CACf,CAAA;AAEY,QAAA,eAAe,GAAe;IACzC,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,uBAAuB;IAC9B,WAAW,EAAE,0DAA0D;IACvE,OAAO,EAAE,IAAI;CACd,CAAA;AAEY,QAAA,UAAU,GAAe;IACpC,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,qFAAqF;IAClG,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,KAAK;IACf,aAAa,EAAE,IAAI;IACnB,OAAO,EAAE,KAAK;CACf,CAAA;AAEY,QAAA,UAAU,GAAe;IACpC,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,0BAA0B;IACvC,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE;CAC/C,CAAA;AAEY,QAAA,SAAS,GAAe;IACnC,KA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AK,EAAE,UAAU;YACjB,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,IAAI;SAChB;QACD,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,IAAI;SAChB;QACD,OAAO,EAAE;YACP,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,IAAI;SAChB;KACF;IACD,OAAO,EAAE;QACP,IAAI,EAAE,EAAE,OAAO,EAAE,2BAA2B,EAAE;QAC9C,MAAM,EAAE,EAAE,OAAO,EAAE,4BAA4B,EAAE;QACjD,GAAG,EAAE,EAAE,OAAO,EAAE,kCAAkC,EAAE;QACpD,QAAQ,EAAE,EAAE,OAAO,EAAE,6BAA6B,EAAE;QACpD,OAAO,EAAE,EAAE,OAAO,EAAE,8BAA8B,EAAE;KACrD;CACF,CAAA;AAEY,QAAA,UAAU,GAAe;IACpC,WAAW,EAAE,0FAA0F;IACvG,KAAK,EAAE,YAAY;IACnB,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,EAAE,OAAO,EAAE,yBAAyB,EAAE;CAChD,CAAA;AAEY,QAAA,YAAY,GAAe;IACtC,KAAK,EAAE,cAAc;IACrB,WAAW,EAAE,mKAAmK;IAChL,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE;CAC/C,CAAA"}
|
|
@@ -27,7 +27,13 @@ const action = {
|
|
|
27
27
|
dynamic: true,
|
|
28
28
|
required: true
|
|
29
29
|
},
|
|
30
|
-
enable_batching: { ...properties_1.enable_batching }
|
|
30
|
+
enable_batching: { ...properties_1.enable_batching },
|
|
31
|
+
phone_number: {
|
|
32
|
+
label: 'Phone Number',
|
|
33
|
+
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.`,
|
|
34
|
+
type: 'string',
|
|
35
|
+
default: { '@path': '$.traits.phone' }
|
|
36
|
+
}
|
|
31
37
|
},
|
|
32
38
|
dynamicFields: {
|
|
33
39
|
list_id: async (request) => {
|
|
@@ -35,21 +41,24 @@ const action = {
|
|
|
35
41
|
}
|
|
36
42
|
},
|
|
37
43
|
perform: async (request, { payload }) => {
|
|
38
|
-
const { email, list_id, external_id } = payload;
|
|
39
|
-
if (!email && !external_id) {
|
|
40
|
-
throw new actions_core_1.PayloadValidationError('
|
|
44
|
+
const { email, list_id, external_id, phone_number } = payload;
|
|
45
|
+
if (!email && !external_id && !phone_number) {
|
|
46
|
+
throw new actions_core_1.PayloadValidationError('One of External ID, Phone Number and Email is required.');
|
|
41
47
|
}
|
|
42
|
-
const profileIds = await functions_1.getProfiles(request, email ? [email] : undefined, external_id ? [external_id] : undefined);
|
|
48
|
+
const profileIds = await functions_1.getProfiles(request, email ? [email] : undefined, external_id ? [external_id] : undefined, phone_number ? [phone_number] : undefined);
|
|
43
49
|
return await functions_1.removeProfileFromList(request, profileIds, list_id);
|
|
44
50
|
},
|
|
45
51
|
performBatch: async (request, { payload }) => {
|
|
46
|
-
const filteredPayload = payload.filter((profile) => profile.email || profile.external_id);
|
|
52
|
+
const filteredPayload = payload.filter((profile) => profile.email || profile.external_id || profile.phone_number);
|
|
47
53
|
const listId = filteredPayload[0]?.list_id;
|
|
48
54
|
const emails = filteredPayload.map((profile) => profile.email).filter((email) => email);
|
|
49
55
|
const externalIds = filteredPayload
|
|
50
56
|
.map((profile) => profile.external_id)
|
|
51
57
|
.filter((external_id) => external_id);
|
|
52
|
-
const
|
|
58
|
+
const phoneNumbers = filteredPayload
|
|
59
|
+
.map((profile) => profile.phone_number)
|
|
60
|
+
.filter((phone_number) => phone_number);
|
|
61
|
+
const profileIds = await functions_1.getProfiles(request, emails, externalIds, phoneNumbers);
|
|
53
62
|
return await functions_1.removeProfileFromList(request, profileIds, listId);
|
|
54
63
|
}
|
|
55
64
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/removeProfile/index.ts"],"names":[],"mappings":";;AAAA,wDAAsG;AAItG,4CAAuF;AACvF,8CAA+C;AAE/C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,0BAA0B;IACvC,mBAAmB,EAAE,oBAAoB;IACzC,MAAM,EAAE;QACN,KAAK,EAAE;YACL,KAAK,EAAE,OAAO;YACd,WAAW,EAAE,oEAAoE;YACjF,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,OAAO;YACf,OAAO,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;SACvC;QACD,WAAW,EAAE;YACX,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,+JAA+J;YAC5K,IAAI,EAAE,QAAQ;SACf;QACD,OAAO,EAAE;YACP,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,yCAAyC;YACtD,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;SACf;QACD,eAAe,EAAE,EAAE,GAAG,4BAAe,EAAE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/removeProfile/index.ts"],"names":[],"mappings":";;AAAA,wDAAsG;AAItG,4CAAuF;AACvF,8CAA+C;AAE/C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,0BAA0B;IACvC,mBAAmB,EAAE,oBAAoB;IACzC,MAAM,EAAE;QACN,KAAK,EAAE;YACL,KAAK,EAAE,OAAO;YACd,WAAW,EAAE,oEAAoE;YACjF,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,OAAO;YACf,OAAO,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;SACvC;QACD,WAAW,EAAE;YACX,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,+JAA+J;YAC5K,IAAI,EAAE,QAAQ;SACf;QACD,OAAO,EAAE;YACP,KAAK,EAAE,MAAM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AC,KAAK,IAAI,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,YAAY,CAAC,CAAA;QACjH,MAAM,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC,EAAE,OAAO,CAAA;QAC1C,MAAM,MAAM,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAa,CAAA;QACnG,MAAM,WAAW,GAAG,eAAe;aAChC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC;aACrC,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAa,CAAA;QACnD,MAAM,YAAY,GAAG,eAAe;aACjC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC;aACtC,MAAM,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAa,CAAA;QAErD,MAAM,UAAU,GAAG,MAAM,uBAAW,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,CAAC,CAAA;QAChF,OAAO,MAAM,iCAAqB,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,CAAA;IACjE,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -11,24 +11,28 @@ const action = {
|
|
|
11
11
|
email: { ...properties_1.email },
|
|
12
12
|
external_id: { ...properties_1.external_id },
|
|
13
13
|
list_id: { ...properties_1.list_id },
|
|
14
|
+
phone_number: { ...properties_1.phone_number },
|
|
14
15
|
enable_batching: { ...properties_1.enable_batching }
|
|
15
16
|
},
|
|
16
17
|
perform: async (request, { payload }) => {
|
|
17
|
-
const { email, list_id, external_id } = payload;
|
|
18
|
-
if (!email && !external_id) {
|
|
19
|
-
throw new actions_core_1.PayloadValidationError('
|
|
18
|
+
const { email, list_id, external_id, phone_number } = payload;
|
|
19
|
+
if (!email && !external_id && !phone_number) {
|
|
20
|
+
throw new actions_core_1.PayloadValidationError('One of External ID, Phone Number and Email is required.');
|
|
20
21
|
}
|
|
21
|
-
const profileIds = await functions_1.getProfiles(request, email ? [email] : undefined, external_id ? [external_id] : undefined);
|
|
22
|
+
const profileIds = await functions_1.getProfiles(request, email ? [email] : undefined, external_id ? [external_id] : undefined, phone_number ? [phone_number] : undefined);
|
|
22
23
|
return await functions_1.removeProfileFromList(request, profileIds, list_id);
|
|
23
24
|
},
|
|
24
25
|
performBatch: async (request, { payload }) => {
|
|
25
|
-
const filteredPayload = payload.filter((profile) => profile.email || profile.external_id);
|
|
26
|
+
const filteredPayload = payload.filter((profile) => profile.email || profile.external_id || profile.phone_number);
|
|
26
27
|
const listId = filteredPayload[0]?.list_id;
|
|
27
28
|
const emails = filteredPayload.map((profile) => profile.email).filter((email) => email);
|
|
28
29
|
const externalIds = filteredPayload
|
|
29
30
|
.map((profile) => profile.external_id)
|
|
30
31
|
.filter((external_id) => external_id);
|
|
31
|
-
const
|
|
32
|
+
const phoneNumbers = filteredPayload
|
|
33
|
+
.map((profile) => profile.phone_number)
|
|
34
|
+
.filter((phone_number) => phone_number);
|
|
35
|
+
const profileIds = await functions_1.getProfiles(request, emails, externalIds, phoneNumbers);
|
|
32
36
|
return await functions_1.removeProfileFromList(request, profileIds, listId);
|
|
33
37
|
}
|
|
34
38
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/removeProfileFromList/index.ts"],"names":[],"mappings":";;AAAA,wDAAgF;AAIhF,4CAAiE;AACjE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/removeProfileFromList/index.ts"],"names":[],"mappings":";;AAAA,wDAAgF;AAIhF,4CAAiE;AACjE,8CAA0F;AAE1F,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,mCAAmC;I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CAAA;QAC1C,MAAM,MAAM,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAa,CAAA;QACnG,MAAM,WAAW,GAAG,eAAe;aAChC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC;aACrC,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAa,CAAA;QACnD,MAAM,YAAY,GAAG,eAAe;aACjC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC;aACtC,MAAM,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAa,CAAA;QAErD,MAAM,UAAU,GAAG,MAAM,uBAAW,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,CAAC,CAAA;QAChF,OAAO,MAAM,iCAAqB,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,CAAA;IACjE,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.290.0-staging-
|
|
4
|
+
"version": "3.290.0-staging-7b9bf1814",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/segmentio/action-destinations",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,184 +0,0 @@
|
|
|
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
|