@aranova/tracking-react 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
@@ -1897,6 +1897,7 @@ function attachFormStart(client, config) {
1897
1897
  }
1898
1898
 
1899
1899
  // ../tracking-core/src/triggers/page-exit.ts
1900
+ var MIN_SEGMENT_MS = 50;
1900
1901
  function attachPageExit(client) {
1901
1902
  if (typeof window === "undefined" || typeof document === "undefined") {
1902
1903
  return () => {
@@ -1934,7 +1935,7 @@ function attachPageExit(client) {
1934
1935
  }
1935
1936
  function emitSegment(path, flush) {
1936
1937
  const dwell = settledDwellMs();
1937
- if (dwell === 0) return;
1938
+ if (dwell < MIN_SEGMENT_MS) return;
1938
1939
  client.trackEvent({
1939
1940
  eventType: "page_exit",
1940
1941
  metadata: {
@@ -1949,7 +1950,7 @@ function attachPageExit(client) {
1949
1950
  client.flushBeacon();
1950
1951
  }
1951
1952
  accumulatedMs = 0;
1952
- activeSince = document.visibilityState === "visible" ? Date.now() : null;
1953
+ activeSince = null;
1953
1954
  }
1954
1955
  function onNavigate() {
1955
1956
  const newPath = window.location.pathname;
@@ -2340,7 +2341,10 @@ var saleCreateSchema = z12.object({
2340
2341
  metadata: metadataSchema.nullable().optional(),
2341
2342
  customer_name: customerNameSchema.nullable().optional(),
2342
2343
  customer_phone: customerPhoneSchema.nullable().optional(),
2343
- customer_email: customerEmailSchema.nullable().optional()
2344
+ customer_email: customerEmailSchema.nullable().optional(),
2345
+ // CASL consent attestation: the customer agreed to receive SMS. Recorded
2346
+ // with a timestamp server-side; every SMS send path gates on it.
2347
+ sms_consent: z12.boolean().default(false)
2344
2348
  }).strict().superRefine((val, ctx) => refineServiceXor(val, ctx, { requireAmount: true }));
2345
2349
  var saleUpdateSchema = z12.object({
2346
2350
  description: z12.string().nullable().optional(),
@@ -2353,7 +2357,9 @@ var saleUpdateSchema = z12.object({
2353
2357
  metadata: metadataSchema.nullable().optional(),
2354
2358
  customer_name: customerNameSchema.nullable().optional(),
2355
2359
  customer_phone: customerPhoneSchema.nullable().optional(),
2356
- customer_email: customerEmailSchema.nullable().optional()
2360
+ customer_email: customerEmailSchema.nullable().optional(),
2361
+ // NOT NULL server-side: omit to leave unchanged (explicit null is rejected).
2362
+ sms_consent: z12.boolean().optional()
2357
2363
  }).strict().superRefine((val, ctx) => refineServiceXor(val, ctx, { requireAmount: false }));
2358
2364
  var TRACKING_RANGES = ["24h", "7d", "30d"];
2359
2365
  var NAMED_RANGES = [
@@ -2737,7 +2743,7 @@ function GoogleAdsTracking(props) {
2737
2743
  import { createContext as createContext2, useContext as useContext2, useEffect as useEffect5, useMemo as useMemo4 } from "react";
2738
2744
 
2739
2745
  // package.json
2740
- var version = "0.16.1";
2746
+ var version = "0.17.0";
2741
2747
 
2742
2748
  // ../tracking-core/src/phone-react.tsx
2743
2749
  import {