@azzas/azzas-tracker-web 2.0.0-preview.2 → 2.0.0-preview.20

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.
@@ -1156,17 +1156,17 @@ var AzzasTracker = function() {
1156
1156
  };
1157
1157
  var getUserInfo = function getUserInfo(context) {
1158
1158
  return _async_to_generator(function() {
1159
- var _PROD_DOMAINS_, domain, _res_customer_document, _res_customer, api, response, _context_manuallyInfo, _context_manuallyInfo1, cpf, birthDate, phone, firstName, lastName, email, email_optin, document3, hashedDocument2, res, document2, hashedDocument, _, _context_manuallyInfo2, _context_manuallyInfo3, cpf1, birthDate1, phone1, firstName1, lastName1, email1, email_optin1, document21, hashedDocument1;
1159
+ var _context_meta_user_info, _context_meta, _PROD_DOMAINS_context_meta_user_info_account, _context_meta_user_info1, _context_meta1, _context_meta_user_info2, _context_meta2, _context_meta_user_info3, _context_meta3, domain, _context_meta_user_info4, _context_meta4, _res_customer_document, _res_customer, api, response, _context_meta_user_info5, _context_meta5, _context_meta_user_info_manuallyInfo, _context_meta_user_info6, _context_meta6, _context_meta_user_info7, _context_meta7, _context_meta_user_info8, _context_meta8, _context_meta_user_info9, _context_meta9, _ref, cpf, birthDate, phone, firstName, lastName, email, email_optin, document3, hashedDocument2, res, document2, hashedDocument, _, _context_meta_user_info10, _context_meta10, _context_meta_user_info_manuallyInfo1, _context_meta_user_info11, _context_meta11, _context_meta_user_info12, _context_meta12, _context_meta_user_info13, _context_meta13, _context_meta_user_info14, _context_meta14, _ref1, cpf1, birthDate1, phone1, firstName1, lastName1, email1, email_optin1, document21, hashedDocument1;
1160
1160
  return _ts_generator(this, function(_state) {
1161
1161
  switch(_state.label){
1162
1162
  case 0:
1163
- domain = (_PROD_DOMAINS_ = PROD_DOMAINS[context.account || "animale"]) === null || _PROD_DOMAINS_ === void 0 ? void 0 : _PROD_DOMAINS_[context.platform || "store"];
1163
+ domain = (_PROD_DOMAINS_context_meta_user_info_account = PROD_DOMAINS[context === null || context === void 0 ? void 0 : (_context_meta1 = context.meta) === null || _context_meta1 === void 0 ? void 0 : (_context_meta_user_info1 = _context_meta1.user_info) === null || _context_meta_user_info1 === void 0 ? void 0 : _context_meta_user_info1.account]) === null || _PROD_DOMAINS_context_meta_user_info_account === void 0 ? void 0 : _PROD_DOMAINS_context_meta_user_info_account[context === null || context === void 0 ? void 0 : (_context_meta = context.meta) === null || _context_meta === void 0 ? void 0 : (_context_meta_user_info = _context_meta.user_info) === null || _context_meta_user_info === void 0 ? void 0 : _context_meta_user_info.platform];
1164
1164
  if (!domain) return [
1165
1165
  2,
1166
1166
  {
1167
1167
  customer: {
1168
- email: context.userEmail,
1169
- id: context === null || context === void 0 ? void 0 : context.userId
1168
+ email: context === null || context === void 0 ? void 0 : (_context_meta2 = context.meta) === null || _context_meta2 === void 0 ? void 0 : (_context_meta_user_info2 = _context_meta2.user_info) === null || _context_meta_user_info2 === void 0 ? void 0 : _context_meta_user_info2.userEmail,
1169
+ id: context === null || context === void 0 ? void 0 : (_context_meta3 = context.meta) === null || _context_meta3 === void 0 ? void 0 : (_context_meta_user_info3 = _context_meta3.user_info) === null || _context_meta_user_info3 === void 0 ? void 0 : _context_meta_user_info3.userId
1170
1170
  },
1171
1171
  address: null
1172
1172
  }
@@ -1185,7 +1185,7 @@ var AzzasTracker = function() {
1185
1185
  fetch(api, {
1186
1186
  method: "POST",
1187
1187
  body: JSON.stringify({
1188
- email: context.userEmail
1188
+ email: context === null || context === void 0 ? void 0 : (_context_meta4 = context.meta) === null || _context_meta4 === void 0 ? void 0 : (_context_meta_user_info4 = _context_meta4.user_info) === null || _context_meta_user_info4 === void 0 ? void 0 : _context_meta_user_info4.userEmail
1189
1189
  })
1190
1190
  })
1191
1191
  ];
@@ -1195,11 +1195,11 @@ var AzzasTracker = function() {
1195
1195
  3,
1196
1196
  5
1197
1197
  ];
1198
- if (!((context === null || context === void 0 ? void 0 : context.manuallyInfo) && ((_context_manuallyInfo = context.manuallyInfo) === null || _context_manuallyInfo === void 0 ? void 0 : _context_manuallyInfo.cpf))) return [
1198
+ if (!((context === null || context === void 0 ? void 0 : (_context_meta5 = context.meta) === null || _context_meta5 === void 0 ? void 0 : (_context_meta_user_info5 = _context_meta5.user_info) === null || _context_meta_user_info5 === void 0 ? void 0 : _context_meta_user_info5.manuallyInfo) && (context === null || context === void 0 ? void 0 : (_context_meta6 = context.meta) === null || _context_meta6 === void 0 ? void 0 : (_context_meta_user_info6 = _context_meta6.user_info) === null || _context_meta_user_info6 === void 0 ? void 0 : (_context_meta_user_info_manuallyInfo = _context_meta_user_info6.manuallyInfo) === null || _context_meta_user_info_manuallyInfo === void 0 ? void 0 : _context_meta_user_info_manuallyInfo.cpf))) return [
1199
1199
  3,
1200
1200
  4
1201
1201
  ];
1202
- _context_manuallyInfo1 = context.manuallyInfo, cpf = _context_manuallyInfo1.cpf, birthDate = _context_manuallyInfo1.birthDate, phone = _context_manuallyInfo1.phone, firstName = _context_manuallyInfo1.firstName, lastName = _context_manuallyInfo1.lastName, email = _context_manuallyInfo1.email, email_optin = _context_manuallyInfo1.email_optin;
1202
+ _ref = context === null || context === void 0 ? void 0 : (_context_meta9 = context.meta) === null || _context_meta9 === void 0 ? void 0 : (_context_meta_user_info9 = _context_meta9.user_info) === null || _context_meta_user_info9 === void 0 ? void 0 : _context_meta_user_info9.manuallyInfo, cpf = _ref.cpf, birthDate = _ref.birthDate, phone = _ref.phone, firstName = _ref.firstName, lastName = _ref.lastName, email = _ref.email, email_optin = _ref.email_optin;
1203
1203
  document3 = cpf === null || cpf === void 0 ? void 0 : cpf.replace(/\D/g, "");
1204
1204
  return [
1205
1205
  4,
@@ -1229,8 +1229,8 @@ var AzzasTracker = function() {
1229
1229
  2,
1230
1230
  {
1231
1231
  customer: {
1232
- email: context.userEmail,
1233
- id: context === null || context === void 0 ? void 0 : context.userId
1232
+ email: context === null || context === void 0 ? void 0 : (_context_meta7 = context.meta) === null || _context_meta7 === void 0 ? void 0 : (_context_meta_user_info7 = _context_meta7.user_info) === null || _context_meta_user_info7 === void 0 ? void 0 : _context_meta_user_info7.userEmail,
1233
+ id: context === null || context === void 0 ? void 0 : (_context_meta8 = context.meta) === null || _context_meta8 === void 0 ? void 0 : (_context_meta_user_info8 = _context_meta8.user_info) === null || _context_meta_user_info8 === void 0 ? void 0 : _context_meta_user_info8.userId
1234
1234
  },
1235
1235
  address: null
1236
1236
  }
@@ -1260,11 +1260,11 @@ var AzzasTracker = function() {
1260
1260
  ];
1261
1261
  case 8:
1262
1262
  _ = _state.sent();
1263
- if (!((context === null || context === void 0 ? void 0 : context.manuallyInfo) && ((_context_manuallyInfo2 = context.manuallyInfo) === null || _context_manuallyInfo2 === void 0 ? void 0 : _context_manuallyInfo2.cpf))) return [
1263
+ if (!((context === null || context === void 0 ? void 0 : (_context_meta10 = context.meta) === null || _context_meta10 === void 0 ? void 0 : (_context_meta_user_info10 = _context_meta10.user_info) === null || _context_meta_user_info10 === void 0 ? void 0 : _context_meta_user_info10.manuallyInfo) && (context === null || context === void 0 ? void 0 : (_context_meta11 = context.meta) === null || _context_meta11 === void 0 ? void 0 : (_context_meta_user_info11 = _context_meta11.user_info) === null || _context_meta_user_info11 === void 0 ? void 0 : (_context_meta_user_info_manuallyInfo1 = _context_meta_user_info11.manuallyInfo) === null || _context_meta_user_info_manuallyInfo1 === void 0 ? void 0 : _context_meta_user_info_manuallyInfo1.cpf))) return [
1264
1264
  3,
1265
1265
  10
1266
1266
  ];
1267
- _context_manuallyInfo3 = context.manuallyInfo, cpf1 = _context_manuallyInfo3.cpf, birthDate1 = _context_manuallyInfo3.birthDate, phone1 = _context_manuallyInfo3.phone, firstName1 = _context_manuallyInfo3.firstName, lastName1 = _context_manuallyInfo3.lastName, email1 = _context_manuallyInfo3.email, email_optin1 = _context_manuallyInfo3.email_optin;
1267
+ _ref1 = context === null || context === void 0 ? void 0 : (_context_meta14 = context.meta) === null || _context_meta14 === void 0 ? void 0 : (_context_meta_user_info14 = _context_meta14.user_info) === null || _context_meta_user_info14 === void 0 ? void 0 : _context_meta_user_info14.manuallyInfo, cpf1 = _ref1.cpf, birthDate1 = _ref1.birthDate, phone1 = _ref1.phone, firstName1 = _ref1.firstName, lastName1 = _ref1.lastName, email1 = _ref1.email, email_optin1 = _ref1.email_optin;
1268
1268
  document21 = cpf1 === null || cpf1 === void 0 ? void 0 : cpf1.replace(/\D/g, "");
1269
1269
  return [
1270
1270
  4,
@@ -1294,8 +1294,8 @@ var AzzasTracker = function() {
1294
1294
  2,
1295
1295
  {
1296
1296
  customer: {
1297
- email: context.userEmail,
1298
- id: context === null || context === void 0 ? void 0 : context.userId
1297
+ email: context === null || context === void 0 ? void 0 : (_context_meta12 = context.meta) === null || _context_meta12 === void 0 ? void 0 : (_context_meta_user_info12 = _context_meta12.user_info) === null || _context_meta_user_info12 === void 0 ? void 0 : _context_meta_user_info12.userEmail,
1298
+ id: context === null || context === void 0 ? void 0 : (_context_meta13 = context.meta) === null || _context_meta13 === void 0 ? void 0 : (_context_meta_user_info13 = _context_meta13.user_info) === null || _context_meta_user_info13 === void 0 ? void 0 : _context_meta_user_info13.userId
1299
1299
  },
1300
1300
  address: null
1301
1301
  }
@@ -1308,10 +1308,49 @@ var AzzasTracker = function() {
1308
1308
  });
1309
1309
  })();
1310
1310
  };
1311
- var getItemShippingTier2 = function getItemShippingTier2() {
1312
- return null;
1311
+ var getBrandCode2 = function getBrandCode2(brand) {
1312
+ if (!brand) return null;
1313
+ var standardized = brand.toLowerCase().trim();
1314
+ return BRAND_CODES2[standardized] || null;
1315
+ };
1316
+ var normalizeBrand2 = function normalizeBrand2(input) {
1317
+ var brandStrings = [];
1318
+ if (Array.isArray(input) && input.every(function(item) {
1319
+ return typeof item === "string";
1320
+ })) {
1321
+ brandStrings = input;
1322
+ } else if (Array.isArray(input)) {
1323
+ brandStrings = input.map(function(item) {
1324
+ var _item_additionalInfo;
1325
+ return ((_item_additionalInfo = item.additionalInfo) === null || _item_additionalInfo === void 0 ? void 0 : _item_additionalInfo.brandName) || item.brand;
1326
+ });
1327
+ } else if ((typeof input === "undefined" ? "undefined" : _type_of(input)) === "object" && input !== null && "brand" in input) {
1328
+ var _input_additionalInfo;
1329
+ brandStrings = [
1330
+ ((_input_additionalInfo = input.additionalInfo) === null || _input_additionalInfo === void 0 ? void 0 : _input_additionalInfo.brandName) || input.brand
1331
+ ];
1332
+ } else if (typeof input === "string") {
1333
+ return getBrandCode2(input);
1334
+ } else {
1335
+ return null;
1336
+ }
1337
+ var brandCodes = brandStrings.map(getBrandCode2).filter(function(code) {
1338
+ return code !== null;
1339
+ });
1340
+ var uniqueSortedCodes = _to_consumable_array(new Set(brandCodes)).sort();
1341
+ return uniqueSortedCodes.length > 0 ? uniqueSortedCodes.join("_") : null;
1313
1342
  };
1314
- var getParameters = function getParameters(context, eventName) {
1343
+ var getItemShippingTier2 = function getItemShippingTier2(orderForm, item) {
1344
+ var _orderForm_shippingData_logisticsInfo, _orderForm_shippingData, _info_slas, _selectedSla_pickupStoreInfo;
1345
+ var info = orderForm === null || orderForm === void 0 ? void 0 : (_orderForm_shippingData = orderForm.shippingData) === null || _orderForm_shippingData === void 0 ? void 0 : (_orderForm_shippingData_logisticsInfo = _orderForm_shippingData.logisticsInfo) === null || _orderForm_shippingData_logisticsInfo === void 0 ? void 0 : _orderForm_shippingData_logisticsInfo.find(function(li) {
1346
+ return li.itemId === item.id;
1347
+ });
1348
+ var selectedSla = info === null || info === void 0 ? void 0 : (_info_slas = info.slas) === null || _info_slas === void 0 ? void 0 : _info_slas.find(function(sla) {
1349
+ return sla.id === info.selectedSla;
1350
+ });
1351
+ return (selectedSla === null || selectedSla === void 0 ? void 0 : (_selectedSla_pickupStoreInfo = selectedSla.pickupStoreInfo) === null || _selectedSla_pickupStoreInfo === void 0 ? void 0 : _selectedSla_pickupStoreInfo.friendlyName) ? "retirada em loja: ".concat(selectedSla.pickupStoreInfo.friendlyName) : (selectedSla === null || selectedSla === void 0 ? void 0 : selectedSla.name) ? "Receba em casa: ".concat(selectedSla.name) : null;
1352
+ };
1353
+ var getParameters = function getParameters(context, eventName, config2) {
1315
1354
  return _async_to_generator(function() {
1316
1355
  var _adapters_currentAdapter, eventConfig, currentAdapter, getters, entries;
1317
1356
  return _ts_generator(this, function(_state) {
@@ -1347,7 +1386,7 @@ var AzzasTracker = function() {
1347
1386
  ];
1348
1387
  return [
1349
1388
  4,
1350
- getter(context, eventName)
1389
+ getter(context, config2)
1351
1390
  ];
1352
1391
  case 1:
1353
1392
  return [
@@ -1371,8 +1410,10 @@ var AzzasTracker = function() {
1371
1410
  });
1372
1411
  })();
1373
1412
  };
1374
- var trackWebEvent = // src/index.ts
1375
- function trackWebEvent(event, context) {
1413
+ var initTracker = function initTracker(c) {
1414
+ config = c;
1415
+ };
1416
+ var trackWebEvent = function trackWebEvent(event, context) {
1376
1417
  return _async_to_generator(function() {
1377
1418
  var parameters, err;
1378
1419
  return _ts_generator(this, function(_state) {
@@ -1386,7 +1427,7 @@ var AzzasTracker = function() {
1386
1427
  ]);
1387
1428
  return [
1388
1429
  4,
1389
- getParameters(context, event)
1430
+ getParameters(context, event, config)
1390
1431
  ];
1391
1432
  case 1:
1392
1433
  parameters = _state.sent();
@@ -1476,6 +1517,9 @@ var AzzasTracker = function() {
1476
1517
  default: function() {
1477
1518
  return src_default;
1478
1519
  },
1520
+ initTracker: function() {
1521
+ return initTracker;
1522
+ },
1479
1523
  trackWebEvent: function() {
1480
1524
  return trackWebEvent;
1481
1525
  }
@@ -1889,7 +1933,6 @@ var AzzasTracker = function() {
1889
1933
  ],
1890
1934
  requiredParams: [
1891
1935
  "brand",
1892
- "line_items",
1893
1936
  "size",
1894
1937
  "item_ref"
1895
1938
  ]
@@ -2112,7 +2155,7 @@ var AzzasTracker = function() {
2112
2155
  "store": "https://www.animale.com.br",
2113
2156
  "checkout": "https://secure.animale.com.br"
2114
2157
  },
2115
- "farm": {
2158
+ "lojafarm": {
2116
2159
  "store": "https://lojafarm.myvtex.com"
2117
2160
  },
2118
2161
  "mariafilo": {
@@ -2130,7 +2173,7 @@ var AzzasTracker = function() {
2130
2173
  "bynv": {
2131
2174
  "store": "https://bynv.myvtex.com"
2132
2175
  },
2133
- "fabula": {
2176
+ "lojafabula": {
2134
2177
  "store": "https://lojafabula.myvtex.com"
2135
2178
  }
2136
2179
  };
@@ -2393,10 +2436,12 @@ var AzzasTracker = function() {
2393
2436
  }
2394
2437
  };
2395
2438
  // src/params/adapters/meta/index.ts
2396
- var metaAdapters = {
2439
+ var metaAdapter = {
2397
2440
  user_info: getUserInfo,
2398
- brand: function(context) {
2399
- return context.meta.brand || null;
2441
+ brand: function(context, config2) {
2442
+ if (config2 === null || config2 === void 0 ? void 0 : config2.brand) return config2.brand;
2443
+ if (context === null || context === void 0 ? void 0 : context.meta.brand) return context.meta.brand;
2444
+ return null;
2400
2445
  },
2401
2446
  content_type: function(context) {
2402
2447
  return context.meta.content_type || null;
@@ -2407,8 +2452,8 @@ var AzzasTracker = function() {
2407
2452
  pre_filled: function(context) {
2408
2453
  return !!context.preFilled;
2409
2454
  },
2410
- currency: function(context) {
2411
- if (context === null || context === void 0 ? void 0 : context.currency) return context.currency;
2455
+ currency: function(_, config2) {
2456
+ if (config2 === null || config2 === void 0 ? void 0 : config2.currency) return config2.currency;
2412
2457
  return "BRL";
2413
2458
  },
2414
2459
  slot_per_line: function(context) {
@@ -2419,7 +2464,7 @@ var AzzasTracker = function() {
2419
2464
  return context.meta.search_term || null;
2420
2465
  },
2421
2466
  search_found: function(context) {
2422
- return context.meta.search_found || null;
2467
+ return context.meta.search_found || false;
2423
2468
  },
2424
2469
  search_quantity: function(context) {
2425
2470
  return context.meta.search_quantity || 0;
@@ -2433,17 +2478,14 @@ var AzzasTracker = function() {
2433
2478
  creative_slot: function(context) {
2434
2479
  return context.meta.creative_slot || null;
2435
2480
  },
2436
- size: function(context) {
2437
- return context.size || null;
2438
- },
2439
2481
  item_ref: function(context) {
2440
- return context.itemRef || null;
2482
+ return context.meta.item_ref || null;
2441
2483
  },
2442
2484
  method: function(context) {
2443
- return context.method || null;
2485
+ return context.meta.method || null;
2444
2486
  },
2445
2487
  type: function(context) {
2446
- return context.type || null;
2488
+ return context.meta.type || null;
2447
2489
  },
2448
2490
  color: function(context) {
2449
2491
  return context.meta.color || null;
@@ -2456,8 +2498,17 @@ var AzzasTracker = function() {
2456
2498
  },
2457
2499
  ordering: function(context) {
2458
2500
  return context.meta.ordering || null;
2501
+ },
2502
+ size: function(context) {
2503
+ return context.meta.size || null;
2459
2504
  }
2460
2505
  };
2506
+ // src/core/farm.ts
2507
+ var BRAND_CODES2 = {
2508
+ farm: "farmrio",
2509
+ "farm etc": "farmetc",
2510
+ "farm rio": "farmrio"
2511
+ };
2461
2512
  // src/params/adapters/deco/utils.ts
2462
2513
  var getItemCategory3 = function(item) {
2463
2514
  var _text_match;
@@ -2482,7 +2533,7 @@ var AzzasTracker = function() {
2482
2533
  // src/params/adapters/deco/index.ts
2483
2534
  var IN_STOCK_SCHEMA = "https://schema.org/InStock";
2484
2535
  var LIST_PRICE_SCHEMA = "https://schema.org/ListPrice";
2485
- var decoAdapter = _object_spread_props(_object_spread({}, metaAdapters), {
2536
+ var decoAdapter = _object_spread_props(_object_spread({}, metaAdapter), {
2486
2537
  // global adapters
2487
2538
  items: function(context) {
2488
2539
  if (context === null || context === void 0 ? void 0 : context.items) return context.items;
@@ -2505,7 +2556,7 @@ var AzzasTracker = function() {
2505
2556
  // cor
2506
2557
  item_variant2: (_ref3 = item === null || item === void 0 ? void 0 : (_item_name1 = item.name) === null || _item_name1 === void 0 ? void 0 : _item_name1.split(" - ")[1]) !== null && _ref3 !== void 0 ? _ref3 : null,
2507
2558
  // tamanho
2508
- item_shipping_tier: getItemShippingTier2(),
2559
+ item_shipping_tier: "",
2509
2560
  item_ref: (_ref4 = (_item_additionalProperty = item.additionalProperty) === null || _item_additionalProperty === void 0 ? void 0 : (_item_additionalProperty_find = _item_additionalProperty.find(function(i) {
2510
2561
  return i.name === "RefId";
2511
2562
  })) === null || _item_additionalProperty_find === void 0 ? void 0 : (_item_additionalProperty_find_value = _item_additionalProperty_find.value) === null || _item_additionalProperty_find_value === void 0 ? void 0 : _item_additionalProperty_find_value.replace(/_\d+$/, "")) !== null && _ref4 !== void 0 ? _ref4 : null,
@@ -2522,13 +2573,17 @@ var AzzasTracker = function() {
2522
2573
  }
2523
2574
  return null;
2524
2575
  },
2525
- // brand: (context: DecoBrandContext) => {
2526
- // if (context?.brand) return context.brand
2527
- // if (context?.products) {
2528
- // return context.products[0].brand?.name // tem que ajustar FARM por conta de FARM_ETC
2529
- // }
2530
- // return null
2531
- // },
2576
+ brand: function(context, config2) {
2577
+ if (config2 === null || config2 === void 0 ? void 0 : config2.brand) return config2.brand;
2578
+ if (context === null || context === void 0 ? void 0 : context.brand) return context.brand;
2579
+ if (context === null || context === void 0 ? void 0 : context.products) {
2580
+ return normalizeBrand2(context.products.map(function(p) {
2581
+ var _p_brand;
2582
+ return p === null || p === void 0 ? void 0 : (_p_brand = p.brand) === null || _p_brand === void 0 ? void 0 : _p_brand.name;
2583
+ }));
2584
+ }
2585
+ return null;
2586
+ },
2532
2587
  line_items: function(context) {
2533
2588
  if (context === null || context === void 0 ? void 0 : context.line_items) return context.line_items;
2534
2589
  if (context === null || context === void 0 ? void 0 : context.products) {
@@ -2536,7 +2591,7 @@ var AzzasTracker = function() {
2536
2591
  return item === null || item === void 0 ? void 0 : item.inProductGroupWithID;
2537
2592
  }).filter(function(id) {
2538
2593
  return Boolean(id);
2539
- });
2594
+ }).join();
2540
2595
  }
2541
2596
  return null;
2542
2597
  },
@@ -2578,231 +2633,119 @@ var AzzasTracker = function() {
2578
2633
  return null;
2579
2634
  }
2580
2635
  });
2581
- // src/params/adapters/orderForm/utils.ts
2636
+ // src/params/adapters/reserva/utils.ts
2582
2637
  var getItemCategory5 = function(item) {
2583
- var _text_match;
2584
- var categories = item === null || item === void 0 ? void 0 : item.productCategories;
2585
- if (!categories) return "Cole\xE7\xE3o";
2586
- var text = Object.values(categories).join(" ");
2587
- var match = (_text_match = text.match(/outlet|bazar|sale/i)) === null || _text_match === void 0 ? void 0 : _text_match[0].toLowerCase();
2638
+ var _item_similarItems_, _item_similarItems, _categories_join_match;
2639
+ var categories = item === null || item === void 0 ? void 0 : (_item_similarItems = item.similarItems) === null || _item_similarItems === void 0 ? void 0 : (_item_similarItems_ = _item_similarItems[0]) === null || _item_similarItems_ === void 0 ? void 0 : _item_similarItems_.categories;
2640
+ if (!(categories === null || categories === void 0 ? void 0 : categories.length)) return "Cole\xE7\xE3o";
2641
+ var match = (_categories_join_match = categories.join(" ").match(/outlet|bazar|sale/i)) === null || _categories_join_match === void 0 ? void 0 : _categories_join_match[0].toLowerCase();
2588
2642
  return match !== null && match !== void 0 ? match : "Cole\xE7\xE3o";
2589
2643
  };
2590
2644
  var getItemCategory23 = function(item) {
2591
2645
  var _ref, _validHierarchy_;
2592
- var AVOID_CATEGORIES = /outlet|bazar|sale/i;
2593
- var categories = Object.values((_ref = item === null || item === void 0 ? void 0 : item.productCategories) !== null && _ref !== void 0 ? _ref : {});
2594
- var validHierarchy = categories.map(function(c) {
2595
- return c.trim();
2596
- }).filter(function(c) {
2646
+ var _item_similarItems_, _item_similarItems;
2647
+ var AVOID_CATEGORIES = /^(outlet|bazar|sale)$/i;
2648
+ var categories = (_ref = item === null || item === void 0 ? void 0 : (_item_similarItems = item.similarItems) === null || _item_similarItems === void 0 ? void 0 : (_item_similarItems_ = _item_similarItems[0]) === null || _item_similarItems_ === void 0 ? void 0 : _item_similarItems_.categories) !== null && _ref !== void 0 ? _ref : [];
2649
+ var validHierarchy = categories.filter(function(c) {
2597
2650
  return c && !AVOID_CATEGORIES.test(c);
2598
2651
  });
2599
2652
  var deepest = (_validHierarchy_ = validHierarchy[validHierarchy.length - 1]) !== null && _validHierarchy_ !== void 0 ? _validHierarchy_ : "";
2600
2653
  return capitalize(deepest);
2601
2654
  };
2602
- var getOrderFormItems = function(orderForm) {
2603
- var idSelected = orderForm === null || orderForm === void 0 ? void 0 : orderForm.selected;
2604
- return idSelected ? orderForm.items.filter(function(item) {
2605
- return item.id === idSelected;
2606
- }) : orderForm.items;
2607
- };
2608
- // src/params/adapters/orderForm/index.ts
2609
- var orderFormAdapter = _object_spread_props(_object_spread({}, metaAdapters), {
2655
+ // src/params/adapters/reserva/index.ts
2656
+ var reservaAdapter = _object_spread_props(_object_spread({}, metaAdapter), {
2657
+ // global adapters
2610
2658
  items: function(context) {
2611
2659
  if (context === null || context === void 0 ? void 0 : context.items) return context.items;
2612
- if ((context === null || context === void 0 ? void 0 : context.orderForm) && (context === null || context === void 0 ? void 0 : context.orderForm.items)) {
2613
- return getOrderFormItems(context.orderForm).map(function(item, index) {
2614
- var _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _getItemCategory5, _getItemCategory23, _ref7, _ref8, _item_detailUrl, _resizeVtexImage2, _ref9, _ref10;
2615
- var _context_orderForm, _item_additionalInfo, _item_skuName_split__split_pop, _item_skuName_split_, _item_skuName, _item_skuName_split_1, _item_skuName1, _context_orderForm1;
2660
+ if (context === null || context === void 0 ? void 0 : context.products) {
2661
+ return context.products.map(function(item) {
2662
+ var _ref, _ref1, _item_name, _ref2, _ref3, _getItemCategory5, _getItemCategory23, _ref4, _ref5, _ref6, _resizeVtexImage2, _ref7, _ref8;
2663
+ var _item_offers_offers, _item_offers, _item_additionalProperty_find_value, _item_additionalProperty_find, _item_additionalProperty, _item_brand_name, _item_brand, _item_offers1, _item_offers2, _item_name_split_, _item_name1, _item_name2, _item_seo, _item_image, _item_offers_offers__seller, _item_offers_offers_, _item_offers_offers1, _item_offers3;
2664
+ var COLOR_REGEX = /^[^_]+_/;
2665
+ var listPrice = item === null || item === void 0 ? void 0 : (_item_offers = item.offers) === null || _item_offers === void 0 ? void 0 : (_item_offers_offers = _item_offers.offers) === null || _item_offers_offers === void 0 ? void 0 : _item_offers_offers[0].listPrice;
2666
+ var refIdValue = (_item_additionalProperty = item.additionalProperty) === null || _item_additionalProperty === void 0 ? void 0 : (_item_additionalProperty_find = _item_additionalProperty.find(function(i) {
2667
+ return i.name === "RefId";
2668
+ })) === null || _item_additionalProperty_find === void 0 ? void 0 : (_item_additionalProperty_find_value = _item_additionalProperty_find.value) === null || _item_additionalProperty_find_value === void 0 ? void 0 : _item_additionalProperty_find_value.replace(/_\d+$/, "");
2616
2669
  return {
2617
- quantity: (_ref = item === null || item === void 0 ? void 0 : item.quantity) !== null && _ref !== void 0 ? _ref : 1,
2618
- index: (_ref1 = (_ref2 = context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.index) !== null && _ref2 !== void 0 ? _ref2 : index) !== null && _ref1 !== void 0 ? _ref1 : null,
2619
- item_brand: (_ref3 = (_item_additionalInfo = item.additionalInfo) === null || _item_additionalInfo === void 0 ? void 0 : _item_additionalInfo.brandName) !== null && _ref3 !== void 0 ? _ref3 : null,
2620
- item_name: (_ref4 = item === null || item === void 0 ? void 0 : item.name.replace(item === null || item === void 0 ? void 0 : item.skuName, "").trim()) !== null && _ref4 !== void 0 ? _ref4 : null,
2621
- price: (item === null || item === void 0 ? void 0 : item.price) / 100,
2622
- discount: ((item === null || item === void 0 ? void 0 : item.listPrice) - (item === null || item === void 0 ? void 0 : item.sellingPrice)) / 100,
2623
- item_variant: (_ref5 = item === null || item === void 0 ? void 0 : (_item_skuName = item.skuName) === null || _item_skuName === void 0 ? void 0 : (_item_skuName_split_ = _item_skuName.split(" - ")[0]) === null || _item_skuName_split_ === void 0 ? void 0 : (_item_skuName_split__split_pop = _item_skuName_split_.split("_").pop()) === null || _item_skuName_split__split_pop === void 0 ? void 0 : _item_skuName_split__split_pop.trim()) !== null && _ref5 !== void 0 ? _ref5 : null,
2624
- item_variant2: (_ref6 = item === null || item === void 0 ? void 0 : (_item_skuName1 = item.skuName) === null || _item_skuName1 === void 0 ? void 0 : (_item_skuName_split_1 = _item_skuName1.split(" - ")[1]) === null || _item_skuName_split_1 === void 0 ? void 0 : _item_skuName_split_1.trim()) !== null && _ref6 !== void 0 ? _ref6 : null,
2670
+ quantity: 1,
2671
+ index: (_ref = item === null || item === void 0 ? void 0 : item.index) !== null && _ref !== void 0 ? _ref : 0,
2672
+ item_brand: (_ref1 = (_item_brand = item.brand) === null || _item_brand === void 0 ? void 0 : (_item_brand_name = _item_brand.name) === null || _item_brand_name === void 0 ? void 0 : _item_brand_name.toLowerCase()) !== null && _ref1 !== void 0 ? _ref1 : null,
2673
+ item_name: (_item_name = item.name) !== null && _item_name !== void 0 ? _item_name : null,
2674
+ price: (_ref2 = (_item_offers1 = item.offers) === null || _item_offers1 === void 0 ? void 0 : _item_offers1.lowPrice) !== null && _ref2 !== void 0 ? _ref2 : null,
2675
+ discount: Math.round((Number(listPrice) - Number(item === null || item === void 0 ? void 0 : (_item_offers2 = item.offers) === null || _item_offers2 === void 0 ? void 0 : _item_offers2.lowPrice)) * 100) / 100,
2676
+ item_variant: (item === null || item === void 0 ? void 0 : (_item_name1 = item.name) === null || _item_name1 === void 0 ? void 0 : (_item_name_split_ = _item_name1.split(" - ")[0]) === null || _item_name_split_ === void 0 ? void 0 : _item_name_split_.replace(COLOR_REGEX, "").replace(/_/g, " ")) || null,
2677
+ // cor
2678
+ item_variant2: (_ref3 = item === null || item === void 0 ? void 0 : (_item_name2 = item.name) === null || _item_name2 === void 0 ? void 0 : _item_name2.split(" - ")[1]) !== null && _ref3 !== void 0 ? _ref3 : null,
2679
+ // tamanho
2625
2680
  item_shipping_tier: "",
2626
- item_ref: (item === null || item === void 0 ? void 0 : item.productRefId) || (item === null || item === void 0 ? void 0 : item.refId.replace(/_\d+$/, "")) || null,
2681
+ item_ref: refIdValue !== null && refIdValue !== void 0 ? refIdValue : null,
2627
2682
  item_category: (_getItemCategory5 = getItemCategory5(item)) !== null && _getItemCategory5 !== void 0 ? _getItemCategory5 : null,
2628
2683
  item_category2: (_getItemCategory23 = getItemCategory23(item)) !== null && _getItemCategory23 !== void 0 ? _getItemCategory23 : null,
2629
- item_id: (_ref7 = item === null || item === void 0 ? void 0 : item.productId) !== null && _ref7 !== void 0 ? _ref7 : null,
2630
- item_sku: (_ref8 = item === null || item === void 0 ? void 0 : item.id) !== null && _ref8 !== void 0 ? _ref8 : null,
2631
- item_url: (_item_detailUrl = item.detailUrl) !== null && _item_detailUrl !== void 0 ? _item_detailUrl : null,
2632
- image_url: (_resizeVtexImage2 = resizeVtexImage2(item.imageUrl)) !== null && _resizeVtexImage2 !== void 0 ? _resizeVtexImage2 : null,
2633
- seller_id: (_ref9 = item === null || item === void 0 ? void 0 : item.seller) !== null && _ref9 !== void 0 ? _ref9 : null,
2634
- item_list_name: (_ref10 = context === null || context === void 0 ? void 0 : (_context_orderForm1 = context.orderForm) === null || _context_orderForm1 === void 0 ? void 0 : _context_orderForm1.item_list_name) !== null && _ref10 !== void 0 ? _ref10 : null
2684
+ item_id: (_ref4 = item === null || item === void 0 ? void 0 : item.id) !== null && _ref4 !== void 0 ? _ref4 : null,
2685
+ item_sku: (_ref5 = item === null || item === void 0 ? void 0 : item.sku) !== null && _ref5 !== void 0 ? _ref5 : null,
2686
+ item_url: (_ref6 = item === null || item === void 0 ? void 0 : (_item_seo = item.seo) === null || _item_seo === void 0 ? void 0 : _item_seo.canonical) !== null && _ref6 !== void 0 ? _ref6 : null,
2687
+ image_url: (_resizeVtexImage2 = resizeVtexImage2(item === null || item === void 0 ? void 0 : (_item_image = item.image) === null || _item_image === void 0 ? void 0 : _item_image[0].url)) !== null && _resizeVtexImage2 !== void 0 ? _resizeVtexImage2 : null,
2688
+ seller_id: (_ref7 = (_item_offers3 = item.offers) === null || _item_offers3 === void 0 ? void 0 : (_item_offers_offers1 = _item_offers3.offers) === null || _item_offers_offers1 === void 0 ? void 0 : (_item_offers_offers_ = _item_offers_offers1[0]) === null || _item_offers_offers_ === void 0 ? void 0 : (_item_offers_offers__seller = _item_offers_offers_.seller) === null || _item_offers_offers__seller === void 0 ? void 0 : _item_offers_offers__seller.identifier) !== null && _ref7 !== void 0 ? _ref7 : null,
2689
+ item_list_name: (_ref8 = item === null || item === void 0 ? void 0 : item.item_list_name) !== null && _ref8 !== void 0 ? _ref8 : null
2635
2690
  };
2636
2691
  });
2637
2692
  }
2638
2693
  return null;
2639
2694
  },
2640
- // brand: (context: any) => {
2641
- // if (context?.brand) return context.brand
2642
- // if (context?.products) {
2643
- // return context.products[0].brand?.name // tem que ajustar FARM por conta de FARM_ETC
2644
- // }
2645
- // return null
2646
- // },
2695
+ brand: function(context, config2) {
2696
+ if (config2 === null || config2 === void 0 ? void 0 : config2.brand) return config2.brand;
2697
+ if (context === null || context === void 0 ? void 0 : context.brand) return context.brand;
2698
+ if (context === null || context === void 0 ? void 0 : context.products) {
2699
+ return normalizeBrand2(context.products.map(function(p) {
2700
+ var _p_brand;
2701
+ return p === null || p === void 0 ? void 0 : (_p_brand = p.brand) === null || _p_brand === void 0 ? void 0 : _p_brand.name;
2702
+ }));
2703
+ }
2704
+ return null;
2705
+ },
2647
2706
  line_items: function(context) {
2648
- var _context_orderForm;
2649
2707
  if (context === null || context === void 0 ? void 0 : context.line_items) return context.line_items;
2650
- if (!(context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.items)) return null;
2651
- return getOrderFormItems(context.orderForm).map(function(item) {
2652
- return item === null || item === void 0 ? void 0 : item.productId;
2653
- }).filter(function(id) {
2654
- return Boolean(id);
2655
- });
2708
+ if (context === null || context === void 0 ? void 0 : context.products) {
2709
+ return context.products.map(function(item) {
2710
+ return item === null || item === void 0 ? void 0 : item.id;
2711
+ }).filter(function(id) {
2712
+ return Boolean(id);
2713
+ }).join();
2714
+ }
2715
+ return null;
2656
2716
  },
2657
2717
  value: function(context) {
2658
- var _context_orderForm;
2659
2718
  if (context === null || context === void 0 ? void 0 : context.value) return context.value;
2660
- if (!(context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.items)) return null;
2661
- return getOrderFormItems(context.orderForm).map(function(item) {
2662
- return (item === null || item === void 0 ? void 0 : item.price) / 100 * item.quantity;
2663
- }).filter(function(price) {
2664
- return price !== void 0;
2665
- }).reduce(function(sum, price) {
2666
- return sum + price;
2667
- }, 0);
2668
- },
2669
- payment_type: getPaymentType,
2670
- total_discount: function(context) {
2671
- var _context_orderForm, _context_orderForm1;
2672
- if (context === null || context === void 0 ? void 0 : context.totalDiscount) return context.totalDiscount;
2673
- var totalsList = ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.totalizers) || ((_context_orderForm1 = context.orderForm) === null || _context_orderForm1 === void 0 ? void 0 : _context_orderForm1.totals) || [];
2674
- var items = context.orderForm.items;
2675
- var totalDiscount = items.reduce(function(acc, item) {
2676
- var unitDiscount = Math.max(0, item.listPrice - item.sellingPrice);
2677
- return acc + unitDiscount * item.quantity;
2678
- }, 0);
2679
- var discounts = totalsList.find(function(t) {
2680
- return t.id === "Discounts";
2681
- });
2682
- return Math.abs(((discounts === null || discounts === void 0 ? void 0 : discounts.value) || 0) + totalDiscount) / 100 || null;
2683
- },
2684
- subtotal: function(context) {
2685
- var _context_orderForm, _context_orderForm1;
2686
- var totalsList = ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.totalizers) || ((_context_orderForm1 = context.orderForm) === null || _context_orderForm1 === void 0 ? void 0 : _context_orderForm1.totals) || [];
2687
- var subtotal = totalsList.filter(function(t) {
2688
- return t.id === "Items";
2689
- }).reduce(function(acc, t) {
2690
- return acc + (t.value || 0);
2691
- }, 0) / 100 || 0;
2692
- return subtotal;
2693
- },
2694
- coupon_message: function(context) {
2695
- var _context_orderForm;
2696
- if (context.couponMessage) return context.couponMessage;
2697
- var messages = ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.messages) || [];
2698
- if (messages.length === 0) return null;
2699
- var couponMessages = messages.filter(function(msg) {
2700
- return msg.text.toLowerCase().includes("cupom");
2701
- });
2702
- if (couponMessages.length === 0) return null;
2703
- return couponMessages.map(function(msg) {
2704
- return msg.text;
2705
- }).join(" | ");
2706
- },
2707
- zipcode: function(context) {
2708
- var _context_zipcode;
2709
- return (_context_zipcode = context.zipcode) !== null && _context_zipcode !== void 0 ? _context_zipcode : null;
2710
- },
2711
- flag_pickup: function(context) {
2712
- var _orderForm_shippingData;
2713
- var orderForm = context.orderForm;
2714
- if (!orderForm) return null;
2715
- var logisticsInfo = ((_orderForm_shippingData = orderForm.shippingData) === null || _orderForm_shippingData === void 0 ? void 0 : _orderForm_shippingData.logisticsInfo) || [];
2716
- var hasPickup = logisticsInfo.some(function(info) {
2717
- var _info_slas;
2718
- return (_info_slas = info.slas) === null || _info_slas === void 0 ? void 0 : _info_slas.some(function(sla) {
2719
- return sla.deliveryChannel === "pickup-in-point";
2720
- });
2721
- });
2722
- return hasPickup;
2723
- },
2724
- shippings: function(context) {
2725
- if (!context.orderForm) return null;
2726
- var _context_orderForm = context.orderForm, items = _context_orderForm.items, shippingData = _context_orderForm.shippingData;
2727
- var acc = {};
2728
- shippingData.logisticsInfo.forEach(function(param) {
2729
- var itemIndex = param.itemIndex, slas = param.slas;
2730
- var item = items[itemIndex];
2731
- if (!item) return;
2732
- slas.forEach(function(sla) {
2733
- if (!acc[sla.name]) acc[sla.name] = {
2734
- shipping_tier: sla.name,
2735
- delivery_time: parseInt(sla.shippingEstimate),
2736
- shipping: parseFloat((sla.price / 100).toFixed(1)),
2737
- line_items: []
2738
- };
2739
- acc[sla.name].line_items.push(item.id);
2740
- });
2741
- });
2742
- return Object.values(acc).map(function(s) {
2743
- return _object_spread_props(_object_spread({}, s), {
2744
- line_items: s.line_items.join(",")
2745
- });
2746
- });
2719
+ if (context === null || context === void 0 ? void 0 : context.products) {
2720
+ return context.products.map(function(item) {
2721
+ var _item_offers;
2722
+ return (_item_offers = item.offers) === null || _item_offers === void 0 ? void 0 : _item_offers.lowPrice;
2723
+ }).filter(function(price) {
2724
+ return price !== void 0;
2725
+ }).reduce(function(sum, price) {
2726
+ return sum + price;
2727
+ }, 0);
2728
+ }
2729
+ return null;
2747
2730
  },
2748
- shipping: function(context) {
2749
- var _ref;
2750
- var _context_orderForm_shippingData, _context_orderForm;
2751
- var logistics = (_ref = context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : (_context_orderForm_shippingData = _context_orderForm.shippingData) === null || _context_orderForm_shippingData === void 0 ? void 0 : _context_orderForm_shippingData.logisticsInfo) !== null && _ref !== void 0 ? _ref : [];
2752
- return logistics.reduce(function(total, item) {
2753
- var _ref;
2754
- var _item_slas;
2755
- var selected = (_item_slas = item.slas) === null || _item_slas === void 0 ? void 0 : _item_slas.find(function(sla) {
2756
- return sla.id === item.selectedSla;
2731
+ available_grid: function(context) {
2732
+ if (context === null || context === void 0 ? void 0 : context.available_grid) return context.available_grid;
2733
+ if (context === null || context === void 0 ? void 0 : context.products) {
2734
+ var sizes = context.products.filter(function(product) {
2735
+ var _product_offers_offers, _product_offers;
2736
+ return (_product_offers = product.offers) === null || _product_offers === void 0 ? void 0 : (_product_offers_offers = _product_offers.offers) === null || _product_offers_offers === void 0 ? void 0 : _product_offers_offers.some(function(o) {
2737
+ return o.availability === "https://schema.org/InStock";
2738
+ });
2739
+ }).map(function(product) {
2740
+ var _product_name;
2741
+ return (_product_name = product.name) === null || _product_name === void 0 ? void 0 : _product_name.split(" - ")[1];
2742
+ }).filter(function(name) {
2743
+ return Boolean(name);
2757
2744
  });
2758
- return total + ((_ref = selected === null || selected === void 0 ? void 0 : selected.price) !== null && _ref !== void 0 ? _ref : 0);
2759
- }, 0);
2760
- },
2761
- shipping_tier: function(context) {
2762
- var _ref;
2763
- var _context_orderForm_shippingData, _context_orderForm;
2764
- var logistics = (_ref = context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : (_context_orderForm_shippingData = _context_orderForm.shippingData) === null || _context_orderForm_shippingData === void 0 ? void 0 : _context_orderForm_shippingData.logisticsInfo) !== null && _ref !== void 0 ? _ref : [];
2765
- var selectedSlas = logistics.map(function(item) {
2766
- var _item_slas;
2767
- if (!item.selectedSla) return null;
2768
- return ((_item_slas = item.slas) === null || _item_slas === void 0 ? void 0 : _item_slas.find(function(sla) {
2769
- return sla.id === item.selectedSla;
2770
- })) || null;
2771
- }).filter(Boolean);
2772
- if (selectedSlas.length === 0) return null;
2773
- var uniqueTiers = Array.from(new Map(selectedSlas.map(function(sla) {
2774
- var _sla_pickupStoreInfo;
2775
- var key = sla.deliveryChannel === "pickup-in-point" ? "pickup:".concat(((_sla_pickupStoreInfo = sla.pickupStoreInfo) === null || _sla_pickupStoreInfo === void 0 ? void 0 : _sla_pickupStoreInfo.friendlyName) || sla.name || "") : "delivery:".concat(sla.name || "");
2776
- return [
2777
- key,
2778
- sla
2779
- ];
2780
- })).values());
2781
- var sortedTiers = uniqueTiers.sort(function(a, b) {
2782
- var _a_pickupStoreInfo, _b_pickupStoreInfo;
2783
- var aOrder = a.deliveryChannel === "pickup-in-point" ? 0 : 1;
2784
- var bOrder = b.deliveryChannel === "pickup-in-point" ? 0 : 1;
2785
- if (aOrder !== bOrder) return aOrder - bOrder;
2786
- var aLabel = a.deliveryChannel === "pickup-in-point" ? ((_a_pickupStoreInfo = a.pickupStoreInfo) === null || _a_pickupStoreInfo === void 0 ? void 0 : _a_pickupStoreInfo.friendlyName) || a.name || "" : a.name || "";
2787
- var bLabel = b.deliveryChannel === "pickup-in-point" ? ((_b_pickupStoreInfo = b.pickupStoreInfo) === null || _b_pickupStoreInfo === void 0 ? void 0 : _b_pickupStoreInfo.friendlyName) || b.name || "" : b.name || "";
2788
- return aLabel.localeCompare(bLabel, "pt-BR");
2789
- });
2790
- var shippingTier = sortedTiers.map(function(sla) {
2791
- var _sla_pickupStoreInfo;
2792
- return sla.deliveryChannel === "pickup-in-point" ? "retirada em loja".concat(((_sla_pickupStoreInfo = sla.pickupStoreInfo) === null || _sla_pickupStoreInfo === void 0 ? void 0 : _sla_pickupStoreInfo.friendlyName) ? ": ".concat(sla.pickupStoreInfo.friendlyName) : "") : sla.deliveryChannel === "delivery" ? "receba em casa".concat(sla.name ? ": ".concat(sla.name) : "") : null;
2793
- }).filter(Boolean).join(", ");
2794
- return shippingTier || null;
2795
- },
2796
- transaction_id: function(context) {
2797
- var _context_orderForm_orderGroup, _context_orderForm;
2798
- return ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : (_context_orderForm_orderGroup = _context_orderForm.orderGroup) === null || _context_orderForm_orderGroup === void 0 ? void 0 : _context_orderForm_orderGroup.toString()) || null;
2799
- },
2800
- coupon: function(context) {
2801
- var _context_orderForm_marketingData, _context_orderForm;
2802
- return context.appliedCoupon || (context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : (_context_orderForm_marketingData = _context_orderForm.marketingData) === null || _context_orderForm_marketingData === void 0 ? void 0 : _context_orderForm_marketingData.coupon) || null;
2803
- },
2804
- seller_cod_name: function(context) {
2805
- return context.appliedSellerCodName || (context === null || context === void 0 ? void 0 : context.orderForm.marketingData.utmiCampaign) || null;
2745
+ var result = sortSizes(sizes).join(",").trim();
2746
+ return result || null;
2747
+ }
2748
+ return null;
2806
2749
  }
2807
2750
  });
2808
2751
  // src/params/adapters/headless/utils.ts
@@ -2891,11 +2834,12 @@ var AzzasTracker = function() {
2891
2834
  return item.productId;
2892
2835
  }).filter(function(id) {
2893
2836
  return Boolean(id);
2894
- });
2837
+ }).join();
2895
2838
  }
2896
2839
  return null;
2897
2840
  },
2898
- brand: function(context) {
2841
+ brand: function(context, config2) {
2842
+ if (config2 === null || config2 === void 0 ? void 0 : config2.brand) return config2.brand;
2899
2843
  if (context === null || context === void 0 ? void 0 : context.brand) return context.brand;
2900
2844
  if (context === null || context === void 0 ? void 0 : context.products) {
2901
2845
  return context.products.map(function(p) {
@@ -2965,11 +2909,12 @@ var AzzasTracker = function() {
2965
2909
  return item.id;
2966
2910
  }).filter(function(id) {
2967
2911
  return Boolean(id);
2968
- });
2912
+ }).join();
2969
2913
  }
2970
2914
  return null;
2971
2915
  },
2972
- brand: function(context) {
2916
+ brand: function(context, config2) {
2917
+ if (config2 === null || config2 === void 0 ? void 0 : config2.brand) return config2.brand;
2973
2918
  if (context === null || context === void 0 ? void 0 : context.brand) return context.brand;
2974
2919
  if (context === null || context === void 0 ? void 0 : context.products) {
2975
2920
  return context.products.map(function(p) {
@@ -2980,14 +2925,14 @@ var AzzasTracker = function() {
2980
2925
  }
2981
2926
  };
2982
2927
  // src/params/adapters/headless/index.ts
2983
- var headlessAdapter = _object_spread_props(_object_spread({}, metaAdapters, orderFormAdapter), {
2984
- // orderForm adapters, confirmar se no storefront tem evento que usa essses params
2985
- brand: function(context) {
2928
+ var headlessAdapter = _object_spread_props(_object_spread({}, metaAdapter), {
2929
+ // global adapters
2930
+ brand: function(context, config2) {
2986
2931
  if (context.zone === "PDP") {
2987
- return HeadlessPdpZone.brand(context);
2932
+ return HeadlessPdpZone.brand(context, config2);
2988
2933
  }
2989
2934
  if (context.zone === "PDC") {
2990
- return HeadlessPdcZone.brand(context);
2935
+ return HeadlessPdcZone.brand(context, config2);
2991
2936
  }
2992
2937
  return null;
2993
2938
  },
@@ -3049,7 +2994,7 @@ var AzzasTracker = function() {
3049
2994
  return isNaN(days) ? 0 : days;
3050
2995
  };
3051
2996
  // src/params/adapters/pickup/index.ts
3052
- var pickupAdapter = _object_spread_props(_object_spread({}, metaAdapters), {
2997
+ var pickupAdapter = _object_spread_props(_object_spread({}, metaAdapter), {
3053
2998
  flag_pickup: function(context) {
3054
2999
  var _ref;
3055
3000
  return (_ref = context === null || context === void 0 ? void 0 : context.flag_pickup) !== null && _ref !== void 0 ? _ref : null;
@@ -3057,10 +3002,10 @@ var AzzasTracker = function() {
3057
3002
  shippings: function(context) {
3058
3003
  if (context.shippings) {
3059
3004
  return context.shippings.map(function(s) {
3060
- var _s_line_items, _s_price;
3005
+ var _s_line_items;
3061
3006
  return {
3062
3007
  line_items: (_s_line_items = s.line_items) !== null && _s_line_items !== void 0 ? _s_line_items : "",
3063
- shipping: (_s_price = s.price) !== null && _s_price !== void 0 ? _s_price : 0,
3008
+ shipping: s.price / 100,
3064
3009
  shipping_tier: getShippingTier(s),
3065
3010
  delivery_time: getDeliveryTime(s)
3066
3011
  };
@@ -3068,17 +3013,287 @@ var AzzasTracker = function() {
3068
3013
  }
3069
3014
  return null;
3070
3015
  },
3016
+ brand: function(context, config2) {
3017
+ if (config2 === null || config2 === void 0 ? void 0 : config2.brand) return config2.brand;
3018
+ if (context === null || context === void 0 ? void 0 : context.brand) return context.brand;
3019
+ return null;
3020
+ },
3021
+ zipcode: function(context) {
3022
+ var _context_meta_zipcode;
3023
+ return (_context_meta_zipcode = context.meta.zipcode) !== null && _context_meta_zipcode !== void 0 ? _context_meta_zipcode : null;
3024
+ }
3025
+ });
3026
+ // src/params/adapters/orderForm/utils.ts
3027
+ var getOrderFormItems = function(orderForm) {
3028
+ var idSelected = orderForm === null || orderForm === void 0 ? void 0 : orderForm.selected;
3029
+ var isMultipleRemove = orderForm === null || orderForm === void 0 ? void 0 : orderForm.multipleRemove;
3030
+ return idSelected ? orderForm.items.filter(function(item) {
3031
+ return item.id === idSelected;
3032
+ }).map(function(i) {
3033
+ if (isMultipleRemove) return i;
3034
+ return _object_spread_props(_object_spread({}, i), {
3035
+ quantity: 1
3036
+ });
3037
+ }) : orderForm.items;
3038
+ };
3039
+ var getItemCategory7 = function(item) {
3040
+ var _text_match;
3041
+ var categories = item === null || item === void 0 ? void 0 : item.productCategories;
3042
+ if (!categories) return "Cole\xE7\xE3o";
3043
+ var text = Object.values(categories).join(" ");
3044
+ var match = (_text_match = text.match(/outlet|bazar|sale/i)) === null || _text_match === void 0 ? void 0 : _text_match[0].toLowerCase();
3045
+ return match !== null && match !== void 0 ? match : "Cole\xE7\xE3o";
3046
+ };
3047
+ var getItemCategory25 = function(item) {
3048
+ var _ref, _validHierarchy_;
3049
+ var AVOID_CATEGORIES = /outlet|bazar|sale/i;
3050
+ var categories = Object.values((_ref = item === null || item === void 0 ? void 0 : item.productCategories) !== null && _ref !== void 0 ? _ref : {});
3051
+ var validHierarchy = categories.map(function(c) {
3052
+ return c.trim();
3053
+ }).filter(function(c) {
3054
+ return c && !AVOID_CATEGORIES.test(c);
3055
+ });
3056
+ var deepest = (_validHierarchy_ = validHierarchy[validHierarchy.length - 1]) !== null && _validHierarchy_ !== void 0 ? _validHierarchy_ : "";
3057
+ return capitalize(deepest);
3058
+ };
3059
+ var getPaymentType2 = function(context) {
3060
+ var _context_orderForm_paymentData, _context_orderForm_paymentData1, _context_orderForm_paymentData2, _system_name;
3061
+ if (context.payment_type) return context.payment_type;
3062
+ if (!context.orderForm) return null;
3063
+ var giftCards = ((_context_orderForm_paymentData = context.orderForm.paymentData) === null || _context_orderForm_paymentData === void 0 ? void 0 : _context_orderForm_paymentData.giftCards) || [];
3064
+ if (giftCards.some(function(g) {
3065
+ return g === null || g === void 0 ? void 0 : g.inUse;
3066
+ })) return "vale";
3067
+ var payments = ((_context_orderForm_paymentData1 = context.orderForm.paymentData) === null || _context_orderForm_paymentData1 === void 0 ? void 0 : _context_orderForm_paymentData1.payments) || [];
3068
+ var systems = ((_context_orderForm_paymentData2 = context.orderForm.paymentData) === null || _context_orderForm_paymentData2 === void 0 ? void 0 : _context_orderForm_paymentData2.paymentSystems) || [];
3069
+ if (!payments.length || !systems.length) return null;
3070
+ var selectedPayment = payments.find(function(p) {
3071
+ return p === null || p === void 0 ? void 0 : p.paymentSystem;
3072
+ }) || payments[0];
3073
+ var id = String((selectedPayment === null || selectedPayment === void 0 ? void 0 : selectedPayment.paymentSystem) || "").trim();
3074
+ if (!id) return null;
3075
+ var system = systems.find(function(s) {
3076
+ return String(s.id) === id;
3077
+ });
3078
+ var name = (system === null || system === void 0 ? void 0 : (_system_name = system.name) === null || _system_name === void 0 ? void 0 : _system_name.toLowerCase()) || "";
3079
+ var match = paymentTypeMap.find(function(param) {
3080
+ var _param = _sliced_to_array(param, 1), key = _param[0];
3081
+ return name.includes(key);
3082
+ });
3083
+ return match ? match[1] : null;
3084
+ };
3085
+ // src/params/adapters/orderForm/index.ts
3086
+ var orderFormAdapter = _object_spread_props(_object_spread({}, metaAdapter), {
3087
+ items: function(context) {
3088
+ if (context === null || context === void 0 ? void 0 : context.items) return context.items;
3089
+ if ((context === null || context === void 0 ? void 0 : context.orderForm) && (context === null || context === void 0 ? void 0 : context.orderForm.items)) {
3090
+ return getOrderFormItems(context.orderForm).map(function(item, index) {
3091
+ var _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _getItemCategory7, _getItemCategory25, _ref6, _ref7, _item_detailUrl, _resizeVtexImage2, _ref8, _ref9;
3092
+ var _context_orderForm, _item_additionalInfo, _item_skuName_split__split_pop, _item_skuName_split_, _item_skuName, _item_skuName_split_1, _item_skuName1, _context_orderForm1;
3093
+ return {
3094
+ quantity: (_ref = item === null || item === void 0 ? void 0 : item.quantity) !== null && _ref !== void 0 ? _ref : 1,
3095
+ index: (_ref1 = context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.index) !== null && _ref1 !== void 0 ? _ref1 : index + 1,
3096
+ item_brand: (_ref2 = (_item_additionalInfo = item.additionalInfo) === null || _item_additionalInfo === void 0 ? void 0 : _item_additionalInfo.brandName) !== null && _ref2 !== void 0 ? _ref2 : null,
3097
+ item_name: (_ref3 = item === null || item === void 0 ? void 0 : item.name.replace(item === null || item === void 0 ? void 0 : item.skuName, "").trim()) !== null && _ref3 !== void 0 ? _ref3 : null,
3098
+ price: (item === null || item === void 0 ? void 0 : item.sellingPrice) / 100,
3099
+ discount: ((item === null || item === void 0 ? void 0 : item.listPrice) - (item === null || item === void 0 ? void 0 : item.sellingPrice)) / 100,
3100
+ item_variant: (_ref4 = item === null || item === void 0 ? void 0 : (_item_skuName = item.skuName) === null || _item_skuName === void 0 ? void 0 : (_item_skuName_split_ = _item_skuName.split(" - ")[0]) === null || _item_skuName_split_ === void 0 ? void 0 : (_item_skuName_split__split_pop = _item_skuName_split_.split("_").pop()) === null || _item_skuName_split__split_pop === void 0 ? void 0 : _item_skuName_split__split_pop.trim()) !== null && _ref4 !== void 0 ? _ref4 : null,
3101
+ item_variant2: (_ref5 = item === null || item === void 0 ? void 0 : (_item_skuName1 = item.skuName) === null || _item_skuName1 === void 0 ? void 0 : (_item_skuName_split_1 = _item_skuName1.split(" - ")[1]) === null || _item_skuName_split_1 === void 0 ? void 0 : _item_skuName_split_1.trim()) !== null && _ref5 !== void 0 ? _ref5 : null,
3102
+ item_shipping_tier: getItemShippingTier2(context.orderForm, item),
3103
+ item_ref: (item === null || item === void 0 ? void 0 : item.productRefId) || (item === null || item === void 0 ? void 0 : item.refId.replace(/_\d+$/, "")) || null,
3104
+ item_category: (_getItemCategory7 = getItemCategory7(item)) !== null && _getItemCategory7 !== void 0 ? _getItemCategory7 : null,
3105
+ item_category2: (_getItemCategory25 = getItemCategory25(item)) !== null && _getItemCategory25 !== void 0 ? _getItemCategory25 : null,
3106
+ item_id: (_ref6 = item === null || item === void 0 ? void 0 : item.productId) !== null && _ref6 !== void 0 ? _ref6 : null,
3107
+ item_sku: (_ref7 = item === null || item === void 0 ? void 0 : item.id) !== null && _ref7 !== void 0 ? _ref7 : null,
3108
+ item_url: (_item_detailUrl = item.detailUrl) !== null && _item_detailUrl !== void 0 ? _item_detailUrl : null,
3109
+ image_url: (_resizeVtexImage2 = resizeVtexImage2(item.imageUrl)) !== null && _resizeVtexImage2 !== void 0 ? _resizeVtexImage2 : null,
3110
+ seller_id: (_ref8 = item === null || item === void 0 ? void 0 : item.seller) !== null && _ref8 !== void 0 ? _ref8 : null,
3111
+ item_list_name: (_ref9 = context === null || context === void 0 ? void 0 : (_context_orderForm1 = context.orderForm) === null || _context_orderForm1 === void 0 ? void 0 : _context_orderForm1.item_list_name) !== null && _ref9 !== void 0 ? _ref9 : null
3112
+ };
3113
+ });
3114
+ }
3115
+ return null;
3116
+ },
3117
+ brand: function(context, config2) {
3118
+ var _context_orderForm;
3119
+ if (config2 === null || config2 === void 0 ? void 0 : config2.brand) return config2.brand;
3120
+ if (context === null || context === void 0 ? void 0 : context.brand) return context.brand;
3121
+ if (!(context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.items)) return null;
3122
+ var brands = getOrderFormItems(context.orderForm).map(function(item) {
3123
+ return item.additionalInfo.brandName;
3124
+ });
3125
+ return normalizeBrand2(brands);
3126
+ },
3127
+ line_items: function(context) {
3128
+ var _context_orderForm;
3129
+ if (context === null || context === void 0 ? void 0 : context.line_items) return context.line_items;
3130
+ if (!(context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.items)) return null;
3131
+ return getOrderFormItems(context.orderForm).map(function(item) {
3132
+ return item === null || item === void 0 ? void 0 : item.productId;
3133
+ }).filter(function(id) {
3134
+ return Boolean(id);
3135
+ }).join();
3136
+ },
3137
+ value: function(context) {
3138
+ var _context_orderForm;
3139
+ if (context === null || context === void 0 ? void 0 : context.value) return context.value;
3140
+ if (!(context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.items)) return null;
3141
+ return getOrderFormItems(context.orderForm).map(function(item) {
3142
+ return (item === null || item === void 0 ? void 0 : item.sellingPrice) / 100 * item.quantity;
3143
+ }).filter(function(price) {
3144
+ return price !== void 0;
3145
+ }).reduce(function(sum, price) {
3146
+ return sum + price;
3147
+ }, 0);
3148
+ },
3149
+ payment_type: getPaymentType2,
3150
+ total_discount: function(context) {
3151
+ var _context_orderForm, _context_orderForm1, _totalizers_find;
3152
+ if (context === null || context === void 0 ? void 0 : context.total_discount) return context.total_discount;
3153
+ if (!(context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.items)) return null;
3154
+ var totalizers = context === null || context === void 0 ? void 0 : (_context_orderForm1 = context.orderForm) === null || _context_orderForm1 === void 0 ? void 0 : _context_orderForm1.totalizers;
3155
+ var productDiscount = ((_totalizers_find = totalizers.find(function(t) {
3156
+ return t.id === "Discounts";
3157
+ })) === null || _totalizers_find === void 0 ? void 0 : _totalizers_find.value) || 0;
3158
+ return Math.abs(productDiscount) / 100 || null;
3159
+ },
3160
+ subtotal: function(context) {
3161
+ var _context_orderForm, _context_orderForm1;
3162
+ var totalsList = ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.totalizers) || ((_context_orderForm1 = context.orderForm) === null || _context_orderForm1 === void 0 ? void 0 : _context_orderForm1.totals) || [];
3163
+ var subtotal = totalsList.filter(function(t) {
3164
+ return t.id === "Items";
3165
+ }).reduce(function(acc, t) {
3166
+ return acc + (t.value || 0);
3167
+ }, 0) / 100 || 0;
3168
+ return subtotal;
3169
+ },
3071
3170
  zipcode: function(context) {
3072
- var _context_zipcode;
3073
- return (_context_zipcode = context.zipcode) !== null && _context_zipcode !== void 0 ? _context_zipcode : null;
3171
+ var _context_meta_zipcode;
3172
+ return (_context_meta_zipcode = context.meta.zipcode) !== null && _context_meta_zipcode !== void 0 ? _context_meta_zipcode : null;
3173
+ },
3174
+ flag_pickup: function(context) {
3175
+ var _orderForm_shippingData;
3176
+ var orderForm = context.orderForm;
3177
+ if (!orderForm) return null;
3178
+ var logisticsInfo = ((_orderForm_shippingData = orderForm.shippingData) === null || _orderForm_shippingData === void 0 ? void 0 : _orderForm_shippingData.logisticsInfo) || [];
3179
+ var hasPickup = logisticsInfo.some(function(info) {
3180
+ var _info_slas;
3181
+ return (_info_slas = info.slas) === null || _info_slas === void 0 ? void 0 : _info_slas.some(function(sla) {
3182
+ return sla.deliveryChannel === "pickup-in-point";
3183
+ });
3184
+ });
3185
+ return hasPickup;
3186
+ },
3187
+ shippings: function(context) {
3188
+ if (!context.orderForm) return null;
3189
+ var _context_orderForm = context.orderForm, items = _context_orderForm.items, shippingData = _context_orderForm.shippingData;
3190
+ var acc = {};
3191
+ shippingData.logisticsInfo.forEach(function(param) {
3192
+ var itemIndex = param.itemIndex, slas = param.slas;
3193
+ var item = items[itemIndex];
3194
+ if (!item) return;
3195
+ slas.forEach(function(sla) {
3196
+ if (!acc[sla.name]) acc[sla.name] = {
3197
+ shipping_tier: sla.name,
3198
+ delivery_time: parseInt(sla.shippingEstimate),
3199
+ shipping: parseFloat((sla.price / 100).toFixed(1)),
3200
+ line_items: []
3201
+ };
3202
+ acc[sla.name].line_items.push(item.id);
3203
+ });
3204
+ });
3205
+ return Object.values(acc).map(function(s) {
3206
+ return _object_spread_props(_object_spread({}, s), {
3207
+ line_items: s.line_items.join(",")
3208
+ });
3209
+ });
3210
+ },
3211
+ shipping: function(context) {
3212
+ var _ref;
3213
+ var _context_orderForm_shippingData, _context_orderForm;
3214
+ var logistics = (_ref = context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : (_context_orderForm_shippingData = _context_orderForm.shippingData) === null || _context_orderForm_shippingData === void 0 ? void 0 : _context_orderForm_shippingData.logisticsInfo) !== null && _ref !== void 0 ? _ref : [];
3215
+ return logistics.reduce(function(total, item) {
3216
+ var _ref;
3217
+ var _item_slas;
3218
+ var selected = (_item_slas = item.slas) === null || _item_slas === void 0 ? void 0 : _item_slas.find(function(sla) {
3219
+ return sla.id === item.selectedSla;
3220
+ });
3221
+ return total + ((_ref = selected === null || selected === void 0 ? void 0 : selected.price) !== null && _ref !== void 0 ? _ref : 0);
3222
+ }, 0);
3223
+ },
3224
+ shipping_tier: function(context) {
3225
+ var _ref;
3226
+ var _context_orderForm_shippingData, _context_orderForm;
3227
+ var logistics = (_ref = context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : (_context_orderForm_shippingData = _context_orderForm.shippingData) === null || _context_orderForm_shippingData === void 0 ? void 0 : _context_orderForm_shippingData.logisticsInfo) !== null && _ref !== void 0 ? _ref : [];
3228
+ var selectedSlas = logistics.map(function(item) {
3229
+ var _item_slas;
3230
+ if (!item.selectedSla) return null;
3231
+ return ((_item_slas = item.slas) === null || _item_slas === void 0 ? void 0 : _item_slas.find(function(sla) {
3232
+ return sla.id === item.selectedSla;
3233
+ })) || null;
3234
+ }).filter(Boolean);
3235
+ if (selectedSlas.length === 0) return null;
3236
+ var uniqueTiers = Array.from(new Map(selectedSlas.map(function(sla) {
3237
+ var _sla_pickupStoreInfo;
3238
+ var key = sla.deliveryChannel === "pickup-in-point" ? "pickup:".concat(((_sla_pickupStoreInfo = sla.pickupStoreInfo) === null || _sla_pickupStoreInfo === void 0 ? void 0 : _sla_pickupStoreInfo.friendlyName) || sla.name || "") : "delivery:".concat(sla.name || "");
3239
+ return [
3240
+ key,
3241
+ sla
3242
+ ];
3243
+ })).values());
3244
+ var sortedTiers = uniqueTiers.sort(function(a, b) {
3245
+ var _a_pickupStoreInfo, _b_pickupStoreInfo;
3246
+ var aOrder = a.deliveryChannel === "pickup-in-point" ? 0 : 1;
3247
+ var bOrder = b.deliveryChannel === "pickup-in-point" ? 0 : 1;
3248
+ if (aOrder !== bOrder) return aOrder - bOrder;
3249
+ var aLabel = a.deliveryChannel === "pickup-in-point" ? ((_a_pickupStoreInfo = a.pickupStoreInfo) === null || _a_pickupStoreInfo === void 0 ? void 0 : _a_pickupStoreInfo.friendlyName) || a.name || "" : a.name || "";
3250
+ var bLabel = b.deliveryChannel === "pickup-in-point" ? ((_b_pickupStoreInfo = b.pickupStoreInfo) === null || _b_pickupStoreInfo === void 0 ? void 0 : _b_pickupStoreInfo.friendlyName) || b.name || "" : b.name || "";
3251
+ return aLabel.localeCompare(bLabel, "pt-BR");
3252
+ });
3253
+ var shippingTier = sortedTiers.map(function(sla) {
3254
+ var _sla_pickupStoreInfo;
3255
+ return sla.deliveryChannel === "pickup-in-point" ? "retirada em loja".concat(((_sla_pickupStoreInfo = sla.pickupStoreInfo) === null || _sla_pickupStoreInfo === void 0 ? void 0 : _sla_pickupStoreInfo.friendlyName) ? ": ".concat(sla.pickupStoreInfo.friendlyName) : "") : sla.deliveryChannel === "delivery" ? "receba em casa".concat(sla.name ? ": ".concat(sla.name) : "") : null;
3256
+ }).filter(Boolean).join(", ");
3257
+ return shippingTier || null;
3258
+ },
3259
+ transaction_id: function(context) {
3260
+ var _context_orderForm_orderGroup, _context_orderForm;
3261
+ return ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : (_context_orderForm_orderGroup = _context_orderForm.orderGroup) === null || _context_orderForm_orderGroup === void 0 ? void 0 : _context_orderForm_orderGroup.toString()) || null;
3262
+ },
3263
+ coupon_message: function(context) {
3264
+ var _context_orderForm;
3265
+ if (context.couponMessage) return context.couponMessage;
3266
+ var messages = ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.messages) || [];
3267
+ if (messages.length === 0) return "C\xF3digo de desconto aplicado com sucesso";
3268
+ var couponMessages = messages.filter(function(msg) {
3269
+ return msg.text.toLowerCase().includes("cupom");
3270
+ });
3271
+ if (couponMessages.length === 0) return "C\xF3digo de desconto aplicado com sucesso";
3272
+ return couponMessages.map(function(msg) {
3273
+ return msg.text;
3274
+ }).join(" | ");
3275
+ },
3276
+ coupon: function(context) {
3277
+ var _context_orderForm_marketingData, _context_orderForm;
3278
+ return context.appliedCoupon || (context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : (_context_orderForm_marketingData = _context_orderForm.marketingData) === null || _context_orderForm_marketingData === void 0 ? void 0 : _context_orderForm_marketingData.coupon) || null;
3279
+ },
3280
+ seller_cod_name: function(context) {
3281
+ return context.appliedSellerCodName || (context === null || context === void 0 ? void 0 : context.orderForm.marketingData.utmiCampaign) || null;
3074
3282
  }
3075
3283
  });
3076
3284
  // src/formatter.ts
3077
3285
  var adapters = {
3078
3286
  DECO: decoAdapter,
3287
+ RESERVA: reservaAdapter,
3079
3288
  HEADLESS: headlessAdapter,
3080
3289
  PICKUP: pickupAdapter,
3081
- ORDERFORM: orderFormAdapter
3290
+ ORDERFORM: orderFormAdapter,
3291
+ META: metaAdapter
3292
+ };
3293
+ // src/index.ts
3294
+ var config = {
3295
+ brand: "",
3296
+ currency: "BRL"
3082
3297
  };
3083
3298
  var src_default = {
3084
3299
  trackWebEvent: trackWebEvent,