@aranova/tracking-react 1.14.0 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{bookings-Bw2ImtPd.d.ts → bookings-CkfA5XOM.d.ts} +283 -8
- package/dist/{bookings-CDGNZUaH.d.mts → bookings-DFz3BUiP.d.mts} +283 -8
- package/dist/client.d.mts +10 -9
- package/dist/client.d.ts +10 -9
- package/dist/client.js +157 -141
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +157 -141
- package/dist/client.mjs.map +1 -1
- package/dist/index.d.mts +5 -6
- package/dist/index.d.ts +5 -6
- package/dist/index.js +365 -203
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +365 -203
- package/dist/index.mjs.map +1 -1
- package/dist/{submit-DuvP5AGN.d.ts → ingest-typed-BO6Arbw-.d.mts} +2 -252
- package/dist/{submit-rqgXl-Wg.d.mts → ingest-typed-D7I4aQ7p.d.ts} +2 -252
- package/dist/{phone-utils-Cfdx474X.d.mts → phone-utils-CYr6AmEP.d.mts} +55 -2
- package/dist/{phone-utils-D2TGPCQW.d.ts → phone-utils-CYr6AmEP.d.ts} +55 -2
- package/dist/phone.d.mts +1 -2
- package/dist/phone.d.ts +1 -2
- package/dist/{sales-DkdrGIUS.d.ts → sales-C0FMkN4m.d.ts} +1 -1
- package/dist/{sales-D4aU73mR.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 +1205 -170
- package/dist/sales.js.map +1 -1
- package/dist/sales.mjs +1205 -170
- package/dist/sales.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/form-submit-C_vJXCxh.d.mts +0 -57
- package/dist/form-submit-C_vJXCxh.d.ts +0 -57
package/dist/index.js
CHANGED
|
@@ -555,10 +555,10 @@ function readStoredRecord() {
|
|
|
555
555
|
return null;
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
|
-
function writeRecord(
|
|
559
|
-
memoryRecord =
|
|
558
|
+
function writeRecord(record4) {
|
|
559
|
+
memoryRecord = record4;
|
|
560
560
|
try {
|
|
561
|
-
window.localStorage.setItem(LANDING_STORAGE_KEY, JSON.stringify(
|
|
561
|
+
window.localStorage.setItem(LANDING_STORAGE_KEY, JSON.stringify(record4));
|
|
562
562
|
} catch {
|
|
563
563
|
}
|
|
564
564
|
}
|
|
@@ -580,9 +580,9 @@ function getOrCaptureLandingParams(sessionId, url) {
|
|
|
580
580
|
if (memoryRecord && memoryRecord.session_id === sessionId) {
|
|
581
581
|
return memoryRecord.params;
|
|
582
582
|
}
|
|
583
|
-
const
|
|
584
|
-
writeRecord(
|
|
585
|
-
return
|
|
583
|
+
const record4 = { session_id: sessionId, params: captureFromUrl(url) };
|
|
584
|
+
writeRecord(record4);
|
|
585
|
+
return record4.params;
|
|
586
586
|
}
|
|
587
587
|
function buildLandingPayloadFields(sessionId, override) {
|
|
588
588
|
const params = override ?? (typeof window === "undefined" ? null : getOrCaptureLandingParams(sessionId));
|
|
@@ -1809,8 +1809,81 @@ var SDK_PACKAGE_HEADER = "X-Aranova-Sdk-Package";
|
|
|
1809
1809
|
var SDK_SURFACE_HEADER = "X-Aranova-Sdk-Surface";
|
|
1810
1810
|
var SDK_ENVIRONMENT_HEADER = "X-Aranova-Sdk-Environment";
|
|
1811
1811
|
|
|
1812
|
-
// ../tracking-core/src/
|
|
1812
|
+
// ../tracking-core/src/ingest-typed.ts
|
|
1813
|
+
var import_mini = require("zod/mini");
|
|
1814
|
+
|
|
1815
|
+
// ../tracking-core/src/events/form-submit.ts
|
|
1813
1816
|
var z2 = __toESM(require("zod/mini"));
|
|
1817
|
+
var jsonValueSchema = z2.lazy(
|
|
1818
|
+
() => z2.union([
|
|
1819
|
+
z2.string(),
|
|
1820
|
+
z2.number(),
|
|
1821
|
+
z2.boolean(),
|
|
1822
|
+
z2.null(),
|
|
1823
|
+
z2.array(jsonValueSchema),
|
|
1824
|
+
z2.record(z2.string(), jsonValueSchema)
|
|
1825
|
+
])
|
|
1826
|
+
).register(z2.globalRegistry, { id: "JsonSerializableValue" });
|
|
1827
|
+
var contractNameSchema = z2.string().check(z2.regex(/^[a-z][a-z0-9_]{0,47}(:[a-z0-9_-]{1,48})?$/));
|
|
1828
|
+
var contractName = contractNameSchema;
|
|
1829
|
+
var violationRole = z2.string().check(
|
|
1830
|
+
z2.maxLength(200),
|
|
1831
|
+
z2.regex(
|
|
1832
|
+
/^[a-z][a-z0-9_]{0,47}(:[a-z0-9_-]{1,48})?(\|[a-z][a-z0-9_]{0,47}(:[a-z0-9_-]{1,48})?)*$/
|
|
1833
|
+
)
|
|
1834
|
+
);
|
|
1835
|
+
var MAX_CONTRACT_VIOLATIONS = 50;
|
|
1836
|
+
var contractViolationSchema = z2.strictObject({
|
|
1837
|
+
role: z2.nullable(violationRole),
|
|
1838
|
+
rule: z2.string().check(z2.regex(/^[a-z][a-z_]{0,47}$/))
|
|
1839
|
+
});
|
|
1840
|
+
var formSubmitMetadataSchema = z2.strictObject({
|
|
1841
|
+
form: z2.strictObject({
|
|
1842
|
+
id: z2.string(),
|
|
1843
|
+
action: z2.nullable(z2.string()),
|
|
1844
|
+
fields: z2.optional(
|
|
1845
|
+
z2.array(
|
|
1846
|
+
z2.strictObject({
|
|
1847
|
+
name: z2.string(),
|
|
1848
|
+
type: z2.string(),
|
|
1849
|
+
label: z2.nullable(z2.string()),
|
|
1850
|
+
value: jsonValueSchema,
|
|
1851
|
+
role: z2.optional(z2.nullable(contractName))
|
|
1852
|
+
})
|
|
1853
|
+
)
|
|
1854
|
+
),
|
|
1855
|
+
kind: z2.optional(z2.nullable(contractName)),
|
|
1856
|
+
contract_version: z2.optional(z2.nullable(z2.int().check(z2.gte(1)))),
|
|
1857
|
+
contract_hash: z2.optional(z2.nullable(z2.string().check(z2.maxLength(64)))),
|
|
1858
|
+
extra: z2.optional(
|
|
1859
|
+
z2.nullable(
|
|
1860
|
+
z2.array(
|
|
1861
|
+
z2.strictObject({
|
|
1862
|
+
key: z2.string().check(z2.maxLength(64)),
|
|
1863
|
+
label: z2.string().check(z2.maxLength(200)),
|
|
1864
|
+
value: jsonValueSchema
|
|
1865
|
+
})
|
|
1866
|
+
).check(z2.maxLength(20))
|
|
1867
|
+
)
|
|
1868
|
+
),
|
|
1869
|
+
contract_violations: z2.optional(
|
|
1870
|
+
z2.nullable(z2.array(contractViolationSchema).check(z2.maxLength(MAX_CONTRACT_VIOLATIONS)))
|
|
1871
|
+
)
|
|
1872
|
+
}),
|
|
1873
|
+
page: z2.strictObject({
|
|
1874
|
+
path: z2.string()
|
|
1875
|
+
})
|
|
1876
|
+
});
|
|
1877
|
+
var formSubmitConfigSchema = z2.strictObject({});
|
|
1878
|
+
|
|
1879
|
+
// ../tracking-core/src/ingest-typed.ts
|
|
1880
|
+
var clientSettings = /* @__PURE__ */ new WeakMap();
|
|
1881
|
+
function typedClientSettings(client) {
|
|
1882
|
+
return clientSettings.get(client) ?? {};
|
|
1883
|
+
}
|
|
1884
|
+
|
|
1885
|
+
// ../tracking-core/src/lead-forms/lead-forms.gen.ts
|
|
1886
|
+
var z3 = __toESM(require("zod/mini"));
|
|
1814
1887
|
var LEAD_FORM_REGISTRY_VERSION = 2;
|
|
1815
1888
|
var LEAD_FORM_KINDS = ["booking", "quote", "contact", "consult", "callback"];
|
|
1816
1889
|
var LEAD_FORM_ROLES = [
|
|
@@ -1850,28 +1923,28 @@ var LEAD_FORM_PRIMITIVES = [
|
|
|
1850
1923
|
"number"
|
|
1851
1924
|
];
|
|
1852
1925
|
var leadFormPrimitiveSchemas = /* @__PURE__ */ (() => ({
|
|
1853
|
-
string:
|
|
1854
|
-
text:
|
|
1855
|
-
enum:
|
|
1856
|
-
multi_enum:
|
|
1857
|
-
bool:
|
|
1858
|
-
date:
|
|
1859
|
-
time_window:
|
|
1860
|
-
start:
|
|
1861
|
-
end:
|
|
1862
|
-
label:
|
|
1926
|
+
string: z3.string().check(z3.maxLength(120)),
|
|
1927
|
+
text: z3.string().check(z3.maxLength(2e3)),
|
|
1928
|
+
enum: z3.string().check(z3.regex(/^[a-z0-9-]{1,48}$/)),
|
|
1929
|
+
multi_enum: z3.array(z3.string().check(z3.regex(/^[a-z0-9-]{1,48}$/))).check(z3.maxLength(10)),
|
|
1930
|
+
bool: z3.boolean(),
|
|
1931
|
+
date: z3.string().check(z3.regex(/^\d{4}-\d{2}-\d{2}$/)),
|
|
1932
|
+
time_window: z3.strictObject({
|
|
1933
|
+
start: z3.string().check(z3.regex(/^([01]\d|2[0-3]):[0-5]\d$/)),
|
|
1934
|
+
end: z3.nullable(z3.string().check(z3.regex(/^([01]\d|2[0-3]):[0-5]\d$/))),
|
|
1935
|
+
label: z3.optional(z3.string().check(z3.maxLength(60)))
|
|
1863
1936
|
}),
|
|
1864
|
-
phone:
|
|
1865
|
-
email:
|
|
1866
|
-
address:
|
|
1867
|
-
line1:
|
|
1868
|
-
line2:
|
|
1869
|
-
city:
|
|
1870
|
-
region:
|
|
1871
|
-
postal_code:
|
|
1872
|
-
country:
|
|
1937
|
+
phone: z3.string().check(z3.regex(/^\+[1-9]\d{6,14}$/)),
|
|
1938
|
+
email: z3.string().check(z3.maxLength(320), z3.regex(/^[^\s@]+@[^\s@]+$/)),
|
|
1939
|
+
address: z3.strictObject({
|
|
1940
|
+
line1: z3.string().check(z3.maxLength(120)),
|
|
1941
|
+
line2: z3.optional(z3.string().check(z3.maxLength(120))),
|
|
1942
|
+
city: z3.optional(z3.string().check(z3.maxLength(120))),
|
|
1943
|
+
region: z3.optional(z3.string().check(z3.maxLength(120))),
|
|
1944
|
+
postal_code: z3.optional(z3.string().check(z3.maxLength(120))),
|
|
1945
|
+
country: z3.optional(z3.string().check(z3.maxLength(120)))
|
|
1873
1946
|
}),
|
|
1874
|
-
number:
|
|
1947
|
+
number: z3.number()
|
|
1875
1948
|
}))();
|
|
1876
1949
|
var LEAD_FORM_ROLE_SPECS = {
|
|
1877
1950
|
given_name: { primitive: "string", smsLabel: "", contactIdentity: true },
|
|
@@ -1921,6 +1994,101 @@ var LEAD_FORM_ROLE_SPECS = {
|
|
|
1921
1994
|
attribution: { primitive: "enum", smsLabel: "", uninteresting: true }
|
|
1922
1995
|
};
|
|
1923
1996
|
|
|
1997
|
+
// ../tracking-core/src/lead-forms/submit.ts
|
|
1998
|
+
var import_mini2 = require("zod/mini");
|
|
1999
|
+
var KNOWN_ROLES = new Set(LEAD_FORM_ROLES);
|
|
2000
|
+
var ROLE_ORDER = new Map(LEAD_FORM_ROLES.map((role, index) => [role, index]));
|
|
2001
|
+
var ADD_ON = /^add_on:[a-z0-9_-]{1,48}$/;
|
|
2002
|
+
var CONTRACT_NAME = /^[a-z][a-z0-9_]{0,47}(:[a-z0-9_-]{1,48})?$/;
|
|
2003
|
+
function judgeLeadForm(kind, formId, fields, contracts, settings) {
|
|
2004
|
+
const generated = contracts?.contracts[kind];
|
|
2005
|
+
const live = liveContract(settings.trackingConfig, kind);
|
|
2006
|
+
const violations = check(live === void 0 ? generated : fromLive(live), fields);
|
|
2007
|
+
const liveHash = live === void 0 ? void 0 : live?.contract_hash ?? null;
|
|
2008
|
+
if (contracts && (liveHash !== void 0 && (generated?.hash ?? null) !== liveHash || contracts.registryVersion !== LEAD_FORM_REGISTRY_VERSION)) {
|
|
2009
|
+
violations.push({ role: null, rule: "contract_behind" });
|
|
2010
|
+
}
|
|
2011
|
+
if (violations.length > 0 && (settings.debug || settings.environment === "development")) {
|
|
2012
|
+
const message = `[AranovaTracking] lead form "${formId}" (${kind}) breaks its contract: ${violations.map((v) => `${v.rule}${v.role ? ` (${v.role})` : ""}`).join(", ")}`;
|
|
2013
|
+
console.error(message);
|
|
2014
|
+
if (settings.debug) throw new Error(message);
|
|
2015
|
+
}
|
|
2016
|
+
return {
|
|
2017
|
+
violations,
|
|
2018
|
+
hash: liveHash === void 0 ? generated?.hash ?? null : liveHash
|
|
2019
|
+
};
|
|
2020
|
+
}
|
|
2021
|
+
function liveContract(ref, kind) {
|
|
2022
|
+
const leadForms = ref ? getTrackingConfigRuntime(ref).leadForms() : null;
|
|
2023
|
+
if (!leadForms) return void 0;
|
|
2024
|
+
return leadForms.contracts.find((c) => c.form_kind === kind) ?? null;
|
|
2025
|
+
}
|
|
2026
|
+
function fromLive(live) {
|
|
2027
|
+
if (!live) return void 0;
|
|
2028
|
+
return {
|
|
2029
|
+
requires: live.requires.map((r) => ({
|
|
2030
|
+
role: r.role,
|
|
2031
|
+
requiredWhen: r.required_when ? { role: r.required_when.role, anyOf: r.required_when.any_of } : null
|
|
2032
|
+
})),
|
|
2033
|
+
requiresAny: live.requires_any.map((g) => g.roles),
|
|
2034
|
+
// Deprecated keys still resolve: a cached form may send them (ADR-0024 §7).
|
|
2035
|
+
options: Object.fromEntries(live.options.map((o) => [o.role, o.options.map((x) => x.key)]))
|
|
2036
|
+
};
|
|
2037
|
+
}
|
|
2038
|
+
function check(contract, fields) {
|
|
2039
|
+
const answered = new Map(fields);
|
|
2040
|
+
const violations = [];
|
|
2041
|
+
for (const [role, value] of fields) {
|
|
2042
|
+
const primitive = primitiveOf(role);
|
|
2043
|
+
if (!primitive) {
|
|
2044
|
+
violations.push({ role: CONTRACT_NAME.test(role) ? role : null, rule: "unknown_role" });
|
|
2045
|
+
continue;
|
|
2046
|
+
}
|
|
2047
|
+
if (!(0, import_mini2.safeParse)(leadFormPrimitiveSchemas[primitive], value).success) {
|
|
2048
|
+
violations.push({ role, rule: "invalid_value" });
|
|
2049
|
+
continue;
|
|
2050
|
+
}
|
|
2051
|
+
const allowed = contract?.options[role] ?? registryOptions(role);
|
|
2052
|
+
if (allowed?.length && optionKeys(value).some((key) => !allowed.includes(key))) {
|
|
2053
|
+
violations.push({ role, rule: "unknown_option" });
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
for (const { role, requiredWhen } of contract?.requires ?? []) {
|
|
2057
|
+
const owing = requiredWhen === null || optionKeys(answered.get(requiredWhen.role)).some((key) => requiredWhen.anyOf.includes(key));
|
|
2058
|
+
if (owing && !answered.has(role)) violations.push({ role, rule: "missing_required" });
|
|
2059
|
+
}
|
|
2060
|
+
for (const group of contract?.requiresAny ?? []) {
|
|
2061
|
+
if (!group.some((role) => answered.has(role))) {
|
|
2062
|
+
violations.push({ role: group.join("|"), rule: "missing_any_of" });
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
return violations;
|
|
2066
|
+
}
|
|
2067
|
+
function primitiveOf(role) {
|
|
2068
|
+
if (ADD_ON.test(role)) return "bool";
|
|
2069
|
+
return KNOWN_ROLES.has(role) ? LEAD_FORM_ROLE_SPECS[role].primitive : null;
|
|
2070
|
+
}
|
|
2071
|
+
function registryOptions(role) {
|
|
2072
|
+
const spec = KNOWN_ROLES.has(role) ? LEAD_FORM_ROLE_SPECS[role] : void 0;
|
|
2073
|
+
return spec && "options" in spec ? spec.options.map((o) => o.key) : void 0;
|
|
2074
|
+
}
|
|
2075
|
+
function optionKeys(value) {
|
|
2076
|
+
if (typeof value === "string") return [value];
|
|
2077
|
+
return Array.isArray(value) ? value.filter((v) => typeof v === "string") : [];
|
|
2078
|
+
}
|
|
2079
|
+
function slotFields(dateTime) {
|
|
2080
|
+
const written = /^(\d{4}-\d{2}-\d{2})[T ](\d{2}:\d{2})(?::\d{2}(?:\.\d+)?)?$/.exec(dateTime);
|
|
2081
|
+
if (!written) {
|
|
2082
|
+
throw new TypeError(
|
|
2083
|
+
`slotFields needs the slot's wall time without an offset ("2026-10-13T09:30"), got "${dateTime}"`
|
|
2084
|
+
);
|
|
2085
|
+
}
|
|
2086
|
+
return { preferred_date: written[1], preferred_time: { start: written[2], end: null } };
|
|
2087
|
+
}
|
|
2088
|
+
function timeWindow(start, end, label) {
|
|
2089
|
+
return { start, end: end ?? null, ...label ? { label } : {} };
|
|
2090
|
+
}
|
|
2091
|
+
|
|
1924
2092
|
// ../tracking-core/src/resources/http/errors.ts
|
|
1925
2093
|
var AranovaApiError = class extends Error {
|
|
1926
2094
|
constructor(message, options) {
|
|
@@ -1960,11 +2128,11 @@ async function apiRequest(config, method, path, body, extraHeaders) {
|
|
|
1960
2128
|
try {
|
|
1961
2129
|
const parsed = await response.json();
|
|
1962
2130
|
if (parsed && typeof parsed === "object") {
|
|
1963
|
-
const
|
|
1964
|
-
if (typeof
|
|
1965
|
-
if (typeof
|
|
1966
|
-
if (
|
|
1967
|
-
context =
|
|
2131
|
+
const record4 = parsed;
|
|
2132
|
+
if (typeof record4.detail === "string") detail = record4.detail;
|
|
2133
|
+
if (typeof record4.code === "string") code = record4.code;
|
|
2134
|
+
if (record4.context && typeof record4.context === "object") {
|
|
2135
|
+
context = record4.context;
|
|
1968
2136
|
}
|
|
1969
2137
|
}
|
|
1970
2138
|
} catch {
|
|
@@ -2018,7 +2186,7 @@ var DROP_OFF_KEYS = {
|
|
|
2018
2186
|
waitForIt: "wait-for-it",
|
|
2019
2187
|
dropOff: "drop-off"
|
|
2020
2188
|
};
|
|
2021
|
-
function formSubmitPayload(input, formSubmit,
|
|
2189
|
+
function formSubmitPayload(input, formSubmit, runtime) {
|
|
2022
2190
|
const field = (role, name, type, label, value) => ({ name, type, label, value, role });
|
|
2023
2191
|
const text = (value) => value?.trim() || void 0;
|
|
2024
2192
|
const { vehicle, dropOff } = input;
|
|
@@ -2028,7 +2196,7 @@ function formSubmitPayload(input, formSubmit, contractHash) {
|
|
|
2028
2196
|
// E.164 on the wire: it keys the customer and enhanced-conversion matching.
|
|
2029
2197
|
field("phone", "phone", "tel", "Phone", toE164(input.phone) ?? input.phone),
|
|
2030
2198
|
field("email", "email", "email", "Email", text(input.email)),
|
|
2031
|
-
field("service", "service", "select", "Service", input.services),
|
|
2199
|
+
field("service", "service", "select", "Service", [...input.services]),
|
|
2032
2200
|
field(
|
|
2033
2201
|
"vehicle",
|
|
2034
2202
|
"vehicle",
|
|
@@ -2053,6 +2221,14 @@ function formSubmitPayload(input, formSubmit, contractHash) {
|
|
|
2053
2221
|
const reported = new Set(entries.map((item) => item.name));
|
|
2054
2222
|
const fields = entries.filter((item) => item.value !== void 0);
|
|
2055
2223
|
const extra = (formSubmit.extraFields ?? []).filter((item) => !reported.has(item.name));
|
|
2224
|
+
const settings = typedClientSettings(formSubmit.tracking);
|
|
2225
|
+
const { violations, hash } = judgeLeadForm(
|
|
2226
|
+
"booking",
|
|
2227
|
+
formSubmit.formId,
|
|
2228
|
+
fields.map((item) => [item.role, item.value]),
|
|
2229
|
+
formSubmit.contracts,
|
|
2230
|
+
{ ...settings, trackingConfig: settings.trackingConfig ?? runtime?.ref }
|
|
2231
|
+
);
|
|
2056
2232
|
return {
|
|
2057
2233
|
form: {
|
|
2058
2234
|
id: formSubmit.formId,
|
|
@@ -2060,7 +2236,8 @@ function formSubmitPayload(input, formSubmit, contractHash) {
|
|
|
2060
2236
|
fields: [...fields, ...extra],
|
|
2061
2237
|
kind: "booking",
|
|
2062
2238
|
contract_version: LEAD_FORM_REGISTRY_VERSION,
|
|
2063
|
-
...
|
|
2239
|
+
...hash ? { contract_hash: hash } : {},
|
|
2240
|
+
...violations.length > 0 ? { contract_violations: violations.slice(0, MAX_CONTRACT_VIOLATIONS) } : {}
|
|
2064
2241
|
},
|
|
2065
2242
|
page: { path: typeof window === "undefined" ? "/" : window.location.pathname }
|
|
2066
2243
|
};
|
|
@@ -2159,10 +2336,9 @@ function createSalesBookingsClient(config, firing) {
|
|
|
2159
2336
|
}
|
|
2160
2337
|
if (formSubmit && !submittedForms.has(attemptKey)) {
|
|
2161
2338
|
submittedForms.add(attemptKey);
|
|
2162
|
-
const contract = runtime?.leadForms()?.contracts.find((c) => c.form_kind === "booking");
|
|
2163
2339
|
formSubmit.tracking.trackEvent(
|
|
2164
2340
|
"form_submit",
|
|
2165
|
-
formSubmitPayload(input, formSubmit,
|
|
2341
|
+
formSubmitPayload(input, formSubmit, runtime)
|
|
2166
2342
|
);
|
|
2167
2343
|
}
|
|
2168
2344
|
const body = {
|
|
@@ -2178,7 +2354,7 @@ function createSalesBookingsClient(config, firing) {
|
|
|
2178
2354
|
email: input.email?.trim() || null,
|
|
2179
2355
|
vehicle: input.vehicle ?? null,
|
|
2180
2356
|
drop_off: input.dropOff ?? null,
|
|
2181
|
-
services: input.services,
|
|
2357
|
+
services: [...input.services],
|
|
2182
2358
|
notes: input.notes?.trim() || null,
|
|
2183
2359
|
marketing_sms_consent: input.marketingSmsConsent === true,
|
|
2184
2360
|
page_path: typeof window === "undefined" ? null : window.location.pathname
|
|
@@ -2265,7 +2441,7 @@ function fireRecordedConversions(firing, input, recorded, sale, currency) {
|
|
|
2265
2441
|
}
|
|
2266
2442
|
function createSalesClient(config) {
|
|
2267
2443
|
if (config.firing) registerCapability("conversion_goals_manual");
|
|
2268
|
-
async function
|
|
2444
|
+
async function record4(input) {
|
|
2269
2445
|
const currency = input.currency ?? config.defaultCurrency;
|
|
2270
2446
|
if (!currency) {
|
|
2271
2447
|
throw new Error(
|
|
@@ -2291,9 +2467,9 @@ function createSalesClient(config) {
|
|
|
2291
2467
|
return sale;
|
|
2292
2468
|
}
|
|
2293
2469
|
return {
|
|
2294
|
-
record:
|
|
2470
|
+
record: record4,
|
|
2295
2471
|
// recordSale is the intent-revealing alias — same behavior, clearer call site.
|
|
2296
|
-
recordSale:
|
|
2472
|
+
recordSale: record4,
|
|
2297
2473
|
trackConversion(key, options) {
|
|
2298
2474
|
if (config.firing && "fireConversion" in config.firing) {
|
|
2299
2475
|
if (options?.userData && getConsentState() !== "denied") stashUserData(options.userData);
|
|
@@ -2413,17 +2589,17 @@ function createSalesClient(config) {
|
|
|
2413
2589
|
}
|
|
2414
2590
|
|
|
2415
2591
|
// ../tracking-core/src/resources/sales/schema.ts
|
|
2416
|
-
var
|
|
2592
|
+
var z5 = __toESM(require("zod/mini"));
|
|
2417
2593
|
|
|
2418
2594
|
// ../tracking-core/src/resources/sales/generated/zod.gen.ts
|
|
2419
|
-
var
|
|
2420
|
-
var zAutoLeapSaleFacts =
|
|
2421
|
-
first_order:
|
|
2422
|
-
fleet_customer:
|
|
2423
|
-
invoice_code:
|
|
2424
|
-
invoice_id:
|
|
2595
|
+
var z4 = __toESM(require("zod/mini"));
|
|
2596
|
+
var zAutoLeapSaleFacts = z4.object({
|
|
2597
|
+
first_order: z4.boolean(),
|
|
2598
|
+
fleet_customer: z4.boolean(),
|
|
2599
|
+
invoice_code: z4.string(),
|
|
2600
|
+
invoice_id: z4.string()
|
|
2425
2601
|
});
|
|
2426
|
-
var zErrorCode =
|
|
2602
|
+
var zErrorCode = z4.enum([
|
|
2427
2603
|
"missing_credentials",
|
|
2428
2604
|
"invalid_api_key",
|
|
2429
2605
|
"not_authenticated",
|
|
@@ -2467,37 +2643,37 @@ var zErrorCode = z3.enum([
|
|
|
2467
2643
|
"rate_limited",
|
|
2468
2644
|
"internal_error"
|
|
2469
2645
|
]);
|
|
2470
|
-
var zSaleItemEntitySchema =
|
|
2471
|
-
category:
|
|
2472
|
-
external_item_id:
|
|
2473
|
-
id:
|
|
2474
|
-
name:
|
|
2475
|
-
quantity:
|
|
2476
|
-
unit_cost_cents:
|
|
2477
|
-
unit_price_cents:
|
|
2646
|
+
var zSaleItemEntitySchema = z4.object({
|
|
2647
|
+
category: z4.nullable(z4.string()),
|
|
2648
|
+
external_item_id: z4.nullable(z4.string()),
|
|
2649
|
+
id: z4.uuid(),
|
|
2650
|
+
name: z4.nullable(z4.string()),
|
|
2651
|
+
quantity: z4.string().check(z4.regex(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)),
|
|
2652
|
+
unit_cost_cents: z4.nullable(z4.int()),
|
|
2653
|
+
unit_price_cents: z4.int()
|
|
2478
2654
|
});
|
|
2479
|
-
var zSaleItemInputSchema =
|
|
2480
|
-
category:
|
|
2481
|
-
external_item_id:
|
|
2482
|
-
name:
|
|
2483
|
-
quantity:
|
|
2484
|
-
unit_cost_cents:
|
|
2485
|
-
unit_price_cents:
|
|
2655
|
+
var zSaleItemInputSchema = z4.strictObject({
|
|
2656
|
+
category: z4.nullish(z4.string()),
|
|
2657
|
+
external_item_id: z4.nullish(z4.string()),
|
|
2658
|
+
name: z4.nullish(z4.string()),
|
|
2659
|
+
quantity: z4.string().check(z4.regex(/^\d+(\.\d{1,3})?$/)),
|
|
2660
|
+
unit_cost_cents: z4.nullish(z4.int().check(z4.gte(0))),
|
|
2661
|
+
unit_price_cents: z4.int().check(z4.gte(0))
|
|
2486
2662
|
});
|
|
2487
|
-
var zSaleServiceEntitySchema =
|
|
2488
|
-
amount_cents:
|
|
2489
|
-
id:
|
|
2490
|
-
mapped:
|
|
2491
|
-
service_id:
|
|
2492
|
-
service_key:
|
|
2493
|
-
service_label:
|
|
2663
|
+
var zSaleServiceEntitySchema = z4.object({
|
|
2664
|
+
amount_cents: z4.int(),
|
|
2665
|
+
id: z4.uuid(),
|
|
2666
|
+
mapped: z4.nullable(z4.boolean()),
|
|
2667
|
+
service_id: z4.uuid(),
|
|
2668
|
+
service_key: z4.string(),
|
|
2669
|
+
service_label: z4.string()
|
|
2494
2670
|
});
|
|
2495
|
-
var zSaleServiceInputSchema =
|
|
2496
|
-
amount_cents:
|
|
2497
|
-
service:
|
|
2671
|
+
var zSaleServiceInputSchema = z4.strictObject({
|
|
2672
|
+
amount_cents: z4.int().check(z4.gte(0)),
|
|
2673
|
+
service: z4.string()
|
|
2498
2674
|
});
|
|
2499
|
-
var zSaleSource =
|
|
2500
|
-
var zSmsAutomationState =
|
|
2675
|
+
var zSaleSource = z4.enum(["api", "admin", "autoleap"]);
|
|
2676
|
+
var zSmsAutomationState = z4.enum([
|
|
2501
2677
|
"needs_check",
|
|
2502
2678
|
"failed",
|
|
2503
2679
|
"undelivered",
|
|
@@ -2509,7 +2685,7 @@ var zSmsAutomationState = z3.enum([
|
|
|
2509
2685
|
"eligible",
|
|
2510
2686
|
"not_applicable"
|
|
2511
2687
|
]);
|
|
2512
|
-
var zSmsWithheldReason =
|
|
2688
|
+
var zSmsWithheldReason = z4.enum([
|
|
2513
2689
|
"automation_disabled",
|
|
2514
2690
|
"sms_disabled",
|
|
2515
2691
|
"no_phone",
|
|
@@ -2535,77 +2711,80 @@ var zSmsWithheldReason = z3.enum([
|
|
|
2535
2711
|
"confirmed_by_integration",
|
|
2536
2712
|
"test_or_bot_session",
|
|
2537
2713
|
"invalid_phone",
|
|
2538
|
-
"recently_texted"
|
|
2714
|
+
"recently_texted",
|
|
2715
|
+
"do_not_contact",
|
|
2716
|
+
"do_not_text_tag",
|
|
2717
|
+
"missing_value"
|
|
2539
2718
|
]);
|
|
2540
|
-
var zSaleSmsStatusSchema =
|
|
2541
|
-
can_send_now:
|
|
2542
|
-
last_message_at:
|
|
2543
|
-
reason_detail:
|
|
2719
|
+
var zSaleSmsStatusSchema = z4.object({
|
|
2720
|
+
can_send_now: z4._default(z4.boolean(), false),
|
|
2721
|
+
last_message_at: z4.nullable(z4.iso.datetime({ offset: true })),
|
|
2722
|
+
reason_detail: z4.nullable(z4.string()),
|
|
2544
2723
|
state: zSmsAutomationState,
|
|
2545
|
-
suppressed_by_other_sale:
|
|
2546
|
-
withheld_reason:
|
|
2724
|
+
suppressed_by_other_sale: z4._default(z4.boolean(), false),
|
|
2725
|
+
withheld_reason: z4.nullable(zSmsWithheldReason)
|
|
2547
2726
|
});
|
|
2548
|
-
var zSupportedCurrency =
|
|
2549
|
-
var zTrackingEnvironment =
|
|
2550
|
-
var zSaleCreateSchema =
|
|
2551
|
-
amount_total_cents:
|
|
2727
|
+
var zSupportedCurrency = z4.enum(["USD", "CAD"]);
|
|
2728
|
+
var zTrackingEnvironment = z4.enum(["production", "development"]);
|
|
2729
|
+
var zSaleCreateSchema = z4.strictObject({
|
|
2730
|
+
amount_total_cents: z4.nullish(z4.int().check(z4.gte(0))),
|
|
2552
2731
|
currency: zSupportedCurrency,
|
|
2553
|
-
customer_email:
|
|
2554
|
-
customer_name:
|
|
2555
|
-
customer_phone:
|
|
2556
|
-
description:
|
|
2557
|
-
environment:
|
|
2558
|
-
external_id:
|
|
2559
|
-
items:
|
|
2560
|
-
metadata:
|
|
2561
|
-
occurred_at:
|
|
2562
|
-
service:
|
|
2563
|
-
services:
|
|
2564
|
-
sms_consent:
|
|
2732
|
+
customer_email: z4.nullish(z4.email().check(z4.maxLength(320))),
|
|
2733
|
+
customer_name: z4.nullish(z4.string().check(z4.maxLength(200))),
|
|
2734
|
+
customer_phone: z4.nullish(z4.string().check(z4.maxLength(64))),
|
|
2735
|
+
description: z4.nullish(z4.string()),
|
|
2736
|
+
environment: z4._default(z4.optional(zTrackingEnvironment), "production"),
|
|
2737
|
+
external_id: z4.nullish(z4.string()),
|
|
2738
|
+
items: z4.optional(z4.array(zSaleItemInputSchema)),
|
|
2739
|
+
metadata: z4.nullish(z4.record(z4.string(), z4.unknown())),
|
|
2740
|
+
occurred_at: z4.iso.datetime({ offset: true }),
|
|
2741
|
+
service: z4.nullish(z4.string()),
|
|
2742
|
+
services: z4.nullish(z4.array(zSaleServiceInputSchema)),
|
|
2743
|
+
sms_consent: z4.nullish(z4.boolean())
|
|
2565
2744
|
});
|
|
2566
|
-
var zValidationError =
|
|
2567
|
-
ctx:
|
|
2568
|
-
input:
|
|
2569
|
-
loc:
|
|
2570
|
-
msg:
|
|
2571
|
-
type:
|
|
2745
|
+
var zValidationError = z4.object({
|
|
2746
|
+
ctx: z4.optional(z4.record(z4.string(), z4.unknown())),
|
|
2747
|
+
input: z4.optional(z4.unknown()),
|
|
2748
|
+
loc: z4.array(z4.union([z4.string(), z4.int()])),
|
|
2749
|
+
msg: z4.string(),
|
|
2750
|
+
type: z4.string()
|
|
2572
2751
|
});
|
|
2573
|
-
var zHttpValidationError =
|
|
2574
|
-
detail:
|
|
2752
|
+
var zHttpValidationError = z4.object({
|
|
2753
|
+
detail: z4.optional(z4.array(zValidationError))
|
|
2575
2754
|
});
|
|
2576
|
-
var zValidationErrorItem =
|
|
2577
|
-
loc:
|
|
2578
|
-
msg:
|
|
2579
|
-
type:
|
|
2755
|
+
var zValidationErrorItem = z4.object({
|
|
2756
|
+
loc: z4.array(z4.union([z4.string(), z4.int()])),
|
|
2757
|
+
msg: z4.string(),
|
|
2758
|
+
type: z4.string()
|
|
2580
2759
|
});
|
|
2581
|
-
var zApiErrorSchema =
|
|
2760
|
+
var zApiErrorSchema = z4.object({
|
|
2582
2761
|
code: zErrorCode,
|
|
2583
|
-
context:
|
|
2584
|
-
detail:
|
|
2585
|
-
errors:
|
|
2586
|
-
request_id:
|
|
2762
|
+
context: z4._default(z4.nullish(z4.record(z4.string(), z4.unknown())), null),
|
|
2763
|
+
detail: z4.string(),
|
|
2764
|
+
errors: z4._default(z4.nullish(z4.array(zValidationErrorItem)), null),
|
|
2765
|
+
request_id: z4._default(z4.nullish(z4.string()), null)
|
|
2587
2766
|
});
|
|
2588
|
-
var zWritebackEmailSource =
|
|
2589
|
-
var zWritebackEnrichmentStatus =
|
|
2590
|
-
var zWritebackSaleUploadCounts =
|
|
2591
|
-
failed:
|
|
2592
|
-
pending:
|
|
2593
|
-
skipped:
|
|
2594
|
-
submitted:
|
|
2595
|
-
total:
|
|
2596
|
-
uploaded:
|
|
2767
|
+
var zWritebackEmailSource = z4.enum(["NONE", "SALE", "CUSTOMER", "HARVESTED"]);
|
|
2768
|
+
var zWritebackEnrichmentStatus = z4.enum(["NONE", "MATCHED", "AMBIGUOUS"]);
|
|
2769
|
+
var zWritebackSaleUploadCounts = z4.object({
|
|
2770
|
+
failed: z4._default(z4.int(), 0),
|
|
2771
|
+
pending: z4._default(z4.int(), 0),
|
|
2772
|
+
skipped: z4._default(z4.int(), 0),
|
|
2773
|
+
submitted: z4._default(z4.int(), 0),
|
|
2774
|
+
total: z4._default(z4.int(), 0),
|
|
2775
|
+
uploaded: z4._default(z4.int(), 0)
|
|
2597
2776
|
});
|
|
2598
|
-
var zSaleWritebackStatusSchema =
|
|
2599
|
-
blocked_reason:
|
|
2600
|
-
can_dispatch:
|
|
2601
|
-
email_source:
|
|
2602
|
-
enrichment_status:
|
|
2603
|
-
gclid_attached:
|
|
2604
|
-
identifiers_sent:
|
|
2605
|
-
mapped_service_ids:
|
|
2606
|
-
matched_submit_count:
|
|
2607
|
-
needs_force:
|
|
2608
|
-
rollup:
|
|
2777
|
+
var zSaleWritebackStatusSchema = z4.object({
|
|
2778
|
+
blocked_reason: z4.nullable(z4.string()),
|
|
2779
|
+
can_dispatch: z4._default(z4.boolean(), false),
|
|
2780
|
+
email_source: z4.nullable(zWritebackEmailSource),
|
|
2781
|
+
enrichment_status: z4.nullable(zWritebackEnrichmentStatus),
|
|
2782
|
+
gclid_attached: z4._default(z4.boolean(), false),
|
|
2783
|
+
identifiers_sent: z4.nullable(z4.string()),
|
|
2784
|
+
mapped_service_ids: z4.array(z4.uuid()),
|
|
2785
|
+
matched_submit_count: z4.nullable(z4.int()),
|
|
2786
|
+
needs_force: z4._default(z4.boolean(), false),
|
|
2787
|
+
rollup: z4.enum([
|
|
2609
2788
|
"failed",
|
|
2610
2789
|
"skipped",
|
|
2611
2790
|
"pending",
|
|
@@ -2615,39 +2794,39 @@ var zSaleWritebackStatusSchema = z3.object({
|
|
|
2615
2794
|
"out_of_window",
|
|
2616
2795
|
"blocked"
|
|
2617
2796
|
]),
|
|
2618
|
-
stale:
|
|
2619
|
-
uncovered_service_ids:
|
|
2797
|
+
stale: z4._default(z4.boolean(), false),
|
|
2798
|
+
uncovered_service_ids: z4.array(z4.uuid()),
|
|
2620
2799
|
uploads: zWritebackSaleUploadCounts
|
|
2621
2800
|
});
|
|
2622
|
-
var zSaleEntitySchema =
|
|
2623
|
-
amount_total_cents:
|
|
2624
|
-
business_id:
|
|
2625
|
-
business_name:
|
|
2626
|
-
created_at:
|
|
2627
|
-
currency:
|
|
2628
|
-
customer_email:
|
|
2629
|
-
customer_name:
|
|
2630
|
-
customer_name_placeholder_confirmed:
|
|
2631
|
-
customer_name_placeholder_confirmed_at:
|
|
2632
|
-
customer_phone:
|
|
2633
|
-
description:
|
|
2801
|
+
var zSaleEntitySchema = z4.object({
|
|
2802
|
+
amount_total_cents: z4.int(),
|
|
2803
|
+
business_id: z4.uuid(),
|
|
2804
|
+
business_name: z4.nullable(z4.string()),
|
|
2805
|
+
created_at: z4.iso.datetime({ offset: true }),
|
|
2806
|
+
currency: z4.string(),
|
|
2807
|
+
customer_email: z4.nullable(z4.string()),
|
|
2808
|
+
customer_name: z4.nullable(z4.string()),
|
|
2809
|
+
customer_name_placeholder_confirmed: z4._default(z4.boolean(), false),
|
|
2810
|
+
customer_name_placeholder_confirmed_at: z4.nullable(z4.iso.datetime({ offset: true })),
|
|
2811
|
+
customer_phone: z4.nullable(z4.string()),
|
|
2812
|
+
description: z4.nullable(z4.string()),
|
|
2634
2813
|
environment: zTrackingEnvironment,
|
|
2635
|
-
external_id:
|
|
2636
|
-
id:
|
|
2637
|
-
items:
|
|
2638
|
-
metadata:
|
|
2639
|
-
occurred_at:
|
|
2640
|
-
service_id:
|
|
2641
|
-
service_key:
|
|
2642
|
-
service_label:
|
|
2643
|
-
services:
|
|
2644
|
-
sms_automation:
|
|
2645
|
-
sms_consent:
|
|
2646
|
-
sms_consent_granted_at:
|
|
2814
|
+
external_id: z4.nullable(z4.string()),
|
|
2815
|
+
id: z4.uuid(),
|
|
2816
|
+
items: z4.array(zSaleItemEntitySchema),
|
|
2817
|
+
metadata: z4.nullable(z4.record(z4.string(), z4.unknown())),
|
|
2818
|
+
occurred_at: z4.iso.datetime({ offset: true }),
|
|
2819
|
+
service_id: z4.nullable(z4.uuid()),
|
|
2820
|
+
service_key: z4.nullable(z4.string()),
|
|
2821
|
+
service_label: z4.nullable(z4.string()),
|
|
2822
|
+
services: z4.array(zSaleServiceEntitySchema),
|
|
2823
|
+
sms_automation: z4.nullable(zSaleSmsStatusSchema),
|
|
2824
|
+
sms_consent: z4._default(z4.boolean(), false),
|
|
2825
|
+
sms_consent_granted_at: z4.nullable(z4.iso.datetime({ offset: true })),
|
|
2647
2826
|
source: zSaleSource,
|
|
2648
|
-
source_facts:
|
|
2649
|
-
updated_at:
|
|
2650
|
-
writeback:
|
|
2827
|
+
source_facts: z4.nullable(zAutoLeapSaleFacts),
|
|
2828
|
+
updated_at: z4.iso.datetime({ offset: true }),
|
|
2829
|
+
writeback: z4.nullable(zSaleWritebackStatusSchema)
|
|
2651
2830
|
});
|
|
2652
2831
|
|
|
2653
2832
|
// ../tracking-core/src/resources/sales/schema.ts
|
|
@@ -2656,11 +2835,11 @@ var saleServiceSchema = zSaleServiceInputSchema;
|
|
|
2656
2835
|
var currencySchema = zSupportedCurrency;
|
|
2657
2836
|
var SUPPORTED_CURRENCIES = currencySchema.options;
|
|
2658
2837
|
var SALE_SOURCES = zSaleSource.options;
|
|
2659
|
-
var centsSchema =
|
|
2660
|
-
var metadataSchema =
|
|
2661
|
-
var customerNameSchema =
|
|
2662
|
-
var customerPhoneSchema =
|
|
2663
|
-
var customerEmailSchema =
|
|
2838
|
+
var centsSchema = z5.int().check(z5.gte(0));
|
|
2839
|
+
var metadataSchema = z5.record(z5.string(), z5.unknown());
|
|
2840
|
+
var customerNameSchema = z5.string().check(z5.maxLength(200));
|
|
2841
|
+
var customerPhoneSchema = z5.string().check(z5.maxLength(64));
|
|
2842
|
+
var customerEmailSchema = z5.email().check(z5.maxLength(320));
|
|
2664
2843
|
function addIssue(ctx, path, message) {
|
|
2665
2844
|
ctx.issues.push({ code: "custom", input: ctx.value, path, message });
|
|
2666
2845
|
}
|
|
@@ -2694,24 +2873,24 @@ function refineServiceXor(val, ctx, { requireAmount }) {
|
|
|
2694
2873
|
);
|
|
2695
2874
|
}
|
|
2696
2875
|
}
|
|
2697
|
-
var saleCreateSchema =
|
|
2698
|
-
var saleUpdateSchema =
|
|
2699
|
-
description:
|
|
2700
|
-
service:
|
|
2701
|
-
services:
|
|
2702
|
-
currency:
|
|
2703
|
-
amount_total_cents:
|
|
2704
|
-
occurred_at:
|
|
2705
|
-
items:
|
|
2706
|
-
metadata:
|
|
2707
|
-
customer_name:
|
|
2876
|
+
var saleCreateSchema = z5.extend(zSaleCreateSchema, { items: z5._default(z5.array(saleItemSchema), []) }).check((ctx) => refineServiceXor(ctx.value, ctx, { requireAmount: true }));
|
|
2877
|
+
var saleUpdateSchema = z5.strictObject({
|
|
2878
|
+
description: z5.nullish(z5.string()),
|
|
2879
|
+
service: z5.nullish(z5.string()),
|
|
2880
|
+
services: z5.nullish(z5.array(saleServiceSchema)),
|
|
2881
|
+
currency: z5.optional(currencySchema),
|
|
2882
|
+
amount_total_cents: z5.optional(centsSchema),
|
|
2883
|
+
occurred_at: z5.optional(z5.iso.datetime()),
|
|
2884
|
+
items: z5.optional(z5.array(saleItemSchema)),
|
|
2885
|
+
metadata: z5.nullish(metadataSchema),
|
|
2886
|
+
customer_name: z5.nullish(customerNameSchema),
|
|
2708
2887
|
// Re-attest when changing a filler-looking name; the server clears the
|
|
2709
2888
|
// prior attestation whenever `customer_name` changes.
|
|
2710
|
-
customer_name_placeholder_confirmed:
|
|
2711
|
-
customer_phone:
|
|
2712
|
-
customer_email:
|
|
2889
|
+
customer_name_placeholder_confirmed: z5.optional(z5.boolean()),
|
|
2890
|
+
customer_phone: z5.nullish(customerPhoneSchema),
|
|
2891
|
+
customer_email: z5.nullish(customerEmailSchema),
|
|
2713
2892
|
// NOT NULL server-side: omit to leave unchanged (explicit null is rejected).
|
|
2714
|
-
sms_consent:
|
|
2893
|
+
sms_consent: z5.optional(z5.boolean())
|
|
2715
2894
|
}).check((ctx) => refineServiceXor(ctx.value, ctx, { requireAmount: false }));
|
|
2716
2895
|
var TRACKING_RANGES = ["24h", "7d", "30d"];
|
|
2717
2896
|
var NAMED_RANGES = [
|
|
@@ -2738,23 +2917,6 @@ function phoneField(name, raw, country, label = null) {
|
|
|
2738
2917
|
return { name, type: "phone", label, value: toE164(raw, country) };
|
|
2739
2918
|
}
|
|
2740
2919
|
|
|
2741
|
-
// ../tracking-core/src/lead-forms/submit.ts
|
|
2742
|
-
var import_mini = require("zod/mini");
|
|
2743
|
-
var KNOWN_ROLES = new Set(LEAD_FORM_ROLES);
|
|
2744
|
-
var ROLE_ORDER = new Map(LEAD_FORM_ROLES.map((role, index) => [role, index]));
|
|
2745
|
-
function slotFields(dateTime) {
|
|
2746
|
-
const written = /^(\d{4}-\d{2}-\d{2})[T ](\d{2}:\d{2})(?::\d{2}(?:\.\d+)?)?$/.exec(dateTime);
|
|
2747
|
-
if (!written) {
|
|
2748
|
-
throw new TypeError(
|
|
2749
|
-
`slotFields needs the slot's wall time without an offset ("2026-10-13T09:30"), got "${dateTime}"`
|
|
2750
|
-
);
|
|
2751
|
-
}
|
|
2752
|
-
return { preferred_date: written[1], preferred_time: { start: written[2], end: null } };
|
|
2753
|
-
}
|
|
2754
|
-
function timeWindow(start, end, label) {
|
|
2755
|
-
return { start, end: end ?? null, ...label ? { label } : {} };
|
|
2756
|
-
}
|
|
2757
|
-
|
|
2758
2920
|
// src/index.ts
|
|
2759
2921
|
var import_client2 = require("@aranova/tracking-react/client");
|
|
2760
2922
|
var import_client3 = require("@aranova/tracking-react/client");
|