@segment/action-destinations 3.46.0 → 3.46.1-alpha.0
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/adobe-target/generated-types.d.ts +3 -0
- package/dist/destinations/adobe-target/generated-types.js +3 -0
- package/dist/destinations/adobe-target/generated-types.js.map +1 -0
- package/dist/destinations/adobe-target/index.d.ts +4 -0
- package/dist/destinations/adobe-target/index.js +27 -0
- package/dist/destinations/adobe-target/index.js.map +1 -0
- package/dist/destinations/adobe-target/updateProfile/generated-types.d.ts +6 -0
- package/dist/destinations/adobe-target/updateProfile/generated-types.js +3 -0
- package/dist/destinations/adobe-target/updateProfile/generated-types.js.map +1 -0
- package/dist/destinations/adobe-target/updateProfile/index.d.ts +5 -0
- package/dist/destinations/adobe-target/updateProfile/index.js +58 -0
- package/dist/destinations/adobe-target/updateProfile/index.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/destinations/adobe-target/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
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 updateProfile_1 = __importDefault(require("./updateProfile"));
|
|
7
|
+
const destination = {
|
|
8
|
+
name: 'Adobe Target Cloud Mode',
|
|
9
|
+
slug: 'actions-adobe-target-cloud',
|
|
10
|
+
mode: 'cloud',
|
|
11
|
+
authentication: {
|
|
12
|
+
scheme: 'custom',
|
|
13
|
+
fields: {
|
|
14
|
+
client_code: {
|
|
15
|
+
label: 'Client Code',
|
|
16
|
+
description: 'Your Adobe Target client code. To find your client code in the Target UI click Administration > Implementation. The client code is shown up top under Account Details.',
|
|
17
|
+
type: 'string',
|
|
18
|
+
required: true
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
actions: {
|
|
23
|
+
updateProfile: updateProfile_1.default
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
exports.default = destination;
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/adobe-target/index.ts"],"names":[],"mappings":";;;;;AAGA,oEAA2C;AAE3C,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,yBAAyB;IAC/B,IAAI,EAAE,4BAA4B;IAClC,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,WAAW,EAAE;gBACX,KAAK,EAAE,aAAa;gBACpB,WAAW,EACT,wKAAwK;gBAC1K,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;SACF;KACF;IACD,OAAO,EAAE;QACP,aAAa,EAAb,uBAAa;KACd;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/adobe-target/updateProfile/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const attributes = {};
|
|
4
|
+
function getnestedObjects(obj, objectPath = '') {
|
|
5
|
+
if (obj.traits) {
|
|
6
|
+
obj = obj.traits;
|
|
7
|
+
}
|
|
8
|
+
Object.keys(obj).forEach((key) => {
|
|
9
|
+
const currObjectPath = objectPath ? `${objectPath}.${key}` : key;
|
|
10
|
+
if (typeof obj[key] !== 'object' && obj[key]) {
|
|
11
|
+
attributes[currObjectPath] = obj[key].toString();
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
getnestedObjects(obj[key], currObjectPath);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return attributes;
|
|
18
|
+
}
|
|
19
|
+
const objectToQueryString = (object) => Object.keys(object)
|
|
20
|
+
.map((key) => `profile.${key}=${object[key].toString()}`)
|
|
21
|
+
.join('&');
|
|
22
|
+
const action = {
|
|
23
|
+
title: 'Update Profile',
|
|
24
|
+
description: '',
|
|
25
|
+
fields: {
|
|
26
|
+
user_id: {
|
|
27
|
+
label: 'User ID',
|
|
28
|
+
description: "The user's unique identifier",
|
|
29
|
+
type: 'string',
|
|
30
|
+
required: true,
|
|
31
|
+
default: {
|
|
32
|
+
'@path': '$.userId'
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
traits: {
|
|
36
|
+
label: 'Traits',
|
|
37
|
+
description: "The user's attributes that will be updated.",
|
|
38
|
+
type: 'object',
|
|
39
|
+
required: true,
|
|
40
|
+
default: {
|
|
41
|
+
'@path': '$.properties.traits'
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
perform: (request, data) => {
|
|
46
|
+
const array = [];
|
|
47
|
+
Object.entries(data.payload).forEach((entry) => array.push(entry[1]));
|
|
48
|
+
const clientCode = data.settings.client_code;
|
|
49
|
+
const userId = data.payload.user_id;
|
|
50
|
+
const traits = getnestedObjects(data.payload.traits);
|
|
51
|
+
const requestUrl = `https://${clientCode}.tt.omtrdc.net/m2/${clientCode}/profile/update?mbox3rdPartyId=${userId}&${objectToQueryString(traits)}`;
|
|
52
|
+
return request(requestUrl, {
|
|
53
|
+
method: 'POST'
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.default = action;
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/adobe-target/updateProfile/index.ts"],"names":[],"mappings":";;AAOA,MAAM,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Q;YACf,WAAW,EAAE,6CAA6C;YAC1D,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,qBAAqB;aAC/B;SACF;KACF;IAED,OAAO,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE;QACzB,MAAM,KAAK,GAAc,EAAE,CAAA;QAC3B,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QACrE,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAA;QAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAA;QACnC,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QACpD,MAAM,UAAU,GAAG,WAAW,UAAU,qBAAqB,UAAU,kCAAkC,MAAM,IAAI,mBAAmB,CACpI,MAAM,CACP,EAAE,CAAA;QAEH,OAAO,OAAO,CAAC,UAAU,EAAE;YACzB,MAAM,EAAE,MAAM;SACf,CAAC,CAAA;IACJ,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.46.0",
|
|
4
|
+
"version": "3.46.1-alpha.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/segmentio/action-destinations",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@amplitude/ua-parser-js": "^0.7.25",
|
|
41
41
|
"@segment/actions-core": "^3.21.1",
|
|
42
|
-
"@segment/actions-shared": "^1.2.0",
|
|
42
|
+
"@segment/actions-shared": "^1.2.1-alpha.0",
|
|
43
43
|
"cheerio": "^1.0.0-rc.10",
|
|
44
44
|
"dayjs": "^1.10.7",
|
|
45
45
|
"escape-goat": "^3",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"<rootDir>/test/setup-after-env.ts"
|
|
63
63
|
]
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "86056961a2b11f1f1d4f6c8eb0779edea7d77feb"
|
|
66
66
|
}
|