@aranova/tracking-next 0.16.1 → 0.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.
package/dist/index.mjs CHANGED
@@ -1668,6 +1668,7 @@ function attachFormStart(client, config) {
1668
1668
  }
1669
1669
 
1670
1670
  // ../tracking-core/src/triggers/page-exit.ts
1671
+ var MIN_SEGMENT_MS = 50;
1671
1672
  function attachPageExit(client) {
1672
1673
  if (typeof window === "undefined" || typeof document === "undefined") {
1673
1674
  return () => {
@@ -1705,7 +1706,7 @@ function attachPageExit(client) {
1705
1706
  }
1706
1707
  function emitSegment(path, flush) {
1707
1708
  const dwell = settledDwellMs();
1708
- if (dwell === 0) return;
1709
+ if (dwell < MIN_SEGMENT_MS) return;
1709
1710
  client.trackEvent({
1710
1711
  eventType: "page_exit",
1711
1712
  metadata: {
@@ -1720,7 +1721,7 @@ function attachPageExit(client) {
1720
1721
  client.flushBeacon();
1721
1722
  }
1722
1723
  accumulatedMs = 0;
1723
- activeSince = document.visibilityState === "visible" ? Date.now() : null;
1724
+ activeSince = null;
1724
1725
  }
1725
1726
  function onNavigate() {
1726
1727
  const newPath = window.location.pathname;
@@ -2111,7 +2112,10 @@ var saleCreateSchema = z12.object({
2111
2112
  metadata: metadataSchema.nullable().optional(),
2112
2113
  customer_name: customerNameSchema.nullable().optional(),
2113
2114
  customer_phone: customerPhoneSchema.nullable().optional(),
2114
- customer_email: customerEmailSchema.nullable().optional()
2115
+ customer_email: customerEmailSchema.nullable().optional(),
2116
+ // CASL consent attestation: the customer agreed to receive SMS. Recorded
2117
+ // with a timestamp server-side; every SMS send path gates on it.
2118
+ sms_consent: z12.boolean().default(false)
2115
2119
  }).strict().superRefine((val, ctx) => refineServiceXor(val, ctx, { requireAmount: true }));
2116
2120
  var saleUpdateSchema = z12.object({
2117
2121
  description: z12.string().nullable().optional(),
@@ -2124,7 +2128,9 @@ var saleUpdateSchema = z12.object({
2124
2128
  metadata: metadataSchema.nullable().optional(),
2125
2129
  customer_name: customerNameSchema.nullable().optional(),
2126
2130
  customer_phone: customerPhoneSchema.nullable().optional(),
2127
- customer_email: customerEmailSchema.nullable().optional()
2131
+ customer_email: customerEmailSchema.nullable().optional(),
2132
+ // NOT NULL server-side: omit to leave unchanged (explicit null is rejected).
2133
+ sms_consent: z12.boolean().optional()
2128
2134
  }).strict().superRefine((val, ctx) => refineServiceXor(val, ctx, { requireAmount: false }));
2129
2135
  var TRACKING_RANGES = ["24h", "7d", "30d"];
2130
2136
  var NAMED_RANGES = [
@@ -2522,7 +2528,7 @@ function GoogleAdsTracking(props) {
2522
2528
  import { usePathname, useSearchParams } from "next/navigation";
2523
2529
 
2524
2530
  // package.json
2525
- var version = "0.16.1";
2531
+ var version = "0.17.0";
2526
2532
 
2527
2533
  // src/factory.tsx
2528
2534
  import {