@azzas/azzas-tracker-web 2.0.0-preview.12 → 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.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 = (_a = PROD_DOMAINS[context.account || "animale"]) == null ? void 0 : _a[context.platform || "store"];
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) && ((_b = context.manuallyInfo) == null ? void 0 : _b.cpf)) {
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 = (_d = (_c = res == null ? void 0 : res.customer) == null ? void 0 : _c.document) == null ? void 0 : _d.replace(/\D/g, "");
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) && ((_e = context.manuallyInfo) == null ? void 0 : _e.cpf)) {
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
 
@@ -1329,6 +1329,11 @@ var legacyGetters = {
1329
1329
  // src/params/adapters/meta/index.ts
1330
1330
  var metaAdapter = {
1331
1331
  user_info: getUserInfo,
1332
+ brand: (context, config2) => {
1333
+ if (config2 == null ? void 0 : config2.brand) return config2.brand;
1334
+ if (context == null ? void 0 : context.meta.brand) return context.meta.brand;
1335
+ return null;
1336
+ },
1332
1337
  content_type: (context) => {
1333
1338
  return context.meta.content_type || null;
1334
1339
  },