@segment/action-destinations 3.342.0 → 3.343.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/facebook-conversions-api/addToCart/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/addToCart/index.js +4 -2
- package/dist/destinations/facebook-conversions-api/addToCart/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/addToCart2/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/addToCart2/index.js +4 -2
- package/dist/destinations/facebook-conversions-api/addToCart2/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/custom/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/custom/index.js +4 -2
- package/dist/destinations/facebook-conversions-api/custom/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/custom2/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/custom2/index.js +4 -2
- package/dist/destinations/facebook-conversions-api/custom2/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/fb-capi-properties.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/fb-capi-properties.js +7 -1
- package/dist/destinations/facebook-conversions-api/fb-capi-properties.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/index.js +1 -1
- package/dist/destinations/facebook-conversions-api/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/initiateCheckout/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/initiateCheckout/index.js +4 -2
- package/dist/destinations/facebook-conversions-api/initiateCheckout/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/initiateCheckout2/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/initiateCheckout2/index.js +4 -2
- package/dist/destinations/facebook-conversions-api/initiateCheckout2/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/pageView/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/pageView/index.js +4 -2
- package/dist/destinations/facebook-conversions-api/pageView/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/pageView2/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/pageView2/index.js +4 -2
- package/dist/destinations/facebook-conversions-api/pageView2/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/purchase/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/purchase/index.js +4 -2
- package/dist/destinations/facebook-conversions-api/purchase/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/purchase2/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/purchase2/index.js +4 -2
- package/dist/destinations/facebook-conversions-api/purchase2/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/search/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/search/index.js +4 -2
- package/dist/destinations/facebook-conversions-api/search/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/search2/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/search2/index.js +4 -2
- package/dist/destinations/facebook-conversions-api/search2/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/viewContent/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/viewContent/index.js +4 -2
- package/dist/destinations/facebook-conversions-api/viewContent/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/viewContent2/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/viewContent2/index.js +4 -2
- package/dist/destinations/facebook-conversions-api/viewContent2/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/functions.d.ts +24 -0
- package/dist/destinations/google-enhanced-conversions/functions.js +9 -2
- package/dist/destinations/google-enhanced-conversions/functions.js.map +1 -1
- package/dist/destinations/hubspot/upsertCompany/index.js +10 -10
- package/dist/destinations/hubspot/upsertCompany/index.js.map +1 -1
- package/dist/destinations/hubspot/upsertContact/index.js +12 -12
- package/dist/destinations/hubspot/upsertContact/index.js.map +1 -1
- package/dist/destinations/hubspot/utils.js +4 -0
- package/dist/destinations/hubspot/utils.js.map +1 -1
- package/dist/destinations/index.js +2 -0
- package/dist/destinations/index.js.map +1 -1
- package/dist/destinations/iterable/trackEvent/index.js +1 -1
- package/dist/destinations/iterable/trackEvent/index.js.map +1 -1
- package/dist/destinations/iterable/updateUser/index.js +1 -1
- package/dist/destinations/iterable/updateUser/index.js.map +1 -1
- package/dist/destinations/iterable-lists/generated-types.d.ts +1 -1
- package/dist/destinations/iterable-lists/index.js +2 -2
- package/dist/destinations/iterable-lists/index.js.map +1 -1
- package/dist/destinations/iterable-lists/syncAudience/generated-types.d.ts +3 -1
- package/dist/destinations/iterable-lists/syncAudience/index.js +3 -3
- package/dist/destinations/iterable-lists/syncAudience/index.js.map +1 -1
- package/dist/destinations/iterable-lists/syncAudience/iterable-client.d.ts +1 -1
- package/dist/destinations/iterable-lists/syncAudience/iterable-client.js +9 -13
- package/dist/destinations/iterable-lists/syncAudience/iterable-client.js.map +1 -1
- package/dist/destinations/klaviyo/orderCompleted/index.js +1 -1
- package/dist/destinations/klaviyo/orderCompleted/index.js.map +1 -1
- package/dist/destinations/recombee/addBookmark/index.js +1 -1
- package/dist/destinations/recombee/addBookmark/index.js.map +1 -1
- package/dist/destinations/recombee/addCartAddition/generated-types.d.ts +2 -2
- package/dist/destinations/recombee/addCartAddition/index.js +17 -27
- package/dist/destinations/recombee/addCartAddition/index.js.map +1 -1
- package/dist/destinations/recombee/commonFields.js +3 -3
- package/dist/destinations/recombee/commonFields.js.map +1 -1
- package/dist/destinations/recombee/index.js +7 -1
- package/dist/destinations/recombee/index.js.map +1 -1
- package/dist/destinations/responsys/index.js +14 -5
- package/dist/destinations/responsys/index.js.map +1 -1
- package/dist/destinations/responsys/sendAudience/index.js +1 -1
- package/dist/destinations/responsys/sendAudienceAsPet/functions.d.ts +10 -0
- package/dist/destinations/responsys/sendAudienceAsPet/functions.js +152 -0
- package/dist/destinations/responsys/sendAudienceAsPet/functions.js.map +1 -0
- package/dist/destinations/responsys/sendAudienceAsPet/generated-types.d.ts +15 -0
- package/dist/destinations/responsys/sendAudienceAsPet/generated-types.js +3 -0
- package/dist/destinations/responsys/sendAudienceAsPet/generated-types.js.map +1 -0
- package/dist/destinations/responsys/sendAudienceAsPet/index.d.ts +5 -0
- package/dist/destinations/responsys/sendAudienceAsPet/index.js +143 -0
- package/dist/destinations/responsys/sendAudienceAsPet/index.js.map +1 -0
- package/dist/destinations/responsys/sendCustomTraits/index.js +1 -1
- package/dist/destinations/responsys/{shared_properties.js → shared-properties.js} +1 -1
- package/dist/destinations/responsys/{shared_properties.js.map → shared-properties.js.map} +1 -1
- package/dist/destinations/responsys/types.d.ts +18 -9
- package/dist/destinations/responsys/upsertListMember/index.js +1 -1
- package/dist/destinations/responsys/utils.d.ts +5 -4
- package/dist/destinations/responsys/utils.js +14 -42
- package/dist/destinations/responsys/utils.js.map +1 -1
- package/dist/destinations/sendgrid/sendEmail/constants.d.ts +1 -0
- package/dist/destinations/sendgrid/sendEmail/constants.js +2 -1
- package/dist/destinations/sendgrid/sendEmail/constants.js.map +1 -1
- package/dist/destinations/sendgrid/sendEmail/dynamic-fields.d.ts +2 -0
- package/dist/destinations/sendgrid/sendEmail/dynamic-fields.js +61 -10
- package/dist/destinations/sendgrid/sendEmail/dynamic-fields.js.map +1 -1
- package/dist/destinations/sendgrid/sendEmail/fields.js +36 -116
- package/dist/destinations/sendgrid/sendEmail/fields.js.map +1 -1
- package/dist/destinations/sendgrid/sendEmail/generated-types.d.ts +1 -17
- package/dist/destinations/sendgrid/sendEmail/index.js +5 -0
- package/dist/destinations/sendgrid/sendEmail/index.js.map +1 -1
- package/dist/destinations/sendgrid/sendEmail/types.d.ts +0 -19
- package/dist/destinations/sendgrid/sendEmail/utils.d.ts +2 -0
- package/dist/destinations/sendgrid/sendEmail/utils.js +29 -26
- package/dist/destinations/sendgrid/sendEmail/utils.js.map +1 -1
- package/dist/destinations/sendgrid-audiences/constants.d.ts +8 -0
- package/dist/destinations/sendgrid-audiences/constants.js +12 -0
- package/dist/destinations/sendgrid-audiences/constants.js.map +1 -0
- package/dist/destinations/sendgrid-audiences/generated-types.d.ts +6 -0
- package/dist/destinations/sendgrid-audiences/generated-types.js +3 -0
- package/dist/destinations/sendgrid-audiences/generated-types.js.map +1 -0
- package/dist/destinations/sendgrid-audiences/index.d.ts +4 -0
- package/dist/destinations/sendgrid-audiences/index.js +70 -0
- package/dist/destinations/sendgrid-audiences/index.js.map +1 -0
- package/dist/destinations/sendgrid-audiences/syncAudience/fields.d.ts +2 -0
- package/dist/destinations/sendgrid-audiences/syncAudience/fields.js +114 -0
- package/dist/destinations/sendgrid-audiences/syncAudience/fields.js.map +1 -0
- package/dist/destinations/sendgrid-audiences/syncAudience/generated-types.d.ts +14 -0
- package/dist/destinations/sendgrid-audiences/syncAudience/generated-types.js +3 -0
- package/dist/destinations/sendgrid-audiences/syncAudience/generated-types.js.map +1 -0
- package/dist/destinations/sendgrid-audiences/syncAudience/index.d.ts +5 -0
- package/dist/destinations/sendgrid-audiences/syncAudience/index.js +18 -0
- package/dist/destinations/sendgrid-audiences/syncAudience/index.js.map +1 -0
- package/dist/destinations/sendgrid-audiences/syncAudience/utils.d.ts +3 -0
- package/dist/destinations/sendgrid-audiences/syncAudience/utils.js +106 -0
- package/dist/destinations/sendgrid-audiences/syncAudience/utils.js.map +1 -0
- package/dist/destinations/sendgrid-audiences/types.d.ts +41 -0
- package/dist/destinations/sendgrid-audiences/types.js +3 -0
- package/dist/destinations/sendgrid-audiences/types.js.map +1 -0
- package/dist/destinations/singlestore/index.js +1 -1
- package/dist/destinations/singlestore/index.js.map +1 -1
- package/dist/destinations/snap-audiences/index.js +77 -17
- package/dist/destinations/snap-audiences/index.js.map +1 -1
- package/dist/destinations/sprig/generated-types.d.ts +3 -0
- package/dist/destinations/sprig/generated-types.js +3 -0
- package/dist/destinations/sprig/generated-types.js.map +1 -0
- package/dist/destinations/sprig/identifyUser/generated-types.d.ts +6 -0
- package/dist/destinations/sprig/identifyUser/generated-types.js +3 -0
- package/dist/destinations/sprig/identifyUser/generated-types.js.map +1 -0
- package/dist/destinations/sprig/identifyUser/index.d.ts +5 -0
- package/dist/destinations/sprig/identifyUser/index.js +38 -0
- package/dist/destinations/sprig/identifyUser/index.js.map +1 -0
- package/dist/destinations/sprig/identifyUser/utils.d.ts +8 -0
- package/dist/destinations/sprig/identifyUser/utils.js +22 -0
- package/dist/destinations/sprig/identifyUser/utils.js.map +1 -0
- package/dist/destinations/sprig/index.d.ts +4 -0
- package/dist/destinations/sprig/index.js +59 -0
- package/dist/destinations/sprig/index.js.map +1 -0
- package/dist/destinations/sprig/trackEvent/generated-types.d.ts +5 -0
- package/dist/destinations/sprig/trackEvent/generated-types.js +3 -0
- package/dist/destinations/sprig/trackEvent/generated-types.js.map +1 -0
- package/dist/destinations/sprig/trackEvent/index.d.ts +5 -0
- package/dist/destinations/sprig/trackEvent/index.js +47 -0
- package/dist/destinations/sprig/trackEvent/index.js.map +1 -0
- package/dist/destinations/sprig/trackEvent/utils.d.ts +8 -0
- package/dist/destinations/sprig/trackEvent/utils.js +16 -0
- package/dist/destinations/sprig/trackEvent/utils.js.map +1 -0
- package/package.json +2 -2
- /package/dist/destinations/responsys/{shared_properties.d.ts → shared-properties.d.ts} +0 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fields = void 0;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
exports.fields = {
|
|
6
|
+
segment_computation_action: {
|
|
7
|
+
label: 'Segment Computation Class',
|
|
8
|
+
description: "Segment computation class used to determine if input event is from an Engage Audience'. Value must be = 'audience'.",
|
|
9
|
+
type: 'string',
|
|
10
|
+
unsafe_hidden: true,
|
|
11
|
+
required: true,
|
|
12
|
+
default: {
|
|
13
|
+
'@path': '$.context.personas.computation_class'
|
|
14
|
+
},
|
|
15
|
+
choices: [{ label: 'audience', value: 'audience' }]
|
|
16
|
+
},
|
|
17
|
+
external_audience_id: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
label: 'Audience ID',
|
|
20
|
+
description: 'Unique Audience Identifier returned by the createAudience() function call.',
|
|
21
|
+
required: true,
|
|
22
|
+
unsafe_hidden: true,
|
|
23
|
+
default: {
|
|
24
|
+
'@path': '$.context.personas.external_audience_id'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
segment_audience_key: {
|
|
28
|
+
label: 'Audience Key',
|
|
29
|
+
description: 'Segment Audience key',
|
|
30
|
+
type: 'string',
|
|
31
|
+
unsafe_hidden: true,
|
|
32
|
+
required: true,
|
|
33
|
+
default: {
|
|
34
|
+
'@path': '$.context.personas.computation_key'
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
traits_or_props: {
|
|
38
|
+
label: 'Traits or properties object',
|
|
39
|
+
description: 'A computed object for track and identify events. This field should not need to be edited.',
|
|
40
|
+
type: 'object',
|
|
41
|
+
required: true,
|
|
42
|
+
unsafe_hidden: true,
|
|
43
|
+
default: {
|
|
44
|
+
'@if': {
|
|
45
|
+
exists: { '@path': '$.properties' },
|
|
46
|
+
then: { '@path': '$.properties' },
|
|
47
|
+
else: { '@path': '$.traits' }
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
email: {
|
|
52
|
+
label: 'Email Address',
|
|
53
|
+
description: `The contact's email address.`,
|
|
54
|
+
type: 'string',
|
|
55
|
+
required: false,
|
|
56
|
+
default: {
|
|
57
|
+
'@if': {
|
|
58
|
+
exists: { '@path': '$.traits.email' },
|
|
59
|
+
then: { '@path': '$.traits.email' },
|
|
60
|
+
else: { '@path': '$.properties.email' }
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
anonymous_id: {
|
|
65
|
+
label: 'Anonymous ID',
|
|
66
|
+
description: `The contact's anonymous ID.`,
|
|
67
|
+
type: 'string',
|
|
68
|
+
required: false,
|
|
69
|
+
default: { '@path': '$.anonymousId' }
|
|
70
|
+
},
|
|
71
|
+
external_id: {
|
|
72
|
+
label: 'External ID',
|
|
73
|
+
description: `The contact's external ID.`,
|
|
74
|
+
type: 'string',
|
|
75
|
+
required: false,
|
|
76
|
+
default: {
|
|
77
|
+
'@if': {
|
|
78
|
+
exists: { '@path': '$.traits.external_id' },
|
|
79
|
+
then: { '@path': '$.traits.external_id' },
|
|
80
|
+
else: { '@path': '$.properties.external_id' }
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
phone_number_id: {
|
|
85
|
+
label: 'Phone Number ID',
|
|
86
|
+
description: `The contact's primary phone number. Should include the country code e.g. +19876543213.`,
|
|
87
|
+
type: 'string',
|
|
88
|
+
required: false,
|
|
89
|
+
default: {
|
|
90
|
+
'@if': {
|
|
91
|
+
exists: { '@path': '$.traits.phone' },
|
|
92
|
+
then: { '@path': '$.traits.phone' },
|
|
93
|
+
else: { '@path': '$.properties.phone' }
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
enable_batching: {
|
|
98
|
+
type: 'boolean',
|
|
99
|
+
label: 'Batch events',
|
|
100
|
+
description: 'When enabled, the action will batch events before sending them to Sendgrid.',
|
|
101
|
+
unsafe_hidden: true,
|
|
102
|
+
required: true,
|
|
103
|
+
default: true
|
|
104
|
+
},
|
|
105
|
+
batch_size: {
|
|
106
|
+
type: 'number',
|
|
107
|
+
label: 'Max batch size',
|
|
108
|
+
description: 'The maximum number of events to batch when sending data to Reddit.',
|
|
109
|
+
unsafe_hidden: true,
|
|
110
|
+
required: false,
|
|
111
|
+
default: constants_1.MAX_BATCH_SIZE
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../src/destinations/sendgrid-audiences/syncAudience/fields.ts"],"names":[],"mappings":";;;AACA,4CAA6C;AAEhC,QAAA,M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,KAAK;QACf,OAAO,EAAE,0BAAc;KACxB;CACF,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
segment_computation_action: string;
|
|
3
|
+
external_audience_id: string;
|
|
4
|
+
segment_audience_key: string;
|
|
5
|
+
traits_or_props: {
|
|
6
|
+
[k: string]: unknown;
|
|
7
|
+
};
|
|
8
|
+
email?: string;
|
|
9
|
+
anonymous_id?: string;
|
|
10
|
+
external_id?: string;
|
|
11
|
+
phone_number_id?: string;
|
|
12
|
+
enable_batching: boolean;
|
|
13
|
+
batch_size?: number;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/sendgrid-audiences/syncAudience/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("./utils");
|
|
4
|
+
const fields_1 = require("./fields");
|
|
5
|
+
const action = {
|
|
6
|
+
title: 'Sync Audience',
|
|
7
|
+
description: 'Sync a Segment Engage Audience to a Sendgrid List',
|
|
8
|
+
defaultSubscription: 'type = "identify" or type = "track"',
|
|
9
|
+
fields: fields_1.fields,
|
|
10
|
+
perform: async (request, { payload }) => {
|
|
11
|
+
return await utils_1.send(request, [payload]);
|
|
12
|
+
},
|
|
13
|
+
performBatch: async (request, { payload }) => {
|
|
14
|
+
return await utils_1.send(request, payload);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
exports.default = action;
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/sendgrid-audiences/syncAudience/index.ts"],"names":[],"mappings":";;AAGA,mCAA8B;AAC9B,qCAAiC;AAEjC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,mDAAmD;IAChE,mBAAmB,EAAE,qCAAqC;IAC1D,MAAM,EAAN,eAAM;IACN,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACtC,OAAO,MAAM,YAAI,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;IACvC,CAAC;IACD,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAC3C,OAAO,MAAM,YAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACrC,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,106 @@
|
|
|
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
|
+
exports.send = void 0;
|
|
7
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
8
|
+
const constants_1 = require("../constants");
|
|
9
|
+
const chunk_1 = __importDefault(require("lodash/chunk"));
|
|
10
|
+
async function send(request, payload) {
|
|
11
|
+
const payloads = validate(payload);
|
|
12
|
+
const { add, remove } = ((payloads) => payloads.reduce((acc, payload) => {
|
|
13
|
+
acc[payload.traits_or_props[payload.segment_audience_key] ? 'add' : 'remove'].push(payload);
|
|
14
|
+
return acc;
|
|
15
|
+
}, { add: [], remove: [] }))(payloads);
|
|
16
|
+
if (add.length > 0) {
|
|
17
|
+
const json = {
|
|
18
|
+
list_ids: [add[0].external_audience_id],
|
|
19
|
+
contacts: add.map((payload) => ({
|
|
20
|
+
email: payload.email ?? undefined,
|
|
21
|
+
phone_number_id: payload.phone_number_id ?? undefined,
|
|
22
|
+
external_id: payload.external_id ?? undefined,
|
|
23
|
+
anonymous_id: payload.anonymous_id ?? undefined
|
|
24
|
+
}))
|
|
25
|
+
};
|
|
26
|
+
await request(constants_1.UPSERT_CONTACTS_URL, {
|
|
27
|
+
method: 'put',
|
|
28
|
+
json
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
if (remove.length > 0) {
|
|
32
|
+
const identifiers = ['email', 'phone_number_id', 'external_id', 'anonymous_id'];
|
|
33
|
+
const chunks = chunkPayloads(remove);
|
|
34
|
+
const queries = chunks.map((c) => identifiers
|
|
35
|
+
.map((identifier) => getQueryPart(identifier, c))
|
|
36
|
+
.filter((query) => query !== "")
|
|
37
|
+
.join(' OR '));
|
|
38
|
+
const responses = await Promise.all(queries.map((query) => request(constants_1.SEARCH_CONTACTS_URL, {
|
|
39
|
+
method: 'post',
|
|
40
|
+
json: {
|
|
41
|
+
query
|
|
42
|
+
}
|
|
43
|
+
})));
|
|
44
|
+
const contact_ids = responses.flatMap((response) => response.data.result.map((item) => item.id));
|
|
45
|
+
const chunkedContactIds = chunk_1.default(contact_ids, constants_1.MAX_CHUNK_SIZE_REMOVE);
|
|
46
|
+
const listId = remove[0].external_audience_id;
|
|
47
|
+
await Promise.all(chunkedContactIds.map(async (c) => {
|
|
48
|
+
const url = constants_1.REMOVE_CONTACTS_FROM_LIST_URL.replace('{list_id}', listId).replace('{contact_ids}', c.join(','));
|
|
49
|
+
if (c.length > 0) {
|
|
50
|
+
await request(url, {
|
|
51
|
+
method: 'delete',
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.send = send;
|
|
58
|
+
function chunkPayloads(payloads) {
|
|
59
|
+
const chunks = [];
|
|
60
|
+
let currentChunk = [];
|
|
61
|
+
let currentChunkSize = 0;
|
|
62
|
+
for (const payload of payloads) {
|
|
63
|
+
const idCount = [payload.email, payload.phone_number_id, payload.external_id, payload.anonymous_id].filter(Boolean).length;
|
|
64
|
+
if (currentChunkSize + idCount > constants_1.MAX_CHUNK_SIZE_SEARCH) {
|
|
65
|
+
chunks.push(currentChunk);
|
|
66
|
+
currentChunk = [];
|
|
67
|
+
currentChunkSize = 0;
|
|
68
|
+
}
|
|
69
|
+
currentChunk.push(payload);
|
|
70
|
+
currentChunkSize += idCount;
|
|
71
|
+
}
|
|
72
|
+
if (currentChunk.length) {
|
|
73
|
+
chunks.push(currentChunk);
|
|
74
|
+
}
|
|
75
|
+
return chunks;
|
|
76
|
+
}
|
|
77
|
+
function getQueryPart(identifier, payloads) {
|
|
78
|
+
const values = payloads
|
|
79
|
+
.filter((payload) => payload[identifier] !== undefined && payload[identifier] !== null)
|
|
80
|
+
.map((payload) => payload[identifier]);
|
|
81
|
+
const part = values.length > 0 ? `${identifier} IN (${values.map((value) => `'${value}'`).join(',')})` : "";
|
|
82
|
+
return part;
|
|
83
|
+
}
|
|
84
|
+
function validate(payloads) {
|
|
85
|
+
if (payloads[0].external_audience_id == null) {
|
|
86
|
+
throw new actions_core_1.PayloadValidationError('external_audience_id value is missing from payload');
|
|
87
|
+
}
|
|
88
|
+
const isBatch = payloads.length > 1;
|
|
89
|
+
const validPayloads = payloads.filter((p) => {
|
|
90
|
+
const hasRequiredField = [p.email, p.anonymous_id, p.external_id, p.phone_number_id].some(Boolean);
|
|
91
|
+
if (!hasRequiredField) {
|
|
92
|
+
if (!isBatch) {
|
|
93
|
+
throw new actions_core_1.PayloadValidationError('At least one of email, anonymous_id, external_id or phone_number_id is required');
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return true;
|
|
100
|
+
});
|
|
101
|
+
if (validPayloads.length == 0) {
|
|
102
|
+
throw new actions_core_1.PayloadValidationError('No valid payloads found');
|
|
103
|
+
}
|
|
104
|
+
return validPayloads;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/destinations/sendgrid-audiences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string;
|
|
7
|
+
}
|
|
8
|
+
export interface UpsertContactsReq {
|
|
9
|
+
list_ids: string[];
|
|
10
|
+
contacts: Array<{
|
|
11
|
+
external_id?: string;
|
|
12
|
+
email?: string;
|
|
13
|
+
phone_number_id?: string;
|
|
14
|
+
anonymous_id?: string;
|
|
15
|
+
} & ({
|
|
16
|
+
external_id: string;
|
|
17
|
+
} | {
|
|
18
|
+
email: string;
|
|
19
|
+
} | {
|
|
20
|
+
phone_number_id: string;
|
|
21
|
+
} | {
|
|
22
|
+
anonymous_id: string;
|
|
23
|
+
})>;
|
|
24
|
+
}
|
|
25
|
+
export interface SearchContactsResp {
|
|
26
|
+
result: Array<{
|
|
27
|
+
id: string;
|
|
28
|
+
external_id?: string;
|
|
29
|
+
email?: string;
|
|
30
|
+
phone_number_id?: string;
|
|
31
|
+
anonymous_id?: string;
|
|
32
|
+
} & ({
|
|
33
|
+
external_id: string;
|
|
34
|
+
} | {
|
|
35
|
+
email: string;
|
|
36
|
+
} | {
|
|
37
|
+
phone_number_id: string;
|
|
38
|
+
} | {
|
|
39
|
+
anonymous_id: string;
|
|
40
|
+
})>;
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/destinations/sendgrid-audiences/types.ts"],"names":[],"mappings":""}
|
|
@@ -71,7 +71,7 @@ const destination = {
|
|
|
71
71
|
throw new actions_core_1.IntegrationError('Destination Id is missing', 'MISSING_DESTINATION_ID', 400);
|
|
72
72
|
}
|
|
73
73
|
const kafkaTopic = crypto_1.createHash('sha256').update(destination_id).digest('hex');
|
|
74
|
-
const kafkaUsername = crypto_1.createHash('sha256').update(`${
|
|
74
|
+
const kafkaUsername = crypto_1.createHash('sha256').update(`${destination_id}_user`).digest('hex');
|
|
75
75
|
const kafkaPassword = util_1.encryptText(kafkaUsername);
|
|
76
76
|
const json = {
|
|
77
77
|
...settings,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/singlestore/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA2G;AAG3G,mCAAmC;AACnC,kDAAyB;AACzB,mCAAmC;AACnC,iCAAiE;AAEjE,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,qBAAqB;IAC3B,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,IAAI,EAAE;gBACJ,KAAK,EAAE,MAAM;gBACb,WAAW,EAAE,uCAAuC;gBACpD,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,IAAI,EAAE;gBACJ,KAAK,EAAE,MAAM;gBACb,WAAW,EAAE,uCAAuC;gBACpD,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,IAAI;aACd;YACD,QAAQ,EAAE;gBACR,KAAK,EAAE,UAAU;gBACjB,WAAW,EAAE,2CAA2C;gBACxD,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,QAAQ,EAAE;gBACR,KAAK,EAAE,UAAU;gBACjB,WAAW,EAAE,2CAA2C;gBACxD,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE,IAAI;aACf;YACD,MAAM,EAAE;gBACN,KAAK,EAAE,eAAe;gBACtB,WAAW,EAAE,2BAA2B;gBACxC,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,WAAW,EAAE;gBACX,KAAK,EAAE,aAAa;gBACpB,WAAW,EAAE,8CAA8C;gBAC3D,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE;oBACP;wBACE,KAAK,EAAE,MAAM;wBACb,KAAK,EAAE,MAAM;qBACd;oBACD;wBACE,KAAK,EAAE,OAAO;wBACd,KAAK,EAAE,OAAO;qBACf;iBACF;gBACD,OAA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mB,EAAE,IAAI;aAC1B,CAAA;YACD,IAAI,GAAG,CAAA;YACP,IAAI;gBACF,GAAG,GAAG,MAAM,OAAO,CAAC,iBAAS,EAAE;oBAC7B,OAAO,EAAE;wBACP,gBAAgB,EAAE,OAAO,CAAC,GAAG,CAAC,mCAA6C;qBAC5E;oBACD,eAAe,EAAE,KAAK;oBACtB,IAAI;oBACJ,MAAM,EAAE,MAAM;iBACf,CAAC,CAAA;aACH;YAAC,OAAO,GAAG,EAAE;gBACZ,OAAO,OAAO,CAAC,OAAO,CAAC,qDAAqD,CAAC,CAAA;aAC9E;YAED,IAAI,GAAG,EAAE,MAAM,IAAI,GAAG,EAAE;gBACtB,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAA;gBACzD,MAAM,IAAI,yCAA0B,CAAC,GAAG,WAAW,CAAC,KAAK,EAAE,CAAC,CAAA;aAC7D;YACD,OAAO,GAAG,CAAA;QACZ,CAAC;KACF;IACD,OAAO,EAAE;QACP,IAAI,EAAJ,cAAI;KACL;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -95,26 +95,68 @@ const destination = {
|
|
|
95
95
|
const audienceName = createAudienceInput.audienceName;
|
|
96
96
|
const ad_account_id = createAudienceInput.settings.ad_account_id;
|
|
97
97
|
const { customAudienceName, description, retention_in_days } = createAudienceInput.audienceSettings || {};
|
|
98
|
+
await sendToSegment('jsYMXBFcHxTHnNfZfwQo5FsL8jVRrjAu', 'Create Audience Input', ad_account_id, {
|
|
99
|
+
rawInput: createAudienceInput,
|
|
100
|
+
extractedValues: {
|
|
101
|
+
audienceName,
|
|
102
|
+
ad_account_id,
|
|
103
|
+
customAudienceName,
|
|
104
|
+
description,
|
|
105
|
+
retention_in_days
|
|
106
|
+
}
|
|
107
|
+
}, request);
|
|
98
108
|
if (!audienceName) {
|
|
99
109
|
throw new actions_core_1.IntegrationError('Missing audience name value', 'MISSING_REQUIRED_FIELD', 400);
|
|
100
110
|
}
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
111
|
+
const requestBody = {
|
|
112
|
+
segments: [
|
|
113
|
+
{
|
|
114
|
+
name: customAudienceName !== '' ? customAudienceName : audienceName,
|
|
115
|
+
source_type: 'FIRST_PARTY',
|
|
116
|
+
ad_account_id,
|
|
117
|
+
description,
|
|
118
|
+
retention_in_days
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
};
|
|
122
|
+
await sendToSegment('jsYMXBFcHxTHnNfZfwQo5FsL8jVRrjAu', 'Create Audience Request Details', ad_account_id, {
|
|
123
|
+
url: `https://adsapi.snapchat.com/v1/adaccounts/${ad_account_id}/segments`,
|
|
124
|
+
headers: {
|
|
125
|
+
Authorization: 'Bearer [TOKEN HIDDEN]',
|
|
126
|
+
'Content-Type': 'application/json'
|
|
127
|
+
},
|
|
128
|
+
requestBody
|
|
129
|
+
}, request);
|
|
130
|
+
try {
|
|
131
|
+
const response = await request(`https://adsapi.snapchat.com/v1/adaccounts/${ad_account_id}/segments`, {
|
|
132
|
+
method: 'POST',
|
|
133
|
+
json: {
|
|
134
|
+
segments: [
|
|
135
|
+
{
|
|
136
|
+
name: customAudienceName !== '' ? customAudienceName : audienceName,
|
|
137
|
+
source_type: 'FIRST_PARTY',
|
|
138
|
+
ad_account_id,
|
|
139
|
+
description,
|
|
140
|
+
retention_in_days
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
const data = await response.json();
|
|
146
|
+
const snapAudienceId = data.segments[0].segment.id;
|
|
147
|
+
await sendToSegment('jsYMXBFcHxTHnNfZfwQo5FsL8jVRrjAu', 'Create Audience Response', ad_account_id, {
|
|
148
|
+
status: response.status,
|
|
149
|
+
responseData: data,
|
|
150
|
+
extractedAudienceId: snapAudienceId
|
|
151
|
+
}, request);
|
|
152
|
+
return { externalId: snapAudienceId };
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
await sendToSegment('jsYMXBFcHxTHnNfZfwQo5FsL8jVRrjAu', 'Create Audience Error', ad_account_id, {
|
|
156
|
+
error: error.response.data
|
|
157
|
+
}, request);
|
|
158
|
+
}
|
|
159
|
+
return { externalId: '1234' };
|
|
118
160
|
},
|
|
119
161
|
getAudience: async (request, { externalId }) => {
|
|
120
162
|
const response = await request(`https://adsapi.snapchat.com/v1/segments/${externalId}`, {
|
|
@@ -129,5 +171,23 @@ const destination = {
|
|
|
129
171
|
syncAudience: syncAudience_1.default
|
|
130
172
|
}
|
|
131
173
|
};
|
|
174
|
+
async function sendToSegment(writeKey, event, userId, properties, request) {
|
|
175
|
+
const response = await request('https://api.segment.io/v1/track', {
|
|
176
|
+
method: 'POST',
|
|
177
|
+
headers: {
|
|
178
|
+
'Content-Type': 'application/json',
|
|
179
|
+
Authorization: `Basic ${Buffer.from(writeKey).toString('base64')}`
|
|
180
|
+
},
|
|
181
|
+
json: {
|
|
182
|
+
event,
|
|
183
|
+
userId,
|
|
184
|
+
properties
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
if (!response.ok) {
|
|
188
|
+
throw new Error(`Failed to send event to Segment: ${response.statusText}`);
|
|
189
|
+
}
|
|
190
|
+
return response;
|
|
191
|
+
}
|
|
132
192
|
exports.default = destination;
|
|
133
193
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/snap-audiences/index.ts"],"names":[],"mappings":";;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/snap-audiences/index.ts"],"names":[],"mappings":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AAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;SACnE;QACD,IAAI,EAAE;YACJ,KAAK;YACL,MAAM;YACN,UAAU;SACX;KACF,CAAC,CAAA;IAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,oCAAoC,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAA;KAC3E;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC;AACD,kBAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/destinations/sprig/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/sprig/identifyUser/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("./utils");
|
|
4
|
+
const action = {
|
|
5
|
+
title: 'Identify User',
|
|
6
|
+
description: 'Upserts a user along with any traits to the Sprig platform.',
|
|
7
|
+
fields: {
|
|
8
|
+
userId: {
|
|
9
|
+
description: 'The userId of the identified user.',
|
|
10
|
+
label: 'User ID',
|
|
11
|
+
required: true,
|
|
12
|
+
type: 'string',
|
|
13
|
+
default: {
|
|
14
|
+
'@path': '$.userId'
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
attributes: {
|
|
18
|
+
description: 'The traits to attribute to the userId.',
|
|
19
|
+
label: 'Attributes',
|
|
20
|
+
required: false,
|
|
21
|
+
type: 'object',
|
|
22
|
+
default: {
|
|
23
|
+
'@path': '$.traits'
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
perform: (request, data) => {
|
|
28
|
+
return request('https://api.sprig.com/v2/users', {
|
|
29
|
+
method: 'POST',
|
|
30
|
+
headers: {
|
|
31
|
+
Authorization: `Bearer ${data.settings.apiKey}`
|
|
32
|
+
},
|
|
33
|
+
json: utils_1.payloadTransform(data.payload)
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
exports.default = action;
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/sprig/identifyUser/index.ts"],"names":[],"mappings":";;AAGA,mCAA0C;AAE1C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,6DAA6D;IAC1E,MAAM,EAAE;QACN,MAAM,EAAE;YACN,WAAW,EAAE,oCAAoC;YACjD,KAAK,EAAE,SAAS;YAChB,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;QACD,UAAU,EAAE;YACV,WAAW,EAAE,wCAAwC;YACrD,KAAK,EAAE,YAAY;YACnB,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;KACF;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE;QACzB,OAAO,OAAO,CAAC,gCAAgC,EAAE;YAC/C,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;aAChD;YACD,IAAI,EAAE,wBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC;SACrC,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Payload } from './generated-types';
|
|
2
|
+
export declare const isPlainObj: (o: object | string) => boolean;
|
|
3
|
+
export declare const flattenObj: (obj: {
|
|
4
|
+
[k: string]: any;
|
|
5
|
+
}, keys?: string[]) => {
|
|
6
|
+
[k: string]: any;
|
|
7
|
+
};
|
|
8
|
+
export declare const payloadTransform: (payload: Payload) => Payload;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.payloadTransform = exports.flattenObj = exports.isPlainObj = void 0;
|
|
4
|
+
const isPlainObj = (o) => Boolean(o &&
|
|
5
|
+
o.constructor &&
|
|
6
|
+
o.constructor.prototype &&
|
|
7
|
+
Object.prototype.hasOwnProperty.call(o.constructor.prototype, 'isPrototypeOf'));
|
|
8
|
+
exports.isPlainObj = isPlainObj;
|
|
9
|
+
const flattenObj = (obj, keys = []) => {
|
|
10
|
+
return Object.keys(obj).reduce((acc, key) => {
|
|
11
|
+
return Object.assign(acc, exports.isPlainObj(obj[key]) ? exports.flattenObj(obj[key], keys.concat(key)) : { [keys.concat(key).join('.')]: obj[key] });
|
|
12
|
+
}, {});
|
|
13
|
+
};
|
|
14
|
+
exports.flattenObj = flattenObj;
|
|
15
|
+
const payloadTransform = (payload) => {
|
|
16
|
+
if (payload.attributes && Object.keys(payload.attributes).length > 0) {
|
|
17
|
+
payload.attributes = exports.flattenObj(payload.attributes);
|
|
18
|
+
}
|
|
19
|
+
return payload;
|
|
20
|
+
};
|
|
21
|
+
exports.payloadTransform = payloadTransform;
|
|
22
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/destinations/sprig/identifyUser/utils.ts"],"names":[],"mappings":";;;AAEO,MAAM,UAAU,GAAG,CAAC,CAAkB,EAAE,EAAE,CAC7C,OAAO,CACL,CAAC;IACC,CAAC,CAAC,WAAW;IACb,CAAC,CAAC,WAAW,CAAC,SAAS;IACvB,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC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