@azzas/azzas-tracker-web 2.0.0-preview.0 → 2.0.0-preview.10

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
@@ -161,6 +161,18 @@ declare const EVENTS: {
161
161
  destinations: string[];
162
162
  requiredParams: string[];
163
163
  };
164
+ REFINE_RESULTS: {
165
+ readonly name: "refine_results";
166
+ readonly hasEcommerce: false;
167
+ readonly destinations: readonly ["DataLayer"];
168
+ readonly requiredParams: readonly ["brand", "region", "color", "price_range", "size", "category", "ordering"];
169
+ };
170
+ GRID_SIZE: {
171
+ readonly name: "grid_size";
172
+ readonly hasEcommerce: false;
173
+ readonly destinations: readonly ["DataLayer"];
174
+ readonly requiredParams: readonly ["brand", "slot_per_line"];
175
+ };
164
176
  };
165
177
  type EventName$1 = keyof typeof EVENTS;
166
178
  type RequiredParamsOf<E extends EventName$1> = typeof EVENTS[E]['requiredParams'][number];
@@ -940,31 +952,481 @@ type ProductType_Minicart = {
940
952
  offerings: OfferingItem[];
941
953
  };
942
954
 
955
+ interface MarketingData {
956
+ utmSource: string | undefined;
957
+ utmMedium: string | undefined;
958
+ utmCampaign: string | undefined;
959
+ utmiPage: string | undefined;
960
+ utmiPart: string | undefined;
961
+ utmiCampaign: string | undefined;
962
+ coupon: string | undefined;
963
+ marketingTags: string[] | undefined;
964
+ }
965
+ interface Installment {
966
+ Value: number;
967
+ InterestRate: number;
968
+ TotalValuePlusInterestRate: number;
969
+ NumberOfInstallments: number;
970
+ PaymentSystemName: string;
971
+ PaymentSystemGroupName: string;
972
+ Name: string;
973
+ }
974
+ interface ClientProfileData {
975
+ email: string;
976
+ firstName: null;
977
+ lastName: null;
978
+ document: null;
979
+ documentType: null;
980
+ phone: null;
981
+ corporateName: null;
982
+ tradeName: null;
983
+ corporateDocument: null;
984
+ stateInscription: null;
985
+ corporatePhone: null;
986
+ isCorporate: boolean;
987
+ profileCompleteOnLoading: boolean;
988
+ profileErrorOnLoading: boolean;
989
+ customerClass: null;
990
+ }
991
+ interface Address {
992
+ addressType?: string;
993
+ receiverName: string | null;
994
+ addressId: string;
995
+ isDisposable?: boolean;
996
+ postalCode?: string;
997
+ city?: string;
998
+ state?: string;
999
+ country?: string;
1000
+ street?: string;
1001
+ number?: string;
1002
+ neighborhood?: string;
1003
+ addressName?: string;
1004
+ complement: string | null;
1005
+ reference?: string;
1006
+ geoCoordinates?: number[];
1007
+ name?: string;
1008
+ }
1009
+ interface Offering {
1010
+ type: string;
1011
+ id: string;
1012
+ name: string;
1013
+ allowGiftMessage: boolean;
1014
+ attachmentOfferings: unknown[];
1015
+ price: number;
1016
+ }
1017
+ interface Ean {
1018
+ maximumNumberOfCharacters: number;
1019
+ domain: unknown[];
1020
+ }
1021
+ interface Schema {
1022
+ Sku: Ean;
1023
+ Price: Ean;
1024
+ Qtde?: Ean;
1025
+ EAN: Ean;
1026
+ Measuremt_unit: Ean;
1027
+ Unit_multiplier: Ean;
1028
+ Quantity: Ean;
1029
+ }
1030
+ declare enum Name {
1031
+ AlternativeSubstitute = "ALTERNATIVE_SUBSTITUTE",
1032
+ Substituto = "Substituto"
1033
+ }
1034
+ interface AttachmentOffering {
1035
+ name: Name;
1036
+ required: boolean;
1037
+ schema: Schema;
1038
+ }
1039
+ interface SellingPrice {
1040
+ value: number;
1041
+ quantity: number;
1042
+ }
1043
+ interface PriceDefinition {
1044
+ calculatedSellingPrice: number;
1045
+ total: number;
1046
+ sellingPrices: SellingPrice[];
1047
+ }
1048
+ interface PriceTag {
1049
+ name: string;
1050
+ value: number;
1051
+ rawValue: number;
1052
+ isPercentual: boolean;
1053
+ identifier: string;
1054
+ owner: string;
1055
+ }
1056
+ type AvailableAssociations = Record<string, string>;
1057
+ interface Component {
1058
+ uniqueId: string;
1059
+ id: string;
1060
+ productId: null;
1061
+ productRefId: null;
1062
+ refId: string;
1063
+ ean: string;
1064
+ name: string;
1065
+ skuName: null;
1066
+ modalType: null;
1067
+ parentItemIndex: null;
1068
+ parentAssemblyBinding: null;
1069
+ assemblies: unknown[];
1070
+ priceValidUntil: null;
1071
+ tax: number;
1072
+ price: number;
1073
+ listPrice: null;
1074
+ manualPrice: null;
1075
+ manualPriceAppliedBy: null;
1076
+ sellingPrice: number;
1077
+ rewardValue: number;
1078
+ isGift: boolean;
1079
+ additionalInfo: AdditionalInfo;
1080
+ preSaleDate: null;
1081
+ productCategoryIds: null;
1082
+ productCategories: AvailableAssociations;
1083
+ quantity: number;
1084
+ seller: null;
1085
+ sellerChain: null[];
1086
+ imageUrl: null;
1087
+ detailUrl: null;
1088
+ components: unknown[];
1089
+ bundleItems: unknown[];
1090
+ attachments: unknown[];
1091
+ attachmentOfferings: unknown[];
1092
+ offerings: unknown[];
1093
+ priceTags: PriceTag[];
1094
+ availability: null;
1095
+ measurementUnit: string;
1096
+ unitMultiplier: number;
1097
+ manufacturerCode: null;
1098
+ priceDefinition: PriceDefinition;
1099
+ }
1100
+ interface AdditionalInfo {
1101
+ dimension: null;
1102
+ brandName: null | string;
1103
+ brandId: null | string;
1104
+ offeringInfo: null;
1105
+ offeringType: null;
1106
+ offeringTypeId: null;
1107
+ }
1108
+ interface OrderFormItem {
1109
+ uniqueId: string;
1110
+ id: string;
1111
+ productId: string;
1112
+ productRefId: string;
1113
+ refId: string;
1114
+ ean: null | string;
1115
+ name: string;
1116
+ skuName: string;
1117
+ modalType: null | string;
1118
+ parentItemIndex: null;
1119
+ parentAssemblyBinding: null;
1120
+ assemblies: unknown[];
1121
+ priceValidUntil: Date;
1122
+ tax: number;
1123
+ price: number;
1124
+ listPrice: number;
1125
+ manualPrice: null;
1126
+ manualPriceAppliedBy: null;
1127
+ sellingPrice: number;
1128
+ rewardValue: number;
1129
+ isGift: boolean;
1130
+ additionalInfo: AdditionalInfo;
1131
+ preSaleDate: null;
1132
+ productCategoryIds: string;
1133
+ productCategories: {
1134
+ [key: string]: string;
1135
+ };
1136
+ quantity: number;
1137
+ seller: string;
1138
+ sellerChain: string[];
1139
+ imageUrl: string;
1140
+ detailUrl: string;
1141
+ components: Component[];
1142
+ bundleItems: unknown[];
1143
+ attachments: unknown[];
1144
+ attachmentOfferings: AttachmentOffering[];
1145
+ offerings: Offering[];
1146
+ priceTags: PriceTag[];
1147
+ availability: string;
1148
+ measurementUnit: string;
1149
+ unitMultiplier: number;
1150
+ manufacturerCode: null;
1151
+ priceDefinition: PriceDefinition;
1152
+ }
1153
+ interface Fields {
1154
+ ean?: string;
1155
+ itemIndex?: string;
1156
+ skuName?: string;
1157
+ }
1158
+ interface Message {
1159
+ code: null | string;
1160
+ text: string;
1161
+ status: string;
1162
+ fields: Fields;
1163
+ }
1164
+ interface Totalizer {
1165
+ id: string;
1166
+ name: string;
1167
+ value: number;
1168
+ alternativeTotals?: Totalizer[];
1169
+ }
1170
+ declare enum SelectedSla {
1171
+ ClickRetireRJS = "Click & Retire (RJS)",
1172
+ Normal = "Normal"
1173
+ }
1174
+ declare enum SelectedDeliveryChannel {
1175
+ Delivery = "delivery",
1176
+ PickupInPoint = "pickup-in-point"
1177
+ }
1178
+ interface DeliveryID {
1179
+ courierId: string;
1180
+ warehouseId: string;
1181
+ dockId: string;
1182
+ courierName: string;
1183
+ quantity: number;
1184
+ kitItemDetails: unknown[];
1185
+ }
1186
+ interface AvailableDeliveryWindow {
1187
+ startDateUtc: Date;
1188
+ endDateUtc: Date;
1189
+ price: number;
1190
+ lisPrice: number;
1191
+ tax: number;
1192
+ }
1193
+ interface PickupStoreInfo {
1194
+ isPickupStore: boolean;
1195
+ friendlyName: null | string;
1196
+ address: Address | null;
1197
+ additionalInfo: null | string;
1198
+ dockId: null;
1199
+ }
1200
+ interface Sla {
1201
+ id: SelectedSla;
1202
+ deliveryChannel: SelectedDeliveryChannel;
1203
+ name: SelectedSla;
1204
+ deliveryIds: DeliveryID[];
1205
+ shippingEstimate: string;
1206
+ shippingEstimateDate: null;
1207
+ lockTTL: null;
1208
+ availableDeliveryWindows: AvailableDeliveryWindow[];
1209
+ deliveryWindow: null;
1210
+ price: number;
1211
+ listPrice: number;
1212
+ tax: number;
1213
+ pickupStoreInfo: PickupStoreInfo;
1214
+ pickupPointId: null | string;
1215
+ pickupDistance: number | null;
1216
+ polygonName: string;
1217
+ transitTime: string;
1218
+ line_items?: string;
1219
+ }
1220
+ interface LogisticsInfo {
1221
+ itemIndex: number;
1222
+ selectedSla: SelectedSla | null;
1223
+ selectedDeliveryChannel: SelectedDeliveryChannel;
1224
+ addressId: string;
1225
+ slas: Sla[];
1226
+ shipsTo: string[];
1227
+ itemId: string;
1228
+ deliveryChannels: DeliveryChannel[];
1229
+ }
1230
+ interface DeliveryChannel {
1231
+ id: SelectedDeliveryChannel;
1232
+ }
1233
+ interface PickupHolidays {
1234
+ date?: string;
1235
+ hourBegin?: string;
1236
+ hourEnd?: string;
1237
+ }
1238
+ interface BusinessHour {
1239
+ DayOfWeek: number;
1240
+ OpeningTime: string;
1241
+ ClosingTime: string;
1242
+ }
1243
+ interface PickupPoint {
1244
+ friendlyName: string;
1245
+ address: Address;
1246
+ additionalInfo: string;
1247
+ id: string;
1248
+ businessHours: BusinessHour[];
1249
+ pickupHolidays?: PickupHolidays[];
1250
+ }
1251
+ interface ShippingData {
1252
+ address: Address;
1253
+ logisticsInfo: LogisticsInfo[];
1254
+ selectedAddresses: Address[];
1255
+ availableAddresses: Address[];
1256
+ pickupPoints: PickupPoint[];
1257
+ }
1258
+ interface CartInstallment {
1259
+ count: number;
1260
+ hasInterestRate: boolean;
1261
+ interestRate: number;
1262
+ value: number;
1263
+ total: number;
1264
+ sellerMerchantInstallments?: Installment[];
1265
+ id?: string;
1266
+ }
1267
+ interface InstallmentOption {
1268
+ paymentSystem: string;
1269
+ bin: null;
1270
+ paymentName: null;
1271
+ paymentGroupName: null;
1272
+ value: number;
1273
+ installments: CartInstallment[];
1274
+ }
1275
+ declare enum CardCodeRegex {
1276
+ The093$ = "^[0-9]{3}$",
1277
+ The094$ = "^[0-9]{4}$"
1278
+ }
1279
+ interface Validator {
1280
+ regex: null | string;
1281
+ mask: null | string;
1282
+ cardCodeRegex: CardCodeRegex | null;
1283
+ cardCodeMask: null | string;
1284
+ weights: number[] | null;
1285
+ useCvv: boolean;
1286
+ useExpirationDate: boolean;
1287
+ useCardHolderName: boolean;
1288
+ useBillingAddress: boolean;
1289
+ }
1290
+ interface PaymentSystem {
1291
+ id: number;
1292
+ name: string;
1293
+ groupName: string;
1294
+ validator: Validator;
1295
+ stringId: string;
1296
+ template: string;
1297
+ requiresDocument: boolean;
1298
+ displayDocument: boolean;
1299
+ isCustom: boolean;
1300
+ description: null | string;
1301
+ requiresAuthentication: boolean;
1302
+ dueDate: Date;
1303
+ availablePayments: null;
1304
+ }
1305
+ interface PaymentData {
1306
+ updateStatus: string;
1307
+ installmentOptions: InstallmentOption[];
1308
+ paymentSystems: PaymentSystem[];
1309
+ payments: unknown[];
1310
+ giftCards: unknown[];
1311
+ giftCardMessages: unknown[];
1312
+ availableAccounts: unknown[];
1313
+ availableTokens: unknown[];
1314
+ availableAssociations: AvailableAssociations;
1315
+ }
1316
+ interface Seller {
1317
+ id: string;
1318
+ name: string;
1319
+ logo: string;
1320
+ }
1321
+ interface ClientPreferencesData {
1322
+ locale: string;
1323
+ optinNewsLetter: null;
1324
+ }
1325
+ interface CurrencyFormatInfo {
1326
+ currencyDecimalDigits: number;
1327
+ currencyDecimalSeparator: string;
1328
+ currencyGroupSeparator: string;
1329
+ currencyGroupSize: number;
1330
+ startsWithCurrencySymbol: boolean;
1331
+ }
1332
+ interface StorePreferencesData {
1333
+ countryCode: string;
1334
+ saveUserData: boolean;
1335
+ timeZone: string;
1336
+ currencyCode: string;
1337
+ currencyLocale: number;
1338
+ currencySymbol: string;
1339
+ currencyFormatInfo: CurrencyFormatInfo;
1340
+ }
1341
+ interface MatchedParameters {
1342
+ "Seller@CatalogSystem": string;
1343
+ "productCluster@CatalogSystem"?: string;
1344
+ "zipCode@Shipping"?: string;
1345
+ slaIds?: string;
1346
+ }
1347
+ interface RateAndBenefitsIdentifier {
1348
+ id: string;
1349
+ name: string;
1350
+ featured: boolean;
1351
+ description: string;
1352
+ matchedParameters: MatchedParameters;
1353
+ additionalInfo: null;
1354
+ }
1355
+ interface RatesAndBenefitsData {
1356
+ rateAndBenefitsIdentifiers: RateAndBenefitsIdentifier[];
1357
+ teaser: unknown[];
1358
+ }
1359
+ interface OrderForm {
1360
+ selected?: string;
1361
+ index?: number;
1362
+ item_list_name: string;
1363
+ zipcode?: string;
1364
+ orderFormId: string;
1365
+ salesChannel: string;
1366
+ loggedIn: boolean;
1367
+ isCheckedIn: boolean;
1368
+ storeId: null;
1369
+ checkedInPickupPointId: null;
1370
+ allowManualPrice: boolean;
1371
+ canEditData: boolean;
1372
+ userProfileId: null;
1373
+ userType: null;
1374
+ ignoreProfileData: boolean;
1375
+ value: number;
1376
+ messages: Message[];
1377
+ items: OrderFormItem[];
1378
+ selectableGifts: unknown[];
1379
+ totalizers: Totalizer[];
1380
+ shippingData: ShippingData;
1381
+ clientProfileData: ClientProfileData | null;
1382
+ paymentData: PaymentData;
1383
+ marketingData: MarketingData;
1384
+ sellers: Seller[];
1385
+ clientPreferencesData: ClientPreferencesData;
1386
+ commercialConditionData: null;
1387
+ storePreferencesData: StorePreferencesData;
1388
+ giftRegistryData: null;
1389
+ openTextField: null;
1390
+ invoiceData: null;
1391
+ customData: null;
1392
+ hooksData: null;
1393
+ ratesAndBenefitsData: RatesAndBenefitsData;
1394
+ subscriptionData: null;
1395
+ merchantContextData: null;
1396
+ itemsOrdination: null;
1397
+ }
1398
+
1399
+ declare const PROD_DOMAINS: Record<string, Record<string, string>>;
1400
+
943
1401
  declare global {
944
1402
  interface Window {
945
1403
  dataLayer: any[];
946
1404
  }
947
1405
  }
