@businessdash/sdk 0.9.80 → 0.9.90

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 (264) hide show
  1. package/README.md +133 -949
  2. package/assets/{biab-sw.js → bd-sw.js} +2 -2
  3. package/dist/account-core/index.d.ts +1 -1
  4. package/dist/account-core/index.d.ts.map +1 -1
  5. package/dist/adapters-revalidate.d.ts +2 -2
  6. package/dist/adapters-revalidate.js +2 -2
  7. package/dist/adapters-revalidate.js.map +1 -1
  8. package/dist/analytics-core.d.ts +6 -6
  9. package/dist/analytics-core.d.ts.map +1 -1
  10. package/dist/analytics-core.js +4 -4
  11. package/dist/analytics-core.js.map +1 -1
  12. package/dist/analytics-server.d.ts +6 -6
  13. package/dist/analytics-server.d.ts.map +1 -1
  14. package/dist/analytics-server.js +5 -5
  15. package/dist/auth-handler.d.ts +14 -14
  16. package/dist/auth-handler.d.ts.map +1 -1
  17. package/dist/auth-handler.js +16 -16
  18. package/dist/auth-handler.js.map +1 -1
  19. package/dist/auth-links.d.ts +2 -2
  20. package/dist/auth-links.d.ts.map +1 -1
  21. package/dist/auth-links.js +2 -2
  22. package/dist/auth-links.js.map +1 -1
  23. package/dist/{biab-forms.css → bd-forms.css} +158 -158
  24. package/dist/cli.d.ts +4 -4
  25. package/dist/cli.js +78 -78
  26. package/dist/cli.js.map +1 -1
  27. package/dist/client.d.ts +158 -147
  28. package/dist/client.d.ts.map +1 -1
  29. package/dist/client.js +156 -137
  30. package/dist/client.js.map +1 -1
  31. package/dist/consent-core/index.cjs +2 -2
  32. package/dist/consent-core/index.d.ts +2 -2
  33. package/dist/consent-core/index.d.ts.map +1 -1
  34. package/dist/consent-core/index.js +10 -8
  35. package/dist/consent-core/index.js.map +1 -1
  36. package/dist/contracts.d.ts +411 -52
  37. package/dist/contracts.d.ts.map +1 -1
  38. package/dist/contracts.js +89 -15
  39. package/dist/contracts.js.map +1 -1
  40. package/dist/data-model-schema.d.ts +15 -15
  41. package/dist/data-model-schema.d.ts.map +1 -1
  42. package/dist/data-model-schema.js +19 -17
  43. package/dist/data-model-schema.js.map +1 -1
  44. package/dist/distribution.d.ts +5 -5
  45. package/dist/distribution.d.ts.map +1 -1
  46. package/dist/distribution.js +4 -4
  47. package/dist/element.d.ts +36 -36
  48. package/dist/element.d.ts.map +1 -1
  49. package/dist/element.js +43 -43
  50. package/dist/element.js.map +1 -1
  51. package/dist/embed-protocol.d.ts +11 -11
  52. package/dist/embed-protocol.d.ts.map +1 -1
  53. package/dist/embed-protocol.js +1 -1
  54. package/dist/embed-protocol.js.map +1 -1
  55. package/dist/errors.d.ts +15 -15
  56. package/dist/errors.d.ts.map +1 -1
  57. package/dist/errors.js +18 -18
  58. package/dist/errors.js.map +1 -1
  59. package/dist/forms-core/autocomplete.d.ts +3 -3
  60. package/dist/forms-core/autocomplete.d.ts.map +1 -1
  61. package/dist/forms-core/autocomplete.js +2 -2
  62. package/dist/forms-core/controller.d.ts +10 -10
  63. package/dist/forms-core/controller.d.ts.map +1 -1
  64. package/dist/forms-core/controller.js +4 -4
  65. package/dist/forms-core/controller.js.map +1 -1
  66. package/dist/forms-core/elements.d.ts +4 -4
  67. package/dist/forms-core/elements.d.ts.map +1 -1
  68. package/dist/forms-core/elements.js +7 -7
  69. package/dist/forms-core/elements.js.map +1 -1
  70. package/dist/forms-core/formula.d.ts +1 -1
  71. package/dist/forms-core/formula.js +1 -1
  72. package/dist/forms-core/index.d.ts +6 -6
  73. package/dist/forms-core/index.d.ts.map +1 -1
  74. package/dist/forms-core/index.js +5 -5
  75. package/dist/forms-core/index.js.map +1 -1
  76. package/dist/forms-core/units.d.ts +1 -1
  77. package/dist/forms-core/units.js +1 -1
  78. package/dist/forms-core/us-states.d.ts +1 -1
  79. package/dist/forms-core/us-states.js +1 -1
  80. package/dist/forms-core/validation.d.ts +12 -3
  81. package/dist/forms-core/validation.d.ts.map +1 -1
  82. package/dist/forms-core/validation.js +152 -17
  83. package/dist/forms-core/validation.js.map +1 -1
  84. package/dist/forms.d.ts +2 -2
  85. package/dist/forms.d.ts.map +1 -1
  86. package/dist/forms.js +2 -2
  87. package/dist/forms.js.map +1 -1
  88. package/dist/framework-support.js +1 -1
  89. package/dist/framework-support.js.map +1 -1
  90. package/dist/gallery-types.d.ts +1 -1
  91. package/dist/graphql.d.ts +3 -3
  92. package/dist/graphql.d.ts.map +1 -1
  93. package/dist/graphql.js +3 -3
  94. package/dist/graphql.js.map +1 -1
  95. package/dist/index.cjs +351 -272
  96. package/dist/index.d.cts +5 -5
  97. package/dist/index.d.mts +5 -5
  98. package/dist/index.d.ts +5 -5
  99. package/dist/index.d.ts.map +1 -1
  100. package/dist/index.js +5 -5
  101. package/dist/index.js.map +1 -1
  102. package/dist/legal-core/index.cjs +8 -8
  103. package/dist/legal-core/index.d.ts +3 -3
  104. package/dist/legal-core/index.d.ts.map +1 -1
  105. package/dist/legal-core/index.js +11 -11
  106. package/dist/legal-core/index.js.map +1 -1
  107. package/dist/marketing-core/index.d.ts +51 -1
  108. package/dist/marketing-core/index.d.ts.map +1 -1
  109. package/dist/marketing-core/index.js +35 -0
  110. package/dist/marketing-core/index.js.map +1 -1
  111. package/dist/marketing-schema.d.ts +9 -9
  112. package/dist/marketing-schema.d.ts.map +1 -1
  113. package/dist/marketing-schema.js +1 -1
  114. package/dist/mcp.d.ts +4 -4
  115. package/dist/mcp.js +4 -4
  116. package/dist/native.d.ts +6 -6
  117. package/dist/native.d.ts.map +1 -1
  118. package/dist/native.js +4 -4
  119. package/dist/native.js.map +1 -1
  120. package/dist/next-revalidate.d.ts +8 -8
  121. package/dist/next-revalidate.d.ts.map +1 -1
  122. package/dist/next-revalidate.js +7 -7
  123. package/dist/next-revalidate.js.map +1 -1
  124. package/dist/notifications-core/index.d.ts +1 -1
  125. package/dist/notifications-core/index.js +1 -1
  126. package/dist/parallel-pages.d.ts +4 -4
  127. package/dist/parallel-pages.d.ts.map +1 -1
  128. package/dist/parallel-pages.js +5 -5
  129. package/dist/parallel-pages.js.map +1 -1
  130. package/dist/portal-core/index.d.ts +1 -1
  131. package/dist/portal-core/index.js +1 -1
  132. package/dist/proxy.d.ts +18 -18
  133. package/dist/proxy.d.ts.map +1 -1
  134. package/dist/proxy.js +10 -10
  135. package/dist/proxy.js.map +1 -1
  136. package/dist/push-core/index.cjs +6 -2
  137. package/dist/push-core/index.d.ts +1 -1
  138. package/dist/push-core/index.d.ts.map +1 -1
  139. package/dist/push-core/index.js +6 -2
  140. package/dist/push-core/index.js.map +1 -1
  141. package/dist/react-analytics.d.ts +14 -14
  142. package/dist/react-analytics.d.ts.map +1 -1
  143. package/dist/react-analytics.js +15 -15
  144. package/dist/react-analytics.js.map +1 -1
  145. package/dist/react-attribution.d.ts +2 -2
  146. package/dist/react-attribution.d.ts.map +1 -1
  147. package/dist/react-attribution.js +1 -1
  148. package/dist/react-marketing.js +5 -5
  149. package/dist/react-marketing.js.map +1 -1
  150. package/dist/react.d.ts +38 -61
  151. package/dist/react.d.ts.map +1 -1
  152. package/dist/react.js +247 -261
  153. package/dist/react.js.map +1 -1
  154. package/dist/reserved-paths.d.ts +2 -2
  155. package/dist/reserved-paths.js +3 -3
  156. package/dist/reserved-paths.js.map +1 -1
  157. package/dist/revalidate-verify.d.ts +3 -3
  158. package/dist/revalidate-verify.d.ts.map +1 -1
  159. package/dist/revalidate-verify.js +1 -1
  160. package/dist/revalidate-verify.js.map +1 -1
  161. package/dist/sdk.d.ts +51 -45
  162. package/dist/sdk.d.ts.map +1 -1
  163. package/dist/sdk.js +48 -50
  164. package/dist/sdk.js.map +1 -1
  165. package/dist/seed-core/index.js +8 -8
  166. package/dist/seed-core/index.js.map +1 -1
  167. package/dist/seo-core/blog.d.ts +1 -1
  168. package/dist/seo-core/blog.js +1 -1
  169. package/dist/seo-core/blog.js.map +1 -1
  170. package/dist/seo-core/index.cjs +2 -2
  171. package/dist/seo-core/index.js +1 -1
  172. package/dist/seo-core/index.js.map +1 -1
  173. package/dist/seo.d.ts +1 -1
  174. package/dist/seo.d.ts.map +1 -1
  175. package/dist/seo.js +1 -1
  176. package/dist/seo.js.map +1 -1
  177. package/dist/sitemap-core/index.cjs +5 -5
  178. package/dist/sitemap-core/index.d.ts +13 -5
  179. package/dist/sitemap-core/index.d.ts.map +1 -1
  180. package/dist/sitemap-core/index.js +4 -4
  181. package/dist/sitemap-core/index.js.map +1 -1
  182. package/dist/socials.d.ts +6 -6
  183. package/dist/socials.d.ts.map +1 -1
  184. package/dist/socials.js +5 -5
  185. package/dist/socials.js.map +1 -1
  186. package/dist/solid-compat.d.ts +1 -1
  187. package/dist/solid-compat.js +4 -4
  188. package/dist/solid-compat.js.map +1 -1
  189. package/dist/store-core/index.d.ts +1 -1
  190. package/dist/vanilla.d.ts +12 -12
  191. package/dist/vanilla.d.ts.map +1 -1
  192. package/dist/vanilla.js +192 -145
  193. package/dist/vanilla.js.map +1 -1
  194. package/openapi.json +264 -1
  195. package/package.json +8 -8
  196. package/src/account-core/index.ts +1 -1
  197. package/src/adapters-revalidate.ts +3 -3
  198. package/src/analytics-core.ts +8 -8
  199. package/src/analytics-server.ts +6 -6
  200. package/src/angular/{biab-form.component.ts → bd-form.component.ts} +269 -161
  201. package/src/angular/headless.ts +12 -12
  202. package/src/angular/index.ts +9 -9
  203. package/src/auth-handler.ts +22 -22
  204. package/src/auth-links.ts +2 -2
  205. package/src/cli.ts +81 -81
  206. package/src/client.ts +218 -193
  207. package/src/consent-core/index.ts +10 -8
  208. package/src/contracts.ts +99 -15
  209. package/src/data-model-schema.ts +29 -26
  210. package/src/distribution.ts +5 -5
  211. package/src/element.ts +54 -54
  212. package/src/embed-protocol.ts +14 -14
  213. package/src/errors.ts +27 -27
  214. package/src/forms-core/autocomplete.ts +3 -3
  215. package/src/forms-core/controller.ts +12 -12
  216. package/src/forms-core/elements.ts +7 -7
  217. package/src/forms-core/formula.ts +1 -1
  218. package/src/forms-core/index.ts +8 -8
  219. package/src/forms-core/units.ts +1 -1
  220. package/src/forms-core/us-states.ts +1 -1
  221. package/src/forms-core/validation.ts +158 -14
  222. package/src/forms.ts +2 -2
  223. package/src/framework-support.ts +1 -1
  224. package/src/gallery-types.ts +1 -1
  225. package/src/graphql.ts +4 -4
  226. package/src/index.ts +38 -38
  227. package/src/legal-core/index.ts +12 -12
  228. package/src/marketing-core/index.ts +62 -0
  229. package/src/marketing-schema.ts +9 -9
  230. package/src/mcp.ts +4 -4
  231. package/src/native.ts +14 -14
  232. package/src/next-revalidate.ts +10 -10
  233. package/src/notifications-core/index.ts +1 -1
  234. package/src/parallel-pages.ts +6 -6
  235. package/src/portal-core/index.ts +1 -1
  236. package/src/proxy.ts +28 -28
  237. package/src/push-core/index.ts +11 -5
  238. package/src/qwik.tsx +262 -166
  239. package/src/react-analytics.tsx +17 -17
  240. package/src/react-attribution.tsx +2 -2
  241. package/src/react-marketing.tsx +5 -5
  242. package/src/react.tsx +541 -500
  243. package/src/reserved-paths.ts +3 -3
  244. package/src/revalidate-verify.ts +5 -5
  245. package/src/sdk.ts +131 -101
  246. package/src/seed-core/index.ts +8 -8
  247. package/src/seo-core/blog.ts +2 -2
  248. package/src/seo-core/index.ts +1 -1
  249. package/src/seo.ts +1 -1
  250. package/src/sitemap-core/index.ts +17 -9
  251. package/src/socials.ts +6 -6
  252. package/src/solid-compat.tsx +5 -5
  253. package/src/solid-surfaces.tsx +28 -28
  254. package/src/solid.tsx +264 -175
  255. package/src/store-core/index.ts +1 -1
  256. package/src/styles/{biab-forms.css → bd-forms.css} +158 -158
  257. package/src/svelte/{BiabForm.svelte → BdForm.svelte} +240 -173
  258. package/src/svelte/context.ts +16 -16
  259. package/src/svelte/headless.ts +10 -10
  260. package/src/svelte/index.ts +16 -16
  261. package/src/vanilla.ts +250 -169
  262. package/src/vue/{BiabForm.vue → BdForm.vue} +270 -157
  263. package/src/vue/headless.ts +11 -11
  264. package/src/vue/index.ts +26 -26
