@azzas/azzas-tracker-web 1.0.95 → 1.0.96
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/mod.cjs +70 -73
- package/dist/mod.cjs.map +1 -1
- package/dist/mod.d.cts +2 -0
- package/dist/mod.d.ts +2 -0
- package/dist/mod.global.js +70 -73
- package/dist/mod.global.js.map +1 -1
- package/dist/mod.js +70 -73
- package/dist/mod.js.map +1 -1
- package/dist/mod.vtex.global.js +114 -114
- package/package.json +1 -1
package/dist/mod.global.js
CHANGED
|
@@ -194,7 +194,8 @@ var AzzasTracker = (() => {
|
|
|
194
194
|
AUTH_ACTION: {
|
|
195
195
|
name: "auth_action",
|
|
196
196
|
hasEcommerce: false,
|
|
197
|
-
requiredParams: ["region"]
|
|
197
|
+
requiredParams: ["region"],
|
|
198
|
+
destinations: ["DataLayer"]
|
|
198
199
|
},
|
|
199
200
|
ADD_PERSONAL_INFO: {
|
|
200
201
|
name: "add_personal_info",
|
|
@@ -1001,89 +1002,84 @@ var AzzasTracker = (() => {
|
|
|
1001
1002
|
}
|
|
1002
1003
|
|
|
1003
1004
|
// src/params/userInfo.ts
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
"
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
"
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
"
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
"
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
async function getManuallyInfo(info) {
|
|
1026
|
-
if (!(info == null ? void 0 : info.cpf)) return null;
|
|
1027
|
-
const { cpf, birthDate, phone, firstName, lastName, email, email_optin } = info;
|
|
1028
|
-
const document2 = cpf == null ? void 0 : cpf.replace(/\D/g, "");
|
|
1029
|
-
const hashedDocument = await documentToHash(document2);
|
|
1030
|
-
let formattedBirthDate = null;
|
|
1031
|
-
if (birthDate) {
|
|
1032
|
-
const [day, month, year] = birthDate.split("/");
|
|
1033
|
-
if (day && month && year && !isNaN(Number(year))) {
|
|
1034
|
-
formattedBirthDate = `${year}-${month}-${day}T00:00:00Z`;
|
|
1035
|
-
} else {
|
|
1036
|
-
console.warn("[DT - user_info] Invalid birthDate format from manuallyInfo:", birthDate);
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
return {
|
|
1040
|
-
address: null,
|
|
1041
|
-
customer: {
|
|
1042
|
-
email,
|
|
1043
|
-
phone,
|
|
1044
|
-
document: document2,
|
|
1045
|
-
lastName,
|
|
1046
|
-
birthDate: formattedBirthDate,
|
|
1047
|
-
firstName,
|
|
1048
|
-
homePhone: phone,
|
|
1049
|
-
cpf: hashedDocument,
|
|
1050
|
-
...email_optin && { email_optin }
|
|
1005
|
+
async function getUserInfo(context, eventName) {
|
|
1006
|
+
var _a, _b, _c, _d, _e;
|
|
1007
|
+
const PROD_DOMAINS = {
|
|
1008
|
+
"animale": {
|
|
1009
|
+
"store": "https://www.animale.com.br",
|
|
1010
|
+
"checkout": "https://secure.animale.com.br"
|
|
1011
|
+
},
|
|
1012
|
+
"farm": {
|
|
1013
|
+
"store": "https://lojafarm.myvtex.com"
|
|
1014
|
+
},
|
|
1015
|
+
"mariafilo": {
|
|
1016
|
+
"store": "https://mariafilo.myvtex.com",
|
|
1017
|
+
"checkout": "https://secure.mariafilo.com.br"
|
|
1018
|
+
},
|
|
1019
|
+
"lojacrisbarros": {
|
|
1020
|
+
"store": "https://lojacrisbarros.myvtex.com",
|
|
1021
|
+
"checkout": "https://secure.crisbarros.com.br"
|
|
1022
|
+
},
|
|
1023
|
+
"lojaoffpremium": {
|
|
1024
|
+
"store": "https://lojaoffpremium.myvtex.com",
|
|
1025
|
+
"checkout": "https://secure.lojaoffpremium.com.br"
|
|
1051
1026
|
}
|
|
1052
1027
|
};
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
return {
|
|
1056
|
-
customer: { email: userEmail, id: userId },
|
|
1057
|
-
address: null
|
|
1058
|
-
};
|
|
1059
|
-
}
|
|
1060
|
-
async function getUserInfo(context, eventName) {
|
|
1061
|
-
var _a, _b, _c;
|
|
1062
|
-
const domain = (_a = PROD_DOMAINS[(context == null ? void 0 : context.account) || "https://www.animale.com.br"]) == null ? void 0 : _a[(context == null ? void 0 : context.platform) || "store"];
|
|
1063
|
-
if (!domain) return getFallbackUserInfo(context.userEmail, context == null ? void 0 : context.userId);
|
|
1028
|
+
const domain = (_a = PROD_DOMAINS[context.account || "https://www.animale.com.br"]) == null ? void 0 : _a[context.platform || "store"];
|
|
1029
|
+
if (!domain) return { customer: { email: context.userEmail, id: context == null ? void 0 : context.userId }, address: null };
|
|
1064
1030
|
try {
|
|
1065
1031
|
const api = `${domain}/_v/user-info`;
|
|
1066
1032
|
const response = await fetch(api, {
|
|
1067
1033
|
method: "POST",
|
|
1068
1034
|
body: JSON.stringify({ email: context.userEmail })
|
|
1069
1035
|
});
|
|
1070
|
-
if (response.status
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1036
|
+
if (response.status !== 200) {
|
|
1037
|
+
if ((context == null ? void 0 : context.manuallyInfo) && ((_b = context.manuallyInfo) == null ? void 0 : _b.cpf)) {
|
|
1038
|
+
const { cpf, birthDate, phone, firstName, lastName, email, email_optin } = context.manuallyInfo;
|
|
1039
|
+
const document3 = cpf == null ? void 0 : cpf.replace(/\D/g, "");
|
|
1040
|
+
const hashedDocument2 = await documentToHash(document3);
|
|
1041
|
+
return {
|
|
1042
|
+
address: null,
|
|
1043
|
+
customer: {
|
|
1044
|
+
email,
|
|
1045
|
+
phone,
|
|
1046
|
+
document: document3,
|
|
1047
|
+
lastName,
|
|
1048
|
+
birthDate,
|
|
1049
|
+
firstName,
|
|
1050
|
+
email_optin,
|
|
1051
|
+
homePhone: phone,
|
|
1052
|
+
cpf: hashedDocument2
|
|
1053
|
+
}
|
|
1054
|
+
};
|
|
1055
|
+
}
|
|
1056
|
+
return { customer: { email: context.userEmail, id: context == null ? void 0 : context.userId }, address: null };
|
|
1079
1057
|
}
|
|
1080
|
-
|
|
1058
|
+
const res = await response.json();
|
|
1059
|
+
const document2 = (_d = (_c = res == null ? void 0 : res.customer) == null ? void 0 : _c.document) == null ? void 0 : _d.replace(/\D/g, "");
|
|
1060
|
+
const hashedDocument = await documentToHash(document2);
|
|
1061
|
+
return { ...res, customer: { ...res.customer, cpf: hashedDocument, document: document2 } };
|
|
1081
1062
|
} catch (_) {
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1063
|
+
if ((context == null ? void 0 : context.manuallyInfo) && ((_e = context.manuallyInfo) == null ? void 0 : _e.cpf)) {
|
|
1064
|
+
const { cpf, birthDate, phone, firstName, lastName, email, email_optin } = context.manuallyInfo;
|
|
1065
|
+
const document2 = cpf == null ? void 0 : cpf.replace(/\D/g, "");
|
|
1066
|
+
const hashedDocument = await documentToHash(document2);
|
|
1067
|
+
return {
|
|
1068
|
+
address: null,
|
|
1069
|
+
customer: {
|
|
1070
|
+
email,
|
|
1071
|
+
phone,
|
|
1072
|
+
document: document2,
|
|
1073
|
+
lastName,
|
|
1074
|
+
birthDate,
|
|
1075
|
+
firstName,
|
|
1076
|
+
email_optin,
|
|
1077
|
+
homePhone: phone,
|
|
1078
|
+
cpf: hashedDocument
|
|
1079
|
+
}
|
|
1080
|
+
};
|
|
1085
1081
|
}
|
|
1086
|
-
return
|
|
1082
|
+
return { customer: { email: context.userEmail, id: context == null ? void 0 : context.userId }, address: null };
|
|
1087
1083
|
}
|
|
1088
1084
|
}
|
|
1089
1085
|
|
|
@@ -1094,6 +1090,7 @@ var AzzasTracker = (() => {
|
|
|
1094
1090
|
payment_type: getPaymentType,
|
|
1095
1091
|
user_info: getUserInfo,
|
|
1096
1092
|
content_type: (context, eventName) => {
|
|
1093
|
+
if (context == null ? void 0 : context.content_type) return context.content_type;
|
|
1097
1094
|
return `regiao`.concat(":" + context.category).concat(context.subcategory ? ":" + context.subcategory : "").concat(":" + context.componentName) || null;
|
|
1098
1095
|
},
|
|
1099
1096
|
region: (context, eventName) => {
|