@segment/action-destinations 3.405.0 → 3.406.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/amazon-conversions-api/index.js +11 -11
- package/dist/destinations/amazon-conversions-api/index.js.map +1 -1
- package/dist/destinations/amazon-conversions-api/trackConversion/fields.js +2 -2
- package/dist/destinations/amazon-conversions-api/trackConversion/fields.js.map +1 -1
- package/dist/destinations/attentive/constants.d.ts +12 -0
- package/dist/destinations/attentive/constants.js +13 -0
- package/dist/destinations/attentive/constants.js.map +1 -0
- package/dist/destinations/attentive/customEvents/generated-types.d.ts +3 -3
- package/dist/destinations/attentive/customEvents/index.js +14 -112
- package/dist/destinations/attentive/customEvents/index.js.map +1 -1
- package/dist/destinations/attentive/ecommEvent/generated-types.d.ts +20 -0
- package/dist/destinations/attentive/ecommEvent/generated-types.js +3 -0
- package/dist/destinations/attentive/ecommEvent/generated-types.js.map +1 -0
- package/dist/destinations/attentive/ecommEvent/index.d.ts +5 -0
- package/dist/destinations/attentive/ecommEvent/index.js +26 -0
- package/dist/destinations/attentive/ecommEvent/index.js.map +1 -0
- package/dist/destinations/attentive/fields.d.ts +12 -0
- package/dist/destinations/attentive/fields.js +215 -0
- package/dist/destinations/attentive/fields.js.map +1 -0
- package/dist/destinations/attentive/functions.d.ts +11 -0
- package/dist/destinations/attentive/functions.js +100 -0
- package/dist/destinations/attentive/functions.js.map +1 -0
- package/dist/destinations/attentive/index.js +51 -8
- package/dist/destinations/attentive/index.js.map +1 -1
- package/dist/destinations/attentive/subscribeUser/generated-types.d.ts +14 -0
- package/dist/destinations/attentive/subscribeUser/generated-types.js +3 -0
- package/dist/destinations/attentive/subscribeUser/generated-types.js.map +1 -0
- package/dist/destinations/attentive/subscribeUser/index.d.ts +5 -0
- package/dist/destinations/attentive/subscribeUser/index.js +29 -0
- package/dist/destinations/attentive/subscribeUser/index.js.map +1 -0
- package/dist/destinations/attentive/test-data.d.ts +96 -0
- package/dist/destinations/attentive/test-data.js +125 -0
- package/dist/destinations/attentive/test-data.js.map +1 -0
- package/dist/destinations/attentive/types.d.ts +51 -0
- package/dist/destinations/attentive/types.js.map +1 -0
- package/dist/destinations/attentive/upsertUserAttributes/generated-types.d.ts +11 -0
- package/dist/destinations/attentive/upsertUserAttributes/generated-types.js +3 -0
- package/dist/destinations/attentive/upsertUserAttributes/generated-types.js.map +1 -0
- package/dist/destinations/attentive/upsertUserAttributes/index.d.ts +5 -0
- package/dist/destinations/attentive/upsertUserAttributes/index.js +29 -0
- package/dist/destinations/attentive/upsertUserAttributes/index.js.map +1 -0
- package/dist/destinations/hubspot/upsertObject/common-fields.js +8 -0
- package/dist/destinations/hubspot/upsertObject/common-fields.js.map +1 -1
- package/dist/destinations/hubspot/upsertObject/constants.d.ts +1 -0
- package/dist/destinations/hubspot/upsertObject/constants.js +2 -1
- package/dist/destinations/hubspot/upsertObject/constants.js.map +1 -1
- package/dist/destinations/hubspot/upsertObject/functions/validation-functions.d.ts +3 -0
- package/dist/destinations/hubspot/upsertObject/functions/validation-functions.js +68 -1
- package/dist/destinations/hubspot/upsertObject/functions/validation-functions.js.map +1 -1
- package/dist/destinations/hubspot/upsertObject/generated-types.d.ts +1 -0
- package/dist/destinations/hubspot/upsertObject/index.js +10 -3
- package/dist/destinations/hubspot/upsertObject/index.js.map +1 -1
- package/dist/destinations/hubspot/upsertObject/types.d.ts +18 -0
- package/dist/destinations/hubspot/upsertObject/types.js.map +1 -1
- package/dist/destinations/roadwayai/groupUser/index.js +2 -2
- package/dist/destinations/roadwayai/groupUser/index.js.map +1 -1
- package/dist/destinations/roadwayai/identifyUser/index.js +2 -2
- package/dist/destinations/roadwayai/identifyUser/index.js.map +1 -1
- package/dist/destinations/roadwayai/index.js +1 -1
- package/dist/destinations/roadwayai/index.js.map +1 -1
- package/dist/destinations/roadwayai/trackEvent/index.js +2 -2
- package/dist/destinations/roadwayai/trackEvent/index.js.map +1 -1
- package/dist/destinations/roadwayai/trackPageView/index.js +2 -2
- package/dist/destinations/roadwayai/trackPageView/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/destinations/attentive/customEvents/types.d.ts +0 -15
- package/dist/destinations/attentive/customEvents/types.js.map +0 -1
- /package/dist/destinations/attentive/{customEvents/types.js → types.js} +0 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatSubscribeUserJSON = exports.formatUpsertUserAttributesJSON = exports.formatCustomEventJSON = exports.formatEcommEventJSON = exports.validateSubscribeUser = exports.validate = void 0;
|
|
4
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
5
|
+
function validate(payload) {
|
|
6
|
+
const { userIdentifiers: { phone, email, clientUserId, ...customIdentifiers } } = payload;
|
|
7
|
+
if (!email && !phone && !clientUserId && Object.keys(customIdentifiers).length === 0) {
|
|
8
|
+
throw new actions_core_1.PayloadValidationError('At least one user identifier is required.');
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.validate = validate;
|
|
12
|
+
function validateSubscribeUser(payload) {
|
|
13
|
+
const { userIdentifiers, locale } = payload;
|
|
14
|
+
if (!userIdentifiers && !locale) {
|
|
15
|
+
throw new actions_core_1.PayloadValidationError('Either locale or signUpSourceId is required.');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.validateSubscribeUser = validateSubscribeUser;
|
|
19
|
+
function formatUser(userIdentifiers) {
|
|
20
|
+
const { phone, email, clientUserId, ...customIdentifiers } = userIdentifiers;
|
|
21
|
+
return {
|
|
22
|
+
...(phone ? { phone } : {}),
|
|
23
|
+
...(email ? { email } : {}),
|
|
24
|
+
...(clientUserId || Object.keys(customIdentifiers || {}).length > 0
|
|
25
|
+
? {
|
|
26
|
+
externalIdentifiers: {
|
|
27
|
+
...(clientUserId ? { clientUserId } : {}),
|
|
28
|
+
...(Object.keys(customIdentifiers || {}).length > 0 ? { customIdentifiers } : {})
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
: {})
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function formatItems(items) {
|
|
35
|
+
return items.map(({ value, currency, ...rest }) => ({
|
|
36
|
+
...rest,
|
|
37
|
+
price: {
|
|
38
|
+
value,
|
|
39
|
+
currency,
|
|
40
|
+
}
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
function formatLocale(locale) {
|
|
44
|
+
if (!locale) {
|
|
45
|
+
throw new actions_core_1.PayloadValidationError('Locale Signup Source ID is required.');
|
|
46
|
+
}
|
|
47
|
+
const parts = locale.split('-');
|
|
48
|
+
if (parts.length !== 2 || !parts[0] || !parts[1]) {
|
|
49
|
+
throw new actions_core_1.PayloadValidationError('Invalid locale format. Expected format: "language-country" e.g. "en-US".');
|
|
50
|
+
}
|
|
51
|
+
const [language, country] = parts;
|
|
52
|
+
return { language, country };
|
|
53
|
+
}
|
|
54
|
+
function formatEcommEventJSON(payload) {
|
|
55
|
+
return {
|
|
56
|
+
items: formatItems(payload.items),
|
|
57
|
+
occurredAt: payload.occurredAt,
|
|
58
|
+
user: formatUser(payload.userIdentifiers)
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
exports.formatEcommEventJSON = formatEcommEventJSON;
|
|
62
|
+
function formatCustomEventJSON(payload) {
|
|
63
|
+
const { externalEventId, type, properties, occurredAt, userIdentifiers } = payload;
|
|
64
|
+
if (Object.values(properties ?? {}).some(value => Array.isArray(value))) {
|
|
65
|
+
throw new actions_core_1.PayloadValidationError('Properties cannot contain arrays.');
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
type,
|
|
69
|
+
properties,
|
|
70
|
+
externalEventId,
|
|
71
|
+
occurredAt,
|
|
72
|
+
user: formatUser(userIdentifiers)
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
exports.formatCustomEventJSON = formatCustomEventJSON;
|
|
76
|
+
function formatUpsertUserAttributesJSON(payload) {
|
|
77
|
+
const { properties, userIdentifiers } = payload;
|
|
78
|
+
if (Object.values(properties ?? {}).some(value => typeof value === 'object' || Array.isArray(value))) {
|
|
79
|
+
throw new actions_core_1.PayloadValidationError('Properties cannot contain objects or arrays.');
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
properties,
|
|
83
|
+
user: formatUser(userIdentifiers)
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
exports.formatUpsertUserAttributesJSON = formatUpsertUserAttributesJSON;
|
|
87
|
+
function formatSubscribeUserJSON(payload) {
|
|
88
|
+
const { externalEventId, occurredAt, userIdentifiers, subscriptionType, signUpSourceId, singleOptIn } = payload;
|
|
89
|
+
return {
|
|
90
|
+
externalEventId,
|
|
91
|
+
occurredAt,
|
|
92
|
+
subscriptionType: subscriptionType,
|
|
93
|
+
locale: formatLocale(payload?.locale),
|
|
94
|
+
signUpSourceId,
|
|
95
|
+
singleOptIn,
|
|
96
|
+
user: formatUser(userIdentifiers)
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
exports.formatSubscribeUserJSON = formatSubscribeUserJSON;
|
|
100
|
+
//# sourceMappingURL=functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/destinations/attentive/functions.ts"],"names":[],"mappings":";;;AAAA,wDAA8D;AAa9D,SAAgB,QAAQ,CAAC,OAA8E;IACrG,MAAM,EACJ,eAAe,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,iBAAiB,EAAE,EACtE,GAAG,OAAO,CAAA;IAEX,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,IAAI,CAAC,YAAY,IAAI,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;QACpF,MAAM,IAAI,qCAAsB,CAAC,2CAA2C,CAAC,CAAA;KAC9E;AACH,CAAC;AARD,4BAQC;AAED,SAAgB,qBAAqB,CAAC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V,eAAe,EAChB,GAAG,OAAO,CAAA;IAEX,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE;QACpG,MAAM,IAAI,qCAAsB,CAAC,8CAA8C,CAAC,CAAA;KACjF;IAED,OAAO;QACL,UAAU;QACV,IAAI,EAAE,UAAU,CAAC,eAAe,CAAC;KAClC,CAAA;AACH,CAAC;AAdD,wEAcC;AAED,SAAgB,uBAAuB,CAAC,OAA2B;IACjE,MAAM,EAAE,eAAe,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,WAAW,EAAE,GAAG,OAAO,CAAA;IAC/G,OAAO;QACL,eAAe;QACf,UAAU;QACV,gBAAgB,EAAE,gBAAoC;QACtD,MAAM,EAAE,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC;QACrC,cAAc;QACd,WAAW;QACX,IAAI,EAAE,UAAU,CAAC,eAAe,CAAC;KAClC,CAAA;AACH,CAAC;AAXD,0DAWC"}
|
|
@@ -5,6 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const actions_core_1 = require("@segment/actions-core");
|
|
7
7
|
const customEvents_1 = __importDefault(require("./customEvents"));
|
|
8
|
+
const ecommEvent_1 = __importDefault(require("./ecommEvent"));
|
|
9
|
+
const upsertUserAttributes_1 = __importDefault(require("./upsertUserAttributes"));
|
|
10
|
+
const subscribeUser_1 = __importDefault(require("./subscribeUser"));
|
|
8
11
|
const destination = {
|
|
9
12
|
name: 'Attentive',
|
|
10
13
|
slug: 'actions-attentive',
|
|
@@ -37,18 +40,58 @@ const destination = {
|
|
|
37
40
|
}
|
|
38
41
|
};
|
|
39
42
|
},
|
|
40
|
-
actions: {
|
|
41
|
-
customEvents: customEvents_1.default
|
|
42
|
-
},
|
|
43
43
|
presets: [
|
|
44
44
|
{
|
|
45
|
-
name: '
|
|
46
|
-
subscribe: 'type = "track"',
|
|
47
|
-
partnerAction: '
|
|
48
|
-
mapping: (0, actions_core_1.defaultValues)(
|
|
45
|
+
name: 'Subscribe User',
|
|
46
|
+
subscribe: 'type = "track" and event = "User Subscribed"',
|
|
47
|
+
partnerAction: 'subscribeUser',
|
|
48
|
+
mapping: (0, actions_core_1.defaultValues)(subscribeUser_1.default.fields),
|
|
49
|
+
type: 'automatic'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'Upsert User Attributes',
|
|
53
|
+
subscribe: 'type = "identify"',
|
|
54
|
+
partnerAction: 'upsertUserAttributes',
|
|
55
|
+
mapping: (0, actions_core_1.defaultValues)(upsertUserAttributes_1.default.fields),
|
|
56
|
+
type: 'automatic'
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'View Item',
|
|
60
|
+
subscribe: 'event = "Product Viewed"',
|
|
61
|
+
partnerAction: 'ecommEvent',
|
|
62
|
+
mapping: {
|
|
63
|
+
...(0, actions_core_1.defaultValues)(ecommEvent_1.default.fields),
|
|
64
|
+
eventType: 'view_item',
|
|
65
|
+
},
|
|
66
|
+
type: 'automatic'
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'Add to Cart',
|
|
70
|
+
subscribe: 'event = "Product Added"',
|
|
71
|
+
partnerAction: 'ecommEvent',
|
|
72
|
+
mapping: {
|
|
73
|
+
...(0, actions_core_1.defaultValues)(ecommEvent_1.default.fields),
|
|
74
|
+
eventType: 'add_to_cart',
|
|
75
|
+
},
|
|
76
|
+
type: 'automatic'
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'Purchase',
|
|
80
|
+
subscribe: 'event = "Order Completed"',
|
|
81
|
+
partnerAction: 'ecommEvent',
|
|
82
|
+
mapping: {
|
|
83
|
+
...(0, actions_core_1.defaultValues)(ecommEvent_1.default.fields),
|
|
84
|
+
eventType: 'purchase',
|
|
85
|
+
},
|
|
49
86
|
type: 'automatic'
|
|
50
87
|
}
|
|
51
|
-
]
|
|
88
|
+
],
|
|
89
|
+
actions: {
|
|
90
|
+
customEvents: customEvents_1.default,
|
|
91
|
+
ecommEvent: ecommEvent_1.default,
|
|
92
|
+
upsertUserAttributes: upsertUserAttributes_1.default,
|
|
93
|
+
subscribeUser: subscribeUser_1.default
|
|
94
|
+
}
|
|
52
95
|
};
|
|
53
96
|
exports.default = destination;
|
|
54
97
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/attentive/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA4E;AAE5E,kEAAyC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/attentive/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA4E;AAE5E,kEAAyC;AACzC,8DAAqC;AACrC,kFAAyD;AACzD,oEAA2C;AAG3C,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,6CAA6C;IAC1D,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,KAAK,EAAE,SAAS;gBAChB,WAAW,EAAE,yBAAyB;gBACtC,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;SACF;QACD,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;YAClD,OAAO,OAAO,CAAC,uCAAuC,EAAE;gBACtD,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,QAAQ,CAAC,MAAM,EAAE;iBAC3C;aACF,CAAC,CAAA;QACJ,CAAC;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AAY;QACZ,UAAU,EAAV,oBAAU;QACV,oBAAoB,EAApB,8BAAoB;QACpB,aAAa,EAAb,uBAAa;KACd;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
userIdentifiers: {
|
|
3
|
+
phone?: string;
|
|
4
|
+
email?: string;
|
|
5
|
+
clientUserId?: string;
|
|
6
|
+
[k: string]: unknown;
|
|
7
|
+
};
|
|
8
|
+
occurredAt?: string;
|
|
9
|
+
externalEventId?: string;
|
|
10
|
+
subscriptionType: string;
|
|
11
|
+
locale?: string;
|
|
12
|
+
signUpSourceId?: string;
|
|
13
|
+
singleOptIn?: boolean;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/attentive/subscribeUser/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fields_1 = require("../fields");
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
const functions_1 = require("../functions");
|
|
6
|
+
const action = {
|
|
7
|
+
title: 'Subscribe User to Attentive',
|
|
8
|
+
description: 'Send a subscription request to Attentive.',
|
|
9
|
+
defaultSubscription: 'type = "track" and event = "User Subscibed"',
|
|
10
|
+
fields: {
|
|
11
|
+
userIdentifiers: fields_1.userIdentifiers,
|
|
12
|
+
occurredAt: fields_1.occurredAt,
|
|
13
|
+
externalEventId: fields_1.externalEventId,
|
|
14
|
+
subscriptionType: fields_1.subscriptionType,
|
|
15
|
+
locale: fields_1.locale,
|
|
16
|
+
signUpSourceId: fields_1.signUpSourceId,
|
|
17
|
+
singleOptIn: fields_1.singleOptIn
|
|
18
|
+
},
|
|
19
|
+
perform: (request, { payload }) => {
|
|
20
|
+
(0, functions_1.validate)(payload);
|
|
21
|
+
(0, functions_1.validateSubscribeUser)(payload);
|
|
22
|
+
return request(`${constants_1.API_URL}/${constants_1.API_VERSION}/subscriptions`, {
|
|
23
|
+
method: 'post',
|
|
24
|
+
json: (0, functions_1.formatSubscribeUserJSON)(payload)
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.default = action;
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/attentive/subscribeUser/index.ts"],"names":[],"mappings":";;AAGA,sCAA+H;AAC/H,4CAAmD;AACnD,4CAAuF;AAEvF,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,6BAA6B;IACpC,WAAW,EAAE,2CAA2C;IACxD,mBAAmB,EAAE,6CAA6C;IAClE,MAAM,EAAE;QACN,eAAe,EAAf,wBAAe;QACf,UAAU,EAAV,mBAAU;QACV,eAAe,EAAf,wBAAe;QACf,gBAAgB,EAAhB,yBAAgB;QAChB,MAAM,EAAN,eAAM;QACN,cAAc,EAAd,uBAAc;QACd,WAAW,EAAX,oBAAW;KACZ;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,IAAA,oBAAQ,EAAC,OAAO,CAAC,CAAA;QACjB,IAAA,iCAAqB,EAAC,OAAO,CAAC,CAAA;QAC9B,OAAO,OAAO,CAAC,GAAG,mBAAO,IAAI,uBAAW,gBAAgB,EAAE;YACxD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAA,mCAAuB,EAAC,OAAO,CAAC;SACvC,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { SegmentEvent } from '@segment/actions-core';
|
|
2
|
+
export declare function getCustomEventsTestValidPayload(timestamp: string): Partial<SegmentEvent>;
|
|
3
|
+
export declare function getCustomEventsTestMapping(): {
|
|
4
|
+
type: {
|
|
5
|
+
'@path': string;
|
|
6
|
+
};
|
|
7
|
+
userIdentifiers: {
|
|
8
|
+
phone: {
|
|
9
|
+
'@path': string;
|
|
10
|
+
};
|
|
11
|
+
email: {
|
|
12
|
+
'@path': string;
|
|
13
|
+
};
|
|
14
|
+
clientUserId: {
|
|
15
|
+
'@path': string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
properties: {
|
|
19
|
+
'@path': string;
|
|
20
|
+
};
|
|
21
|
+
externalEventId: {
|
|
22
|
+
'@path': string;
|
|
23
|
+
};
|
|
24
|
+
occurredAt: {
|
|
25
|
+
'@path': string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export declare function getCustomEventsTestExpectedPayload(validPayload: Record<string, any>): {
|
|
29
|
+
type: any;
|
|
30
|
+
properties: any;
|
|
31
|
+
externalEventId: any;
|
|
32
|
+
occurredAt: any;
|
|
33
|
+
user: {
|
|
34
|
+
phone: any;
|
|
35
|
+
email: any;
|
|
36
|
+
externalIdentifiers: {
|
|
37
|
+
clientUserId: any;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export declare function getECommEventTestValidPayload(timestamp: string): Partial<SegmentEvent>;
|
|
42
|
+
export declare function getECommEventTestMapping(): {
|
|
43
|
+
items: {
|
|
44
|
+
productId: {
|
|
45
|
+
'@path': string;
|
|
46
|
+
};
|
|
47
|
+
productVariantId: {
|
|
48
|
+
'@path': string;
|
|
49
|
+
};
|
|
50
|
+
productImage: {
|
|
51
|
+
'@path': string;
|
|
52
|
+
};
|
|
53
|
+
productUrl: {
|
|
54
|
+
'@path': string;
|
|
55
|
+
};
|
|
56
|
+
name: {
|
|
57
|
+
'@path': string;
|
|
58
|
+
};
|
|
59
|
+
price: {
|
|
60
|
+
value: {
|
|
61
|
+
'@path': string;
|
|
62
|
+
};
|
|
63
|
+
currency: {
|
|
64
|
+
'@path': string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
quantity: {
|
|
68
|
+
'@path': string;
|
|
69
|
+
};
|
|
70
|
+
}[];
|
|
71
|
+
userIdentifiers: {
|
|
72
|
+
phone: {
|
|
73
|
+
'@path': string;
|
|
74
|
+
};
|
|
75
|
+
email: {
|
|
76
|
+
'@path': string;
|
|
77
|
+
};
|
|
78
|
+
clientUserId: {
|
|
79
|
+
'@path': string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
occurredAt: {
|
|
83
|
+
'@path': string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
export declare function getECommEventTestExpectedPayload(validPayload: Record<string, any>): {
|
|
87
|
+
items: any;
|
|
88
|
+
occurredAt: any;
|
|
89
|
+
user: {
|
|
90
|
+
phone: any;
|
|
91
|
+
email: any;
|
|
92
|
+
externalIdentifiers: {
|
|
93
|
+
clientUserId: any;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getECommEventTestExpectedPayload = exports.getECommEventTestMapping = exports.getECommEventTestValidPayload = exports.getCustomEventsTestExpectedPayload = exports.getCustomEventsTestMapping = exports.getCustomEventsTestValidPayload = void 0;
|
|
4
|
+
function getCustomEventsTestValidPayload(timestamp) {
|
|
5
|
+
return {
|
|
6
|
+
timestamp,
|
|
7
|
+
event: 'Event Type 1',
|
|
8
|
+
messageId: '123e4567-e89b-12d3-a456-426614174000',
|
|
9
|
+
type: 'track',
|
|
10
|
+
userId: '123e4567-e89b-12d3-a456-426614174000',
|
|
11
|
+
context: {
|
|
12
|
+
traits: {
|
|
13
|
+
phone: '+3538675765689',
|
|
14
|
+
email: 'test@test.com'
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
properties: {
|
|
18
|
+
tracking_url: 'https://tracking-url.com',
|
|
19
|
+
product_name: 'Product X'
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
exports.getCustomEventsTestValidPayload = getCustomEventsTestValidPayload;
|
|
24
|
+
function getCustomEventsTestMapping() {
|
|
25
|
+
return {
|
|
26
|
+
type: { '@path': '$.event' },
|
|
27
|
+
userIdentifiers: {
|
|
28
|
+
phone: { '@path': '$.context.traits.phone' },
|
|
29
|
+
email: { '@path': '$.context.traits.email' },
|
|
30
|
+
clientUserId: { '@path': '$.userId' }
|
|
31
|
+
},
|
|
32
|
+
properties: { '@path': '$.properties' },
|
|
33
|
+
externalEventId: { '@path': '$.messageId' },
|
|
34
|
+
occurredAt: { '@path': '$.timestamp' }
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
exports.getCustomEventsTestMapping = getCustomEventsTestMapping;
|
|
38
|
+
function getCustomEventsTestExpectedPayload(validPayload) {
|
|
39
|
+
return {
|
|
40
|
+
type: validPayload.type,
|
|
41
|
+
properties: validPayload.properties,
|
|
42
|
+
externalEventId: validPayload.messageId,
|
|
43
|
+
occurredAt: validPayload.timestamp,
|
|
44
|
+
user: {
|
|
45
|
+
phone: validPayload.context?.traits?.phone,
|
|
46
|
+
email: validPayload.context?.traits?.email,
|
|
47
|
+
externalIdentifiers: {
|
|
48
|
+
clientUserId: validPayload.userId
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
exports.getCustomEventsTestExpectedPayload = getCustomEventsTestExpectedPayload;
|
|
54
|
+
function getECommEventTestValidPayload(timestamp) {
|
|
55
|
+
return {
|
|
56
|
+
timestamp,
|
|
57
|
+
event: 'Product Viewed',
|
|
58
|
+
messageId: '123e4567-e89b-12d3-a456-426614174001',
|
|
59
|
+
type: 'track',
|
|
60
|
+
userId: '123e4567-e89b-12d3-a456-426614174001',
|
|
61
|
+
context: {
|
|
62
|
+
traits: {
|
|
63
|
+
phone: '+3538675765689',
|
|
64
|
+
email: 'test@test.com'
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
properties: {
|
|
68
|
+
items: [
|
|
69
|
+
{
|
|
70
|
+
productId: 'prod_123',
|
|
71
|
+
productVariantId: 'var_456',
|
|
72
|
+
productImage: 'https://image-url.com/product.jpg',
|
|
73
|
+
productUrl: 'https://product-url.com',
|
|
74
|
+
name: 'Product X',
|
|
75
|
+
price: {
|
|
76
|
+
value: 29.99,
|
|
77
|
+
currency: 'USD'
|
|
78
|
+
},
|
|
79
|
+
quantity: 1
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
exports.getECommEventTestValidPayload = getECommEventTestValidPayload;
|
|
86
|
+
function getECommEventTestMapping() {
|
|
87
|
+
return {
|
|
88
|
+
items: [
|
|
89
|
+
{
|
|
90
|
+
productId: { '@path': '$.properties.items[0].productId' },
|
|
91
|
+
productVariantId: { '@path': '$.properties.items[0].productVariantId' },
|
|
92
|
+
productImage: { '@path': '$.properties.items[0].productImage' },
|
|
93
|
+
productUrl: { '@path': '$.properties.items[0].productUrl' },
|
|
94
|
+
name: { '@path': '$.properties.items[0].name' },
|
|
95
|
+
price: {
|
|
96
|
+
value: { '@path': '$.properties.items[0].price.value' },
|
|
97
|
+
currency: { '@path': '$.properties.items[0].price.currency' }
|
|
98
|
+
},
|
|
99
|
+
quantity: { '@path': '$.properties.items[0].quantity' }
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
userIdentifiers: {
|
|
103
|
+
phone: { '@path': '$.context.traits.phone' },
|
|
104
|
+
email: { '@path': '$.context.traits.email' },
|
|
105
|
+
clientUserId: { '@path': '$.userId' }
|
|
106
|
+
},
|
|
107
|
+
occurredAt: { '@path': '$.timestamp' }
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
exports.getECommEventTestMapping = getECommEventTestMapping;
|
|
111
|
+
function getECommEventTestExpectedPayload(validPayload) {
|
|
112
|
+
return {
|
|
113
|
+
items: validPayload.properties?.items,
|
|
114
|
+
occurredAt: validPayload.timestamp,
|
|
115
|
+
user: {
|
|
116
|
+
phone: validPayload.context?.traits?.phone,
|
|
117
|
+
email: validPayload.context?.traits?.email,
|
|
118
|
+
externalIdentifiers: {
|
|
119
|
+
clientUserId: validPayload.userId
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
exports.getECommEventTestExpectedPayload = getECommEventTestExpectedPayload;
|
|
125
|
+
//# sourceMappingURL=test-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-data.js","sourceRoot":"","sources":["../../../src/destinations/attentive/test-data.ts"],"names":[],"mappings":";;;AAGA,SAAgB,+BAA+B,CAAC,SAAiB;IAC/D,OAAO;QACL,SAAS;QACT,KAAK,EAAE,cAAc;QACrB,SAAS,EAAE,sCAAsC;QACjD,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,sCAAsC;QAC9C,OAAO,EAAE;YACP,MAAM,EAAE;gBACN,KAAK,EAAE,gBAAgB;gBACvB,KAAK,EAAE,eAAe;aACvB;SACF;QACD,UAAU,EAAE;YACV,YAAY,EAAE,0BAA0B;YACxC,YAAY,EAAE,WAAW;SAC1B;KACF,CAAA;AACH,CAAC;AAlBD,0EAkBC;AAED,SAAgB,0BAA0B;IACxC,OAAO;QACL,IAAI,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;QAC5B,eAAe,EAAE;YACf,KAAK,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE;YAC5C,KAAK,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE;YAC5C,YAAY,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;SACtC;QACD,UAAU,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;QACvC,eAAe,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;QAC3C,UAAU,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;KACvC,CAAA;AACH,CAAC;AAZD,gEAYC;AAED,SAA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AAU,EAAE,EAAE,OAAO,EAAE,kCAAkC,EAAE;gBAC3D,IAAI,EAAE,EAAE,OAAO,EAAE,4BAA4B,EAAE;gBAC/C,KAAK,EAAE;oBACL,KAAK,EAAE,EAAE,OAAO,EAAE,mCAAmC,EAAE;oBACvD,QAAQ,EAAE,EAAE,OAAO,EAAE,sCAAsC,EAAE;iBAC9D;gBACD,QAAQ,EAAE,EAAE,OAAO,EAAE,gCAAgC,EAAE;aACxD;SACF;QACD,eAAe,EAAE;YACf,KAAK,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE;YAC5C,KAAK,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE;YAC5C,YAAY,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;SACtC;QACD,UAAU,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;KACvC,CAAA;AACH,CAAC;AAvBD,4DAuBC;AAED,SAAgB,gCAAgC,CAAC,YAAiC;IAChF,OAAO;QACL,KAAK,EAAE,YAAY,CAAC,UAAU,EAAE,KAAK;QACrC,UAAU,EAAE,YAAY,CAAC,SAAS;QAClC,IAAI,EAAE;YACJ,KAAK,EAAE,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK;YAC1C,KAAK,EAAE,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK;YAC1C,mBAAmB,EAAE;gBACnB,YAAY,EAAE,YAAY,CAAC,MAAM;aAClC;SACF;KACF,CAAA;AACH,CAAC;AAZD,4EAYC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { SUBSCRIPTION_TYPES } from "./constants";
|
|
2
|
+
export interface EcommEventJSON {
|
|
3
|
+
items: Item[];
|
|
4
|
+
occurredAt?: string;
|
|
5
|
+
user: User;
|
|
6
|
+
}
|
|
7
|
+
export interface CustomEventJSON {
|
|
8
|
+
externalEventId?: string;
|
|
9
|
+
occurredAt?: string;
|
|
10
|
+
user: User;
|
|
11
|
+
type: string;
|
|
12
|
+
properties?: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
export interface UpsertUserAttributesJSON {
|
|
15
|
+
properties: Record<string, unknown>;
|
|
16
|
+
user: User;
|
|
17
|
+
}
|
|
18
|
+
export interface SubscribeUserJSON {
|
|
19
|
+
externalEventId?: string;
|
|
20
|
+
occurredAt?: string;
|
|
21
|
+
user: User;
|
|
22
|
+
subscriptionType: SubscriptionType;
|
|
23
|
+
locale?: {
|
|
24
|
+
language: string;
|
|
25
|
+
country: string;
|
|
26
|
+
};
|
|
27
|
+
signUpSourceId?: string;
|
|
28
|
+
singleOptIn?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface User {
|
|
31
|
+
phone?: string;
|
|
32
|
+
email?: string;
|
|
33
|
+
externalIdentifiers?: ExternalIdentifiers;
|
|
34
|
+
}
|
|
35
|
+
export interface ExternalIdentifiers {
|
|
36
|
+
clientUserId?: string;
|
|
37
|
+
customIdentifiers?: Record<string, unknown>;
|
|
38
|
+
}
|
|
39
|
+
export interface Item {
|
|
40
|
+
productId: string;
|
|
41
|
+
productVariantId: string;
|
|
42
|
+
productImage?: string;
|
|
43
|
+
productUrl?: string;
|
|
44
|
+
name?: string;
|
|
45
|
+
price: {
|
|
46
|
+
value: number;
|
|
47
|
+
currency?: string;
|
|
48
|
+
};
|
|
49
|
+
quantity?: number;
|
|
50
|
+
}
|
|
51
|
+
export type SubscriptionType = typeof SUBSCRIPTION_TYPES[number];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/destinations/attentive/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/attentive/upsertUserAttributes/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fields_1 = require("../fields");
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
const functions_1 = require("../functions");
|
|
6
|
+
const action = {
|
|
7
|
+
title: 'Upsert Custom Attributes',
|
|
8
|
+
description: 'Upserts custom attributes on a user profile in Attentive.',
|
|
9
|
+
defaultSubscription: 'type = "identify"',
|
|
10
|
+
fields: {
|
|
11
|
+
userIdentifiers: fields_1.userIdentifiers,
|
|
12
|
+
properties: {
|
|
13
|
+
...fields_1.properties,
|
|
14
|
+
default: {
|
|
15
|
+
'@path': '$.traits'
|
|
16
|
+
},
|
|
17
|
+
required: true
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
perform: (request, { payload }) => {
|
|
21
|
+
(0, functions_1.validate)(payload);
|
|
22
|
+
return request(`${constants_1.API_URL}/${constants_1.API_VERSION}/attributes/custom`, {
|
|
23
|
+
method: 'post',
|
|
24
|
+
json: (0, functions_1.formatUpsertUserAttributesJSON)(payload)
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.default = action;
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/attentive/upsertUserAttributes/index.ts"],"names":[],"mappings":";;AAGA,sCAAuD;AACvD,4CAAmD;AACnD,4CAAuE;AAEvE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,0BAA0B;IACjC,WAAW,EAAE,2DAA2D;IACxE,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,eAAe,EAAf,wBAAe;QACf,UAAU,EAAE;YACV,GAAG,mBAAU;YACb,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;YACD,QAAQ,EAAE,IAAI;SACf;KACF;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,IAAA,oBAAQ,EAAC,OAAO,CAAC,CAAA;QACjB,OAAO,OAAO,CAAC,GAAG,mBAAO,IAAI,uBAAW,oBAAoB,EAAE;YAC5D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAA,0CAA8B,EAAC,OAAO,CAAC;SAC9C,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -135,6 +135,14 @@ exports.commonFields = {
|
|
|
135
135
|
required: true,
|
|
136
136
|
unsafe_hidden: true,
|
|
137
137
|
default: constants_1.MAX_HUBSPOT_BATCH_SIZE
|
|
138
|
+
},
|
|
139
|
+
timestamp: {
|
|
140
|
+
label: 'Timestamp',
|
|
141
|
+
description: 'The time the event occurred. This will be used to de-duplicate the events before sending them to hubspot.',
|
|
142
|
+
type: 'string',
|
|
143
|
+
required: false,
|
|
144
|
+
default: { '@path': '$.timestamp' },
|
|
145
|
+
disabledInputMethods: ['literal', 'variable', 'function', 'freeform', 'enrichment']
|
|
138
146
|
}
|
|
139
147
|
};
|
|
140
148
|
//# sourceMappingURL=common-fields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common-fields.js","sourceRoot":"","sources":["../../../../src/destinations/hubspot/upsertObject/common-fields.ts"],"names":[],"mappings":";;;AACA,2CAAoD;AAEvC,QAAA,YAAY,GAA+B;IACtD,cAAc,EAAE;QACd,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,oDAAoD;QACjE,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,eAAe,EAAE,eAAe;QAChC,oBAAoB,EAAE,KAAK;QAC3B,UAAU,EAAE;YACV,WAAW,EAAE;gBACX,KAAK,EAAE,aAAa;gBACpB,WAAW,EAAE,wDAAwD;gBACrE,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;gBACd,SAAS,EAAE,KAAK;gBAChB,OAAO,EAAE,IAAI;gBACb,oBAAoB,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,CAAC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,UAAU,EAAE,YAAY,CAAC;aACpF;YACD,cAAc,EAAE;gBACd,KAAK,EAAE,0BAA0B;gBACjC,WAAW,EAAE,kEAAkE;gBAC/E,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,KAAK;aAChB;SACF;KACF;IACD,eAAe,EAAE;QACf,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,kCAAkC;QACzC,WAAW,EAAE,+CAA+C;QAC5D,OAAO,EAAE,IAAI;QACb,aAAa,EAAE,IAAI;KACpB;IACD,UAAU,EAAE;QACV,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,oDAAoD;QACjE,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,aAAa,EAAE,IAAI;QACnB,OAAO,EAAE,kCAAsB;KAChC;CACF,CAAA"}
|
|
1
|
+
{"version":3,"file":"common-fields.js","sourceRoot":"","sources":["../../../../src/destinations/hubspot/upsertObject/common-fields.ts"],"names":[],"mappings":";;;AACA,2CAAoD;AAEvC,QAAA,YAAY,GAA+B;IACtD,cAAc,EAAE;QACd,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,oDAAoD;QACjE,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,eAAe,EAAE,eAAe;QAChC,oBAAoB,EAAE,KAAK;QAC3B,UAAU,EAAE;YACV,WAAW,EAAE;gBACX,KAAK,EAAE,aAAa;gBACpB,WAAW,EAAE,wDAAwD;gBACrE,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;gBACd,SAAS,EAAE,KAAK;gBAChB,OAAO,EAAE,IAAI;gBACb,oBAAoB,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,CAAC;aACpF;YACD,aAAa,EAAE;gBACb,KAAK,EAAE,sBAAsB;gBAC7B,WAAW,EAAE,0CAA0C;gBACvD,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;gBACd,SAAS,EAAE,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