@@ -41,7 +41,7 @@
41
41
  * @module
42
42
  */
43
43
 
44
- import { BiabAccessRejectedError } from "../errors.js";
44
+ import { BdAccessRejectedError } from "../errors.js";
45
45
  import { isReservedPagePath } from "../reserved-paths.js";
46
46
 
47
47
  /** Where a kind of platform content lives on YOUR site. */
@@ -74,8 +74,11 @@ export type SitemapRoutes = {
74
74
  export type SitemapEntry = {
75
75
  /** Absolute URL. */
76
76
  loc: string;
77
- /** ISO 8601. Omitted when nothing meaningful is known. */
78
- lastmod?: string;
77
+ /** ISO 8601. Omitted when nothing meaningful is known. The explicit
78
+ * `| undefined` matters under exactOptionalPropertyTypes: the real
79
+ * client's `sitemapEntries()` rows carry `lastmod?: string | undefined`,
80
+ * and without it the facade fails the SitemapClientLike contract. */
81
+ lastmod?: string | undefined;
79
82
  };
80
83
 
81
84
  export type BuildSitemapOptions = {
@@ -106,16 +109,21 @@ export type BuildSitemapOptions = {
106
109
  onSkip?: (section: string, reason: string) => void;
107
110
  };
108
111
 
109
- /** The subset of the SDK client this needs. */
112
+ /** The subset of the SDK client this needs. Shapes mirror the REAL
113
+ * client responses (`{ items, … }` — blogListPostsResponseSchema and
114
+ * storefrontListProductsResponseSchema): this type once said `posts`/
115
+ * `products`, so the destructure came back undefined, the loop threw,
116
+ * and every real sitemap silently reported its blog and product
117
+ * sections as "unreachable". */
110
118
  export type SitemapClientLike = {
111
119
  blog: {
112
120
  listPosts(input?: { limit?: number }): Promise<{
113
- posts: Array<{ slug: string; updatedAt?: string | null }>;
121
+ items: Array<{ slug: string; updatedAt?: string | null }>;
114
122
  }>;
115
123
  };
116
124
  storefront: {
117
125
  listProducts(input?: { limit?: number }): Promise<{
118
- products: Array<{ id: string; updatedAt?: string | null }>;
126
+ items: Array<{ id: string; updatedAt?: string | null }>;
119
127
  }>;
120
128
  };
121
129
  site(siteId: string): {
@@ -148,7 +156,7 @@ function escapeXml(value: string): string {
148
156
  * gives up on an error page.
149
157
  */
150
158
  function isExpectedAbsence(cause: unknown): boolean {
151
- return cause instanceof BiabAccessRejectedError;
159
+ return cause instanceof BdAccessRejectedError;
152
160
  }
153
161
 
154
162
  /**
@@ -209,7 +217,7 @@ export async function collectSitemapEntries(
209
217
  // 3. Blog — only when you told us where it lives.
210
218
  if (routes.blog) {
211
219
  try {
212
- const { posts } = await client.blog.listPosts({
220
+ const { items: posts } = await client.blog.listPosts({
213
221
  limit: options.blogLimit ?? 1000,
214
222
  });
215
223
  for (const post of posts) {
@@ -230,7 +238,7 @@ export async function collectSitemapEntries(
230
238
  // 4. Products — same rule.
231
239
  if (routes.product) {
232
240
  try {
233
- const { products } = await client.storefront.listProducts({
241
+ const { items: products } = await client.storefront.listProducts({
234
242
  limit: options.productLimit ?? 1000,
235
243
  });
236
244
  for (const product of products) {
package/src/socials.ts CHANGED
@@ -2,10 +2,10 @@
2
2
  * Canonical social-profile support.
3
3
  *
4
4
  * The company profile (`storefrontMeta().socials`) is a free-form record keyed
5
- * by BIAB's field keys (`meta`, `twitterX`, `tikTok`, …). Consumers kept
6
- * re-implementing the key→icon→href mapping by hand and getting BIAB's exact
5
+ * by BD's field keys (`meta`, `twitterX`, `tikTok`, …). Consumers kept
6
+ * re-implementing the key→icon→href mapping by hand and getting BD's exact
7
7
  * keys wrong (e.g. mapping `facebook`/`x` and silently dropping `meta`/`twitterX`).
8
- * This module is the single source of truth: every platform BIAB supports, in
8
+ * This module is the single source of truth: every platform BD supports, in
9
9
  * render order, with a stable icon slug + a handle→URL normalizer, plus alias
10
10
  * resolution so older/lowercase spellings still match.
11
11
  *
@@ -15,7 +15,7 @@
15
15
  * this for you, see `SocialLinks` in `@businessdash/sdk/react`.
16
16
  */
17
17
 
18
- /** A social/profile platform key as stored on the BIAB company profile. */
18
+ /** A social/profile platform key as stored on the BD company profile. */
19
19
  export type SocialPlatformKey =
20
20
  | "meta"
21
21
  | "instagram"
@@ -59,7 +59,7 @@ export type SocialPlatformMeta = {
59
59
  hrefPrefix?: string;
60
60
  };
61
61
 
62
- /** Every platform BIAB supports, in footer render order. */
62
+ /** Every platform BD supports, in footer render order. */
63
63
  export const SOCIAL_PLATFORMS: readonly SocialPlatformMeta[] = [
64
64
  {
65
65
  key: "meta",
@@ -167,7 +167,7 @@ function canonicalize(raw: string): string {
167
167
  return raw.toLowerCase().replace(/[\s_-]+/g, "");
168
168
  }
169
169
 
170
- /** Resolve any incoming social key (BIAB key, alias, or loose spelling) to its platform meta. */
170
+ /** Resolve any incoming social key (BD key, alias, or loose spelling) to its platform meta. */
171
171
  export function resolveSocialPlatform(key: string): SocialPlatformMeta | null {
172
172
  const c = canonicalize(key);
173
173
  const direct = PLATFORM_BY_KEY.get(c);
@@ -175,7 +175,7 @@ export function Show<T>(props: {
175
175
 
176
176
  /** The marker a `Match` leaves behind for its enclosing `Switch`. */
177
177
  type MatchMarker = {
178
- readonly __biabMatch: true;
178
+ readonly __bdMatch: true;
179
179
  readonly when: unknown;
180
180
  readonly children: SolidNode;
181
181
  };
@@ -184,7 +184,7 @@ function isMatchMarker(value: unknown): value is MatchMarker {
184
184
  return (
185
185
  typeof value === "object" &&
186
186
  value !== null &&
187
- (value as { __biabMatch?: unknown }).__biabMatch === true
187
+ (value as { __bdMatch?: unknown }).__bdMatch === true
188
188
  );
189
189
  }
190
190
 
@@ -197,7 +197,7 @@ function isMatchMarker(value: unknown): value is MatchMarker {
197
197
  */
198
198
  export function Match(props: { when: unknown; children: SolidNode }): Node {
199
199
  const marker: MatchMarker = {
200
- __biabMatch: true,
200
+ __bdMatch: true,
201
201
  get when() {
202
202
  return props.when;
203
203
  },
@@ -301,12 +301,12 @@ let uniqueIdCounter = 0;
301
301
  * one document — they are not persisted, sent anywhere, or compared across
302
302
  * renders.
303
303
  *
304
- * The `biab-` prefix keeps them from colliding with ids the consumer's own
304
+ * The `bd-` prefix keeps them from colliding with ids the consumer's own
305
305
  * page already uses.
306
306
  */
307
307
  export function createUniqueId(): string {
308
308
  uniqueIdCounter += 1;
309
- return `biab-${uniqueIdCounter}`;
309
+ return `bd-${uniqueIdCounter}`;
310
310
  }
311
311
 
312
312
  /**
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * `@businessdash/sdk/solid` — the product surfaces beyond forms.
3
3
  *
4
- * Solid used to stop at `<BiabForm>` while React carried the whole product:
4
+ * Solid used to stop at `<BdForm>` while React carried the whole product:
5
5
  * storefront, cart, checkout, blog, the customer portal, chat, auth, followers
6
6
  * and social links. This file closes most of that gap.
7
7
  *
@@ -17,8 +17,8 @@
17
17
  *
18
18
  * The consequence worth stating plainly: these surfaces render BusinessDash's
19
19
  * markup, not yours. They are the fastest path to a working store, not a
20
- * design-system component. `<BiabForm>` remains the only surface here that
21
- * renders into your own DOM, and `BiabClient` is always available if you want
20
+ * design-system component. `<BdForm>` remains the only surface here that
21
+ * renders into your own DOM, and `BdClient` is always available if you want
22
22
  * to build the UI yourself.
23
23
  *
24
24
  * ## Solid specifics
@@ -57,7 +57,7 @@ import { buildAuthHref } from "./auth-links.js";
57
57
  import { createBlogController } from "./blog-core/index.js";
58
58
  import { createChatController } from "./chat-core/index.js";
59
59
  import { createCheckoutController } from "./checkout-core/index.js";
60
- import { BiabDevClient } from "./client.js";
60
+ import { BdApiClient } from "./client.js";
61
61
  import type {
62
62
  BlogCommentPostInput,
63
63
  BlogSessionInput,
@@ -82,7 +82,7 @@ import type {
82
82
  StorefrontSessionResponse,
83
83
  } from "./contracts.js";
84
84
  import {
85
- type BiabEmbedEvent,
85
+ type BdEmbedEvent,
86
86
  DEFAULT_EMBED_SANDBOX,
87
87
  DEFAULT_REFRESH_LEAD_MS,
88
88
  type EmbedSessionState,
@@ -91,7 +91,7 @@ import {
91
91
  } from "./embed-protocol.js";
92
92
  import { createMarketingController } from "./marketing-core/index.js";
93
93
  import { createPortalController } from "./portal-core/index.js";
94
- import { createBiabClient } from "./sdk.js";
94
+ import { createBdClient } from "./sdk.js";
95
95
  import {
96
96
  resolveSocialLinks,
97
97
  SOCIAL_FALLBACK_GLYPH,
@@ -112,7 +112,7 @@ import {
112
112
  createVerifyController,
113
113
  } from "./verify-core/index.js";
114
114
 
115
- export type { BiabEmbedEvent } from "./embed-protocol.js";
115
+ export type { BdEmbedEvent } from "./embed-protocol.js";
116
116
 
117
117
  /** Package-API base URL used when a surface doesn't specify one. */
118
118
  export const DEFAULT_PACKAGE_BASE_URL =
@@ -153,12 +153,12 @@ export type EmbedSessionOptions = {
153
153
  export function createEmbedSession<
154
154
  T extends { url: string; expiresAt: string },
155
155
  >(
156
- loader: (client: BiabDevClient) => Promise<T>,
156
+ loader: (client: BdApiClient) => Promise<T>,
157
157
  options: () => EmbedSessionOptions,
158
158
  ) {
159
159
  const client = createMemo(
160
160
  () =>
161
- new BiabDevClient({
161
+ new BdApiClient({
162
162
  apiKey: options().apiKey,
163
163
  baseUrl: options().baseUrl,
164
164
  }),
@@ -220,7 +220,7 @@ type EmbedIframeProps<T extends { url: string }> = {
220
220
  errorFallback?:
221
221
  | ((error: Error, refresh: () => void) => SolidNode)
222
222
  | undefined;
223
- onEvent?: ((event: BiabEmbedEvent) => void) | undefined;
223
+ onEvent?: ((event: BdEmbedEvent) => void) | undefined;
224
224
  /** Extra `sandbox` tokens beyond the safe defaults. */
225
225
  extraSandbox?: string | undefined;
226
226
  };
@@ -297,7 +297,7 @@ type BaseEmbedProps = {
297
297
  title?: string;
298
298
  loadingFallback?: SolidNode;
299
299
  errorFallback?: (error: Error, refresh: () => void) => SolidNode;
300
- onEvent?: (event: BiabEmbedEvent) => void;
300
+ onEvent?: (event: BdEmbedEvent) => void;
301
301
  refreshLeadMs?: number;
302
302
  };
303
303
 
@@ -332,7 +332,7 @@ export function Storefront(props: StorefrontProps) {
332
332
  loadingFallback={props.loadingFallback}
333
333
  onEvent={(event) => {
334
334
  props.onEvent?.(event);
335
- if (event.type === "biab:cart:update") {
335
+ if (event.type === "bd:cart:update") {
336
336
  props.onCartChange?.(event.count, event.subtotalCents);
337
337
  }
338
338
  }}
@@ -368,7 +368,7 @@ export function Cart(props: CartProps) {
368
368
  loadingFallback={props.loadingFallback}
369
369
  onEvent={(event) => {
370
370
  props.onEvent?.(event);
371
- if (event.type === "biab:cart:update") {
371
+ if (event.type === "bd:cart:update") {
372
372
  props.onCartChange?.(event.count, event.subtotalCents);
373
373
  }
374
374
  }}
@@ -426,7 +426,7 @@ export type ChatbotProps = BaseEmbedProps & {
426
426
  *
427
427
  * This is the hosted chat UI. React additionally ships a headless
428
428
  * `useChatbot` + `<ChatbotInline>` for hosts that render their own chat; that
429
- * pair has no Solid equivalent yet, and `BiabClient.chatbot` is the way to
429
+ * pair has no Solid equivalent yet, and `BdClient.chatbot` is the way to
430
430
  * build one in the meantime.
431
431
  */
432
432
  export function Chatbot(props: ChatbotProps) {
@@ -446,7 +446,7 @@ export function Chatbot(props: ChatbotProps) {
446
446
  loadingFallback={props.loadingFallback}
447
447
  onEvent={(event) => {
448
448
  props.onEvent?.(event);
449
- if (event.type === "biab:chatbot:assistant-message") {
449
+ if (event.type === "bd:chatbot:assistant-message") {
450
450
  props.onAssistantMessage?.(event.content, event.model);
451
451
  }
452
452
  }}
@@ -476,7 +476,7 @@ export type CheckoutProps = {
476
476
  children?: SolidNode;
477
477
  loadingFallback?: SolidNode;
478
478
  errorFallback?: (error: Error, refresh: () => void) => SolidNode;
479
- onEvent?: (event: BiabEmbedEvent) => void;
479
+ onEvent?: (event: BdEmbedEvent) => void;
480
480
  onSuccess?: (sessionId: string) => void;
481
481
  onCancel?: (sessionId: string) => void;
482
482
  onError?: (error: Error) => void;
@@ -485,7 +485,7 @@ export type CheckoutProps = {
485
485
  /** Start a Stripe checkout, as a button (default) or an embedded surface. */
486
486
  export function Checkout(props: CheckoutProps) {
487
487
  const client = createMemo(
488
- () => new BiabDevClient({ apiKey: props.apiKey, baseUrl: props.baseUrl }),
488
+ () => new BdApiClient({ apiKey: props.apiKey, baseUrl: props.baseUrl }),
489
489
  );
490
490
  const [state, setState] = createSignal<
491
491
  EmbedSessionState<CheckoutSessionResponse>
@@ -543,11 +543,11 @@ export function Checkout(props: CheckoutProps) {
543
543
  loadingFallback={props.loadingFallback}
544
544
  onEvent={(event) => {
545
545
  props.onEvent?.(event);
546
- if (event.type === "biab:checkout:success") {
546
+ if (event.type === "bd:checkout:success") {
547
547
  props.onSuccess?.(event.sessionId);
548
- } else if (event.type === "biab:checkout:cancel") {
548
+ } else if (event.type === "bd:checkout:cancel") {
549
549
  props.onCancel?.(event.sessionId);
550
- } else if (event.type === "biab:checkout:error") {
550
+ } else if (event.type === "bd:checkout:error") {
551
551
  props.onError?.(new Error(event.message));
552
552
  }
553
553
  }}
@@ -1002,7 +1002,7 @@ export function createStorefront(options: () => CreateStorefrontOptions) {
1002
1002
  const { controller, snapshot } = bridge(
1003
1003
  () =>
1004
1004
  createStoreController({
1005
- client: new BiabDevClient({
1005
+ client: new BdApiClient({
1006
1006
  apiKey: options().apiKey,
1007
1007
  baseUrl: options().baseUrl,
1008
1008
  }),
@@ -1042,7 +1042,7 @@ export type CreateChatOptions = { apiKey: string; baseUrl: string };
1042
1042
  export function createChat(options: () => CreateChatOptions) {
1043
1043
  const { controller, snapshot } = bridge(() =>
1044
1044
  createChatController({
1045
- client: new BiabDevClient({
1045
+ client: new BdApiClient({
1046
1046
  apiKey: options().apiKey,
1047
1047
  baseUrl: options().baseUrl,
1048
1048
  }),
@@ -1082,7 +1082,7 @@ export function createBlog(options: () => CreateBlogOptions) {
1082
1082
  const { controller, snapshot } = bridge(
1083
1083
  () =>
1084
1084
  createBlogController({
1085
- client: new BiabDevClient({
1085
+ client: new BdApiClient({
1086
1086
  apiKey: options().apiKey,
1087
1087
  baseUrl: options().baseUrl,
1088
1088
  }),
@@ -1112,7 +1112,7 @@ export type CreateCheckoutOptions = { apiKey: string; baseUrl: string };
1112
1112
  export function createCheckout(options: () => CreateCheckoutOptions) {
1113
1113
  const { controller, snapshot } = bridge(() =>
1114
1114
  createCheckoutController({
1115
- client: new BiabDevClient({
1115
+ client: new BdApiClient({
1116
1116
  apiKey: options().apiKey,
1117
1117
  baseUrl: options().baseUrl,
1118
1118
  }),
@@ -1151,7 +1151,7 @@ export type CreateFollowersOptions = {
1151
1151
  export function createFollowers(options: () => CreateFollowersOptions) {
1152
1152
  const { controller, snapshot } = bridge(() =>
1153
1153
  createFollowersController({
1154
- client: createBiabClient({
1154
+ client: createBdClient({
1155
1155
  apiKey: options().token,
1156
1156
  siteId: options().siteId,
1157
1157
  ...(options().baseUrl ? { baseUrl: options().baseUrl } : {}),
@@ -1181,7 +1181,7 @@ export function createMarketing(options: () => CreateMarketingOptions) {
1181
1181
  const { controller, snapshot } = bridge(
1182
1182
  () =>
1183
1183
  createMarketingController({
1184
- client: createBiabClient({
1184
+ client: createBdClient({
1185
1185
  apiKey: options().token,
1186
1186
  siteId: options().siteId,
1187
1187
  ...(options().baseUrl ? { baseUrl: options().baseUrl } : {}),
@@ -1208,7 +1208,7 @@ export function createVerify(options: () => CreateVerifyOptions) {
1208
1208
  const { controller, snapshot } = bridge(() => {
1209
1209
  const { apiKey, baseUrl, ...rest } = options();
1210
1210
  return createVerifyController({
1211
- client: new BiabDevClient({ apiKey, baseUrl }),
1211
+ client: new BdApiClient({ apiKey, baseUrl }),
1212
1212
  ...rest,
1213
1213
  });
1214
1214
  });
@@ -1244,7 +1244,7 @@ export function createPortal(options: () => CreatePortalOptions) {
1244
1244
  const { controller, snapshot } = bridge(
1245
1245
  () =>
1246
1246
  createPortalController({
1247
- client: new BiabDevClient({
1247
+ client: new BdApiClient({
1248
1248
  apiKey: options().apiKey,
1249
1249
  baseUrl: options().baseUrl,
1250
1250
  }),