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

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
@@ -156,10 +156,10 @@ declare const EVENTS: {
156
156
  readonly requiredParams: readonly ["user_info"];
157
157
  };
158
158
  NOTIFY_ME: {
159
- name: string;
160
- hasEcommerce: boolean;
161
- destinations: string[];
162
- requiredParams: string[];
159
+ readonly name: "notify_me";
160
+ readonly hasEcommerce: false;
161
+ readonly destinations: readonly ["DataLayer"];
162
+ readonly requiredParams: readonly ["brand", "size", "item_ref"];
163
163
  };
164
164
  REFINE_RESULTS: {
165
165
  readonly name: "refine_results";
@@ -1454,6 +1454,8 @@ type CallOverrides = {
1454
1454
  brand?: string;
1455
1455
  };
1456
1456
  type AdapterPayload = ({
1457
+ adapter: 'META';
1458
+ } | {
1457
1459
  adapter: 'DECO';
1458
1460
  products: (Product & ProductMeta)[];
1459
1461
  } | {
@@ -1478,12 +1480,15 @@ type AdapterPayload = ({
1478
1480
  }) & CallOverrides;
1479
1481
  type RequiredMetaKeys<E extends EventName> = Extract<RequiredParamsOf<E>, keyof TrackMeta>;
1480
1482
  type MetaForEvent<E extends EventName> = Required<Pick<TrackMeta, RequiredMetaKeys<E>>> & Omit<TrackMeta, RequiredMetaKeys<E>>;
1481
-
1482
- declare function initTracker(c: InitialConfig): void;
1483
- 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) & {
1484
1486
  meta: MetaForEvent<E>;
1485
1487
  window?: unknown;
1486
- }): 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>;
1487
1492
 
1488
1493
  declare const _default: {
1489
1494
  trackWebEvent: typeof trackWebEvent;
@@ -1645,10 +1650,10 @@ declare const _default: {
1645
1650
  readonly requiredParams: readonly ["user_info"];
1646
1651
  };
1647
1652
  NOTIFY_ME: {
1648
- name: string;
1649
- hasEcommerce: boolean;
1650
- destinations: string[];
1651
- requiredParams: string[];
1653
+ readonly name: "notify_me";
1654
+ readonly hasEcommerce: false;
1655
+ readonly destinations: readonly ["DataLayer"];
1656
+ readonly requiredParams: readonly ["brand", "size", "item_ref"];
1652
1657
  };
1653
1658
  REFINE_RESULTS: {
1654
1659
  readonly name: "refine_results";
package/dist/mod.d.ts CHANGED
@@ -156,10 +156,10 @@ declare const EVENTS: {
156
156
  readonly requiredParams: readonly ["user_info"];
157
157
  };
158
158
  NOTIFY_ME: {
159
- name: string;
160
- hasEcommerce: boolean;
161
- destinations: string[];
162
- requiredParams: string[];
159
+ readonly name: "notify_me";
160
+ readonly hasEcommerce: false;
161
+ readonly destinations: readonly ["DataLayer"];
162
+ readonly requiredParams: readonly ["brand", "size", "item_ref"];
163
163
  };
164
164
  REFINE_RESULTS: {
165
165
  readonly name: "refine_results";
@@ -1454,6 +1454,8 @@ type CallOverrides = {
1454
1454
  brand?: string;
1455
1455
  };
1456
1456
  type AdapterPayload = ({
1457
+ adapter: 'META';
1458
+ } | {
1457
1459
  adapter: 'DECO';
1458
1460
  products: (Product & ProductMeta)[];
1459
1461
  } | {
@@ -1478,12 +1480,15 @@ type AdapterPayload = ({
1478
1480
  }) & CallOverrides;
1479
1481
  type RequiredMetaKeys<E extends EventName> = Extract<RequiredParamsOf<E>, keyof TrackMeta>;
1480
1482
  type MetaForEvent<E extends EventName> = Required<Pick<TrackMeta, RequiredMetaKeys<E>>> & Omit<TrackMeta, RequiredMetaKeys<E>>;
1481
-
1482
- declare function initTracker(c: InitialConfig): void;
1483
- 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) & {
1484
1486
  meta: MetaForEvent<E>;
1485
1487
  window?: unknown;
1486
- }): 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>;
1487
1492
 
1488
1493
  declare const _default: {
1489
1494
  trackWebEvent: typeof trackWebEvent;
@@ -1645,10 +1650,10 @@ declare const _default: {
1645
1650
  readonly requiredParams: readonly ["user_info"];
1646
1651
  };
1647
1652
  NOTIFY_ME: {
1648
- name: string;
1649
- hasEcommerce: boolean;
1650
- destinations: string[];
1651
- requiredParams: string[];
1653
+ readonly name: "notify_me";
1654
+ readonly hasEcommerce: false;
1655
+ readonly destinations: readonly ["DataLayer"];
1656
+ readonly requiredParams: readonly ["brand", "size", "item_ref"];
1652
1657
  };
1653
1658
  REFINE_RESULTS: {
1654
1659
  readonly name: "refine_results";
@@ -1356,7 +1356,7 @@ var AzzasTracker = (() => {
1356
1356
  };
1357
1357
 
1358
1358
  // src/params/adapters/meta/index.ts
1359
- var metaAdapters = {
1359
+ var metaAdapter = {
1360
1360
  user_info: getUserInfo,
1361
1361
  content_type: (context) => {
1362
1362
  return context.meta.content_type || null;
@@ -1475,7 +1475,7 @@ var AzzasTracker = (() => {
1475
1475
  var IN_STOCK_SCHEMA = "https://schema.org/InStock";
1476
1476
  var LIST_PRICE_SCHEMA = "https://schema.org/ListPrice";
1477
1477
  var decoAdapter = {
1478
- ...metaAdapters,
1478
+ ...metaAdapter,
1479
1479
  // global adapters
1480
1480
  items: (context) => {
1481
1481
  if (context == null ? void 0 : context.items) return context.items;
@@ -1710,7 +1710,7 @@ var AzzasTracker = (() => {
1710
1710
 
1711
1711
  // src/params/adapters/headless/index.ts
1712
1712
  var headlessAdapter = {
1713
- ...metaAdapters,
1713
+ ...metaAdapter,
1714
1714
  // global adapters
1715
1715
  brand: (context, config2) => {
1716
1716
  if (context.zone === "PDP") {
@@ -1778,7 +1778,7 @@ var AzzasTracker = (() => {
1778
1778
 
1779
1779
  // src/params/adapters/pickup/index.ts
1780
1780
  var pickupAdapter = {
1781
- ...metaAdapters,
1781
+ ...metaAdapter,
1782
1782
  flag_pickup: (context) => {
1783
1783
  var _a;
1784
1784
  return (_a = context == null ? void 0 : context.flag_pickup) != null ? _a : null;
@@ -1840,7 +1840,7 @@ var AzzasTracker = (() => {
1840
1840
 
1841
1841
  // src/params/adapters/orderForm/index.ts
1842
1842
  var orderFormAdapter = {
1843
- ...metaAdapters,
1843
+ ...metaAdapter,
1844
1844
  items: (context) => {
1845
1845
  if (context == null ? void 0 : context.items) return context.items;
1846
1846
  if ((context == null ? void 0 : context.orderForm) && (context == null ? void 0 : context.orderForm.items)) {
@@ -2016,7 +2016,8 @@ var AzzasTracker = (() => {
2016
2016
  DECO: decoAdapter,
2017
2017
  HEADLESS: headlessAdapter,
2018
2018
  PICKUP: pickupAdapter,
2019
- ORDERFORM: orderFormAdapter
2019
+ ORDERFORM: orderFormAdapter,
2020
+ META: metaAdapter
2020
2021
  };
2021
2022
  async function getParameters(context, eventName, config2) {
2022
2023
  var _a;