@aranova/tracking-react 1.13.0 → 1.14.1
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/README.md +26 -0
- package/dist/{bookings-C1HMPjQl.d.ts → bookings-CkfA5XOM.d.ts} +283 -8
- package/dist/{bookings-CHpplXU7.d.mts → bookings-DFz3BUiP.d.mts} +283 -8
- package/dist/client.d.mts +10 -8
- package/dist/client.d.ts +10 -8
- package/dist/client.js +382 -41
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +380 -40
- package/dist/client.mjs.map +1 -1
- package/dist/index.d.mts +8 -180
- package/dist/index.d.ts +8 -180
- package/dist/index.js +375 -189
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +372 -189
- package/dist/index.mjs.map +1 -1
- package/dist/{ingest-typed-sCDoPInT.d.ts → ingest-typed-BO6Arbw-.d.mts} +6 -99
- package/dist/{ingest-typed-Ckt4R731.d.mts → ingest-typed-D7I4aQ7p.d.ts} +6 -99
- package/dist/{phone-utils-BNiSqeF7.d.mts → phone-utils-CYr6AmEP.d.mts} +231 -3
- package/dist/{phone-utils-D12FW8tT.d.ts → phone-utils-CYr6AmEP.d.ts} +231 -3
- package/dist/phone.d.mts +1 -2
- package/dist/phone.d.ts +1 -2
- package/dist/phone.js +2 -2
- package/dist/phone.js.map +1 -1
- package/dist/phone.mjs +2 -2
- package/dist/phone.mjs.map +1 -1
- package/dist/{sales-CNvzyF5T.d.ts → sales-C0FMkN4m.d.ts} +1 -1
- package/dist/{sales-YUH3bQl9.d.mts → sales-KbTcowYa.d.mts} +1 -1
- package/dist/sales.d.mts +3 -3
- package/dist/sales.d.ts +3 -3
- package/dist/sales.js +1204 -170
- package/dist/sales.js.map +1 -1
- package/dist/sales.mjs +1204 -170
- package/dist/sales.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/form-submit-CX-CxJjQ.d.mts +0 -47
- package/dist/form-submit-CX-CxJjQ.d.ts +0 -47
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { p as LeadFormKind, r as LeadFormRole, o as LEAD_FORM_ROLE_SPECS, n as LEAD_FORM_ROLES, J as JsonValue, b as TrackingEnvironment, k as FormSubmitMetadata } from './phone-utils-CYr6AmEP.mjs';
|
|
2
2
|
|
|
3
3
|
interface ServiceFiring {
|
|
4
4
|
send_to: string;
|
|
@@ -308,6 +308,263 @@ declare class TrackingConfigRuntime {
|
|
|
308
308
|
}
|
|
309
309
|
declare function getTrackingConfigRuntime(ref: TrackingConfigReference, fetchImpl?: typeof fetch): TrackingConfigRuntime;
|
|
310
310
|
|
|
311
|
+
type BookingProvider = "autoleap";
|
|
312
|
+
/**
|
|
313
|
+
* An option key the live config offered. Branded so a contract-typed booking accepts it beside the
|
|
314
|
+
* generated keys: a key newer than the site's generated file still books (reported as behind).
|
|
315
|
+
*/
|
|
316
|
+
type BookingOptionKey = string & {
|
|
317
|
+
readonly __bookingOptionKey: true;
|
|
318
|
+
};
|
|
319
|
+
/** One service choice on the booking form, by the site's own key. */
|
|
320
|
+
interface BookingOption {
|
|
321
|
+
key: BookingOptionKey;
|
|
322
|
+
label: string;
|
|
323
|
+
/** The shop's service category, for a heading over its choices; null when it has none. */
|
|
324
|
+
group: string | null;
|
|
325
|
+
/** Optional helper text to show under the label. */
|
|
326
|
+
description: string | null;
|
|
327
|
+
}
|
|
328
|
+
/** One heading on the form and the choices under it; `group` null holds the ungrouped ones. */
|
|
329
|
+
interface BookingOptionGroup {
|
|
330
|
+
group: string | null;
|
|
331
|
+
options: BookingOption[];
|
|
332
|
+
}
|
|
333
|
+
/** The booking rules in camelCase, all in the shop's wall time. */
|
|
334
|
+
interface BookingRules {
|
|
335
|
+
minDaysAhead: number;
|
|
336
|
+
maxDaysAhead: number;
|
|
337
|
+
/** Start hours per weekday, `monday` … `sunday`; both lists empty = closed. */
|
|
338
|
+
hours: Record<string, BookingDayWindows>;
|
|
339
|
+
/** `YYYY-MM-DD` shop dates with no bookings although the weekday is open. */
|
|
340
|
+
closedDates: string[];
|
|
341
|
+
/** `YYYY-MM-DD` shop dates whose start hours replace their weekday's. */
|
|
342
|
+
specialHours: Record<string, BookingDayWindows>;
|
|
343
|
+
vehicleRequired: boolean;
|
|
344
|
+
/** The vehicle may come after booking: send it with `bookings.updateBooking`. */
|
|
345
|
+
vehicleDeferred: boolean;
|
|
346
|
+
/** `waitForIt` / `dropOff`; empty when the shop hides the question. */
|
|
347
|
+
dropOffOptions: string[];
|
|
348
|
+
}
|
|
349
|
+
interface BookingIntegration {
|
|
350
|
+
provider: BookingProvider;
|
|
351
|
+
/** False: render only the handoff link. Never block the customer on it. */
|
|
352
|
+
enabled: boolean;
|
|
353
|
+
/** The shop's own booking page. */
|
|
354
|
+
fallbackUrl: string;
|
|
355
|
+
/** True when the site may post a booking: `enabled`, rules captured and options mapped. */
|
|
356
|
+
acceptsBookings: boolean;
|
|
357
|
+
/** The shop's IANA timezone; every date and hour here is its wall time. */
|
|
358
|
+
timezone: string;
|
|
359
|
+
/** Sent back with each booking; a stale one is refused and the config refetched. */
|
|
360
|
+
configVersion: number | null;
|
|
361
|
+
rules: BookingRules | null;
|
|
362
|
+
options: BookingOption[];
|
|
363
|
+
/**
|
|
364
|
+
* Where a booking from this page goes: `live` in production; on a development config `test`
|
|
365
|
+
* (the shop's test lead source) or `simulated` (never sent). Show a banner when not `live`.
|
|
366
|
+
*/
|
|
367
|
+
mode: BookingMode;
|
|
368
|
+
}
|
|
369
|
+
/** What the visitor already typed, carried onto the shop's booking page. */
|
|
370
|
+
interface BookingHandoffPrefill {
|
|
371
|
+
/** A single full-name field; split on the first space when `firstName` is not given. */
|
|
372
|
+
name?: string | null;
|
|
373
|
+
firstName?: string | null;
|
|
374
|
+
lastName?: string | null;
|
|
375
|
+
/** Any format; sent as national digits (no country code), as the shop's portal stores it. */
|
|
376
|
+
phone?: string | null;
|
|
377
|
+
email?: string | null;
|
|
378
|
+
}
|
|
379
|
+
/** The enabled-or-fallback booking provider in a config's integrations, if any. */
|
|
380
|
+
declare function getBookingIntegration(integrations: ConversionIntegrations | null | undefined): BookingIntegration | null;
|
|
381
|
+
/** One bookable day: its start hours split as the shop's portal shows them. */
|
|
382
|
+
interface BookableDay {
|
|
383
|
+
/** `YYYY-MM-DD`, shop-local. */
|
|
384
|
+
date: string;
|
|
385
|
+
/** `monday` … `sunday`. */
|
|
386
|
+
weekday: string;
|
|
387
|
+
/** Start hours before noon (8 = 08:00). */
|
|
388
|
+
morning: number[];
|
|
389
|
+
/** Start hours from noon on. */
|
|
390
|
+
afternoon: number[];
|
|
391
|
+
}
|
|
392
|
+
/** Today's date in `timeZone` as `YYYY-MM-DD`; the server judges notice by the same date. */
|
|
393
|
+
declare function shopToday(timeZone: string, now?: Date): string;
|
|
394
|
+
/**
|
|
395
|
+
* Every day a customer may book, from the minimum notice to the end of the window, with its
|
|
396
|
+
* start hours. Exactly what the server accepts: closed dates removed, special hours applied.
|
|
397
|
+
*/
|
|
398
|
+
declare function bookableSlots(rules: BookingRules, { timeZone, now }: {
|
|
399
|
+
timeZone: string;
|
|
400
|
+
now?: Date;
|
|
401
|
+
}): BookableDay[];
|
|
402
|
+
/**
|
|
403
|
+
* The handoff URL with the visitor's details prefilled, or null when `fallbackUrl` is not an
|
|
404
|
+
* https link on the shop's booking host (a config value never becomes an arbitrary redirect).
|
|
405
|
+
*/
|
|
406
|
+
declare function buildBookingHandoffUrl(fallbackUrl: string, prefill?: BookingHandoffPrefill): string | null;
|
|
407
|
+
/**
|
|
408
|
+
* The options as headed sections, in published order: one per category, choices in order
|
|
409
|
+
* under it. The API saves them grouped, so a category is never split; this keeps the first run.
|
|
410
|
+
*/
|
|
411
|
+
declare function groupBookingOptions(options: readonly BookingOption[]): BookingOptionGroup[];
|
|
412
|
+
|
|
413
|
+
/** One required role; `requiredWhen` is the one-level condition (ADR-0024 §3). */
|
|
414
|
+
interface LeadFormRequirementDecl {
|
|
415
|
+
readonly role: LeadFormRole;
|
|
416
|
+
readonly requiredWhen: {
|
|
417
|
+
readonly role: LeadFormRole;
|
|
418
|
+
readonly anyOf: readonly string[];
|
|
419
|
+
} | null;
|
|
420
|
+
/** An operator recorded a waiver: optional in the type, still reported when missing. */
|
|
421
|
+
readonly waived?: boolean;
|
|
422
|
+
}
|
|
423
|
+
/** What one kind of form must collect, as generated for the site. */
|
|
424
|
+
interface LeadFormKindDecl {
|
|
425
|
+
/** The published contract hash; null when nothing is bound for the kind. */
|
|
426
|
+
readonly hash: string | null;
|
|
427
|
+
readonly requires: readonly LeadFormRequirementDecl[];
|
|
428
|
+
/** Each group is satisfied by any one of its roles. */
|
|
429
|
+
readonly requiresAny: readonly (readonly LeadFormRole[])[];
|
|
430
|
+
/** Live option keys per choice role; deprecated keys are left out. */
|
|
431
|
+
readonly options: {
|
|
432
|
+
readonly [role: string]: readonly string[];
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
/** The module `aranova-tracking forms gen` writes: `ARANOVA_LEAD_FORMS`. */
|
|
436
|
+
interface LeadFormContracts {
|
|
437
|
+
readonly registryVersion: number;
|
|
438
|
+
readonly siteId: string | null;
|
|
439
|
+
readonly contracts: {
|
|
440
|
+
readonly [K in LeadFormKind]?: LeadFormKindDecl;
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
/** `{ start: "HH:MM", end: "HH:MM" | null, label? }`, business-local; pinned to the zod by test. */
|
|
444
|
+
interface LeadFormTimeWindow {
|
|
445
|
+
start: string;
|
|
446
|
+
end: string | null;
|
|
447
|
+
label?: string;
|
|
448
|
+
}
|
|
449
|
+
interface LeadFormAddress {
|
|
450
|
+
line1: string;
|
|
451
|
+
line2?: string;
|
|
452
|
+
city?: string;
|
|
453
|
+
region?: string;
|
|
454
|
+
postal_code?: string;
|
|
455
|
+
country?: string;
|
|
456
|
+
}
|
|
457
|
+
type Specs = typeof LEAD_FORM_ROLE_SPECS;
|
|
458
|
+
type RegistryRole = (typeof LEAD_FORM_ROLES)[number];
|
|
459
|
+
type AddOnRole = `add_on:${string}`;
|
|
460
|
+
type SpecOf<R> = R extends AddOnRole ? Specs["add_on"] : R extends keyof Specs ? Specs[R] : never;
|
|
461
|
+
type PrimitiveOf<R> = SpecOf<R>["primitive"];
|
|
462
|
+
type EmptyKind = {
|
|
463
|
+
hash: null;
|
|
464
|
+
requires: readonly [];
|
|
465
|
+
requiresAny: readonly [];
|
|
466
|
+
options: Record<string, never>;
|
|
467
|
+
};
|
|
468
|
+
type KindOf<C extends LeadFormContracts, K extends LeadFormKind> = C["contracts"][K] extends LeadFormKindDecl ? C["contracts"][K] : EmptyKind;
|
|
469
|
+
/** The site's live keys for a choice role, else the registry's fixed ones, else any key. */
|
|
470
|
+
type OptionKey<D extends LeadFormKindDecl, R> = R extends keyof D["options"] ? D["options"][R][number] : SpecOf<R> extends {
|
|
471
|
+
options: readonly {
|
|
472
|
+
key: infer Key;
|
|
473
|
+
}[];
|
|
474
|
+
} ? Key : string;
|
|
475
|
+
interface PrimitiveValues {
|
|
476
|
+
string: string;
|
|
477
|
+
text: string;
|
|
478
|
+
phone: string;
|
|
479
|
+
email: string;
|
|
480
|
+
date: string;
|
|
481
|
+
bool: boolean;
|
|
482
|
+
number: number;
|
|
483
|
+
time_window: LeadFormTimeWindow;
|
|
484
|
+
address: LeadFormAddress;
|
|
485
|
+
}
|
|
486
|
+
/** The value a role takes: option keys for a choice role, never labels. */
|
|
487
|
+
type LeadFormValue<D extends LeadFormKindDecl, R> = PrimitiveOf<R> extends "enum" ? OptionKey<D, R> : PrimitiveOf<R> extends "multi_enum" ? readonly OptionKey<D, R>[] : PrimitiveValues[Extract<PrimitiveOf<R>, keyof PrimitiveValues>];
|
|
488
|
+
type Blank = null | undefined;
|
|
489
|
+
type RequiredRoles<D extends LeadFormKindDecl> = Exclude<Extract<D["requires"][number], {
|
|
490
|
+
readonly requiredWhen: null;
|
|
491
|
+
}>, {
|
|
492
|
+
readonly waived: true;
|
|
493
|
+
}>["role"];
|
|
494
|
+
/** The roles one kind must always send (unconditional, not waived), per the generated contract. */
|
|
495
|
+
type LeadFormRequiredRole<C extends LeadFormContracts, K extends LeadFormKind> = RequiredRoles<KindOf<C, K>>;
|
|
496
|
+
type AnyOf<D extends LeadFormKindDecl, G extends readonly string[]> = {
|
|
497
|
+
[R in G[number]]: {
|
|
498
|
+
[P in R]: LeadFormValue<D, P>;
|
|
499
|
+
};
|
|
500
|
+
}[G[number]];
|
|
501
|
+
type AllGroups<D extends LeadFormKindDecl, Gs> = Gs extends readonly [
|
|
502
|
+
infer H extends readonly string[],
|
|
503
|
+
...infer T
|
|
504
|
+
] ? AnyOf<D, H> & AllGroups<D, T> : unknown;
|
|
505
|
+
/**
|
|
506
|
+
* The `fields` of one kind's submit: unconditionally required roles are required keys, each
|
|
507
|
+
* any-of group needs one of its roles, everything else in the registry is optional (blank is
|
|
508
|
+
* omitted); a `required_when` role is optional here and checked at runtime.
|
|
509
|
+
*/
|
|
510
|
+
type LeadFormFields<C extends LeadFormContracts, K extends LeadFormKind> = {
|
|
511
|
+
[R in RequiredRoles<KindOf<C, K>>]: LeadFormValue<KindOf<C, K>, R>;
|
|
512
|
+
} & {
|
|
513
|
+
[R in Exclude<RegistryRole, RequiredRoles<KindOf<C, K>>>]?: LeadFormValue<KindOf<C, K>, R> | Blank;
|
|
514
|
+
} & {
|
|
515
|
+
[R in AddOnRole]?: boolean | Blank;
|
|
516
|
+
} & AllGroups<KindOf<C, K>, KindOf<C, K>["requiresAny"]>;
|
|
517
|
+
interface LeadFormExtraField {
|
|
518
|
+
key: string;
|
|
519
|
+
label: string;
|
|
520
|
+
value: JsonValue;
|
|
521
|
+
}
|
|
522
|
+
interface LeadFormSubmitInput<C extends LeadFormContracts, K extends LeadFormKind> {
|
|
523
|
+
/** The `<form id>`, so `form_start` and `form_submit` line up. */
|
|
524
|
+
formId: string;
|
|
525
|
+
kind: K;
|
|
526
|
+
fields: LeadFormFields<C, K>;
|
|
527
|
+
/** Questions with no registry role yet: shown beside the contract, never texted. */
|
|
528
|
+
extra?: LeadFormExtraField[];
|
|
529
|
+
action?: string | null;
|
|
530
|
+
}
|
|
531
|
+
/** Anything that can send a `form_submit`: `useTracking()` with `form_submit` registered. */
|
|
532
|
+
interface LeadFormTracking {
|
|
533
|
+
trackEvent(eventType: "form_submit", metadata: FormSubmitMetadata): void;
|
|
534
|
+
}
|
|
535
|
+
interface LeadFormSubmitOptions {
|
|
536
|
+
/** Defaults to the tracking client's `createTracking({ debug })`. Throws on a violation. */
|
|
537
|
+
debug?: boolean;
|
|
538
|
+
/** Defaults to the tracking client's; `development` logs every violation. */
|
|
539
|
+
environment?: TrackingEnvironment;
|
|
540
|
+
/** Defaults to the tracking client's; validation and the hash use its live contracts. */
|
|
541
|
+
trackingConfig?: TrackingConfigReference;
|
|
542
|
+
}
|
|
543
|
+
interface LeadFormSubmitter<C extends LeadFormContracts> {
|
|
544
|
+
/** Send one typed `form_submit`; returns the metadata sent, violations included. */
|
|
545
|
+
submit<K extends LeadFormKind>(input: LeadFormSubmitInput<C, K>): FormSubmitMetadata;
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* Bind a tracking client to the site's generated contracts (`ARANOVA_LEAD_FORMS`).
|
|
549
|
+
*
|
|
550
|
+
* @example
|
|
551
|
+
* ```ts
|
|
552
|
+
* const leadForms = createLeadFormSubmit(useTracking(), ARANOVA_LEAD_FORMS);
|
|
553
|
+
* leadForms.submit({ formId: "booking-form", kind: "booking", fields: { given_name, phone } });
|
|
554
|
+
* ```
|
|
555
|
+
*/
|
|
556
|
+
declare function createLeadFormSubmit<C extends LeadFormContracts>(tracking: LeadFormTracking, contracts: C, options?: LeadFormSubmitOptions): LeadFormSubmitter<C>;
|
|
557
|
+
/**
|
|
558
|
+
* A picked slot as `preferred_date` + `preferred_time`, in the business's wall time.
|
|
559
|
+
* Takes `YYYY-MM-DD[T ]HH:MM` with no offset; a `Z`/`±HH:MM` instant or a `Date` would be re-zoned.
|
|
560
|
+
*/
|
|
561
|
+
declare function slotFields(dateTime: string): {
|
|
562
|
+
preferred_date: string;
|
|
563
|
+
preferred_time: LeadFormTimeWindow;
|
|
564
|
+
};
|
|
565
|
+
/** A `time_window` value: `timeWindow("09:00", "12:00", "Morning")`; an exact time has no end. */
|
|
566
|
+
declare function timeWindow(start: string, end?: string | null, label?: string): LeadFormTimeWindow;
|
|
567
|
+
|
|
311
568
|
/** A UUID v4 from Web Crypto, with a `getRandomValues` (then `Math.random`) fallback. */
|
|
312
569
|
declare function uuidV4(): string;
|
|
313
570
|
|
|
@@ -369,15 +626,11 @@ interface BookingInput {
|
|
|
369
626
|
/** Mobile number; the shop texts its confirmation to it. */
|
|
370
627
|
phone: string;
|
|
371
628
|
email?: string | null;
|
|
372
|
-
vehicle?:
|
|
373
|
-
year: number;
|
|
374
|
-
make: string;
|
|
375
|
-
model: string;
|
|
376
|
-
} | null;
|
|
629
|
+
vehicle?: BookingVehicle | null;
|
|
377
630
|
/** Ask only when the rules list drop-off options. */
|
|
378
631
|
dropOff?: BookingDropOff | null;
|
|
379
632
|
/** Option keys from `useBookingIntegration(...).options`. */
|
|
380
|
-
services: string[];
|
|
633
|
+
services: readonly string[];
|
|
381
634
|
notes?: string | null;
|
|
382
635
|
/**
|
|
383
636
|
* The customer's own opt-in to marketing texts. Never default it on (CASL). Service texts
|
|
@@ -385,6 +638,26 @@ interface BookingInput {
|
|
|
385
638
|
*/
|
|
386
639
|
marketingSmsConsent?: boolean;
|
|
387
640
|
}
|
|
641
|
+
interface BookingVehicle {
|
|
642
|
+
year: number;
|
|
643
|
+
make: string;
|
|
644
|
+
model: string;
|
|
645
|
+
}
|
|
646
|
+
type BookingFields<C extends LeadFormContracts> = LeadFormFields<C, "booking">;
|
|
647
|
+
type Asked<C extends LeadFormContracts, R extends string, P extends string, V> = R extends LeadFormRequiredRole<C, "booking"> ? {
|
|
648
|
+
[K in P]: V;
|
|
649
|
+
} : {
|
|
650
|
+
[K in P]?: V | null;
|
|
651
|
+
};
|
|
652
|
+
/** A service key the site's generated `booking` contract names, or one the live config offered. */
|
|
653
|
+
type BookingServiceKey<C extends LeadFormContracts> = NonNullable<BookingFields<C>["service"]>[number] | BookingOptionKey;
|
|
654
|
+
/**
|
|
655
|
+
* `BookingInput` typed by the site's generated contract (`ARANOVA_LEAD_FORMS`): the drop-off,
|
|
656
|
+
* vehicle and email the shop's rules require are required here, and services are its keys.
|
|
657
|
+
*/
|
|
658
|
+
type BookingInputFor<C extends LeadFormContracts> = Omit<BookingInput, "services" | "dropOff" | "vehicle" | "email"> & {
|
|
659
|
+
services: readonly BookingServiceKey<C>[];
|
|
660
|
+
} & Asked<C, "drop_off", "dropOff", BookingDropOff> & Asked<C, "vehicle", "vehicle", BookingVehicle> & Asked<C, "email", "email", string>;
|
|
388
661
|
/** The form's `form_submit`, sent once per booking attempt and tied to this visit. */
|
|
389
662
|
interface BookingFormSubmit {
|
|
390
663
|
/** The site's tracking client (`useTracking()`): the booking takes the visit it reports. */
|
|
@@ -400,6 +673,8 @@ interface BookingFormSubmit {
|
|
|
400
673
|
* reports (`phone`, `email`, ...) is dropped, so lead matching cannot be overridden.
|
|
401
674
|
*/
|
|
402
675
|
extraFields?: FormSubmitField[];
|
|
676
|
+
/** The site's generated `ARANOVA_LEAD_FORMS`: judged before the config loads, and drift flagged. */
|
|
677
|
+
contracts?: LeadFormContracts;
|
|
403
678
|
}
|
|
404
679
|
/** One field of a `form_submit`. */
|
|
405
680
|
type FormSubmitField = NonNullable<FormSubmitMetadata["form"]["fields"]>[number];
|
|
@@ -473,4 +748,4 @@ interface SalesBookingsClient {
|
|
|
473
748
|
/** A fresh per-submit key. Keep it for retries of the same submit; mint a new one after. */
|
|
474
749
|
declare const newBookingAttemptKey: typeof uuidV4;
|
|
475
750
|
|
|
476
|
-
export { type
|
|
751
|
+
export { type LeadFormKindDecl as A, type BookableDay as B, type ConversionConfig as C, type LeadFormRequirementDecl as D, type LeadFormSubmitInput as E, type FormSubmitField as F, type LeadFormSubmitOptions as G, type LeadFormSubmitter as H, type LeadFormTimeWindow as I, type LeadFormTracking as J, type LeadFormValue as K, type LeadFormAddress as L, bookableSlots as M, buildBookingHandoffUrl as N, getBookingIntegration as O, getTrackingConfigRuntime as P, groupBookingOptions as Q, newBookingAttemptKey as R, type SalesBookingsClient as S, type TrackingConfigReference as T, resolveConversionConfig as U, resolveTrackingConfigUrl as V, shopToday as W, slotFields as X, timeWindow as Y, createLeadFormSubmit as Z, TrackingConfigRuntime as _, type BookingDetailsFailure as a, type BookingDetailsInput as b, type BookingDetailsOptions as c, type BookingDetailsOutcome as d, type BookingDetailsStatus as e, type BookingDropOff as f, type BookingFormSubmit as g, type BookingHandoffPrefill as h, type BookingInput as i, type BookingInputFor as j, type BookingIntegration as k, type BookingMode as l, type BookingOption as m, type BookingOptionGroup as n, type BookingOptionKey as o, type BookingOutcome as p, type BookingProvider as q, type BookingRules as r, type BookingServiceKey as s, type BookingSimulation as t, type BookingSubmitOptions as u, type BookingVehicle as v, type ConversionConfigStore as w, type LeadFormContracts as x, type LeadFormExtraField as y, type LeadFormFields as z };
|
package/dist/client.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, CSSProperties, InputHTMLAttributes, ChangeEvent, FocusEvent, AnchorHTMLAttributes } from 'react';
|
|
3
|
-
import { G as GtagEnvironmentMap, M as MetaPixelEnvironmentMap, h as ConsentState, f as ConsentChoiceState, g as ConsentSource, T as TrackingParams, b as TrackingEnvironment,
|
|
4
|
-
import { T as TrackingConfigReference, C as ConversionConfig,
|
|
5
|
-
|
|
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';
|
|
6
|
+
import { L as TriggerRegistryConfig, O as TypedTrackingClient } from './ingest-typed-BO6Arbw-.mjs';
|
|
6
7
|
import { CountryCode } from 'libphonenumber-js';
|
|
7
|
-
import './form-submit-CX-CxJjQ.mjs';
|
|
8
8
|
import 'zod/mini';
|
|
9
9
|
import 'zod/v4/core';
|
|
10
10
|
|
|
@@ -407,11 +407,11 @@ interface BookedAttempt {
|
|
|
407
407
|
bookingId: string;
|
|
408
408
|
attemptKey: string;
|
|
409
409
|
}
|
|
410
|
-
interface BookingSubmitState {
|
|
410
|
+
interface BookingSubmitState<I = BookingInput> {
|
|
411
411
|
status: BookingSubmitStatus;
|
|
412
412
|
outcome: BookingOutcome | null;
|
|
413
413
|
/** Send the booking. A retry of an unanswered or refused submit reuses its attempt key. */
|
|
414
|
-
submit(input:
|
|
414
|
+
submit(input: I): Promise<BookingOutcome>;
|
|
415
415
|
/**
|
|
416
416
|
* The recorded booking and the key it was sent with; persist it (e.g. `sessionStorage`) to add
|
|
417
417
|
* details after a reload. Null until the server has the booking.
|
|
@@ -430,11 +430,13 @@ interface BookingSubmitState {
|
|
|
430
430
|
* get wrong: one attempt key per submit (a double-click never books twice), the visit's
|
|
431
431
|
* `form_submit`, the stale-config refetch, and the fallback link on failure. A `pending` answer
|
|
432
432
|
* shows at once (`status: "pending"`) while the final one is polled; the submit stays in flight.
|
|
433
|
+
* Pass the site's `ARANOVA_LEAD_FORMS` as `contracts` to type the input by the shop's rules.
|
|
433
434
|
*/
|
|
434
|
-
declare function useBookingSubmit(bookings: SalesBookingsClient, options?: {
|
|
435
|
+
declare function useBookingSubmit<C extends LeadFormContracts | undefined = undefined>(bookings: SalesBookingsClient, options?: {
|
|
435
436
|
formSubmit?: BookingFormSubmit;
|
|
436
437
|
/** Development only: a simulated create's outcome. The production API ignores it. */
|
|
437
438
|
simulate?: BookingSimulation;
|
|
438
|
-
|
|
439
|
+
contracts?: C;
|
|
440
|
+
}): BookingSubmitState<C extends LeadFormContracts ? BookingInputFor<C> : BookingInput>;
|
|
439
441
|
|
|
440
442
|
export { AdPlatformTracking, type AdPlatformTrackingProps, type BookedAttempt, BookingHandoffLink, type BookingHandoffLinkProps, type BookingHandoffOptions, type BookingSubmitState, type BookingSubmitStatus, ConsentBanner, type ConsentBannerProps, type CreateTrackingOptions, type CreateTrackingResult, GoogleAdsTracking, type GoogleAdsTrackingProps, PhoneField, type PhoneFieldApi, type PhoneFieldProps, type PhoneInputProps, type TrackingProviderProps, type UseConsentResult, type UseCookiePreferencesOptions, type UseCookiePreferencesResult, type UsePhoneFieldOptions, createTracking, useBookingHandoffUrl, useBookingIntegration, useBookingSlots, useBookingSubmit, useConsent, useConsentState, useCookiePreferences, useGclid, usePhoneConfig, usePhoneField, useTrackingParams };
|
package/dist/client.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, CSSProperties, InputHTMLAttributes, ChangeEvent, FocusEvent, AnchorHTMLAttributes } from 'react';
|
|
3
|
-
import { G as GtagEnvironmentMap, M as MetaPixelEnvironmentMap, h as ConsentState, f as ConsentChoiceState, g as ConsentSource, T as TrackingParams, b as TrackingEnvironment,
|
|
4
|
-
import { T as TrackingConfigReference, C as ConversionConfig,
|
|
5
|
-
|
|
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';
|
|
6
|
+
import { L as TriggerRegistryConfig, O as TypedTrackingClient } from './ingest-typed-D7I4aQ7p.js';
|
|
6
7
|
import { CountryCode } from 'libphonenumber-js';
|
|
7
|
-
import './form-submit-CX-CxJjQ.js';
|
|
8
8
|
import 'zod/mini';
|
|
9
9
|
import 'zod/v4/core';
|
|
10
10
|
|
|
@@ -407,11 +407,11 @@ interface BookedAttempt {
|
|
|
407
407
|
bookingId: string;
|
|
408
408
|
attemptKey: string;
|
|
409
409
|
}
|
|
410
|
-
interface BookingSubmitState {
|
|
410
|
+
interface BookingSubmitState<I = BookingInput> {
|
|
411
411
|
status: BookingSubmitStatus;
|
|
412
412
|
outcome: BookingOutcome | null;
|
|
413
413
|
/** Send the booking. A retry of an unanswered or refused submit reuses its attempt key. */
|
|
414
|
-
submit(input:
|
|
414
|
+
submit(input: I): Promise<BookingOutcome>;
|
|
415
415
|
/**
|
|
416
416
|
* The recorded booking and the key it was sent with; persist it (e.g. `sessionStorage`) to add
|
|
417
417
|
* details after a reload. Null until the server has the booking.
|
|
@@ -430,11 +430,13 @@ interface BookingSubmitState {
|
|
|
430
430
|
* get wrong: one attempt key per submit (a double-click never books twice), the visit's
|
|
431
431
|
* `form_submit`, the stale-config refetch, and the fallback link on failure. A `pending` answer
|
|
432
432
|
* shows at once (`status: "pending"`) while the final one is polled; the submit stays in flight.
|
|
433
|
+
* Pass the site's `ARANOVA_LEAD_FORMS` as `contracts` to type the input by the shop's rules.
|
|
433
434
|
*/
|
|
434
|
-
declare function useBookingSubmit(bookings: SalesBookingsClient, options?: {
|
|
435
|
+
declare function useBookingSubmit<C extends LeadFormContracts | undefined = undefined>(bookings: SalesBookingsClient, options?: {
|
|
435
436
|
formSubmit?: BookingFormSubmit;
|
|
436
437
|
/** Development only: a simulated create's outcome. The production API ignores it. */
|
|
437
438
|
simulate?: BookingSimulation;
|
|
438
|
-
|
|
439
|
+
contracts?: C;
|
|
440
|
+
}): BookingSubmitState<C extends LeadFormContracts ? BookingInputFor<C> : BookingInput>;
|
|
439
441
|
|
|
440
442
|
export { AdPlatformTracking, type AdPlatformTrackingProps, type BookedAttempt, BookingHandoffLink, type BookingHandoffLinkProps, type BookingHandoffOptions, type BookingSubmitState, type BookingSubmitStatus, ConsentBanner, type ConsentBannerProps, type CreateTrackingOptions, type CreateTrackingResult, GoogleAdsTracking, type GoogleAdsTrackingProps, PhoneField, type PhoneFieldApi, type PhoneFieldProps, type PhoneInputProps, type TrackingProviderProps, type UseConsentResult, type UseCookiePreferencesOptions, type UseCookiePreferencesResult, type UsePhoneFieldOptions, createTracking, useBookingHandoffUrl, useBookingIntegration, useBookingSlots, useBookingSubmit, useConsent, useConsentState, useCookiePreferences, useGclid, usePhoneConfig, usePhoneField, useTrackingParams };
|