@segment/action-destinations 3.260.0-staging.2 → 3.260.1-staging.1
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/amazon-ads/generated-types.d.ts +9 -0
- package/dist/destinations/amazon-ads/index.d.ts +2 -2
- package/dist/destinations/amazon-ads/index.js +174 -3
- package/dist/destinations/amazon-ads/index.js.map +1 -1
- package/dist/destinations/amazon-ads/syncAudiences/generated-types.d.ts +19 -0
- package/dist/destinations/amazon-ads/syncAudiences/index.js +158 -7
- package/dist/destinations/amazon-ads/syncAudiences/index.js.map +1 -1
- package/dist/destinations/amazon-ads/utils.d.ts +25 -0
- package/dist/destinations/amazon-ads/utils.js +8 -0
- package/dist/destinations/amazon-ads/utils.js.map +1 -0
- package/dist/destinations/blackbaud-raisers-edge-nxt/utils/index.d.ts +1 -1
- package/dist/destinations/braze/index.js +1 -0
- package/dist/destinations/braze/index.js.map +1 -1
- package/dist/destinations/customerio/test-helper.d.ts +1 -1
- package/dist/destinations/customerio/utils.d.ts +1 -1
- package/dist/destinations/display-video-360/addToAudience/index.js +2 -1
- package/dist/destinations/display-video-360/addToAudience/index.js.map +1 -1
- package/dist/destinations/display-video-360/index.js +4 -2
- package/dist/destinations/display-video-360/index.js.map +1 -1
- package/dist/destinations/engage/utils/EngageActionPerformer.d.ts +1 -1
- package/dist/destinations/engage/utils/EngageActionPerformer.js +17 -1
- package/dist/destinations/engage/utils/EngageActionPerformer.js.map +1 -1
- package/dist/destinations/engage/utils/ResponseError.d.ts +1 -0
- package/dist/destinations/engage/utils/ResponseError.js.map +1 -1
- package/dist/destinations/engage/utils/operationTracking/OperationFinallyHooks.d.ts +3 -0
- package/dist/destinations/engage/utils/operationTracking/OperationFinallyHooks.js +15 -0
- package/dist/destinations/engage/utils/operationTracking/OperationFinallyHooks.js.map +1 -1
- package/dist/destinations/engage/utils/track.d.ts +20 -17
- package/dist/destinations/kafka/index.js +14 -7
- package/dist/destinations/kafka/index.js.map +1 -1
- package/dist/destinations/kafka/utils.d.ts +4 -0
- package/dist/destinations/kafka/utils.js +39 -1
- package/dist/destinations/kafka/utils.js.map +1 -1
- package/dist/destinations/klaviyo/index.js +3 -1
- package/dist/destinations/klaviyo/index.js.map +1 -1
- package/dist/destinations/klaviyo/orderCompleted/generated-types.d.ts +1 -4
- package/dist/destinations/klaviyo/orderCompleted/index.js +6 -15
- package/dist/destinations/klaviyo/orderCompleted/index.js.map +1 -1
- package/dist/destinations/klaviyo/removeProfile/generated-types.d.ts +6 -0
- package/dist/destinations/klaviyo/removeProfile/generated-types.js +3 -0
- package/dist/destinations/klaviyo/removeProfile/generated-types.js.map +1 -0
- package/dist/destinations/klaviyo/removeProfile/index.d.ts +5 -0
- package/dist/destinations/klaviyo/removeProfile/index.js +59 -0
- package/dist/destinations/klaviyo/removeProfile/index.js.map +1 -0
- package/dist/destinations/klaviyo/trackEvent/index.js +1 -0
- package/dist/destinations/klaviyo/trackEvent/index.js.map +1 -1
- package/dist/destinations/klaviyo/types.d.ts +3 -1
- package/dist/destinations/marketo-static-lists/addToList/index.js +4 -2
- package/dist/destinations/marketo-static-lists/addToList/index.js.map +1 -1
- package/dist/destinations/segment-profiles/segment-properties.d.ts +1 -0
- package/dist/destinations/segment-profiles/segment-properties.js +8 -1
- package/dist/destinations/segment-profiles/segment-properties.js.map +1 -1
- package/dist/destinations/segment-profiles/sendGroup/generated-types.d.ts +1 -0
- package/dist/destinations/segment-profiles/sendGroup/index.js +3 -1
- package/dist/destinations/segment-profiles/sendGroup/index.js.map +1 -1
- package/dist/destinations/segment-profiles/sendIdentify/generated-types.d.ts +1 -0
- package/dist/destinations/segment-profiles/sendIdentify/index.js +3 -1
- package/dist/destinations/segment-profiles/sendIdentify/index.js.map +1 -1
- package/dist/destinations/segment-profiles/sendSubscription/generated-types.d.ts +1 -0
- package/dist/destinations/segment-profiles/sendSubscription/index.js +3 -1
- package/dist/destinations/segment-profiles/sendSubscription/index.js.map +1 -1
- package/dist/destinations/segment-profiles/sendSubscription/subscription-properties.d.ts +1 -0
- package/dist/destinations/segment-profiles/sendSubscription/subscription-properties.js +8 -1
- package/dist/destinations/segment-profiles/sendSubscription/subscription-properties.js.map +1 -1
- package/dist/destinations/segment-profiles/sendTrack/generated-types.d.ts +1 -0
- package/dist/destinations/segment-profiles/sendTrack/index.js +3 -1
- package/dist/destinations/segment-profiles/sendTrack/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -17,6 +17,7 @@ const isDestinationActionService_1 = require("./isDestinationActionService");
|
|
|
17
17
|
const ResponseError_1 = require("./ResponseError");
|
|
18
18
|
const IntegrationErrorWrapper_1 = require("./IntegrationErrorWrapper");
|
|
19
19
|
const truncate_1 = __importDefault(require("lodash/truncate"));
|
|
20
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
20
21
|
class EngageActionPerformer {
|
|
21
22
|
constructor(requestClient, executeInput) {
|
|
22
23
|
this.requestClient = requestClient;
|
|
@@ -75,6 +76,20 @@ class EngageActionPerformer {
|
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
});
|
|
79
|
+
op?.onCatch.push(() => {
|
|
80
|
+
const respError = op?.error;
|
|
81
|
+
if (respError) {
|
|
82
|
+
const errorDetails = ResponseError_1.getErrorDetails(respError);
|
|
83
|
+
const msgLowercare = errorDetails?.message?.toLowerCase();
|
|
84
|
+
const isTimeoutErrorInOnCatch = msgLowercare?.includes('timeout') ||
|
|
85
|
+
msgLowercare?.includes('timedout') ||
|
|
86
|
+
msgLowercare?.includes('exceeded the deadline') ||
|
|
87
|
+
errorDetails.code?.toLowerCase().includes('etimedout');
|
|
88
|
+
if (isTimeoutErrorInOnCatch) {
|
|
89
|
+
op.error = new actions_core_1.RetryableError('Timeout error in onCatch');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
});
|
|
78
93
|
return await this.requestClient(url, options);
|
|
79
94
|
}
|
|
80
95
|
redactPii(pii) {
|
|
@@ -133,7 +148,8 @@ __decorate([
|
|
|
133
148
|
__decorate([
|
|
134
149
|
track_1.track({
|
|
135
150
|
onTry: addUrlToLog,
|
|
136
|
-
onFinally: addUrlToLog
|
|
151
|
+
onFinally: addUrlToLog,
|
|
152
|
+
onCatch: addUrlToLog
|
|
137
153
|
})
|
|
138
154
|
], EngageActionPerformer.prototype, "request", null);
|
|
139
155
|
exports.EngageActionPerformer = EngageActionPerformer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngageActionPerformer.js","sourceRoot":"","sources":["../../../../src/destinations/engage/utils/EngageActionPerformer.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,iDAA6C;AAC7C,+CAA2C;AAC3C,mCAAiD;AACjD,6EAAyE;AACzE,mDAAgE;AAGhE,uEAAmE;AAEnE,+DAAsC;
|
|
1
|
+
{"version":3,"file":"EngageActionPerformer.js","sourceRoot":"","sources":["../../../../src/destinations/engage/utils/EngageActionPerformer.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,iDAA6C;AAC7C,+CAA2C;AAC3C,mCAAiD;AACjD,6EAAyE;AACzE,mDAAgE;AAGhE,uEAAmE;AAEnE,+DAAsC;AACtC,wDAAsD;AAKtD,MAAsB,qBAAqB;IASzC,YAAqB,aAA4B,EAAW,YAA+C;QAAtF,kBAAa,GAAb,aAAa,CAAe;QAAW,iBAAY,GAAZ,YAAY,CAAmC;QARlG,WAAM,GAAiB,IAAI,2BAAY,CAAC,IAAI,CAAC,CAAA;QAC7C,gBAAW,GAAgB,IAAI,yBAAW,CAAC,IAAI,CAAC,CAAA;QAChD,kBAAa,GAAG,IAAI,CAAC,YAAY,CAAC,aAAa,CAAA;QAOtD,IAAI,CAAC,OAAO,GAAG,YAAY,CAAC,OAAO,CAAA;QACnC,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAA;IACvC,CAAC;IAKD,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,aAAa,EAAE,EAAE,CAAA;QAC5B,OAAO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W;QACtB,OAAO,EAAE,WAAW;KACrB,CAAC;oDAmED;AAxGH,sDA2KC;AAED,SAAS,WAAW,CAAC,GAAQ;IAE3B,MAAM,OAAO,GAAG,GAAuB,CAAA;IACvC,MAAM,MAAM,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAA;IAChC,IAAI,OAAO,CAAC,IAAI,IAAI,MAAM,EAAE;QAC1B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAQ,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;KACpD;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponseError.js","sourceRoot":"","sources":["../../../../src/destinations/engage/utils/ResponseError.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ResponseError.js","sourceRoot":"","sources":["../../../../src/destinations/engage/utils/ResponseError.ts"],"names":[],"mappings":";;;AA4BA,SAAgB,eAAe,CAAC,KAAU;IAGxC,MAAM,SAAS,GAAG,KAAsB,CAAA;IAGxC,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,IAAI,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAA;IAI7D,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,IAAI,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAA;IAE7D,MAAM,OAAO,GAAG;QACd,SAAS,CAAC,IAAI,IAAI,SAAS,CAAC,WAAW,EAAE,IAAI;QAC7C,SAAS,CAAC,OAAO;QACjB,SAAS,CAAC,QAAQ,EAAE,UAAU,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,UAAU,CAAC;YAC3F,CAAC,CAAC,SAAS,CAAC,QAAQ,EAAE,UAAU;YAChC,CAAC,CAAC,SAAS;QAGb,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO;QAClC,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO;KAChD;SACE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,IAAI,CAAC,CAAA;IACb,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAA;AACpD,CAAC;AA1BD,0CA0BC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { TryCatchFinallyContext, TryCatchFinallyHook } from './wrapTryCatchFinallyPromisable';
|
|
2
2
|
export declare type OperationFinallyHooksContext<TContext extends TryCatchFinallyContext = TryCatchFinallyContext> = TContext & {
|
|
3
3
|
onFinally: (() => void)[];
|
|
4
|
+
onCatch: (() => void)[];
|
|
4
5
|
decoratorArgs?: {
|
|
5
6
|
onTry?: (ctx: TContext) => void;
|
|
6
7
|
onFinally?: (ctx: TContext) => void;
|
|
8
|
+
onCatch?: (ctx: TContext) => void;
|
|
7
9
|
};
|
|
8
10
|
};
|
|
9
11
|
export declare class OperationFinallyHooks {
|
|
@@ -11,4 +13,5 @@ export declare class OperationFinallyHooks {
|
|
|
11
13
|
static getPriority(): number;
|
|
12
14
|
static onTry<TContext extends TryCatchFinallyContext>(ctx: OperationFinallyHooksContext<TContext>): void;
|
|
13
15
|
static onFinally<TContext extends TryCatchFinallyContext>(ctx: OperationFinallyHooksContext<TContext>): void;
|
|
16
|
+
static onCatch<TContext extends TryCatchFinallyContext>(ctx: OperationFinallyHooksContext<TContext>): void;
|
|
14
17
|
}
|
|
@@ -10,6 +10,7 @@ class OperationFinallyHooks {
|
|
|
10
10
|
}
|
|
11
11
|
static onTry(ctx) {
|
|
12
12
|
ctx.onFinally = [];
|
|
13
|
+
ctx.onCatch = [];
|
|
13
14
|
ctx.decoratorArgs?.onTry?.(ctx);
|
|
14
15
|
}
|
|
15
16
|
static onFinally(ctx) {
|
|
@@ -26,6 +27,20 @@ class OperationFinallyHooks {
|
|
|
26
27
|
}
|
|
27
28
|
ctx.decoratorArgs?.onFinally?.(ctx);
|
|
28
29
|
}
|
|
30
|
+
static onCatch(ctx) {
|
|
31
|
+
for (const hook of ctx.onCatch) {
|
|
32
|
+
try {
|
|
33
|
+
hook();
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
const error = e;
|
|
37
|
+
const loggerCtx = ctx;
|
|
38
|
+
if (loggerCtx.logs)
|
|
39
|
+
loggerCtx.logs.push(`Error in onCatch hook: ${error?.message || error.toString()}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
ctx.decoratorArgs?.onFinally?.(ctx);
|
|
43
|
+
}
|
|
29
44
|
}
|
|
30
45
|
exports.OperationFinallyHooks = OperationFinallyHooks;
|
|
31
46
|
//# sourceMappingURL=OperationFinallyHooks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationFinallyHooks.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/utils/operationTracking/OperationFinallyHooks.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"OperationFinallyHooks.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/utils/operationTracking/OperationFinallyHooks.ts"],"names":[],"mappings":";;;AAiBA,MAAa,qBAAqB;IAChC,MAAM,CAAC,sBAAsB,CAAC,IAAkC;QAC9D,OAAO,IAAI,CAAA;IACb,CAAC;IACD,MAAM,CAAC,WAAW;QAChB,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,MAAM,CAAC,KAAK,CAA0C,GAA2C;QAC/F,GAAG,CAAC,SAAS,GAAG,EAAE,CAAA;QAClB,GAAG,CAAC,OAAO,GAAG,EAAE,CAAA;QAChB,GAAG,CAAC,aAAa,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAAA;IACjC,CAAC;IAED,MAAM,CAAC,SAAS,CAA0C,GAA2C;QACnG,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,SAAS,EAAE;YAChC,IAAI;gBACF,IAAI,EAAE,CAAA;aACP;YAAC,OAAO,CAAC,EAAE;gBACV,MAAM,KAAK,GAAG,CAAU,CAAA;gBAExB,MAAM,SAAS,GAAG,GAAsC,CAAA;gBACxD,IAAI,SAAS,CAAC,IAAI;oBAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,4BAA4B,KAAK,EAAE,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;aAC1G;SACF;QACD,GAAG,CAAC,aAAa,EAAE,SAAS,EAAE,CAAC,GAAG,CAAC,CAAA;IACrC,CAAC;IACD,MAAM,CAAC,OAAO,CAA0C,GAA2C;QACjG,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,OAAO,EAAE;YAC9B,IAAI;gBACF,IAAI,EAAE,CAAA;aACP;YAAC,OAAO,CAAC,EAAE;gBACV,MAAM,KAAK,GAAG,CAAU,CAAA;gBAExB,MAAM,SAAS,GAAG,GAAsC,CAAA;gBACxD,IAAI,SAAS,CAAC,IAAI;oBAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,0BAA0B,KAAK,EAAE,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;aACxG;SACF;QACD,GAAG,CAAC,aAAa,EAAE,SAAS,EAAE,CAAC,GAAG,CAAC,CAAA;IACrC,CAAC;CACF;AAxCD,sDAwCC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
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
|
+
} & import("./operationTracking").OperationLoggerDecoratorArgs & {
|
|
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
|
+
onCatch?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
|
|
8
|
+
} & {
|
|
9
|
+
shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
|
|
10
|
+
} & {
|
|
10
11
|
wrapIntegrationError?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => import("@segment/actions-core/*").IntegrationError | [message: string, code: string, status: number]) | undefined;
|
|
11
12
|
}) | undefined) => import("./operationTracking").GenericMethodDecorator<(this: any, ...args: any[]) => any>) & {
|
|
12
13
|
getCurrentOperation(classInstance: any): (import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & {
|
|
@@ -15,13 +16,8 @@ export declare const track: ((decoratorArgs?: ({
|
|
|
15
16
|
}) | undefined;
|
|
16
17
|
} & {
|
|
17
18
|
_contextType: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
tags: string[];
|
|
21
|
-
};
|
|
22
|
-
decoratorArgs?: {
|
|
23
|
-
shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
|
|
24
|
-
} | undefined;
|
|
19
|
+
start?: number | undefined;
|
|
20
|
+
duration?: number | undefined;
|
|
25
21
|
} & {
|
|
26
22
|
decoratorArgs?: {
|
|
27
23
|
onError?: ((ctx: import("./operationTracking").OperationErrorHandlerContext<import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>>) => void) | undefined;
|
|
@@ -30,19 +26,26 @@ export declare const track: ((decoratorArgs?: ({
|
|
|
30
26
|
parent?: (import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & any) | undefined;
|
|
31
27
|
sharedContext: {};
|
|
32
28
|
} & {
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
logs: string[];
|
|
30
|
+
logMetadata?: Record<string, unknown> | undefined;
|
|
31
|
+
decoratorArgs?: import("./operationTracking").OperationLoggerDecoratorArgs | undefined;
|
|
32
|
+
sharedContext: import("./operationTracking").OperationLoggerSharedContext;
|
|
35
33
|
} & {
|
|
36
34
|
onFinally: (() => void)[];
|
|
35
|
+
onCatch: (() => void)[];
|
|
37
36
|
decoratorArgs?: {
|
|
38
37
|
onTry?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
|
|
39
38
|
onFinally?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
|
|
39
|
+
onCatch?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
|
|
40
40
|
} | undefined;
|
|
41
41
|
} & {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
tags: string[];
|
|
43
|
+
sharedContext: {
|
|
44
|
+
tags: string[];
|
|
45
|
+
};
|
|
46
|
+
decoratorArgs?: {
|
|
47
|
+
shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
|
|
48
|
+
} | undefined;
|
|
46
49
|
} & {
|
|
47
50
|
decoratorArgs?: {
|
|
48
51
|
wrapIntegrationError?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => import("@segment/actions-core/*").IntegrationError | [message: string, code: string, status: number]) | undefined;
|
|
@@ -44,31 +44,36 @@ const destination = {
|
|
|
44
44
|
label: 'Username',
|
|
45
45
|
description: 'The username for your Kafka instance. Should be populated only if using PLAIN or SCRAM Authentication Mechanisms.',
|
|
46
46
|
type: 'string',
|
|
47
|
-
required: false
|
|
47
|
+
required: false,
|
|
48
|
+
depends_on: utils_1.DEPENDS_ON_PLAIN_OR_SCRAM
|
|
48
49
|
},
|
|
49
50
|
password: {
|
|
50
51
|
label: 'Password',
|
|
51
52
|
description: 'The password for your Kafka instance. Should only be populated if using PLAIN or SCRAM Authentication Mechanisms.',
|
|
52
53
|
type: 'password',
|
|
53
|
-
required: false
|
|
54
|
+
required: false,
|
|
55
|
+
depends_on: utils_1.DEPENDS_ON_PLAIN_OR_SCRAM
|
|
54
56
|
},
|
|
55
57
|
accessKeyId: {
|
|
56
58
|
label: 'AWS Access Key ID',
|
|
57
59
|
description: 'The Access Key ID for your AWS IAM instance. Must be populated if using AWS IAM Authentication Mechanism.',
|
|
58
60
|
type: 'string',
|
|
59
|
-
required: false
|
|
61
|
+
required: false,
|
|
62
|
+
depends_on: utils_1.DEPEONDS_ON_AWS
|
|
60
63
|
},
|
|
61
64
|
secretAccessKey: {
|
|
62
65
|
label: 'AWS Secret Key',
|
|
63
66
|
description: 'The Secret Key for your AWS IAM instance. Must be populated if using AWS IAM Authentication Mechanism.',
|
|
64
67
|
type: 'password',
|
|
65
|
-
required: false
|
|
68
|
+
required: false,
|
|
69
|
+
depends_on: utils_1.DEPEONDS_ON_AWS
|
|
66
70
|
},
|
|
67
71
|
authorizationIdentity: {
|
|
68
72
|
label: 'AWS Authorization Identity',
|
|
69
73
|
description: 'AWS IAM role ARN used for authorization. This field is optional, and should only be populated if using the AWS IAM Authentication Mechanism.',
|
|
70
74
|
type: 'string',
|
|
71
|
-
required: false
|
|
75
|
+
required: false,
|
|
76
|
+
depends_on: utils_1.DEPEONDS_ON_AWS
|
|
72
77
|
},
|
|
73
78
|
ssl_enabled: {
|
|
74
79
|
label: 'SSL Enabled',
|
|
@@ -87,13 +92,15 @@ const destination = {
|
|
|
87
92
|
label: 'SSL Client Key',
|
|
88
93
|
description: 'The Client Key for your Kafka instance. Exclude the first and last lines from the file. i.e `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----`.',
|
|
89
94
|
type: 'string',
|
|
90
|
-
required: false
|
|
95
|
+
required: false,
|
|
96
|
+
depends_on: utils_1.DEPENDS_ON_CLIENT_CERT
|
|
91
97
|
},
|
|
92
98
|
ssl_cert: {
|
|
93
99
|
label: 'SSL Client Certificate',
|
|
94
100
|
description: 'The Certificate Authority for your Kafka instance. Exclude the first and last lines from the file. i.e `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----`.',
|
|
95
101
|
type: 'string',
|
|
96
|
-
required: false
|
|
102
|
+
required: false,
|
|
103
|
+
depends_on: utils_1.DEPENDS_ON_CLIENT_CERT
|
|
97
104
|
},
|
|
98
105
|
ssl_reject_unauthorized_ca: {
|
|
99
106
|
label: 'SSL - Reject Unauthorized Certificate Authority',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/kafka/index.ts"],"names":[],"mappings":";;;;;AAEA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/kafka/index.ts"],"names":[],"mappings":";;;;;AAEA,mCAAiH;AACjH,kDAAyB;AAEzB,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,4BAA4B;IACzC,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,QAAQ,EAAE;gBACR,KAAK,EAAE,WAAW;gBAClB,WAAW,EAAE,sFAAsF;gBACnG,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,gCAAgC;aAC1C;YACD,OAAO,EAAE;gBACP,KAAK,EAAE,SAAS;gBAChB,WAAW,EACT,2HAA2H;gBAC7H,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,SAAS,EAAE;gBACT,KAAK,EAAE,0BAA0B;gBACjC,WAAW,EACT,sRAAsR;gBACxR,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pB,WAAW,EAAE,qCAAqC;gBAClD,IAAI,EAAE,SAAS;gBACf,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,IAAI;aACd;YACD,MAAM,EAAE;gBACN,KAAK,EAAE,2BAA2B;gBAClC,WAAW,EACT,uKAAuK;gBACzK,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,KAAK;aAChB;YACD,OAAO,EAAE;gBACP,KAAK,EAAE,gBAAgB;gBACvB,WAAW,EACT,4JAA4J;gBAC9J,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,KAAK;gBACf,UAAU,EAAE,8BAAsB;aACnC;YACD,QAAQ,EAAE;gBACR,KAAK,EAAE,wBAAwB;gBAC/B,WAAW,EACT,uKAAuK;gBACzK,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,KAAK;gBACf,UAAU,EAAE,8BAAsB;aACnC;YACD,0BAA0B,EAAE;gBAC1B,KAAK,EAAE,iDAAiD;gBACxD,WAAW,EACT,6GAA6G;gBAC/G,IAAI,EAAE,SAAS;gBACf,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,IAAI;aACd;SACF;QACD,kBAAkB,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;YAC5C,gBAAQ,CAAC,QAAQ,CAAC,CAAA;YAClB,OAAO,MAAM,iBAAS,CAAC,QAAQ,CAAC,CAAA;QAClC,CAAC;KACF;IACD,OAAO,EAAE;QACP,IAAI,EAAJ,cAAI;KACL;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { DynamicFieldResponse } from '@segment/actions-core';
|
|
2
2
|
import type { Settings } from './generated-types';
|
|
3
3
|
import type { Payload } from './send/generated-types';
|
|
4
|
+
import { DependsOnConditions } from '@segment/actions-core/destination-kittypes';
|
|
4
5
|
export declare const DEFAULT_PARTITIONER = "DefaultPartitioner";
|
|
6
|
+
export declare const DEPENDS_ON_PLAIN_OR_SCRAM: DependsOnConditions;
|
|
7
|
+
export declare const DEPEONDS_ON_AWS: DependsOnConditions;
|
|
8
|
+
export declare const DEPENDS_ON_CLIENT_CERT: DependsOnConditions;
|
|
5
9
|
export declare const getTopics: (settings: Settings) => Promise<DynamicFieldResponse>;
|
|
6
10
|
export declare const validate: (settings: Settings) => void;
|
|
7
11
|
export declare const sendData: (settings: Settings, payload: Payload[]) => Promise<void>;
|
|
@@ -1,9 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sendData = exports.validate = exports.getTopics = exports.DEFAULT_PARTITIONER = void 0;
|
|
3
|
+
exports.sendData = exports.validate = exports.getTopics = exports.DEPENDS_ON_CLIENT_CERT = exports.DEPEONDS_ON_AWS = exports.DEPENDS_ON_PLAIN_OR_SCRAM = exports.DEFAULT_PARTITIONER = void 0;
|
|
4
4
|
const kafkajs_1 = require("kafkajs");
|
|
5
5
|
const actions_core_1 = require("@segment/actions-core");
|
|
6
6
|
exports.DEFAULT_PARTITIONER = 'DefaultPartitioner';
|
|
7
|
+
exports.DEPENDS_ON_PLAIN_OR_SCRAM = {
|
|
8
|
+
match: 'any',
|
|
9
|
+
conditions: [
|
|
10
|
+
{
|
|
11
|
+
fieldKey: 'mechanism',
|
|
12
|
+
operator: 'is',
|
|
13
|
+
value: 'plain'
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
fieldKey: 'mechanism',
|
|
17
|
+
operator: 'is',
|
|
18
|
+
value: 'scram-sha-256'
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
fieldKey: 'mechanism',
|
|
22
|
+
operator: 'is',
|
|
23
|
+
value: 'scram-sha-512'
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
};
|
|
27
|
+
exports.DEPEONDS_ON_AWS = {
|
|
28
|
+
conditions: [
|
|
29
|
+
{
|
|
30
|
+
fieldKey: 'mechanism',
|
|
31
|
+
operator: 'is',
|
|
32
|
+
value: 'aws'
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
};
|
|
36
|
+
exports.DEPENDS_ON_CLIENT_CERT = {
|
|
37
|
+
conditions: [
|
|
38
|
+
{
|
|
39
|
+
fieldKey: 'mechanism',
|
|
40
|
+
operator: 'is',
|
|
41
|
+
value: 'client-cert-auth'
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
};
|
|
7
45
|
const getTopics = async (settings) => {
|
|
8
46
|
const kafka = getKafka(settings);
|
|
9
47
|
const admin = kafka.admin();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/destinations/kafka/utils.ts"],"names":[],"mappings":";;;AAAA,qCAAqG;AACrG,wDAA8E;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/destinations/kafka/utils.ts"],"names":[],"mappings":";;;AAAA,qCAAqG;AACrG,wDAA8E;AAKjE,QAAA,mBAAmB,GAAG,oBAAoB,CAAA;AAE1C,QAAA,yBAAyB,GAAwB;IAC5D,KAAK,EAAE,KAAK;IACZ,UAAU,EAAE;QACV;YACE,QAAQ,EAAE,WAAW;YACrB,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,OAAO;SACf;QACD;YACE,QAAQ,EAAE,WAAW;YACrB,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,eAAe;SACvB;QACD;YACE,QAAQ,EAAE,WAAW;YACrB,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,eAAe;SACvB;KACF;CACF,CAAA;AACY,QAAA,eAAe,GAAwB;IAClD,UAAU,EAAE;QACV;YACE,QAAQ,EAAE,WAAW;YACrB,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,KAAK;SACb;KACF;CACF,CAAA;AACY,QAAA,sBAAsB,GAAwB;IACzD,UAAU,EAAE;QACV;YACE,QAAQ,EAAE,WAAW;YACrB,QAAQ,EAAE,IAAI;YACd,KAAK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fileFromList
|
|
|
11
11
|
const trackEvent_1 = __importDefault(require("./trackEvent"));
|
|
12
12
|
const orderCompleted_1 = __importDefault(require("./orderCompleted"));
|
|
13
13
|
const functions_1 = require("./functions");
|
|
14
|
+
const removeProfile_1 = __importDefault(require("./removeProfile"));
|
|
14
15
|
const destination = {
|
|
15
16
|
name: 'Klaviyo (Actions)',
|
|
16
17
|
slug: 'actions-klaviyo',
|
|
@@ -109,7 +110,8 @@ const destination = {
|
|
|
109
110
|
addProfileToList: addProfileToList_1.default,
|
|
110
111
|
removeProfileFromList: removeProfileFromList_1.default,
|
|
111
112
|
trackEvent: trackEvent_1.default,
|
|
112
|
-
orderCompleted: orderCompleted_1.default
|
|
113
|
+
orderCompleted: orderCompleted_1.default,
|
|
114
|
+
removeProfile: removeProfile_1.default
|
|
113
115
|
}
|
|
114
116
|
};
|
|
115
117
|
exports.default = destination;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAK8B;AAG9B,qCAAkC;AAClC,oEAA2C;AAC3C,0EAAiD;AACjD,oFAA2D;AAC3D,8DAAqC;AACrC,sEAA6C;AAC7C,2CAA0C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAK8B;AAG9B,qCAAkC;AAClC,oEAA2C;AAC3C,0EAAiD;AACjD,oFAA2D;AAC3D,8DAAqC;AACrC,sEAA6C;AAC7C,2CAA0C;AAC1C,oEAA2C;AAE3C,MAAM,WAAW,GAA4C;IAC3D,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,UAAU;gBAChB,KAAK,EAAE,SAA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kG,EAClG,sBAAsB,EACtB,GAAG,CACJ,CAAA;aACF;YAED,OAAO;gBACL,UAAU;aACX,CAAA;QACH,CAAC;KACF;IACD,OAAO,EAAE;QACP,aAAa,EAAb,uBAAa;QACb,gBAAgB,EAAhB,0BAAgB;QAChB,qBAAqB,EAArB,+BAAqB;QACrB,UAAU,EAAV,oBAAU;QACV,cAAc,EAAd,wBAAc;QACd,aAAa,EAAb,uBAAa;KACd;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const actions_core_1 = require("@segment/actions-core");
|
|
4
4
|
const config_1 = require("../config");
|
|
5
|
+
const uuid_1 = require("@lukeed/uuid");
|
|
5
6
|
const createEventData = (payload) => ({
|
|
6
7
|
data: {
|
|
7
8
|
type: 'event',
|
|
@@ -9,6 +10,7 @@ const createEventData = (payload) => ({
|
|
|
9
10
|
properties: { ...payload.properties },
|
|
10
11
|
time: payload.time,
|
|
11
12
|
value: payload.value,
|
|
13
|
+
unique_id: payload.unique_id,
|
|
12
14
|
metric: {
|
|
13
15
|
data: {
|
|
14
16
|
type: 'metric',
|
|
@@ -32,13 +34,14 @@ const sendProductRequests = async (payload, orderEventData, request) => {
|
|
|
32
34
|
if (!payload.products || !Array.isArray(payload.products)) {
|
|
33
35
|
return;
|
|
34
36
|
}
|
|
37
|
+
delete orderEventData.data.attributes.properties?.products;
|
|
35
38
|
const productPromises = payload.products.map((product) => {
|
|
36
39
|
const productEventData = {
|
|
37
40
|
data: {
|
|
38
41
|
type: 'event',
|
|
39
42
|
attributes: {
|
|
40
|
-
properties: { ...product
|
|
41
|
-
|
|
43
|
+
properties: { ...product, ...orderEventData.data.attributes.properties },
|
|
44
|
+
unique_id: uuid_1.v4(),
|
|
42
45
|
metric: {
|
|
43
46
|
data: {
|
|
44
47
|
type: 'metric',
|
|
@@ -125,19 +128,7 @@ const action = {
|
|
|
125
128
|
label: 'Products',
|
|
126
129
|
description: 'List of products purchased in the order.',
|
|
127
130
|
multiple: true,
|
|
128
|
-
type: 'object'
|
|
129
|
-
properties: {
|
|
130
|
-
value: {
|
|
131
|
-
label: 'Value',
|
|
132
|
-
description: 'A numeric value to associate with this event. For example, the dollar amount of a purchase.',
|
|
133
|
-
type: 'number'
|
|
134
|
-
},
|
|
135
|
-
properties: {
|
|
136
|
-
description: `Properties of this event.`,
|
|
137
|
-
label: 'Properties',
|
|
138
|
-
type: 'object'
|
|
139
|
-
}
|
|
140
|
-
}
|
|
131
|
+
type: 'object'
|
|
141
132
|
}
|
|
142
133
|
},
|
|
143
134
|
perform: async (request, { payload }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/orderCompleted/index.ts"],"names":[],"mappings":";;AAGA,wDAA6E;AAC7E,sCAAmC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/orderCompleted/index.ts"],"names":[],"mappings":";;AAGA,wDAA6E;AAC7E,sCAAmC;AAEnC,uCAA2C;AAE3C,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,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,MAAM,EAAE;gBACN,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,IAAI,EAAE,iBAAiB;qBACxB;iBACF;aACF;YACD,OAAO,EAAE;gBACP,IAAI,EAAE;oBACJ,IAAI,EAAE,SAAS;oBACf,UAAU,EAAE;wBACV,GAAG,OAAO,CAAC,OAAO;qBACnB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AE;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 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/removeProfile/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,59 @@
|
|
|
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',
|
|
8
|
+
description: 'Remove profile from list',
|
|
9
|
+
defaultSubscription: 'event = "Identify"',
|
|
10
|
+
fields: {
|
|
11
|
+
email: {
|
|
12
|
+
label: 'Email',
|
|
13
|
+
description: `Individual's email address. One of External ID, or Email required.`,
|
|
14
|
+
type: 'string',
|
|
15
|
+
format: 'email',
|
|
16
|
+
default: { '@path': '$.traits.email' }
|
|
17
|
+
},
|
|
18
|
+
external_id: {
|
|
19
|
+
label: 'External ID',
|
|
20
|
+
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.`,
|
|
21
|
+
type: 'string'
|
|
22
|
+
},
|
|
23
|
+
list_id: {
|
|
24
|
+
label: 'List',
|
|
25
|
+
description: `The Klaviyo list to add the profile to.`,
|
|
26
|
+
type: 'string',
|
|
27
|
+
dynamic: true,
|
|
28
|
+
required: true
|
|
29
|
+
},
|
|
30
|
+
enable_batching: { ...properties_1.enable_batching }
|
|
31
|
+
},
|
|
32
|
+
dynamicFields: {
|
|
33
|
+
list_id: async (request) => {
|
|
34
|
+
return functions_1.getListIdDynamicData(request);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
perform: async (request, { payload }) => {
|
|
38
|
+
console.log('Remove perform');
|
|
39
|
+
const { email, list_id, external_id } = payload;
|
|
40
|
+
if (!email && !external_id) {
|
|
41
|
+
throw new actions_core_1.PayloadValidationError('Missing Email or External Id');
|
|
42
|
+
}
|
|
43
|
+
const profileIds = await functions_1.getProfiles(request, email ? [email] : undefined, external_id ? [external_id] : undefined);
|
|
44
|
+
return await functions_1.removeProfileFromList(request, profileIds, list_id);
|
|
45
|
+
},
|
|
46
|
+
performBatch: async (request, { payload }) => {
|
|
47
|
+
console.log('Remove perform Batch');
|
|
48
|
+
const filteredPayload = payload.filter((profile) => profile.email || profile.external_id);
|
|
49
|
+
const listId = filteredPayload[0]?.list_id;
|
|
50
|
+
const emails = filteredPayload.map((profile) => profile.email).filter((email) => email);
|
|
51
|
+
const externalIds = filteredPayload
|
|
52
|
+
.map((profile) => profile.external_id)
|
|
53
|
+
.filter((external_id) => external_id);
|
|
54
|
+
const profileIds = await functions_1.getProfiles(request, emails, externalIds);
|
|
55
|
+
return await functions_1.removeProfileFromList(request, profileIds, listId);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
exports.default = action;
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/removeProfile/index.ts"],"names":[],"mappings":";;AAAA,wDAAsG;AA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CAAA;QAE/C,IAAI,CAAC,KAAK,IAAI,CAAC,YAAY,EAAE;YAC3B,MAAM,IAAI,qCAAsB,CAAC,2CAA2C,CAAC,CAAA;SAC9E;QAED,MAAM,SAAS,GAAG;YAChB,IAAI,EAAE;gBACJ,IAAI,EAAE,OAAO;gBACb,UAAU,EAAE;oBACV,UAAU,EAAE,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE;oBACrC,IAAI,EAAE,OAAO,CAAC,IAAI;oBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;oBACpB,MAAM,EAAE;wBACN,IAAI,EAAE;4BACJ,IAAI,EAAE,QAAQ;4BACd,UAAU,EAAE;gCACV,IAAI,EAAE,OAAO,CAAC,WAAW;6BAC1B;yBACF;qBACF;oBACD,OAAO,EAAE;wBACP,IAAI,EAAE;4BACJ,IAAI,EAAE,SAAS;4BACf,UAAU,EAAE;gCACV,GAAG,OAAO,CAAC,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"}
|
|
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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