948
1406
  type EventName = keyof typeof EVENTS;
1407
+ type InitialConfig = {
1408
+ brand: string;
1409
+ currency: string;
1410
+ };
949
1411
  type ProductMeta = {
950
1412
  index?: number;
951
1413
  item_list_name?: string | undefined | null;
952
1414
  };
953
- type AdapterPayload = {
954
- adapter: 'HEADLESS';
955
- zone: 'PDP';
956
- products: (ProductType_PDP & ProductMeta)[];
957
- } | {
958
- adapter: 'HEADLESS';
959
- zone: 'PDC';
960
- products: (ProductType_PDC & ProductMeta)[];
961
- } | {
962
- adapter: 'HEADLESS';
963
- zone: 'Minicart';
964
- products: (ProductType_Minicart & ProductMeta)[];
965
- } | {
966
- adapter: 'DECO';
967
- products: (Product & 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;
968
1430
  };
969
1431
  interface TrackMeta {
970
1432
  region?: string;
@@ -973,19 +1435,51 @@ interface TrackMeta {
973
1435
  type?: string;
974
1436
  item_ref?: string;
975
1437
  size?: string;
1438
+ color?: string;
1439
+ ordering?: string;
1440
+ price_range?: string;
1441
+ category?: string;
976
1442
  search_term?: string;
977
1443
  search_found?: boolean;
978
1444
  search_quantity?: number;
979
- zip_code?: string;
1445
+ zipcode?: string;
1446
+ content_type?: string;
980
1447
  promotion_name?: string;
981
1448
  creative_name?: string;
982
1449
  creative_slot?: string;
983
1450
  coupon_code?: string;
984
- currency?: string;
1451
+ user_info?: UserInfoContext;
985
1452
  }
1453
+ type CallOverrides = {
1454
+ brand?: string;
1455
+ };
1456
+ type AdapterPayload = ({
1457
+ adapter: 'DECO';
1458
+ products: (Product & ProductMeta)[];
1459
+ } | {
1460
+ adapter: 'ORDERFORM';
1461
+ orderForm: (OrderForm & ProductMeta)[];
1462
+ } | {
1463
+ adapter: 'PICKUP';
1464
+ flag_pickup: boolean;
1465
+ shippings: Sla[];
1466
+ } | {
1467
+ adapter: 'HEADLESS';
1468
+ zone: 'PDP';
1469
+ products: (ProductType_PDP & ProductMeta)[];
1470
+ } | {
1471
+ adapter: 'HEADLESS';
1472
+ zone: 'PDC';
1473
+ products: (ProductType_PDC & ProductMeta)[];
1474
+ } | {
1475
+ adapter: 'HEADLESS';
1476
+ zone: 'Minicart';
1477
+ products: (ProductType_Minicart & ProductMeta)[];
1478
+ }) & CallOverrides;
986
1479
  type RequiredMetaKeys<E extends EventName> = Extract<RequiredParamsOf<E>, keyof TrackMeta>;
987
1480
  type MetaForEvent<E extends EventName> = Required<Pick<TrackMeta, RequiredMetaKeys<E>>> & Omit<TrackMeta, RequiredMetaKeys<E>>;
988
1481
 
1482
+ declare function initTracker(c: InitialConfig): void;
989
1483
  declare function trackWebEvent<E extends EventName>(event: E, context: AdapterPayload & {
990
1484
  meta: MetaForEvent<E>;
991
1485
  window?: unknown;
@@ -1156,7 +1650,19 @@ declare const _default: {
1156
1650
  destinations: string[];
1157
1651
  requiredParams: string[];
1158
1652
  };
1653
+ REFINE_RESULTS: {
1654
+ readonly name: "refine_results";
1655
+ readonly hasEcommerce: false;
1656
+ readonly destinations: readonly ["DataLayer"];
1657
+ readonly requiredParams: readonly ["brand", "region", "color", "price_range", "size", "category", "ordering"];
1658
+ };
1659
+ GRID_SIZE: {
1660
+ readonly name: "grid_size";
1661
+ readonly hasEcommerce: false;
1662
+ readonly destinations: readonly ["DataLayer"];
1663
+ readonly requiredParams: readonly ["brand", "slot_per_line"];
1664
+ };
1159
1665
  };
1160
1666
  };
1161
1667
 
1162
- export { EVENTS, _default as default, trackWebEvent };
1668
+ export { EVENTS, _default as default, initTracker, trackWebEvent };