@azzas/azzas-tracker-web 2.0.0-preview.6 → 2.0.0-preview.8

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.d.cts CHANGED
@@ -1215,6 +1215,7 @@ interface Sla {
1215
1215
  pickupDistance: number | null;
1216
1216
  polygonName: string;
1217
1217
  transitTime: string;
1218
+ line_items?: string;
1218
1219
  }
1219
1220
  interface LogisticsInfo {
1220
1221
  itemIndex: number;
@@ -1395,6 +1396,8 @@ interface OrderForm {
1395
1396
  itemsOrdination: null;
1396
1397
  }
1397
1398
 
1399
+ declare const PROD_DOMAINS: Record<string, Record<string, string>>;
1400
+
1398
1401
  declare global {
1399
1402
  interface Window {
1400
1403
  dataLayer: any[];
@@ -1409,24 +1412,21 @@ type ProductMeta = {
1409
1412
  index?: number;
1410
1413
  item_list_name?: string | undefined | null;
1411
1414
  };
1412
- type AdapterPayload = {
1413
- adapter: 'HEADLESS';
1414
- zone: 'PDP';
1415
- products: (ProductType_PDP & ProductMeta)[];
1416
- } | {
1417
- adapter: 'HEADLESS';
1418
- zone: 'PDC';
1419
- products: (ProductType_PDC & ProductMeta)[];
1420
- } | {
1421
- adapter: 'HEADLESS';
1422
- zone: 'Minicart';
1423
- products: (ProductType_Minicart & ProductMeta)[];
1424
- } | {
1425
- adapter: 'DECO';
1426
- products: (Product & ProductMeta)[];
1427
- } | {
1428
- adapter: 'ORDERFORM';
1429
- orderForm: (OrderForm & ProductMeta)[];
1415
+ type ManuallyInfoContext = {
1416
+ cpf: string;
1417
+ birthDate: string;
1418
+ phone: string;
1419
+ firstName: string;
1420
+ lastName: string;
1421
+ email: string;
1422
+ email_optin?: boolean;
1423
+ };
1424
+ type UserInfoContext = {
1425
+ account: keyof typeof PROD_DOMAINS;
1426
+ platform: 'store' | 'checkout';
1427
+ userEmail: string;
1428
+ userId?: string;
1429
+ manuallyInfo?: ManuallyInfoContext;
1430
1430
  };
1431
1431
  interface TrackMeta {
1432
1432
  region?: string;
@@ -1438,12 +1438,40 @@ interface TrackMeta {
1438
1438
  search_term?: string;
1439
1439
  search_found?: boolean;
1440
1440
  search_quantity?: number;
1441
- zip_code?: string;
1441
+ zipcode?: string;
1442
+ content_type?: string;
1442
1443
  promotion_name?: string;
1443
1444
  creative_name?: string;
1444
1445
  creative_slot?: string;
1445
1446
  coupon_code?: string;
1447
+ user_info?: UserInfoContext;
1446
1448
  }
1449
+ type CallOverrides = {
1450
+ brand?: string;
1451
+ };
1452
+ type AdapterPayload = ({
1453
+ adapter: 'DECO';
1454
+ products: (Product & ProductMeta)[];
1455
+ } | {
1456
+ adapter: 'ORDERFORM';
1457
+ orderForm: (OrderForm & ProductMeta)[];
1458
+ } | {
1459
+ adapter: 'PICKUP';
1460
+ flag_pickup: boolean;
1461
+ shippings: Sla[];
1462
+ } | {
1463
+ adapter: 'HEADLESS';
1464
+ zone: 'PDP';
1465
+ products: (ProductType_PDP & ProductMeta)[];
1466
+ } | {
1467
+ adapter: 'HEADLESS';
1468
+ zone: 'PDC';
1469
+ products: (ProductType_PDC & ProductMeta)[];
1470
+ } | {
1471
+ adapter: 'HEADLESS';
1472
+ zone: 'Minicart';
1473
+ products: (ProductType_Minicart & ProductMeta)[];
1474
+ }) & CallOverrides;
1447
1475
  type RequiredMetaKeys<E extends EventName> = Extract<RequiredParamsOf<E>, keyof TrackMeta>;
1448
1476
  type MetaForEvent<E extends EventName> = Required<Pick<TrackMeta, RequiredMetaKeys<E>>> & Omit<TrackMeta, RequiredMetaKeys<E>>;
1449
1477
 
package/dist/mod.d.ts CHANGED
@@ -1215,6 +1215,7 @@ interface Sla {
1215
1215
  pickupDistance: number | null;
1216
1216
  polygonName: string;
1217
1217
  transitTime: string;
1218
+ line_items?: string;
1218
1219
  }
1219
1220
  interface LogisticsInfo {
1220
1221
  itemIndex: number;
@@ -1395,6 +1396,8 @@ interface OrderForm {
1395
1396
  itemsOrdination: null;
1396
1397
  }
1397
1398
 
1399
+ declare const PROD_DOMAINS: Record<string, Record<string, string>>;
1400
+
1398
1401
  declare global {
1399
1402
  interface Window {
1400
1403
  dataLayer: any[];
@@ -1409,24 +1412,21 @@ type ProductMeta = {
1409
1412
  index?: number;
1410
1413
  item_list_name?: string | undefined | null;
1411
1414
  };
1412
- type AdapterPayload = {
1413
- adapter: 'HEADLESS';
1414
- zone: 'PDP';
1415
- products: (ProductType_PDP & ProductMeta)[];
1416
- } | {
1417
- adapter: 'HEADLESS';
1418
- zone: 'PDC';
1419
- products: (ProductType_PDC & ProductMeta)[];
1420
- } | {
1421
- adapter: 'HEADLESS';
1422
- zone: 'Minicart';
1423
- products: (ProductType_Minicart & ProductMeta)[];
1424
- } | {
1425
- adapter: 'DECO';
1426
- products: (Product & ProductMeta)[];
1427
- } | {
1428
- adapter: 'ORDERFORM';
1429
- orderForm: (OrderForm & ProductMeta)[];
1415
+ type ManuallyInfoContext = {
1416
+ cpf: string;
1417
+ birthDate: string;
1418
+ phone: string;
1419
+ firstName: string;
1420
+ lastName: string;
1421
+ email: string;
1422
+ email_optin?: boolean;
1423
+ };
1424
+ type UserInfoContext = {
1425
+ account: keyof typeof PROD_DOMAINS;
1426
+ platform: 'store' | 'checkout';
1427
+ userEmail: string;
1428
+ userId?: string;
1429
+ manuallyInfo?: ManuallyInfoContext;
1430
1430
  };
1431
1431
  interface TrackMeta {
1432
1432
  region?: string;
@@ -1438,12 +1438,40 @@ interface TrackMeta {
1438
1438
  search_term?: string;
1439
1439
  search_found?: boolean;
1440
1440
  search_quantity?: number;
1441
- zip_code?: string;
1441
+ zipcode?: string;
1442
+ content_type?: string;
1442
1443
  promotion_name?: string;
1443
1444
  creative_name?: string;
1444
1445
  creative_slot?: string;
1445
1446
  coupon_code?: string;
1447
+ user_info?: UserInfoContext;
1446
1448
  }
1449
+ type CallOverrides = {
1450
+ brand?: string;
1451
+ };
1452
+ type AdapterPayload = ({
1453
+ adapter: 'DECO';
1454
+ products: (Product & ProductMeta)[];
1455
+ } | {
1456
+ adapter: 'ORDERFORM';
1457
+ orderForm: (OrderForm & ProductMeta)[];
1458
+ } | {
1459
+ adapter: 'PICKUP';
1460
+ flag_pickup: boolean;
1461
+ shippings: Sla[];
1462
+ } | {
1463
+ adapter: 'HEADLESS';
1464
+ zone: 'PDP';
1465
+ products: (ProductType_PDP & ProductMeta)[];
1466
+ } | {
1467
+ adapter: 'HEADLESS';
1468
+ zone: 'PDC';
1469
+ products: (ProductType_PDC & ProductMeta)[];
1470
+ } | {
1471
+ adapter: 'HEADLESS';
1472
+ zone: 'Minicart';
1473
+ products: (ProductType_Minicart & ProductMeta)[];
1474
+ }) & CallOverrides;
1447
1475
  type RequiredMetaKeys<E extends EventName> = Extract<RequiredParamsOf<E>, keyof TrackMeta>;
1448
1476
  type MetaForEvent<E extends EventName> = Required<Pick<TrackMeta, RequiredMetaKeys<E>>> & Omit<TrackMeta, RequiredMetaKeys<E>>;
1449
1477
 
@@ -1358,9 +1358,6 @@ var AzzasTracker = (() => {
1358
1358
  // src/params/adapters/meta/index.ts
1359
1359
  var metaAdapters = {
1360
1360
  user_info: getUserInfo,
1361
- // brand: (context: MetaBrandContext) => {
1362
- // return context.meta.brand || null;
1363
- // },
1364
1361
  content_type: (context) => {
1365
1362
  return context.meta.content_type || null;
1366
1363
  },
@@ -1422,24 +1419,7 @@ var AzzasTracker = (() => {
1422
1419
  }
1423
1420
  };
1424
1421
 
1425
- // src/params/adapters/deco/utils.ts
1426
- var getItemCategory3 = (item) => {
1427
- var _a;
1428
- const value = item == null ? void 0 : item.category;
1429
- if (!value) return "Cole\xE7\xE3o";
1430
- const text = Array.isArray(value) ? value.join(" ") : String(value);
1431
- const match = (_a = text.match(/outlet|bazar|sale/i)) == null ? void 0 : _a[0].toLowerCase();
1432
- return match != null ? match : "Cole\xE7\xE3o";
1433
- };
1434
- var getItemCategory22 = (item) => {
1435
- var _a, _b, _c, _d;
1436
- const AVOID_CATEGORIES = /^(outlet|bazar|sale)$/i;
1437
- const categories = (_b = (_a = item.category) == null ? void 0 : _a.split(">")) != null ? _b : [];
1438
- const last = (_c = categories[categories.length - 1]) != null ? _c : "";
1439
- const validHierarchy = last.split("/").filter((c) => c && !AVOID_CATEGORIES.test(c));
1440
- const deepest = (_d = validHierarchy[validHierarchy.length - 1]) != null ? _d : "";
1441
- return capitalize(deepest);
1442
- };
1422
+ // src/core/farm.ts
1443
1423
  var BRAND_CODES2 = {
1444
1424
  farm: "farmrio",
1445
1425
  "farm etc": "farmetc",
@@ -1472,6 +1452,25 @@ var AzzasTracker = (() => {
1472
1452
  return uniqueSortedCodes.length > 0 ? uniqueSortedCodes.join("_") : null;
1473
1453
  }
1474
1454
 
1455
+ // src/params/adapters/deco/utils.ts
1456
+ var getItemCategory3 = (item) => {
1457
+ var _a;
1458
+ const value = item == null ? void 0 : item.category;
1459
+ if (!value) return "Cole\xE7\xE3o";
1460
+ const text = Array.isArray(value) ? value.join(" ") : String(value);
1461
+ const match = (_a = text.match(/outlet|bazar|sale/i)) == null ? void 0 : _a[0].toLowerCase();
1462
+ return match != null ? match : "Cole\xE7\xE3o";
1463
+ };
1464
+ var getItemCategory22 = (item) => {
1465
+ var _a, _b, _c, _d;
1466
+ const AVOID_CATEGORIES = /^(outlet|bazar|sale)$/i;
1467
+ const categories = (_b = (_a = item.category) == null ? void 0 : _a.split(">")) != null ? _b : [];
1468
+ const last = (_c = categories[categories.length - 1]) != null ? _c : "";
1469
+ const validHierarchy = last.split("/").filter((c) => c && !AVOID_CATEGORIES.test(c));
1470
+ const deepest = (_d = validHierarchy[validHierarchy.length - 1]) != null ? _d : "";
1471
+ return capitalize(deepest);
1472
+ };
1473
+
1475
1474
  // src/params/adapters/deco/index.ts
1476
1475
  var IN_STOCK_SCHEMA = "https://schema.org/InStock";
1477
1476
  var LIST_PRICE_SCHEMA = "https://schema.org/ListPrice";
@@ -1515,6 +1514,7 @@ var AzzasTracker = (() => {
1515
1514
  },
1516
1515
  brand: (context, config2) => {
1517
1516
  if (config2 == null ? void 0 : config2.brand) return config2.brand;
1517
+ if (context == null ? void 0 : context.brand) return context.brand;
1518
1518
  if (context == null ? void 0 : context.products) {
1519
1519
  return normalizeBrand2(context.products.map((p) => {
1520
1520
  var _a;
@@ -1641,6 +1641,7 @@ var AzzasTracker = (() => {
1641
1641
  },
1642
1642
  brand: (context, config2) => {
1643
1643
  if (config2 == null ? void 0 : config2.brand) return config2.brand;
1644
+ if (context == null ? void 0 : context.brand) return context.brand;
1644
1645
  if (context == null ? void 0 : context.products) {
1645
1646
  return context.products.map((p) => p.brand).join().trim();
1646
1647
  }
@@ -1699,6 +1700,7 @@ var AzzasTracker = (() => {
1699
1700
  },
1700
1701
  brand: (context, config2) => {
1701
1702
  if (config2 == null ? void 0 : config2.brand) return config2.brand;
1703
+ if (context == null ? void 0 : context.brand) return context.brand;
1702
1704
  if (context == null ? void 0 : context.products) {
1703
1705
  return context.products.map((p) => p.brand.name).join().trim();
1704
1706
  }
@@ -1795,9 +1797,14 @@ var AzzasTracker = (() => {
1795
1797
  }
1796
1798
  return null;
1797
1799
  },
1800
+ brand: (context, config2) => {
1801
+ if (config2 == null ? void 0 : config2.brand) return config2.brand;
1802
+ if (context == null ? void 0 : context.brand) return context.brand;
1803
+ return null;
1804
+ },
1798
1805
  zipcode: (context) => {
1799
1806
  var _a;
1800
- return (_a = context.zipcode) != null ? _a : null;
1807
+ return (_a = context.meta.zipcode) != null ? _a : null;
1801
1808
  }
1802
1809
  };
1803
1810
 
@@ -1866,6 +1873,7 @@ var AzzasTracker = (() => {
1866
1873
  brand: (context, config2) => {
1867
1874
  var _a;
1868
1875
  if (config2 == null ? void 0 : config2.brand) return config2.brand;
1876
+ if (context == null ? void 0 : context.brand) return context.brand;
1869
1877
  if (!((_a = context == null ? void 0 : context.orderForm) == null ? void 0 : _a.items)) return null;
1870
1878
  const brands = getOrderFormItems(context.orderForm).map((item) => item.additionalInfo.brandName);
1871
1879
  return normalizeBrand2(brands);
@@ -1914,7 +1922,7 @@ var AzzasTracker = (() => {
1914
1922
  },
1915
1923
  zipcode: (context) => {
1916
1924
  var _a;
1917
- return (_a = context.zipcode) != null ? _a : null;
1925
+ return (_a = context.meta.zipcode) != null ? _a : null;
1918
1926
  },
1919
1927
  flag_pickup: (context) => {
1920
1928
  var _a;