@aranova/tracking-react 1.4.1 → 1.6.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/README.md +16 -3
- package/dist/{bookings-DIu1ho6v.d.ts → bookings-B50X7GSG.d.ts} +20 -1
- package/dist/{bookings-CqCuuyP6.d.mts → bookings-n8UUzrak.d.mts} +20 -1
- package/dist/client.d.mts +4 -3
- package/dist/client.d.ts +4 -3
- package/dist/client.js +25 -4
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +25 -4
- package/dist/client.mjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +55 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -37
- package/dist/index.mjs.map +1 -1
- package/dist/{ingest-typed-D7UZr0EM.d.mts → ingest-typed-ABH28Ips.d.mts} +16 -2
- package/dist/{ingest-typed-D2S3Kb8m.d.ts → ingest-typed-vP-DqpxO.d.ts} +16 -2
- package/dist/{sales-hlcVTJSS.d.ts → sales-D4QRnpdz.d.ts} +1 -1
- package/dist/{sales-CxJVthx_.d.mts → sales-DByfvgzT.d.mts} +1 -1
- package/dist/sales.d.mts +2 -2
- package/dist/sales.d.ts +2 -2
- package/dist/sales.js +36 -36
- package/dist/sales.js.map +1 -1
- package/dist/sales.mjs +36 -36
- package/dist/sales.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { AdPlatformTracking, AdPlatformTrackingProps, BookingHandoffLink, BookingHandoffLinkProps, BookingHandoffOptions, BookingSubmitState, BookingSubmitStatus, ConsentBanner, ConsentBannerProps, CreateTrackingOptions, CreateTrackingResult, GoogleAdsTracking, GoogleAdsTrackingProps, PhoneField, PhoneFieldApi, PhoneFieldProps, PhoneInputProps, TrackingProviderProps, UseConsentResult, UseCookiePreferencesOptions, UseCookiePreferencesResult, UsePhoneFieldOptions, createTracking, useBookingHandoffUrl, useBookingIntegration, useBookingSlots, useBookingSubmit, useConsent, useConsentState, useCookiePreferences, useGclid, usePhoneConfig, usePhoneField, useTrackingParams } from '@aranova/tracking-react/client';
|
|
2
2
|
import { T as TrackingParams, a as TrackingInstallSurface, b as TrackingEnvironment, c as TrackingClientContext, d as TrackingEventCreatePayload, e as TrackingSessionUpsertPayload } from './phone-utils-CM8eUPz8.mjs';
|
|
3
3
|
export { C as ConsentChoice, f as ConsentChoiceState, g as ConsentSource, h as ConsentState, D as DEFAULT_DECLINE_TTL_DAYS, i as DEFAULT_PHONE_COUNTRY, G as GtagEnvironmentMap, M as MetaPixelEnvironmentMap, P as ParsedPhone, j as PhoneConfig, k as PhoneDisplayFormat, S as SetConsentOptions, l as TrackedField, m as TrackingInitConfig, n as formatPhone, o as formatPhoneAsTyped, p as getConsentChoice, q as getConsentState, r as onConsentChange, s as optIn, t as optOut, u as parsePhone, v as phoneField, w as resetConsent, x as setConsentState, y as toE164 } from './phone-utils-CM8eUPz8.mjs';
|
|
4
|
-
export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, C as CompareTo, c as ConversionUserData, d as CurrencyRevenue, e as CustomerCurrencyDelta, f as CustomerCurrencyTotal, g as CustomerGetOptions, h as CustomerGetResult, i as CustomerKpis, j as CustomerKpisDeltas, k as CustomerKpisPrevious, l as CustomerListPage, m as CustomerListQuery, n as CustomerProfile, o as CustomerSegment, p as CustomerSegmentCount, q as CustomerSortField, r as CustomerSummary, s as CustomerSummaryQuery, D as DistinctCustomersByCurrency, E as EffectiveSaleProperty, G as Granularity, N as NAMED_RANGES, t as NamedRange, P as PublicServiceItem, S as SALE_SOURCES, u as SUPPORTED_CURRENCIES, v as Sale, w as SaleBuiltinRequirableField, x as SaleCursorPage, y as SaleFilters, z as SaleInput, F as SaleItem, H as SaleItemInput, I as SaleKeysetSortField, J as SaleListPage, K as SaleListQuery, L as SaleListQueryV2, M as SalePropertyOption, O as SalePropertyType, Q as SaleService, R as SaleServiceInput, T as SaleSortField, U as SaleSortOrder, V as SaleSource, W as SaleSourceFacts, X as SaleSummary, Y as SaleSummaryPrevious, Z as SaleSummaryQuery, _ as SaleSummaryQueryV2, $ as SaleSummaryV2, a0 as SaleUpdateInput, a1 as SalesBusinessClient, a2 as SalesCategoryBreakdown, a3 as SalesClient, a4 as SalesClientConfig, a5 as SalesCustomersClient, a6 as SalesServiceBreakdown, a7 as SalesTransportConfig, a8 as SalesTrendPoint, a9 as SummaryCurrencyDelta, aa as SummaryDeltas, ab as SummaryWindow, ac as SupportedCurrency, ad as TRACKING_RANGES, ae as TrackingOverviewRange, af as clearStashedUserData, ag as createSalesClient, ah as currencySchema, ai as fetchServices, aj as formatDateInTz, ak as formatMoney, al as fromMinor, am as saleCreateSchema, an as saleItemSchema, ao as saleServiceSchema, ap as saleUpdateSchema, aq as salesRequest, ar as stashUserData, as as toMinor } from './sales-
|
|
5
|
-
export { B as BookingDropOff, a as BookingFormSubmit, b as BookingInput, c as BookingMode, d as BookingOutcome, e as BookingSimulation, f as BookingSubmitOptions, C as ConversionConfig, g as ConversionConfigStore, S as SalesBookingsClient, T as TrackingConfigReference, h as getTrackingConfigRuntime, n as newBookingAttemptKey, r as resolveConversionConfig, i as resolveTrackingConfigUrl } from './bookings-
|
|
6
|
-
export { A as AutomaticEventName, B as BookableDay, a as BookingHandoffPrefill, b as BookingIntegration, c as BookingOption, d as
|
|
4
|
+
export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, C as CompareTo, c as ConversionUserData, d as CurrencyRevenue, e as CustomerCurrencyDelta, f as CustomerCurrencyTotal, g as CustomerGetOptions, h as CustomerGetResult, i as CustomerKpis, j as CustomerKpisDeltas, k as CustomerKpisPrevious, l as CustomerListPage, m as CustomerListQuery, n as CustomerProfile, o as CustomerSegment, p as CustomerSegmentCount, q as CustomerSortField, r as CustomerSummary, s as CustomerSummaryQuery, D as DistinctCustomersByCurrency, E as EffectiveSaleProperty, G as Granularity, N as NAMED_RANGES, t as NamedRange, P as PublicServiceItem, S as SALE_SOURCES, u as SUPPORTED_CURRENCIES, v as Sale, w as SaleBuiltinRequirableField, x as SaleCursorPage, y as SaleFilters, z as SaleInput, F as SaleItem, H as SaleItemInput, I as SaleKeysetSortField, J as SaleListPage, K as SaleListQuery, L as SaleListQueryV2, M as SalePropertyOption, O as SalePropertyType, Q as SaleService, R as SaleServiceInput, T as SaleSortField, U as SaleSortOrder, V as SaleSource, W as SaleSourceFacts, X as SaleSummary, Y as SaleSummaryPrevious, Z as SaleSummaryQuery, _ as SaleSummaryQueryV2, $ as SaleSummaryV2, a0 as SaleUpdateInput, a1 as SalesBusinessClient, a2 as SalesCategoryBreakdown, a3 as SalesClient, a4 as SalesClientConfig, a5 as SalesCustomersClient, a6 as SalesServiceBreakdown, a7 as SalesTransportConfig, a8 as SalesTrendPoint, a9 as SummaryCurrencyDelta, aa as SummaryDeltas, ab as SummaryWindow, ac as SupportedCurrency, ad as TRACKING_RANGES, ae as TrackingOverviewRange, af as clearStashedUserData, ag as createSalesClient, ah as currencySchema, ai as fetchServices, aj as formatDateInTz, ak as formatMoney, al as fromMinor, am as saleCreateSchema, an as saleItemSchema, ao as saleServiceSchema, ap as saleUpdateSchema, aq as salesRequest, ar as stashUserData, as as toMinor } from './sales-DByfvgzT.mjs';
|
|
5
|
+
export { B as BookingDropOff, a as BookingFormSubmit, b as BookingInput, c as BookingMode, d as BookingOutcome, e as BookingSimulation, f as BookingSubmitOptions, C as ConversionConfig, g as ConversionConfigStore, F as FormSubmitField, S as SalesBookingsClient, T as TrackingConfigReference, h as getTrackingConfigRuntime, n as newBookingAttemptKey, r as resolveConversionConfig, i as resolveTrackingConfigUrl } from './bookings-n8UUzrak.mjs';
|
|
6
|
+
export { A as AutomaticEventName, B as BookableDay, a as BookingHandoffPrefill, b as BookingIntegration, c as BookingOption, d as BookingOptionGroup, e as BookingProvider, f as BookingRules, C as CtaClickConfig, g as CtaClickMetadata, E as EVENT_SEMANTICS, h as EventCategory, i as EventClientVisibility, j as EventConfig, k as EventKind, l as EventMetadata, m as EventName, n as EventOutcomeRole, o as EventSemantics, F as FormStartConfig, p as FormStartMetadata, q as FormStepConfig, r as FormStepMetadata, M as ManualEventName, s as MultiPageSessionConfig, t as MultiPageSessionMetadata, P as PageExitConfig, u as PageExitMetadata, v as PageIdentity, w as PageViewConfig, x as PageViewMetadata, y as PhoneClickConfig, z as PhoneClickMetadata, R as RegisteredAutomaticEvents, D as RegisteredManualEvents, S as ScrollDepthConfig, G as ScrollDepthMetadata, H as SdkHeartbeatConfig, I as SdkHeartbeatMetadata, J as SiteLinkArrivalConfig, K as SiteLinkArrivalMetadata, L as SiteLinkClickConfig, N as SiteLinkClickMetadata, O as SpecificPageName, Q as SpecificPageVisitConfig, T as SpecificPageVisitMetadata, U as TimeOnSiteConfig, V as TimeOnSiteMetadata, W as TrackableEvent, X as TriggerRegistryConfig, Y as TypedTrackEventOptions, Z as TypedTrackingClient, _ as bookableSlots, $ as buildBookingHandoffUrl, a0 as getBookingIntegration, a1 as getEventSemantics, a2 as groupBookingOptions, a3 as shopToday } from './ingest-typed-ABH28Ips.mjs';
|
|
7
7
|
export { F as FormSubmitConfig, a as FormSubmitMetadata, J as JsonValue } from './form-submit-BLb28aCk.mjs';
|
|
8
8
|
export { CountryCode } from 'libphonenumber-js';
|
|
9
9
|
import 'zod/mini';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { AdPlatformTracking, AdPlatformTrackingProps, BookingHandoffLink, BookingHandoffLinkProps, BookingHandoffOptions, BookingSubmitState, BookingSubmitStatus, ConsentBanner, ConsentBannerProps, CreateTrackingOptions, CreateTrackingResult, GoogleAdsTracking, GoogleAdsTrackingProps, PhoneField, PhoneFieldApi, PhoneFieldProps, PhoneInputProps, TrackingProviderProps, UseConsentResult, UseCookiePreferencesOptions, UseCookiePreferencesResult, UsePhoneFieldOptions, createTracking, useBookingHandoffUrl, useBookingIntegration, useBookingSlots, useBookingSubmit, useConsent, useConsentState, useCookiePreferences, useGclid, usePhoneConfig, usePhoneField, useTrackingParams } from '@aranova/tracking-react/client';
|
|
2
2
|
import { T as TrackingParams, a as TrackingInstallSurface, b as TrackingEnvironment, c as TrackingClientContext, d as TrackingEventCreatePayload, e as TrackingSessionUpsertPayload } from './phone-utils-l8ey3Zdm.js';
|
|
3
3
|
export { C as ConsentChoice, f as ConsentChoiceState, g as ConsentSource, h as ConsentState, D as DEFAULT_DECLINE_TTL_DAYS, i as DEFAULT_PHONE_COUNTRY, G as GtagEnvironmentMap, M as MetaPixelEnvironmentMap, P as ParsedPhone, j as PhoneConfig, k as PhoneDisplayFormat, S as SetConsentOptions, l as TrackedField, m as TrackingInitConfig, n as formatPhone, o as formatPhoneAsTyped, p as getConsentChoice, q as getConsentState, r as onConsentChange, s as optIn, t as optOut, u as parsePhone, v as phoneField, w as resetConsent, x as setConsentState, y as toE164 } from './phone-utils-l8ey3Zdm.js';
|
|
4
|
-
export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, C as CompareTo, c as ConversionUserData, d as CurrencyRevenue, e as CustomerCurrencyDelta, f as CustomerCurrencyTotal, g as CustomerGetOptions, h as CustomerGetResult, i as CustomerKpis, j as CustomerKpisDeltas, k as CustomerKpisPrevious, l as CustomerListPage, m as CustomerListQuery, n as CustomerProfile, o as CustomerSegment, p as CustomerSegmentCount, q as CustomerSortField, r as CustomerSummary, s as CustomerSummaryQuery, D as DistinctCustomersByCurrency, E as EffectiveSaleProperty, G as Granularity, N as NAMED_RANGES, t as NamedRange, P as PublicServiceItem, S as SALE_SOURCES, u as SUPPORTED_CURRENCIES, v as Sale, w as SaleBuiltinRequirableField, x as SaleCursorPage, y as SaleFilters, z as SaleInput, F as SaleItem, H as SaleItemInput, I as SaleKeysetSortField, J as SaleListPage, K as SaleListQuery, L as SaleListQueryV2, M as SalePropertyOption, O as SalePropertyType, Q as SaleService, R as SaleServiceInput, T as SaleSortField, U as SaleSortOrder, V as SaleSource, W as SaleSourceFacts, X as SaleSummary, Y as SaleSummaryPrevious, Z as SaleSummaryQuery, _ as SaleSummaryQueryV2, $ as SaleSummaryV2, a0 as SaleUpdateInput, a1 as SalesBusinessClient, a2 as SalesCategoryBreakdown, a3 as SalesClient, a4 as SalesClientConfig, a5 as SalesCustomersClient, a6 as SalesServiceBreakdown, a7 as SalesTransportConfig, a8 as SalesTrendPoint, a9 as SummaryCurrencyDelta, aa as SummaryDeltas, ab as SummaryWindow, ac as SupportedCurrency, ad as TRACKING_RANGES, ae as TrackingOverviewRange, af as clearStashedUserData, ag as createSalesClient, ah as currencySchema, ai as fetchServices, aj as formatDateInTz, ak as formatMoney, al as fromMinor, am as saleCreateSchema, an as saleItemSchema, ao as saleServiceSchema, ap as saleUpdateSchema, aq as salesRequest, ar as stashUserData, as as toMinor } from './sales-
|
|
5
|
-
export { B as BookingDropOff, a as BookingFormSubmit, b as BookingInput, c as BookingMode, d as BookingOutcome, e as BookingSimulation, f as BookingSubmitOptions, C as ConversionConfig, g as ConversionConfigStore, S as SalesBookingsClient, T as TrackingConfigReference, h as getTrackingConfigRuntime, n as newBookingAttemptKey, r as resolveConversionConfig, i as resolveTrackingConfigUrl } from './bookings-
|
|
6
|
-
export { A as AutomaticEventName, B as BookableDay, a as BookingHandoffPrefill, b as BookingIntegration, c as BookingOption, d as
|
|
4
|
+
export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, C as CompareTo, c as ConversionUserData, d as CurrencyRevenue, e as CustomerCurrencyDelta, f as CustomerCurrencyTotal, g as CustomerGetOptions, h as CustomerGetResult, i as CustomerKpis, j as CustomerKpisDeltas, k as CustomerKpisPrevious, l as CustomerListPage, m as CustomerListQuery, n as CustomerProfile, o as CustomerSegment, p as CustomerSegmentCount, q as CustomerSortField, r as CustomerSummary, s as CustomerSummaryQuery, D as DistinctCustomersByCurrency, E as EffectiveSaleProperty, G as Granularity, N as NAMED_RANGES, t as NamedRange, P as PublicServiceItem, S as SALE_SOURCES, u as SUPPORTED_CURRENCIES, v as Sale, w as SaleBuiltinRequirableField, x as SaleCursorPage, y as SaleFilters, z as SaleInput, F as SaleItem, H as SaleItemInput, I as SaleKeysetSortField, J as SaleListPage, K as SaleListQuery, L as SaleListQueryV2, M as SalePropertyOption, O as SalePropertyType, Q as SaleService, R as SaleServiceInput, T as SaleSortField, U as SaleSortOrder, V as SaleSource, W as SaleSourceFacts, X as SaleSummary, Y as SaleSummaryPrevious, Z as SaleSummaryQuery, _ as SaleSummaryQueryV2, $ as SaleSummaryV2, a0 as SaleUpdateInput, a1 as SalesBusinessClient, a2 as SalesCategoryBreakdown, a3 as SalesClient, a4 as SalesClientConfig, a5 as SalesCustomersClient, a6 as SalesServiceBreakdown, a7 as SalesTransportConfig, a8 as SalesTrendPoint, a9 as SummaryCurrencyDelta, aa as SummaryDeltas, ab as SummaryWindow, ac as SupportedCurrency, ad as TRACKING_RANGES, ae as TrackingOverviewRange, af as clearStashedUserData, ag as createSalesClient, ah as currencySchema, ai as fetchServices, aj as formatDateInTz, ak as formatMoney, al as fromMinor, am as saleCreateSchema, an as saleItemSchema, ao as saleServiceSchema, ap as saleUpdateSchema, aq as salesRequest, ar as stashUserData, as as toMinor } from './sales-D4QRnpdz.js';
|
|
5
|
+
export { B as BookingDropOff, a as BookingFormSubmit, b as BookingInput, c as BookingMode, d as BookingOutcome, e as BookingSimulation, f as BookingSubmitOptions, C as ConversionConfig, g as ConversionConfigStore, F as FormSubmitField, S as SalesBookingsClient, T as TrackingConfigReference, h as getTrackingConfigRuntime, n as newBookingAttemptKey, r as resolveConversionConfig, i as resolveTrackingConfigUrl } from './bookings-B50X7GSG.js';
|
|
6
|
+
export { A as AutomaticEventName, B as BookableDay, a as BookingHandoffPrefill, b as BookingIntegration, c as BookingOption, d as BookingOptionGroup, e as BookingProvider, f as BookingRules, C as CtaClickConfig, g as CtaClickMetadata, E as EVENT_SEMANTICS, h as EventCategory, i as EventClientVisibility, j as EventConfig, k as EventKind, l as EventMetadata, m as EventName, n as EventOutcomeRole, o as EventSemantics, F as FormStartConfig, p as FormStartMetadata, q as FormStepConfig, r as FormStepMetadata, M as ManualEventName, s as MultiPageSessionConfig, t as MultiPageSessionMetadata, P as PageExitConfig, u as PageExitMetadata, v as PageIdentity, w as PageViewConfig, x as PageViewMetadata, y as PhoneClickConfig, z as PhoneClickMetadata, R as RegisteredAutomaticEvents, D as RegisteredManualEvents, S as ScrollDepthConfig, G as ScrollDepthMetadata, H as SdkHeartbeatConfig, I as SdkHeartbeatMetadata, J as SiteLinkArrivalConfig, K as SiteLinkArrivalMetadata, L as SiteLinkClickConfig, N as SiteLinkClickMetadata, O as SpecificPageName, Q as SpecificPageVisitConfig, T as SpecificPageVisitMetadata, U as TimeOnSiteConfig, V as TimeOnSiteMetadata, W as TrackableEvent, X as TriggerRegistryConfig, Y as TypedTrackEventOptions, Z as TypedTrackingClient, _ as bookableSlots, $ as buildBookingHandoffUrl, a0 as getBookingIntegration, a1 as getEventSemantics, a2 as groupBookingOptions, a3 as shopToday } from './ingest-typed-vP-DqpxO.js';
|
|
7
7
|
export { F as FormSubmitConfig, a as FormSubmitMetadata, J as JsonValue } from './form-submit-BLb28aCk.js';
|
|
8
8
|
export { CountryCode } from 'libphonenumber-js';
|
|
9
9
|
import 'zod/mini';
|
package/dist/index.js
CHANGED
|
@@ -65,6 +65,7 @@ __export(src_exports, {
|
|
|
65
65
|
getConsentState: () => getConsentState,
|
|
66
66
|
getEventSemantics: () => getEventSemantics,
|
|
67
67
|
getTrackingConfigRuntime: () => getTrackingConfigRuntime,
|
|
68
|
+
groupBookingOptions: () => groupBookingOptions,
|
|
68
69
|
newBookingAttemptKey: () => newBookingAttemptKey,
|
|
69
70
|
onConsentChange: () => onConsentChange,
|
|
70
71
|
optIn: () => optIn,
|
|
@@ -810,7 +811,14 @@ function parseBookingOption(value) {
|
|
|
810
811
|
if (!value || typeof value !== "object") return [];
|
|
811
812
|
const o = value;
|
|
812
813
|
if (typeof o.key !== "string" || !o.key || typeof o.label !== "string") return [];
|
|
813
|
-
return [
|
|
814
|
+
return [
|
|
815
|
+
{
|
|
816
|
+
key: o.key,
|
|
817
|
+
label: o.label,
|
|
818
|
+
group: typeof o.group === "string" && o.group ? o.group : null,
|
|
819
|
+
description: typeof o.description === "string" && o.description ? o.description : null
|
|
820
|
+
}
|
|
821
|
+
];
|
|
814
822
|
}
|
|
815
823
|
function parseIntegrations(value) {
|
|
816
824
|
if (!value || typeof value !== "object") return {};
|
|
@@ -1537,7 +1545,12 @@ function getBookingIntegration(integrations) {
|
|
|
1537
1545
|
timezone: booking.timezone,
|
|
1538
1546
|
configVersion: booking.config_version,
|
|
1539
1547
|
rules,
|
|
1540
|
-
options: booking.options.map((option) => ({
|
|
1548
|
+
options: booking.options.map((option) => ({
|
|
1549
|
+
key: option.key,
|
|
1550
|
+
label: option.label,
|
|
1551
|
+
group: option.group,
|
|
1552
|
+
description: option.description
|
|
1553
|
+
})),
|
|
1541
1554
|
mode: booking.mode ?? "live"
|
|
1542
1555
|
};
|
|
1543
1556
|
}
|
|
@@ -1617,6 +1630,15 @@ function nationalDigits(phone) {
|
|
|
1617
1630
|
const parsed = parsePhone(phone);
|
|
1618
1631
|
return (parsed.isValid ? parsed.national : phone).replace(/\D/g, "");
|
|
1619
1632
|
}
|
|
1633
|
+
function groupBookingOptions(options) {
|
|
1634
|
+
const groups = /* @__PURE__ */ new Map();
|
|
1635
|
+
for (const option of options) {
|
|
1636
|
+
const members = groups.get(option.group);
|
|
1637
|
+
if (members) members.push(option);
|
|
1638
|
+
else groups.set(option.group, [option]);
|
|
1639
|
+
}
|
|
1640
|
+
return [...groups].map(([group, members]) => ({ group, options: members }));
|
|
1641
|
+
}
|
|
1620
1642
|
|
|
1621
1643
|
// ../tracking-core/src/events/semantics.ts
|
|
1622
1644
|
var EVENT_SEMANTICS = {
|
|
@@ -1800,7 +1822,7 @@ function outcomeOf(body) {
|
|
|
1800
1822
|
if (body.status === "pending") return { status: "pending", id: body.id, mode };
|
|
1801
1823
|
return { status: "failed", id: body.id, fallbackUrl: body.fallback_url, mode };
|
|
1802
1824
|
}
|
|
1803
|
-
function formSubmitPayload(input,
|
|
1825
|
+
function formSubmitPayload(input, formSubmit, labels) {
|
|
1804
1826
|
const vehicle = input.vehicle ? `${input.vehicle.year} ${input.vehicle.make} ${input.vehicle.model}` : "";
|
|
1805
1827
|
const field = (name, type, label, value) => ({
|
|
1806
1828
|
name,
|
|
@@ -1808,32 +1830,31 @@ function formSubmitPayload(input, formId, labels) {
|
|
|
1808
1830
|
label,
|
|
1809
1831
|
value
|
|
1810
1832
|
});
|
|
1833
|
+
const fields = [
|
|
1834
|
+
field("first_name", "text", "First name", input.firstName),
|
|
1835
|
+
field("last_name", "text", "Last name", input.lastName),
|
|
1836
|
+
// E.164 on the wire: it keys the customer and enhanced-conversion matching.
|
|
1837
|
+
field("phone", "tel", "Phone", toE164(input.phone) ?? input.phone),
|
|
1838
|
+
field("email", "email", "Email", input.email ?? ""),
|
|
1839
|
+
field(
|
|
1840
|
+
"service",
|
|
1841
|
+
"select",
|
|
1842
|
+
"Service",
|
|
1843
|
+
input.services.map((key) => labels.get(key) ?? key).join(", ")
|
|
1844
|
+
),
|
|
1845
|
+
field("vehicle", "text", "Vehicle", vehicle),
|
|
1846
|
+
field(
|
|
1847
|
+
"start",
|
|
1848
|
+
"text",
|
|
1849
|
+
"Requested time",
|
|
1850
|
+
`${input.startDate} ${String(input.startHour).padStart(2, "0")}:00`
|
|
1851
|
+
),
|
|
1852
|
+
field("note", "textarea", "Notes", input.notes ?? "")
|
|
1853
|
+
];
|
|
1854
|
+
const reported = new Set(fields.map((item) => item.name));
|
|
1855
|
+
const extra = (formSubmit.extraFields ?? []).filter((item) => !reported.has(item.name));
|
|
1811
1856
|
return {
|
|
1812
|
-
form: {
|
|
1813
|
-
id: formId,
|
|
1814
|
-
action: "/tracking/bookings",
|
|
1815
|
-
fields: [
|
|
1816
|
-
field("first_name", "text", "First name", input.firstName),
|
|
1817
|
-
field("last_name", "text", "Last name", input.lastName),
|
|
1818
|
-
// E.164 on the wire: it keys the customer and enhanced-conversion matching.
|
|
1819
|
-
field("phone", "tel", "Phone", toE164(input.phone) ?? input.phone),
|
|
1820
|
-
field("email", "email", "Email", input.email ?? ""),
|
|
1821
|
-
field(
|
|
1822
|
-
"service",
|
|
1823
|
-
"select",
|
|
1824
|
-
"Service",
|
|
1825
|
-
input.services.map((key) => labels.get(key) ?? key).join(", ")
|
|
1826
|
-
),
|
|
1827
|
-
field("vehicle", "text", "Vehicle", vehicle),
|
|
1828
|
-
field(
|
|
1829
|
-
"start",
|
|
1830
|
-
"text",
|
|
1831
|
-
"Requested time",
|
|
1832
|
-
`${input.startDate} ${String(input.startHour).padStart(2, "0")}:00`
|
|
1833
|
-
),
|
|
1834
|
-
field("note", "textarea", "Notes", input.notes ?? "")
|
|
1835
|
-
]
|
|
1836
|
-
},
|
|
1857
|
+
form: { id: formSubmit.formId, action: "/tracking/bookings", fields: [...fields, ...extra] },
|
|
1837
1858
|
page: { path: typeof window === "undefined" ? "/" : window.location.pathname }
|
|
1838
1859
|
};
|
|
1839
1860
|
}
|
|
@@ -1921,7 +1942,7 @@ function createSalesBookingsClient(config, firing) {
|
|
|
1921
1942
|
return failedBeforeSend(input);
|
|
1922
1943
|
}
|
|
1923
1944
|
return {
|
|
1924
|
-
async submit(input, { attemptKey, formSubmit, simulate }) {
|
|
1945
|
+
async submit(input, { attemptKey, formSubmit, simulate, onPending }) {
|
|
1925
1946
|
registerCapability("booking_integration");
|
|
1926
1947
|
const runtime = runtimeOf(firing);
|
|
1927
1948
|
warnOnSetupMismatch(runtime);
|
|
@@ -1932,10 +1953,7 @@ function createSalesBookingsClient(config, firing) {
|
|
|
1932
1953
|
if (formSubmit && !submittedForms.has(attemptKey)) {
|
|
1933
1954
|
submittedForms.add(attemptKey);
|
|
1934
1955
|
const labels = new Map(booking.options.map((option) => [option.key, option.label]));
|
|
1935
|
-
formSubmit.tracking.trackEvent(
|
|
1936
|
-
"form_submit",
|
|
1937
|
-
formSubmitPayload(input, formSubmit.formId, labels)
|
|
1938
|
-
);
|
|
1956
|
+
formSubmit.tracking.trackEvent("form_submit", formSubmitPayload(input, formSubmit, labels));
|
|
1939
1957
|
}
|
|
1940
1958
|
const body = {
|
|
1941
1959
|
idempotency_key: attemptKey,
|
|
@@ -1969,10 +1987,9 @@ function createSalesBookingsClient(config, firing) {
|
|
|
1969
1987
|
return rejected(error, input, attemptKey, runtime);
|
|
1970
1988
|
}
|
|
1971
1989
|
const outcome = outcomeOf(response);
|
|
1972
|
-
return withHandoff(
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
);
|
|
1990
|
+
if (outcome.status !== "pending") return withHandoff(outcome, input);
|
|
1991
|
+
onPending?.(outcome);
|
|
1992
|
+
return withHandoff(await poll(outcome.id, outcome.mode), input);
|
|
1976
1993
|
},
|
|
1977
1994
|
async status(id) {
|
|
1978
1995
|
return outcomeOf(
|
|
@@ -2524,6 +2541,7 @@ var import_client3 = require("@aranova/tracking-react/client");
|
|
|
2524
2541
|
getConsentState,
|
|
2525
2542
|
getEventSemantics,
|
|
2526
2543
|
getTrackingConfigRuntime,
|
|
2544
|
+
groupBookingOptions,
|
|
2527
2545
|
newBookingAttemptKey,
|
|
2528
2546
|
onConsentChange,
|
|
2529
2547
|
optIn,
|