@segment/action-destinations 3.227.1 → 3.227.2-staging.8
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/engage/utils/track.d.ts +17 -17
- package/dist/destinations/google-enhanced-conversions/functions.d.ts +1 -1
- package/dist/destinations/google-enhanced-conversions/functions.js +1 -1
- package/dist/destinations/google-enhanced-conversions/functions.js.map +1 -1
- package/dist/destinations/klaviyo/addProfileToList/generated-types.d.ts +5 -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 +61 -0
- package/dist/destinations/klaviyo/addProfileToList/index.js.map +1 -0
- package/dist/destinations/klaviyo/functions.d.ts +4 -0
- package/dist/destinations/klaviyo/functions.js +48 -0
- package/dist/destinations/klaviyo/functions.js.map +1 -0
- package/dist/destinations/klaviyo/properties.d.ts +4 -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 +5 -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 +62 -0
- package/dist/destinations/klaviyo/removeProfileToList/index.js.map +1 -0
- package/dist/destinations/marketo-static-lists/constants.d.ts +21 -0
- package/dist/destinations/marketo-static-lists/constants.js +16 -0
- package/dist/destinations/marketo-static-lists/constants.js.map +1 -0
- package/dist/destinations/marketo-static-lists/generated-types.d.ts +4 -0
- package/dist/destinations/marketo-static-lists/index.js +96 -1
- package/dist/destinations/marketo-static-lists/index.js.map +1 -1
- 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/webhook-audiences/index.js +2 -1
- package/dist/destinations/webhook-audiences/index.js.map +1 -1
- package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.d.ts +4 -0
- package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.js +3 -0
- package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.js.map +1 -0
- package/dist/destinations/yahoo-audiences/createCustomerNode/index.d.ts +5 -0
- package/dist/destinations/yahoo-audiences/createCustomerNode/index.js +33 -0
- package/dist/destinations/yahoo-audiences/createCustomerNode/index.js.map +1 -0
- package/dist/destinations/yahoo-audiences/createSegment/generated-types.d.ts +6 -0
- package/dist/destinations/yahoo-audiences/createSegment/generated-types.js +3 -0
- package/dist/destinations/yahoo-audiences/createSegment/generated-types.js.map +1 -0
- package/dist/destinations/yahoo-audiences/createSegment/index.d.ts +5 -0
- package/dist/destinations/yahoo-audiences/createSegment/index.js +45 -0
- package/dist/destinations/yahoo-audiences/createSegment/index.js.map +1 -0
- package/dist/destinations/yahoo-audiences/utils.d.ts +4 -0
- package/dist/destinations/yahoo-audiences/utils.js +30 -0
- package/dist/destinations/yahoo-audiences/utils.js.map +1 -0
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -4,7 +4,7 @@ import { StatsContext } from '@segment/actions-core/destination-kit';
|
|
|
4
4
|
import { Features } from '@segment/actions-core/mapping-kit';
|
|
5
5
|
export declare const API_VERSION = "v12";
|
|
6
6
|
export declare const CANARY_API_VERSION = "v13";
|
|
7
|
-
export declare const FLAGON_NAME = "google-enhanced-canary-version";
|
|
7
|
+
export declare const FLAGON_NAME = "actions-versions-google-enhanced-canary-version";
|
|
8
8
|
export declare function formatCustomVariables(customVariables: object, customVariableIdsResults: Array<ConversionCustomVariable>): object;
|
|
9
9
|
export declare const hash: (value: string | undefined) => string | undefined;
|
|
10
10
|
export declare function getCustomVariables(customerId: string, auth: any, request: RequestClient, features: Features | undefined, statsContext: StatsContext | undefined): Promise<ModifiedResponse<QueryResponse[]>>;
|
|
@@ -6,7 +6,7 @@ const actions_core_1 = require("@segment/actions-core");
|
|
|
6
6
|
const formats_1 = require("ajv-formats/dist/formats");
|
|
7
7
|
exports.API_VERSION = 'v12';
|
|
8
8
|
exports.CANARY_API_VERSION = 'v13';
|
|
9
|
-
exports.FLAGON_NAME = 'google-enhanced-canary-version';
|
|
9
|
+
exports.FLAGON_NAME = 'actions-versions-google-enhanced-canary-version';
|
|
10
10
|
function formatCustomVariables(customVariables, customVariableIdsResults) {
|
|
11
11
|
const resourceNames = {};
|
|
12
12
|
Object.entries(customVariableIdsResults).forEach(([_, customVariablesIds]) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/destinations/google-enhanced-conversions/functions.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AAQnC,wDAO8B;AAG9B,sDAAsD;AAEzC,QAAA,WAAW,GAAG,KAAK,CAAA;AACnB,QAAA,kBAAkB,GAAG,KAAK,CAAA;AAC1B,QAAA,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/destinations/google-enhanced-conversions/functions.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AAQnC,wDAO8B;AAG9B,sDAAsD;AAEzC,QAAA,WAAW,GAAG,KAAK,CAAA;AACnB,QAAA,kBAAkB,GAAG,KAAK,CAAA;AAC1B,QAAA,WAAW,GAAG,iDAAiD,CAAA;AAE5E,SAAgB,qBAAqB,CACnC,eAAuB,EACvB,wBAAyD;IAGzD,MAAM,aAAa,GAA2B,EAAE,CAAA;IAChD,MAAM,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,kBAAkB,CAAC,EAAE,EAAE;QAC3E,aAAa,CAAC,kBAA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,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;QAC9C,MAAM,IAAI,qCAAsB,CAAC,sDAAsD,CAAC,CAAA;KACzF;IAED,OAAO,MAAM,CAAC,YAAI,CAAC,KAAK,CAAC,CAAC,CAAA;AAC5B,CAAC,CAAA;AAXY,QAAA,2BAA2B,+BAWvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/addProfileToList/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
profile_id: { ...properties_1.profile_id },
|
|
11
|
+
list_id: { ...properties_1.list_id },
|
|
12
|
+
enable_batching: { ...properties_1.enable_batching }
|
|
13
|
+
},
|
|
14
|
+
dynamicFields: {
|
|
15
|
+
list_id: async (request, { settings }) => {
|
|
16
|
+
return functions_1.getListIdDynamicData(request, settings);
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
perform: async (request, { payload }) => {
|
|
20
|
+
const { profile_id, list_id } = payload;
|
|
21
|
+
if (!list_id) {
|
|
22
|
+
throw new actions_core_1.IntegrationError("Insert the ID of the default list that you'd like to subscribe users", 'Missing required fields', 400);
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const listData = {
|
|
26
|
+
data: [
|
|
27
|
+
{
|
|
28
|
+
type: 'profile',
|
|
29
|
+
id: profile_id
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
};
|
|
33
|
+
const list = await functions_1.executeProfileList(request, 'POST', listData, list_id);
|
|
34
|
+
return list;
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
throw new Error('An error occurred while processing the request');
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
performBatch: async (request, { payload }) => {
|
|
41
|
+
try {
|
|
42
|
+
if (!payload[0].list_id) {
|
|
43
|
+
throw new actions_core_1.IntegrationError("Insert the ID of the default list that you'd like to subscribe users", 'Missing required fields', 400);
|
|
44
|
+
}
|
|
45
|
+
const batch_data = { data: [] };
|
|
46
|
+
payload.forEach((data) => {
|
|
47
|
+
if (!data.list_id) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
batch_data.data.push({ type: 'profile', id: data.profile_id });
|
|
51
|
+
});
|
|
52
|
+
const list = await functions_1.executeProfileList(request, 'POST', batch_data, payload[0].list_id);
|
|
53
|
+
return list;
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
throw new Error('An error occurred while processing the request');
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
exports.default = action;
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/addProfileToList/index.ts"],"names":[],"mappings":";;AAAA,wDAAgG;AAIhG,4CAAuE;AACvE,8CAAoE;AAEpE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,aAAa;IAC1B,MAAM,EAAE;QACN,UAAU,EAAE,EAAE,GAAG,uBAAU,EAAE;QAC7B,OAAO,EAAE,EAAE,GAAG,oBAAO,EAAE;QACvB,eAAe,EAAE,EAAE,GAAG,4BAAe,EAAE;KACxC;IACD,aAAa,EAAE;QACb,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAiC,EAAE;YACtE,OAAO,gCAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;QAChD,CAAC;KACF;IACD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,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;YACtF,OAAO,IAAI,CAAA;SACZ;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAA;SAClE;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RequestClient, DynamicFieldResponse } from '@segment/actions-core';
|
|
2
|
+
import { listData } from './types';
|
|
3
|
+
export declare function getListIdDynamicData(request: RequestClient, settings: any): Promise<DynamicFieldResponse>;
|
|
4
|
+
export declare function executeProfileList(request: RequestClient, method: 'DELETE' | 'POST', payload: listData, list_id: string): Promise<import("@segment/actions-core").ModifiedResponse<unknown>>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeProfileList = exports.getListIdDynamicData = void 0;
|
|
4
|
+
const config_1 = require("./config");
|
|
5
|
+
async function getListIdDynamicData(request, settings) {
|
|
6
|
+
try {
|
|
7
|
+
const result = await request(`${config_1.API_URL}/lists/`, {
|
|
8
|
+
method: 'get',
|
|
9
|
+
headers: {
|
|
10
|
+
Authorization: `Klaviyo-API-Key ${settings.api_key}`,
|
|
11
|
+
Accept: 'application/json',
|
|
12
|
+
revision: new Date().toISOString().slice(0, 10)
|
|
13
|
+
},
|
|
14
|
+
skipResponseCloning: true
|
|
15
|
+
});
|
|
16
|
+
const choices = JSON.parse(result.content).data.map((list) => {
|
|
17
|
+
return { value: list.id, label: list.attributes.name };
|
|
18
|
+
});
|
|
19
|
+
return {
|
|
20
|
+
choices
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
return {
|
|
25
|
+
choices: [],
|
|
26
|
+
nextPage: '',
|
|
27
|
+
error: {
|
|
28
|
+
message: err.message ?? 'Unknown error',
|
|
29
|
+
code: err.status + '' ?? 'Unknown error'
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.getListIdDynamicData = getListIdDynamicData;
|
|
35
|
+
async function executeProfileList(request, method, payload, list_id) {
|
|
36
|
+
try {
|
|
37
|
+
const list = await request(`${config_1.API_URL}/lists/${list_id}/relationships/profiles/`, {
|
|
38
|
+
method: method,
|
|
39
|
+
json: payload
|
|
40
|
+
});
|
|
41
|
+
return list;
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
throw new Error('An error occurred while processing the request');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.executeProfileList = executeProfileList;
|
|
48
|
+
//# sourceMappingURL=functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/functions.ts"],"names":[],"mappings":";;;AACA,qCAAkC;AAG3B,KAAK,UAAU,oBAAoB,CAAC,OAAsB,EAAE,QAAa;IAC9E,IAAI;QACF,MAAM,MAAM,GAAQ,MAAM,OAAO,CAAC,GAAG,gBAAO,SAAS,EAAE;YACrD,MAAM,EAAE,KAAK;YACb,OAAO,EAAE;gBACP,aAAa,EAAE,mBAAmB,QAAQ,CAAC,OAAO,EAAE;gBACpD,MAAM,EAAE,kBAAkB;gBAC1B,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;aAChD;YACD,mBAAmB,EAAE,IAAI;SAC1B,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,EAAE,CAAA;QACxD,CAAC,CAAC,CAAA;QACF,OAAO;YACL,OAAO;SACR,CAAA;KACF;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO;YACL,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,EAAE;YACZ,KAAK,EAAE;gBACL,OAAO,EAAG,GAAgB,CAAC,OAAO,IAAI,eAAe;gBACrD,IAAI,EAAG,GAAgB,CAAC,MAAM,GAAG,EAAE,IAAI,eAAe;aACvD;SACF,CAAA;KACF;AACH,CAAC;AA3BD,oDA2BC;AAEM,KAAK,UAAU,kBAAkB,CACtC,OAAsB,EACtB,MAAyB,EACzB,OAAiB,EACjB,OAAe;IAEf,IAAI;QACF,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,GAAG,gBAAO,UAAU,OAAO,0BAA0B,EAAE;YAChF,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,OAAO;SACd,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;KACZ;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAA;KAClE;AACH,CAAC;AAfD,gDAeC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.profile_id = exports.list_id = exports.enable_batching = void 0;
|
|
4
|
+
exports.enable_batching = {
|
|
5
|
+
label: 'Enable Batching',
|
|
6
|
+
description: 'Enable batching of requests to the Klaviyo.',
|
|
7
|
+
type: 'boolean',
|
|
8
|
+
default: true
|
|
9
|
+
};
|
|
10
|
+
exports.list_id = {
|
|
11
|
+
label: 'List Id',
|
|
12
|
+
description: `'Insert the ID of the default list that you'd like to subscribe users to when you call .identify().'`,
|
|
13
|
+
type: 'string',
|
|
14
|
+
dynamic: true
|
|
15
|
+
};
|
|
16
|
+
exports.profile_id = {
|
|
17
|
+
label: 'Profile Id',
|
|
18
|
+
description: 'Profile Id of User',
|
|
19
|
+
type: 'string'
|
|
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,eAAe,GAAe;IACzC,KAAK,EAAE,iBAAiB;IACxB,WAAW,EAAE,6CAA6C;IAC1D,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,IAAI;CACd,CAAA;AAEY,QAAA,OAAO,GAAe;IACjC,KAAK,EAAE,SAAS;IAChB,WAAW,EAAE,sGAAsG;IACnH,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,IAAI;CACd,CAAA;AAEY,QAAA,UAAU,GAAe;IACpC,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,oBAAoB;IACjC,IAAI,EAAE,QAAQ;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,62 @@
|
|
|
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
|
+
profile_id: { ...properties_1.profile_id },
|
|
11
|
+
list_id: { ...properties_1.list_id },
|
|
12
|
+
enable_batching: { ...properties_1.enable_batching }
|
|
13
|
+
},
|
|
14
|
+
dynamicFields: {
|
|
15
|
+
list_id: async (request, { settings }) => {
|
|
16
|
+
return functions_1.getListIdDynamicData(request, settings);
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
perform: async (request, { payload }) => {
|
|
20
|
+
const { profile_id, list_id } = payload;
|
|
21
|
+
if (!list_id) {
|
|
22
|
+
throw new actions_core_1.IntegrationError("Insert the ID of the default list that you'd like to subscribe users", 'Missing required fields', 400);
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const listData = {
|
|
26
|
+
data: [
|
|
27
|
+
{
|
|
28
|
+
type: 'profile',
|
|
29
|
+
id: profile_id
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
};
|
|
33
|
+
const list = await functions_1.executeProfileList(request, 'DELETE', listData, list_id);
|
|
34
|
+
return list;
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
console.log(error);
|
|
38
|
+
throw new Error('An error occurred while processing the request');
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
performBatch: async (request, { payload }) => {
|
|
42
|
+
try {
|
|
43
|
+
if (!payload[0].list_id) {
|
|
44
|
+
throw new actions_core_1.IntegrationError("Insert the ID of the default list that you'd like to subscribe users", 'Missing required fields', 400);
|
|
45
|
+
}
|
|
46
|
+
const batch_data = { data: [] };
|
|
47
|
+
payload.forEach((data) => {
|
|
48
|
+
if (!data.list_id) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
batch_data.data.push({ type: 'profile', id: data.profile_id });
|
|
52
|
+
});
|
|
53
|
+
const list = await functions_1.executeProfileList(request, 'DELETE', batch_data, payload[0].list_id);
|
|
54
|
+
return list;
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
throw new Error('An error occurred while processing the request');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
exports.default = action;
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/removeProfileToList/index.ts"],"names":[],"mappings":";;AAAA,wDAAgG;AAKhG,4CAAuE;AACvE,8CAAoE;AAEpE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,0BAA0B;IACjC,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,GAAa,EAAE,IAAI,EAAE,EAAE,EAAE,CAAA;YACzC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBACvB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;oBACjB,OAAM;iBACP;gBACD,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAA;YAChE,CAAC,CAAC,CAAA;YAEF,MAAM,IAAI,GAAG,MAAM,8BAAkB,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;YACxF,OAAO,IAAI,CAAA;SACZ;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAA;SAClE;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RequestClient } from '@segment/actions-core/*';
|
|
2
|
+
import { Settings } from './generated-types';
|
|
3
|
+
export interface RefreshTokenResponse {
|
|
4
|
+
access_token: string;
|
|
5
|
+
}
|
|
6
|
+
export interface MarketoResonse {
|
|
7
|
+
success: boolean;
|
|
8
|
+
errors: [
|
|
9
|
+
{
|
|
10
|
+
code: string;
|
|
11
|
+
message: string;
|
|
12
|
+
}
|
|
13
|
+
];
|
|
14
|
+
result: [
|
|
15
|
+
{
|
|
16
|
+
name: string;
|
|
17
|
+
id: string;
|
|
18
|
+
}
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
export declare function getAccessToken(request: RequestClient, settings: Settings): Promise<string>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAccessToken = void 0;
|
|
4
|
+
async function getAccessToken(request, settings) {
|
|
5
|
+
const res = await request(`${settings.api_endpoint}/identity/oauth/token`, {
|
|
6
|
+
method: 'POST',
|
|
7
|
+
body: new URLSearchParams({
|
|
8
|
+
client_id: settings.client_id,
|
|
9
|
+
client_secret: settings.client_secret,
|
|
10
|
+
grant_type: 'client_credentials'
|
|
11
|
+
})
|
|
12
|
+
});
|
|
13
|
+
return res.data.access_token;
|
|
14
|
+
}
|
|
15
|
+
exports.getAccessToken = getAccessToken;
|
|
16
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/destinations/marketo-static-lists/constants.ts"],"names":[],"mappings":";;;AAuBO,KAAK,UAAU,cAAc,CAAC,OAAsB,EAAE,QAAkB;IAC7E,MAAM,GAAG,GAAG,MAAM,OAAO,CAAuB,GAAG,QAAQ,CAAC,YAAY,uBAAuB,EAAE;QAC/F,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,eAAe,CAAC;YACxB,SAAS,EAAE,QAAQ,CAAC,SAAS;YAC7B,aAAa,EAAE,QAAQ,CAAC,aAAa;YACrC,UAAU,EAAE,oBAAoB;SACjC,CAAC;KACH,CAAC,CAAA;IAEF,OAAO,GAAG,CAAC,IAAI,CAAC,YAAY,CAAA;AAC9B,CAAC;AAXD,wCAWC"}
|
|
@@ -3,21 +3,116 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
6
7
|
const addToList_1 = __importDefault(require("./addToList"));
|
|
7
8
|
const removeFromList_1 = __importDefault(require("./removeFromList"));
|
|
9
|
+
const constants_1 = require("./constants");
|
|
8
10
|
const destination = {
|
|
9
11
|
name: 'Marketo Static Lists (Actions)',
|
|
10
12
|
slug: 'actions-marketo-static-lists',
|
|
11
13
|
mode: 'cloud',
|
|
12
14
|
authentication: {
|
|
13
15
|
scheme: 'oauth2',
|
|
14
|
-
fields: {
|
|
16
|
+
fields: {
|
|
17
|
+
client_id: {
|
|
18
|
+
label: 'Client ID',
|
|
19
|
+
description: 'Your Marketo REST API Client ID.',
|
|
20
|
+
type: 'string',
|
|
21
|
+
required: true
|
|
22
|
+
},
|
|
23
|
+
client_secret: {
|
|
24
|
+
label: 'Client Secret',
|
|
25
|
+
description: 'Your Marketo REST API Client Secret.',
|
|
26
|
+
type: 'password',
|
|
27
|
+
required: true
|
|
28
|
+
},
|
|
29
|
+
api_endpoint: {
|
|
30
|
+
label: 'API Endpoint',
|
|
31
|
+
description: 'Your Marketo REST API Endpoint in this format: https://<your_account_id>.mktorest.com.',
|
|
32
|
+
type: 'string',
|
|
33
|
+
required: true
|
|
34
|
+
},
|
|
35
|
+
folder_name: {
|
|
36
|
+
label: 'Folder Name',
|
|
37
|
+
description: 'Name of the folder in which to create static lists.',
|
|
38
|
+
type: 'string',
|
|
39
|
+
required: true
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
refreshAccessToken: async (request, { settings }) => {
|
|
43
|
+
return { accessToken: await constants_1.getAccessToken(request, settings) };
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
extendRequest({ auth }) {
|
|
47
|
+
return {
|
|
48
|
+
headers: {
|
|
49
|
+
authorization: `Bearer ${auth?.accessToken}`
|
|
50
|
+
}
|
|
51
|
+
};
|
|
15
52
|
},
|
|
16
53
|
audienceFields: {},
|
|
17
54
|
audienceConfig: {
|
|
18
55
|
mode: {
|
|
19
56
|
type: 'synced',
|
|
20
57
|
full_audience_sync: false
|
|
58
|
+
},
|
|
59
|
+
async createAudience(request, createAudienceInput) {
|
|
60
|
+
const audience_name = createAudienceInput.audienceName;
|
|
61
|
+
const folder = createAudienceInput.settings.folder_name;
|
|
62
|
+
const endpoint = createAudienceInput.settings.api_endpoint;
|
|
63
|
+
const statsClient = createAudienceInput?.statsContext?.statsClient;
|
|
64
|
+
const statsTags = createAudienceInput?.statsContext?.tags;
|
|
65
|
+
const access_token = await constants_1.getAccessToken(request, createAudienceInput.settings);
|
|
66
|
+
const get_folder_response = await request(`${endpoint}/rest/asset/v1/folder/byName.json?name=${encodeURIComponent(folder)}`, {
|
|
67
|
+
method: 'GET',
|
|
68
|
+
headers: {
|
|
69
|
+
authorization: `Bearer ${access_token}`
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
if (!get_folder_response.data.success && get_folder_response.data.errors) {
|
|
73
|
+
statsClient?.incr('createAudience.error', 1, statsTags);
|
|
74
|
+
throw new actions_core_1.IntegrationError(`${get_folder_response.data.errors[0].message}`, 'INVALID_RESPONSE', 400);
|
|
75
|
+
}
|
|
76
|
+
if (!get_folder_response.data.result) {
|
|
77
|
+
statsClient?.incr('createAudience.error', 1, statsTags);
|
|
78
|
+
throw new actions_core_1.IntegrationError(`A folder with the name ${folder} not found`, 'INVALID_REQUEST_DATA', 400);
|
|
79
|
+
}
|
|
80
|
+
const folder_id = get_folder_response.data.result[0].id;
|
|
81
|
+
const create_list_response = await request(`${endpoint}/rest/asset/v1/staticLists.json?folder=${folder_id}&name=${encodeURIComponent(audience_name)}`, {
|
|
82
|
+
method: 'POST',
|
|
83
|
+
headers: {
|
|
84
|
+
authorization: `Bearer ${access_token}`
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
if (!create_list_response.data.success && create_list_response.data.errors) {
|
|
88
|
+
statsClient?.incr('createAudience.error', 1, statsTags);
|
|
89
|
+
throw new actions_core_1.IntegrationError(`${create_list_response.data.errors[0].message}`, 'INVALID_RESPONSE', 400);
|
|
90
|
+
}
|
|
91
|
+
statsClient?.incr('createAudience.success', 1, statsTags);
|
|
92
|
+
return {
|
|
93
|
+
externalId: create_list_response.data.result[0].id
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
async getAudience(request, getAudienceInput) {
|
|
97
|
+
const endpoint = getAudienceInput.settings.api_endpoint;
|
|
98
|
+
const list_id = getAudienceInput.externalId;
|
|
99
|
+
const statsClient = getAudienceInput?.statsContext?.statsClient;
|
|
100
|
+
const statsTags = getAudienceInput?.statsContext?.tags;
|
|
101
|
+
const access_token = await constants_1.getAccessToken(request, getAudienceInput.settings);
|
|
102
|
+
const response = await request(`${endpoint}/rest/asset/v1/staticList/${list_id}.json`, {
|
|
103
|
+
method: 'GET',
|
|
104
|
+
headers: {
|
|
105
|
+
authorization: `Bearer ${access_token}`
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
if (!response.data.success && response.data.errors) {
|
|
109
|
+
statsClient?.incr('getAudience.error', 1, statsTags);
|
|
110
|
+
throw new actions_core_1.IntegrationError(`${response.data.errors[0].message}`, 'INVALID_RESPONSE', 400);
|
|
111
|
+
}
|
|
112
|
+
statsClient?.incr('getAudience.success', 1, statsTags);
|
|
113
|
+
return {
|
|
114
|
+
externalId: list_id
|
|
115
|
+
};
|
|
21
116
|
}
|
|
22
117
|
},
|
|
23
118
|
actions: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/marketo-static-lists/index.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/marketo-static-lists/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAwD;AAGxD,4DAAmC;AACnC,sEAA6C;AAC7C,2CAA4D;AAE5D,MAAM,WAAW,GAA4C;IAC3D,IAAI,EAAE,gCAAgC;IACtC,IAAI,EAAE,8BAA8B;IACpC,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,SAAS,EAAE;gBACT,KAAK,EAAE,WAAW;gBAClB,WAAW,EAAE,kCAAkC;gBAC/C,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,aAAa,EAAE;gBACb,KAAK,EAAE,eAAe;gBACtB,WAAW,EA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AAE,IAAI,CAAC,qBAAqB,EAAE,CAAC,EAAE,SAAS,CAAC,CAAA;YAEtD,OAAO;gBACL,UAAU,EAAE,OAAO;aACpB,CAAA;QACH,CAAC;KACF;IACD,OAAO,EAAE;QACP,SAAS,EAAT,mBAAS;QACT,cAAc,EAAd,wBAAc;KACf;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare enum ApiRegions {
|
|
2
|
+
US = "US \uD83C\uDDFA\uD83C\uDDF8",
|
|
3
|
+
EU = "EU \uD83C\uDDEA\uD83C\uDDFA"
|
|
4
|
+
}
|
|
5
|
+
export declare enum StrictMode {
|
|
6
|
+
ON = "1",
|
|
7
|
+
OFF = "0"
|
|
8
|
+
}
|
|
9
|
+
export declare function getConcatenatedName(firstName: unknown, lastName: unknown, name: unknown): unknown;
|
|
10
|
+
export declare function getApiServerUrl(apiRegion: string | undefined): "https://api-eu.mixpanel.com" | "https://api.mixpanel.com";
|
|
11
|
+
export declare function getBrowser(userAgent: string): string;
|
|
12
|
+
export declare function getBrowserVersion(userAgent: string): string | undefined;
|
|
13
|
+
export declare function cheapGuid(maxlen?: number): string;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cheapGuid = exports.getBrowserVersion = exports.getBrowser = exports.getApiServerUrl = exports.getConcatenatedName = exports.StrictMode = exports.ApiRegions = void 0;
|
|
4
|
+
var ApiRegions;
|
|
5
|
+
(function (ApiRegions) {
|
|
6
|
+
ApiRegions["US"] = "US \uD83C\uDDFA\uD83C\uDDF8";
|
|
7
|
+
ApiRegions["EU"] = "EU \uD83C\uDDEA\uD83C\uDDFA";
|
|
8
|
+
})(ApiRegions = exports.ApiRegions || (exports.ApiRegions = {}));
|
|
9
|
+
var StrictMode;
|
|
10
|
+
(function (StrictMode) {
|
|
11
|
+
StrictMode["ON"] = "1";
|
|
12
|
+
StrictMode["OFF"] = "0";
|
|
13
|
+
})(StrictMode = exports.StrictMode || (exports.StrictMode = {}));
|
|
14
|
+
function getConcatenatedName(firstName, lastName, name) {
|
|
15
|
+
return name ?? (firstName && lastName ? `${firstName} ${lastName}` : undefined);
|
|
16
|
+
}
|
|
17
|
+
exports.getConcatenatedName = getConcatenatedName;
|
|
18
|
+
function getApiServerUrl(apiRegion) {
|
|
19
|
+
if (apiRegion == ApiRegions.EU) {
|
|
20
|
+
return 'https://api-eu.mixpanel.com';
|
|
21
|
+
}
|
|
22
|
+
return 'https://api.mixpanel.com';
|
|
23
|
+
}
|
|
24
|
+
exports.getApiServerUrl = getApiServerUrl;
|
|
25
|
+
function getBrowser(userAgent) {
|
|
26
|
+
if (userAgent.includes(' OPR/')) {
|
|
27
|
+
if (userAgent.includes('Mini')) {
|
|
28
|
+
return 'Opera Mini';
|
|
29
|
+
}
|
|
30
|
+
return 'Opera';
|
|
31
|
+
}
|
|
32
|
+
else if (/(BlackBerry|PlayBook|BB10)/i.test(userAgent)) {
|
|
33
|
+
return 'BlackBerry';
|
|
34
|
+
}
|
|
35
|
+
else if (userAgent.includes('IEMobile') || userAgent.includes('WPDesktop')) {
|
|
36
|
+
return 'Internet Explorer Mobile';
|
|
37
|
+
}
|
|
38
|
+
else if (userAgent.includes('SamsungBrowser/')) {
|
|
39
|
+
return 'Samsung Internet';
|
|
40
|
+
}
|
|
41
|
+
else if (userAgent.includes('Edge') || userAgent.includes('Edg/')) {
|
|
42
|
+
return 'Microsoft Edge';
|
|
43
|
+
}
|
|
44
|
+
else if (userAgent.includes('FBIOS')) {
|
|
45
|
+
return 'Facebook Mobile';
|
|
46
|
+
}
|
|
47
|
+
else if (userAgent.includes('Chrome')) {
|
|
48
|
+
return 'Chrome';
|
|
49
|
+
}
|
|
50
|
+
else if (userAgent.includes('CriOS')) {
|
|
51
|
+
return 'Chrome iOS';
|
|
52
|
+
}
|
|
53
|
+
else if (userAgent.includes('UCWEB') || userAgent.includes('UCBrowser')) {
|
|
54
|
+
return 'UC Browser';
|
|
55
|
+
}
|
|
56
|
+
else if (userAgent.includes('FxiOS')) {
|
|
57
|
+
return 'Firefox iOS';
|
|
58
|
+
}
|
|
59
|
+
else if (userAgent.includes('Safari')) {
|
|
60
|
+
return 'Safari';
|
|
61
|
+
}
|
|
62
|
+
else if (userAgent.includes('Android')) {
|
|
63
|
+
return 'Android Mobile';
|
|
64
|
+
}
|
|
65
|
+
else if (userAgent.includes('Konqueror')) {
|
|
66
|
+
return 'Konqueror';
|
|
67
|
+
}
|
|
68
|
+
else if (userAgent.includes('Firefox')) {
|
|
69
|
+
return 'Firefox';
|
|
70
|
+
}
|
|
71
|
+
else if (userAgent.includes('MSIE') || userAgent.includes('Trident/')) {
|
|
72
|
+
return 'Internet Explorer';
|
|
73
|
+
}
|
|
74
|
+
else if (userAgent.includes('Gecko')) {
|
|
75
|
+
return 'Mozilla';
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
return '';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.getBrowser = getBrowser;
|
|
82
|
+
function getBrowserVersion(userAgent) {
|
|
83
|
+
const browser = getBrowser(userAgent);
|
|
84
|
+
const versionRegexs = {
|
|
85
|
+
'Internet Explorer Mobile': /rv:(\d+(\.\d+)?)/,
|
|
86
|
+
'Microsoft Edge': /Edge?\/(\d+(\.\d+)?)/,
|
|
87
|
+
Chrome: /Chrome\/(\d+(\.\d+)?)/,
|
|
88
|
+
'Chrome iOS': /CriOS\/(\d+(\.\d+)?)/,
|
|
89
|
+
'UC Browser': /(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,
|
|
90
|
+
Safari: /Version\/(\d+(\.\d+)?)/,
|
|
91
|
+
'Mobile Safari': /Version\/(\d+(\.\d+)?)/,
|
|
92
|
+
Opera: /(Opera|OPR)\/(\d+(\.\d+)?)/,
|
|
93
|
+
Firefox: /Firefox\/(\d+(\.\d+)?)/,
|
|
94
|
+
'Firefox iOS': /FxiOS\/(\d+(\.\d+)?)/,
|
|
95
|
+
Konqueror: /Konqueror:(\d+(\.\d+)?)/,
|
|
96
|
+
BlackBerry: /BlackBerry (\d+(\.\d+)?)/,
|
|
97
|
+
'Android Mobile': /android\s(\d+(\.\d+)?)/,
|
|
98
|
+
'Samsung Internet': /SamsungBrowser\/(\d+(\.\d+)?)/,
|
|
99
|
+
'Internet Explorer': /(rv:|MSIE )(\d+(\.\d+)?)/,
|
|
100
|
+
Mozilla: /rv:(\d+(\.\d+)?)/
|
|
101
|
+
};
|
|
102
|
+
const regex = versionRegexs[browser];
|
|
103
|
+
if (!regex)
|
|
104
|
+
return regex;
|
|
105
|
+
const matches = regex.exec(userAgent);
|
|
106
|
+
if (!matches) {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
return matches[matches.length - 2];
|
|
110
|
+
}
|
|
111
|
+
exports.getBrowserVersion = getBrowserVersion;
|
|
112
|
+
function cheapGuid(maxlen) {
|
|
113
|
+
const guid = Math.random().toString(36).substring(2, 10) + Math.random().toString(36).substring(2, 10);
|
|
114
|
+
return maxlen ? guid.substring(0, maxlen) : guid;
|
|
115
|
+
}
|
|
116
|
+
exports.cheapGuid = cheapGuid;
|
|
117
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/destinations/mixpanel/utils.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,gDAAc,CAAA;IACd,gDAAc,CAAA;AAChB,CAAC,EAHW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAGrB;AAED,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,sBAAQ,CAAA;IACR,uBAAS,CAAA;AACX,CAAC,EAHW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAGrB;AAED,SAAgB,mBAAmB,CAAC,SAAkB,EAAE,QAAiB,EAAE,IAAa;IACtF,OAA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BACJ,GAAG,OAAO,CAAC,IAAI;4BACf,GAAG,MAAM;yBACV;qBACF;oBACD,QAAQ;iBACT,CAAC,CAAA;YACJ,CAAC;YACD,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,EAAE,EAAE;gBACjE,MAAM,MAAM,GAAG,sBAAsB,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAA;gBAI/D,OAAO,cAAI,CAAC,YAAa,CAAC,OAAO,EAAE;oBACjC,gBAAgB;oBAChB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;wBACzB,OAAO;4BACL,GAAG,CAAC;4BACJ,IAAI,EAAE;gCACJ,GAAG,CAAC,CAAC,IAAI;gCACT,GAAG,MAAM;6BACV;yBACF,CAAA;oBACH,CAAC,CAAC;oBACF,QAAQ;iBACT,CAAC,CAAA;YACJ,CAAC;SACF;KACF;CACF,CAAA;AAED,MAAM,sBAAsB,GAAG,CAAC,iBAA0B,EAAU,EAAE;IACpE,IAAI,aAAa,GAAG,EAAE,CAAA;IACtB,IAAI,iBAAiB,EAAE;QACrB,IAAI;YACF,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAA;SAC9C;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,IAAI,+BAAgB,CAAC,4BAA4B,EAAE,sBAAsB,EAAE,GAAG,CAAC,CAAA;SACtF;KACF;IACD,OAAO,aAAa,CAAA;AACtB,CAAC,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/yahoo-audiences/createCustomerNode/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_tax_1 = require("../utils-tax");
|
|
4
|
+
const utils_tax_2 = require("../utils-tax");
|
|
5
|
+
const action = {
|
|
6
|
+
title: 'Create top-level CUSTOMER node in Yahoo taxonomy',
|
|
7
|
+
defaultSubscription: 'event = "Audience Entered" and event = "Audience Exited"',
|
|
8
|
+
description: '',
|
|
9
|
+
fields: {
|
|
10
|
+
engage_space_id: {
|
|
11
|
+
label: 'Engage Space Id',
|
|
12
|
+
description: 'Provide Engage Space Id found in Unify > Settings > API Access. This maps to the "Id" and "Name" of the top-level Customer node in Yahoo taxonomy',
|
|
13
|
+
type: 'string',
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
customer_desc: {
|
|
17
|
+
label: 'Customer Description',
|
|
18
|
+
description: 'Provide a description for the Customer node in Yahoo taxonomy. This must be less then 1000 characters',
|
|
19
|
+
type: 'string',
|
|
20
|
+
required: false
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
perform: async (request, { settings, payload }) => {
|
|
24
|
+
const tx_creds = {
|
|
25
|
+
tx_client_key: settings.taxonomy_client_key,
|
|
26
|
+
tx_client_secret: settings.taxonomy_client_secret
|
|
27
|
+
};
|
|
28
|
+
const taxonomy_payload = utils_tax_1.gen_customer_taxonomy_payload(settings, payload);
|
|
29
|
+
return await utils_tax_2.update_taxonomy('', tx_creds, request, taxonomy_payload);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
exports.default = action;
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/yahoo-audiences/createCustomerNode/index.ts"],"names":[],"mappings":";;AAGA,4CAA4D;AAC5D,4CAA8C;AAE9C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,kDAAkD;IACzD,mBAAmB,EAAE,0DAA0D;IAC/E,WAAW,EAAE,EAAE;IACf,MAAM,EAAE;QACN,eAAe,EAAE;YACf,KAAK,EAAE,iBAAiB;YACxB,WAAW,EACT,mJAAmJ;YACrJ,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,aAAa,EAAE;YACb,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EACT,uGAAuG;YACzG,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAChD,MAAM,QAAQ,GAAG;YACf,aAAa,EAAE,QAAQ,CAAC,mBAAmB;YAC3C,gBAAgB,EAAE,QAAQ,CAAC,sBAAsB;SAClD,CAAA;QACD,MAAM,gBAAgB,GAAG,yCAA6B,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QACzE,OAAO,MAAM,2BAAe,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAA;IACvE,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/yahoo-audiences/createSegment/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_tax_1 = require("../utils-tax");
|
|
4
|
+
const utils_tax_2 = require("../utils-tax");
|
|
5
|
+
const action = {
|
|
6
|
+
title: 'Create SEGMENT sub-node in Yahoo taxonomy',
|
|
7
|
+
description: 'Use this action to generate SEGMENT sub-node within CUSTOMER node in Yahoo taxonomy',
|
|
8
|
+
defaultSubscription: 'event = "Audience Entered" and event = "Audience Exited"',
|
|
9
|
+
fields: {
|
|
10
|
+
segment_audience_key: {
|
|
11
|
+
label: 'Audience Key',
|
|
12
|
+
description: 'Provide audience key. This maps to the "Name" of the Segment node in Yahoo taxonomy',
|
|
13
|
+
type: 'string',
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
segment_audience_id: {
|
|
17
|
+
label: 'Audience Id',
|
|
18
|
+
description: 'Provide audience Id (aud_...) from audience URL in Segment Engage. This maps to the "Id" of the Segment node in Yahoo taxonomy',
|
|
19
|
+
type: 'string',
|
|
20
|
+
required: true
|
|
21
|
+
},
|
|
22
|
+
engage_space_id: {
|
|
23
|
+
label: 'Engage Space Id',
|
|
24
|
+
description: 'Provide Engage Space Id found in Unify > Settings > API Access. This maps to the "Id" and "Name" of the top-level Customer node in Yahoo taxonomy and specifies the parent node for your Segment node in Yahoo taxonomy',
|
|
25
|
+
type: 'string',
|
|
26
|
+
required: false
|
|
27
|
+
},
|
|
28
|
+
customer_desc: {
|
|
29
|
+
label: 'Space Description',
|
|
30
|
+
description: 'Provide the description for Segment node in Yahoo taxonomy. This must be less then 1000 characters',
|
|
31
|
+
type: 'string',
|
|
32
|
+
required: false
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
perform: async (request, { payload, settings }) => {
|
|
36
|
+
const tx_creds = {
|
|
37
|
+
tx_client_key: settings.taxonomy_client_key,
|
|
38
|
+
tx_client_secret: settings.taxonomy_client_secret
|
|
39
|
+
};
|
|
40
|
+
const body_form_data = utils_tax_1.gen_segment_subtaxonomy_payload(payload);
|
|
41
|
+
return await utils_tax_2.update_taxonomy(String(payload.engage_space_id), tx_creds, request, body_form_data);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
exports.default = action;
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/yahoo-audiences/createSegment/index.ts"],"names":[],"mappings":";;AAIA,4CAA8D;AAC9D,4CAA8C;AAG9C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,2CAA2C;IAClD,WAAW,EAAE,qFAAqF;IAClG,mBAAmB,EAAE,0DAA0D;IAE/E,MAAM,EAAE;QACN,oBAAoB,EAAE;YACpB,KAAK,EAAE,cAAc;YACrB,WAAW,EAAE,qFAAqF;YAClG,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,mBAAmB,EAAE;YACnB,KAAK,EAAE,aAAa;YACpB,WAAW,EACT,gIAAgI;YAClI,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,eAAe,EAAE;YACf,KAAK,EAAE,iBAAiB;YACxB,WAAW,EACT,yNAAyN;YAC3N,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;QACD,aAAa,EAAE;YACb,KAAK,EAAE,mBAAmB;YAC1B,WAAW,EAAE,oGAAoG;YACjH,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAChD,MAAM,QAAQ,GAAG;YACf,aAAa,EAAE,QAAQ,CAAC,mBAAmB;YAC3C,gBAAgB,EAAE,QAAQ,CAAC,sBAAsB;SAClD,CAAA;QAED,MAAM,cAAc,GAAG,2CAA+B,CAAC,OAAO,CAAC,CAAA;QAC/D,OAAO,MAAM,2BAAe,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,CAAC,CAAA;IAClG,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RequestClient } from '@segment/actions-core';
|
|
2
|
+
import { CredsObj } from './types';
|
|
3
|
+
export declare function gen_random_id(length: number): string;
|
|
4
|
+
export declare function update_taxonomy(engage_space_id: string, tx_creds: CredsObj, request: RequestClient, body_form_data: string): Promise<any>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.update_taxonomy = exports.gen_random_id = void 0;
|
|
4
|
+
const utils_tax_1 = require("./utils-tax");
|
|
5
|
+
function gen_random_id(length) {
|
|
6
|
+
const pattern = 'abcdefghijklmnopqrstuvwxyz123456789';
|
|
7
|
+
const result = [];
|
|
8
|
+
for (let i = 0; i < length; i++) {
|
|
9
|
+
result.push(pattern[Math.floor(Math.random() * pattern.length)]);
|
|
10
|
+
}
|
|
11
|
+
return result.join('');
|
|
12
|
+
}
|
|
13
|
+
exports.gen_random_id = gen_random_id;
|
|
14
|
+
async function update_taxonomy(engage_space_id, tx_creds, request, body_form_data) {
|
|
15
|
+
const tx_client_secret = tx_creds.tx_client_key;
|
|
16
|
+
const tx_client_key = tx_creds.tx_client_secret;
|
|
17
|
+
const url = `https://datax.yahooapis.com/v1/taxonomy/append${engage_space_id.length > 0 ? '/' + engage_space_id : ''}`;
|
|
18
|
+
const oauth1_auth_string = utils_tax_1.gen_oauth1_signature(tx_client_key, tx_client_secret, 'PUT', url);
|
|
19
|
+
const add_segment_node = await request(url, {
|
|
20
|
+
method: 'PUT',
|
|
21
|
+
body: body_form_data,
|
|
22
|
+
headers: {
|
|
23
|
+
Authorization: oauth1_auth_string,
|
|
24
|
+
'Content-Type': 'multipart/form-data; boundary=SEGMENT-DATA'
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return await add_segment_node.json();
|
|
28
|
+
}
|
|
29
|
+
exports.update_taxonomy = update_taxonomy;
|
|
30
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/destinations/yahoo-audiences/utils.ts"],"names":[],"mappings":";;;AAEA,2CAAkD;AAQlD,SAAgB,aAAa,CAAC,MAAc;IAC1C,MAAM,OAAO,GAAG,qCAAqC,CAAA;IACrD,MAAM,MAAM,GAAG,EAAE,CAAA;IACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;QAC/B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;KACjE;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxB,CAAC;AAPD,sCAOC;AAEM,KAAK,UAAU,eAAe,CACnC,eAAuB,EACvB,QAAkB,EAClB,OAAsB,EACtB,cAAsB;IAEtB,MAAM,gBAAgB,GAAG,QAAQ,CAAC,aAAa,CAAA;IAC/C,MAAM,aAAa,GAAG,QAAQ,CAAC,gBAAgB,CAAA;IAC/C,MAAM,GAAG,GAAG,iDAAiD,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE,CAAA;IACtH,MAAM,kBAAkB,GAAG,gCAAoB,CAAC,aAAa,EAAE,gBAAgB,EAAE,KAAK,EAAE,GAAG,CAAC,CAAA;IAE5F,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE;QAC1C,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE;YACP,aAAa,EAAE,kBAAkB;YACjC,cAAc,EAAE,4CAA4C;SAC7D;KACF,CAAC,CAAA;IAEF,OAAO,MAAM,gBAAgB,CAAC,IAAI,EAAE,CAAA;AACtC,CAAC;AArBD,0CAqBC"}
|
package/package.json
CHANGED