saasco-sdk 0.1.44 → 0.1.45
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/index.cjs.js +6 -39
- package/index.esm.js +6 -39
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -8,7 +8,7 @@ var uuid$1 = require('@lukeed/uuid');
|
|
|
8
8
|
var jsSha256 = require('js-sha256');
|
|
9
9
|
var zod = require('zod');
|
|
10
10
|
|
|
11
|
-
var version = "0.1.
|
|
11
|
+
var version = "0.1.45";
|
|
12
12
|
|
|
13
13
|
const timezones = {
|
|
14
14
|
'Asia/Barnaul': 'RU',
|
|
@@ -918,7 +918,7 @@ function coerceMetaConversionsAmValues(properties) {
|
|
|
918
918
|
coerceFrom,
|
|
919
919
|
transform
|
|
920
920
|
} of coerce) {
|
|
921
|
-
const foundValue = findFirstProperty$
|
|
921
|
+
const foundValue = findFirstProperty$1(properties, coerceFrom);
|
|
922
922
|
if (foundValue !== null && transform) {
|
|
923
923
|
const transformedValue = transform(foundValue);
|
|
924
924
|
if (transformedValue) {
|
|
@@ -930,7 +930,7 @@ function coerceMetaConversionsAmValues(properties) {
|
|
|
930
930
|
}
|
|
931
931
|
return result;
|
|
932
932
|
}
|
|
933
|
-
function findFirstProperty$
|
|
933
|
+
function findFirstProperty$1(properties, keys) {
|
|
934
934
|
for (const key of keys) {
|
|
935
935
|
if (properties[key] !== undefined) {
|
|
936
936
|
return properties[key];
|
|
@@ -1018,22 +1018,17 @@ function createPinterestTagIntegration(config, debug) {
|
|
|
1018
1018
|
}
|
|
1019
1019
|
});
|
|
1020
1020
|
}),
|
|
1021
|
-
track: (eventName, properties
|
|
1021
|
+
track: (eventName, properties) => {
|
|
1022
1022
|
if (!isTagReady || !window.pintrk) return;
|
|
1023
1023
|
const pinterestEventName = getPinterestEventName(eventName, config.eventMapping);
|
|
1024
1024
|
const eventData = buildEventData(properties);
|
|
1025
|
-
// Get enhanced matching data from properties
|
|
1026
|
-
const enhancedMatchData = getPinterestEnhancedMatchData(context || {});
|
|
1027
1025
|
logger.debug('Tracking event', {
|
|
1028
1026
|
eventName,
|
|
1029
1027
|
pinterestEventName,
|
|
1030
|
-
eventData
|
|
1031
|
-
enhancedMatchData
|
|
1028
|
+
eventData
|
|
1032
1029
|
});
|
|
1033
|
-
// Combine event data with enhanced matching data
|
|
1034
|
-
const finalEventData = Object.assign(Object.assign({}, eventData), enhancedMatchData);
|
|
1035
1030
|
// Track the event
|
|
1036
|
-
window.pintrk('track', pinterestEventName,
|
|
1031
|
+
window.pintrk('track', pinterestEventName, eventData);
|
|
1037
1032
|
},
|
|
1038
1033
|
identify: (userId, properties, context) => {
|
|
1039
1034
|
// Identify not supported with pinterest tag
|
|
@@ -1087,34 +1082,6 @@ function buildEventData(properties) {
|
|
|
1087
1082
|
}
|
|
1088
1083
|
return eventData;
|
|
1089
1084
|
}
|
|
1090
|
-
/**
|
|
1091
|
-
* Get Pinterest Enhanced Matching values from properties
|
|
1092
|
-
* Reference: https://help.pinterest.com/en/business/article/enhanced-match
|
|
1093
|
-
*/
|
|
1094
|
-
function getPinterestEnhancedMatchData(properties) {
|
|
1095
|
-
const enhancedMatch = {};
|
|
1096
|
-
// Email
|
|
1097
|
-
const email = findFirstProperty$1(properties, ['email', 'user_email', 'userEmail', 'email_address', 'emailAddress', 'e_mail', 'E_Mail', 'mail', 'Mail', 'contact_email', 'contactEmail', 'primary_email', 'primaryEmail']);
|
|
1098
|
-
if (email && typeof email === 'string') {
|
|
1099
|
-
// Pinterest expects hashed email for enhanced matching
|
|
1100
|
-
const normalizedEmail = email.trim().toLowerCase();
|
|
1101
|
-
enhancedMatch.em = normalizedEmail;
|
|
1102
|
-
}
|
|
1103
|
-
// External ID (User ID)
|
|
1104
|
-
const externalId = findFirstProperty$1(properties, ['external_id', 'externalId', 'user_id', 'userId', 'id', 'distinctId', 'distinct_id', 'customer_id', 'customerId', 'member_id', 'memberId']);
|
|
1105
|
-
if (externalId) {
|
|
1106
|
-
enhancedMatch.external_id = String(externalId);
|
|
1107
|
-
}
|
|
1108
|
-
return enhancedMatch;
|
|
1109
|
-
}
|
|
1110
|
-
function findFirstProperty$1(properties, keys) {
|
|
1111
|
-
for (const key of keys) {
|
|
1112
|
-
if (properties[key] !== undefined) {
|
|
1113
|
-
return properties[key];
|
|
1114
|
-
}
|
|
1115
|
-
}
|
|
1116
|
-
return null;
|
|
1117
|
-
}
|
|
1118
1085
|
|
|
1119
1086
|
/**
|
|
1120
1087
|
* TikTok Pixel Integration
|
package/index.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ import { v4 } from '@lukeed/uuid';
|
|
|
4
4
|
import { sha256 } from 'js-sha256';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
|
|
7
|
-
var version = "0.1.
|
|
7
|
+
var version = "0.1.45";
|
|
8
8
|
|
|
9
9
|
const timezones = {
|
|
10
10
|
'Asia/Barnaul': 'RU',
|
|
@@ -914,7 +914,7 @@ function coerceMetaConversionsAmValues(properties) {
|
|
|
914
914
|
coerceFrom,
|
|
915
915
|
transform
|
|
916
916
|
} of coerce) {
|
|
917
|
-
const foundValue = findFirstProperty$
|
|
917
|
+
const foundValue = findFirstProperty$1(properties, coerceFrom);
|
|
918
918
|
if (foundValue !== null && transform) {
|
|
919
919
|
const transformedValue = transform(foundValue);
|
|
920
920
|
if (transformedValue) {
|
|
@@ -926,7 +926,7 @@ function coerceMetaConversionsAmValues(properties) {
|
|
|
926
926
|
}
|
|
927
927
|
return result;
|
|
928
928
|
}
|
|
929
|
-
function findFirstProperty$
|
|
929
|
+
function findFirstProperty$1(properties, keys) {
|
|
930
930
|
for (const key of keys) {
|
|
931
931
|
if (properties[key] !== undefined) {
|
|
932
932
|
return properties[key];
|
|
@@ -1014,22 +1014,17 @@ function createPinterestTagIntegration(config, debug) {
|
|
|
1014
1014
|
}
|
|
1015
1015
|
});
|
|
1016
1016
|
}),
|
|
1017
|
-
track: (eventName, properties
|
|
1017
|
+
track: (eventName, properties) => {
|
|
1018
1018
|
if (!isTagReady || !window.pintrk) return;
|
|
1019
1019
|
const pinterestEventName = getPinterestEventName(eventName, config.eventMapping);
|
|
1020
1020
|
const eventData = buildEventData(properties);
|
|
1021
|
-
// Get enhanced matching data from properties
|
|
1022
|
-
const enhancedMatchData = getPinterestEnhancedMatchData(context || {});
|
|
1023
1021
|
logger.debug('Tracking event', {
|
|
1024
1022
|
eventName,
|
|
1025
1023
|
pinterestEventName,
|
|
1026
|
-
eventData
|
|
1027
|
-
enhancedMatchData
|
|
1024
|
+
eventData
|
|
1028
1025
|
});
|
|
1029
|
-
// Combine event data with enhanced matching data
|
|
1030
|
-
const finalEventData = Object.assign(Object.assign({}, eventData), enhancedMatchData);
|
|
1031
1026
|
// Track the event
|
|
1032
|
-
window.pintrk('track', pinterestEventName,
|
|
1027
|
+
window.pintrk('track', pinterestEventName, eventData);
|
|
1033
1028
|
},
|
|
1034
1029
|
identify: (userId, properties, context) => {
|
|
1035
1030
|
// Identify not supported with pinterest tag
|
|
@@ -1083,34 +1078,6 @@ function buildEventData(properties) {
|
|
|
1083
1078
|
}
|
|
1084
1079
|
return eventData;
|
|
1085
1080
|
}
|
|
1086
|
-
/**
|
|
1087
|
-
* Get Pinterest Enhanced Matching values from properties
|
|
1088
|
-
* Reference: https://help.pinterest.com/en/business/article/enhanced-match
|
|
1089
|
-
*/
|
|
1090
|
-
function getPinterestEnhancedMatchData(properties) {
|
|
1091
|
-
const enhancedMatch = {};
|
|
1092
|
-
// Email
|
|
1093
|
-
const email = findFirstProperty$1(properties, ['email', 'user_email', 'userEmail', 'email_address', 'emailAddress', 'e_mail', 'E_Mail', 'mail', 'Mail', 'contact_email', 'contactEmail', 'primary_email', 'primaryEmail']);
|
|
1094
|
-
if (email && typeof email === 'string') {
|
|
1095
|
-
// Pinterest expects hashed email for enhanced matching
|
|
1096
|
-
const normalizedEmail = email.trim().toLowerCase();
|
|
1097
|
-
enhancedMatch.em = normalizedEmail;
|
|
1098
|
-
}
|
|
1099
|
-
// External ID (User ID)
|
|
1100
|
-
const externalId = findFirstProperty$1(properties, ['external_id', 'externalId', 'user_id', 'userId', 'id', 'distinctId', 'distinct_id', 'customer_id', 'customerId', 'member_id', 'memberId']);
|
|
1101
|
-
if (externalId) {
|
|
1102
|
-
enhancedMatch.external_id = String(externalId);
|
|
1103
|
-
}
|
|
1104
|
-
return enhancedMatch;
|
|
1105
|
-
}
|
|
1106
|
-
function findFirstProperty$1(properties, keys) {
|
|
1107
|
-
for (const key of keys) {
|
|
1108
|
-
if (properties[key] !== undefined) {
|
|
1109
|
-
return properties[key];
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
return null;
|
|
1113
|
-
}
|
|
1114
1081
|
|
|
1115
1082
|
/**
|
|
1116
1083
|
* TikTok Pixel Integration
|