@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/client.d.ts
ADDED
|
@@ -0,0 +1,1681 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type AddressDetailsResponse, type AddressFormValues, type AddressSearchInput, type AddressSearchResponse, type AddressVerifyResponse, type AiVisibilityInput, type AiVisibilityResponse, type AttributionHeartbeatInput, type AttributionHeartbeatResponse, type AttributionPolicy, type AuthIntrospectResponse, type BlogCategoryListResponse, type BlogCommentListResponse, type BlogCommentPostInput, type BlogCommentPostResponse, type BlogLikeResponse, type BlogListPostsResponse, type BlogPostBySlugResponse, type BlogSessionInput, type BlogSessionResponse, type BlogTagListResponse, type CartAddItemInput, type CartCouponInput, type CartSessionResponse, type CartSnapshot, type CartUpdateItemInput, type ChatbotAppendMessageInput, type ChatbotAvailability, type ChatbotChatInput, type ChatbotChatResponse, type ChatbotConfig, type ChatbotConfigUpdateInput, type ChatbotFormDefinition, type ChatbotFormSubmitInput, type ChatbotFormSubmitResponse, type ChatbotMessagesResponse, type ChatbotPersistedSessionInput, type ChatbotPersistedSessionResponse, type ChatbotRequestHumanInput, type ChatbotRequestHumanResponse, type ChatbotSessionResponse, type CheckoutSessionInput, type CheckoutSessionResponse, type CheckoutStartInput, type CheckoutStartResponse, type CheckoutStatusResponse, type ConfirmVerificationInput, type ConfirmVerificationResponse, type CouponValidateResponse, type CreateCollectionInput, type CreateCollectionResponse, type CreateEmailTemplateInput, type CreateEmailTemplateResponse, type CreateEmailTemplateVersionInput, type CreateEmailTemplateVersionResponse, type CustomerContactCompanyInput, type CustomerContactCompanyResponse, type CustomerContractDetail, type CustomerContractSignResponse, type CustomerDownloadsResponse, type CustomerInvoiceDetail, type CustomerInvoicePayInput, type CustomerInvoicePayResponse, type CustomerInvoicePdf, type CustomerJobActivityResponse, type CustomerJobComment, type CustomerJobCommentPostInput, type CustomerJobCommentsListResponse, type CustomerJobDetail, type CustomerJobEtaResponse, type CustomerNotificationPreferencesResponse, type CustomerNotificationPreferencesUpdateInput, type CustomerNotificationPreferencesUpdateResponse, type CustomerOrderDetail, type CustomerOrderListResponse, type CustomerPortalContextResponse, type CustomerPortalOtherOrgsResponse, type CustomerPortalProfile, type CustomerPortalUpdateProfileInput, type CustomerPortalUpdateProfileResponse, type CustomerQuoteActionResponse, type CustomerQuoteDetail, type CustomerReferralHistoryResponse, type CustomerReferralPayoutsResponse, type CustomerReferralStats, type CustomerReturnRequestCreated, type CustomerReturnRequestInput, type CustomerReviewListResponse, type CustomerReviewSubmitInput, type CustomerReviewSubmitResponse, type CustomerShipmentTracking, type CustomerWorkBundle, type DashboardSessionResponse, type ExecuteActionInput, type ExecuteActionResponse, type FollowerEditInput, type FollowerEditResponse, type FollowerJoinInput, type FollowerJoinResponse, type FollowerLeaveInput, type FollowerLeaveResponse, type FollowerMeInput, type FollowerMeResponse, type GetCollectionResponse, type GetEmailTemplateResponse, type GetMarketingLocalesResponse, type GetMarketingPageBundleResponse, type GetPublishedMarketingSchemaResponse, type GetSiteMarketingPageResponse, type GoogleAddress, type JobCategoryListResponse, type JobPosting, type JobPostingListResponse, type ListCollectionsResponse, type ListDataModelRecordsInput, type ListDataModelRecordsResponse, type ListEmailTemplatesInput, type ListEmailTemplatesResponse, type ListRowsInput, type ListRowsResponse, type ListSiteMarketingPagesResponse, type NotificationPreferencesResponse, type NotificationPreferencesUpdateInput, type PageViewsInput, type PageViewsResponse, type PublishMarketingSectionsInput, type PublishMarketingSectionsResponse, type QueryRowsInput, type QueryRowsResponse, type ReviewWallListResponse, type ShippingRatesInput, type ShippingRatesResponse, type ShippingSettingsResponse, type ShippingTrackResponse, type SiteAssetInput, type SiteBranding, type StartVerificationInput, type StartVerificationResponse, type StorefrontAddonsResponse, type StorefrontCategoriesResponse, type StorefrontListProductsResponse, type StorefrontProductDetail, type StorefrontProductReviewsResponse, type StorefrontProductsWithMetaResponse, type StorefrontRelatedProductsResponse, type StorefrontSessionInput, type StorefrontSessionResponse, type StorefrontSort, type SubscriptionCheckoutInput, type SubscriptionCheckoutResponse, type SubscriptionOffering, type SubscriptionOfferingsListResponse, type TenantAuthExchangeInput, type TenantAuthExchangeResponse, type TenantAuthMeResponse, type TenantAuthPasswordResetInput, type TenantAuthPasswordResetResponse, type TenantAuthSignOutResponse, type TenantAuthStartInput, type TenantAuthStartResponse, type UploadSiteAssetResponse, type UpsertDraftMarketingSchemaInput, type UpsertDraftMarketingSchemaResponse, type UpsertRowInput, type UpsertRowResponse } from "./contracts.js";
|
|
3
|
+
export type FetchLike = typeof fetch;
|
|
4
|
+
/** Options for {@link BiabDevClient} / {@link createBiabDevClient}. */
|
|
5
|
+
export type BiabDevClientOptions = {
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
apiKey: string;
|
|
8
|
+
fetch?: FetchLike;
|
|
9
|
+
defaultHeaders?: HeadersInit;
|
|
10
|
+
/**
|
|
11
|
+
* Origin to send to the platform on every request. Required when the API
|
|
12
|
+
* key has an Allowed Host set on the host (server-to-server `fetch` does
|
|
13
|
+
* not send `Origin` automatically — without it the platform replies 403
|
|
14
|
+
* `origin_required`). Accepts a full URL (`https://my-site.com`) or a
|
|
15
|
+
* bare hostname (`my-site.com`); only the origin is sent on the wire.
|
|
16
|
+
*/
|
|
17
|
+
siteOrigin?: string;
|
|
18
|
+
};
|
|
19
|
+
/** An array value becomes a repeated param: `?path=/a&path=/b`. */
|
|
20
|
+
type QueryValue = string | number | boolean | Array<string | number> | undefined;
|
|
21
|
+
type RequestOptions<T> = {
|
|
22
|
+
method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
23
|
+
path: string;
|
|
24
|
+
query?: Record<string, QueryValue>;
|
|
25
|
+
body?: unknown;
|
|
26
|
+
responseSchema: z.ZodType<T, z.ZodTypeDef, unknown>;
|
|
27
|
+
headers?: HeadersInit;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Typed client for the BIAB package HTTP API.
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* **Alpha:** This SDK is in alpha. Surfaces and behavior may change without semver guarantees.
|
|
34
|
+
* Do not rely on it for production workloads—use development, staging, or experiments only.
|
|
35
|
+
*/
|
|
36
|
+
export declare class BiabDevClient {
|
|
37
|
+
private readonly baseUrl;
|
|
38
|
+
private readonly apiKey;
|
|
39
|
+
private readonly fetchImpl;
|
|
40
|
+
private readonly defaultHeaders;
|
|
41
|
+
constructor(options: BiabDevClientOptions);
|
|
42
|
+
private readonly siteOrigin;
|
|
43
|
+
site(siteId: string): BiabDevSiteClient;
|
|
44
|
+
get emailTemplates(): BiabDevEmailTemplatesClient;
|
|
45
|
+
get dashboard(): BiabDevDashboardClient;
|
|
46
|
+
get storefront(): BiabDevStorefrontClient;
|
|
47
|
+
get cart(): BiabDevCartClient;
|
|
48
|
+
get checkout(): BiabDevCheckoutClient;
|
|
49
|
+
get coupons(): BiabDevCouponsClient;
|
|
50
|
+
get subscriptions(): BiabDevSubscriptionsClient;
|
|
51
|
+
get shipping(): BiabDevShippingClient;
|
|
52
|
+
get notifications(): BiabDevNotificationsClient;
|
|
53
|
+
get address(): BiabDevAddressClient;
|
|
54
|
+
get blog(): BiabDevBlogClient;
|
|
55
|
+
get reviews(): BiabDevReviewsClient;
|
|
56
|
+
/** Public job postings — build a careers page on your own domain. */
|
|
57
|
+
get hiring(): BiabDevHiringClient;
|
|
58
|
+
get chatbot(): BiabDevChatbotClient;
|
|
59
|
+
get auth(): BiabDevAuthClient;
|
|
60
|
+
/**
|
|
61
|
+
* Customer-portal client. Pin to a specific BIAB organization id so the
|
|
62
|
+
* caller never sees data from any other org (recommended). Omit
|
|
63
|
+
* `organizationId` to fall back to the user's currently-active session
|
|
64
|
+
* org — only use that on first-party hosts where the host already pins
|
|
65
|
+
* the org.
|
|
66
|
+
*/
|
|
67
|
+
customerPortal(organizationId?: string): BiabDevCustomerPortalClient;
|
|
68
|
+
introspect(): Promise<AuthIntrospectResponse>;
|
|
69
|
+
request<T>(options: RequestOptions<T>): Promise<T>;
|
|
70
|
+
}
|
|
71
|
+
export declare class BiabDevSiteClient {
|
|
72
|
+
readonly client: BiabDevClient;
|
|
73
|
+
readonly siteId: string;
|
|
74
|
+
readonly collections: BiabDevCollectionsClient;
|
|
75
|
+
readonly rows: BiabDevRowsClient;
|
|
76
|
+
/**
|
|
77
|
+
* The org's custom database — the tables from `defineDataModel()`.
|
|
78
|
+
* Distinct from `collections`/`rows`, which are Site Data. See
|
|
79
|
+
* {@link BiabDevDataModelClient}.
|
|
80
|
+
*/
|
|
81
|
+
readonly dataModel: BiabDevDataModelClient;
|
|
82
|
+
/**
|
|
83
|
+
* Read your site's visitor counts back (the counterpart to the
|
|
84
|
+
* `<BIABAnalytics/>` tracker, which only records). See
|
|
85
|
+
* {@link BiabDevAnalyticsClient}.
|
|
86
|
+
*/
|
|
87
|
+
readonly analytics: BiabDevAnalyticsClient;
|
|
88
|
+
/**
|
|
89
|
+
* The "Powered by BusinessDash" badge's policy + heartbeat. See
|
|
90
|
+
* {@link BiabDevAttributionClient}.
|
|
91
|
+
*/
|
|
92
|
+
readonly attribution: BiabDevAttributionClient;
|
|
93
|
+
readonly assets: BiabDevAssetsClient;
|
|
94
|
+
readonly actions: BiabDevActionsClient;
|
|
95
|
+
readonly followers: BiabDevFollowersClient;
|
|
96
|
+
readonly marketingPages: BiabDevMarketingPagesClient;
|
|
97
|
+
/**
|
|
98
|
+
* Schema-driven marketing flow (Phase 2). Pair with the SDK's
|
|
99
|
+
* `defineSiteMarketingSchema()` builder + the `biab-dev sync-schema`
|
|
100
|
+
* CLI for the authoring side; this client is the live-site read
|
|
101
|
+
* path (`getPageBundle`) and the upload entry point for the CLI.
|
|
102
|
+
*/
|
|
103
|
+
readonly marketing: BiabDevMarketingClient;
|
|
104
|
+
readonly parallelPages: BiabDevParallelPagesClient;
|
|
105
|
+
constructor(client: BiabDevClient, siteId: string);
|
|
106
|
+
/**
|
|
107
|
+
* The org's storefront branding — logo + favicon (site static media) plus
|
|
108
|
+
* the org name + icon. Render the masthead/favicon/og without the org
|
|
109
|
+
* re-supplying assets. Available even when billing has lapsed.
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```ts
|
|
113
|
+
* const b = await client.site(SITE_ID).branding();
|
|
114
|
+
* <img src={b.logoUrl ?? b.orgIcon ?? ""} alt={b.orgName ?? ""} />
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
branding(): Promise<SiteBranding>;
|
|
118
|
+
}
|
|
119
|
+
export declare const parallelPagesListResponseSchema: z.ZodObject<{
|
|
120
|
+
items: z.ZodArray<z.ZodObject<{
|
|
121
|
+
id: z.ZodString;
|
|
122
|
+
key: z.ZodString;
|
|
123
|
+
routePattern: z.ZodString;
|
|
124
|
+
variables: z.ZodArray<z.ZodObject<{
|
|
125
|
+
name: z.ZodString;
|
|
126
|
+
source: z.ZodObject<{
|
|
127
|
+
section: z.ZodString;
|
|
128
|
+
path: z.ZodOptional<z.ZodString>;
|
|
129
|
+
}, "strip", z.ZodTypeAny, {
|
|
130
|
+
section: string;
|
|
131
|
+
path?: string | undefined;
|
|
132
|
+
}, {
|
|
133
|
+
section: string;
|
|
134
|
+
path?: string | undefined;
|
|
135
|
+
}>;
|
|
136
|
+
slugField: z.ZodString;
|
|
137
|
+
tokenFields: z.ZodArray<z.ZodString, "many">;
|
|
138
|
+
}, "strip", z.ZodTypeAny, {
|
|
139
|
+
name: string;
|
|
140
|
+
source: {
|
|
141
|
+
section: string;
|
|
142
|
+
path?: string | undefined;
|
|
143
|
+
};
|
|
144
|
+
slugField: string;
|
|
145
|
+
tokenFields: string[];
|
|
146
|
+
}, {
|
|
147
|
+
name: string;
|
|
148
|
+
source: {
|
|
149
|
+
section: string;
|
|
150
|
+
path?: string | undefined;
|
|
151
|
+
};
|
|
152
|
+
slugField: string;
|
|
153
|
+
tokenFields: string[];
|
|
154
|
+
}>, "many">;
|
|
155
|
+
meta: z.ZodObject<{
|
|
156
|
+
title: z.ZodString;
|
|
157
|
+
description: z.ZodString;
|
|
158
|
+
canonical: z.ZodOptional<z.ZodString>;
|
|
159
|
+
ogImage: z.ZodOptional<z.ZodString>;
|
|
160
|
+
}, "strip", z.ZodTypeAny, {
|
|
161
|
+
description: string;
|
|
162
|
+
title: string;
|
|
163
|
+
canonical?: string | undefined;
|
|
164
|
+
ogImage?: string | undefined;
|
|
165
|
+
}, {
|
|
166
|
+
description: string;
|
|
167
|
+
title: string;
|
|
168
|
+
canonical?: string | undefined;
|
|
169
|
+
ogImage?: string | undefined;
|
|
170
|
+
}>;
|
|
171
|
+
templateRef: z.ZodString;
|
|
172
|
+
source: z.ZodEnum<["sdk", "site_builder"]>;
|
|
173
|
+
crawlRule: z.ZodEnum<["inherit", "index", "noindex"]>;
|
|
174
|
+
isActive: z.ZodBoolean;
|
|
175
|
+
}, "strip", z.ZodTypeAny, {
|
|
176
|
+
id: string;
|
|
177
|
+
source: "sdk" | "site_builder";
|
|
178
|
+
isActive: boolean;
|
|
179
|
+
key: string;
|
|
180
|
+
variables: {
|
|
181
|
+
name: string;
|
|
182
|
+
source: {
|
|
183
|
+
section: string;
|
|
184
|
+
path?: string | undefined;
|
|
185
|
+
};
|
|
186
|
+
slugField: string;
|
|
187
|
+
tokenFields: string[];
|
|
188
|
+
}[];
|
|
189
|
+
routePattern: string;
|
|
190
|
+
meta: {
|
|
191
|
+
description: string;
|
|
192
|
+
title: string;
|
|
193
|
+
canonical?: string | undefined;
|
|
194
|
+
ogImage?: string | undefined;
|
|
195
|
+
};
|
|
196
|
+
templateRef: string;
|
|
197
|
+
crawlRule: "inherit" | "index" | "noindex";
|
|
198
|
+
}, {
|
|
199
|
+
id: string;
|
|
200
|
+
source: "sdk" | "site_builder";
|
|
201
|
+
isActive: boolean;
|
|
202
|
+
key: string;
|
|
203
|
+
variables: {
|
|
204
|
+
name: string;
|
|
205
|
+
source: {
|
|
206
|
+
section: string;
|
|
207
|
+
path?: string | undefined;
|
|
208
|
+
};
|
|
209
|
+
slugField: string;
|
|
210
|
+
tokenFields: string[];
|
|
211
|
+
}[];
|
|
212
|
+
routePattern: string;
|
|
213
|
+
meta: {
|
|
214
|
+
description: string;
|
|
215
|
+
title: string;
|
|
216
|
+
canonical?: string | undefined;
|
|
217
|
+
ogImage?: string | undefined;
|
|
218
|
+
};
|
|
219
|
+
templateRef: string;
|
|
220
|
+
crawlRule: "inherit" | "index" | "noindex";
|
|
221
|
+
}>, "many">;
|
|
222
|
+
}, "strip", z.ZodTypeAny, {
|
|
223
|
+
items: {
|
|
224
|
+
id: string;
|
|
225
|
+
source: "sdk" | "site_builder";
|
|
226
|
+
isActive: boolean;
|
|
227
|
+
key: string;
|
|
228
|
+
variables: {
|
|
229
|
+
name: string;
|
|
230
|
+
source: {
|
|
231
|
+
section: string;
|
|
232
|
+
path?: string | undefined;
|
|
233
|
+
};
|
|
234
|
+
slugField: string;
|
|
235
|
+
tokenFields: string[];
|
|
236
|
+
}[];
|
|
237
|
+
routePattern: string;
|
|
238
|
+
meta: {
|
|
239
|
+
description: string;
|
|
240
|
+
title: string;
|
|
241
|
+
canonical?: string | undefined;
|
|
242
|
+
ogImage?: string | undefined;
|
|
243
|
+
};
|
|
244
|
+
templateRef: string;
|
|
245
|
+
crawlRule: "inherit" | "index" | "noindex";
|
|
246
|
+
}[];
|
|
247
|
+
}, {
|
|
248
|
+
items: {
|
|
249
|
+
id: string;
|
|
250
|
+
source: "sdk" | "site_builder";
|
|
251
|
+
isActive: boolean;
|
|
252
|
+
key: string;
|
|
253
|
+
variables: {
|
|
254
|
+
name: string;
|
|
255
|
+
source: {
|
|
256
|
+
section: string;
|
|
257
|
+
path?: string | undefined;
|
|
258
|
+
};
|
|
259
|
+
slugField: string;
|
|
260
|
+
tokenFields: string[];
|
|
261
|
+
}[];
|
|
262
|
+
routePattern: string;
|
|
263
|
+
meta: {
|
|
264
|
+
description: string;
|
|
265
|
+
title: string;
|
|
266
|
+
canonical?: string | undefined;
|
|
267
|
+
ogImage?: string | undefined;
|
|
268
|
+
};
|
|
269
|
+
templateRef: string;
|
|
270
|
+
crawlRule: "inherit" | "index" | "noindex";
|
|
271
|
+
}[];
|
|
272
|
+
}>;
|
|
273
|
+
export declare const parallelPagesVariantsResponseSchema: z.ZodObject<{
|
|
274
|
+
variants: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodString>, "many">;
|
|
275
|
+
}, "strip", z.ZodTypeAny, {
|
|
276
|
+
variants: Record<string, string>[];
|
|
277
|
+
}, {
|
|
278
|
+
variants: Record<string, string>[];
|
|
279
|
+
}>;
|
|
280
|
+
export declare const parallelPagesRenderResponseSchema: z.ZodObject<{
|
|
281
|
+
key: z.ZodString;
|
|
282
|
+
routePattern: z.ZodString;
|
|
283
|
+
slugs: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
284
|
+
meta: z.ZodObject<{
|
|
285
|
+
title: z.ZodString;
|
|
286
|
+
description: z.ZodString;
|
|
287
|
+
canonical: z.ZodNullable<z.ZodString>;
|
|
288
|
+
ogImage: z.ZodNullable<z.ZodString>;
|
|
289
|
+
}, "strip", z.ZodTypeAny, {
|
|
290
|
+
description: string;
|
|
291
|
+
title: string;
|
|
292
|
+
canonical: string | null;
|
|
293
|
+
ogImage: string | null;
|
|
294
|
+
}, {
|
|
295
|
+
description: string;
|
|
296
|
+
title: string;
|
|
297
|
+
canonical: string | null;
|
|
298
|
+
ogImage: string | null;
|
|
299
|
+
}>;
|
|
300
|
+
body: z.ZodNullable<z.ZodUnknown>;
|
|
301
|
+
}, "strip", z.ZodTypeAny, {
|
|
302
|
+
key: string;
|
|
303
|
+
routePattern: string;
|
|
304
|
+
meta: {
|
|
305
|
+
description: string;
|
|
306
|
+
title: string;
|
|
307
|
+
canonical: string | null;
|
|
308
|
+
ogImage: string | null;
|
|
309
|
+
};
|
|
310
|
+
slugs: Record<string, string>;
|
|
311
|
+
body?: unknown;
|
|
312
|
+
}, {
|
|
313
|
+
key: string;
|
|
314
|
+
routePattern: string;
|
|
315
|
+
meta: {
|
|
316
|
+
description: string;
|
|
317
|
+
title: string;
|
|
318
|
+
canonical: string | null;
|
|
319
|
+
ogImage: string | null;
|
|
320
|
+
};
|
|
321
|
+
slugs: Record<string, string>;
|
|
322
|
+
body?: unknown;
|
|
323
|
+
}>;
|
|
324
|
+
export type ParallelPagesListResponse = z.infer<typeof parallelPagesListResponseSchema>;
|
|
325
|
+
export type ParallelPagesVariantsResponse = z.infer<typeof parallelPagesVariantsResponseSchema>;
|
|
326
|
+
export type ParallelPagesRenderResponse = z.infer<typeof parallelPagesRenderResponseSchema>;
|
|
327
|
+
/**
|
|
328
|
+
* Programmatic SEO ("parallel pages") client. Same shape across
|
|
329
|
+
* SDK-defined and site-builder-defined pages — both share the
|
|
330
|
+
* `org_parallel_pages` table on the server.
|
|
331
|
+
*
|
|
332
|
+
* Typical wiring in Next.js:
|
|
333
|
+
*
|
|
334
|
+
* export async function generateStaticParams() {
|
|
335
|
+
* const { variants } = await client
|
|
336
|
+
* .site(SITE_ID)
|
|
337
|
+
* .parallelPages
|
|
338
|
+
* .listVariants("repair-area");
|
|
339
|
+
* return variants;
|
|
340
|
+
* }
|
|
341
|
+
*
|
|
342
|
+
* export default async function Page({ params }) {
|
|
343
|
+
* const bundle = await client
|
|
344
|
+
* .site(SITE_ID)
|
|
345
|
+
* .parallelPages
|
|
346
|
+
* .render("repair-area", await params);
|
|
347
|
+
* return <RenderTemplate bundle={bundle} />;
|
|
348
|
+
* }
|
|
349
|
+
*/
|
|
350
|
+
export declare class BiabDevParallelPagesClient {
|
|
351
|
+
private readonly client;
|
|
352
|
+
private readonly siteId;
|
|
353
|
+
constructor(client: BiabDevClient, siteId: string);
|
|
354
|
+
list(): Promise<ParallelPagesListResponse>;
|
|
355
|
+
listVariants(key: string, opts?: {
|
|
356
|
+
locale?: string;
|
|
357
|
+
}): Promise<ParallelPagesVariantsResponse>;
|
|
358
|
+
render(key: string, slugs: Record<string, string>, opts?: {
|
|
359
|
+
locale?: string;
|
|
360
|
+
}): Promise<ParallelPagesRenderResponse>;
|
|
361
|
+
/**
|
|
362
|
+
* URL of the auto-generated sitemap. Consumer's `/sitemap.xml` route
|
|
363
|
+
* proxies straight through. Returns null when the client isn't
|
|
364
|
+
* configured with a base URL.
|
|
365
|
+
*/
|
|
366
|
+
sitemapUrl(): string;
|
|
367
|
+
/**
|
|
368
|
+
* URL of the auto-generated robots.txt. Consumer's `/robots.txt` route
|
|
369
|
+
* proxies straight through.
|
|
370
|
+
*/
|
|
371
|
+
robotsUrl(): string;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Manually invalidate marketing caches scoped to a site. Useful after a
|
|
375
|
+
* server-side mutation the SDK didn't initiate (e.g. an operator saved a
|
|
376
|
+
* section in the dashboard while the consumer's Next process is still
|
|
377
|
+
* warm).
|
|
378
|
+
*/
|
|
379
|
+
export declare function clearMarketingCache(siteId: string): void;
|
|
380
|
+
/**
|
|
381
|
+
* Live-site read client for the schema-driven marketing flow.
|
|
382
|
+
*
|
|
383
|
+
* Surfaces:
|
|
384
|
+
* - `getPageBundle({ pageKey, locale })` — every section for a page,
|
|
385
|
+
* tagged ok|error per section, plus SEO + availableLocales.
|
|
386
|
+
* - `getPublishedSchema()` — the live schema (returns `{ schema: null }`
|
|
387
|
+
* until the consumer's CLI has published one).
|
|
388
|
+
* - `getDraftSchema()` — what's currently staged (CLI-only path).
|
|
389
|
+
* - `publishDraftSchema(input)` — CLI upload. Idempotent (same
|
|
390
|
+
* checksum = `noop: true`).
|
|
391
|
+
* - `getLocales()` — enabled locales + brand-token map.
|
|
392
|
+
*/
|
|
393
|
+
export declare class BiabDevMarketingClient {
|
|
394
|
+
private readonly client;
|
|
395
|
+
private readonly siteId;
|
|
396
|
+
constructor(client: BiabDevClient, siteId: string);
|
|
397
|
+
getPageBundle(input?: {
|
|
398
|
+
pageKey?: string;
|
|
399
|
+
locale?: string;
|
|
400
|
+
reviewsLimit?: number;
|
|
401
|
+
}, options?: {
|
|
402
|
+
skipCache?: boolean;
|
|
403
|
+
}): Promise<GetMarketingPageBundleResponse>;
|
|
404
|
+
getPageBundleCached(input?: {
|
|
405
|
+
pageKey?: string;
|
|
406
|
+
locale?: string;
|
|
407
|
+
}): GetMarketingPageBundleResponse | null;
|
|
408
|
+
prefetchPageBundle(input?: {
|
|
409
|
+
pageKey?: string;
|
|
410
|
+
locale?: string;
|
|
411
|
+
}): Promise<GetMarketingPageBundleResponse>;
|
|
412
|
+
getPublishedSchema(options?: {
|
|
413
|
+
skipCache?: boolean;
|
|
414
|
+
}): Promise<GetPublishedMarketingSchemaResponse>;
|
|
415
|
+
getDraftSchema(): Promise<GetPublishedMarketingSchemaResponse>;
|
|
416
|
+
publishDraftSchema(input: UpsertDraftMarketingSchemaInput): Promise<UpsertDraftMarketingSchemaResponse>;
|
|
417
|
+
/**
|
|
418
|
+
* Bulk-upsert section values. Used by `biab-dev sync-content` to push
|
|
419
|
+
* local JSON content to BIAB. Server caps each request at 256 items;
|
|
420
|
+
* larger imports are batched by the CLI. Per-item failures are
|
|
421
|
+
* reported in the response (`results[].ok === false`) without aborting
|
|
422
|
+
* the rest of the batch.
|
|
423
|
+
*
|
|
424
|
+
* The CLI's `--lax` flag sets `validate: false` for first-time imports
|
|
425
|
+
* of legacy content that doesn't yet match the published schema —
|
|
426
|
+
* useful so writers can pull existing content into BIAB and fix
|
|
427
|
+
* validation errors in the dashboard incrementally.
|
|
428
|
+
*/
|
|
429
|
+
publishSections(input: PublishMarketingSectionsInput): Promise<PublishMarketingSectionsResponse>;
|
|
430
|
+
getLocales(options?: {
|
|
431
|
+
skipCache?: boolean;
|
|
432
|
+
}): Promise<GetMarketingLocalesResponse>;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Manually clear the SDK's cache for `(siteId, pageKey)` (or the whole
|
|
436
|
+
* site when `pageKey` is omitted). Useful after a server-side mutation
|
|
437
|
+
* that the SDK didn't initiate, or in tests.
|
|
438
|
+
*/
|
|
439
|
+
export declare function clearMarketingPageCache(siteId: string, pageKey?: string): void;
|
|
440
|
+
/**
|
|
441
|
+
* Read-only access to the host's `org_site_marketing_pages` table — the JSON
|
|
442
|
+
* documents the Site Builder writes for marketing landing pages (e.g. the
|
|
443
|
+
* `home` page rendered by `custom-demo`).
|
|
444
|
+
*
|
|
445
|
+
* Requires the `collections:read` scope on the API key (the same scope used
|
|
446
|
+
* for collection reads, so existing keys created from the host's Site Builder
|
|
447
|
+
* → Developer panel work without re-issuing).
|
|
448
|
+
*
|
|
449
|
+
* The client transparently caches per-page responses across instances; pair
|
|
450
|
+
* `list()` (no payloads) with `get(pageKey)` / `prefetch(pageKey)` to load
|
|
451
|
+
* pages on demand instead of paying the full-content cost up front.
|
|
452
|
+
*/
|
|
453
|
+
export declare class BiabDevMarketingPagesClient {
|
|
454
|
+
private readonly client;
|
|
455
|
+
private readonly siteId;
|
|
456
|
+
constructor(client: BiabDevClient, siteId: string);
|
|
457
|
+
/**
|
|
458
|
+
* Payload-free directory of every marketing page for the site. Use this
|
|
459
|
+
* to render a navigation index without loading any content; call
|
|
460
|
+
* {@link get} or {@link prefetch} when the visitor selects a page.
|
|
461
|
+
*/
|
|
462
|
+
list(): Promise<ListSiteMarketingPagesResponse>;
|
|
463
|
+
/**
|
|
464
|
+
* Fetches a single marketing page payload by `pageKey` (defaults to `"home"`).
|
|
465
|
+
* Returns `{ page: null }` when the host has not published one yet — callers
|
|
466
|
+
* typically render a static fallback in that case.
|
|
467
|
+
*
|
|
468
|
+
* Reads from the shared cache when present (warmed by {@link prefetch} or
|
|
469
|
+
* a previous `get`). Pass `{ skipCache: true }` to force a network round-trip
|
|
470
|
+
* (e.g. after a save the SDK didn't make itself).
|
|
471
|
+
*/
|
|
472
|
+
get(pageKey?: string, options?: {
|
|
473
|
+
skipCache?: boolean;
|
|
474
|
+
}): Promise<GetSiteMarketingPageResponse>;
|
|
475
|
+
/**
|
|
476
|
+
* Read the cached value for `pageKey` without making a network call.
|
|
477
|
+
* Returns `null` when the entry hasn't been fetched yet — callers can
|
|
478
|
+
* fall back to a synchronous static default while {@link prefetch}
|
|
479
|
+
* warms the cache in the background.
|
|
480
|
+
*/
|
|
481
|
+
getCached(pageKey: string): GetSiteMarketingPageResponse | null;
|
|
482
|
+
/**
|
|
483
|
+
* Warm the SDK cache for `pageKey` without rendering anything yet.
|
|
484
|
+
* Common pattern: call from a `<Link onPointerEnter>` / `onFocus` so
|
|
485
|
+
* the next page is already loaded by the time the visitor clicks.
|
|
486
|
+
* Subsequent `get(pageKey)` calls resolve from cache.
|
|
487
|
+
*/
|
|
488
|
+
prefetch(pageKey?: string): Promise<GetSiteMarketingPageResponse>;
|
|
489
|
+
}
|
|
490
|
+
export declare class BiabDevCollectionsClient {
|
|
491
|
+
private readonly client;
|
|
492
|
+
private readonly siteId;
|
|
493
|
+
constructor(client: BiabDevClient, siteId: string);
|
|
494
|
+
list(): Promise<ListCollectionsResponse>;
|
|
495
|
+
create(input: CreateCollectionInput): Promise<CreateCollectionResponse>;
|
|
496
|
+
get(slug: string): Promise<GetCollectionResponse>;
|
|
497
|
+
}
|
|
498
|
+
export declare class BiabDevRowsClient {
|
|
499
|
+
private readonly client;
|
|
500
|
+
private readonly siteId;
|
|
501
|
+
constructor(client: BiabDevClient, siteId: string);
|
|
502
|
+
list(collectionSlug: string, input?: ListRowsInput): Promise<ListRowsResponse>;
|
|
503
|
+
upsert(collectionSlug: string, input: UpsertRowInput): Promise<UpsertRowResponse>;
|
|
504
|
+
query(collectionSlug: string, input: QueryRowsInput): Promise<QueryRowsResponse>;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Read rows out of the org's CUSTOM DATABASE — the tables you declare with
|
|
508
|
+
* `defineDataModel()` and push with `biab-dev sync-data-model`.
|
|
509
|
+
*
|
|
510
|
+
* ⚠️ Not the same thing as `.collections` / `.rows`. Those read Site Data (the
|
|
511
|
+
* site builder's tables, `site_data_rows`). Rows seeded with
|
|
512
|
+
* `biab-dev sync-records` live in `org_object_records` and are reachable only
|
|
513
|
+
* through here — no `collections:*` call will ever return one.
|
|
514
|
+
*
|
|
515
|
+
* Requires the `metadata:read_records` scope. What a key can actually read is
|
|
516
|
+
* decided per object by its `visibility`:
|
|
517
|
+
*
|
|
518
|
+
* - `private` (default) — a SECRET key only. Call from a server component, a
|
|
519
|
+
* route handler, or at build time; a `pk_…` key gets "not found".
|
|
520
|
+
* - `authenticated` — a secret key, or a publishable key carrying a signed-in
|
|
521
|
+
* tenant session.
|
|
522
|
+
* - `public` — any key, including a publishable (`pk_…`) one in page JS.
|
|
523
|
+
*
|
|
524
|
+
* So a table you declared `public` is readable straight from the browser; a
|
|
525
|
+
* private one never is. Open a table by declaring `visibility` in your model.
|
|
526
|
+
*
|
|
527
|
+
* ```ts
|
|
528
|
+
* const result = await biab.site(siteId).dataModel.listRecords({
|
|
529
|
+
* object: TECH_OBJECT_ID, // the universalIdentifier from your config
|
|
530
|
+
* });
|
|
531
|
+
* if (!result.available) return <UpgradeCard feature={result.requiredFeature} />;
|
|
532
|
+
* for (const tech of result.records) {
|
|
533
|
+
* tech.fields.name; // scalar values, keyed by field name
|
|
534
|
+
* tech.relations.icon; // [{ recordId, object }] — links, not embedded rows
|
|
535
|
+
* }
|
|
536
|
+
* ```
|
|
537
|
+
*/
|
|
538
|
+
export declare class BiabDevDataModelClient {
|
|
539
|
+
private readonly client;
|
|
540
|
+
private readonly siteId;
|
|
541
|
+
constructor(client: BiabDevClient, siteId: string);
|
|
542
|
+
/**
|
|
543
|
+
* One page of an object's rows, newest first, with relations expanded.
|
|
544
|
+
*
|
|
545
|
+
* Relations come back as LINKS (`{ recordId, object }`), not embedded rows —
|
|
546
|
+
* fetch the targets with a follow-up call for the object they point at.
|
|
547
|
+
* Every declared relation field is present; `[]` means "no links yet", which
|
|
548
|
+
* is deliberately distinguishable from a field that wasn't returned.
|
|
549
|
+
*
|
|
550
|
+
* Paginate by passing the previous response's `nextCursor` back as `cursor`
|
|
551
|
+
* until it comes back `null`. The cursor is opaque — don't build one.
|
|
552
|
+
*/
|
|
553
|
+
listRecords(input: ListDataModelRecordsInput): Promise<ListDataModelRecordsResponse>;
|
|
554
|
+
/**
|
|
555
|
+
* Every row of an object, walking `nextCursor` to exhaustion.
|
|
556
|
+
*
|
|
557
|
+
* For build-time rendering of a table you own and whose size you know. It is
|
|
558
|
+
* an unbounded loop over your data by definition — for anything visitor-facing
|
|
559
|
+
* or open-ended, page with {@link listRecords} instead.
|
|
560
|
+
*
|
|
561
|
+
* Returns the plan-gate shape unchanged if the org lacks the entitlement, so
|
|
562
|
+
* the same `available` branch works for both.
|
|
563
|
+
*/
|
|
564
|
+
listAllRecords(input: Omit<ListDataModelRecordsInput, "cursor">): Promise<ListDataModelRecordsResponse>;
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Read your site's visitor counts back.
|
|
568
|
+
*
|
|
569
|
+
* The `<BIABAnalytics/>` tracker (`@businessdash/sdk/react-analytics`) RECORDS
|
|
570
|
+
* pageviews; this READS the totals, so you can put a number on the page instead
|
|
571
|
+
* of only feeding the dashboard.
|
|
572
|
+
*
|
|
573
|
+
* ```ts
|
|
574
|
+
* // Site-wide, all time
|
|
575
|
+
* const all = await biab.site(siteId).analytics.pageViews();
|
|
576
|
+
* if (all.available) console.log(`${all.total.views} views`);
|
|
577
|
+
*
|
|
578
|
+
* // One page, last 30 days
|
|
579
|
+
* const home = await biab.site(siteId).analytics.pageViews({ paths: ['/'], days: 30 });
|
|
580
|
+
*
|
|
581
|
+
* // A batch of pages in one round-trip
|
|
582
|
+
* const list = await biab.site(siteId).analytics.pageViews({
|
|
583
|
+
* paths: ['/tech/typescript', '/tech/rust'],
|
|
584
|
+
* });
|
|
585
|
+
* // list.paths → [{ path, views, visitors }, …], every requested path present
|
|
586
|
+
* ```
|
|
587
|
+
*
|
|
588
|
+
* `visitors` approximates unique visitors (distinct daily-rotating anon id).
|
|
589
|
+
* Requires the `analytics.web` entitlement — an org without it gets
|
|
590
|
+
* `{ available: false }`, so branch on `.available`.
|
|
591
|
+
*/
|
|
592
|
+
export declare class BiabDevAnalyticsClient {
|
|
593
|
+
private readonly client;
|
|
594
|
+
private readonly siteId;
|
|
595
|
+
constructor(client: BiabDevClient, siteId: string);
|
|
596
|
+
/**
|
|
597
|
+
* Pageview + visitor counts. Pass `paths` for a per-path breakdown (plus a
|
|
598
|
+
* combined `total`), or omit them for a site-wide `total`. `days` windows the
|
|
599
|
+
* count; omit for all-time.
|
|
600
|
+
*/
|
|
601
|
+
pageViews(input?: PageViewsInput): Promise<PageViewsResponse>;
|
|
602
|
+
/**
|
|
603
|
+
* Which AI crawlers (GPTBot, ClaudeBot, PerplexityBot, …) actually fetched
|
|
604
|
+
* this site's pages: fetch counts, distinct pages read, vendor, intent
|
|
605
|
+
* (training / search / live-assistant), and when each last came.
|
|
606
|
+
*
|
|
607
|
+
* First-party AEO visibility — recorded when crawlers hit the tracker (the
|
|
608
|
+
* assistant browsing agents run JS) and when your server reports the rest
|
|
609
|
+
* via `reportAiCrawlerHit` from `@businessdash/sdk/analytics-server`. Defaults
|
|
610
|
+
* to a 30-day window.
|
|
611
|
+
*
|
|
612
|
+
* ```ts
|
|
613
|
+
* const ai = await biab.site(siteId).analytics.aiVisibility({ days: 30 });
|
|
614
|
+
* if (ai.available) {
|
|
615
|
+
* for (const c of ai.crawlers)
|
|
616
|
+
* console.log(`${c.name}: ${c.fetches} fetches over ${c.distinctPages} pages`);
|
|
617
|
+
* }
|
|
618
|
+
* ```
|
|
619
|
+
*/
|
|
620
|
+
aiVisibility(input?: AiVisibilityInput): Promise<AiVisibilityResponse>;
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* The "Powered by BusinessDash" attribution badge's one narrow function.
|
|
624
|
+
*
|
|
625
|
+
* `<BusinessDashFooter/>` uses this to (a) read whether the badge is required on
|
|
626
|
+
* this plan and (b) optionally report that it rendered. Both are scoped to your
|
|
627
|
+
* own site with a publishable key.
|
|
628
|
+
*
|
|
629
|
+
* ⚠️ The heartbeat is a courtesy signal, not proof of anything — BusinessDash
|
|
630
|
+
* verifies the badge by fetching your live domain, not by trusting this call. So
|
|
631
|
+
* don't build logic on the heartbeat; do honor `policy().required`.
|
|
632
|
+
*/
|
|
633
|
+
export declare class BiabDevAttributionClient {
|
|
634
|
+
private readonly client;
|
|
635
|
+
private readonly siteId;
|
|
636
|
+
constructor(client: BiabDevClient, siteId: string);
|
|
637
|
+
/**
|
|
638
|
+
* This site's badge policy: `{ siteId, required }`. `required` is `true` on
|
|
639
|
+
* plans that can't remove the badge (launch), `false` otherwise. Build the
|
|
640
|
+
* badge's `?ref=<siteId>` backlink from `siteId`.
|
|
641
|
+
*/
|
|
642
|
+
policy(): Promise<AttributionPolicy>;
|
|
643
|
+
/**
|
|
644
|
+
* Report that the badge rendered on `url`. Best-effort and untrusted — it
|
|
645
|
+
* never throws for a bad URL (you get `{ recorded: false }`), and it's safe to
|
|
646
|
+
* fire-and-forget. Don't await it in a render path.
|
|
647
|
+
*/
|
|
648
|
+
heartbeat(input: AttributionHeartbeatInput): Promise<AttributionHeartbeatResponse>;
|
|
649
|
+
}
|
|
650
|
+
export declare class BiabDevAssetsClient {
|
|
651
|
+
private readonly client;
|
|
652
|
+
private readonly siteId;
|
|
653
|
+
constructor(client: BiabDevClient, siteId: string);
|
|
654
|
+
create(input: SiteAssetInput): Promise<UploadSiteAssetResponse>;
|
|
655
|
+
}
|
|
656
|
+
export declare class BiabDevActionsClient {
|
|
657
|
+
private readonly client;
|
|
658
|
+
private readonly siteId;
|
|
659
|
+
constructor(client: BiabDevClient, siteId: string);
|
|
660
|
+
run(actionName: string, input?: ExecuteActionInput): Promise<ExecuteActionResponse>;
|
|
661
|
+
}
|
|
662
|
+
export declare class BiabDevEmailTemplatesClient {
|
|
663
|
+
private readonly client;
|
|
664
|
+
constructor(client: BiabDevClient);
|
|
665
|
+
list(input?: ListEmailTemplatesInput): Promise<ListEmailTemplatesResponse>;
|
|
666
|
+
get(templateId: number): Promise<GetEmailTemplateResponse>;
|
|
667
|
+
create(input: CreateEmailTemplateInput): Promise<CreateEmailTemplateResponse>;
|
|
668
|
+
createVersion(templateId: number, input: CreateEmailTemplateVersionInput): Promise<CreateEmailTemplateVersionResponse>;
|
|
669
|
+
}
|
|
670
|
+
export declare class BiabDevFollowersClient {
|
|
671
|
+
private readonly client;
|
|
672
|
+
private readonly siteId;
|
|
673
|
+
constructor(client: BiabDevClient, siteId: string);
|
|
674
|
+
private actionPath;
|
|
675
|
+
join(input: FollowerJoinInput): Promise<FollowerJoinResponse>;
|
|
676
|
+
me(input: FollowerMeInput): Promise<FollowerMeResponse>;
|
|
677
|
+
edit(input: FollowerEditInput): Promise<FollowerEditResponse>;
|
|
678
|
+
leave(input: FollowerLeaveInput): Promise<FollowerLeaveResponse>;
|
|
679
|
+
}
|
|
680
|
+
export declare class BiabDevDashboardClient {
|
|
681
|
+
private readonly client;
|
|
682
|
+
constructor(client: BiabDevClient);
|
|
683
|
+
createSession(): Promise<DashboardSessionResponse>;
|
|
684
|
+
}
|
|
685
|
+
export declare class BiabDevStorefrontClient {
|
|
686
|
+
private readonly client;
|
|
687
|
+
constructor(client: BiabDevClient);
|
|
688
|
+
/**
|
|
689
|
+
* Legacy embed-session mint (kept for iframe-widget consumers).
|
|
690
|
+
* The programmatic methods below let consumer sites render their
|
|
691
|
+
* own native product catalog using BIAB as the data layer.
|
|
692
|
+
*/
|
|
693
|
+
createSession(input?: StorefrontSessionInput): Promise<StorefrontSessionResponse>;
|
|
694
|
+
/**
|
|
695
|
+
* Paginated list of live products for the calling org's storefront.
|
|
696
|
+
* Cursor is an opaque integer offset — pass back the response's
|
|
697
|
+
* `nextCursor` to fetch the next page. Filter by category via the
|
|
698
|
+
* `categoryId` option.
|
|
699
|
+
*/
|
|
700
|
+
listProducts(input?: {
|
|
701
|
+
limit?: number;
|
|
702
|
+
cursor?: number | null;
|
|
703
|
+
categoryId?: string;
|
|
704
|
+
}): Promise<StorefrontListProductsResponse>;
|
|
705
|
+
/**
|
|
706
|
+
* Filterable listing grid with facets — the data behind a full shop page.
|
|
707
|
+
* Returns enriched per-card price/ratings/badges plus `categoryCounts` and
|
|
708
|
+
* the catalog-wide `priceRange` for a sidebar. Supports `search`,
|
|
709
|
+
* `categoryId`, `minPriceCents`/`maxPriceCents`, `minRating` (1–5), and
|
|
710
|
+
* `sort` (featured | newest | price-asc | price-desc | rating-desc).
|
|
711
|
+
*/
|
|
712
|
+
listProductsWithMeta(input?: {
|
|
713
|
+
search?: string;
|
|
714
|
+
categoryId?: string;
|
|
715
|
+
minPriceCents?: number;
|
|
716
|
+
maxPriceCents?: number;
|
|
717
|
+
minRating?: number;
|
|
718
|
+
sort?: StorefrontSort;
|
|
719
|
+
limit?: number;
|
|
720
|
+
/** Dev-only: also surface pending (non-live) products. Caller-gated. */
|
|
721
|
+
preview?: boolean;
|
|
722
|
+
}): Promise<StorefrontProductsWithMetaResponse>;
|
|
723
|
+
/** Org-scoped product categories for a storefront sidebar. */
|
|
724
|
+
listCategories(): Promise<StorefrontCategoriesResponse>;
|
|
725
|
+
/**
|
|
726
|
+
* Full product detail with variants + per-image rows. Returns 404
|
|
727
|
+
* via `BiabApiError` if the product isn't live or doesn't belong
|
|
728
|
+
* to the org bound to the API key.
|
|
729
|
+
*/
|
|
730
|
+
getProduct(productId: string): Promise<StorefrontProductDetail>;
|
|
731
|
+
/** Approved reviews for a product + aggregate (`avgRating`, `totalCount`).
|
|
732
|
+
* Cursor-paginated — pass back `nextCursor` for the next page. */
|
|
733
|
+
getProductReviews(productId: string, input?: {
|
|
734
|
+
limit?: number;
|
|
735
|
+
cursor?: number | null;
|
|
736
|
+
}): Promise<StorefrontProductReviewsResponse>;
|
|
737
|
+
/** "You may also like" — same-category / paired recommendations. */
|
|
738
|
+
getRelatedProducts(productId: string, input?: {
|
|
739
|
+
limit?: number;
|
|
740
|
+
}): Promise<StorefrontRelatedProductsResponse>;
|
|
741
|
+
/** Companion / exclusive cross-sell addons for the "complete your X" rail. */
|
|
742
|
+
getProductAddons(productId: string): Promise<StorefrontAddonsResponse>;
|
|
743
|
+
}
|
|
744
|
+
export declare class BiabDevCartClient {
|
|
745
|
+
private readonly client;
|
|
746
|
+
private readonly visitorToken;
|
|
747
|
+
private readonly sessionToken;
|
|
748
|
+
constructor(client: BiabDevClient, visitorToken?: string | null, sessionToken?: string | null);
|
|
749
|
+
/**
|
|
750
|
+
* Use an anonymous visitor token (UUID stored in the consumer's
|
|
751
|
+
* own httpOnly cookie). Same shopper across page loads, no
|
|
752
|
+
* sign-in required.
|
|
753
|
+
*/
|
|
754
|
+
forVisitor(visitorToken: string): BiabDevCartClient;
|
|
755
|
+
/**
|
|
756
|
+
* Use a tenantAuth session token instead of a visitor token.
|
|
757
|
+
* Carts are now keyed to the signed-in customer; persists
|
|
758
|
+
* across devices.
|
|
759
|
+
*/
|
|
760
|
+
withSession(sessionToken: string): BiabDevCartClient;
|
|
761
|
+
private headers;
|
|
762
|
+
/**
|
|
763
|
+
* Legacy embed-session mint (kept for iframe-widget consumers).
|
|
764
|
+
* The programmatic methods below let the consumer site render
|
|
765
|
+
* its own native cart UI.
|
|
766
|
+
*/
|
|
767
|
+
createSession(): Promise<CartSessionResponse>;
|
|
768
|
+
/**
|
|
769
|
+
* Read the current cart snapshot — item count, items with
|
|
770
|
+
* resolved product detail (name, image, variant title, unit
|
|
771
|
+
* price), subtotal, currency. Auto-creates an empty cart row
|
|
772
|
+
* the first time it's called for a new visitor/session, so
|
|
773
|
+
* the consumer always gets a valid snapshot.
|
|
774
|
+
*/
|
|
775
|
+
get(): Promise<CartSnapshot>;
|
|
776
|
+
/**
|
|
777
|
+
* Add a product (optionally with a variant) to the cart. If the
|
|
778
|
+
* (productId, variantId) already exists, increments its quantity
|
|
779
|
+
* rather than creating a duplicate line.
|
|
780
|
+
*/
|
|
781
|
+
addItem(input: CartAddItemInput): Promise<CartSnapshot>;
|
|
782
|
+
/**
|
|
783
|
+
* Set a line's quantity. Pass quantity=0 to delete the line.
|
|
784
|
+
*/
|
|
785
|
+
updateItem(itemId: string, input: CartUpdateItemInput): Promise<CartSnapshot>;
|
|
786
|
+
removeItem(itemId: string): Promise<CartSnapshot>;
|
|
787
|
+
/**
|
|
788
|
+
* Stamp a coupon code on the cart. Validation runs at checkout —
|
|
789
|
+
* stamping here is a no-op when invalid; the consumer learns
|
|
790
|
+
* via the Stripe-checkout-session response whether the code
|
|
791
|
+
* actually applies.
|
|
792
|
+
*/
|
|
793
|
+
applyCoupon(input: CartCouponInput): Promise<CartSnapshot>;
|
|
794
|
+
removeCoupon(): Promise<CartSnapshot>;
|
|
795
|
+
/** Empty all items + drop the stamped coupon. Keeps the cart row itself. */
|
|
796
|
+
clear(): Promise<CartSnapshot>;
|
|
797
|
+
}
|
|
798
|
+
export declare class BiabDevCheckoutClient {
|
|
799
|
+
private readonly client;
|
|
800
|
+
private readonly visitorToken;
|
|
801
|
+
private readonly sessionToken;
|
|
802
|
+
constructor(client: BiabDevClient, visitorToken?: string | null, sessionToken?: string | null);
|
|
803
|
+
/**
|
|
804
|
+
* Authenticate the start-from-cart call as an anonymous shopper
|
|
805
|
+
* (visitor-token cart). Same UUID you used with `client.cart.forVisitor(...)`.
|
|
806
|
+
*/
|
|
807
|
+
forVisitor(visitorToken: string): BiabDevCheckoutClient;
|
|
808
|
+
/**
|
|
809
|
+
* Authenticate as a signed-in customer (tenantAuth session token).
|
|
810
|
+
* The Stripe Checkout Session will be created against this
|
|
811
|
+
* customer's saved cart.
|
|
812
|
+
*/
|
|
813
|
+
withSession(sessionToken: string): BiabDevCheckoutClient;
|
|
814
|
+
private headers;
|
|
815
|
+
/**
|
|
816
|
+
* Legacy iframe-embed mint — gives back a tokenized URL to render
|
|
817
|
+
* inside an iframe that redirects to Stripe. Kept for `<Checkout/>`
|
|
818
|
+
* consumers; new code should call `start()` for native handoff.
|
|
819
|
+
*/
|
|
820
|
+
createSession(input: CheckoutSessionInput): Promise<CheckoutSessionResponse>;
|
|
821
|
+
/**
|
|
822
|
+
* Convert the caller's saved BIAB cart (resolved via visitor token
|
|
823
|
+
* or session token) into a Stripe Checkout Session. Returns the
|
|
824
|
+
* Stripe-hosted URL; redirect the browser there to collect payment.
|
|
825
|
+
*
|
|
826
|
+
* `successUrl` + `cancelUrl` may be full URLs on the consumer's own
|
|
827
|
+
* domain. We append `session_id={CHECKOUT_SESSION_ID}` to the
|
|
828
|
+
* success URL automatically so the success page can call
|
|
829
|
+
* `getStatus(sessionId)` to confirm payment.
|
|
830
|
+
*/
|
|
831
|
+
start(input?: CheckoutStartInput): Promise<CheckoutStartResponse>;
|
|
832
|
+
/**
|
|
833
|
+
* Look up a Stripe Checkout Session by id. Returns paid / unpaid
|
|
834
|
+
* status plus the customer details Stripe collected — what the
|
|
835
|
+
* consumer's "thank you" page calls before rendering.
|
|
836
|
+
*/
|
|
837
|
+
getStatus(sessionId: string): Promise<CheckoutStatusResponse>;
|
|
838
|
+
}
|
|
839
|
+
/**
|
|
840
|
+
* White-glove Google Places proxy. BIAB owns the API key — consumer
|
|
841
|
+
* code never sees it. Use at the checkout delivery-address input
|
|
842
|
+
* to give shoppers text-search predictions + verify deliverability
|
|
843
|
+
* before submitting the order.
|
|
844
|
+
*
|
|
845
|
+
* Mirrors the working reference in `Resources/addressParser/`:
|
|
846
|
+
* - `search(query)` — text-search predictions (uses Google
|
|
847
|
+
* `places:searchText`)
|
|
848
|
+
* - `getDetails(placeId)` — placeId → `GoogleAddress` shape
|
|
849
|
+
* - `verify(form)` — text-searches the entered address and
|
|
850
|
+
* compares component-by-component
|
|
851
|
+
*
|
|
852
|
+
* Three pure converters are exported alongside as static methods —
|
|
853
|
+
* the same ones the reference React hooks wrap, just plain functions
|
|
854
|
+
* so they work outside React too.
|
|
855
|
+
*
|
|
856
|
+
* @example
|
|
857
|
+
* ```tsx
|
|
858
|
+
* // On each keystroke (debounced):
|
|
859
|
+
* const result = await client.address.search({ query: input });
|
|
860
|
+
* if (!result.enabled) return; // platform not configured; show plain input
|
|
861
|
+
*
|
|
862
|
+
* // When user picks a prediction:
|
|
863
|
+
* const detail = await client.address.getDetails(prediction.place_id);
|
|
864
|
+
* if (detail.enabled && detail.address) {
|
|
865
|
+
* const form = BiabDevAddressClient.googleToFormValues(detail.address);
|
|
866
|
+
* reactHookForm.reset(form);
|
|
867
|
+
* }
|
|
868
|
+
*
|
|
869
|
+
* // Before submitting the order:
|
|
870
|
+
* const v = await client.address.verify(form);
|
|
871
|
+
* if (!v.isVerified) showDidYouMean(v.googleAddress);
|
|
872
|
+
* ```
|
|
873
|
+
*/
|
|
874
|
+
export declare class BiabDevAddressClient {
|
|
875
|
+
private readonly client;
|
|
876
|
+
constructor(client: BiabDevClient);
|
|
877
|
+
search(input: AddressSearchInput): Promise<AddressSearchResponse>;
|
|
878
|
+
getDetails(placeId: string): Promise<AddressDetailsResponse>;
|
|
879
|
+
verify(input: AddressFormValues): Promise<AddressVerifyResponse>;
|
|
880
|
+
/** Convert Google's `GoogleAddress` shape into a form-values object. */
|
|
881
|
+
static googleToFormValues(g: GoogleAddress): AddressFormValues;
|
|
882
|
+
/** Convert a form-values object into Stripe's billing-address shape. */
|
|
883
|
+
static formToStripeAddress(a: AddressFormValues): {
|
|
884
|
+
line1: string;
|
|
885
|
+
line2: string | null;
|
|
886
|
+
city: string;
|
|
887
|
+
state: string;
|
|
888
|
+
postal_code: string;
|
|
889
|
+
country: string;
|
|
890
|
+
};
|
|
891
|
+
}
|
|
892
|
+
/**
|
|
893
|
+
* Org-side recurring offerings (gym memberships, monthly service
|
|
894
|
+
* plans, software subscriptions). Lists are public read; the
|
|
895
|
+
* checkout-start endpoint hands the customer off to Stripe-hosted
|
|
896
|
+
* Checkout in `mode: 'subscription'`.
|
|
897
|
+
*
|
|
898
|
+
* Requires the org to have synced each offering to Stripe via the
|
|
899
|
+
* dashboard's "Sync to Stripe" action — otherwise `startCheckout`
|
|
900
|
+
* returns 409 `subscription_not_synced`.
|
|
901
|
+
*/
|
|
902
|
+
export declare class BiabDevSubscriptionsClient {
|
|
903
|
+
private readonly client;
|
|
904
|
+
constructor(client: BiabDevClient);
|
|
905
|
+
list(): Promise<SubscriptionOfferingsListResponse>;
|
|
906
|
+
get(id: string): Promise<SubscriptionOffering>;
|
|
907
|
+
startCheckout(id: string, input?: SubscriptionCheckoutInput): Promise<SubscriptionCheckoutResponse>;
|
|
908
|
+
}
|
|
909
|
+
export declare class BiabDevCouponsClient {
|
|
910
|
+
private readonly client;
|
|
911
|
+
constructor(client: BiabDevClient);
|
|
912
|
+
/**
|
|
913
|
+
* Validate a coupon code against the org's Stripe-connected
|
|
914
|
+
* account. Returns the discount shape (percent / amount /
|
|
915
|
+
* duration) when valid; `{ valid: false, reason, message }`
|
|
916
|
+
* otherwise so the consumer's UI can show "$10 off" before the
|
|
917
|
+
* shopper proceeds to checkout.
|
|
918
|
+
*
|
|
919
|
+
* Source of truth is Stripe — what this endpoint validates is
|
|
920
|
+
* exactly what Stripe-hosted Checkout will accept.
|
|
921
|
+
*
|
|
922
|
+
* @example
|
|
923
|
+
* ```ts
|
|
924
|
+
* const result = await client.coupons.validate("SAVE10");
|
|
925
|
+
* if (result.valid) showDiscount(result.percentOff ?? result.amountOffCents);
|
|
926
|
+
* else toast.error(result.message);
|
|
927
|
+
* ```
|
|
928
|
+
*/
|
|
929
|
+
validate(code: string): Promise<CouponValidateResponse>;
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
* Shipping: rate lookups + on-demand tracking. White-glove model —
|
|
933
|
+
* BIAB owns the carrier integration; consumer code never sees the
|
|
934
|
+
* underlying provider name. Gated on `ecommerce.shipping` so calls
|
|
935
|
+
* from orgs on the Launch plan return the standard plan-gate body
|
|
936
|
+
* via {@link BiabApiError} (status 403).
|
|
937
|
+
*
|
|
938
|
+
* @example
|
|
939
|
+
* ```ts
|
|
940
|
+
* const { options, requiresShipping } = await client.shipping
|
|
941
|
+
* .forVisitor(visitorToken)
|
|
942
|
+
* .getRates({ deliveryAddress });
|
|
943
|
+
* if (!requiresShipping) skipShippingStep();
|
|
944
|
+
* else {
|
|
945
|
+
* const picked = options[0]; // cheapest
|
|
946
|
+
* await client.checkout.forVisitor(visitorToken).start({
|
|
947
|
+
* shipping: picked,
|
|
948
|
+
* successUrl, cancelUrl,
|
|
949
|
+
* });
|
|
950
|
+
* }
|
|
951
|
+
* ```
|
|
952
|
+
*/
|
|
953
|
+
export declare class BiabDevShippingClient {
|
|
954
|
+
private readonly client;
|
|
955
|
+
private readonly visitorToken;
|
|
956
|
+
private readonly sessionToken;
|
|
957
|
+
constructor(client: BiabDevClient, visitorToken?: string | null, sessionToken?: string | null);
|
|
958
|
+
forVisitor(visitorToken: string): BiabDevShippingClient;
|
|
959
|
+
withSession(sessionToken: string): BiabDevShippingClient;
|
|
960
|
+
private headers;
|
|
961
|
+
/**
|
|
962
|
+
* Fetch shipping rate options for the caller's cart + a delivery
|
|
963
|
+
* address. Multi-origin + multi-parcel orders surface as a single
|
|
964
|
+
* combined cost per service tier (carrier+speed). Pass the chosen
|
|
965
|
+
* option directly to `client.checkout.start({ shipping })`.
|
|
966
|
+
*/
|
|
967
|
+
getRates(input: ShippingRatesInput): Promise<ShippingRatesResponse>;
|
|
968
|
+
/**
|
|
969
|
+
* On-demand tracking lookup for a known tracking number. Returns
|
|
970
|
+
* the cached `status_history` we already received via webhook
|
|
971
|
+
* PLUS a fresh poll against the carrier (`liveStatus`). Consumer
|
|
972
|
+
* apps that don't subscribe to push notifications use this to
|
|
973
|
+
* refresh "Where's my order?" pages.
|
|
974
|
+
*/
|
|
975
|
+
track(input: {
|
|
976
|
+
trackingNumber: string;
|
|
977
|
+
}): Promise<ShippingTrackResponse>;
|
|
978
|
+
/**
|
|
979
|
+
* The org's storefront shipping config — whether shipping is on, a coarse
|
|
980
|
+
* "ships from" (city/state/country), the destinations it ships to, the duty
|
|
981
|
+
* model, and preferred carriers. Sanitized (no keys/secrets, no precise
|
|
982
|
+
* origin address). Render shipping copy without the org re-declaring it.
|
|
983
|
+
*
|
|
984
|
+
* @example
|
|
985
|
+
* ```ts
|
|
986
|
+
* const s = await client.shipping.settings();
|
|
987
|
+
* if (s.enabled) show(`Ships to ${s.allowedDestinationCountries?.join(", ") ?? "anywhere"}`);
|
|
988
|
+
* ```
|
|
989
|
+
*/
|
|
990
|
+
settings(): Promise<ShippingSettingsResponse>;
|
|
991
|
+
}
|
|
992
|
+
/**
|
|
993
|
+
* Customer notification preferences. Per-customer-per-org channel
|
|
994
|
+
* settings (in-app / email / SMS / outbound webhook). Identified by
|
|
995
|
+
* the tenantAuth session token — bind with `.withSession(token)`.
|
|
996
|
+
*
|
|
997
|
+
* Outbound-webhook events the consumer site can subscribe to are
|
|
998
|
+
* the same as the shipping fan-out keys:
|
|
999
|
+
* - `order.shipped`
|
|
1000
|
+
* - `order.out_for_delivery`
|
|
1001
|
+
* - `order.delivered`
|
|
1002
|
+
* - `order.exception`
|
|
1003
|
+
* - `order.return_label_created`
|
|
1004
|
+
*
|
|
1005
|
+
* The webhook payload is JSON + signed with the customer's saved
|
|
1006
|
+
* `webhookSigningSecret` via `X-BIAB-Signature: <hex hmac-sha256>`.
|
|
1007
|
+
* Consumer's receiver verifies via:
|
|
1008
|
+
* crypto.createHmac('sha256', secret).update(rawBody).digest('hex')
|
|
1009
|
+
*/
|
|
1010
|
+
export declare class BiabDevNotificationsClient {
|
|
1011
|
+
private readonly client;
|
|
1012
|
+
private readonly sessionToken;
|
|
1013
|
+
constructor(client: BiabDevClient, sessionToken?: string | null);
|
|
1014
|
+
withSession(sessionToken: string): BiabDevNotificationsClient;
|
|
1015
|
+
private headers;
|
|
1016
|
+
getPreferences(): Promise<CustomerNotificationPreferencesResponse>;
|
|
1017
|
+
updatePreferences(input: CustomerNotificationPreferencesUpdateInput): Promise<CustomerNotificationPreferencesUpdateResponse>;
|
|
1018
|
+
/**
|
|
1019
|
+
* Start a verification flow for a destination the customer wants to
|
|
1020
|
+
* use for shipping notifications. Email: a verification link is sent
|
|
1021
|
+
* (15-min TTL). Phone: a 6-digit OTP is sent (5-min TTL).
|
|
1022
|
+
*
|
|
1023
|
+
* Until verified, the channel stays inert — preventing the customer
|
|
1024
|
+
* from spamming arbitrary destinations.
|
|
1025
|
+
*/
|
|
1026
|
+
startVerification(input: StartVerificationInput): Promise<StartVerificationResponse>;
|
|
1027
|
+
/**
|
|
1028
|
+
* Consume the verification token from the email link / SMS OTP.
|
|
1029
|
+
* On success: stamps `*VerifiedAt` on the prefs row + activates the
|
|
1030
|
+
* channel.
|
|
1031
|
+
*/
|
|
1032
|
+
confirmVerification(input: ConfirmVerificationInput): Promise<ConfirmVerificationResponse>;
|
|
1033
|
+
}
|
|
1034
|
+
export declare class BiabDevBlogClient {
|
|
1035
|
+
private readonly client;
|
|
1036
|
+
private readonly sessionToken;
|
|
1037
|
+
constructor(client: BiabDevClient, sessionToken?: string | null);
|
|
1038
|
+
/**
|
|
1039
|
+
* Chainable: return a blog client whose `postComment` + future
|
|
1040
|
+
* write methods authenticate via the tenantAuth session token.
|
|
1041
|
+
* Reads (listPosts, getPost, listCategories, listTags, listComments)
|
|
1042
|
+
* don't require a session and work the same either way.
|
|
1043
|
+
*
|
|
1044
|
+
* @example
|
|
1045
|
+
* ```ts
|
|
1046
|
+
* await client.blog().withSession(token).postComment(slug, { content });
|
|
1047
|
+
* ```
|
|
1048
|
+
*/
|
|
1049
|
+
withSession(sessionToken: string): BiabDevBlogClient;
|
|
1050
|
+
private headers;
|
|
1051
|
+
/**
|
|
1052
|
+
* Legacy embed-session mint (kept for backwards compat with
|
|
1053
|
+
* embedded-iframe consumers).
|
|
1054
|
+
*/
|
|
1055
|
+
createSession(input?: BlogSessionInput): Promise<BlogSessionResponse>;
|
|
1056
|
+
/**
|
|
1057
|
+
* Paginated list of published blog posts for the calling org's
|
|
1058
|
+
* site. Cursor is an opaque number — pass back the `nextCursor`
|
|
1059
|
+
* from the previous response to fetch the next page.
|
|
1060
|
+
*/
|
|
1061
|
+
listPosts(input?: {
|
|
1062
|
+
limit?: number;
|
|
1063
|
+
cursor?: number | null;
|
|
1064
|
+
categoryId?: string;
|
|
1065
|
+
}): Promise<BlogListPostsResponse>;
|
|
1066
|
+
/**
|
|
1067
|
+
* Get a single post by its slug. Returns `{ post, access }`
|
|
1068
|
+
* where `access === 'paywall'` and `post.content === ''` for
|
|
1069
|
+
* posts marked `accessLevel: 'paid' | 'followers'`. The
|
|
1070
|
+
* consumer renders a paywall over the empty body when access
|
|
1071
|
+
* is restricted.
|
|
1072
|
+
*/
|
|
1073
|
+
getPost(slug: string): Promise<BlogPostBySlugResponse>;
|
|
1074
|
+
listCategories(): Promise<BlogCategoryListResponse>;
|
|
1075
|
+
listTags(): Promise<BlogTagListResponse>;
|
|
1076
|
+
listComments(slug: string, input?: {
|
|
1077
|
+
limit?: number;
|
|
1078
|
+
cursor?: number | null;
|
|
1079
|
+
}): Promise<BlogCommentListResponse>;
|
|
1080
|
+
/**
|
|
1081
|
+
* Submit a comment on a published post. Requires `withSession()` —
|
|
1082
|
+
* anonymous comments aren't supported in 0.9.0 (the blog_comments
|
|
1083
|
+
* row references a `user_id` text column that's NOT NULL). The
|
|
1084
|
+
* server runs the same moderation screener used by the dashboard
|
|
1085
|
+
* tRPC path; the response surfaces both the comment row + the
|
|
1086
|
+
* moderation verdict so the consumer can show "your comment is
|
|
1087
|
+
* pending review" when applicable.
|
|
1088
|
+
*/
|
|
1089
|
+
postComment(slug: string, input: BlogCommentPostInput): Promise<BlogCommentPostResponse>;
|
|
1090
|
+
/**
|
|
1091
|
+
* Current like state + count for a post. With `withSession()`, `liked`
|
|
1092
|
+
* reflects whether this visitor already liked it (filled heart on load);
|
|
1093
|
+
* without a session the public count is returned with `liked: false`.
|
|
1094
|
+
*/
|
|
1095
|
+
likeStatus(slug: string): Promise<BlogLikeResponse>;
|
|
1096
|
+
/**
|
|
1097
|
+
* Toggle the session visitor's like on a post. Requires `withSession()`
|
|
1098
|
+
* (same identity as `postComment`). Returns the new like state + count.
|
|
1099
|
+
*/
|
|
1100
|
+
toggleLike(slug: string): Promise<BlogLikeResponse>;
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Public reviews-wall client. Reads the org's external reviews
|
|
1104
|
+
* (Google + Yelp + manual + CSV) — the same store the marketing bundle's
|
|
1105
|
+
* `reviews` aggregate is built from. The bundle ships the first page + the
|
|
1106
|
+
* aggregate (count / average / histogram); use this to lazily fetch deeper
|
|
1107
|
+
* pages on "View all" / scroll.
|
|
1108
|
+
*
|
|
1109
|
+
* @example
|
|
1110
|
+
* ```ts
|
|
1111
|
+
* const page1 = await client.reviews.list({ limit: 10 });
|
|
1112
|
+
* if (page1.nextOffset != null) {
|
|
1113
|
+
* const page2 = await client.reviews.list({ limit: 10, offset: page1.nextOffset });
|
|
1114
|
+
* }
|
|
1115
|
+
* ```
|
|
1116
|
+
*/
|
|
1117
|
+
export declare class BiabDevReviewsClient {
|
|
1118
|
+
private readonly client;
|
|
1119
|
+
constructor(client: BiabDevClient);
|
|
1120
|
+
/**
|
|
1121
|
+
* One page of the org's public reviews, newest-first. `limit` defaults to
|
|
1122
|
+
* the server default (10, max 50). Pass the previous response's
|
|
1123
|
+
* `nextOffset` to page forward — it's `null` once the list is exhausted.
|
|
1124
|
+
* `source` narrows to a single platform (e.g. `"yelp"`).
|
|
1125
|
+
*/
|
|
1126
|
+
list(input?: {
|
|
1127
|
+
limit?: number;
|
|
1128
|
+
offset?: number;
|
|
1129
|
+
source?: "google" | "yelp" | "housecall_pro" | "other";
|
|
1130
|
+
}): Promise<ReviewWallListResponse>;
|
|
1131
|
+
}
|
|
1132
|
+
/**
|
|
1133
|
+
* Public hiring client — the org's open job postings and their categories, so
|
|
1134
|
+
* a consumer can render a careers page in their own design system.
|
|
1135
|
+
*
|
|
1136
|
+
* Read-only by construction: everything returned is content the org published
|
|
1137
|
+
* for candidates. To take applications, hand the posting's `applicationFormId`
|
|
1138
|
+
* to the forms surface — this client grants no submit path of its own.
|
|
1139
|
+
*
|
|
1140
|
+
* @example
|
|
1141
|
+
* ```ts
|
|
1142
|
+
* const { items } = await client.hiring.list({ limit: 20 });
|
|
1143
|
+
* const posting = await client.hiring.get("senior-installer");
|
|
1144
|
+
* if (posting.applicationFormId) {
|
|
1145
|
+
* const form = await client.forms.schema(posting.applicationFormId);
|
|
1146
|
+
* }
|
|
1147
|
+
* ```
|
|
1148
|
+
*/
|
|
1149
|
+
export declare class BiabDevHiringClient {
|
|
1150
|
+
private readonly client;
|
|
1151
|
+
constructor(client: BiabDevClient);
|
|
1152
|
+
/**
|
|
1153
|
+
* One page of open postings, newest-first. `limit` defaults to the server
|
|
1154
|
+
* default (25, max 100). Pass the previous response's `nextOffset` to page
|
|
1155
|
+
* forward — it's `null` once the list is exhausted. `category` narrows to a
|
|
1156
|
+
* single group by its slug.
|
|
1157
|
+
*
|
|
1158
|
+
* Only postings that are published, active, have seats left, and are under
|
|
1159
|
+
* their application cap are returned, so a careers page never advertises a
|
|
1160
|
+
* role that can no longer be applied to.
|
|
1161
|
+
*/
|
|
1162
|
+
list(input?: {
|
|
1163
|
+
limit?: number;
|
|
1164
|
+
offset?: number;
|
|
1165
|
+
category?: string;
|
|
1166
|
+
}): Promise<JobPostingListResponse>;
|
|
1167
|
+
/**
|
|
1168
|
+
* One open posting by slug. Rejects with a 404 error when the posting is a
|
|
1169
|
+
* draft, closed, archived, fully filled, or has hit its application cap —
|
|
1170
|
+
* treat that as "this role is gone" rather than as a transient failure.
|
|
1171
|
+
*/
|
|
1172
|
+
get(slug: string): Promise<JobPosting>;
|
|
1173
|
+
/**
|
|
1174
|
+
* The org's job categories with a count of open postings in each — enough to
|
|
1175
|
+
* render filter chips or grouped sections without fetching every posting.
|
|
1176
|
+
*/
|
|
1177
|
+
categories(): Promise<JobCategoryListResponse>;
|
|
1178
|
+
}
|
|
1179
|
+
export declare class BiabDevChatbotClient {
|
|
1180
|
+
private readonly client;
|
|
1181
|
+
constructor(client: BiabDevClient);
|
|
1182
|
+
/** Returns the iframe URL for `<Chatbot/>`. */
|
|
1183
|
+
createSession(): Promise<ChatbotSessionResponse>;
|
|
1184
|
+
/** Reads the org's persisted chatbot config (system prompt, KB, model). */
|
|
1185
|
+
getConfig(): Promise<ChatbotConfig>;
|
|
1186
|
+
/**
|
|
1187
|
+
* Persists the org's chatbot config. Requires `chatbot:write` scope on the
|
|
1188
|
+
* API key — typically only used by admin tools, not embedded widgets.
|
|
1189
|
+
*/
|
|
1190
|
+
updateConfig(input: ChatbotConfigUpdateInput): Promise<ChatbotConfig>;
|
|
1191
|
+
/**
|
|
1192
|
+
* Headless chat — host owns the UI. Each request is fully org-scoped: the
|
|
1193
|
+
* server runs the LLM with the org's saved system prompt + KB + model.
|
|
1194
|
+
*
|
|
1195
|
+
* The response includes `uiActions` (e.g. `show_form`) and `availability`
|
|
1196
|
+
* (front-desk presence + wait-time hint). Headless consumers should resolve
|
|
1197
|
+
* any `show_form` action via {@link getChatForm}, render the fields, and POST
|
|
1198
|
+
* back through {@link submitChatForm} (which carries the chat transcript).
|
|
1199
|
+
*/
|
|
1200
|
+
chat(input: ChatbotChatInput): Promise<ChatbotChatResponse>;
|
|
1201
|
+
/**
|
|
1202
|
+
* Upload a file a visitor attached in the chat. Presigns a direct-to-R2 PUT
|
|
1203
|
+
* (gated by the org's `chat.file_uploads` entitlement — check
|
|
1204
|
+
* `getConfig().fileUploadsEnabled` before offering it), uploads the bytes, and
|
|
1205
|
+
* returns a ref you can attach to the conversation. `sessionId` is any stable
|
|
1206
|
+
* per-chat id (drives the 5-files/hour cap + provenance). Throws on a refused
|
|
1207
|
+
* upload (entitlement, 7 MB cap, or rate limit).
|
|
1208
|
+
*/
|
|
1209
|
+
uploadFile(args: {
|
|
1210
|
+
sessionId: string;
|
|
1211
|
+
file: File;
|
|
1212
|
+
/** Captured visitor email — stored for provenance + checked against the
|
|
1213
|
+
* platform block-list. Optional. */
|
|
1214
|
+
uploaderEmail?: string | null;
|
|
1215
|
+
}): Promise<{
|
|
1216
|
+
url: string;
|
|
1217
|
+
name: string;
|
|
1218
|
+
type: string;
|
|
1219
|
+
size: number;
|
|
1220
|
+
}>;
|
|
1221
|
+
/**
|
|
1222
|
+
* Live front-desk availability — tier flag, staff-online presence, and
|
|
1223
|
+
* a wait-time hint string. Safe to poll (every 20–30s) so the SDK
|
|
1224
|
+
* consumer can render or hide a "Talk to a person" CTA without sending
|
|
1225
|
+
* a chat turn.
|
|
1226
|
+
*/
|
|
1227
|
+
getAvailability(): Promise<ChatbotAvailability>;
|
|
1228
|
+
/**
|
|
1229
|
+
* Fetch a **Live** form definition to render inline on your own page.
|
|
1230
|
+
* A form is reachable here when it is Live (`isActive`) — independent of
|
|
1231
|
+
* `chatbotAccess`. Returns a 404-equivalent throw when the form is missing
|
|
1232
|
+
* or not Live. For a form the AI chatbot recommended via a `show_form`
|
|
1233
|
+
* action, use {@link getChatForm} instead (it carries the chat transcript on
|
|
1234
|
+
* submit).
|
|
1235
|
+
*/
|
|
1236
|
+
getForm(slug: string): Promise<ChatbotFormDefinition>;
|
|
1237
|
+
/**
|
|
1238
|
+
* Submit a **Live** form. Fans out to the same hiring/leads/inquiries CRM
|
|
1239
|
+
* mirrors, actions, scheduling, and staff notification as every other ingest
|
|
1240
|
+
* point. Gated on Live only — no `chatbotAccess` required.
|
|
1241
|
+
*/
|
|
1242
|
+
submitForm(slug: string, input: ChatbotFormSubmitInput): Promise<ChatbotFormSubmitResponse>;
|
|
1243
|
+
/**
|
|
1244
|
+
* Fetch a form the AI chatbot recommended via a `show_form` UI action. This
|
|
1245
|
+
* additionally requires the form to be chatbot-accessible (`chatbotAccess`),
|
|
1246
|
+
* which a recommended form always is. Most embeds want {@link getForm}; reach
|
|
1247
|
+
* for this only inside the chat flow.
|
|
1248
|
+
*/
|
|
1249
|
+
getChatForm(slug: string): Promise<ChatbotFormDefinition>;
|
|
1250
|
+
/**
|
|
1251
|
+
* Submit a chatbot-recommended form. Same CRM fan-out as {@link submitForm},
|
|
1252
|
+
* but on the chatbot path — pass `priorChat` so the resulting CRM inquiry can
|
|
1253
|
+
* include the chat transcript that led to the submission.
|
|
1254
|
+
*/
|
|
1255
|
+
submitChatForm(slug: string, input: ChatbotFormSubmitInput): Promise<ChatbotFormSubmitResponse>;
|
|
1256
|
+
/**
|
|
1257
|
+
* Create or resume the persisted `chatSessions` row for this
|
|
1258
|
+
* visitor. Idempotent on `(orgId, visitorToken)`. The returned
|
|
1259
|
+
* `sessionId` is what you pass to `postMessage`, `pollMessages`,
|
|
1260
|
+
* and `requestHuman`.
|
|
1261
|
+
*
|
|
1262
|
+
* Distinct from {@link createSession} — that mints an iframe-embed
|
|
1263
|
+
* token. This one exposes the underlying server session so the
|
|
1264
|
+
* consumer can render their own UI and still reach Front Desk.
|
|
1265
|
+
*/
|
|
1266
|
+
createPersistedSession(input: ChatbotPersistedSessionInput): Promise<ChatbotPersistedSessionResponse>;
|
|
1267
|
+
/**
|
|
1268
|
+
* Poll messages + session status. Pass `since` (ISO timestamp) on
|
|
1269
|
+
* subsequent polls to only fetch new rows. Recommended cadence:
|
|
1270
|
+
* 3–5s while the widget is open and focused.
|
|
1271
|
+
*/
|
|
1272
|
+
pollMessages(input: {
|
|
1273
|
+
sessionId: string;
|
|
1274
|
+
visitorToken: string;
|
|
1275
|
+
since?: string;
|
|
1276
|
+
}): Promise<ChatbotMessagesResponse>;
|
|
1277
|
+
/**
|
|
1278
|
+
* Append a visitor message. Returns the updated message log so
|
|
1279
|
+
* the consumer can replace its local list with an authoritative
|
|
1280
|
+
* snapshot rather than tracking optimistic updates manually.
|
|
1281
|
+
*/
|
|
1282
|
+
postMessage(input: ChatbotAppendMessageInput): Promise<ChatbotMessagesResponse>;
|
|
1283
|
+
/**
|
|
1284
|
+
* Visitor presses "Talk to a person." Plan-gated on
|
|
1285
|
+
* `chat.front_desk` — orgs on Launch get back
|
|
1286
|
+
* `{ available: false, reason: 'plan_required', requiredFeature, upgradeUrl }`.
|
|
1287
|
+
* Orgs on Growth+ get `{ available: true, status, placeInLine, ... }`.
|
|
1288
|
+
*
|
|
1289
|
+
* Branch on `result.available` to render an upgrade CTA vs the
|
|
1290
|
+
* "you're in line" UI.
|
|
1291
|
+
*
|
|
1292
|
+
* @example
|
|
1293
|
+
* ```ts
|
|
1294
|
+
* const result = await client.chatbot.requestHuman({ sessionId, visitorToken });
|
|
1295
|
+
* if (!result.available) return <UpgradeCard feature={result.requiredFeature} />;
|
|
1296
|
+
* return <Queue position={result.placeInLine} eta={result.estimateLabel} />;
|
|
1297
|
+
* ```
|
|
1298
|
+
*/
|
|
1299
|
+
requestHuman(input: ChatbotRequestHumanInput): Promise<ChatbotRequestHumanResponse>;
|
|
1300
|
+
}
|
|
1301
|
+
export declare class BiabDevCustomerPortalClient {
|
|
1302
|
+
private readonly client;
|
|
1303
|
+
private readonly organizationId;
|
|
1304
|
+
/**
|
|
1305
|
+
* Optional tenantAuth session token. When set, requests include
|
|
1306
|
+
* an `X-BIAB-Session-Token` header and the BIAB customer-portal
|
|
1307
|
+
* routes resolve the calling user via the session payload
|
|
1308
|
+
* instead of the API key's user binding.
|
|
1309
|
+
*
|
|
1310
|
+
* This is the right path for consumer storefronts that don't
|
|
1311
|
+
* mint per-customer API keys: sign customers in via
|
|
1312
|
+
* `client.auth.signIn()`, store the resulting session token
|
|
1313
|
+
* (the SDK's `createAuthHandler` does this in an httpOnly
|
|
1314
|
+
* cookie automatically), then pass that token to
|
|
1315
|
+
* `client.customerPortal(orgId).withSession(token)` for every
|
|
1316
|
+
* customer-scoped call.
|
|
1317
|
+
*/
|
|
1318
|
+
private readonly sessionToken;
|
|
1319
|
+
constructor(client: BiabDevClient, organizationId: string | null,
|
|
1320
|
+
/**
|
|
1321
|
+
* Optional tenantAuth session token. When set, requests include
|
|
1322
|
+
* an `X-BIAB-Session-Token` header and the BIAB customer-portal
|
|
1323
|
+
* routes resolve the calling user via the session payload
|
|
1324
|
+
* instead of the API key's user binding.
|
|
1325
|
+
*
|
|
1326
|
+
* This is the right path for consumer storefronts that don't
|
|
1327
|
+
* mint per-customer API keys: sign customers in via
|
|
1328
|
+
* `client.auth.signIn()`, store the resulting session token
|
|
1329
|
+
* (the SDK's `createAuthHandler` does this in an httpOnly
|
|
1330
|
+
* cookie automatically), then pass that token to
|
|
1331
|
+
* `client.customerPortal(orgId).withSession(token)` for every
|
|
1332
|
+
* customer-scoped call.
|
|
1333
|
+
*/
|
|
1334
|
+
sessionToken?: string | null);
|
|
1335
|
+
/**
|
|
1336
|
+
* Return a customer-portal client that authenticates the calling
|
|
1337
|
+
* user via the tenantAuth session token instead of (or in
|
|
1338
|
+
* addition to) the API key's user binding. Chainable.
|
|
1339
|
+
*
|
|
1340
|
+
* @example
|
|
1341
|
+
* ```ts
|
|
1342
|
+
* const session = await getTenantSessionFromCookie({ cookieValue });
|
|
1343
|
+
* const work = await client
|
|
1344
|
+
* .customerPortal(orgId)
|
|
1345
|
+
* .withSession(session.sessionToken)
|
|
1346
|
+
* .getWork();
|
|
1347
|
+
* ```
|
|
1348
|
+
*/
|
|
1349
|
+
withSession(sessionToken: string): BiabDevCustomerPortalClient;
|
|
1350
|
+
private headers;
|
|
1351
|
+
context(): Promise<CustomerPortalContextResponse>;
|
|
1352
|
+
getProfile(): Promise<CustomerPortalProfile>;
|
|
1353
|
+
updateProfile(input: CustomerPortalUpdateProfileInput): Promise<CustomerPortalUpdateProfileResponse>;
|
|
1354
|
+
myOtherCustomerOrgs(): Promise<CustomerPortalOtherOrgsResponse>;
|
|
1355
|
+
/**
|
|
1356
|
+
* Read the signed-in customer's notification preferences (per category,
|
|
1357
|
+
* per channel) for the bound org. The response also includes the full
|
|
1358
|
+
* category + channel catalog so SDK consumers can render the UI
|
|
1359
|
+
* without hardcoding either — both grow over time on the server side.
|
|
1360
|
+
*
|
|
1361
|
+
* @example
|
|
1362
|
+
* ```ts
|
|
1363
|
+
* const { preferences, categories, channels } =
|
|
1364
|
+
* await client.customerPortal().getNotificationPreferences();
|
|
1365
|
+
*
|
|
1366
|
+
* categories.map((c) => (
|
|
1367
|
+
* <Row category={c} state={preferences[c.id]} />
|
|
1368
|
+
* ));
|
|
1369
|
+
* ```
|
|
1370
|
+
*/
|
|
1371
|
+
getNotificationPreferences(): Promise<NotificationPreferencesResponse>;
|
|
1372
|
+
/**
|
|
1373
|
+
* Update notification preferences. Sparse: only send the toggles you
|
|
1374
|
+
* want to flip — omitted keys keep their persisted (or default) value.
|
|
1375
|
+
* Compliance-required channels (e.g. transactional email) silently
|
|
1376
|
+
* stay true regardless of what's sent.
|
|
1377
|
+
*
|
|
1378
|
+
* @example
|
|
1379
|
+
* ```ts
|
|
1380
|
+
* await client.customerPortal().updateNotificationPreferences({
|
|
1381
|
+
* preferences: { marketing: { email: false, sms: false } },
|
|
1382
|
+
* });
|
|
1383
|
+
* ```
|
|
1384
|
+
*/
|
|
1385
|
+
updateNotificationPreferences(input: NotificationPreferencesUpdateInput): Promise<NotificationPreferencesResponse>;
|
|
1386
|
+
/**
|
|
1387
|
+
* Read the signed-in customer's "what's on my plate" bundle: open
|
|
1388
|
+
* jobs, pending quotes, unpaid invoices, contracts awaiting signature,
|
|
1389
|
+
* and a recent payment history, plus a roll-up summary for the
|
|
1390
|
+
* consumer header.
|
|
1391
|
+
*
|
|
1392
|
+
* URLs are host-less paths — resolve them against the consumer's own
|
|
1393
|
+
* storefront origin to build clickable links.
|
|
1394
|
+
*
|
|
1395
|
+
* @example
|
|
1396
|
+
* ```ts
|
|
1397
|
+
* const work = await client.customerPortal().getWork();
|
|
1398
|
+
* const { openJobCount, unpaidBalance } = work.summary;
|
|
1399
|
+
* work.invoices.filter((i) => i.balanceDue > 0).map(...)
|
|
1400
|
+
* ```
|
|
1401
|
+
*/
|
|
1402
|
+
getWork(): Promise<CustomerWorkBundle>;
|
|
1403
|
+
/** Read a single job the signed-in customer owns. */
|
|
1404
|
+
getJob(jobId: string): Promise<CustomerJobDetail>;
|
|
1405
|
+
/** Read a single quote the signed-in customer owns. */
|
|
1406
|
+
getQuote(quoteId: string): Promise<CustomerQuoteDetail>;
|
|
1407
|
+
/** Naming alias for {@link getQuote} — read a single quote the customer owns. */
|
|
1408
|
+
viewQuote(quoteId: string): Promise<CustomerQuoteDetail>;
|
|
1409
|
+
/**
|
|
1410
|
+
* Accept a quote as the signed-in customer. Idempotent — re-accepting
|
|
1411
|
+
* an already-accepted quote resolves the existing state without
|
|
1412
|
+
* additional side effects.
|
|
1413
|
+
*/
|
|
1414
|
+
acceptQuote(quoteId: string): Promise<CustomerQuoteActionResponse>;
|
|
1415
|
+
/** Reject a quote as the signed-in customer. Idempotent. */
|
|
1416
|
+
rejectQuote(quoteId: string): Promise<CustomerQuoteActionResponse>;
|
|
1417
|
+
/** Read a single invoice the signed-in customer owns. */
|
|
1418
|
+
getInvoice(invoiceId: string): Promise<CustomerInvoiceDetail>;
|
|
1419
|
+
/**
|
|
1420
|
+
* Start payment for an invoice the customer owns. Returns a Stripe-hosted
|
|
1421
|
+
* Checkout URL to redirect to — card entry happens entirely on Stripe, so
|
|
1422
|
+
* your app never touches card data (stays out of PCI scope).
|
|
1423
|
+
*
|
|
1424
|
+
* Pass your own `successUrl` / `cancelUrl` to return into your storefront,
|
|
1425
|
+
* or omit them to land back on the org's branded hosted invoice page.
|
|
1426
|
+
*
|
|
1427
|
+
* @example
|
|
1428
|
+
* ```ts
|
|
1429
|
+
* const { checkoutUrl } = await client
|
|
1430
|
+
* .customerPortal()
|
|
1431
|
+
* .payInvoice(invoiceId, { successUrl: "https://shop.example.com/paid" });
|
|
1432
|
+
* window.location.href = checkoutUrl;
|
|
1433
|
+
* ```
|
|
1434
|
+
*/
|
|
1435
|
+
payInvoice(invoiceId: string, opts?: CustomerInvoicePayInput): Promise<CustomerInvoicePayResponse>;
|
|
1436
|
+
/**
|
|
1437
|
+
* Download the customer's invoice as a PDF. Returns the file metadata plus
|
|
1438
|
+
* the decoded `bytes` (a `Uint8Array`) — the auth headers ride along on the
|
|
1439
|
+
* SDK request, so this works for a signed-in customer without exposing a
|
|
1440
|
+
* public URL. Once paid, the PDF carries a PAID marker + payment history.
|
|
1441
|
+
*
|
|
1442
|
+
* @example Browser download
|
|
1443
|
+
* ```ts
|
|
1444
|
+
* const file = await client.customerPortal(orgId).withSession(token)
|
|
1445
|
+
* .downloadInvoicePdf(invoiceId);
|
|
1446
|
+
* const url = URL.createObjectURL(
|
|
1447
|
+
* new Blob([file.bytes], { type: file.contentType }),
|
|
1448
|
+
* );
|
|
1449
|
+
* const a = document.createElement("a");
|
|
1450
|
+
* a.href = url;
|
|
1451
|
+
* a.download = file.filename;
|
|
1452
|
+
* a.click();
|
|
1453
|
+
* URL.revokeObjectURL(url);
|
|
1454
|
+
* ```
|
|
1455
|
+
*/
|
|
1456
|
+
downloadInvoicePdf(invoiceId: string): Promise<CustomerInvoicePdf & {
|
|
1457
|
+
bytes: Uint8Array;
|
|
1458
|
+
}>;
|
|
1459
|
+
/** Read a single contract the signed-in customer owns. */
|
|
1460
|
+
getContract(contractId: string): Promise<CustomerContractDetail>;
|
|
1461
|
+
/**
|
|
1462
|
+
* Begin signing a contract the customer owns. Returns a ready, absolute
|
|
1463
|
+
* signing URL on the org's branded hostname — redirect the customer there
|
|
1464
|
+
* to BIAB's hosted e-sign page, which captures the signature and generates
|
|
1465
|
+
* the executed PDF. No signature payload is collected client-side, so the
|
|
1466
|
+
* legal record stays consistent across consumers.
|
|
1467
|
+
*
|
|
1468
|
+
* Rejects with `contract_already_signed` (409) or `contract_not_signable`
|
|
1469
|
+
* (409) when the contract isn't in a signable state.
|
|
1470
|
+
*
|
|
1471
|
+
* @example
|
|
1472
|
+
* ```ts
|
|
1473
|
+
* const { signingUrl } = await client
|
|
1474
|
+
* .customerPortal()
|
|
1475
|
+
* .signContract(contractId);
|
|
1476
|
+
* window.location.href = signingUrl;
|
|
1477
|
+
* ```
|
|
1478
|
+
*/
|
|
1479
|
+
signContract(contractId: string): Promise<CustomerContractSignResponse>;
|
|
1480
|
+
/** List reviews the signed-in customer has submitted in this org. */
|
|
1481
|
+
listMyReviews(): Promise<CustomerReviewListResponse>;
|
|
1482
|
+
/**
|
|
1483
|
+
* Referral roll-up for the signed-in customer (as an affiliate), summed
|
|
1484
|
+
* across every program they're enrolled in. `enrolled: false` with zeroed
|
|
1485
|
+
* counters when the customer holds no affiliate record. Real data appears
|
|
1486
|
+
* once the org's referral attribution + payout pipeline records activity.
|
|
1487
|
+
*
|
|
1488
|
+
* @example
|
|
1489
|
+
* ```ts
|
|
1490
|
+
* const stats = await client.customerPortal().myReferralStats();
|
|
1491
|
+
* if (stats.enrolled) showEarnings(stats.earningsCents);
|
|
1492
|
+
* ```
|
|
1493
|
+
*/
|
|
1494
|
+
myReferralStats(): Promise<CustomerReferralStats>;
|
|
1495
|
+
/**
|
|
1496
|
+
* The customer's referral conversion feed (most recent first). Empty until
|
|
1497
|
+
* the attribution pipeline records conversions. `limit` 1–200 (default 50).
|
|
1498
|
+
*/
|
|
1499
|
+
myReferralHistory(opts?: {
|
|
1500
|
+
limit?: number;
|
|
1501
|
+
}): Promise<CustomerReferralHistoryResponse>;
|
|
1502
|
+
/** The customer's referral payout history + upcoming rows (newest first). */
|
|
1503
|
+
myReferralPayouts(): Promise<CustomerReferralPayoutsResponse>;
|
|
1504
|
+
/**
|
|
1505
|
+
* The signed-in customer's orders (newest first), each with a shipment
|
|
1506
|
+
* roll-up (`overallStatus`, `anyInTransit`, `latestEstimatedDelivery`) for
|
|
1507
|
+
* an orders/shipping dashboard list. `limit` 1–100 (default 30). Requires
|
|
1508
|
+
* the org's `ecommerce.shipping` entitlement.
|
|
1509
|
+
*
|
|
1510
|
+
* @example
|
|
1511
|
+
* ```ts
|
|
1512
|
+
* const { items } = await client.customerPortal().listOrders();
|
|
1513
|
+
* items.filter((o) => o.anyInTransit).map(renderTracker);
|
|
1514
|
+
* ```
|
|
1515
|
+
*/
|
|
1516
|
+
listOrders(opts?: {
|
|
1517
|
+
limit?: number;
|
|
1518
|
+
}): Promise<CustomerOrderListResponse>;
|
|
1519
|
+
/**
|
|
1520
|
+
* The customer's full payment history with this org — invoice payments,
|
|
1521
|
+
* store-order charges, and refunds (negative amounts), newest first.
|
|
1522
|
+
* Powers a "Payments" tab on the customer dashboard.
|
|
1523
|
+
*
|
|
1524
|
+
* ```ts
|
|
1525
|
+
* const { items } = await client.customerPortal().listPayments();
|
|
1526
|
+
* items.map((p) => `${p.occurredAt} ${p.kind} $${p.amount}`);
|
|
1527
|
+
* ```
|
|
1528
|
+
*/
|
|
1529
|
+
listPayments(opts?: {
|
|
1530
|
+
limit?: number;
|
|
1531
|
+
}): Promise<import("./contracts").CustomerPaymentHistoryResponse>;
|
|
1532
|
+
/**
|
|
1533
|
+
* One order the customer owns: line items + shipments, each shipment with
|
|
1534
|
+
* its carrier, tracking link, status, and `statusHistory` timeline (read
|
|
1535
|
+
* from stored data — webhook-fresh).
|
|
1536
|
+
*/
|
|
1537
|
+
getOrder(orderId: string): Promise<CustomerOrderDetail>;
|
|
1538
|
+
/**
|
|
1539
|
+
* Open a return / refund request on an order the customer owns. Creates a
|
|
1540
|
+
* `requested` record and notifies the org's review queue — the org's
|
|
1541
|
+
* approval (not this call) triggers the actual Stripe refund. Omit `items`
|
|
1542
|
+
* for a whole-order request. The request then shows up under
|
|
1543
|
+
* `getOrder(orderId).returnRequests`.
|
|
1544
|
+
*
|
|
1545
|
+
* @example
|
|
1546
|
+
* ```ts
|
|
1547
|
+
* await portal.submitReturnRequest(orderId, {
|
|
1548
|
+
* reason: "damaged",
|
|
1549
|
+
* customerNote: "Arrived cracked.",
|
|
1550
|
+
* items: [{ orderItemId, quantity: 1 }],
|
|
1551
|
+
* });
|
|
1552
|
+
* ```
|
|
1553
|
+
*/
|
|
1554
|
+
submitReturnRequest(orderId: string, input?: CustomerReturnRequestInput): Promise<CustomerReturnRequestCreated>;
|
|
1555
|
+
/**
|
|
1556
|
+
* List the digital downloads the customer is entitled to for a paid order
|
|
1557
|
+
* (P10d). Each item is a ready-to-use URL — a short-lived presigned link for
|
|
1558
|
+
* BIAB-hosted files (`expiresInSeconds` set) or the org's external link.
|
|
1559
|
+
* Returns an empty list until the order's payment settles.
|
|
1560
|
+
*
|
|
1561
|
+
* @example
|
|
1562
|
+
* ```ts
|
|
1563
|
+
* const { items } = await portal.getDownloads(orderId);
|
|
1564
|
+
* for (const d of items) console.log(d.productName, d.url);
|
|
1565
|
+
* ```
|
|
1566
|
+
*/
|
|
1567
|
+
getDownloads(orderId: string): Promise<CustomerDownloadsResponse>;
|
|
1568
|
+
/**
|
|
1569
|
+
* Track a single shipment the customer owns (resolved through their own
|
|
1570
|
+
* order). Returns the stored shipment plus a best-effort live carrier status
|
|
1571
|
+
* (`liveStatus`) when it's still in transit.
|
|
1572
|
+
*/
|
|
1573
|
+
trackShipment(shipmentId: string): Promise<CustomerShipmentTracking>;
|
|
1574
|
+
/**
|
|
1575
|
+
* Submit a review tied to the signed-in customer's email. Land
|
|
1576
|
+
* with `status: pending` so org staff can moderate before the
|
|
1577
|
+
* review surfaces on the public bundle. `jobId` is optional and
|
|
1578
|
+
* validated server-side against the customer's own jobs — a
|
|
1579
|
+
* stranger's id is rejected with a 403.
|
|
1580
|
+
*/
|
|
1581
|
+
submitReview(input: CustomerReviewSubmitInput): Promise<CustomerReviewSubmitResponse>;
|
|
1582
|
+
/** List the comment thread on a job the customer owns. */
|
|
1583
|
+
listJobComments(jobId: string): Promise<CustomerJobCommentsListResponse>;
|
|
1584
|
+
/** Post a customer comment on one of the customer's own jobs. */
|
|
1585
|
+
postJobComment(jobId: string, input: CustomerJobCommentPostInput): Promise<CustomerJobComment>;
|
|
1586
|
+
/**
|
|
1587
|
+
* Open (or reuse) a front-desk chat session bound to the signed-in
|
|
1588
|
+
* customer and post their first message. Staff see the thread in
|
|
1589
|
+
* the chatbot inbox with `linkedContactId` set so they know who's
|
|
1590
|
+
* reaching out. Returns the `sessionId` + `visitorToken` so the
|
|
1591
|
+
* consumer can poll for staff replies or render the chatbot widget
|
|
1592
|
+
* over the same session via the existing chatbot embed flow.
|
|
1593
|
+
*/
|
|
1594
|
+
contactCompany(input: CustomerContactCompanyInput): Promise<CustomerContactCompanyResponse>;
|
|
1595
|
+
/**
|
|
1596
|
+
* Staff-on-the-way view for a job the customer owns. First-cut:
|
|
1597
|
+
* returns assigned-tech display names + dispatch status, the last
|
|
1598
|
+
* known GPS ping per tech (when available), and the most recent
|
|
1599
|
+
* ETA snapshot from the dispatch_offers cascade.
|
|
1600
|
+
*
|
|
1601
|
+
* `liveEtaAvailable: false` today — flips to true once the
|
|
1602
|
+
* dispatch travel-time recompute layer ships, at which point the
|
|
1603
|
+
* `eta` field switches sources without breaking this shape.
|
|
1604
|
+
*/
|
|
1605
|
+
getJobEta(jobId: string): Promise<CustomerJobEtaResponse>;
|
|
1606
|
+
/**
|
|
1607
|
+
* Unified job activity feed: structured events (status changes,
|
|
1608
|
+
* dispatch lifecycle, media uploads, quote/contract/invoice
|
|
1609
|
+
* transitions) interleaved with chat messages linked to this
|
|
1610
|
+
* customer's contact. One linear timeline so the customer can
|
|
1611
|
+
* see "what happened, then what was said, then what happened
|
|
1612
|
+
* next" without piecing together separate views.
|
|
1613
|
+
*
|
|
1614
|
+
* Each entry is `{ kind: 'event' | 'chat', id, at, ... }`. The
|
|
1615
|
+
* discriminated union means TypeScript narrows correctly when
|
|
1616
|
+
* you branch on `kind`.
|
|
1617
|
+
*/
|
|
1618
|
+
getJobActivity(jobId: string): Promise<CustomerJobActivityResponse>;
|
|
1619
|
+
}
|
|
1620
|
+
/**
|
|
1621
|
+
* Creates a {@link BiabDevClient} for the given host `baseUrl` and package API key.
|
|
1622
|
+
*
|
|
1623
|
+
* @remarks
|
|
1624
|
+
* **Alpha:** This package is still in alpha release. APIs may change; it is **not** intended
|
|
1625
|
+
* for production use yet. Prefer non-production environments until a stable major is published.
|
|
1626
|
+
*/
|
|
1627
|
+
export declare function createBiabDevClient(options: BiabDevClientOptions): BiabDevClient;
|
|
1628
|
+
/**
|
|
1629
|
+
* Per-tenant auth: hosted sign-in/sign-up scoped to the org bound to
|
|
1630
|
+
* the API key. Used by the SDK's `createAuthHandler` (server) and
|
|
1631
|
+
* `<SignIn />` / `<SignUp />` / `<SignOut />` components (client).
|
|
1632
|
+
*/
|
|
1633
|
+
export declare class BiabDevAuthClient {
|
|
1634
|
+
private readonly client;
|
|
1635
|
+
constructor(client: BiabDevClient);
|
|
1636
|
+
start(input: TenantAuthStartInput): Promise<TenantAuthStartResponse>;
|
|
1637
|
+
/**
|
|
1638
|
+
* Ergonomic shortcut for `start({ intent: "sign-in", ... })`. Returns
|
|
1639
|
+
* the platform-hosted redirect URL the caller should navigate to;
|
|
1640
|
+
* stateless on its own — pair with `exchange()` on your callback
|
|
1641
|
+
* route to mint the session.
|
|
1642
|
+
*/
|
|
1643
|
+
signIn(input: {
|
|
1644
|
+
redirectUri: string;
|
|
1645
|
+
returnTo?: string;
|
|
1646
|
+
loginHint?: string;
|
|
1647
|
+
}): Promise<TenantAuthStartResponse>;
|
|
1648
|
+
/**
|
|
1649
|
+
* Ergonomic shortcut for `start({ intent: "sign-up", ... })`. Same
|
|
1650
|
+
* shape as `signIn`; only the platform-hosted page that opens differs.
|
|
1651
|
+
*/
|
|
1652
|
+
signUp(input: {
|
|
1653
|
+
redirectUri: string;
|
|
1654
|
+
returnTo?: string;
|
|
1655
|
+
loginHint?: string;
|
|
1656
|
+
}): Promise<TenantAuthStartResponse>;
|
|
1657
|
+
/**
|
|
1658
|
+
* Alias for `requestPasswordReset`. Always resolves `{ ok: true }`
|
|
1659
|
+
* (the server doesn't reveal whether the email matched an account).
|
|
1660
|
+
*/
|
|
1661
|
+
forgotPassword(input: TenantAuthPasswordResetInput): Promise<TenantAuthPasswordResetResponse>;
|
|
1662
|
+
exchange(input: TenantAuthExchangeInput): Promise<TenantAuthExchangeResponse>;
|
|
1663
|
+
me(input: {
|
|
1664
|
+
sessionToken: string;
|
|
1665
|
+
}): Promise<TenantAuthMeResponse>;
|
|
1666
|
+
signOut(): Promise<TenantAuthSignOutResponse>;
|
|
1667
|
+
/**
|
|
1668
|
+
* Trigger a password-reset email for `input.email`. Always resolves
|
|
1669
|
+
* with `{ ok: true }` — the server intentionally does not reveal
|
|
1670
|
+
* whether a matching account exists. The email (when sent) contains
|
|
1671
|
+
* a platform-hosted reset URL; the consumer never needs to build a
|
|
1672
|
+
* "set new password" page.
|
|
1673
|
+
*
|
|
1674
|
+
* Server-only by design (the API key may not be exposed to the
|
|
1675
|
+
* browser). The matching browser-side `requestPasswordReset()` in
|
|
1676
|
+
* `@businessdash/sdk/react` proxies through the auth-handler.
|
|
1677
|
+
*/
|
|
1678
|
+
requestPasswordReset(input: TenantAuthPasswordResetInput): Promise<TenantAuthPasswordResetResponse>;
|
|
1679
|
+
}
|
|
1680
|
+
export {};
|
|
1681
|
+
//# sourceMappingURL=client.d.ts.map
|