@evinvest/sites-contract 0.0.0-stage → 0.1.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 +25 -2
- package/dist/booking.d.ts +44 -0
- package/dist/booking.js +137 -0
- package/dist/experiments.d.ts +18 -0
- package/dist/experiments.js +56 -0
- package/dist/generated/booking.d.ts +12 -0
- package/dist/generated/booking.js +11 -0
- package/dist/generated/codes.d.ts +6 -0
- package/dist/generated/codes.js +4 -0
- package/dist/generated/experiments.d.ts +7 -0
- package/dist/generated/experiments.js +8 -0
- package/dist/generated/lead.d.ts +13 -0
- package/dist/generated/lead.js +10 -0
- package/dist/generated/place.d.ts +15 -0
- package/dist/generated/place.js +15 -0
- package/dist/generated/pricing.d.ts +16 -0
- package/dist/generated/pricing.js +16 -0
- package/dist/generated/types.d.ts +234 -0
- package/dist/generated/types.js +2 -0
- package/dist/generated/wire.d.ts +502 -0
- package/dist/generated/wire.js +3 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +13 -0
- package/dist/ingest.d.ts +51 -0
- package/dist/ingest.js +45 -0
- package/dist/phone.d.ts +22 -0
- package/dist/phone.js +76 -0
- package/dist/place.d.ts +23 -0
- package/dist/place.js +280 -0
- package/dist/pricing.d.ts +72 -0
- package/dist/pricing.js +273 -0
- package/dist/text.d.ts +11 -0
- package/dist/text.js +19 -0
- package/package.json +41 -4
package/README.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @evinvest/sites-contract
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Service-Arb sites ↔ panel contract, in TS: what a landing reads from the panel and sends
|
|
4
|
+
to it. Its source is the panel — `crates/panel_core` and `contracts/proto/sa/v1` in
|
|
5
|
+
[EV-Service-Arb/sites_panel](https://github.com/EV-Service-Arb/sites_panel) — and this is its
|
|
6
|
+
only TS form. No runtime dependencies, no Node imports: it is bundled into landing pages and
|
|
7
|
+
the panel's front end.
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
src/generated/contract.ts panel_core's shapes, vocabularies and limits (`nix run .#gen`)
|
|
11
|
+
src/generated/wire.ts the protos as protojson: the envelope, every type's properties
|
|
12
|
+
src/*.ts the one TS implementation of what both sides run, held to
|
|
13
|
+
contracts/vectors with panel_core:
|
|
14
|
+
pricing checkPricingModel, priceOf
|
|
15
|
+
booking checkBookingConfig, checkBookingUrl, bookingRequested, isLeadRef
|
|
16
|
+
place checkPlaceLive: a place's live settings, field by field
|
|
17
|
+
phone normalizePhone, phoneProblem
|
|
18
|
+
ingest siteEvent, ingestBody, uuidV7, isOpaqueId: the only way a site builds an event
|
|
19
|
+
experiments parseLiveExperiments, declarationProblem
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Checks answer `{ path, code }` problems, never words: a site logs them, the panel's editor says
|
|
23
|
+
each code in its own copy.
|
|
24
|
+
|
|
25
|
+
Release: bump `version`, commit, push the tag `@evinvest/sites-contract-v<version>`; CI
|
|
26
|
+
(`release-npm.yml`) publishes it.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type DayPart } from "./generated/booking.js";
|
|
2
|
+
import type { BookingCode } from "./generated/codes.js";
|
|
3
|
+
import type { BookingConfig, BookingProvider, PageProvider } from "./generated/types.js";
|
|
4
|
+
import type { BookingRequestedV1 } from "./generated/wire.js";
|
|
5
|
+
/** One thing wrong with a place's `booking`: where below it (`""`, `default`, `providers.cal_com.url`) and why. */
|
|
6
|
+
export interface BookingProblem {
|
|
7
|
+
path: string;
|
|
8
|
+
code: BookingCode;
|
|
9
|
+
}
|
|
10
|
+
export declare const isBookingProvider: (v: unknown) => v is BookingProvider;
|
|
11
|
+
export declare const isPageProvider: (v: unknown) => v is PageProvider;
|
|
12
|
+
/** `lead-<row>-<8 lowercase hex>`, the row 1 or more: the panel's lead id for a site's lead. */
|
|
13
|
+
export declare const isLeadRef: (v: unknown) => v is string;
|
|
14
|
+
/**
|
|
15
|
+
* Why `url` may not be `provider`'s booking page, or `null` (`contracts/vectors/booking/README.md`,
|
|
16
|
+
* normative): at most 2048 printable ASCII; the literal `https://`; no `#` and no `\`; an
|
|
17
|
+
* authority without `@`, `:` or `[`; a dotted DNS name whose last label is not a number; then
|
|
18
|
+
* the provider's own rule.
|
|
19
|
+
*/
|
|
20
|
+
export declare function checkBookingUrl(provider: PageProvider, url: string): BookingCode | null;
|
|
21
|
+
/**
|
|
22
|
+
* A place's `booking` checked whole: every problem, and the config when there is none. `manual`
|
|
23
|
+
* is always available, so never a key of `providers`; the default is `manual` or one of them.
|
|
24
|
+
*/
|
|
25
|
+
export declare function checkBookingConfig(v: unknown): {
|
|
26
|
+
problems: BookingProblem[];
|
|
27
|
+
config: BookingConfig | null;
|
|
28
|
+
};
|
|
29
|
+
/** `booking.requested@1`'s properties, their vocabularies as the panel checks them. */
|
|
30
|
+
export type BookingRequested = BookingRequestedV1 & {
|
|
31
|
+
provider: BookingProvider;
|
|
32
|
+
preferred_part?: DayPart;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* `booking.requested@1`'s properties, or `null` when the panel would refuse them: a lead ref, a
|
|
36
|
+
* provider and, with `manual` only, a day and a part of the day. No null, nothing else, no free
|
|
37
|
+
* text.
|
|
38
|
+
*/
|
|
39
|
+
export declare function bookingRequested(v: unknown): BookingRequested | null;
|
|
40
|
+
/**
|
|
41
|
+
* Whether a visitor's preferred day may be asked for on `today` (both `YYYY-MM-DD`): two days
|
|
42
|
+
* back (clocks, an outbox's delay) to a year and a day ahead. The panel checks it on arrival.
|
|
43
|
+
*/
|
|
44
|
+
export declare function preferredDateInWindow(day: string, today: string): boolean;
|
package/dist/booking.js
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { BOOKING_LIMITS as LIMIT, BOOKING_PROVIDERS, DAY_PARTS, PAGE_PROVIDERS } from "./generated/booking.js";
|
|
2
|
+
import { at, isDate, isObject } from "./text.js";
|
|
3
|
+
export const isBookingProvider = (v) => BOOKING_PROVIDERS.some(p => p === v);
|
|
4
|
+
export const isPageProvider = (v) => PAGE_PROVIDERS.some(p => p === v);
|
|
5
|
+
const LEAD_REF = new RegExp(LIMIT.leadRef);
|
|
6
|
+
const CAL_SEGMENT = new RegExp(LIMIT.calComSegment);
|
|
7
|
+
const LABEL = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?$/;
|
|
8
|
+
const APPOINTMENTS = "/calendar/appointments/";
|
|
9
|
+
/** `lead-<row>-<8 lowercase hex>`, the row 1 or more: the panel's lead id for a site's lead. */
|
|
10
|
+
export const isLeadRef = (v) => typeof v === "string" && LEAD_REF.test(v);
|
|
11
|
+
/**
|
|
12
|
+
* Why `url` may not be `provider`'s booking page, or `null` (`contracts/vectors/booking/README.md`,
|
|
13
|
+
* normative): at most 2048 printable ASCII; the literal `https://`; no `#` and no `\`; an
|
|
14
|
+
* authority without `@`, `:` or `[`; a dotted DNS name whose last label is not a number; then
|
|
15
|
+
* the provider's own rule.
|
|
16
|
+
*/
|
|
17
|
+
export function checkBookingUrl(provider, url) {
|
|
18
|
+
if (url.length === 0 || url.length > LIMIT.maxUrl || !/^[\x21-\x7e]+$/.test(url))
|
|
19
|
+
return "format";
|
|
20
|
+
if (!url.startsWith("https://"))
|
|
21
|
+
return "scheme";
|
|
22
|
+
if (url.includes("#"))
|
|
23
|
+
return "fragment";
|
|
24
|
+
if (url.includes("\\"))
|
|
25
|
+
return "backslash";
|
|
26
|
+
const rest = url.slice("https://".length);
|
|
27
|
+
const split = rest.search(/[/?]/);
|
|
28
|
+
const host = split < 0 ? rest : rest.slice(0, split);
|
|
29
|
+
if (host.includes("@"))
|
|
30
|
+
return "userinfo";
|
|
31
|
+
if (host.startsWith("["))
|
|
32
|
+
return "ip";
|
|
33
|
+
if (host.includes(":"))
|
|
34
|
+
return "port";
|
|
35
|
+
const labels = host.split(".");
|
|
36
|
+
if (host.length > 253 || labels.length < 2 || !labels.every(l => LABEL.test(l)))
|
|
37
|
+
return "host";
|
|
38
|
+
const last = (labels.at(-1) ?? "").toLowerCase();
|
|
39
|
+
// A WHATWG parser reads a host whose last label is a number as an IPv4 address.
|
|
40
|
+
if (/^\d+$/.test(last) || last.startsWith("0x"))
|
|
41
|
+
return "ip";
|
|
42
|
+
const name = host.toLowerCase();
|
|
43
|
+
const path = (split < 0 ? "" : rest.slice(split)).split("?")[0] ?? "";
|
|
44
|
+
switch (provider) {
|
|
45
|
+
case "link":
|
|
46
|
+
return null;
|
|
47
|
+
case "google_calendar":
|
|
48
|
+
return (name === "calendar.app.google" && path.length > 1) || (name === "calendar.google.com" && path.length > APPOINTMENTS.length && path.startsWith(APPOINTMENTS)) ? null : "google";
|
|
49
|
+
case "cal_com": {
|
|
50
|
+
if (!LIMIT.calComHosts.some(h => h === name))
|
|
51
|
+
return "cal_host";
|
|
52
|
+
const segments = path.replace(/^\//, "").split("/");
|
|
53
|
+
return path.startsWith("/") && segments.length === 2 && segments.every(s => CAL_SEGMENT.test(s)) ? null : "cal_path";
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A place's `booking` checked whole: every problem, and the config when there is none. `manual`
|
|
59
|
+
* is always available, so never a key of `providers`; the default is `manual` or one of them.
|
|
60
|
+
*/
|
|
61
|
+
export function checkBookingConfig(v) {
|
|
62
|
+
const problems = [];
|
|
63
|
+
const fail = (path, code) => problems.push({ path, code });
|
|
64
|
+
if (!isObject(v))
|
|
65
|
+
return { problems: [{ path: "", code: "shape" }], config: null };
|
|
66
|
+
if (Object.keys(v).some(k => k !== "default" && k !== "providers"))
|
|
67
|
+
fail("", "unknown_key");
|
|
68
|
+
const def = isBookingProvider(v.default) ? v.default : null;
|
|
69
|
+
if (!Object.hasOwn(v, "default"))
|
|
70
|
+
fail("default", "required");
|
|
71
|
+
else if (def === null)
|
|
72
|
+
fail("default", "default_unknown");
|
|
73
|
+
const providers = {};
|
|
74
|
+
if (!Object.hasOwn(v, "providers"))
|
|
75
|
+
fail("providers", "required");
|
|
76
|
+
else if (!isObject(v.providers))
|
|
77
|
+
fail("providers", "shape");
|
|
78
|
+
else
|
|
79
|
+
for (const [name, conf] of Object.entries(v.providers)) {
|
|
80
|
+
const path = at("providers", name);
|
|
81
|
+
if (!isBookingProvider(name))
|
|
82
|
+
fail(path, "provider_unknown");
|
|
83
|
+
else if (!isObject(conf))
|
|
84
|
+
fail(path, "provider_shape");
|
|
85
|
+
else if (Object.keys(conf).some(k => k !== "url"))
|
|
86
|
+
fail(path, "provider_extra");
|
|
87
|
+
else if (!isPageProvider(name))
|
|
88
|
+
fail(path, "manual");
|
|
89
|
+
else if (!Object.hasOwn(conf, "url"))
|
|
90
|
+
fail(at(path, "url"), "required");
|
|
91
|
+
else if (typeof conf.url !== "string")
|
|
92
|
+
fail(at(path, "url"), "url_type");
|
|
93
|
+
else {
|
|
94
|
+
const bad = checkBookingUrl(name, conf.url);
|
|
95
|
+
if (bad)
|
|
96
|
+
fail(at(path, "url"), bad);
|
|
97
|
+
else
|
|
98
|
+
providers[name] = { url: conf.url };
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// A default whose own entry is refused is blamed there, not twice.
|
|
102
|
+
if (isPageProvider(def) && !Object.hasOwn(providers, def) && !problems.some(p => p.path.startsWith(at("providers", def))))
|
|
103
|
+
fail("default", "default_unset");
|
|
104
|
+
return problems.length > 0 || def === null ? { problems, config: null } : { problems, config: { default: def, providers } };
|
|
105
|
+
}
|
|
106
|
+
const isDayPart = (v) => DAY_PARTS.some(p => p === v);
|
|
107
|
+
/**
|
|
108
|
+
* `booking.requested@1`'s properties, or `null` when the panel would refuse them: a lead ref, a
|
|
109
|
+
* provider and, with `manual` only, a day and a part of the day. No null, nothing else, no free
|
|
110
|
+
* text.
|
|
111
|
+
*/
|
|
112
|
+
export function bookingRequested(v) {
|
|
113
|
+
if (!isObject(v) || Object.entries(v).some(([k, x]) => x === null || !["lead_ref", "provider", "preferred_date", "preferred_part"].includes(k)))
|
|
114
|
+
return null;
|
|
115
|
+
const { lead_ref, provider, preferred_date, preferred_part } = v;
|
|
116
|
+
if (!isLeadRef(lead_ref) || !isBookingProvider(provider))
|
|
117
|
+
return null;
|
|
118
|
+
if ((preferred_date !== undefined && !isDate(preferred_date)) || (preferred_part !== undefined && !isDayPart(preferred_part)))
|
|
119
|
+
return null;
|
|
120
|
+
if (provider !== "manual" && (preferred_date !== undefined || preferred_part !== undefined))
|
|
121
|
+
return null;
|
|
122
|
+
return {
|
|
123
|
+
lead_ref,
|
|
124
|
+
provider,
|
|
125
|
+
...(preferred_date !== undefined ? { preferred_date } : {}),
|
|
126
|
+
...(preferred_part !== undefined ? { preferred_part } : {}),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
const DAY_MS = 86_400_000;
|
|
130
|
+
/**
|
|
131
|
+
* Whether a visitor's preferred day may be asked for on `today` (both `YYYY-MM-DD`): two days
|
|
132
|
+
* back (clocks, an outbox's delay) to a year and a day ahead. The panel checks it on arrival.
|
|
133
|
+
*/
|
|
134
|
+
export function preferredDateInWindow(day, today) {
|
|
135
|
+
const days = (Date.parse(`${day}T00:00:00Z`) - Date.parse(`${today}T00:00:00Z`)) / DAY_MS;
|
|
136
|
+
return days >= -2 && days <= 366;
|
|
137
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { LiveExperiments } from "./generated/types.js";
|
|
2
|
+
import type { ExperimentDeclaration } from "./generated/wire.js";
|
|
3
|
+
/**
|
|
4
|
+
* The panel's answer to `GET …/brands/{brand}/experiments`, or `null` when it is not one: an
|
|
5
|
+
* override whose field has another type is not the panel's. Fields the panel added since are
|
|
6
|
+
* passed over. Whether an override fits the experiment in code (weights of the right length, a
|
|
7
|
+
* holdout in `[0, 1)`) is `applyOverrides`' call: only it knows the code's variants.
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseLiveExperiments(body: unknown): LiveExperiments | null;
|
|
10
|
+
/** Why the panel would refuse an experiment as declared. */
|
|
11
|
+
export type DeclarationProblem = "key" | "variants" | "variant" | "duplicate_variant" | "weights" | "holdout" | "summary";
|
|
12
|
+
/**
|
|
13
|
+
* Why the panel would refuse this experiment of `experiments.declared@1`, or `null`
|
|
14
|
+
* (`contracts/vectors/ingest/declarations.json`): a key; 2 to 32 variants, unique, each a slug;
|
|
15
|
+
* one weight per variant, each ≥ 0, their sum > 0; a holdout in `[0, 1)`; a summary of at most
|
|
16
|
+
* 200 characters once trimmed.
|
|
17
|
+
*/
|
|
18
|
+
export declare function declarationProblem(d: ExperimentDeclaration): DeclarationProblem | null;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { EXPERIMENT_LIMITS } from "./generated/experiments.js";
|
|
2
|
+
import { charCount, isObject, trim } from "./text.js";
|
|
3
|
+
/**
|
|
4
|
+
* The panel's answer to `GET …/brands/{brand}/experiments`, or `null` when it is not one: an
|
|
5
|
+
* override whose field has another type is not the panel's. Fields the panel added since are
|
|
6
|
+
* passed over. Whether an override fits the experiment in code (weights of the right length, a
|
|
7
|
+
* holdout in `[0, 1)`) is `applyOverrides`' call: only it knows the code's variants.
|
|
8
|
+
*/
|
|
9
|
+
export function parseLiveExperiments(body) {
|
|
10
|
+
if (!isObject(body) || !isObject(body.experiments))
|
|
11
|
+
return null;
|
|
12
|
+
const experiments = {};
|
|
13
|
+
for (const [key, entry] of Object.entries(body.experiments)) {
|
|
14
|
+
if (!isObject(entry))
|
|
15
|
+
return null;
|
|
16
|
+
const { enabled, weights, holdout } = entry;
|
|
17
|
+
if (enabled !== undefined && typeof enabled !== "boolean")
|
|
18
|
+
return null;
|
|
19
|
+
if (weights !== undefined && !(Array.isArray(weights) && weights.every(w => typeof w === "number")))
|
|
20
|
+
return null;
|
|
21
|
+
if (holdout !== undefined && typeof holdout !== "number")
|
|
22
|
+
return null;
|
|
23
|
+
experiments[key] = {
|
|
24
|
+
...(enabled !== undefined ? { enabled } : {}),
|
|
25
|
+
...(weights !== undefined ? { weights } : {}),
|
|
26
|
+
...(holdout !== undefined ? { holdout } : {}),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return { experiments };
|
|
30
|
+
}
|
|
31
|
+
const KEY = new RegExp(EXPERIMENT_LIMITS.key);
|
|
32
|
+
const VARIANT = new RegExp(EXPERIMENT_LIMITS.variant);
|
|
33
|
+
/**
|
|
34
|
+
* Why the panel would refuse this experiment of `experiments.declared@1`, or `null`
|
|
35
|
+
* (`contracts/vectors/ingest/declarations.json`): a key; 2 to 32 variants, unique, each a slug;
|
|
36
|
+
* one weight per variant, each ≥ 0, their sum > 0; a holdout in `[0, 1)`; a summary of at most
|
|
37
|
+
* 200 characters once trimmed.
|
|
38
|
+
*/
|
|
39
|
+
export function declarationProblem(d) {
|
|
40
|
+
if (!KEY.test(d.key))
|
|
41
|
+
return "key";
|
|
42
|
+
if (d.variants.length < 2 || d.variants.length > EXPERIMENT_LIMITS.maxVariants)
|
|
43
|
+
return "variants";
|
|
44
|
+
if (!d.variants.every(v => VARIANT.test(v)))
|
|
45
|
+
return "variant";
|
|
46
|
+
if (new Set(d.variants).size !== d.variants.length)
|
|
47
|
+
return "duplicate_variant";
|
|
48
|
+
const weightsOk = d.weights.length === d.variants.length && d.weights.every(w => Number.isFinite(w) && w >= 0) && d.weights.reduce((a, b) => a + b, 0) > 0;
|
|
49
|
+
if (!weightsOk)
|
|
50
|
+
return "weights";
|
|
51
|
+
if (d.holdout !== undefined && !(Number.isFinite(d.holdout) && d.holdout >= 0 && d.holdout < 1))
|
|
52
|
+
return "holdout";
|
|
53
|
+
if (d.summary !== undefined && charCount(trim(d.summary)) > EXPERIMENT_LIMITS.maxSummary)
|
|
54
|
+
return "summary";
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const BOOKING_PROVIDERS: readonly ["manual", "link", "google_calendar", "cal_com"];
|
|
2
|
+
export declare const PAGE_PROVIDERS: readonly ["link", "google_calendar", "cal_com"];
|
|
3
|
+
export declare const BOOKING_LIMITS: {
|
|
4
|
+
readonly calComHosts: readonly ["cal.evinvest.ltd", "cal.com"];
|
|
5
|
+
readonly calComSegment: "^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$";
|
|
6
|
+
readonly leadRef: "^lead-[1-9][0-9]{0,18}-[0-9a-f]{8}$";
|
|
7
|
+
readonly maxUrl: 2048;
|
|
8
|
+
};
|
|
9
|
+
export declare const BOOKING_STATUSES: readonly ["none", "requested", "booked", "canceled", "done", "no_show"];
|
|
10
|
+
export type BookingStatus = (typeof BOOKING_STATUSES)[number];
|
|
11
|
+
export declare const DAY_PARTS: readonly ["morning", "afternoon", "evening"];
|
|
12
|
+
export type DayPart = (typeof DAY_PARTS)[number];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// AUTO-GENERATED by `nix run .#gen` — do not edit.
|
|
2
|
+
export const BOOKING_PROVIDERS = ["manual", "link", "google_calendar", "cal_com"];
|
|
3
|
+
export const PAGE_PROVIDERS = ["link", "google_calendar", "cal_com"];
|
|
4
|
+
export const BOOKING_LIMITS = {
|
|
5
|
+
"calComHosts": ["cal.evinvest.ltd", "cal.com"],
|
|
6
|
+
"calComSegment": "^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$",
|
|
7
|
+
"leadRef": "^lead-[1-9][0-9]{0,18}-[0-9a-f]{8}$",
|
|
8
|
+
"maxUrl": 2048,
|
|
9
|
+
};
|
|
10
|
+
export const BOOKING_STATUSES = ["none", "requested", "booked", "canceled", "done", "no_show"];
|
|
11
|
+
export const DAY_PARTS = ["morning", "afternoon", "evening"];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const PRICING_CODES: readonly ["object", "missing", "unknownField", "format", "currency", "date", "int", "slug", "labels", "locale", "label", "list", "duplicate", "kind", "needKind", "noInput", "dearest", "labelMissing"];
|
|
2
|
+
export type PricingCode = (typeof PRICING_CODES)[number];
|
|
3
|
+
export declare const BOOKING_CODES: readonly ["shape", "unknown_key", "required", "provider_unknown", "provider_shape", "provider_extra", "manual", "url_type", "default_unknown", "default_unset", "format", "scheme", "fragment", "backslash", "userinfo", "ip", "port", "host", "google", "cal_host", "cal_path"];
|
|
4
|
+
export type BookingCode = (typeof BOOKING_CODES)[number];
|
|
5
|
+
export declare const PLACE_CODES: readonly ["object", "unknown_field", "required", "type", "blank", "too_long", "control", "e164", "telegram_bot", "messenger_unknown", "boolean", "shape", "empty", "too_many", "day", "duplicate", "time", "closes_before_opens", "postal_code", "coordinate", "https_url", "review_url", "locale", "rating_value", "rating_count", "instant"];
|
|
6
|
+
export type PlaceCode = (typeof PLACE_CODES)[number];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// AUTO-GENERATED by `nix run .#gen` — do not edit.
|
|
2
|
+
export const PRICING_CODES = ["object", "missing", "unknownField", "format", "currency", "date", "int", "slug", "labels", "locale", "label", "list", "duplicate", "kind", "needKind", "noInput", "dearest", "labelMissing"];
|
|
3
|
+
export const BOOKING_CODES = ["shape", "unknown_key", "required", "provider_unknown", "provider_shape", "provider_extra", "manual", "url_type", "default_unknown", "default_unset", "format", "scheme", "fragment", "backslash", "userinfo", "ip", "port", "host", "google", "cal_host", "cal_path"];
|
|
4
|
+
export const PLACE_CODES = ["object", "unknown_field", "required", "type", "blank", "too_long", "control", "e164", "telegram_bot", "messenger_unknown", "boolean", "shape", "empty", "too_many", "day", "duplicate", "time", "closes_before_opens", "postal_code", "coordinate", "https_url", "review_url", "locale", "rating_value", "rating_count", "instant"];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const LEAD_LIMITS: {
|
|
2
|
+
readonly analyticsId: "^[A-Za-z0-9._:-]{1,128}$";
|
|
3
|
+
readonly maxEstimateInputs: 12;
|
|
4
|
+
readonly messageRef: "^[A-Z]{2,4}-[0-9A-HJKMNP-TV-Z]{4,8}$";
|
|
5
|
+
};
|
|
6
|
+
export declare const LEAD_CHANNELS: readonly ["form", "phone_inbound", "callback", "whatsapp", "telegram"];
|
|
7
|
+
export type LeadChannel = (typeof LEAD_CHANNELS)[number];
|
|
8
|
+
export declare const SITE_CHANNELS: readonly ["form", "callback", "whatsapp", "telegram"];
|
|
9
|
+
export type SiteChannel = (typeof SITE_CHANNELS)[number];
|
|
10
|
+
export declare const LEAD_SUSPECTS: readonly ["rate_limited", "too_fast"];
|
|
11
|
+
export type LeadSuspect = (typeof LEAD_SUSPECTS)[number];
|
|
12
|
+
export declare const LEAD_FLOWS: readonly ["quote", "estimate", "fixed"];
|
|
13
|
+
export type LeadFlow = (typeof LEAD_FLOWS)[number];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// AUTO-GENERATED by `nix run .#gen` — do not edit.
|
|
2
|
+
export const LEAD_LIMITS = {
|
|
3
|
+
"analyticsId": "^[A-Za-z0-9._:-]{1,128}$",
|
|
4
|
+
"maxEstimateInputs": 12,
|
|
5
|
+
"messageRef": "^[A-Z]{2,4}-[0-9A-HJKMNP-TV-Z]{4,8}$",
|
|
6
|
+
};
|
|
7
|
+
export const LEAD_CHANNELS = ["form", "phone_inbound", "callback", "whatsapp", "telegram"];
|
|
8
|
+
export const SITE_CHANNELS = ["form", "callback", "whatsapp", "telegram"];
|
|
9
|
+
export const LEAD_SUSPECTS = ["rate_limited", "too_fast"];
|
|
10
|
+
export const LEAD_FLOWS = ["quote", "estimate", "fixed"];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const DAYS: readonly ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
|
|
2
|
+
export declare const MESSENGERS: readonly ["whatsapp", "telegram"];
|
|
3
|
+
export declare const PLACE_FIELDS: readonly ["phone", "whatsapp", "telegram", "messengers", "hours", "serviceArea", "address", "geo", "storefrontPhoto", "landmark", "rating", "booking", "reviewUrl"];
|
|
4
|
+
export type PlaceField = (typeof PLACE_FIELDS)[number];
|
|
5
|
+
export declare const PLACE_LIMITS: {
|
|
6
|
+
readonly e164: "^\\+[1-9][0-9]{6,14}$";
|
|
7
|
+
readonly maxArea: 200;
|
|
8
|
+
readonly maxHours: 14;
|
|
9
|
+
readonly maxLocales: 8;
|
|
10
|
+
readonly maxText: 200;
|
|
11
|
+
readonly maxUrl: 2048;
|
|
12
|
+
readonly reviewHosts: readonly ["g.page", "search.google.com"];
|
|
13
|
+
readonly telegramBot: "^[A-Za-z][A-Za-z0-9_]{1,28}[Bb][Oo][Tt]$";
|
|
14
|
+
readonly time: "^([01][0-9]|2[0-3]):[0-5][0-9]$";
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// AUTO-GENERATED by `nix run .#gen` — do not edit.
|
|
2
|
+
export const DAYS = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
|
|
3
|
+
export const MESSENGERS = ["whatsapp", "telegram"];
|
|
4
|
+
export const PLACE_FIELDS = ["phone", "whatsapp", "telegram", "messengers", "hours", "serviceArea", "address", "geo", "storefrontPhoto", "landmark", "rating", "booking", "reviewUrl"];
|
|
5
|
+
export const PLACE_LIMITS = {
|
|
6
|
+
"e164": "^\\+[1-9][0-9]{6,14}$",
|
|
7
|
+
"maxArea": 200,
|
|
8
|
+
"maxHours": 14,
|
|
9
|
+
"maxLocales": 8,
|
|
10
|
+
"maxText": 200,
|
|
11
|
+
"maxUrl": 2048,
|
|
12
|
+
"reviewHosts": ["g.page", "search.google.com"],
|
|
13
|
+
"telegramBot": "^[A-Za-z][A-Za-z0-9_]{1,28}[Bb][Oo][Tt]$",
|
|
14
|
+
"time": "^([01][0-9]|2[0-3]):[0-5][0-9]$",
|
|
15
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const PRICING_FORMAT = 1;
|
|
2
|
+
export declare const PRICING_CURRENCY = "EUR";
|
|
3
|
+
export declare const PRICING_LIMITS: {
|
|
4
|
+
readonly locale: "^[a-z]{2}(-[A-Z]{2})?$";
|
|
5
|
+
readonly maxDiscountBp: 10000;
|
|
6
|
+
readonly maxInputs: 32;
|
|
7
|
+
readonly maxLabel: 120;
|
|
8
|
+
readonly maxMultiplyBp: 100000;
|
|
9
|
+
readonly maxNeedInputs: 12;
|
|
10
|
+
readonly maxNeeds: 64;
|
|
11
|
+
readonly maxOptions: 32;
|
|
12
|
+
readonly maxPriceCents: 100000000;
|
|
13
|
+
readonly slug: "^[a-z0-9_-]{1,40}$";
|
|
14
|
+
};
|
|
15
|
+
export declare const INPUT_KINDS: readonly ["add", "multiply", "discount"];
|
|
16
|
+
export type PricingInputKind = (typeof INPUT_KINDS)[number];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// AUTO-GENERATED by `nix run .#gen` — do not edit.
|
|
2
|
+
export const PRICING_FORMAT = 1;
|
|
3
|
+
export const PRICING_CURRENCY = "EUR";
|
|
4
|
+
export const PRICING_LIMITS = {
|
|
5
|
+
"locale": "^[a-z]{2}(-[A-Z]{2})?$",
|
|
6
|
+
"maxDiscountBp": 10000,
|
|
7
|
+
"maxInputs": 32,
|
|
8
|
+
"maxLabel": 120,
|
|
9
|
+
"maxMultiplyBp": 100000,
|
|
10
|
+
"maxNeedInputs": 12,
|
|
11
|
+
"maxNeeds": 64,
|
|
12
|
+
"maxOptions": 32,
|
|
13
|
+
"maxPriceCents": 100000000,
|
|
14
|
+
"slug": "^[a-z0-9_-]{1,40}$",
|
|
15
|
+
};
|
|
16
|
+
export const INPUT_KINDS = ["add", "multiply", "discount"];
|