@businessdash/sdk 0.9.60
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/LICENSE +21 -0
- package/README.md +899 -0
- package/dist/adapters-revalidate.d.ts +44 -0
- package/dist/adapters-revalidate.d.ts.map +1 -0
- package/dist/adapters-revalidate.js +68 -0
- package/dist/adapters-revalidate.js.map +1 -0
- package/dist/alpha.d.ts +21 -0
- package/dist/alpha.d.ts.map +1 -0
- package/dist/alpha.js +21 -0
- package/dist/alpha.js.map +1 -0
- package/dist/analytics-core.d.ts +34 -0
- package/dist/analytics-core.d.ts.map +1 -0
- package/dist/analytics-core.js +138 -0
- package/dist/analytics-core.js.map +1 -0
- package/dist/analytics-server.d.ts +54 -0
- package/dist/analytics-server.d.ts.map +1 -0
- package/dist/analytics-server.js +78 -0
- package/dist/analytics-server.js.map +1 -0
- package/dist/attribution-logo.d.ts +2 -0
- package/dist/attribution-logo.d.ts.map +1 -0
- package/dist/attribution-logo.js +5 -0
- package/dist/attribution-logo.js.map +1 -0
- package/dist/auth-handler.d.ts +92 -0
- package/dist/auth-handler.d.ts.map +1 -0
- package/dist/auth-handler.js +277 -0
- package/dist/auth-handler.js.map +1 -0
- package/dist/biab-forms.css +484 -0
- package/dist/cli.d.ts +46 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1824 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.d.ts +1681 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +2845 -0
- package/dist/client.js.map +1 -0
- package/dist/collections.d.ts +13 -0
- package/dist/collections.d.ts.map +1 -0
- package/dist/collections.js +13 -0
- package/dist/collections.js.map +1 -0
- package/dist/contracts.d.ts +14609 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +2428 -0
- package/dist/contracts.js.map +1 -0
- package/dist/data-model-schema.d.ts +962 -0
- package/dist/data-model-schema.d.ts.map +1 -0
- package/dist/data-model-schema.js +2295 -0
- package/dist/data-model-schema.js.map +1 -0
- package/dist/distribution.d.ts +38 -0
- package/dist/distribution.d.ts.map +1 -0
- package/dist/distribution.js +61 -0
- package/dist/distribution.js.map +1 -0
- package/dist/element.d.ts +121 -0
- package/dist/element.d.ts.map +1 -0
- package/dist/element.js +276 -0
- package/dist/element.js.map +1 -0
- package/dist/enums.d.ts +25 -0
- package/dist/enums.d.ts.map +1 -0
- package/dist/enums.js +38 -0
- package/dist/enums.js.map +1 -0
- package/dist/errors.d.ts +195 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +188 -0
- package/dist/errors.js.map +1 -0
- package/dist/forms-core/autocomplete.d.ts +37 -0
- package/dist/forms-core/autocomplete.d.ts.map +1 -0
- package/dist/forms-core/autocomplete.js +82 -0
- package/dist/forms-core/autocomplete.js.map +1 -0
- package/dist/forms-core/business-function.d.ts +61 -0
- package/dist/forms-core/business-function.d.ts.map +1 -0
- package/dist/forms-core/business-function.js +149 -0
- package/dist/forms-core/business-function.js.map +1 -0
- package/dist/forms-core/calculation.d.ts +72 -0
- package/dist/forms-core/calculation.d.ts.map +1 -0
- package/dist/forms-core/calculation.js +103 -0
- package/dist/forms-core/calculation.js.map +1 -0
- package/dist/forms-core/controller.d.ts +249 -0
- package/dist/forms-core/controller.d.ts.map +1 -0
- package/dist/forms-core/controller.js +590 -0
- package/dist/forms-core/controller.js.map +1 -0
- package/dist/forms-core/elements.d.ts +44 -0
- package/dist/forms-core/elements.d.ts.map +1 -0
- package/dist/forms-core/elements.js +68 -0
- package/dist/forms-core/elements.js.map +1 -0
- package/dist/forms-core/email-domains.d.ts +10 -0
- package/dist/forms-core/email-domains.d.ts.map +1 -0
- package/dist/forms-core/email-domains.js +69 -0
- package/dist/forms-core/email-domains.js.map +1 -0
- package/dist/forms-core/file-rules.d.ts +51 -0
- package/dist/forms-core/file-rules.d.ts.map +1 -0
- package/dist/forms-core/file-rules.js +105 -0
- package/dist/forms-core/file-rules.js.map +1 -0
- package/dist/forms-core/formula.d.ts +114 -0
- package/dist/forms-core/formula.d.ts.map +1 -0
- package/dist/forms-core/formula.js +1170 -0
- package/dist/forms-core/formula.js.map +1 -0
- package/dist/forms-core/index.d.ts +24 -0
- package/dist/forms-core/index.d.ts.map +1 -0
- package/dist/forms-core/index.js +28 -0
- package/dist/forms-core/index.js.map +1 -0
- package/dist/forms-core/units.d.ts +49 -0
- package/dist/forms-core/units.d.ts.map +1 -0
- package/dist/forms-core/units.js +255 -0
- package/dist/forms-core/units.js.map +1 -0
- package/dist/forms-core/us-states.d.ts +14 -0
- package/dist/forms-core/us-states.d.ts.map +1 -0
- package/dist/forms-core/us-states.js +66 -0
- package/dist/forms-core/us-states.js.map +1 -0
- package/dist/forms-core/validation.d.ts +266 -0
- package/dist/forms-core/validation.d.ts.map +1 -0
- package/dist/forms-core/validation.js +850 -0
- package/dist/forms-core/validation.js.map +1 -0
- package/dist/forms.d.ts +19 -0
- package/dist/forms.d.ts.map +1 -0
- package/dist/forms.js +29 -0
- package/dist/forms.js.map +1 -0
- package/dist/gallery-types.d.ts +32 -0
- package/dist/gallery-types.d.ts.map +1 -0
- package/dist/gallery-types.js +2 -0
- package/dist/gallery-types.js.map +1 -0
- package/dist/graphql.d.ts +97 -0
- package/dist/graphql.d.ts.map +1 -0
- package/dist/graphql.js +212 -0
- package/dist/graphql.js.map +1 -0
- package/dist/index.cjs +19448 -0
- package/dist/index.d.cts +19 -0
- package/dist/index.d.mts +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/marketing-schema.d.ts +216 -0
- package/dist/marketing-schema.d.ts.map +1 -0
- package/dist/marketing-schema.js +200 -0
- package/dist/marketing-schema.js.map +1 -0
- package/dist/mcp.d.ts +42 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +87 -0
- package/dist/mcp.js.map +1 -0
- package/dist/native.d.ts +45 -0
- package/dist/native.d.ts.map +1 -0
- package/dist/native.js +43 -0
- package/dist/native.js.map +1 -0
- package/dist/next-revalidate.d.ts +43 -0
- package/dist/next-revalidate.d.ts.map +1 -0
- package/dist/next-revalidate.js +84 -0
- package/dist/next-revalidate.js.map +1 -0
- package/dist/parallel-pages.d.ts +102 -0
- package/dist/parallel-pages.d.ts.map +1 -0
- package/dist/parallel-pages.js +108 -0
- package/dist/parallel-pages.js.map +1 -0
- package/dist/payment-icons.d.ts +66 -0
- package/dist/payment-icons.d.ts.map +1 -0
- package/dist/payment-icons.js +160 -0
- package/dist/payment-icons.js.map +1 -0
- package/dist/proxy.d.ts +67 -0
- package/dist/proxy.d.ts.map +1 -0
- package/dist/proxy.js +97 -0
- package/dist/proxy.js.map +1 -0
- package/dist/react-analytics.d.ts +39 -0
- package/dist/react-analytics.d.ts.map +1 -0
- package/dist/react-analytics.js +59 -0
- package/dist/react-analytics.js.map +1 -0
- package/dist/react-attribution.d.ts +99 -0
- package/dist/react-attribution.d.ts.map +1 -0
- package/dist/react-attribution.js +52 -0
- package/dist/react-attribution.js.map +1 -0
- package/dist/react-marketing.d.ts +181 -0
- package/dist/react-marketing.d.ts.map +1 -0
- package/dist/react-marketing.js +215 -0
- package/dist/react-marketing.js.map +1 -0
- package/dist/react.d.ts +727 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +2418 -0
- package/dist/react.js.map +1 -0
- package/dist/reserved-paths.d.ts +24 -0
- package/dist/reserved-paths.d.ts.map +1 -0
- package/dist/reserved-paths.js +60 -0
- package/dist/reserved-paths.js.map +1 -0
- package/dist/revalidate-verify.d.ts +30 -0
- package/dist/revalidate-verify.d.ts.map +1 -0
- package/dist/revalidate-verify.js +74 -0
- package/dist/revalidate-verify.js.map +1 -0
- package/dist/sdk.d.ts +678 -0
- package/dist/sdk.d.ts.map +1 -0
- package/dist/sdk.js +801 -0
- package/dist/sdk.js.map +1 -0
- package/dist/seo.d.ts +218 -0
- package/dist/seo.d.ts.map +1 -0
- package/dist/seo.js +309 -0
- package/dist/seo.js.map +1 -0
- package/dist/socials.d.ts +47 -0
- package/dist/socials.d.ts.map +1 -0
- package/dist/socials.js +172 -0
- package/dist/socials.js.map +1 -0
- package/dist/static.d.ts +14 -0
- package/dist/static.d.ts.map +1 -0
- package/dist/static.js +14 -0
- package/dist/static.js.map +1 -0
- package/dist/url-pattern.d.ts +47 -0
- package/dist/url-pattern.d.ts.map +1 -0
- package/dist/url-pattern.js +124 -0
- package/dist/url-pattern.js.map +1 -0
- package/dist/vanilla.d.ts +77 -0
- package/dist/vanilla.d.ts.map +1 -0
- package/dist/vanilla.js +903 -0
- package/dist/vanilla.js.map +1 -0
- package/openapi.json +13779 -0
- package/package.json +204 -0
- package/src/adapters-revalidate.ts +88 -0
- package/src/alpha.ts +89 -0
- package/src/analytics-core.ts +175 -0
- package/src/analytics-server.ts +99 -0
- package/src/angular/biab-form.component.ts +1443 -0
- package/src/angular/index.ts +26 -0
- package/src/attribution-logo.ts +5 -0
- package/src/auth-handler.ts +352 -0
- package/src/cli.ts +2517 -0
- package/src/client.ts +3578 -0
- package/src/collections.ts +101 -0
- package/src/contracts.ts +3390 -0
- package/src/data-model-schema.ts +4042 -0
- package/src/distribution.ts +73 -0
- package/src/element.ts +321 -0
- package/src/enums.ts +65 -0
- package/src/errors.ts +338 -0
- package/src/forms-core/autocomplete.ts +97 -0
- package/src/forms-core/business-function.ts +209 -0
- package/src/forms-core/calculation.ts +167 -0
- package/src/forms-core/controller.ts +922 -0
- package/src/forms-core/elements.ts +86 -0
- package/src/forms-core/email-domains.ts +68 -0
- package/src/forms-core/file-rules.ts +123 -0
- package/src/forms-core/formula.ts +1339 -0
- package/src/forms-core/index.ts +122 -0
- package/src/forms-core/units.ts +308 -0
- package/src/forms-core/us-states.ts +68 -0
- package/src/forms-core/validation.ts +1037 -0
- package/src/forms.ts +63 -0
- package/src/gallery-types.ts +31 -0
- package/src/graphql.ts +295 -0
- package/src/index.ts +505 -0
- package/src/marketing-schema.ts +395 -0
- package/src/mcp.ts +108 -0
- package/src/native.ts +73 -0
- package/src/next-revalidate.ts +124 -0
- package/src/parallel-pages.ts +192 -0
- package/src/payment-icons.ts +205 -0
- package/src/proxy.ts +173 -0
- package/src/qwik.tsx +1234 -0
- package/src/react-analytics.tsx +76 -0
- package/src/react-attribution.tsx +192 -0
- package/src/react-marketing.tsx +338 -0
- package/src/react.tsx +5495 -0
- package/src/reserved-paths.ts +65 -0
- package/src/revalidate-verify.ts +98 -0
- package/src/sdk.ts +1671 -0
- package/src/seo.ts +488 -0
- package/src/socials.ts +230 -0
- package/src/solid.tsx +1466 -0
- package/src/static.ts +21 -0
- package/src/styles/biab-forms.css +484 -0
- package/src/svelte/BiabForm.svelte +1069 -0
- package/src/svelte/context.ts +57 -0
- package/src/svelte/index.ts +79 -0
- package/src/url-pattern.ts +153 -0
- package/src/vanilla.ts +1290 -0
- package/src/vue/BiabForm.vue +1538 -0
- package/src/vue/index.ts +119 -0
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,727 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from "react";
|
|
2
|
+
import type { ChatbotAvailability, ChatbotChatResponse, ChatbotConfig, ChatbotFormDefinition, ChatbotFormSubmitInput, ChatbotFormSubmitResponse, CheckoutSessionInput, GetSiteMarketingPageResponse, SiteMarketingPage, SiteMarketingPageSummary } from "./contracts.js";
|
|
3
|
+
import { type BiabFormsClient, type CreateFormControllerOptions } from "./forms-core/index.js";
|
|
4
|
+
import type { FormSchema, FormSubmitResult } from "./sdk.js";
|
|
5
|
+
type SessionState<T> = {
|
|
6
|
+
status: "idle";
|
|
7
|
+
} | {
|
|
8
|
+
status: "loading";
|
|
9
|
+
} | {
|
|
10
|
+
status: "ready";
|
|
11
|
+
session: T;
|
|
12
|
+
} | {
|
|
13
|
+
status: "error";
|
|
14
|
+
error: Error;
|
|
15
|
+
};
|
|
16
|
+
export type BiabEmbedEvent = {
|
|
17
|
+
type: "biab:ready";
|
|
18
|
+
surface: string;
|
|
19
|
+
} | {
|
|
20
|
+
type: "biab:cart:update";
|
|
21
|
+
count: number;
|
|
22
|
+
subtotalCents: number;
|
|
23
|
+
} | {
|
|
24
|
+
type: "biab:cart:checkout-requested";
|
|
25
|
+
lines: Array<{
|
|
26
|
+
productId: string;
|
|
27
|
+
variantId: string;
|
|
28
|
+
combinationKey?: string;
|
|
29
|
+
quantity: number;
|
|
30
|
+
}>;
|
|
31
|
+
} | {
|
|
32
|
+
type: "biab:checkout:success";
|
|
33
|
+
sessionId: string;
|
|
34
|
+
orderId?: string | null;
|
|
35
|
+
} | {
|
|
36
|
+
type: "biab:checkout:cancel";
|
|
37
|
+
sessionId: string;
|
|
38
|
+
} | {
|
|
39
|
+
type: "biab:checkout:error";
|
|
40
|
+
message: string;
|
|
41
|
+
} | {
|
|
42
|
+
type: "biab:chatbot:user-message";
|
|
43
|
+
content: string;
|
|
44
|
+
} | {
|
|
45
|
+
type: "biab:chatbot:assistant-message";
|
|
46
|
+
content: string;
|
|
47
|
+
model?: string;
|
|
48
|
+
} | {
|
|
49
|
+
type: "biab:chatbot:error";
|
|
50
|
+
message: string;
|
|
51
|
+
};
|
|
52
|
+
type DashboardContextValue = {
|
|
53
|
+
state: SessionState<{
|
|
54
|
+
url: string;
|
|
55
|
+
token: string;
|
|
56
|
+
expiresAt: string;
|
|
57
|
+
}>;
|
|
58
|
+
refresh: () => Promise<void>;
|
|
59
|
+
};
|
|
60
|
+
export type DashboardProviderProps = {
|
|
61
|
+
apiKey: string;
|
|
62
|
+
baseUrl: string;
|
|
63
|
+
children: ReactNode;
|
|
64
|
+
refreshLeadMs?: number;
|
|
65
|
+
};
|
|
66
|
+
export declare function DashboardProvider({ apiKey, baseUrl, children, refreshLeadMs, }: DashboardProviderProps): import("react").JSX.Element;
|
|
67
|
+
export declare function useDashboardSession(): DashboardContextValue;
|
|
68
|
+
export type DashboardProps = {
|
|
69
|
+
className?: string;
|
|
70
|
+
style?: CSSProperties;
|
|
71
|
+
title?: string;
|
|
72
|
+
loadingFallback?: ReactNode;
|
|
73
|
+
errorFallback?: (error: Error, refresh: () => void) => ReactNode;
|
|
74
|
+
};
|
|
75
|
+
export declare function Dashboard({ className, style, title, loadingFallback, errorFallback, }?: DashboardProps): import("react").JSX.Element;
|
|
76
|
+
export type StorefrontProps = {
|
|
77
|
+
apiKey: string;
|
|
78
|
+
baseUrl: string;
|
|
79
|
+
productId?: string;
|
|
80
|
+
className?: string;
|
|
81
|
+
style?: CSSProperties;
|
|
82
|
+
title?: string;
|
|
83
|
+
loadingFallback?: ReactNode;
|
|
84
|
+
errorFallback?: (error: Error, refresh: () => void) => ReactNode;
|
|
85
|
+
/** Fires for every event the embed posts. */
|
|
86
|
+
onEvent?: (event: BiabEmbedEvent) => void;
|
|
87
|
+
/** Convenience: fires only on cart updates. */
|
|
88
|
+
onCartChange?: (count: number, subtotalCents: number) => void;
|
|
89
|
+
refreshLeadMs?: number;
|
|
90
|
+
};
|
|
91
|
+
export declare function Storefront({ apiKey, baseUrl, productId, className, style, title, loadingFallback, errorFallback, onEvent, onCartChange, refreshLeadMs, }: StorefrontProps): import("react").JSX.Element;
|
|
92
|
+
export type CartProps = {
|
|
93
|
+
apiKey: string;
|
|
94
|
+
baseUrl: string;
|
|
95
|
+
className?: string;
|
|
96
|
+
style?: CSSProperties;
|
|
97
|
+
title?: string;
|
|
98
|
+
loadingFallback?: ReactNode;
|
|
99
|
+
errorFallback?: (error: Error, refresh: () => void) => ReactNode;
|
|
100
|
+
onEvent?: (event: BiabEmbedEvent) => void;
|
|
101
|
+
onCartChange?: (count: number, subtotalCents: number) => void;
|
|
102
|
+
refreshLeadMs?: number;
|
|
103
|
+
};
|
|
104
|
+
export declare function Cart({ apiKey, baseUrl, className, style, title, loadingFallback, errorFallback, onEvent, onCartChange, refreshLeadMs, }: CartProps): import("react").JSX.Element;
|
|
105
|
+
export type CheckoutProps = {
|
|
106
|
+
apiKey: string;
|
|
107
|
+
baseUrl: string;
|
|
108
|
+
cart: CheckoutSessionInput;
|
|
109
|
+
/** Render mode. `"redirect"` (default): button → top-level Stripe redirect.
|
|
110
|
+
* `"iframe"`: shows the embed iframe; Stripe opens in a new tab via
|
|
111
|
+
* `allow-top-navigation`. */
|
|
112
|
+
mode?: "redirect" | "iframe";
|
|
113
|
+
className?: string;
|
|
114
|
+
style?: CSSProperties;
|
|
115
|
+
title?: string;
|
|
116
|
+
children?: ReactNode;
|
|
117
|
+
loadingFallback?: ReactNode;
|
|
118
|
+
errorFallback?: (error: Error, refresh: () => void) => ReactNode;
|
|
119
|
+
onEvent?: (event: BiabEmbedEvent) => void;
|
|
120
|
+
onSuccess?: (sessionId: string) => void;
|
|
121
|
+
onCancel?: (sessionId: string) => void;
|
|
122
|
+
onError?: (error: Error) => void;
|
|
123
|
+
};
|
|
124
|
+
export declare function Checkout(props: CheckoutProps): import("react").JSX.Element;
|
|
125
|
+
/**
|
|
126
|
+
* Pair with `<Checkout/>` in `redirect` mode. Drop on the host's success URL
|
|
127
|
+
* (the URL passed as `cart.successUrl` when calling `client.checkout`). Reads
|
|
128
|
+
* `?session_id=…` from the URL and renders the resolved order summary.
|
|
129
|
+
*/
|
|
130
|
+
export type CheckoutResultProps = {
|
|
131
|
+
apiKey: string;
|
|
132
|
+
baseUrl: string;
|
|
133
|
+
orgSlug: string;
|
|
134
|
+
sessionIdParam?: string;
|
|
135
|
+
render?: (state: {
|
|
136
|
+
status: "loading" | "paid" | "unpaid" | "error";
|
|
137
|
+
error?: Error;
|
|
138
|
+
amountTotalCents?: number | null;
|
|
139
|
+
currency?: string | null;
|
|
140
|
+
customerEmail?: string | null;
|
|
141
|
+
}) => ReactNode;
|
|
142
|
+
};
|
|
143
|
+
export declare function CheckoutResult(props: CheckoutResultProps): import("react").JSX.Element;
|
|
144
|
+
export type BlogProps = {
|
|
145
|
+
apiKey: string;
|
|
146
|
+
baseUrl: string;
|
|
147
|
+
postSlug?: string;
|
|
148
|
+
className?: string;
|
|
149
|
+
style?: CSSProperties;
|
|
150
|
+
title?: string;
|
|
151
|
+
loadingFallback?: ReactNode;
|
|
152
|
+
errorFallback?: (error: Error, refresh: () => void) => ReactNode;
|
|
153
|
+
onEvent?: (event: BiabEmbedEvent) => void;
|
|
154
|
+
refreshLeadMs?: number;
|
|
155
|
+
};
|
|
156
|
+
export type ChatbotProps = {
|
|
157
|
+
apiKey: string;
|
|
158
|
+
baseUrl: string;
|
|
159
|
+
className?: string;
|
|
160
|
+
style?: CSSProperties;
|
|
161
|
+
title?: string;
|
|
162
|
+
loadingFallback?: ReactNode;
|
|
163
|
+
errorFallback?: (error: Error, refresh: () => void) => ReactNode;
|
|
164
|
+
onEvent?: (event: BiabEmbedEvent) => void;
|
|
165
|
+
/** Convenience: fires when the assistant replies. */
|
|
166
|
+
onAssistantMessage?: (content: string, model?: string) => void;
|
|
167
|
+
refreshLeadMs?: number;
|
|
168
|
+
};
|
|
169
|
+
export declare function Chatbot({ apiKey, baseUrl, className, style, title, loadingFallback, errorFallback, onEvent, onAssistantMessage, refreshLeadMs, }: ChatbotProps): import("react").JSX.Element;
|
|
170
|
+
/**
|
|
171
|
+
* Headless chat hook — for hosts that want to render their own chat UI but
|
|
172
|
+
* still drive every turn through the org's persisted chatbot config.
|
|
173
|
+
*
|
|
174
|
+
* Beyond `messages` and `send`, the hook tracks the latest `uiActions` (e.g.
|
|
175
|
+
* `show_form` — call {@link useChatbot}.getForm to fetch the definition and
|
|
176
|
+
* {@link useChatbot}.submitForm to POST a filled form back), and the latest
|
|
177
|
+
* `availability` snapshot (front-desk presence + wait-time hint) so the
|
|
178
|
+
* consumer can show or hide its "Talk to a person" CTA.
|
|
179
|
+
*/
|
|
180
|
+
export declare function useChatbot(options: {
|
|
181
|
+
apiKey: string;
|
|
182
|
+
baseUrl: string;
|
|
183
|
+
}): {
|
|
184
|
+
messages: {
|
|
185
|
+
role: "user" | "assistant" | "system";
|
|
186
|
+
content: string;
|
|
187
|
+
}[];
|
|
188
|
+
send: (content: string) => Promise<ChatbotChatResponse | null>;
|
|
189
|
+
reset: () => void;
|
|
190
|
+
isPending: boolean;
|
|
191
|
+
error: Error | null;
|
|
192
|
+
getConfig: () => Promise<ChatbotConfig>;
|
|
193
|
+
latestUiActions: {
|
|
194
|
+
kind: "show_form";
|
|
195
|
+
formSlug: string;
|
|
196
|
+
}[];
|
|
197
|
+
availability: {
|
|
198
|
+
offline: boolean;
|
|
199
|
+
frontDeskEnabled: boolean;
|
|
200
|
+
staffAvailable: boolean;
|
|
201
|
+
estimateLabel: string | null;
|
|
202
|
+
onlineHandlers: {
|
|
203
|
+
name: string;
|
|
204
|
+
userId: string;
|
|
205
|
+
avatarUrl: string | null;
|
|
206
|
+
}[];
|
|
207
|
+
} | null;
|
|
208
|
+
refreshAvailability: () => Promise<ChatbotAvailability | null>;
|
|
209
|
+
getForm: (slug: string) => Promise<ChatbotFormDefinition | null>;
|
|
210
|
+
submitForm: (slug: string, input: ChatbotFormSubmitInput) => Promise<ChatbotFormSubmitResponse | null>;
|
|
211
|
+
uploadFile: (args: {
|
|
212
|
+
sessionId: string;
|
|
213
|
+
file: File;
|
|
214
|
+
uploaderEmail?: string | null;
|
|
215
|
+
}) => Promise<{
|
|
216
|
+
url: string;
|
|
217
|
+
name: string;
|
|
218
|
+
type: string;
|
|
219
|
+
size: number;
|
|
220
|
+
}>;
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* Slot-based className overrides for {@link ChatbotInline}. Every slot
|
|
224
|
+
* defaults to an empty string so the consumer's CSS / Tailwind owns the
|
|
225
|
+
* look. The component only ships the layout-essential inline styles
|
|
226
|
+
* (flex, overflow, scroll) — everything else is yours.
|
|
227
|
+
*/
|
|
228
|
+
export type ChatbotInlineClassNames = {
|
|
229
|
+
root?: string;
|
|
230
|
+
header?: string;
|
|
231
|
+
headerTitle?: string;
|
|
232
|
+
headerSubtitle?: string;
|
|
233
|
+
presenceStrip?: string;
|
|
234
|
+
presenceStripOnline?: string;
|
|
235
|
+
presenceStripAway?: string;
|
|
236
|
+
presenceStripOffline?: string;
|
|
237
|
+
presenceLabel?: string;
|
|
238
|
+
presenceEstimate?: string;
|
|
239
|
+
messageList?: string;
|
|
240
|
+
messageRow?: string;
|
|
241
|
+
messageUser?: string;
|
|
242
|
+
messageAssistant?: string;
|
|
243
|
+
messagePending?: string;
|
|
244
|
+
formCard?: string;
|
|
245
|
+
formTitle?: string;
|
|
246
|
+
formDescription?: string;
|
|
247
|
+
formField?: string;
|
|
248
|
+
formLabel?: string;
|
|
249
|
+
formInput?: string;
|
|
250
|
+
formTextarea?: string;
|
|
251
|
+
formSelect?: string;
|
|
252
|
+
formSubmit?: string;
|
|
253
|
+
formError?: string;
|
|
254
|
+
formReceipt?: string;
|
|
255
|
+
inputBar?: string;
|
|
256
|
+
inputField?: string;
|
|
257
|
+
sendButton?: string;
|
|
258
|
+
jumpButton?: string;
|
|
259
|
+
errorText?: string;
|
|
260
|
+
};
|
|
261
|
+
export type ChatbotInlineProps = {
|
|
262
|
+
apiKey: string;
|
|
263
|
+
baseUrl: string;
|
|
264
|
+
/** Optional welcome message shown before the visitor sends anything. */
|
|
265
|
+
welcomeMessage?: string;
|
|
266
|
+
/** Title shown in the header. Set to `null` to hide the header entirely. */
|
|
267
|
+
title?: string | null;
|
|
268
|
+
/** Subtitle shown beneath the title (e.g. the model id). Hidden when null. */
|
|
269
|
+
subtitle?: string | null;
|
|
270
|
+
classNames?: ChatbotInlineClassNames;
|
|
271
|
+
className?: string;
|
|
272
|
+
style?: CSSProperties;
|
|
273
|
+
/**
|
|
274
|
+
* Skip the injected default visual theme and render bare divs (the previous
|
|
275
|
+
* behavior). Leave false for the polished drop-in look; the defaults are
|
|
276
|
+
* zero-specificity, so any `classNames` you pass already override them — set
|
|
277
|
+
* this only if you want a completely unstyled baseline.
|
|
278
|
+
*/
|
|
279
|
+
unstyled?: boolean;
|
|
280
|
+
/** Polling interval for availability (ms). Default 30s. Set to 0 to disable polling. */
|
|
281
|
+
availabilityPollMs?: number;
|
|
282
|
+
/**
|
|
283
|
+
* Optional render-prop overrides. When provided, replaces the default
|
|
284
|
+
* markup for that slot — full freedom for consumers who want to ship
|
|
285
|
+
* their own message bubbles, form cards, or presence strip.
|
|
286
|
+
*/
|
|
287
|
+
renderMessage?: (item: {
|
|
288
|
+
kind: "text";
|
|
289
|
+
role: "user" | "assistant";
|
|
290
|
+
content: string;
|
|
291
|
+
} | {
|
|
292
|
+
kind: "form";
|
|
293
|
+
form: ChatbotFormDefinition;
|
|
294
|
+
submitted: boolean;
|
|
295
|
+
} | {
|
|
296
|
+
kind: "file";
|
|
297
|
+
file: {
|
|
298
|
+
url: string;
|
|
299
|
+
name: string;
|
|
300
|
+
type: string;
|
|
301
|
+
size: number;
|
|
302
|
+
};
|
|
303
|
+
}, index: number) => ReactNode;
|
|
304
|
+
renderPresenceStrip?: (availability: ChatbotAvailability) => ReactNode;
|
|
305
|
+
onAssistantMessage?: (content: string) => void;
|
|
306
|
+
};
|
|
307
|
+
/**
|
|
308
|
+
* In-tree React chatbot component. Same backend wiring as the iframe
|
|
309
|
+
* `<Chatbot />` (chat → uiActions → form fetch → submit + CRM mirrors,
|
|
310
|
+
* plus availability polling) but rendered directly in the consumer's
|
|
311
|
+
* DOM tree so they can style every piece with their own CSS / Tailwind.
|
|
312
|
+
*
|
|
313
|
+
* For zero-customization drop-in use, prefer `<Chatbot />` (iframe).
|
|
314
|
+
* For fully custom UI, use the `useChatbot()` hook directly.
|
|
315
|
+
*/
|
|
316
|
+
export declare function ChatbotInline({ apiKey, baseUrl, welcomeMessage, title, subtitle, classNames, className, style, unstyled, availabilityPollMs, renderMessage, renderPresenceStrip, onAssistantMessage, }: ChatbotInlineProps): import("react").JSX.Element;
|
|
317
|
+
export declare function Blog({ apiKey, baseUrl, postSlug, className, style, title, loadingFallback, errorFallback, onEvent, refreshLeadMs, }: BlogProps): import("react").JSX.Element;
|
|
318
|
+
import type { TenantAuthMeResponse } from "./contracts.js";
|
|
319
|
+
type AuthLinkProps = {
|
|
320
|
+
/** Where to send the user after auth completes. */
|
|
321
|
+
returnTo?: string;
|
|
322
|
+
/** Pre-fill the email field on the platform-hosted page. */
|
|
323
|
+
loginHint?: string;
|
|
324
|
+
/** Override the basePath the auth-handler is mounted at. */
|
|
325
|
+
basePath?: string;
|
|
326
|
+
className?: string;
|
|
327
|
+
style?: CSSProperties;
|
|
328
|
+
children?: ReactNode;
|
|
329
|
+
};
|
|
330
|
+
export declare function SignIn({ children, ...rest }: AuthLinkProps): import("react").JSX.Element;
|
|
331
|
+
export declare function SignUp({ children, ...rest }: AuthLinkProps): import("react").JSX.Element;
|
|
332
|
+
export declare function SignOut({ children, basePath, className, style, }: AuthLinkProps): import("react").JSX.Element;
|
|
333
|
+
export type ProgrammaticAuthOptions = {
|
|
334
|
+
/** Where to send the user after auth completes. Defaults server-side. */
|
|
335
|
+
returnTo?: string;
|
|
336
|
+
/** Pre-fill the email on the platform-hosted page (sign-in / sign-up only). */
|
|
337
|
+
loginHint?: string;
|
|
338
|
+
/** Override the auth-handler basePath. Defaults to "/api/biab-auth". */
|
|
339
|
+
basePath?: string;
|
|
340
|
+
};
|
|
341
|
+
/**
|
|
342
|
+
* Programmatic sign-in — navigates the browser through the auth handler's
|
|
343
|
+
* `/sign-in` route. Equivalent to clicking `<SignIn />`. Browser-only.
|
|
344
|
+
*/
|
|
345
|
+
export declare function signIn(options?: ProgrammaticAuthOptions): void;
|
|
346
|
+
/**
|
|
347
|
+
* Programmatic sign-up — navigates through `/sign-up`. Equivalent to
|
|
348
|
+
* clicking `<SignUp />`. Browser-only.
|
|
349
|
+
*/
|
|
350
|
+
export declare function signUp(options?: ProgrammaticAuthOptions): void;
|
|
351
|
+
export type ProgrammaticSignOutOptions = {
|
|
352
|
+
/** Override the auth-handler basePath. Defaults to "/api/biab-auth". */
|
|
353
|
+
basePath?: string;
|
|
354
|
+
/**
|
|
355
|
+
* Default `"redirect"` — navigates through `/sign-out` (matches the
|
|
356
|
+
* `<SignOut />` anchor). Use `"fetch"` when you want to clear the
|
|
357
|
+
* session without a top-level navigation (e.g. just before showing
|
|
358
|
+
* a "signed out" state in your own UI). The fetch path returns
|
|
359
|
+
* `{ ok: true }` after clearing the cookie.
|
|
360
|
+
*/
|
|
361
|
+
mode?: "redirect" | "fetch";
|
|
362
|
+
};
|
|
363
|
+
/**
|
|
364
|
+
* Programmatic sign-out. Defaults to a redirect through the auth
|
|
365
|
+
* handler's `/sign-out` route (same as `<SignOut />`). Pass
|
|
366
|
+
* `{ mode: "fetch" }` for a fetch-based clear that resolves with
|
|
367
|
+
* `{ ok: true }` and does not navigate.
|
|
368
|
+
*/
|
|
369
|
+
export declare function signOut(options?: ProgrammaticSignOutOptions): Promise<{
|
|
370
|
+
ok: boolean;
|
|
371
|
+
}>;
|
|
372
|
+
export type ProgrammaticPasswordResetInput = {
|
|
373
|
+
email: string;
|
|
374
|
+
/** Override the auth-handler basePath. Defaults to "/api/biab-auth". */
|
|
375
|
+
basePath?: string;
|
|
376
|
+
/**
|
|
377
|
+
* Optional return path the platform-hosted reset page sends the user to
|
|
378
|
+
* after they set a new password. Server-side falls back to the org's
|
|
379
|
+
* sign-in landing page when omitted.
|
|
380
|
+
*/
|
|
381
|
+
returnTo?: string;
|
|
382
|
+
};
|
|
383
|
+
/**
|
|
384
|
+
* Programmatic "forgot password" — POSTs to the auth handler's
|
|
385
|
+
* `/password-reset` route, which the SDK forwards to BIAB. The server
|
|
386
|
+
* returns `{ ok: true }` regardless of whether an account matched
|
|
387
|
+
* (intentional anti-leak), and emails the platform-hosted reset link
|
|
388
|
+
* out-of-band when a match exists.
|
|
389
|
+
*/
|
|
390
|
+
export declare function requestPasswordReset(input: ProgrammaticPasswordResetInput): Promise<{
|
|
391
|
+
ok: boolean;
|
|
392
|
+
}>;
|
|
393
|
+
type UseUserState = {
|
|
394
|
+
status: "loading";
|
|
395
|
+
user: null;
|
|
396
|
+
} | {
|
|
397
|
+
status: "signed-in";
|
|
398
|
+
user: NonNullable<TenantAuthMeResponse>;
|
|
399
|
+
} | {
|
|
400
|
+
status: "signed-out";
|
|
401
|
+
user: null;
|
|
402
|
+
};
|
|
403
|
+
/**
|
|
404
|
+
* Reads the current tenant session by hitting the `/me` route the SDK's
|
|
405
|
+
* auth-handler exposes on the tenant's own domain. No props needed because
|
|
406
|
+
* the cookie + handler path are the source of truth.
|
|
407
|
+
*/
|
|
408
|
+
export declare function useUser(options?: {
|
|
409
|
+
basePath?: string;
|
|
410
|
+
}): UseUserState;
|
|
411
|
+
export type UseFollowersOptions = {
|
|
412
|
+
/** Publishable token (`pk_…`) — browser-safe (origin-locked, rate-limited,
|
|
413
|
+
* scoped to `followers:self`). */
|
|
414
|
+
token: string;
|
|
415
|
+
/** Site id (shown in Site Builder → Developer). */
|
|
416
|
+
siteId: string;
|
|
417
|
+
/** Package-API base URL. Defaults to production (the apex). */
|
|
418
|
+
baseUrl?: string;
|
|
419
|
+
};
|
|
420
|
+
/**
|
|
421
|
+
* Visitor-facing followers/subscribe client, bound to a publishable token so it
|
|
422
|
+
* works browser-side with no backend.
|
|
423
|
+
*
|
|
424
|
+
* const f = useFollowers({ token: pk, siteId });
|
|
425
|
+
* if (!f.subscribedLocally) showForm(); // anonymous "already subscribed?" hint
|
|
426
|
+
* await f.join({ email, name, source: "footer" }); // subscribe (+ remembers this browser)
|
|
427
|
+
* const { follower } = await f.me(user.email); // authoritative status (logged-in)
|
|
428
|
+
* await f.leave(email); // unsubscribe (+ forgets)
|
|
429
|
+
*
|
|
430
|
+
* Source of truth for "is this visitor subscribed":
|
|
431
|
+
* - Logged-in → pass `user.email` to `me()` (authoritative, cross-device).
|
|
432
|
+
* - Anonymous → `subscribedLocally` — a per-browser flag set on `join()`.
|
|
433
|
+
* Email is the real key; this is just a privacy-friendly UX hint so an
|
|
434
|
+
* anonymous visitor isn't shown the form forever. Clearing storage / a new
|
|
435
|
+
* device re-shows it, and re-subscribing is idempotent (no dupes). IP is
|
|
436
|
+
* deliberately NOT used (shared NAT hides the form from non-subscribers).
|
|
437
|
+
*
|
|
438
|
+
* `useUser()` covers the auth session; this covers follower status + subscribe,
|
|
439
|
+
* which the session doesn't include. All actions are `followers:self`, so a
|
|
440
|
+
* publishable token can run them.
|
|
441
|
+
*/
|
|
442
|
+
export declare function useFollowers(options: UseFollowersOptions): {
|
|
443
|
+
join: (input: {
|
|
444
|
+
email: string;
|
|
445
|
+
name?: string;
|
|
446
|
+
source?: string;
|
|
447
|
+
}) => Promise<{
|
|
448
|
+
follower: {
|
|
449
|
+
email: string;
|
|
450
|
+
id: string;
|
|
451
|
+
isActive: boolean;
|
|
452
|
+
joinedAt: string;
|
|
453
|
+
name?: string | null | undefined;
|
|
454
|
+
source?: string | null | undefined;
|
|
455
|
+
unsubscribedAt?: string | null | undefined;
|
|
456
|
+
};
|
|
457
|
+
created: boolean;
|
|
458
|
+
}>;
|
|
459
|
+
leave: (email: string) => Promise<{
|
|
460
|
+
follower: {
|
|
461
|
+
email: string;
|
|
462
|
+
id: string;
|
|
463
|
+
isActive: boolean;
|
|
464
|
+
joinedAt: string;
|
|
465
|
+
name?: string | null | undefined;
|
|
466
|
+
source?: string | null | undefined;
|
|
467
|
+
unsubscribedAt?: string | null | undefined;
|
|
468
|
+
} | null;
|
|
469
|
+
}>;
|
|
470
|
+
me: (email: string) => Promise<{
|
|
471
|
+
follower: {
|
|
472
|
+
email: string;
|
|
473
|
+
id: string;
|
|
474
|
+
isActive: boolean;
|
|
475
|
+
joinedAt: string;
|
|
476
|
+
name?: string | null | undefined;
|
|
477
|
+
source?: string | null | undefined;
|
|
478
|
+
unsubscribedAt?: string | null | undefined;
|
|
479
|
+
} | null;
|
|
480
|
+
}>;
|
|
481
|
+
edit: (email: string, patch: {
|
|
482
|
+
name?: string;
|
|
483
|
+
source?: string;
|
|
484
|
+
}) => Promise<{
|
|
485
|
+
follower: {
|
|
486
|
+
email: string;
|
|
487
|
+
id: string;
|
|
488
|
+
isActive: boolean;
|
|
489
|
+
joinedAt: string;
|
|
490
|
+
name?: string | null | undefined;
|
|
491
|
+
source?: string | null | undefined;
|
|
492
|
+
unsubscribedAt?: string | null | undefined;
|
|
493
|
+
};
|
|
494
|
+
}>;
|
|
495
|
+
/** This browser already subscribed (instant, no network). Use to hide a
|
|
496
|
+
* newsletter form for anonymous visitors. */
|
|
497
|
+
subscribedLocally: boolean;
|
|
498
|
+
/** Email this browser subscribed with — pass to `me()` for an
|
|
499
|
+
* authoritative re-check, or `null` if this browser hasn't subscribed. */
|
|
500
|
+
localEmail: string | null;
|
|
501
|
+
};
|
|
502
|
+
type MarketingPageState = {
|
|
503
|
+
status: "idle";
|
|
504
|
+
page: null;
|
|
505
|
+
} | {
|
|
506
|
+
status: "loading";
|
|
507
|
+
page: null;
|
|
508
|
+
} | {
|
|
509
|
+
status: "ready";
|
|
510
|
+
page: SiteMarketingPage | null;
|
|
511
|
+
} | {
|
|
512
|
+
status: "error";
|
|
513
|
+
page: null;
|
|
514
|
+
error: Error;
|
|
515
|
+
};
|
|
516
|
+
/**
|
|
517
|
+
* Lazy-fetch a single marketing page by `pageKey`. The hook reads from the
|
|
518
|
+
* SDK's shared cache when present (warmed by `useMarketingPagePreloader` or
|
|
519
|
+
* a previous `useMarketingPage` render) and only hits the network when the
|
|
520
|
+
* cache is empty — so navigating between pages on a many-page site only
|
|
521
|
+
* fetches the page the visitor actually views.
|
|
522
|
+
*
|
|
523
|
+
* Pass `enabled: false` to gate the request on something async (e.g., wait
|
|
524
|
+
* for the visitor to consent before loading the privacy page).
|
|
525
|
+
*/
|
|
526
|
+
export declare function useMarketingPage(options: {
|
|
527
|
+
apiKey: string;
|
|
528
|
+
baseUrl: string;
|
|
529
|
+
siteId: string;
|
|
530
|
+
pageKey: string;
|
|
531
|
+
enabled?: boolean;
|
|
532
|
+
}): MarketingPageState & {
|
|
533
|
+
refresh: () => Promise<void>;
|
|
534
|
+
};
|
|
535
|
+
type MarketingPageListState = {
|
|
536
|
+
status: "idle";
|
|
537
|
+
pages: null;
|
|
538
|
+
} | {
|
|
539
|
+
status: "loading";
|
|
540
|
+
pages: null;
|
|
541
|
+
} | {
|
|
542
|
+
status: "ready";
|
|
543
|
+
pages: SiteMarketingPageSummary[];
|
|
544
|
+
} | {
|
|
545
|
+
status: "error";
|
|
546
|
+
pages: null;
|
|
547
|
+
error: Error;
|
|
548
|
+
};
|
|
549
|
+
/**
|
|
550
|
+
* Loads the payload-free directory of marketing pages for a site. Pair with
|
|
551
|
+
* `useMarketingPage(siteId, pageKey)` to render the selected page lazily.
|
|
552
|
+
*/
|
|
553
|
+
export declare function useMarketingPagesList(options: {
|
|
554
|
+
apiKey: string;
|
|
555
|
+
baseUrl: string;
|
|
556
|
+
siteId: string;
|
|
557
|
+
enabled?: boolean;
|
|
558
|
+
}): MarketingPageListState & {
|
|
559
|
+
refresh: () => Promise<void>;
|
|
560
|
+
};
|
|
561
|
+
/**
|
|
562
|
+
* Returns a stable `preload(pageKey)` function that warms the SDK cache for
|
|
563
|
+
* the next page without rendering anything yet. Common pattern: wire it to
|
|
564
|
+
* `<Link onPointerEnter>` / `onFocus` so the next page is ready by the time
|
|
565
|
+
* the visitor clicks. Idempotent — repeat calls are free.
|
|
566
|
+
*/
|
|
567
|
+
export declare function useMarketingPagePreloader(options: {
|
|
568
|
+
apiKey: string;
|
|
569
|
+
baseUrl: string;
|
|
570
|
+
siteId: string;
|
|
571
|
+
}): (pageKey: string) => Promise<GetSiteMarketingPageResponse | null>;
|
|
572
|
+
export { useMarketingBundlePreloader, useMarketingLocales, useMarketingPageBundle, useMarketingPageSeo, useMarketingSection, usePublishedMarketingSchema, } from "./react-marketing.js";
|
|
573
|
+
/**
|
|
574
|
+
* Drop-in email-verification widget for the customer's notification
|
|
575
|
+
* preferences page. Customer enters an email, we mint + send a
|
|
576
|
+
* verification link, they click the link, the deep-link target
|
|
577
|
+
* page consumes the token via {@link VerifyEmailConfirm}.
|
|
578
|
+
*/
|
|
579
|
+
export declare function VerifyEmailFlow(props: {
|
|
580
|
+
apiKey: string;
|
|
581
|
+
baseUrl: string;
|
|
582
|
+
sessionToken: string;
|
|
583
|
+
currentEmail?: string | null;
|
|
584
|
+
onSent?: (destination: string) => void;
|
|
585
|
+
className?: string;
|
|
586
|
+
}): import("react").JSX.Element;
|
|
587
|
+
/**
|
|
588
|
+
* Deep-link target for an email verification flow. Reads the `token`
|
|
589
|
+
* prop (typically pulled from the URL query string), confirms it
|
|
590
|
+
* server-side, and renders success / failure.
|
|
591
|
+
*/
|
|
592
|
+
export declare function VerifyEmailConfirm(props: {
|
|
593
|
+
apiKey: string;
|
|
594
|
+
baseUrl: string;
|
|
595
|
+
sessionToken: string;
|
|
596
|
+
token: string;
|
|
597
|
+
onVerified?: (destination: string) => void;
|
|
598
|
+
className?: string;
|
|
599
|
+
}): import("react").JSX.Element;
|
|
600
|
+
/**
|
|
601
|
+
* Inline SMS-OTP verification flow. Two phases, no round-trip
|
|
602
|
+
* deep link. 6-digit OTP, 5-minute TTL.
|
|
603
|
+
*/
|
|
604
|
+
export declare function VerifyPhoneFlow(props: {
|
|
605
|
+
apiKey: string;
|
|
606
|
+
baseUrl: string;
|
|
607
|
+
sessionToken: string;
|
|
608
|
+
currentPhone?: string | null;
|
|
609
|
+
onVerified?: (destination: string) => void;
|
|
610
|
+
className?: string;
|
|
611
|
+
}): import("react").JSX.Element;
|
|
612
|
+
export type { BiabFormsClient };
|
|
613
|
+
/** Production package-API base URL — the default target for a publishable token
|
|
614
|
+
* when no `baseUrl` is supplied. Override via the `baseUrl` prop for staging or
|
|
615
|
+
* a custom host. Use the **apex** host: `www.biab.app` 307-redirects to the
|
|
616
|
+
* apex, and a CORS preflight does not follow redirects (the browser fails the
|
|
617
|
+
* request), so a browser publishable-token client must target the apex. */
|
|
618
|
+
export declare const DEFAULT_PACKAGE_BASE_URL = "https://biab.app/api/package/v1";
|
|
619
|
+
export type BiabFormProviderProps = {
|
|
620
|
+
/** A forms client (or same-origin proxy). Provide this OR a publishable `token`. */
|
|
621
|
+
client?: BiabFormsClient;
|
|
622
|
+
/**
|
|
623
|
+
* A publishable token (`pk_…`) — builds a browser client that calls BIAB
|
|
624
|
+
* directly. Safe in browser JS: it's origin-locked (the browser sends Origin
|
|
625
|
+
* automatically), rate-limited, and scoped to public read/submit actions
|
|
626
|
+
* only. Requires `siteId`. Use instead of `client` for the zero-backend path.
|
|
627
|
+
*/
|
|
628
|
+
token?: string;
|
|
629
|
+
/** Site id for the `token` client (shown in Site Builder → Developer). */
|
|
630
|
+
siteId?: string;
|
|
631
|
+
/** Package-API base URL for the `token` client. Defaults to production. */
|
|
632
|
+
baseUrl?: string;
|
|
633
|
+
children: ReactNode;
|
|
634
|
+
};
|
|
635
|
+
/** Provide a BIAB forms client to every nested `<BiabForm>`. Pass a `client`, or
|
|
636
|
+
* a publishable `token` + `siteId` (+ optional `baseUrl`) to build a browser
|
|
637
|
+
* client. */
|
|
638
|
+
export declare function BiabFormProvider({ client, token, siteId, baseUrl, children, }: BiabFormProviderProps): import("react").JSX.Element;
|
|
639
|
+
/** Read the client from a surrounding `<BiabFormProvider>`, if any. */
|
|
640
|
+
export declare function useBiabFormsClient(): BiabFormsClient | null;
|
|
641
|
+
export type BiabFormProps = {
|
|
642
|
+
/** Form slug to load via the client. Omit when passing a pre-fetched `schema`. */
|
|
643
|
+
slug?: string;
|
|
644
|
+
/**
|
|
645
|
+
* SDK client (or same-origin proxy). Falls back to `token`, then to a
|
|
646
|
+
* surrounding `<BiabFormProvider>`. Required unless a pre-fetched `schema` is
|
|
647
|
+
* supplied AND no submit is needed (submit needs a client).
|
|
648
|
+
*/
|
|
649
|
+
client?: BiabFormsClient;
|
|
650
|
+
/**
|
|
651
|
+
* A publishable token (`pk_…`) — builds a browser client that calls BIAB
|
|
652
|
+
* directly, so `<BiabForm slug token siteId />` works with zero backend
|
|
653
|
+
* wiring. Safe in browser JS (origin-locked, rate-limited, public
|
|
654
|
+
* read/submit only). Requires `siteId`.
|
|
655
|
+
*/
|
|
656
|
+
token?: string;
|
|
657
|
+
/** Site id for the `token` client (shown in Site Builder → Developer). */
|
|
658
|
+
siteId?: string;
|
|
659
|
+
/** Package-API base URL for the `token` client. Defaults to production. */
|
|
660
|
+
baseUrl?: string;
|
|
661
|
+
/** Pre-fetched schema (SSR / RSC). Adopted synchronously; no schema fetch. */
|
|
662
|
+
schema?: FormSchema;
|
|
663
|
+
/** Provenance / recipient passthrough merged into every submit. */
|
|
664
|
+
submitOptions?: CreateFormControllerOptions["submitOptions"];
|
|
665
|
+
/** Validate against the live schema server-side but store nothing. */
|
|
666
|
+
dryRun?: boolean;
|
|
667
|
+
/** Label for the final Submit button. */
|
|
668
|
+
submitLabel?: string;
|
|
669
|
+
/** Called with the final values after the controller validates locally and the
|
|
670
|
+
* submit resolves successfully. */
|
|
671
|
+
onSubmit?: (values: Record<string, unknown>) => void;
|
|
672
|
+
onSuccess?: (result: Extract<FormSubmitResult, {
|
|
673
|
+
ok: true;
|
|
674
|
+
}>) => void;
|
|
675
|
+
onError?: (result: Extract<FormSubmitResult, {
|
|
676
|
+
ok: false;
|
|
677
|
+
}>) => void;
|
|
678
|
+
/** Render when the schema is loading. */
|
|
679
|
+
loadingFallback?: ReactNode;
|
|
680
|
+
/** Render when the schema fails to load (receives the message). */
|
|
681
|
+
errorFallback?: (message: string) => ReactNode;
|
|
682
|
+
/** Render after a successful submit instead of the default confirmation. */
|
|
683
|
+
successFallback?: (result: Extract<FormSubmitResult, {
|
|
684
|
+
ok: true;
|
|
685
|
+
}>) => ReactNode;
|
|
686
|
+
/**
|
|
687
|
+
* HTML autofill default for every input in the form. `true` (default) infers
|
|
688
|
+
* a sensible `autocomplete` token per field (name/email/tel/address/…) so
|
|
689
|
+
* browsers offer autofill; `false` emits `autocomplete="off"` on all inputs.
|
|
690
|
+
* Override individual fields with `fieldAutoComplete`.
|
|
691
|
+
*/
|
|
692
|
+
autoComplete?: boolean;
|
|
693
|
+
/**
|
|
694
|
+
* Per-field autofill overrides, keyed by field id. A literal token
|
|
695
|
+
* (e.g. "email", "given-name", "off"), `true` (force inference), or `false`
|
|
696
|
+
* (off). Wins over `autoComplete` and any schema-level token.
|
|
697
|
+
*/
|
|
698
|
+
fieldAutoComplete?: Record<string, string | boolean>;
|
|
699
|
+
/** Extra class on the root `.biab-form` element. `class` is accepted as an
|
|
700
|
+
* alias for non-JSX callers / parity with other framework bindings. */
|
|
701
|
+
className?: string;
|
|
702
|
+
class?: string;
|
|
703
|
+
style?: CSSProperties;
|
|
704
|
+
};
|
|
705
|
+
export declare function BiabForm(props: BiabFormProps): import("react").JSX.Element;
|
|
706
|
+
export type SocialLinksProps = {
|
|
707
|
+
/** The company profile's `socials` record (e.g. `storefrontMeta().socials`). */
|
|
708
|
+
socials: unknown;
|
|
709
|
+
/**
|
|
710
|
+
* Icon color for branded glyphs — a hex (no `#`) or CSS color keyword passed
|
|
711
|
+
* to the simple-icons CDN. Omit to use each brand's official color.
|
|
712
|
+
*/
|
|
713
|
+
color?: string;
|
|
714
|
+
/** Icon edge length in px (default 20). */
|
|
715
|
+
size?: number;
|
|
716
|
+
className?: string;
|
|
717
|
+
linkClassName?: string;
|
|
718
|
+
iconClassName?: string;
|
|
719
|
+
};
|
|
720
|
+
/**
|
|
721
|
+
* Render every social profile on the company as an icon + link, in canonical
|
|
722
|
+
* order, resolving BIAB's exact keys (`meta`, `twitterX`, …) for you. Branded
|
|
723
|
+
* glyphs come from the simple-icons CDN; platforms without one fall back to a
|
|
724
|
+
* globe. Returns `null` when no socials are set.
|
|
725
|
+
*/
|
|
726
|
+
export declare function SocialLinks({ socials, color, size, className, linkClassName, iconClassName, }: SocialLinksProps): import("react").JSX.Element | null;
|
|
727
|
+
//# sourceMappingURL=react.d.ts.map
|