@aranova/tracking-react 1.4.1 → 1.5.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.
package/dist/index.mjs CHANGED
@@ -722,7 +722,14 @@ function parseBookingOption(value) {
722
722
  if (!value || typeof value !== "object") return [];
723
723
  const o = value;
724
724
  if (typeof o.key !== "string" || !o.key || typeof o.label !== "string") return [];
725
- return [{ key: o.key, label: o.label }];
725
+ return [
726
+ {
727
+ key: o.key,
728
+ label: o.label,
729
+ group: typeof o.group === "string" && o.group ? o.group : null,
730
+ description: typeof o.description === "string" && o.description ? o.description : null
731
+ }
732
+ ];
726
733
  }
727
734
  function parseIntegrations(value) {
728
735
  if (!value || typeof value !== "object") return {};
@@ -1449,7 +1456,12 @@ function getBookingIntegration(integrations) {
1449
1456
  timezone: booking.timezone,
1450
1457
  configVersion: booking.config_version,
1451
1458
  rules,
1452
- options: booking.options.map((option) => ({ key: option.key, label: option.label })),
1459
+ options: booking.options.map((option) => ({
1460
+ key: option.key,
1461
+ label: option.label,
1462
+ group: option.group,
1463
+ description: option.description
1464
+ })),
1453
1465
  mode: booking.mode ?? "live"
1454
1466
  };
1455
1467
  }
@@ -1529,6 +1541,15 @@ function nationalDigits(phone) {
1529
1541
  const parsed = parsePhone(phone);
1530
1542
  return (parsed.isValid ? parsed.national : phone).replace(/\D/g, "");
1531
1543
  }
1544
+ function groupBookingOptions(options) {
1545
+ const groups = /* @__PURE__ */ new Map();
1546
+ for (const option of options) {
1547
+ const members = groups.get(option.group);
1548
+ if (members) members.push(option);
1549
+ else groups.set(option.group, [option]);
1550
+ }
1551
+ return [...groups].map(([group, members]) => ({ group, options: members }));
1552
+ }
1532
1553
 
1533
1554
  // ../tracking-core/src/events/semantics.ts
1534
1555
  var EVENT_SEMANTICS = {
@@ -2445,6 +2466,7 @@ export {
2445
2466
  getConsentState,
2446
2467
  getEventSemantics,
2447
2468
  getTrackingConfigRuntime,
2469
+ groupBookingOptions,
2448
2470
  newBookingAttemptKey,
2449
2471
  onConsentChange,
2450
2472
  optIn,