@aranova/tracking-react 1.3.0 → 1.4.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 +7 -0
- package/dist/{bookings-VsQdopTt.d.mts → bookings-CqCuuyP6.d.mts} +26 -5
- package/dist/{bookings-CqdjLMkv.d.ts → bookings-DIu1ho6v.d.ts} +26 -5
- package/dist/client.d.mts +4 -2
- package/dist/client.d.ts +4 -2
- package/dist/client.js +12 -6
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +12 -6
- 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 +58 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +58 -16
- package/dist/index.mjs.map +1 -1
- package/dist/{ingest-typed-DGqzbteM.d.ts → ingest-typed-D2S3Kb8m.d.ts} +6 -1
- package/dist/{ingest-typed-BCUv93ax.d.mts → ingest-typed-D7UZr0EM.d.mts} +6 -1
- package/dist/{sales-DSL6vMuY.d.mts → sales-CxJVthx_.d.mts} +1 -1
- package/dist/{sales-_F3nnI2r.d.ts → sales-hlcVTJSS.d.ts} +1 -1
- package/dist/sales.d.mts +2 -2
- package/dist/sales.d.ts +2 -2
- package/dist/sales.js +101 -50
- package/dist/sales.js.map +1 -1
- package/dist/sales.mjs +101 -50
- 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 BookingOutcome, C as ConversionConfig,
|
|
6
|
-
export { A as AutomaticEventName, B as BookableDay, a as BookingHandoffPrefill, b as BookingIntegration, c as BookingOption, d as BookingProvider, e as BookingRules, C as CtaClickConfig, f as CtaClickMetadata, E as EVENT_SEMANTICS, g as EventCategory, h as EventClientVisibility, i as EventConfig, j as EventKind, k as EventMetadata, l as EventName, m as EventOutcomeRole, n as EventSemantics, F as FormStartConfig, o as FormStartMetadata, p as FormStepConfig, q as FormStepMetadata, M as ManualEventName, r as MultiPageSessionConfig, s as MultiPageSessionMetadata, P as PageExitConfig, t as PageExitMetadata, u as PageIdentity, v as PageViewConfig, w as PageViewMetadata, x as PhoneClickConfig, y as PhoneClickMetadata, R as RegisteredAutomaticEvents, z as RegisteredManualEvents, S as ScrollDepthConfig, D as ScrollDepthMetadata, G as SdkHeartbeatConfig, H as SdkHeartbeatMetadata, I as SiteLinkArrivalConfig, J as SiteLinkArrivalMetadata, K as SiteLinkClickConfig, L as SiteLinkClickMetadata, N as SpecificPageName, O as SpecificPageVisitConfig, Q as SpecificPageVisitMetadata, T as TimeOnSiteConfig, U as TimeOnSiteMetadata, V as TrackableEvent, W as TriggerRegistryConfig, X as TypedTrackEventOptions, Y as TypedTrackingClient, Z as bookableSlots, _ as buildBookingHandoffUrl, $ as getBookingIntegration, a0 as getEventSemantics, a1 as shopToday } from './ingest-typed-
|
|
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-CxJVthx_.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, S as SalesBookingsClient, T as TrackingConfigReference, h as getTrackingConfigRuntime, n as newBookingAttemptKey, r as resolveConversionConfig, i as resolveTrackingConfigUrl } from './bookings-CqCuuyP6.mjs';
|
|
6
|
+
export { A as AutomaticEventName, B as BookableDay, a as BookingHandoffPrefill, b as BookingIntegration, c as BookingOption, d as BookingProvider, e as BookingRules, C as CtaClickConfig, f as CtaClickMetadata, E as EVENT_SEMANTICS, g as EventCategory, h as EventClientVisibility, i as EventConfig, j as EventKind, k as EventMetadata, l as EventName, m as EventOutcomeRole, n as EventSemantics, F as FormStartConfig, o as FormStartMetadata, p as FormStepConfig, q as FormStepMetadata, M as ManualEventName, r as MultiPageSessionConfig, s as MultiPageSessionMetadata, P as PageExitConfig, t as PageExitMetadata, u as PageIdentity, v as PageViewConfig, w as PageViewMetadata, x as PhoneClickConfig, y as PhoneClickMetadata, R as RegisteredAutomaticEvents, z as RegisteredManualEvents, S as ScrollDepthConfig, D as ScrollDepthMetadata, G as SdkHeartbeatConfig, H as SdkHeartbeatMetadata, I as SiteLinkArrivalConfig, J as SiteLinkArrivalMetadata, K as SiteLinkClickConfig, L as SiteLinkClickMetadata, N as SpecificPageName, O as SpecificPageVisitConfig, Q as SpecificPageVisitMetadata, T as TimeOnSiteConfig, U as TimeOnSiteMetadata, V as TrackableEvent, W as TriggerRegistryConfig, X as TypedTrackEventOptions, Y as TypedTrackingClient, Z as bookableSlots, _ as buildBookingHandoffUrl, $ as getBookingIntegration, a0 as getEventSemantics, a1 as shopToday } from './ingest-typed-D7UZr0EM.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 BookingOutcome, C as ConversionConfig,
|
|
6
|
-
export { A as AutomaticEventName, B as BookableDay, a as BookingHandoffPrefill, b as BookingIntegration, c as BookingOption, d as BookingProvider, e as BookingRules, C as CtaClickConfig, f as CtaClickMetadata, E as EVENT_SEMANTICS, g as EventCategory, h as EventClientVisibility, i as EventConfig, j as EventKind, k as EventMetadata, l as EventName, m as EventOutcomeRole, n as EventSemantics, F as FormStartConfig, o as FormStartMetadata, p as FormStepConfig, q as FormStepMetadata, M as ManualEventName, r as MultiPageSessionConfig, s as MultiPageSessionMetadata, P as PageExitConfig, t as PageExitMetadata, u as PageIdentity, v as PageViewConfig, w as PageViewMetadata, x as PhoneClickConfig, y as PhoneClickMetadata, R as RegisteredAutomaticEvents, z as RegisteredManualEvents, S as ScrollDepthConfig, D as ScrollDepthMetadata, G as SdkHeartbeatConfig, H as SdkHeartbeatMetadata, I as SiteLinkArrivalConfig, J as SiteLinkArrivalMetadata, K as SiteLinkClickConfig, L as SiteLinkClickMetadata, N as SpecificPageName, O as SpecificPageVisitConfig, Q as SpecificPageVisitMetadata, T as TimeOnSiteConfig, U as TimeOnSiteMetadata, V as TrackableEvent, W as TriggerRegistryConfig, X as TypedTrackEventOptions, Y as TypedTrackingClient, Z as bookableSlots, _ as buildBookingHandoffUrl, $ as getBookingIntegration, a0 as getEventSemantics, a1 as shopToday } from './ingest-typed-
|
|
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-hlcVTJSS.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, S as SalesBookingsClient, T as TrackingConfigReference, h as getTrackingConfigRuntime, n as newBookingAttemptKey, r as resolveConversionConfig, i as resolveTrackingConfigUrl } from './bookings-DIu1ho6v.js';
|
|
6
|
+
export { A as AutomaticEventName, B as BookableDay, a as BookingHandoffPrefill, b as BookingIntegration, c as BookingOption, d as BookingProvider, e as BookingRules, C as CtaClickConfig, f as CtaClickMetadata, E as EVENT_SEMANTICS, g as EventCategory, h as EventClientVisibility, i as EventConfig, j as EventKind, k as EventMetadata, l as EventName, m as EventOutcomeRole, n as EventSemantics, F as FormStartConfig, o as FormStartMetadata, p as FormStepConfig, q as FormStepMetadata, M as ManualEventName, r as MultiPageSessionConfig, s as MultiPageSessionMetadata, P as PageExitConfig, t as PageExitMetadata, u as PageIdentity, v as PageViewConfig, w as PageViewMetadata, x as PhoneClickConfig, y as PhoneClickMetadata, R as RegisteredAutomaticEvents, z as RegisteredManualEvents, S as ScrollDepthConfig, D as ScrollDepthMetadata, G as SdkHeartbeatConfig, H as SdkHeartbeatMetadata, I as SiteLinkArrivalConfig, J as SiteLinkArrivalMetadata, K as SiteLinkClickConfig, L as SiteLinkClickMetadata, N as SpecificPageName, O as SpecificPageVisitConfig, Q as SpecificPageVisitMetadata, T as TimeOnSiteConfig, U as TimeOnSiteMetadata, V as TrackableEvent, W as TriggerRegistryConfig, X as TypedTrackEventOptions, Y as TypedTrackingClient, Z as bookableSlots, _ as buildBookingHandoffUrl, $ as getBookingIntegration, a0 as getEventSemantics, a1 as shopToday } from './ingest-typed-D2S3Kb8m.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
|
@@ -754,6 +754,10 @@ function fireConversionWithConsent(input, options) {
|
|
|
754
754
|
}
|
|
755
755
|
|
|
756
756
|
// ../tracking-core/src/resources/conversion-config.ts
|
|
757
|
+
var BOOKING_MODES = ["live", "test", "simulated"];
|
|
758
|
+
function isBookingMode(value) {
|
|
759
|
+
return BOOKING_MODES.includes(value);
|
|
760
|
+
}
|
|
757
761
|
function isStringMap(value) {
|
|
758
762
|
return typeof value === "object" && value !== null && Object.values(value).every((v) => typeof v === "string");
|
|
759
763
|
}
|
|
@@ -825,7 +829,8 @@ function parseIntegrations(value) {
|
|
|
825
829
|
config_version: typeof b.config_version === "number" ? b.config_version : null,
|
|
826
830
|
accepts_bookings: b.accepts_bookings === true,
|
|
827
831
|
rules: parseBookingRules(b.rules),
|
|
828
|
-
options: Array.isArray(b.options) ? b.options.flatMap(parseBookingOption) : []
|
|
832
|
+
options: Array.isArray(b.options) ? b.options.flatMap(parseBookingOption) : [],
|
|
833
|
+
...isBookingMode(b.mode) ? { mode: b.mode } : {}
|
|
829
834
|
}
|
|
830
835
|
}
|
|
831
836
|
};
|
|
@@ -1532,7 +1537,8 @@ function getBookingIntegration(integrations) {
|
|
|
1532
1537
|
timezone: booking.timezone,
|
|
1533
1538
|
configVersion: booking.config_version,
|
|
1534
1539
|
rules,
|
|
1535
|
-
options: booking.options.map((option) => ({ key: option.key, label: option.label }))
|
|
1540
|
+
options: booking.options.map((option) => ({ key: option.key, label: option.label })),
|
|
1541
|
+
mode: booking.mode ?? "live"
|
|
1536
1542
|
};
|
|
1537
1543
|
}
|
|
1538
1544
|
function camelRules(rules) {
|
|
@@ -1773,6 +1779,7 @@ async function apiRequest(config, method, path, body, extraHeaders) {
|
|
|
1773
1779
|
var salesRequest = apiRequest;
|
|
1774
1780
|
|
|
1775
1781
|
// ../tracking-core/src/resources/sales/bookings.ts
|
|
1782
|
+
var BOOKING_SIMULATE_HEADER = "X-Aranova-Simulate";
|
|
1776
1783
|
var BOOKING_ERROR_CODES = {
|
|
1777
1784
|
unavailable: "booking_unavailable",
|
|
1778
1785
|
stale: "booking_config_stale",
|
|
@@ -1787,10 +1794,11 @@ function sleep(ms) {
|
|
|
1787
1794
|
});
|
|
1788
1795
|
}
|
|
1789
1796
|
function outcomeOf(body) {
|
|
1797
|
+
const mode = body.mode ?? "live";
|
|
1790
1798
|
if (body.status === "created")
|
|
1791
|
-
return { status: "created", id: body.id, requestCode: body.request_code };
|
|
1792
|
-
if (body.status === "pending") return { status: "pending", id: body.id };
|
|
1793
|
-
return { status: "failed", id: body.id, fallbackUrl: body.fallback_url };
|
|
1799
|
+
return { status: "created", id: body.id, requestCode: body.request_code, mode };
|
|
1800
|
+
if (body.status === "pending") return { status: "pending", id: body.id, mode };
|
|
1801
|
+
return { status: "failed", id: body.id, fallbackUrl: body.fallback_url, mode };
|
|
1794
1802
|
}
|
|
1795
1803
|
function formSubmitPayload(input, formId, labels) {
|
|
1796
1804
|
const vehicle = input.vehicle ? `${input.vehicle.year} ${input.vehicle.make} ${input.vehicle.model}` : "";
|
|
@@ -1832,9 +1840,29 @@ function formSubmitPayload(input, formId, labels) {
|
|
|
1832
1840
|
function runtimeOf(firing) {
|
|
1833
1841
|
return firing && "integrations" in firing ? firing : null;
|
|
1834
1842
|
}
|
|
1843
|
+
function isLocalUrl(url) {
|
|
1844
|
+
try {
|
|
1845
|
+
return ["localhost", "127.0.0.1", "[::1]"].includes(new URL(url).hostname);
|
|
1846
|
+
} catch {
|
|
1847
|
+
return false;
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
function bookingSetupMismatch(endpoint, runtime) {
|
|
1851
|
+
if (!runtime || !isLocalUrl(endpoint)) return null;
|
|
1852
|
+
const configUrl = resolveTrackingConfigUrl(runtime.ref);
|
|
1853
|
+
if (isLocalUrl(configUrl)) return null;
|
|
1854
|
+
return `[aranova] Bookings go to the local API (${endpoint}) but the runtime config comes from ${configUrl}. Set NEXT_PUBLIC_ARANOVA_CDN_BASE_URL to the local bucket (http://localhost:9100/aranova-demos) so both come from one backend.`;
|
|
1855
|
+
}
|
|
1835
1856
|
function createSalesBookingsClient(config, firing) {
|
|
1836
1857
|
const submittedForms = /* @__PURE__ */ new Set();
|
|
1837
1858
|
const staleAttempts = /* @__PURE__ */ new Set();
|
|
1859
|
+
let isSetupChecked = false;
|
|
1860
|
+
function warnOnSetupMismatch(runtime) {
|
|
1861
|
+
if (isSetupChecked) return;
|
|
1862
|
+
isSetupChecked = true;
|
|
1863
|
+
const warning = bookingSetupMismatch(config.endpoint, runtime);
|
|
1864
|
+
if (warning) console.warn(warning);
|
|
1865
|
+
}
|
|
1838
1866
|
function handoff(input) {
|
|
1839
1867
|
const booking = getBookingIntegration(runtimeOf(firing)?.integrations());
|
|
1840
1868
|
if (!booking) return null;
|
|
@@ -1845,14 +1873,18 @@ function createSalesBookingsClient(config, firing) {
|
|
|
1845
1873
|
email: input.email
|
|
1846
1874
|
});
|
|
1847
1875
|
}
|
|
1876
|
+
function failedBeforeSend(input) {
|
|
1877
|
+
const mode = getBookingIntegration(runtimeOf(firing)?.integrations())?.mode ?? "live";
|
|
1878
|
+
return { status: "failed", id: null, fallbackUrl: handoff(input), mode };
|
|
1879
|
+
}
|
|
1848
1880
|
function withHandoff(outcome, input) {
|
|
1849
1881
|
if (outcome.status === "failed" && !outcome.fallbackUrl) {
|
|
1850
1882
|
return { ...outcome, fallbackUrl: handoff(input) };
|
|
1851
1883
|
}
|
|
1852
1884
|
return outcome;
|
|
1853
1885
|
}
|
|
1854
|
-
async function poll(id) {
|
|
1855
|
-
let outcome = { status: "pending", id };
|
|
1886
|
+
async function poll(id, mode) {
|
|
1887
|
+
let outcome = { status: "pending", id, mode };
|
|
1856
1888
|
for (const delay of POLL_DELAYS_MS) {
|
|
1857
1889
|
await sleep(delay);
|
|
1858
1890
|
try {
|
|
@@ -1867,12 +1899,10 @@ function createSalesBookingsClient(config, firing) {
|
|
|
1867
1899
|
}
|
|
1868
1900
|
async function rejected(error, input, attemptKey, runtime) {
|
|
1869
1901
|
if (!(error instanceof AranovaApiError)) {
|
|
1870
|
-
return
|
|
1902
|
+
return failedBeforeSend(input);
|
|
1871
1903
|
}
|
|
1872
1904
|
if (error.code === BOOKING_ERROR_CODES.stale) {
|
|
1873
|
-
if (staleAttempts.has(attemptKey))
|
|
1874
|
-
return { status: "failed", id: null, fallbackUrl: handoff(input) };
|
|
1875
|
-
}
|
|
1905
|
+
if (staleAttempts.has(attemptKey)) return failedBeforeSend(input);
|
|
1876
1906
|
staleAttempts.add(attemptKey);
|
|
1877
1907
|
await runtime?.revalidate();
|
|
1878
1908
|
return { status: "stale", message: error.message };
|
|
@@ -1888,15 +1918,16 @@ function createSalesBookingsClient(config, firing) {
|
|
|
1888
1918
|
if (error.code === "validation_error") {
|
|
1889
1919
|
return { status: "invalid", message: INVALID_DETAILS, reasons: [] };
|
|
1890
1920
|
}
|
|
1891
|
-
return
|
|
1921
|
+
return failedBeforeSend(input);
|
|
1892
1922
|
}
|
|
1893
1923
|
return {
|
|
1894
|
-
async submit(input, { attemptKey, formSubmit }) {
|
|
1924
|
+
async submit(input, { attemptKey, formSubmit, simulate }) {
|
|
1895
1925
|
registerCapability("booking_integration");
|
|
1896
1926
|
const runtime = runtimeOf(firing);
|
|
1927
|
+
warnOnSetupMismatch(runtime);
|
|
1897
1928
|
const booking = getBookingIntegration(runtime?.integrations());
|
|
1898
1929
|
if (!booking?.acceptsBookings || booking.configVersion === null) {
|
|
1899
|
-
return
|
|
1930
|
+
return failedBeforeSend(input);
|
|
1900
1931
|
}
|
|
1901
1932
|
if (formSubmit && !submittedForms.has(attemptKey)) {
|
|
1902
1933
|
submittedForms.add(attemptKey);
|
|
@@ -1926,12 +1957,22 @@ function createSalesBookingsClient(config, firing) {
|
|
|
1926
1957
|
};
|
|
1927
1958
|
let response;
|
|
1928
1959
|
try {
|
|
1929
|
-
|
|
1960
|
+
const headers = simulate ? { [BOOKING_SIMULATE_HEADER]: simulate } : void 0;
|
|
1961
|
+
response = await salesRequest(
|
|
1962
|
+
config,
|
|
1963
|
+
"POST",
|
|
1964
|
+
"/bookings",
|
|
1965
|
+
body,
|
|
1966
|
+
headers
|
|
1967
|
+
);
|
|
1930
1968
|
} catch (error) {
|
|
1931
1969
|
return rejected(error, input, attemptKey, runtime);
|
|
1932
1970
|
}
|
|
1933
1971
|
const outcome = outcomeOf(response);
|
|
1934
|
-
return withHandoff(
|
|
1972
|
+
return withHandoff(
|
|
1973
|
+
outcome.status === "pending" ? await poll(outcome.id, outcome.mode) : outcome,
|
|
1974
|
+
input
|
|
1975
|
+
);
|
|
1935
1976
|
},
|
|
1936
1977
|
async status(id) {
|
|
1937
1978
|
return outcomeOf(
|
|
@@ -2160,6 +2201,7 @@ var zErrorCode = z2.enum([
|
|
|
2160
2201
|
"booking_not_found",
|
|
2161
2202
|
"booking_not_cancellable",
|
|
2162
2203
|
"booking_not_reschedulable",
|
|
2204
|
+
"booking_not_synced",
|
|
2163
2205
|
"manage_token_invalid",
|
|
2164
2206
|
"google_error",
|
|
2165
2207
|
"booking_unavailable",
|