@aranova/tracking-react 1.16.1 → 1.17.0

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.
@@ -105,6 +105,12 @@ interface BookingRulesConfig {
105
105
  vehicle_deferred: boolean;
106
106
  /** Empty when the shop hides the drop-off question. */
107
107
  drop_off_options: string[];
108
+ /**
109
+ * `YYYY-MM-DD` shop dates → live bookings that day (synced appointments, pending requests,
110
+ * website bookings not yet synced), today to the end of the window; days with none are left
111
+ * out. Empty from an API older than the counts. The site decides when a day is full.
112
+ */
113
+ booked_counts: Record<string, number>;
108
114
  }
109
115
  /** One service choice on the site's booking form; the shop system's ids stay server-side. */
110
116
  interface BookingOptionConfig {
@@ -345,6 +351,8 @@ interface BookingRules {
345
351
  vehicleDeferred: boolean;
346
352
  /** `waitForIt` / `dropOff`; empty when the shop hides the question. */
347
353
  dropOffOptions: string[];
354
+ /** `YYYY-MM-DD` shop dates → live bookings already held that day; days with none absent. */
355
+ bookedCounts: Record<string, number>;
348
356
  }
349
357
  interface BookingIntegration {
350
358
  provider: BookingProvider;
@@ -388,6 +396,11 @@ interface BookableDay {
388
396
  morning: number[];
389
397
  /** Start hours from noon on. */
390
398
  afternoon: number[];
399
+ /**
400
+ * Live bookings the shop already holds that day (0 when none). Never filters a day out:
401
+ * a site with a daily cap marks the day full itself.
402
+ */
403
+ booked: number;
391
404
  }
392
405
  /** Today's date in `timeZone` as `YYYY-MM-DD`; the server judges notice by the same date. */
393
406
  declare function shopToday(timeZone: string, now?: Date): string;
@@ -105,6 +105,12 @@ interface BookingRulesConfig {
105
105
  vehicle_deferred: boolean;
106
106
  /** Empty when the shop hides the drop-off question. */
107
107
  drop_off_options: string[];
108
+ /**
109
+ * `YYYY-MM-DD` shop dates → live bookings that day (synced appointments, pending requests,
110
+ * website bookings not yet synced), today to the end of the window; days with none are left
111
+ * out. Empty from an API older than the counts. The site decides when a day is full.
112
+ */
113
+ booked_counts: Record<string, number>;
108
114
  }
109
115
  /** One service choice on the site's booking form; the shop system's ids stay server-side. */
110
116
  interface BookingOptionConfig {
@@ -345,6 +351,8 @@ interface BookingRules {
345
351
  vehicleDeferred: boolean;
346
352
  /** `waitForIt` / `dropOff`; empty when the shop hides the question. */
347
353
  dropOffOptions: string[];
354
+ /** `YYYY-MM-DD` shop dates → live bookings already held that day; days with none absent. */
355
+ bookedCounts: Record<string, number>;
348
356
  }
349
357
  interface BookingIntegration {
350
358
  provider: BookingProvider;
@@ -388,6 +396,11 @@ interface BookableDay {
388
396
  morning: number[];
389
397
  /** Start hours from noon on. */
390
398
  afternoon: number[];
399
+ /**
400
+ * Live bookings the shop already holds that day (0 when none). Never filters a day out:
401
+ * a site with a daily cap marks the day full itself.
402
+ */
403
+ booked: number;
391
404
  }
392
405
  /** Today's date in `timeZone` as `YYYY-MM-DD`; the server judges notice by the same date. */
393
406
  declare function shopToday(timeZone: string, now?: Date): string;
package/dist/client.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, CSSProperties, InputHTMLAttributes, ChangeEvent, FocusEvent, AnchorHTMLAttributes } from 'react';
3
3
  import { G as GtagEnvironmentMap, M as MetaPixelEnvironmentMap, h as ConsentState, f as ConsentChoiceState, g as ConsentSource, T as TrackingParams, b as TrackingEnvironment, u as PhoneConfig, P as ParsedPhone, v as PhoneDisplayFormat } from './phone-utils-CYr6AmEP.mjs';
4
- import { T as TrackingConfigReference, C as ConversionConfig, h as BookingHandoffPrefill, i as BookingInput, p as BookingOutcome, b as BookingDetailsInput, d as BookingDetailsOutcome, k as BookingIntegration, B as BookableDay, x as LeadFormContracts, S as SalesBookingsClient, g as BookingFormSubmit, t as BookingSimulation, j as BookingInputFor } from './bookings-DFz3BUiP.mjs';
5
- export { Z as createLeadFormSubmit } from './bookings-DFz3BUiP.mjs';
4
+ import { T as TrackingConfigReference, C as ConversionConfig, h as BookingHandoffPrefill, i as BookingInput, p as BookingOutcome, b as BookingDetailsInput, d as BookingDetailsOutcome, k as BookingIntegration, B as BookableDay, x as LeadFormContracts, S as SalesBookingsClient, g as BookingFormSubmit, t as BookingSimulation, j as BookingInputFor } from './bookings-DOh1WMhH.mjs';
5
+ export { Z as createLeadFormSubmit } from './bookings-DOh1WMhH.mjs';
6
6
  import { L as TriggerRegistryConfig, O as TypedTrackingClient } from './ingest-typed-BO6Arbw-.mjs';
7
7
  import { CountryCode } from 'libphonenumber-js';
8
8
  import 'zod/mini';
package/dist/client.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, CSSProperties, InputHTMLAttributes, ChangeEvent, FocusEvent, AnchorHTMLAttributes } from 'react';
3
3
  import { G as GtagEnvironmentMap, M as MetaPixelEnvironmentMap, h as ConsentState, f as ConsentChoiceState, g as ConsentSource, T as TrackingParams, b as TrackingEnvironment, u as PhoneConfig, P as ParsedPhone, v as PhoneDisplayFormat } from './phone-utils-CYr6AmEP.js';
4
- import { T as TrackingConfigReference, C as ConversionConfig, h as BookingHandoffPrefill, i as BookingInput, p as BookingOutcome, b as BookingDetailsInput, d as BookingDetailsOutcome, k as BookingIntegration, B as BookableDay, x as LeadFormContracts, S as SalesBookingsClient, g as BookingFormSubmit, t as BookingSimulation, j as BookingInputFor } from './bookings-CkfA5XOM.js';
5
- export { Z as createLeadFormSubmit } from './bookings-CkfA5XOM.js';
4
+ import { T as TrackingConfigReference, C as ConversionConfig, h as BookingHandoffPrefill, i as BookingInput, p as BookingOutcome, b as BookingDetailsInput, d as BookingDetailsOutcome, k as BookingIntegration, B as BookableDay, x as LeadFormContracts, S as SalesBookingsClient, g as BookingFormSubmit, t as BookingSimulation, j as BookingInputFor } from './bookings-2ZKfenQ7.js';
5
+ export { Z as createLeadFormSubmit } from './bookings-2ZKfenQ7.js';
6
6
  import { L as TriggerRegistryConfig, O as TypedTrackingClient } from './ingest-typed-D7I4aQ7p.js';
7
7
  import { CountryCode } from 'libphonenumber-js';
8
8
  import 'zod/mini';
package/dist/client.js CHANGED
@@ -1031,9 +1031,18 @@ function parseBookingRules(value) {
1031
1031
  special_hours: parseWindowsMap(r.special_hours),
1032
1032
  vehicle_required: r.vehicle_required === true,
1033
1033
  vehicle_deferred: r.vehicle_deferred === true,
1034
- drop_off_options: isStringList(r.drop_off_options) ? r.drop_off_options : []
1034
+ drop_off_options: isStringList(r.drop_off_options) ? r.drop_off_options : [],
1035
+ booked_counts: parseCounts(r.booked_counts)
1035
1036
  };
1036
1037
  }
1038
+ function parseCounts(value) {
1039
+ if (!value || typeof value !== "object" || Array.isArray(value)) return {};
1040
+ const counts = {};
1041
+ for (const [date, count] of Object.entries(value)) {
1042
+ if (typeof count === "number" && Number.isInteger(count) && count >= 0) counts[date] = count;
1043
+ }
1044
+ return counts;
1045
+ }
1037
1046
  function parseBookingOption(value) {
1038
1047
  if (!value || typeof value !== "object") return [];
1039
1048
  const o = value;
@@ -1826,7 +1835,8 @@ function camelRules(rules) {
1826
1835
  specialHours: rules.special_hours,
1827
1836
  vehicleRequired: rules.vehicle_required,
1828
1837
  vehicleDeferred: rules.vehicle_deferred,
1829
- dropOffOptions: rules.drop_off_options
1838
+ dropOffOptions: rules.drop_off_options,
1839
+ bookedCounts: rules.booked_counts ?? {}
1830
1840
  };
1831
1841
  }
1832
1842
  var WEEKDAYS = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
@@ -1859,7 +1869,8 @@ function bookableSlots(rules, { timeZone, now = /* @__PURE__ */ new Date() }) {
1859
1869
  date,
1860
1870
  weekday,
1861
1871
  morning: [...windows.morning],
1862
- afternoon: [...windows.afternoon]
1872
+ afternoon: [...windows.afternoon],
1873
+ booked: rules.bookedCounts?.[date] ?? 0
1863
1874
  });
1864
1875
  }
1865
1876
  return days;
@@ -4416,7 +4427,7 @@ function GoogleAdsTracking(props) {
4416
4427
  var import_react6 = require("react");
4417
4428
 
4418
4429
  // package.json
4419
- var version = "1.16.1";
4430
+ var version = "1.17.0";
4420
4431
 
4421
4432
  // ../tracking-core/src/phone-react.tsx
4422
4433
  var import_react5 = require("react");