@aranova/tracking-react 1.8.0 → 1.9.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 +5 -0
- package/dist/{bookings-B50X7GSG.d.ts → bookings-Bx7totlS.d.ts} +43 -1
- package/dist/{bookings-n8UUzrak.d.mts → bookings-DtcwdM_I.d.mts} +43 -1
- package/dist/client.d.mts +17 -3
- package/dist/client.d.ts +17 -3
- package/dist/client.js +46 -5
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +46 -5
- package/dist/client.mjs.map +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +32 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -2
- package/dist/index.mjs.map +1 -1
- package/dist/{ingest-typed-vP-DqpxO.d.ts → ingest-typed-B-BgEZdW.d.ts} +3 -1
- package/dist/{ingest-typed-ABH28Ips.d.mts → ingest-typed-C2OvZ7dp.d.mts} +3 -1
- package/dist/{sales-D4QRnpdz.d.ts → sales-DJJpMY_c.d.ts} +1 -1
- package/dist/{sales-DByfvgzT.d.mts → sales-Dil7TNV_.d.mts} +1 -1
- package/dist/sales.d.mts +2 -2
- package/dist/sales.d.ts +2 -2
- package/dist/sales.js +31 -2
- package/dist/sales.js.map +1 -1
- package/dist/sales.mjs +31 -2
- package/dist/sales.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { p as BookingDayWindows, h as BookingMode, q as ConversionIntegrations } from './bookings-Bx7totlS.js';
|
|
2
2
|
import * as zod_v4_core from 'zod/v4/core';
|
|
3
3
|
import * as z from 'zod/mini';
|
|
4
4
|
import { J as JsonValue, F as FormSubmitConfig, a as FormSubmitMetadata } from './form-submit-BLb28aCk.js';
|
|
@@ -30,6 +30,8 @@ interface BookingRules {
|
|
|
30
30
|
/** `YYYY-MM-DD` shop dates whose start hours replace their weekday's. */
|
|
31
31
|
specialHours: Record<string, BookingDayWindows>;
|
|
32
32
|
vehicleRequired: boolean;
|
|
33
|
+
/** The vehicle may come after booking: send it with `bookings.updateBooking`. */
|
|
34
|
+
vehicleDeferred: boolean;
|
|
33
35
|
/** `waitForIt` / `dropOff`; empty when the shop hides the question. */
|
|
34
36
|
dropOffOptions: string[];
|
|
35
37
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { p as BookingDayWindows, h as BookingMode, q as ConversionIntegrations } from './bookings-DtcwdM_I.mjs';
|
|
2
2
|
import * as zod_v4_core from 'zod/v4/core';
|
|
3
3
|
import * as z from 'zod/mini';
|
|
4
4
|
import { J as JsonValue, F as FormSubmitConfig, a as FormSubmitMetadata } from './form-submit-BLb28aCk.mjs';
|
|
@@ -30,6 +30,8 @@ interface BookingRules {
|
|
|
30
30
|
/** `YYYY-MM-DD` shop dates whose start hours replace their weekday's. */
|
|
31
31
|
specialHours: Record<string, BookingDayWindows>;
|
|
32
32
|
vehicleRequired: boolean;
|
|
33
|
+
/** The vehicle may come after booking: send it with `bookings.updateBooking`. */
|
|
34
|
+
vehicleDeferred: boolean;
|
|
33
35
|
/** `waitForIt` / `dropOff`; empty when the shop hides the question. */
|
|
34
36
|
dropOffOptions: string[];
|
|
35
37
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as z from 'zod/mini';
|
|
2
|
-
import { S as SalesBookingsClient,
|
|
2
|
+
import { S as SalesBookingsClient, l as ConversionConfigStore, s as TrackingConfigRuntime } from './bookings-Bx7totlS.js';
|
|
3
3
|
import { CountryCode } from 'libphonenumber-js';
|
|
4
4
|
|
|
5
5
|
/** Raw identifiers a caller may hand us (normalized before use). */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as z from 'zod/mini';
|
|
2
|
-
import { S as SalesBookingsClient,
|
|
2
|
+
import { S as SalesBookingsClient, l as ConversionConfigStore, s as TrackingConfigRuntime } from './bookings-DtcwdM_I.mjs';
|
|
3
3
|
import { CountryCode } from 'libphonenumber-js';
|
|
4
4
|
|
|
5
5
|
/** Raw identifiers a caller may hand us (normalized before use). */
|
package/dist/sales.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, C as CompareTo, 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, 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, as as toMinor } from './sales-
|
|
2
|
-
export { B as
|
|
1
|
+
export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, C as CompareTo, 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, 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, as as toMinor } from './sales-Dil7TNV_.mjs';
|
|
2
|
+
export { B as BookingDetailsFailure, a as BookingDetailsInput, b as BookingDetailsOptions, c as BookingDetailsOutcome, d as BookingDetailsStatus, e as BookingDropOff, f as BookingFormSubmit, g as BookingInput, h as BookingMode, i as BookingOutcome, j as BookingSimulation, k as BookingSubmitOptions, F as FormSubmitField, S as SalesBookingsClient, n as newBookingAttemptKey } from './bookings-DtcwdM_I.mjs';
|
|
3
3
|
import 'zod/mini';
|
|
4
4
|
import 'libphonenumber-js';
|
|
5
5
|
import './form-submit-BLb28aCk.mjs';
|
package/dist/sales.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, C as CompareTo, 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, 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, as as toMinor } from './sales-
|
|
2
|
-
export { B as
|
|
1
|
+
export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, C as CompareTo, 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, 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, as as toMinor } from './sales-DJJpMY_c.js';
|
|
2
|
+
export { B as BookingDetailsFailure, a as BookingDetailsInput, b as BookingDetailsOptions, c as BookingDetailsOutcome, d as BookingDetailsStatus, e as BookingDropOff, f as BookingFormSubmit, g as BookingInput, h as BookingMode, i as BookingOutcome, j as BookingSimulation, k as BookingSubmitOptions, F as FormSubmitField, S as SalesBookingsClient, n as newBookingAttemptKey } from './bookings-Bx7totlS.js';
|
|
3
3
|
import 'zod/mini';
|
|
4
4
|
import 'libphonenumber-js';
|
|
5
5
|
import './form-submit-BLb28aCk.js';
|
package/dist/sales.js
CHANGED
|
@@ -259,6 +259,7 @@ function camelRules(rules) {
|
|
|
259
259
|
closedDates: rules.closed_dates,
|
|
260
260
|
specialHours: rules.special_hours,
|
|
261
261
|
vehicleRequired: rules.vehicle_required,
|
|
262
|
+
vehicleDeferred: rules.vehicle_deferred,
|
|
262
263
|
dropOffOptions: rules.drop_off_options
|
|
263
264
|
};
|
|
264
265
|
}
|
|
@@ -452,8 +453,17 @@ var BOOKING_SIMULATE_HEADER = "X-Aranova-Simulate";
|
|
|
452
453
|
var BOOKING_ERROR_CODES = {
|
|
453
454
|
unavailable: "booking_unavailable",
|
|
454
455
|
stale: "booking_config_stale",
|
|
455
|
-
rejected: "booking_rejected"
|
|
456
|
+
rejected: "booking_rejected",
|
|
457
|
+
attemptMismatch: "booking_attempt_mismatch",
|
|
458
|
+
detailsConflict: "idempotency_conflict"
|
|
456
459
|
};
|
|
460
|
+
function detailsFailure(error) {
|
|
461
|
+
if (!(error instanceof AranovaApiError)) return "failed";
|
|
462
|
+
if (error.code === BOOKING_ERROR_CODES.attemptMismatch) return "mismatch";
|
|
463
|
+
if (error.code === BOOKING_ERROR_CODES.detailsConflict) return "conflict";
|
|
464
|
+
if (error.status === 404) return "not_found";
|
|
465
|
+
return error.status === 422 ? "invalid" : "failed";
|
|
466
|
+
}
|
|
457
467
|
var POLL_DELAYS_MS = [1e3, 2e3, 4e3, 8e3, 15e3];
|
|
458
468
|
var INVALID_DETAILS = "Please check your details and try again.";
|
|
459
469
|
var newBookingAttemptKey = uuidV4;
|
|
@@ -638,6 +648,25 @@ function createSalesBookingsClient(config, firing) {
|
|
|
638
648
|
onPending?.(outcome);
|
|
639
649
|
return withHandoff(await poll(outcome.id, outcome.mode), input);
|
|
640
650
|
},
|
|
651
|
+
async updateBooking(bookingId, details, { attemptKey }) {
|
|
652
|
+
const body = {
|
|
653
|
+
idempotency_key: attemptKey,
|
|
654
|
+
vehicle: details.vehicle ?? null,
|
|
655
|
+
notes: details.notes?.trim() || null
|
|
656
|
+
};
|
|
657
|
+
try {
|
|
658
|
+
const response = await salesRequest(
|
|
659
|
+
config,
|
|
660
|
+
"POST",
|
|
661
|
+
`/bookings/${encodeURIComponent(bookingId)}/details`,
|
|
662
|
+
body
|
|
663
|
+
);
|
|
664
|
+
return { status: response.status, id: response.id };
|
|
665
|
+
} catch (error) {
|
|
666
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
667
|
+
return { status: detailsFailure(error), id: bookingId, message };
|
|
668
|
+
}
|
|
669
|
+
},
|
|
641
670
|
async status(id) {
|
|
642
671
|
return outcomeOf(
|
|
643
672
|
await salesRequest(
|
|
@@ -871,6 +900,7 @@ var zErrorCode = z.enum([
|
|
|
871
900
|
"booking_unavailable",
|
|
872
901
|
"booking_config_stale",
|
|
873
902
|
"booking_rejected",
|
|
903
|
+
"booking_attempt_mismatch",
|
|
874
904
|
"calendar_not_owned",
|
|
875
905
|
"calendar_is_sandbox",
|
|
876
906
|
"sandbox_exists",
|
|
@@ -951,7 +981,6 @@ var zSmsWithheldReason = z.enum([
|
|
|
951
981
|
"confirmed_by_integration",
|
|
952
982
|
"test_or_bot_session",
|
|
953
983
|
"invalid_phone",
|
|
954
|
-
"quiet_hours",
|
|
955
984
|
"recently_texted"
|
|
956
985
|
]);
|
|
957
986
|
var zSaleSmsStatusSchema = z.object({
|