@azzas/azzas-tracker-web 2.0.0-preview.13 → 2.0.0-preview.15

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
 
@@ -1502,7 +1502,7 @@ var decoAdapter = {
1502
1502
  line_items: (context) => {
1503
1503
  if (context == null ? void 0 : context.line_items) return context.line_items;
1504
1504
  if (context == null ? void 0 : context.products) {
1505
- return context.products.map((item) => item == null ? void 0 : item.inProductGroupWithID).filter((id) => Boolean(id));
1505
+ return context.products.map((item) => item == null ? void 0 : item.inProductGroupWithID).filter((id) => Boolean(id)).join();
1506
1506
  }
1507
1507
  return null;
1508
1508
  },
@@ -1611,7 +1611,7 @@ var HeadlessPdpZone = {
1611
1611
  line_items: (context) => {
1612
1612
  if (context == null ? void 0 : context.line_items) return context.line_items;
1613
1613
  if (context == null ? void 0 : context.products) {
1614
- return context.products.map((item) => item.productId).filter((id) => Boolean(id));
1614
+ return context.products.map((item) => item.productId).filter((id) => Boolean(id)).join();
1615
1615
  }
1616
1616
  return null;
1617
1617
  },
@@ -1670,7 +1670,7 @@ var HeadlessPdcZone = {
1670
1670
  line_items: (context) => {
1671
1671
  if (context == null ? void 0 : context.line_items) return context.line_items;
1672
1672
  if (context == null ? void 0 : context.products) {
1673
- return context.products.map((item) => item.id).filter((id) => Boolean(id));
1673
+ return context.products.map((item) => item.id).filter((id) => Boolean(id)).join();
1674
1674
  }
1675
1675
  return null;
1676
1676
  },
@@ -1858,7 +1858,7 @@ var orderFormAdapter = {
1858
1858
  var _a;
1859
1859
  if (context == null ? void 0 : context.line_items) return context.line_items;
1860
1860
  if (!((_a = context == null ? void 0 : context.orderForm) == null ? void 0 : _a.items)) return null;
1861
- return getOrderFormItems(context.orderForm).map((item) => item == null ? void 0 : item.productId).filter((id) => Boolean(id));
1861
+ return getOrderFormItems(context.orderForm).map((item) => item == null ? void 0 : item.productId).filter((id) => Boolean(id)).join();
1862
1862
  },
1863
1863
  value: (context) => {
1864
1864
  var _a;