@aranova/tracking-react 1.10.0 → 1.11.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
@@ -815,9 +815,15 @@ function parseConversionConfig(raw) {
815
815
  services,
816
816
  goals,
817
817
  linked_hostnames: Array.isArray(obj.linked_hostnames) ? obj.linked_hostnames.filter((h) => typeof h === "string" && h.length > 0) : [],
818
- integrations: parseIntegrations(obj.integrations)
818
+ integrations: parseIntegrations(obj.integrations),
819
+ lead_forms: parseLeadForms(obj.lead_forms)
819
820
  };
820
821
  }
822
+ function parseLeadForms(value) {
823
+ if (!value || typeof value !== "object") return null;
824
+ const version = value.registry_version;
825
+ return typeof version === "number" ? { registry_version: version } : null;
826
+ }
821
827
  var CACHE_PREFIX = "_aranova_cfg_";
822
828
  function cacheKey(url) {
823
829
  return `${CACHE_PREFIX}${url}`;
@@ -2450,6 +2456,118 @@ function phoneField(name, raw, country) {
2450
2456
  return { name, type: "phone", value: toE164(raw, country) };
2451
2457
  }
2452
2458
 
2459
+ // ../tracking-core/src/lead-forms/lead-forms.gen.ts
2460
+ import * as z4 from "zod/mini";
2461
+ var LEAD_FORM_REGISTRY_VERSION = 1;
2462
+ var LEAD_FORM_KINDS = ["booking", "quote", "contact", "consult", "callback"];
2463
+ var LEAD_FORM_ROLES = [
2464
+ "given_name",
2465
+ "family_name",
2466
+ "phone",
2467
+ "email",
2468
+ "service",
2469
+ "preferred_date",
2470
+ "preferred_time",
2471
+ "note",
2472
+ "visit",
2473
+ "intent",
2474
+ "vehicle",
2475
+ "drop_off",
2476
+ "address",
2477
+ "patient_type",
2478
+ "matter",
2479
+ "language",
2480
+ "products",
2481
+ "goal",
2482
+ "business_type",
2483
+ "lead_volume",
2484
+ "attribution"
2485
+ ];
2486
+ var LEAD_FORM_PRIMITIVES = [
2487
+ "string",
2488
+ "text",
2489
+ "enum",
2490
+ "multi_enum",
2491
+ "bool",
2492
+ "date",
2493
+ "time_window",
2494
+ "phone",
2495
+ "email",
2496
+ "address",
2497
+ "number"
2498
+ ];
2499
+ var leadFormPrimitiveSchemas = {
2500
+ string: z4.string().check(z4.maxLength(120)),
2501
+ text: z4.string().check(z4.maxLength(2e3)),
2502
+ enum: z4.string().check(z4.regex(/^[a-z0-9-]{1,48}$/)),
2503
+ multi_enum: z4.array(z4.string().check(z4.regex(/^[a-z0-9-]{1,48}$/))).check(z4.maxLength(10)),
2504
+ bool: z4.boolean(),
2505
+ date: z4.string().check(z4.regex(/^\d{4}-\d{2}-\d{2}$/)),
2506
+ time_window: z4.strictObject({
2507
+ start: z4.string().check(z4.regex(/^([01]\d|2[0-3]):[0-5]\d$/)),
2508
+ end: z4.nullable(z4.string().check(z4.regex(/^([01]\d|2[0-3]):[0-5]\d$/))),
2509
+ label: z4.optional(z4.string().check(z4.maxLength(60)))
2510
+ }),
2511
+ phone: z4.string().check(z4.regex(/^\+[1-9]\d{6,14}$/)),
2512
+ email: z4.string().check(z4.maxLength(320), z4.regex(/^[^\s@]+@[^\s@]+$/)),
2513
+ address: z4.strictObject({
2514
+ line1: z4.string().check(z4.maxLength(120)),
2515
+ line2: z4.optional(z4.string().check(z4.maxLength(120))),
2516
+ city: z4.optional(z4.string().check(z4.maxLength(120))),
2517
+ region: z4.optional(z4.string().check(z4.maxLength(120))),
2518
+ postal_code: z4.optional(z4.string().check(z4.maxLength(120))),
2519
+ country: z4.optional(z4.string().check(z4.maxLength(120)))
2520
+ }),
2521
+ number: z4.number()
2522
+ };
2523
+ var LEAD_FORM_ROLE_SPECS = {
2524
+ given_name: { primitive: "string", smsLabel: "", contactIdentity: true },
2525
+ family_name: { primitive: "string", smsLabel: "", contactIdentity: true },
2526
+ phone: { primitive: "phone", smsLabel: "", contactIdentity: true },
2527
+ email: { primitive: "email", smsLabel: "", contactIdentity: true },
2528
+ service: { primitive: "enum", smsLabel: "Service" },
2529
+ preferred_date: { primitive: "date", smsLabel: "Date" },
2530
+ preferred_time: { primitive: "time_window", smsLabel: "Time" },
2531
+ note: { primitive: "text", smsLabel: "Note" },
2532
+ visit: {
2533
+ primitive: "enum",
2534
+ smsLabel: "Visit",
2535
+ options: [
2536
+ { key: "in-shop", label: "In shop" },
2537
+ { key: "in-home", label: "In home" },
2538
+ { key: "remote", label: "Remote" },
2539
+ { key: "on-site", label: "On site" }
2540
+ ]
2541
+ },
2542
+ intent: {
2543
+ primitive: "enum",
2544
+ smsLabel: "Wants",
2545
+ options: [
2546
+ { key: "book", label: "Book" },
2547
+ { key: "quote", label: "Quote" }
2548
+ ]
2549
+ },
2550
+ vehicle: { primitive: "string", smsLabel: "Vehicle" },
2551
+ drop_off: {
2552
+ primitive: "enum",
2553
+ smsLabel: "Drop-off",
2554
+ options: [
2555
+ { key: "wait-for-it", label: "Waiting" },
2556
+ { key: "drop-off", label: "Dropping off" }
2557
+ ]
2558
+ },
2559
+ address: { primitive: "address", smsLabel: "Address" },
2560
+ patient_type: { primitive: "enum", smsLabel: "Patient" },
2561
+ matter: { primitive: "enum", smsLabel: "Matter" },
2562
+ language: { primitive: "enum", smsLabel: "Language" },
2563
+ products: { primitive: "multi_enum", smsLabel: "Products" },
2564
+ goal: { primitive: "enum", smsLabel: "Goal" },
2565
+ business_type: { primitive: "enum", smsLabel: "Business" },
2566
+ lead_volume: { primitive: "enum", smsLabel: "Lead volume" },
2567
+ add_on: { primitive: "bool", smsLabel: "" },
2568
+ attribution: { primitive: "enum", smsLabel: "", uninteresting: true }
2569
+ };
2570
+
2453
2571
  // src/index.ts
2454
2572
  import {
2455
2573
  PhoneField,
@@ -2472,6 +2590,11 @@ export {
2472
2590
  DEFAULT_PHONE_COUNTRY,
2473
2591
  EVENT_SEMANTICS,
2474
2592
  GoogleAdsTracking,
2593
+ LEAD_FORM_KINDS,
2594
+ LEAD_FORM_PRIMITIVES,
2595
+ LEAD_FORM_REGISTRY_VERSION,
2596
+ LEAD_FORM_ROLES,
2597
+ LEAD_FORM_ROLE_SPECS,
2475
2598
  NAMED_RANGES,
2476
2599
  PhoneField,
2477
2600
  SALE_SOURCES,
@@ -2500,6 +2623,7 @@ export {
2500
2623
  getEventSemantics,
2501
2624
  getTrackingConfigRuntime,
2502
2625
  groupBookingOptions,
2626
+ leadFormPrimitiveSchemas,
2503
2627
  newBookingAttemptKey,
2504
2628
  onConsentChange,
2505
2629
  optIn,