@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.
Files changed (268) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +899 -0
  3. package/dist/adapters-revalidate.d.ts +44 -0
  4. package/dist/adapters-revalidate.d.ts.map +1 -0
  5. package/dist/adapters-revalidate.js +68 -0
  6. package/dist/adapters-revalidate.js.map +1 -0
  7. package/dist/alpha.d.ts +21 -0
  8. package/dist/alpha.d.ts.map +1 -0
  9. package/dist/alpha.js +21 -0
  10. package/dist/alpha.js.map +1 -0
  11. package/dist/analytics-core.d.ts +34 -0
  12. package/dist/analytics-core.d.ts.map +1 -0
  13. package/dist/analytics-core.js +138 -0
  14. package/dist/analytics-core.js.map +1 -0
  15. package/dist/analytics-server.d.ts +54 -0
  16. package/dist/analytics-server.d.ts.map +1 -0
  17. package/dist/analytics-server.js +78 -0
  18. package/dist/analytics-server.js.map +1 -0
  19. package/dist/attribution-logo.d.ts +2 -0
  20. package/dist/attribution-logo.d.ts.map +1 -0
  21. package/dist/attribution-logo.js +5 -0
  22. package/dist/attribution-logo.js.map +1 -0
  23. package/dist/auth-handler.d.ts +92 -0
  24. package/dist/auth-handler.d.ts.map +1 -0
  25. package/dist/auth-handler.js +277 -0
  26. package/dist/auth-handler.js.map +1 -0
  27. package/dist/biab-forms.css +484 -0
  28. package/dist/cli.d.ts +46 -0
  29. package/dist/cli.d.ts.map +1 -0
  30. package/dist/cli.js +1824 -0
  31. package/dist/cli.js.map +1 -0
  32. package/dist/client.d.ts +1681 -0
  33. package/dist/client.d.ts.map +1 -0
  34. package/dist/client.js +2845 -0
  35. package/dist/client.js.map +1 -0
  36. package/dist/collections.d.ts +13 -0
  37. package/dist/collections.d.ts.map +1 -0
  38. package/dist/collections.js +13 -0
  39. package/dist/collections.js.map +1 -0
  40. package/dist/contracts.d.ts +14609 -0
  41. package/dist/contracts.d.ts.map +1 -0
  42. package/dist/contracts.js +2428 -0
  43. package/dist/contracts.js.map +1 -0
  44. package/dist/data-model-schema.d.ts +962 -0
  45. package/dist/data-model-schema.d.ts.map +1 -0
  46. package/dist/data-model-schema.js +2295 -0
  47. package/dist/data-model-schema.js.map +1 -0
  48. package/dist/distribution.d.ts +38 -0
  49. package/dist/distribution.d.ts.map +1 -0
  50. package/dist/distribution.js +61 -0
  51. package/dist/distribution.js.map +1 -0
  52. package/dist/element.d.ts +121 -0
  53. package/dist/element.d.ts.map +1 -0
  54. package/dist/element.js +276 -0
  55. package/dist/element.js.map +1 -0
  56. package/dist/enums.d.ts +25 -0
  57. package/dist/enums.d.ts.map +1 -0
  58. package/dist/enums.js +38 -0
  59. package/dist/enums.js.map +1 -0
  60. package/dist/errors.d.ts +195 -0
  61. package/dist/errors.d.ts.map +1 -0
  62. package/dist/errors.js +188 -0
  63. package/dist/errors.js.map +1 -0
  64. package/dist/forms-core/autocomplete.d.ts +37 -0
  65. package/dist/forms-core/autocomplete.d.ts.map +1 -0
  66. package/dist/forms-core/autocomplete.js +82 -0
  67. package/dist/forms-core/autocomplete.js.map +1 -0
  68. package/dist/forms-core/business-function.d.ts +61 -0
  69. package/dist/forms-core/business-function.d.ts.map +1 -0
  70. package/dist/forms-core/business-function.js +149 -0
  71. package/dist/forms-core/business-function.js.map +1 -0
  72. package/dist/forms-core/calculation.d.ts +72 -0
  73. package/dist/forms-core/calculation.d.ts.map +1 -0
  74. package/dist/forms-core/calculation.js +103 -0
  75. package/dist/forms-core/calculation.js.map +1 -0
  76. package/dist/forms-core/controller.d.ts +249 -0
  77. package/dist/forms-core/controller.d.ts.map +1 -0
  78. package/dist/forms-core/controller.js +590 -0
  79. package/dist/forms-core/controller.js.map +1 -0
  80. package/dist/forms-core/elements.d.ts +44 -0
  81. package/dist/forms-core/elements.d.ts.map +1 -0
  82. package/dist/forms-core/elements.js +68 -0
  83. package/dist/forms-core/elements.js.map +1 -0
  84. package/dist/forms-core/email-domains.d.ts +10 -0
  85. package/dist/forms-core/email-domains.d.ts.map +1 -0
  86. package/dist/forms-core/email-domains.js +69 -0
  87. package/dist/forms-core/email-domains.js.map +1 -0
  88. package/dist/forms-core/file-rules.d.ts +51 -0
  89. package/dist/forms-core/file-rules.d.ts.map +1 -0
  90. package/dist/forms-core/file-rules.js +105 -0
  91. package/dist/forms-core/file-rules.js.map +1 -0
  92. package/dist/forms-core/formula.d.ts +114 -0
  93. package/dist/forms-core/formula.d.ts.map +1 -0
  94. package/dist/forms-core/formula.js +1170 -0
  95. package/dist/forms-core/formula.js.map +1 -0
  96. package/dist/forms-core/index.d.ts +24 -0
  97. package/dist/forms-core/index.d.ts.map +1 -0
  98. package/dist/forms-core/index.js +28 -0
  99. package/dist/forms-core/index.js.map +1 -0
  100. package/dist/forms-core/units.d.ts +49 -0
  101. package/dist/forms-core/units.d.ts.map +1 -0
  102. package/dist/forms-core/units.js +255 -0
  103. package/dist/forms-core/units.js.map +1 -0
  104. package/dist/forms-core/us-states.d.ts +14 -0
  105. package/dist/forms-core/us-states.d.ts.map +1 -0
  106. package/dist/forms-core/us-states.js +66 -0
  107. package/dist/forms-core/us-states.js.map +1 -0
  108. package/dist/forms-core/validation.d.ts +266 -0
  109. package/dist/forms-core/validation.d.ts.map +1 -0
  110. package/dist/forms-core/validation.js +850 -0
  111. package/dist/forms-core/validation.js.map +1 -0
  112. package/dist/forms.d.ts +19 -0
  113. package/dist/forms.d.ts.map +1 -0
  114. package/dist/forms.js +29 -0
  115. package/dist/forms.js.map +1 -0
  116. package/dist/gallery-types.d.ts +32 -0
  117. package/dist/gallery-types.d.ts.map +1 -0
  118. package/dist/gallery-types.js +2 -0
  119. package/dist/gallery-types.js.map +1 -0
  120. package/dist/graphql.d.ts +97 -0
  121. package/dist/graphql.d.ts.map +1 -0
  122. package/dist/graphql.js +212 -0
  123. package/dist/graphql.js.map +1 -0
  124. package/dist/index.cjs +19448 -0
  125. package/dist/index.d.cts +19 -0
  126. package/dist/index.d.mts +19 -0
  127. package/dist/index.d.ts +19 -0
  128. package/dist/index.d.ts.map +1 -0
  129. package/dist/index.js +20 -0
  130. package/dist/index.js.map +1 -0
  131. package/dist/marketing-schema.d.ts +216 -0
  132. package/dist/marketing-schema.d.ts.map +1 -0
  133. package/dist/marketing-schema.js +200 -0
  134. package/dist/marketing-schema.js.map +1 -0
  135. package/dist/mcp.d.ts +42 -0
  136. package/dist/mcp.d.ts.map +1 -0
  137. package/dist/mcp.js +87 -0
  138. package/dist/mcp.js.map +1 -0
  139. package/dist/native.d.ts +45 -0
  140. package/dist/native.d.ts.map +1 -0
  141. package/dist/native.js +43 -0
  142. package/dist/native.js.map +1 -0
  143. package/dist/next-revalidate.d.ts +43 -0
  144. package/dist/next-revalidate.d.ts.map +1 -0
  145. package/dist/next-revalidate.js +84 -0
  146. package/dist/next-revalidate.js.map +1 -0
  147. package/dist/parallel-pages.d.ts +102 -0
  148. package/dist/parallel-pages.d.ts.map +1 -0
  149. package/dist/parallel-pages.js +108 -0
  150. package/dist/parallel-pages.js.map +1 -0
  151. package/dist/payment-icons.d.ts +66 -0
  152. package/dist/payment-icons.d.ts.map +1 -0
  153. package/dist/payment-icons.js +160 -0
  154. package/dist/payment-icons.js.map +1 -0
  155. package/dist/proxy.d.ts +67 -0
  156. package/dist/proxy.d.ts.map +1 -0
  157. package/dist/proxy.js +97 -0
  158. package/dist/proxy.js.map +1 -0
  159. package/dist/react-analytics.d.ts +39 -0
  160. package/dist/react-analytics.d.ts.map +1 -0
  161. package/dist/react-analytics.js +59 -0
  162. package/dist/react-analytics.js.map +1 -0
  163. package/dist/react-attribution.d.ts +99 -0
  164. package/dist/react-attribution.d.ts.map +1 -0
  165. package/dist/react-attribution.js +52 -0
  166. package/dist/react-attribution.js.map +1 -0
  167. package/dist/react-marketing.d.ts +181 -0
  168. package/dist/react-marketing.d.ts.map +1 -0
  169. package/dist/react-marketing.js +215 -0
  170. package/dist/react-marketing.js.map +1 -0
  171. package/dist/react.d.ts +727 -0
  172. package/dist/react.d.ts.map +1 -0
  173. package/dist/react.js +2418 -0
  174. package/dist/react.js.map +1 -0
  175. package/dist/reserved-paths.d.ts +24 -0
  176. package/dist/reserved-paths.d.ts.map +1 -0
  177. package/dist/reserved-paths.js +60 -0
  178. package/dist/reserved-paths.js.map +1 -0
  179. package/dist/revalidate-verify.d.ts +30 -0
  180. package/dist/revalidate-verify.d.ts.map +1 -0
  181. package/dist/revalidate-verify.js +74 -0
  182. package/dist/revalidate-verify.js.map +1 -0
  183. package/dist/sdk.d.ts +678 -0
  184. package/dist/sdk.d.ts.map +1 -0
  185. package/dist/sdk.js +801 -0
  186. package/dist/sdk.js.map +1 -0
  187. package/dist/seo.d.ts +218 -0
  188. package/dist/seo.d.ts.map +1 -0
  189. package/dist/seo.js +309 -0
  190. package/dist/seo.js.map +1 -0
  191. package/dist/socials.d.ts +47 -0
  192. package/dist/socials.d.ts.map +1 -0
  193. package/dist/socials.js +172 -0
  194. package/dist/socials.js.map +1 -0
  195. package/dist/static.d.ts +14 -0
  196. package/dist/static.d.ts.map +1 -0
  197. package/dist/static.js +14 -0
  198. package/dist/static.js.map +1 -0
  199. package/dist/url-pattern.d.ts +47 -0
  200. package/dist/url-pattern.d.ts.map +1 -0
  201. package/dist/url-pattern.js +124 -0
  202. package/dist/url-pattern.js.map +1 -0
  203. package/dist/vanilla.d.ts +77 -0
  204. package/dist/vanilla.d.ts.map +1 -0
  205. package/dist/vanilla.js +903 -0
  206. package/dist/vanilla.js.map +1 -0
  207. package/openapi.json +13779 -0
  208. package/package.json +204 -0
  209. package/src/adapters-revalidate.ts +88 -0
  210. package/src/alpha.ts +89 -0
  211. package/src/analytics-core.ts +175 -0
  212. package/src/analytics-server.ts +99 -0
  213. package/src/angular/biab-form.component.ts +1443 -0
  214. package/src/angular/index.ts +26 -0
  215. package/src/attribution-logo.ts +5 -0
  216. package/src/auth-handler.ts +352 -0
  217. package/src/cli.ts +2517 -0
  218. package/src/client.ts +3578 -0
  219. package/src/collections.ts +101 -0
  220. package/src/contracts.ts +3390 -0
  221. package/src/data-model-schema.ts +4042 -0
  222. package/src/distribution.ts +73 -0
  223. package/src/element.ts +321 -0
  224. package/src/enums.ts +65 -0
  225. package/src/errors.ts +338 -0
  226. package/src/forms-core/autocomplete.ts +97 -0
  227. package/src/forms-core/business-function.ts +209 -0
  228. package/src/forms-core/calculation.ts +167 -0
  229. package/src/forms-core/controller.ts +922 -0
  230. package/src/forms-core/elements.ts +86 -0
  231. package/src/forms-core/email-domains.ts +68 -0
  232. package/src/forms-core/file-rules.ts +123 -0
  233. package/src/forms-core/formula.ts +1339 -0
  234. package/src/forms-core/index.ts +122 -0
  235. package/src/forms-core/units.ts +308 -0
  236. package/src/forms-core/us-states.ts +68 -0
  237. package/src/forms-core/validation.ts +1037 -0
  238. package/src/forms.ts +63 -0
  239. package/src/gallery-types.ts +31 -0
  240. package/src/graphql.ts +295 -0
  241. package/src/index.ts +505 -0
  242. package/src/marketing-schema.ts +395 -0
  243. package/src/mcp.ts +108 -0
  244. package/src/native.ts +73 -0
  245. package/src/next-revalidate.ts +124 -0
  246. package/src/parallel-pages.ts +192 -0
  247. package/src/payment-icons.ts +205 -0
  248. package/src/proxy.ts +173 -0
  249. package/src/qwik.tsx +1234 -0
  250. package/src/react-analytics.tsx +76 -0
  251. package/src/react-attribution.tsx +192 -0
  252. package/src/react-marketing.tsx +338 -0
  253. package/src/react.tsx +5495 -0
  254. package/src/reserved-paths.ts +65 -0
  255. package/src/revalidate-verify.ts +98 -0
  256. package/src/sdk.ts +1671 -0
  257. package/src/seo.ts +488 -0
  258. package/src/socials.ts +230 -0
  259. package/src/solid.tsx +1466 -0
  260. package/src/static.ts +21 -0
  261. package/src/styles/biab-forms.css +484 -0
  262. package/src/svelte/BiabForm.svelte +1069 -0
  263. package/src/svelte/context.ts +57 -0
  264. package/src/svelte/index.ts +79 -0
  265. package/src/url-pattern.ts +153 -0
  266. package/src/vanilla.ts +1290 -0
  267. package/src/vue/BiabForm.vue +1538 -0
  268. package/src/vue/index.ts +119 -0
@@ -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