@segment/action-destinations 3.333.0 → 3.333.1-staging-d615339bd.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/actions-pardot/pa-operations.d.ts +1 -1
- package/dist/destinations/adjust/functions.d.ts +1 -1
- package/dist/destinations/adobe-target/adobeTarget_operations.d.ts +1 -1
- package/dist/destinations/airship/utilities.d.ts +7 -7
- package/dist/destinations/cordial/cordial-client.d.ts +8 -8
- package/dist/destinations/customerio/test-helper.d.ts +1 -1
- package/dist/destinations/engage-messaging-twilio/sendMobilePush/PushSender.d.ts +1 -1
- package/dist/destinations/engage-messaging-twilio/utils/PhoneMessageSender.d.ts +1 -1
- package/dist/destinations/facebook-custom-audiences/fbca-operations.d.ts +2 -2
- package/dist/destinations/first-party-dv360/addToAudMobileDeviceId/generated-types.d.ts +5 -0
- package/dist/destinations/first-party-dv360/addToAudMobileDeviceId/generated-types.js.map +1 -0
- package/dist/destinations/first-party-dv360/addToAudMobileDeviceId/index.d.ts +5 -0
- package/dist/destinations/first-party-dv360/addToAudMobileDeviceId/index.js +24 -0
- package/dist/destinations/first-party-dv360/addToAudMobileDeviceId/index.js.map +1 -0
- package/dist/destinations/first-party-dv360/addtoAudContactInfo/generated-types.d.ts +10 -0
- package/dist/destinations/first-party-dv360/addtoAudContactInfo/generated-types.js +3 -0
- package/dist/destinations/first-party-dv360/addtoAudContactInfo/generated-types.js.map +1 -0
- package/dist/destinations/first-party-dv360/addtoAudContactInfo/index.d.ts +5 -0
- package/dist/destinations/first-party-dv360/addtoAudContactInfo/index.js +29 -0
- package/dist/destinations/first-party-dv360/addtoAudContactInfo/index.js.map +1 -0
- package/dist/destinations/first-party-dv360/functions.d.ts +23 -1
- package/dist/destinations/first-party-dv360/functions.js +130 -1
- package/dist/destinations/first-party-dv360/functions.js.map +1 -1
- package/dist/destinations/first-party-dv360/generated-types.d.ts +0 -1
- package/dist/destinations/first-party-dv360/index.js +12 -19
- package/dist/destinations/first-party-dv360/index.js.map +1 -1
- package/dist/destinations/first-party-dv360/properties.d.ts +12 -0
- package/dist/destinations/first-party-dv360/properties.js +94 -0
- package/dist/destinations/first-party-dv360/properties.js.map +1 -0
- package/dist/destinations/first-party-dv360/removeFromAudContactInfo/generated-types.d.ts +10 -0
- package/dist/destinations/first-party-dv360/removeFromAudContactInfo/generated-types.js +3 -0
- package/dist/destinations/first-party-dv360/removeFromAudContactInfo/generated-types.js.map +1 -0
- package/dist/destinations/first-party-dv360/removeFromAudContactInfo/index.d.ts +5 -0
- package/dist/destinations/first-party-dv360/removeFromAudContactInfo/index.js +29 -0
- package/dist/destinations/first-party-dv360/removeFromAudContactInfo/index.js.map +1 -0
- package/dist/destinations/first-party-dv360/removeFromAudMobileDeviceId/generated-types.d.ts +5 -0
- package/dist/destinations/first-party-dv360/removeFromAudMobileDeviceId/generated-types.js +3 -0
- package/dist/destinations/first-party-dv360/removeFromAudMobileDeviceId/generated-types.js.map +1 -0
- package/dist/destinations/first-party-dv360/removeFromAudMobileDeviceId/index.d.ts +5 -0
- package/dist/destinations/first-party-dv360/removeFromAudMobileDeviceId/index.js +24 -0
- package/dist/destinations/first-party-dv360/removeFromAudMobileDeviceId/index.js.map +1 -0
- package/dist/destinations/gameball/util.d.ts +1 -1
- package/dist/destinations/google-analytics-4/ga4-functions.d.ts +1 -1
- package/dist/destinations/google-campaign-manager-360/utils.d.ts +1 -1
- package/dist/destinations/google-enhanced-conversions/functions.d.ts +5 -5
- package/dist/destinations/google-enhanced-conversions/functions.js +18 -18
- package/dist/destinations/google-enhanced-conversions/functions.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/index.js +2 -2
- package/dist/destinations/google-enhanced-conversions/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/types.d.ts +3 -0
- package/dist/destinations/google-enhanced-conversions/userList/index.js +9 -9
- package/dist/destinations/google-enhanced-conversions/userList/index.js.map +1 -1
- package/dist/destinations/google-sheets/postSheet/operations.d.ts +1 -1
- package/dist/destinations/google-sheets/postSheet2/operations2.d.ts +1 -1
- package/dist/destinations/hubspot/customEvent/event-completion.d.ts +1 -1
- package/dist/destinations/hubspot/upsertObject/client.d.ts +3 -3
- package/dist/destinations/klaviyo/addProfileToList/generated-types.d.ts +1 -0
- package/dist/destinations/klaviyo/addProfileToList/index.js +5 -14
- package/dist/destinations/klaviyo/addProfileToList/index.js.map +1 -1
- package/dist/destinations/klaviyo/config.d.ts +4 -0
- package/dist/destinations/klaviyo/config.js +250 -1
- package/dist/destinations/klaviyo/config.js.map +1 -1
- package/dist/destinations/klaviyo/functions.d.ts +15 -7
- package/dist/destinations/klaviyo/functions.js +256 -7
- package/dist/destinations/klaviyo/functions.js.map +1 -1
- package/dist/destinations/klaviyo/orderCompleted/generated-types.d.ts +1 -0
- package/dist/destinations/klaviyo/orderCompleted/index.js +6 -4
- package/dist/destinations/klaviyo/orderCompleted/index.js.map +1 -1
- package/dist/destinations/klaviyo/properties.d.ts +3 -0
- package/dist/destinations/klaviyo/properties.js +19 -1
- package/dist/destinations/klaviyo/properties.js.map +1 -1
- package/dist/destinations/klaviyo/removeProfile/generated-types.d.ts +1 -0
- package/dist/destinations/klaviyo/removeProfile/index.js +10 -5
- package/dist/destinations/klaviyo/removeProfile/index.js.map +1 -1
- package/dist/destinations/klaviyo/removeProfileFromList/generated-types.d.ts +1 -0
- package/dist/destinations/klaviyo/removeProfileFromList/index.js +9 -6
- package/dist/destinations/klaviyo/removeProfileFromList/index.js.map +1 -1
- package/dist/destinations/klaviyo/subscribeProfile/generated-types.d.ts +1 -0
- package/dist/destinations/klaviyo/subscribeProfile/index.js +11 -5
- package/dist/destinations/klaviyo/subscribeProfile/index.js.map +1 -1
- package/dist/destinations/klaviyo/trackEvent/generated-types.d.ts +1 -0
- package/dist/destinations/klaviyo/trackEvent/index.js +8 -4
- package/dist/destinations/klaviyo/trackEvent/index.js.map +1 -1
- package/dist/destinations/klaviyo/types.d.ts +18 -0
- package/dist/destinations/klaviyo/unsubscribeProfile/generated-types.d.ts +1 -0
- package/dist/destinations/klaviyo/unsubscribeProfile/index.js +11 -5
- package/dist/destinations/klaviyo/unsubscribeProfile/index.js.map +1 -1
- package/dist/destinations/klaviyo/upsertProfile/generated-types.d.ts +1 -0
- package/dist/destinations/klaviyo/upsertProfile/index.js +10 -5
- package/dist/destinations/klaviyo/upsertProfile/index.js.map +1 -1
- package/dist/destinations/launchdarkly-audiences/syncAudience/custom-audience-operations.d.ts +1 -1
- package/dist/destinations/linkedin-audiences/api/index.js +0 -1
- package/dist/destinations/linkedin-audiences/api/index.js.map +1 -1
- package/dist/destinations/linkedin-audiences/constants.d.ts +1 -1
- package/dist/destinations/linkedin-audiences/constants.js +1 -1
- package/dist/destinations/magellan-ai/addToCart/generated-types.d.ts +2 -0
- package/dist/destinations/magellan-ai/addToCart/index.js +2 -1
- package/dist/destinations/magellan-ai/addToCart/index.js.map +1 -1
- package/dist/destinations/magellan-ai/checkout/generated-types.d.ts +2 -0
- package/dist/destinations/magellan-ai/checkout/index.js +2 -1
- package/dist/destinations/magellan-ai/checkout/index.js.map +1 -1
- package/dist/destinations/magellan-ai/code/generated-types.d.ts +2 -0
- package/dist/destinations/magellan-ai/code/index.js +3 -1
- package/dist/destinations/magellan-ai/code/index.js.map +1 -1
- package/dist/destinations/magellan-ai/identify/generated-types.d.ts +2 -0
- package/dist/destinations/magellan-ai/identify/index.js +3 -1
- package/dist/destinations/magellan-ai/identify/index.js.map +1 -1
- package/dist/destinations/magellan-ai/install/generated-types.d.ts +2 -2
- package/dist/destinations/magellan-ai/install/index.js +4 -1
- package/dist/destinations/magellan-ai/install/index.js.map +1 -1
- package/dist/destinations/magellan-ai/lead/generated-types.d.ts +2 -0
- package/dist/destinations/magellan-ai/lead/index.js +2 -1
- package/dist/destinations/magellan-ai/lead/index.js.map +1 -1
- package/dist/destinations/magellan-ai/product/generated-types.d.ts +2 -0
- package/dist/destinations/magellan-ai/product/index.js +4 -1
- package/dist/destinations/magellan-ai/product/index.js.map +1 -1
- package/dist/destinations/magellan-ai/purchase/generated-types.d.ts +2 -0
- package/dist/destinations/magellan-ai/purchase/index.js +2 -1
- package/dist/destinations/magellan-ai/purchase/index.js.map +1 -1
- package/dist/destinations/magellan-ai/schema.d.ts +1 -0
- package/dist/destinations/magellan-ai/schema.js +24 -22
- package/dist/destinations/magellan-ai/schema.js.map +1 -1
- package/dist/destinations/magellan-ai/thirdPartyEvent/generated-types.d.ts +2 -2
- package/dist/destinations/magellan-ai/thirdPartyEvent/index.js +2 -1
- package/dist/destinations/magellan-ai/thirdPartyEvent/index.js.map +1 -1
- package/dist/destinations/magellan-ai/view/generated-types.d.ts +2 -0
- package/dist/destinations/magellan-ai/view/index.js +3 -1
- package/dist/destinations/magellan-ai/view/index.js.map +1 -1
- package/dist/destinations/mantle/identify/generated-types.d.ts +1 -0
- package/dist/destinations/mantle/identify/index.js +8 -0
- package/dist/destinations/mantle/identify/index.js.map +1 -1
- package/dist/destinations/mixpanel/common/utils.d.ts +15 -0
- package/dist/destinations/mixpanel/common/utils.js +28 -1
- package/dist/destinations/mixpanel/common/utils.js.map +1 -1
- package/dist/destinations/mixpanel/trackEvent/index.js +30 -2
- package/dist/destinations/mixpanel/trackEvent/index.js.map +1 -1
- package/dist/destinations/mixpanel/trackPurchase/index.js +28 -2
- package/dist/destinations/mixpanel/trackPurchase/index.js.map +1 -1
- package/dist/destinations/recombee/deleteBookmark/index.js +1 -1
- package/dist/destinations/recombee/deleteBookmark/index.js.map +1 -1
- package/dist/destinations/recombee/deleteCartAddition/index.js +1 -1
- package/dist/destinations/recombee/deleteCartAddition/index.js.map +1 -1
- package/dist/destinations/recombee/setViewPortion/index.js +1 -1
- package/dist/destinations/recombee/setViewPortion/index.js.map +1 -1
- package/dist/destinations/recombee/setViewPortionFromWatchTime/index.d.ts +1 -1
- package/dist/destinations/recombee/setViewPortionFromWatchTime/index.js +6 -2
- package/dist/destinations/recombee/setViewPortionFromWatchTime/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.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/s3/fields.js +9 -0
- package/dist/destinations/s3/fields.js.map +1 -1
- package/dist/destinations/s3/functions.d.ts +2 -1
- package/dist/destinations/s3/functions.js +14 -3
- package/dist/destinations/s3/functions.js.map +1 -1
- package/dist/destinations/s3/syncToS3/generated-types.d.ts +1 -0
- package/dist/destinations/s3/syncToS3/index.js +4 -2
- package/dist/destinations/s3/syncToS3/index.js.map +1 -1
- package/dist/destinations/sendgrid/index.js +3 -1
- package/dist/destinations/sendgrid/index.js.map +1 -1
- package/dist/destinations/sendgrid/sendEmail/constants.d.ts +4 -0
- package/dist/destinations/sendgrid/sendEmail/constants.js +8 -0
- package/dist/destinations/sendgrid/sendEmail/constants.js.map +1 -0
- package/dist/destinations/sendgrid/sendEmail/fields.d.ts +2 -0
- package/dist/destinations/sendgrid/sendEmail/fields.js +396 -0
- package/dist/destinations/sendgrid/sendEmail/fields.js.map +1 -0
- package/dist/destinations/sendgrid/sendEmail/generated-types.d.ts +73 -0
- package/dist/destinations/sendgrid/sendEmail/generated-types.js +3 -0
- package/dist/destinations/sendgrid/sendEmail/generated-types.js.map +1 -0
- package/dist/destinations/sendgrid/sendEmail/index.d.ts +5 -0
- package/dist/destinations/sendgrid/sendEmail/index.js +14 -0
- package/dist/destinations/sendgrid/sendEmail/index.js.map +1 -0
- package/dist/destinations/sendgrid/sendEmail/types.d.ts +72 -0
- package/dist/destinations/sendgrid/sendEmail/types.js +3 -0
- package/dist/destinations/sendgrid/sendEmail/types.js.map +1 -0
- package/dist/destinations/sendgrid/sendEmail/utils.d.ts +3 -0
- package/dist/destinations/sendgrid/sendEmail/utils.js +86 -0
- package/dist/destinations/sendgrid/sendEmail/utils.js.map +1 -0
- package/dist/destinations/webhook-audiences/index.js +14 -2
- package/dist/destinations/webhook-audiences/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/destinations/first-party-dv360/addToList/generated-types.d.ts +0 -2
- package/dist/destinations/first-party-dv360/addToList/generated-types.js.map +0 -1
- package/dist/destinations/first-party-dv360/addToList/index.js +0 -11
- package/dist/destinations/first-party-dv360/addToList/index.js.map +0 -1
- /package/dist/destinations/first-party-dv360/{addToList → addToAudMobileDeviceId}/generated-types.js +0 -0
- /package/dist/destinations/{first-party-dv360/addToList → responsys/sendAudienceAsPet}/index.d.ts +0 -0
- /package/dist/destinations/responsys/{shared_properties.d.ts → shared-properties.d.ts} +0 -0
|
@@ -4,6 +4,7 @@ const functions_1 = require("../functions");
|
|
|
4
4
|
const actions_core_1 = require("@segment/actions-core");
|
|
5
5
|
const functions_2 = require("../functions");
|
|
6
6
|
const config_1 = require("../config");
|
|
7
|
+
const properties_1 = require("../properties");
|
|
7
8
|
const action = {
|
|
8
9
|
title: 'Subscribe Profile',
|
|
9
10
|
description: 'Subscribe Klaviyo profiles to Email marketing, SMS marketing, or both.',
|
|
@@ -34,6 +35,9 @@ const action = {
|
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
},
|
|
38
|
+
country_code: {
|
|
39
|
+
...properties_1.country_code
|
|
40
|
+
},
|
|
37
41
|
list_id: {
|
|
38
42
|
label: 'List Id',
|
|
39
43
|
description: `The Klaviyo list to add the newly subscribed profiles to. If no List Id is present, the opt-in process used to subscribe the profile depends on the account's default opt-in settings.`,
|
|
@@ -66,13 +70,11 @@ const action = {
|
|
|
66
70
|
}
|
|
67
71
|
},
|
|
68
72
|
perform: async (request, { payload }) => {
|
|
69
|
-
const { email, phone_number, consented_at, list_id, custom_source } = payload;
|
|
73
|
+
const { email, phone_number: initialPhoneNumber, consented_at, list_id, custom_source, country_code } = payload;
|
|
74
|
+
const phone_number = functions_1.processPhoneNumber(initialPhoneNumber, country_code);
|
|
70
75
|
if (!email && !phone_number) {
|
|
71
76
|
throw new actions_core_1.PayloadValidationError('Phone Number or Email is required.');
|
|
72
77
|
}
|
|
73
|
-
if (phone_number && !functions_1.validatePhoneNumber(phone_number)) {
|
|
74
|
-
throw new actions_core_1.PayloadValidationError(`${phone_number} is not a valid E.164 phone number.`);
|
|
75
|
-
}
|
|
76
78
|
const profileToSubscribe = functions_2.formatSubscribeProfile(email, phone_number, consented_at);
|
|
77
79
|
const subData = functions_2.formatSubscribeRequestBody(profileToSubscribe, list_id, custom_source);
|
|
78
80
|
return await request(`${config_1.API_URL}/profile-subscription-bulk-create-jobs/`, {
|
|
@@ -85,7 +87,11 @@ const action = {
|
|
|
85
87
|
},
|
|
86
88
|
performBatch: async (request, { payload }) => {
|
|
87
89
|
const filteredPayload = payload.filter((profile) => {
|
|
88
|
-
|
|
90
|
+
const validPhoneNumber = functions_1.validateAndConvertPhoneNumber(profile.phone_number, profile.country_code);
|
|
91
|
+
if (validPhoneNumber) {
|
|
92
|
+
profile.phone_number = validPhoneNumber;
|
|
93
|
+
}
|
|
94
|
+
else if (validPhoneNumber === null) {
|
|
89
95
|
return false;
|
|
90
96
|
}
|
|
91
97
|
return profile.email || profile.phone_number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/subscribeProfile/index.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/subscribeProfile/index.ts"],"names":[],"mappings":";;AAGA,4CAAsG;AAEtG,wDAA8D;AAC9D,4CAAiF;AAEjF,sCAAmC;AACnC,8CAA4C;AAE5C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,mBAAmB;IAC1B,WAAW,EAAE,wEAAwE;IACrF,mBAAmB,EAAE,8CAA8C;IACnE,MAAM,EAAE;QACN,KAAK,EAAE;YACL,KAAK,EAAE,OAAO;YACd,WAAW,EAAE,4GAA4G;YACzH,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,OAAO;YACf,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;oBACrC,IAAI,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;oBACnC,IAAI,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE;iBAC5C;aACF;SACF;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,cAAc;YACrB,WAAW,EAAE,uIAAuI;YACpJ,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;oBACrC,IAAI,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;oBACnC,IAAI,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE;iBAC5C;aACF;SACF;QACD,YAAY,EAAE;YACZ,GAAG,yBAAY;SAChB;QACD,OAAO,EAAE;YACP,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,wLAAwL;YACrM,IAAI,EAAE,QAAQ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,CAAA;QAGpF,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;IAC/C,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const actions_core_1 = require("@segment/actions-core");
|
|
7
7
|
const config_1 = require("../config");
|
|
8
8
|
const functions_1 = require("../functions");
|
|
9
|
+
const properties_1 = require("../properties");
|
|
9
10
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
10
11
|
const action = {
|
|
11
12
|
title: 'Track Event',
|
|
@@ -25,6 +26,9 @@ const action = {
|
|
|
25
26
|
label: 'Phone Number',
|
|
26
27
|
type: 'string'
|
|
27
28
|
},
|
|
29
|
+
country_code: {
|
|
30
|
+
...properties_1.country_code
|
|
31
|
+
},
|
|
28
32
|
external_id: {
|
|
29
33
|
label: 'External Id',
|
|
30
34
|
description: 'A unique identifier used by customers to associate Klaviyo profiles with profiles in an external system.',
|
|
@@ -89,13 +93,13 @@ const action = {
|
|
|
89
93
|
}
|
|
90
94
|
},
|
|
91
95
|
perform: (request, { payload }) => {
|
|
92
|
-
const { email, phone_number, external_id, anonymous_id } = payload.profile;
|
|
96
|
+
const { email, phone_number: initialPhoneNumber, external_id, anonymous_id, country_code } = payload.profile;
|
|
97
|
+
const phone_number = functions_1.processPhoneNumber(initialPhoneNumber, country_code);
|
|
98
|
+
payload.profile.phone_number = phone_number;
|
|
99
|
+
delete payload?.profile?.country_code;
|
|
93
100
|
if (!email && !phone_number && !external_id && !anonymous_id) {
|
|
94
101
|
throw new actions_core_1.PayloadValidationError('One of External ID, Anonymous ID, Phone Number or Email is required.');
|
|
95
102
|
}
|
|
96
|
-
if (phone_number && !functions_1.validatePhoneNumber(phone_number)) {
|
|
97
|
-
throw new actions_core_1.PayloadValidationError(`${phone_number} is not a valid E.164 phone number.`);
|
|
98
|
-
}
|
|
99
103
|
const eventData = {
|
|
100
104
|
data: {
|
|
101
105
|
type: 'event',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/trackEvent/index.ts"],"names":[],"mappings":";;;;;AAIA,wDAA8D;AAC9D,sCAAmC;AACnC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/trackEvent/index.ts"],"names":[],"mappings":";;;;;AAIA,wDAA8D;AAC9D,sCAAmC;AACnC,4CAAiD;AACjD,8CAA4C;AAC5C,kDAAyB;AAEzB,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,wDAAwD;IACrE,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,OAAO,EAAE;YACP,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,sDAAsD;YACnE,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,KAAK,EAAE,OAAO;oBACd,IAAI,EAAE,QAAQ;iBACf;gBACD,YAAY,EAAE;oBACZ,KAAK,EAAE,cAAc;oBACrB,IAAI,EAAE,QAAQ;iBACf;gBACD,YAAY,EAAE;oBACZ,GAAG,yBAAY;iBAChB;gBACD,WAAW,EAAE;oBACX,KAAK,EAAE,aAAa;oBACpB,WAAW,EACT,0GAA0G;oBAC5G,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;iBACjC;gBACD,YAAY,EAAE;oBACZ,KAAK,EAAE,cAAc;oBACrB,WAAW,EAAE,yCAAyC;oBACtD,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE;iBACtC;aACF;YACD,oBAAoB,EAAE,IAAI;YAC1B,QAAQ,EAAE,IAAI;SACf;QACD,WAAW,EAAE;YACX,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,s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OAAO;gBACb,UAAU,EAAE;oBACV,UAAU,EAAE,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE;oBACrC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,eAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS;oBACnE,KAAK,EAAE,OAAO,CAAC,KAAK;oBACpB,SAAS,EAAE,OAAO,CAAC,SAAS;oBAC5B,MAAM,EAAE;wBACN,IAAI,EAAE;4BACJ,IAAI,EAAE,QAAQ;4BACd,UAAU,EAAE;gCACV,IAAI,EAAE,OAAO,CAAC,WAAW;6BAC1B;yBACF;qBACF;oBACD,OAAO,EAAE;wBACP,IAAI,EAAE;4BACJ,IAAI,EAAE,SAAS;4BACf,UAAU,EAAE,OAAO,CAAC,OAAO;yBAC5B;qBACF;iBACF;aACF;SACF,CAAA;QAED,OAAO,OAAO,CAAC,GAAG,gBAAO,UAAU,EAAE;YACnC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,SAAS;SAChB,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -205,3 +205,21 @@ export interface AdditionalAttributes {
|
|
|
205
205
|
title?: string;
|
|
206
206
|
image?: string;
|
|
207
207
|
}
|
|
208
|
+
export interface KlaviyoAPIErrorResponse {
|
|
209
|
+
id: string;
|
|
210
|
+
status: number;
|
|
211
|
+
code: string;
|
|
212
|
+
title: string;
|
|
213
|
+
detail: string;
|
|
214
|
+
source: {
|
|
215
|
+
pointer: string;
|
|
216
|
+
parameter?: string;
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
export interface KlaviyoAPIErrorResponse {
|
|
220
|
+
errors: KlaviyoAPIError[];
|
|
221
|
+
}
|
|
222
|
+
export interface KlaviyoProfile {
|
|
223
|
+
type: string;
|
|
224
|
+
attributes: ProfileAttributes;
|
|
225
|
+
}
|
|
@@ -4,6 +4,7 @@ const functions_1 = require("../functions");
|
|
|
4
4
|
const actions_core_1 = require("@segment/actions-core");
|
|
5
5
|
const functions_2 = require("../functions");
|
|
6
6
|
const config_1 = require("../config");
|
|
7
|
+
const properties_1 = require("../properties");
|
|
7
8
|
const action = {
|
|
8
9
|
title: 'Unsubscribe Profile',
|
|
9
10
|
defaultSubscription: 'type = "track" and event = "User Unsubscribed"',
|
|
@@ -34,6 +35,9 @@ const action = {
|
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
},
|
|
38
|
+
country_code: {
|
|
39
|
+
...properties_1.country_code
|
|
40
|
+
},
|
|
37
41
|
list_id: {
|
|
38
42
|
label: 'List Id',
|
|
39
43
|
description: `The Klaviyo list to remove the subscribed profiles from. If no list id is provided, the profile will be unsubscribed from all channels.`,
|
|
@@ -52,13 +56,11 @@ const action = {
|
|
|
52
56
|
}
|
|
53
57
|
},
|
|
54
58
|
perform: async (request, { payload }) => {
|
|
55
|
-
const { email, phone_number, list_id } = payload;
|
|
59
|
+
const { email, phone_number: initialPhoneNumber, list_id, country_code } = payload;
|
|
60
|
+
const phone_number = functions_1.processPhoneNumber(initialPhoneNumber, country_code);
|
|
56
61
|
if (!email && !phone_number) {
|
|
57
62
|
throw new actions_core_1.PayloadValidationError('Phone Number or Email is required.');
|
|
58
63
|
}
|
|
59
|
-
if (phone_number && !functions_1.validatePhoneNumber(phone_number)) {
|
|
60
|
-
throw new actions_core_1.PayloadValidationError(`${phone_number} is not a valid E.164 phone number.`);
|
|
61
|
-
}
|
|
62
64
|
const profileToUnSubscribe = functions_2.formatUnsubscribeProfile(email, phone_number);
|
|
63
65
|
const unSubData = functions_2.formatUnsubscribeRequestBody(profileToUnSubscribe, list_id);
|
|
64
66
|
return await request(`${config_1.API_URL}/profile-subscription-bulk-delete-jobs`, {
|
|
@@ -71,7 +73,11 @@ const action = {
|
|
|
71
73
|
},
|
|
72
74
|
performBatch: async (request, { payload }) => {
|
|
73
75
|
const filteredPayload = payload.filter((profile) => {
|
|
74
|
-
|
|
76
|
+
const validPhoneNumber = functions_1.validateAndConvertPhoneNumber(profile.phone_number, profile.country_code);
|
|
77
|
+
if (validPhoneNumber) {
|
|
78
|
+
profile.phone_number = validPhoneNumber;
|
|
79
|
+
}
|
|
80
|
+
else if (validPhoneNumber === null) {
|
|
75
81
|
return false;
|
|
76
82
|
}
|
|
77
83
|
return profile.email || profile.phone_number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/unsubscribeProfile/index.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/unsubscribeProfile/index.ts"],"names":[],"mappings":";;AAGA,4CAAsG;AACtG,wDAA8D;AAC9D,4CAAqF;AAErF,sCAAmC;AACnC,8CAA4C;AAE5C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,qBAAqB;IAC5B,mBAAmB,EAAE,gDAAgD;IACrE,WAAW,EAAE,4EAA4E;IACzF,MAAM,EAAE;QACN,KAAK,EAAE;YACL,KAAK,EAAE,OAAO;YACd,WAAW,EAAE,gHAAgH;YAC7H,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,OAAO;YACf,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;oBACrC,IAAI,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;oBACnC,IAAI,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE;iBAC5C;aACF;SACF;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,cAAc;YACrB,WAAW,EAAE,2IAA2I;YACxJ,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;oBACrC,IAAI,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;oBACnC,IAAI,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,MAAM;oBACd,OAAO,EAAE;wBACP,QAAQ,EAAE,YAAY;qBACvB;oBACD,IAAI,EAAE,SAAS;iBAChB,CAAC,CAAA;gBAEF,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;aACxB;QACH,CAAC,CAAC,CAAA;QACF,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IACpC,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA;AASrB,SAAS,WAAW,CAAC,YAAuB;IAC1C,MAAM,MAAM,GAAkB,EAAE,CAAA;IAEhC,YAAY,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC/B,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,OAAO,CAAA;QAEhD,MAAM,GAAG,GAAG,OAAO,IAAI,UAAU,CAAA;QAGjC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;YAChB,MAAM,KAAK,GAAyD;gBAClE,QAAQ,EAAE,EAAE;aACb,CAAA;YAED,IAAI,OAAO,KAAK,SAAS,EAAE;gBACzB,KAAK,CAAC,OAAO,GAAG,OAAO,CAAA;aACxB;YAED,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;SACpB;QAGD,MAAM,oBAAoB,GAAG,oCAAwB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;QAG1E,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;IACjD,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -27,6 +27,9 @@ const action = {
|
|
|
27
27
|
type: 'string',
|
|
28
28
|
default: { '@path': '$.context.traits.phone' }
|
|
29
29
|
},
|
|
30
|
+
country_code: {
|
|
31
|
+
...properties_1.country_code
|
|
32
|
+
},
|
|
30
33
|
external_id: {
|
|
31
34
|
label: 'External ID',
|
|
32
35
|
description: `A unique identifier used by customers to associate Klaviyo profiles with profiles in an external system. One of External ID, Phone Number and Email required.`,
|
|
@@ -212,14 +215,12 @@ const action = {
|
|
|
212
215
|
}
|
|
213
216
|
},
|
|
214
217
|
perform: async (request, { payload, hookOutputs }) => {
|
|
215
|
-
const { email, external_id, phone_number, enable_batching, batch_size, list_id: otherListId, override_list_id, ...otherAttributes } = payload;
|
|
218
|
+
const { email, external_id, phone_number: initialPhoneNumber, enable_batching, batch_size, list_id: otherListId, override_list_id, country_code, ...otherAttributes } = payload;
|
|
216
219
|
const list_id = hookOutputs?.retlOnMappingSave?.outputs?.id ?? override_list_id ?? otherListId;
|
|
220
|
+
const phone_number = functions_1.processPhoneNumber(initialPhoneNumber, country_code);
|
|
217
221
|
if (!email && !phone_number && !external_id) {
|
|
218
222
|
throw new actions_core_1.PayloadValidationError('One of External ID, Phone Number and Email is required.');
|
|
219
223
|
}
|
|
220
|
-
if (phone_number && !functions_1.validatePhoneNumber(phone_number)) {
|
|
221
|
-
throw new actions_core_1.PayloadValidationError(`${phone_number} is not a valid E.164 phone number.`);
|
|
222
|
-
}
|
|
223
224
|
const profileData = {
|
|
224
225
|
data: {
|
|
225
226
|
type: 'profile',
|
|
@@ -265,7 +266,11 @@ const action = {
|
|
|
265
266
|
},
|
|
266
267
|
performBatch: async (request, { payload, hookOutputs }) => {
|
|
267
268
|
payload = payload.filter((profile) => {
|
|
268
|
-
|
|
269
|
+
const validPhoneNumber = functions_1.validateAndConvertPhoneNumber(profile.phone_number, profile.country_code);
|
|
270
|
+
if (validPhoneNumber) {
|
|
271
|
+
profile.phone_number = validPhoneNumber;
|
|
272
|
+
}
|
|
273
|
+
else if (validPhoneNumber === null) {
|
|
269
274
|
return false;
|
|
270
275
|
}
|
|
271
276
|
return profile.email || profile.phone_number || profile.external_id;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/upsertProfile/index.ts"],"names":[],"mappings":";;AAIA,sCAAmC;AACnC,wDAA8D;AAE9D,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/upsertProfile/index.ts"],"names":[],"mappings":";;AAIA,sCAAmC;AACnC,wDAA8D;AAE9D,4CAWqB;AACrB,8CAAwD;AAExD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,sBAAsB;IACnC,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,KAAK,EAAE;YACL,KAAK,EAAE,OAAO;YACd,WAAW,EAAE,kFAAkF;YAC/F,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,OAAO;YACf,OAAO,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;SACvC;QACD,eAAe,EAAE;YACf,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,uBAAuB;YAC9B,WAAW,EAAE,0DAA0D;SACxE;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,cAAc;YACrB,WAAW,EAAE,mKAAmK;YAChL,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE;SAC/C;QACD,YAAY,EAAE;YACZ,GAAG,yBAAY;SAChB;QACD,WAAW,EAAE;YACX,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,+JAA+J;YAC5K,IAAI,EAAE,QAAQ;SACf;QACD,UAAU,EAAE;YACV,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,0BAA0B;YACvC,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;SAC3C;QACD,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,yBAAyB;YACtC,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE;SAC1C;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,cAAc;YACrB,WAAW,EAAE,uFAAuF;YACpG,IA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,CAAC,WAAW,CAAA;QACrE,CAAC,CAAC,CAAA;QAEF,MAAM,gBAAgB,GAAc,EAAE,CAAA;QACtC,MAAM,mBAAmB,GAAc,EAAE,CAAA;QAEzC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC1B,IAAI,WAAW,EAAE,iBAAiB,EAAE,OAAO,EAAE,EAAE,EAAE;gBAC/C,OAAO,CAAC,OAAO,GAAG,WAAW,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAE,CAAA;aAC3D;YACD,IAAI,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,gBAAgB,EAAE;gBAC/C,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;aAC/B;iBAAM;gBACL,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;aAClC;QACH,CAAC,CAAC,CAAA;QAEF,IAAI,sBAAsB,CAAA;QAC1B,IAAI,yBAAyB,CAAA;QAE7B,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;YAE/B,MAAM,eAAe,GAAG,yBAAa,CAAC,gBAAgB,CAAC,CAAA;YACvD,sBAAsB,GAAG,MAAM,kCAAsB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAA;SAChF;QAED,IAAI,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE;YAClC,MAAM,gBAAgB,GAAG,kCAAsB,CAAC,mBAAmB,CAAC,CAAA;YACpE,yBAAyB,GAAG,MAAM,gCAAoB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAA;SAClF;QAED,OAAO;YACL,QAAQ,EAAE,sBAAsB;YAChC,WAAW,EAAE,yBAAyB;SACvC,CAAA;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
package/dist/destinations/launchdarkly-audiences/syncAudience/custom-audience-operations.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestClient } from '@segment/actions-core';
|
|
2
2
|
import type { Payload } from './generated-types';
|
|
3
3
|
import { Settings } from '../generated-types';
|
|
4
|
-
declare function processPayload(request: RequestClient, settings: Settings, events: Payload[]): Promise<import("@segment/actions-core
|
|
4
|
+
declare function processPayload(request: RequestClient, settings: Settings, events: Payload[]): Promise<import("@segment/actions-core").ModifiedResponse<unknown>[]>;
|
|
5
5
|
export { processPayload };
|
|
@@ -35,7 +35,6 @@ class LinkedInAudiences {
|
|
|
35
35
|
sourcePlatform: constants_1.LINKEDIN_SOURCE_PLATFORM,
|
|
36
36
|
sourceSegmentId: payload.personas_audience_key,
|
|
37
37
|
account: `urn:li:sponsoredAccount:${settings.ad_account_id}`,
|
|
38
|
-
accessPolicy: 'PRIVATE',
|
|
39
38
|
type: 'USER',
|
|
40
39
|
destinations: [
|
|
41
40
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/linkedin-audiences/api/index.ts"],"names":[],"mappings":";;;AAGA,4CAAiE;AAGjE,MAAa,iBAAiB;IAG5B,YAAY,OAAsB;QAChC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,KAAK,CAAC,UAAU;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,oBAAQ,KAAK,EAAE;YACpC,MAAM,EAAE,KAAK;SACd,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,uBAAuB,CAAC,QAAkB,EAAE,MAAc;QAC9D,OAAO,IAAI,CAAC,OAAO,CACjB,GAAG,oBAAQ,mDAAmD,QAAQ,CAAC,aAAa,uBAAuB,MAAM,EAAE,EACnH;YACE,MAAM,EAAE,KAAK;SACd,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,QAAkB,EAAE,OAAgB;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,oBAAQ,cAAc,EAAE;YAC7C,MAAM,EAAE,KAAK;YACb,YAAY,EAAE;gBACZ,CAAC,EAAE,SAA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OAAO,EAAE,2BAA2B,QAAQ,CAAC,aAAa,EAAE;gBAC5D,eAAe,EAAE,OAAO,CAAC,qBAAqB,IAAI,EAAE;gBACpD,cAAc,EAAE,oCAAwB;aACzC;SACF,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,QAAkB,EAAE,OAAgB;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,oBAAQ,cAAc,EAAE;YAC7C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,IAAI,EAAE,OAAO,CAAC,gBAAgB;gBAC9B,cAAc,EAAE,oCAAwB;gBACxC,eAAe,EAAE,OAAO,CAAC,qBAAqB;gBAC9C,OAAO,EAAE,2BAA2B,QAAQ,CAAC,aAAa,EAAE;gBAC5D,IAAI,EAAE,MAAM;gBACZ,YAAY,EAAE;oBACZ;wBACE,WAAW,EAAE,UAAU;qBACxB;iBACF;aACF;SACF,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,YAAoB,EAAE,QAAkC;QACxE,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,oBAAQ,gBAAgB,YAAY,QAAQ,EAAE;YACnE,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,iBAAiB,EAAE,cAAc;aAClC;YACD,IAAI,EAAE;gBACJ,QAAQ;aACT;YACD,eAAe,EAAE,KAAK;SACvB,CAAC,CAAA;IACJ,CAAC;CACF;AAhED,8CAgEC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LINKEDIN_SOURCE_PLATFORM = exports.BASE_URL = exports.LINKEDIN_API_VERSION = void 0;
|
|
4
|
-
exports.LINKEDIN_API_VERSION = '
|
|
4
|
+
exports.LINKEDIN_API_VERSION = '202409';
|
|
5
5
|
exports.BASE_URL = 'https://api.linkedin.com/rest';
|
|
6
6
|
exports.LINKEDIN_SOURCE_PLATFORM = 'SEGMENT';
|
|
7
7
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/addToCart/index.ts"],"names":[],"mappings":";;AAIA,oCAAyC;AACzC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/addToCart/index.ts"],"names":[],"mappings":";;AAIA,oCAAyC;AACzC,sCAAuD;AAEvD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,4DAA4D;IACzE,mBAAmB,EAAE,4CAA4C;IACjE,MAAM,EAAE;QACN,QAAQ,EAAE;YACR,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,uCAAuC;YACpD,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,uBAAuB,EAAE;YAC7C,QAAQ,EAAE,IAAI;SACf;QACD,GAAG,sBAAa;QAChB,GAAG,qBAAY;KAChB;IACD,OAAO,EAAE,sBAAc,CAAC,aAAa,CAAC;CACvC,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -8,7 +8,8 @@ const action = {
|
|
|
8
8
|
defaultSubscription: 'type = "track" and event = "Checkout Started"',
|
|
9
9
|
fields: {
|
|
10
10
|
...schema_1.priceFields(),
|
|
11
|
-
...schema_1.orderInfoFields
|
|
11
|
+
...schema_1.orderInfoFields,
|
|
12
|
+
...schema_1.clientFields
|
|
12
13
|
},
|
|
13
14
|
perform: utils_1.buildPerformer('checkout')
|
|
14
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/checkout/index.ts"],"names":[],"mappings":";;AAIA,oCAAyC;AACzC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/checkout/index.ts"],"names":[],"mappings":";;AAIA,oCAAyC;AACzC,sCAAsE;AAEtE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,UAAU;IACjB,WAAW,EAAE,oGAAoG;IACjH,mBAAmB,EAAE,+CAA+C;IACpE,MAAM,EAAE;QACN,GAAG,oBAAW,EAAE;QAChB,GAAG,wBAAe;QAClB,GAAG,qBAAY;KAChB;IACD,OAAO,EAAE,sBAAc,CAAC,UAAU,CAAC;CACpC,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
|
+
const schema_1 = require("../schema");
|
|
4
5
|
const action = {
|
|
5
6
|
title: 'Code',
|
|
6
7
|
description: 'Track when a user enters a discount code at checkout.',
|
|
@@ -19,7 +20,8 @@ const action = {
|
|
|
19
20
|
type: 'string',
|
|
20
21
|
default: 'promo',
|
|
21
22
|
required: true
|
|
22
|
-
}
|
|
23
|
+
},
|
|
24
|
+
...schema_1.clientFields
|
|
23
25
|
},
|
|
24
26
|
perform: utils_1.buildPerformer('code')
|
|
25
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/code/index.ts"],"names":[],"mappings":";;AAIA,oCAAyC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/code/index.ts"],"names":[],"mappings":";;AAIA,oCAAyC;AACzC,sCAAwC;AAExC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,MAAM;IACb,WAAW,EAAE,uDAAuD;IACpE,mBAAmB,EAAE,6CAA6C;IAClE,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,qCAAqC;YAClD,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE;YAC9C,QAAQ,EAAE,IAAI;SACf;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,0CAA0C;YACvD,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,OAAO;YAChB,QAAQ,EAAE,IAAI;SACf;QACD,GAAG,qBAAY;KAChB;IACD,OAAO,EAAE,sBAAc,CAAC,MAAM,CAAC;CAChC,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
|
+
const schema_1 = require("../schema");
|
|
4
5
|
const action = {
|
|
5
6
|
title: 'Identify',
|
|
6
7
|
description: 'If you have your own identifiers for customers, Magellan AI can accept that identifier and report it back to you with other measurement data.',
|
|
@@ -12,7 +13,8 @@ const action = {
|
|
|
12
13
|
type: 'string',
|
|
13
14
|
default: { '@path': '$.userId' },
|
|
14
15
|
required: true
|
|
15
|
-
}
|
|
16
|
+
},
|
|
17
|
+
...schema_1.clientFields
|
|
16
18
|
},
|
|
17
19
|
perform: utils_1.buildPerformer('identify')
|
|
18
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/identify/index.ts"],"names":[],"mappings":";;AAIA,oCAAyC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/identify/index.ts"],"names":[],"mappings":";;AAIA,oCAAyC;AACzC,sCAAwC;AAExC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,UAAU;IACjB,WAAW,EACT,+IAA+I;IACjJ,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,MAAM,EAAE;YACN,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,+CAA+C;YAC5D,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;YAChC,QAAQ,EAAE,IAAI;SACf;QACD,GAAG,qBAAY;KAChB;IACD,OAAO,EAAE,sBAAc,CAAC,UAAU,CAAC;CACpC,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -6,7 +6,10 @@ const action = {
|
|
|
6
6
|
title: 'Install',
|
|
7
7
|
description: 'Fire this event to track when a user installs your mobile application. (Mobile applications only)',
|
|
8
8
|
defaultSubscription: 'type = "track" and event = "Application Installed"',
|
|
9
|
-
fields:
|
|
9
|
+
fields: {
|
|
10
|
+
...schema_1.mobileFields,
|
|
11
|
+
...schema_1.clientFields
|
|
12
|
+
},
|
|
10
13
|
perform: utils_1.buildPerformer('install')
|
|
11
14
|
};
|
|
12
15
|
exports.default = action;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/install/index.ts"],"names":[],"mappings":";;AAIA,oCAAyC;AACzC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/install/index.ts"],"names":[],"mappings":";;AAIA,oCAAyC;AACzC,sCAAsD;AAEtD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,SAAS;IAChB,WAAW,EAAE,mGAAmG;IAChH,mBAAmB,EAAE,oDAAoD;IACzE,MAAM,EAAE;QACN,GAAG,qBAAY;QACf,GAAG,qBAAY;KAChB;IACD,OAAO,EAAE,sBAAc,CAAC,SAAS,CAAC;CACnC,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/lead/index.ts"],"names":[],"mappings":";;AAIA,oCAAyC;AACzC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/lead/index.ts"],"names":[],"mappings":";;AAIA,oCAAyC;AACzC,sCAAqD;AAErD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,MAAM;IACb,WAAW,EAAE,gFAAgF;IAC7F,mBAAmB,EAAE,wCAAwC;IAC7D,MAAM,EAAE;QACN,GAAG,oBAAW,EAAE;QAChB,EAAE,EAAE;YACF,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,uCAAuC;YACpD,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;QACD,SAAS,EAAE;YACT,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,0CAA0C;YACvD,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,yBAAyB,EAAE;YAC/C,QAAQ,EAAE,KAAK;SAChB;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,8CAA8C;YAC3D,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,uBAAuB,EAAE;YAC7C,QAAQ,EAAE,KAAK;SAChB;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,kBAAkB;YAC/B,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE;YACzC,QAAQ,EAAE,KAAK;SAChB;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,eAAe;YACtB,WAAW,EAAE,sBAAsB;YACnC,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,uBAAuB,EAAE;YAC7C,QAAQ,EAAE,KAAK;SAChB;QACD,GAAG,qBAAY;KAChB;IACD,OAAO,EAAE,sBAAc,CAAC,MAAM,CAAC;CAChC,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -6,7 +6,10 @@ const action = {
|
|
|
6
6
|
title: 'Product',
|
|
7
7
|
description: 'Indicates that a user has visited the page for a specific product or variant of a product. This event is similar to the view event, but allows you to provide more details about the product the user has seen.',
|
|
8
8
|
defaultSubscription: 'type = "track" and event = "Product Viewed"',
|
|
9
|
-
fields:
|
|
9
|
+
fields: {
|
|
10
|
+
...schema_1.productFields,
|
|
11
|
+
...schema_1.clientFields
|
|
12
|
+
},
|
|
10
13
|
perform: utils_1.buildPerformer('product')
|
|
11
14
|
};
|
|
12
15
|
exports.default = action;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/product/index.ts"],"names":[],"mappings":";;AAIA,oCAAyC;AACzC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/product/index.ts"],"names":[],"mappings":";;AAIA,oCAAyC;AACzC,sCAAuD;AAEvD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,SAAS;IAChB,WAAW,EACT,iNAAiN;IACnN,mBAAmB,EAAE,6CAA6C;IAClE,MAAM,EAAE;QACN,GAAG,sBAAa;QAChB,GAAG,qBAAY;KAChB;IACD,OAAO,EAAE,sBAAc,CAAC,SAAS,CAAC;CACnC,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/purchase/index.ts"],"names":[],"mappings":";;AAIA,oCAAyC;AACzC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/purchase/index.ts"],"names":[],"mappings":";;AAIA,oCAAyC;AACzC,sCAAsE;AAEtE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,UAAU;IACjB,WAAW,EAAE,2DAA2D;IACxE,mBAAmB,EAAE,8CAA8C;IACnE,MAAM,EAAE;QACN,GAAG,oBAAW,CAAC,OAAO,CAAC;QACvB,GAAG,wBAAe;QAClB,aAAa,EAAE;YACb,KAAK,EAAE,eAAe;YACtB,WAAW,EAAE,oEAAoE;YACjF,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,KAAK;SAChB;QACD,GAAG,qBAAY;KAChB;IACD,OAAO,EAAE,sBAAc,CAAC,UAAU,CAAC;CACpC,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { InputField } from '@segment/actions-core';
|
|
2
|
+
export declare const clientFields: Record<string, InputField>;
|
|
2
3
|
export declare function priceFields(valueSource?: string): Record<string, InputField>;
|
|
3
4
|
export declare const lineItemFields: Record<string, InputField>;
|
|
4
5
|
export declare const productFields: Record<string, InputField>;
|