@azzas/azzas-tracker-web 2.0.0-preview.1 → 2.0.0-preview.11

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
@@ -952,31 +952,481 @@ type ProductType_Minicart = {
952
952
  offerings: OfferingItem[];
953
953
  };
954
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
+
955
1401
  declare global {
956
1402
  interface Window {
957
1403
  dataLayer: any[];
958
1404
  }
959
1405
  }
960
1406
  type EventName = keyof typeof EVENTS;
1407
+ type InitialConfig = {
1408
+ brand: string;
1409
+ currency: string;
1410
+ };
961
1411
  type ProductMeta = {
962
1412
  index?: number;
963
1413
  item_list_name?: string | undefined | null;
964
1414
  };
965
- type AdapterPayload = {
966
- adapter: 'HEADLESS';
967
- zone: 'PDP';
968
- products: (ProductType_PDP & ProductMeta)[];
969
- } | {
970
- adapter: 'HEADLESS';
971
- zone: 'PDC';
972
- products: (ProductType_PDC & ProductMeta)[];
973
- } | {
974
- adapter: 'HEADLESS';
975
- zone: 'Minicart';
976
- products: (ProductType_Minicart & ProductMeta)[];
977
- } | {
978
- adapter: 'DECO';
979
- 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;
980
1430
  };
981
1431
  interface TrackMeta {
982
1432
  region?: string;
@@ -985,23 +1435,60 @@ interface TrackMeta {
985
1435
  type?: string;
986
1436
  item_ref?: string;
987
1437
  size?: string;
1438
+ color?: string;
1439
+ ordering?: string;
1440
+ price_range?: string;
1441
+ category?: string;
988
1442
  search_term?: string;
989
1443
  search_found?: boolean;
990
1444
  search_quantity?: number;
991
- zip_code?: string;
1445
+ zipcode?: string;
1446
+ content_type?: string;
992
1447
  promotion_name?: string;
993
1448
  creative_name?: string;
994
1449
  creative_slot?: string;
995
1450
  coupon_code?: string;
996
- currency?: string;
1451
+ user_info?: UserInfoContext;
997
1452
  }
1453
+ type CallOverrides = {
1454
+ brand?: string;
1455
+ };
1456
+ type AdapterPayload = ({
1457
+ adapter: 'META';
1458
+ } | {
1459
+ adapter: 'DECO';
1460
+ products: (Product & ProductMeta)[];
1461
+ } | {
1462
+ adapter: 'ORDERFORM';
1463
+ orderForm: (OrderForm & ProductMeta)[];
1464
+ } | {
1465
+ adapter: 'PICKUP';
1466
+ flag_pickup: boolean;
1467
+ shippings: Sla[];
1468
+ } | {
1469
+ adapter: 'HEADLESS';
1470
+ zone: 'PDP';
1471
+ products: (ProductType_PDP & ProductMeta)[];
1472
+ } | {
1473
+ adapter: 'HEADLESS';
1474
+ zone: 'PDC';
1475
+ products: (ProductType_PDC & ProductMeta)[];
1476
+ } | {
1477
+ adapter: 'HEADLESS';
1478
+ zone: 'Minicart';
1479
+ products: (ProductType_Minicart & ProductMeta)[];
1480
+ }) & CallOverrides;
998
1481
  type RequiredMetaKeys<E extends EventName> = Extract<RequiredParamsOf<E>, keyof TrackMeta>;
999
1482
  type MetaForEvent<E extends EventName> = Required<Pick<TrackMeta, RequiredMetaKeys<E>>> & Omit<TrackMeta, RequiredMetaKeys<E>>;
1000
-
1001
- declare function trackWebEvent<E extends EventName>(event: E, context: AdapterPayload & {
1483
+ type PayloadFor<E extends EventName> = ('items' extends RequiredParamsOf<E> ? Exclude<AdapterPayload, {
1484
+ adapter: 'META';
1485
+ }> : AdapterPayload) & {
1002
1486
  meta: MetaForEvent<E>;
1003
1487
  window?: unknown;
1004
- }): Promise<void>;
1488
+ };
1489
+
1490
+ declare function initTracker(c: InitialConfig): void;
1491
+ declare function trackWebEvent<E extends EventName>(event: E, context: PayloadFor<E>): Promise<void>;
1005
1492
 
1006
1493
  declare const _default: {
1007
1494
  trackWebEvent: typeof trackWebEvent;
@@ -1183,4 +1670,4 @@ declare const _default: {
1183
1670
  };
1184
1671
  };
1185
1672
 
1186
- export { EVENTS, _default as default, trackWebEvent };
1673
+ export { EVENTS, _default as default, initTracker, trackWebEvent };