@azzas/azzas-tracker-web 2.0.0-preview.13 → 2.0.0-preview.14
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 +11 -11
- package/dist/mod.cjs.map +1 -1
- package/dist/mod.d.cts +2 -2
- package/dist/mod.d.ts +2 -2
- package/dist/mod.global.js +11 -11
- package/dist/mod.global.js.map +1 -1
- package/dist/mod.js +11 -11
- package/dist/mod.js.map +1 -1
- package/dist/mod.vtex.global.js +13 -13
- package/package.json +1 -1
package/dist/mod.js
CHANGED
|
@@ -1065,18 +1065,18 @@ var PROD_DOMAINS = {
|
|
|
1065
1065
|
}
|
|
1066
1066
|
};
|
|
1067
1067
|
async function getUserInfo(context) {
|
|
1068
|
-
var _a, _b, _c, _d, _e;
|
|
1069
|
-
const domain = (
|
|
1070
|
-
if (!domain) return { customer: { email: context.userEmail, id: context == null ? void 0 : context.userId }, address: null };
|
|
1068
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I;
|
|
1069
|
+
const domain = (_e = PROD_DOMAINS[(_b = (_a = context == null ? void 0 : context.meta) == null ? void 0 : _a.user_info) == null ? void 0 : _b.account]) == null ? void 0 : _e[(_d = (_c = context == null ? void 0 : context.meta) == null ? void 0 : _c.user_info) == null ? void 0 : _d.platform];
|
|
1070
|
+
if (!domain) return { customer: { email: (_g = (_f = context == null ? void 0 : context.meta) == null ? void 0 : _f.user_info) == null ? void 0 : _g.userEmail, id: (_i = (_h = context == null ? void 0 : context.meta) == null ? void 0 : _h.user_info) == null ? void 0 : _i.userId }, address: null };
|
|
1071
1071
|
try {
|
|
1072
1072
|
const api = `${domain}/_v/user-info`;
|
|
1073
1073
|
const response = await fetch(api, {
|
|
1074
1074
|
method: "POST",
|
|
1075
|
-
body: JSON.stringify({ email: context.userEmail })
|
|
1075
|
+
body: JSON.stringify({ email: (_k = (_j = context == null ? void 0 : context.meta) == null ? void 0 : _j.user_info) == null ? void 0 : _k.userEmail })
|
|
1076
1076
|
});
|
|
1077
1077
|
if (response.status !== 200) {
|
|
1078
|
-
if ((context == null ? void 0 : context.manuallyInfo) && ((
|
|
1079
|
-
const { cpf, birthDate, phone, firstName, lastName, email, email_optin } = context.manuallyInfo;
|
|
1078
|
+
if (((_m = (_l = context == null ? void 0 : context.meta) == null ? void 0 : _l.user_info) == null ? void 0 : _m.manuallyInfo) && ((_p = (_o = (_n = context == null ? void 0 : context.meta) == null ? void 0 : _n.user_info) == null ? void 0 : _o.manuallyInfo) == null ? void 0 : _p.cpf)) {
|
|
1079
|
+
const { cpf, birthDate, phone, firstName, lastName, email, email_optin } = (_r = (_q = context == null ? void 0 : context.meta) == null ? void 0 : _q.user_info) == null ? void 0 : _r.manuallyInfo;
|
|
1080
1080
|
const document3 = cpf == null ? void 0 : cpf.replace(/\D/g, "");
|
|
1081
1081
|
const hashedDocument2 = await documentToHash(document3);
|
|
1082
1082
|
return {
|
|
@@ -1094,15 +1094,15 @@ async function getUserInfo(context) {
|
|
|
1094
1094
|
}
|
|
1095
1095
|
};
|
|
1096
1096
|
}
|
|
1097
|
-
return { customer: { email: context.userEmail, id: context == null ? void 0 : context.userId }, address: null };
|
|
1097
|
+
return { customer: { email: (_t = (_s = context == null ? void 0 : context.meta) == null ? void 0 : _s.user_info) == null ? void 0 : _t.userEmail, id: (_v = (_u = context == null ? void 0 : context.meta) == null ? void 0 : _u.user_info) == null ? void 0 : _v.userId }, address: null };
|
|
1098
1098
|
}
|
|
1099
1099
|
const res = await response.json();
|
|
1100
|
-
const document2 = (
|
|
1100
|
+
const document2 = (_x = (_w = res == null ? void 0 : res.customer) == null ? void 0 : _w.document) == null ? void 0 : _x.replace(/\D/g, "");
|
|
1101
1101
|
const hashedDocument = await documentToHash(document2);
|
|
1102
1102
|
return { ...res, customer: { ...res.customer, cpf: hashedDocument, document: document2 } };
|
|
1103
1103
|
} catch (_) {
|
|
1104
|
-
if ((context == null ? void 0 : context.manuallyInfo) && ((
|
|
1105
|
-
const { cpf, birthDate, phone, firstName, lastName, email, email_optin } = context.manuallyInfo;
|
|
1104
|
+
if (((_z = (_y = context == null ? void 0 : context.meta) == null ? void 0 : _y.user_info) == null ? void 0 : _z.manuallyInfo) && ((_C = (_B = (_A = context == null ? void 0 : context.meta) == null ? void 0 : _A.user_info) == null ? void 0 : _B.manuallyInfo) == null ? void 0 : _C.cpf)) {
|
|
1105
|
+
const { cpf, birthDate, phone, firstName, lastName, email, email_optin } = (_E = (_D = context == null ? void 0 : context.meta) == null ? void 0 : _D.user_info) == null ? void 0 : _E.manuallyInfo;
|
|
1106
1106
|
const document2 = cpf == null ? void 0 : cpf.replace(/\D/g, "");
|
|
1107
1107
|
const hashedDocument = await documentToHash(document2);
|
|
1108
1108
|
return {
|
|
@@ -1120,7 +1120,7 @@ async function getUserInfo(context) {
|
|
|
1120
1120
|
}
|
|
1121
1121
|
};
|
|
1122
1122
|
}
|
|
1123
|
-
return { customer: { email: context.userEmail, id: context == null ? void 0 : context.userId }, address: null };
|
|
1123
|
+
return { customer: { email: (_G = (_F = context == null ? void 0 : context.meta) == null ? void 0 : _F.user_info) == null ? void 0 : _G.userEmail, id: (_I = (_H = context == null ? void 0 : context.meta) == null ? void 0 : _H.user_info) == null ? void 0 : _I.userId }, address: null };
|
|
1124
1124
|
}
|
|
1125
1125
|
}
|
|
1126
1126
|
|