@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 CHANGED
@@ -1094,18 +1094,18 @@ var PROD_DOMAINS = {
1094
1094
  }
1095
1095
  };
1096
1096
  async function getUserInfo(context) {
1097
- var _a, _b, _c, _d, _e;
1098
- const domain = (_a = PROD_DOMAINS[context.account || "animale"]) == null ? void 0 : _a[context.platform || "store"];
1099
- if (!domain) return { customer: { email: context.userEmail, id: context == null ? void 0 : context.userId }, address: null };
1097
+ 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;
1098
+ 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];
1099
+ 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 };
1100
1100
  try {
1101
1101
  const api = `${domain}/_v/user-info`;
1102
1102
  const response = await fetch(api, {
1103
1103
  method: "POST",
1104
- body: JSON.stringify({ email: context.userEmail })
1104
+ body: JSON.stringify({ email: (_k = (_j = context == null ? void 0 : context.meta) == null ? void 0 : _j.user_info) == null ? void 0 : _k.userEmail })
1105
1105
  });
1106
1106
  if (response.status !== 200) {
1107
- if ((context == null ? void 0 : context.manuallyInfo) && ((_b = context.manuallyInfo) == null ? void 0 : _b.cpf)) {
1108
- const { cpf, birthDate, phone, firstName, lastName, email, email_optin } = context.manuallyInfo;
1107
+ 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)) {
1108
+ 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;
1109
1109
  const document3 = cpf == null ? void 0 : cpf.replace(/\D/g, "");
1110
1110
  const hashedDocument2 = await documentToHash(document3);
1111
1111
  return {
@@ -1123,15 +1123,15 @@ async function getUserInfo(context) {
1123
1123
  }
1124
1124
  };
1125
1125
  }
1126
- return { customer: { email: context.userEmail, id: context == null ? void 0 : context.userId }, address: null };
1126
+ 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 };
1127
1127
  }
1128
1128
  const res = await response.json();
1129
- const document2 = (_d = (_c = res == null ? void 0 : res.customer) == null ? void 0 : _c.document) == null ? void 0 : _d.replace(/\D/g, "");
1129
+ const document2 = (_x = (_w = res == null ? void 0 : res.customer) == null ? void 0 : _w.document) == null ? void 0 : _x.replace(/\D/g, "");
1130
1130
  const hashedDocument = await documentToHash(document2);
1131
1131
  return { ...res, customer: { ...res.customer, cpf: hashedDocument, document: document2 } };
1132
1132
  } catch (_) {
1133
- if ((context == null ? void 0 : context.manuallyInfo) && ((_e = context.manuallyInfo) == null ? void 0 : _e.cpf)) {
1134
- const { cpf, birthDate, phone, firstName, lastName, email, email_optin } = context.manuallyInfo;
1133
+ 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)) {
1134
+ 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;
1135
1135
  const document2 = cpf == null ? void 0 : cpf.replace(/\D/g, "");
1136
1136
  const hashedDocument = await documentToHash(document2);
1137
1137
  return {
@@ -1149,7 +1149,7 @@ async function getUserInfo(context) {
1149
1149
  }
1150
1150
  };
1151
1151
  }
1152
- return { customer: { email: context.userEmail, id: context == null ? void 0 : context.userId }, address: null };
1152
+ 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 };
1153
1153
  }
1154
1154
  }
1155
1155