@businessdash/sdk 0.9.60 → 0.9.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +991 -295
- package/assets/biab-sw.js +92 -0
- package/dist/account-core/index.d.ts +126 -0
- package/dist/account-core/index.d.ts.map +1 -0
- package/dist/account-core/index.js +191 -0
- package/dist/account-core/index.js.map +1 -0
- package/dist/account.d.ts +11 -0
- package/dist/account.d.ts.map +1 -0
- package/dist/account.js +11 -0
- package/dist/account.js.map +1 -0
- package/dist/auth-handler.d.ts +1 -1
- package/dist/auth-links.d.ts +33 -0
- package/dist/auth-links.d.ts.map +1 -0
- package/dist/auth-links.js +64 -0
- package/dist/auth-links.js.map +1 -0
- package/dist/blog-core/index.d.ts +112 -0
- package/dist/blog-core/index.d.ts.map +1 -0
- package/dist/blog-core/index.js +330 -0
- package/dist/blog-core/index.js.map +1 -0
- package/dist/blog.d.ts +11 -0
- package/dist/blog.d.ts.map +1 -0
- package/dist/blog.js +11 -0
- package/dist/blog.js.map +1 -0
- package/dist/chat-core/index.d.ts +97 -0
- package/dist/chat-core/index.d.ts.map +1 -0
- package/dist/chat-core/index.js +237 -0
- package/dist/chat-core/index.js.map +1 -0
- package/dist/chat.d.ts +11 -0
- package/dist/chat.d.ts.map +1 -0
- package/dist/chat.js +11 -0
- package/dist/chat.js.map +1 -0
- package/dist/checkout-core/index.d.ts +65 -0
- package/dist/checkout-core/index.d.ts.map +1 -0
- package/dist/checkout-core/index.js +159 -0
- package/dist/checkout-core/index.js.map +1 -0
- package/dist/checkout.d.ts +10 -0
- package/dist/checkout.d.ts.map +1 -0
- package/dist/checkout.js +10 -0
- package/dist/checkout.js.map +1 -0
- package/dist/cli.js +133 -25
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +622 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +888 -1
- package/dist/client.js.map +1 -1
- package/dist/consent-core/index.cjs +107 -0
- package/dist/consent-core/index.d.ts +103 -0
- package/dist/consent-core/index.d.ts.map +1 -0
- package/dist/consent-core/index.js +157 -0
- package/dist/consent-core/index.js.map +1 -0
- package/dist/contracts.d.ts +3526 -767
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +571 -4
- package/dist/contracts.js.map +1 -1
- package/dist/data-model-schema.d.ts +1 -1
- package/dist/data-model-schema.d.ts.map +1 -1
- package/dist/element.d.ts +30 -0
- package/dist/element.d.ts.map +1 -1
- package/dist/element.js +56 -0
- package/dist/element.js.map +1 -1
- package/dist/embed-protocol.d.ts +86 -0
- package/dist/embed-protocol.d.ts.map +1 -0
- package/dist/embed-protocol.js +60 -0
- package/dist/embed-protocol.js.map +1 -0
- package/dist/framework-support.d.ts +122 -0
- package/dist/framework-support.d.ts.map +1 -0
- package/dist/framework-support.js +323 -0
- package/dist/framework-support.js.map +1 -0
- package/dist/index.cjs +1355 -24
- package/dist/legal-core/index.cjs +115 -0
- package/dist/legal-core/index.d.ts +160 -0
- package/dist/legal-core/index.d.ts.map +1 -0
- package/dist/legal-core/index.js +220 -0
- package/dist/legal-core/index.js.map +1 -0
- package/dist/marketing-core/index.d.ts +66 -0
- package/dist/marketing-core/index.d.ts.map +1 -0
- package/dist/marketing-core/index.js +154 -0
- package/dist/marketing-core/index.js.map +1 -0
- package/dist/marketing.d.ts +7 -0
- package/dist/marketing.d.ts.map +1 -0
- package/dist/marketing.js +7 -0
- package/dist/marketing.js.map +1 -0
- package/dist/mcp-adapters/index.d.ts +135 -0
- package/dist/mcp-adapters/index.d.ts.map +1 -0
- package/dist/mcp-adapters/index.js +187 -0
- package/dist/mcp-adapters/index.js.map +1 -0
- package/dist/mcp-adapters.d.ts +7 -0
- package/dist/mcp-adapters.d.ts.map +1 -0
- package/dist/mcp-adapters.js +7 -0
- package/dist/mcp-adapters.js.map +1 -0
- package/dist/model3d-core/index.cjs +95 -0
- package/dist/model3d-core/index.d.ts +167 -0
- package/dist/model3d-core/index.d.ts.map +1 -0
- package/dist/model3d-core/index.js +158 -0
- package/dist/model3d-core/index.js.map +1 -0
- package/dist/notifications-core/index.cjs +315 -0
- package/dist/notifications-core/index.d.ts +229 -0
- package/dist/notifications-core/index.d.ts.map +1 -0
- package/dist/notifications-core/index.js +445 -0
- package/dist/notifications-core/index.js.map +1 -0
- package/dist/portal-core/index.d.ts +451 -0
- package/dist/portal-core/index.d.ts.map +1 -0
- package/dist/portal-core/index.js +819 -0
- package/dist/portal-core/index.js.map +1 -0
- package/dist/portal.d.ts +7 -0
- package/dist/portal.d.ts.map +1 -0
- package/dist/portal.js +7 -0
- package/dist/portal.js.map +1 -0
- package/dist/push-core/index.cjs +171 -0
- package/dist/push-core/index.d.ts +149 -0
- package/dist/push-core/index.d.ts.map +1 -0
- package/dist/push-core/index.js +231 -0
- package/dist/push-core/index.js.map +1 -0
- package/dist/react-marketing.d.ts +1 -17
- package/dist/react-marketing.d.ts.map +1 -1
- package/dist/react-marketing.js +4 -0
- package/dist/react-marketing.js.map +1 -1
- package/dist/react.d.ts +294 -101
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +302 -246
- package/dist/react.js.map +1 -1
- package/dist/seed-core/index.d.ts +354 -0
- package/dist/seed-core/index.d.ts.map +1 -0
- package/dist/seed-core/index.js +420 -0
- package/dist/seed-core/index.js.map +1 -0
- package/dist/seed.d.ts +7 -0
- package/dist/seed.d.ts.map +1 -0
- package/dist/seed.js +7 -0
- package/dist/seed.js.map +1 -0
- package/dist/seo-core/blog.d.ts +94 -0
- package/dist/seo-core/blog.d.ts.map +1 -0
- package/dist/seo-core/blog.js +149 -0
- package/dist/seo-core/blog.js.map +1 -0
- package/dist/seo-core/commerce.d.ts +64 -0
- package/dist/seo-core/commerce.d.ts.map +1 -0
- package/dist/seo-core/commerce.js +87 -0
- package/dist/seo-core/commerce.js.map +1 -0
- package/dist/seo-core/index.cjs +751 -0
- package/dist/seo-core/index.d.ts +226 -0
- package/dist/seo-core/index.d.ts.map +1 -0
- package/dist/seo-core/index.js +455 -0
- package/dist/seo-core/index.js.map +1 -0
- package/dist/seo-core/local.d.ts +181 -0
- package/dist/seo-core/local.d.ts.map +1 -0
- package/dist/seo-core/local.js +193 -0
- package/dist/seo-core/local.js.map +1 -0
- package/dist/sitemap-core/index.cjs +167 -0
- package/dist/sitemap-core/index.d.ts +155 -0
- package/dist/sitemap-core/index.d.ts.map +1 -0
- package/dist/sitemap-core/index.js +195 -0
- package/dist/sitemap-core/index.js.map +1 -0
- package/dist/social-core/index.d.ts +74 -0
- package/dist/social-core/index.d.ts.map +1 -0
- package/dist/social-core/index.js +72 -0
- package/dist/social-core/index.js.map +1 -0
- package/dist/social.d.ts +7 -0
- package/dist/social.d.ts.map +1 -0
- package/dist/social.js +7 -0
- package/dist/social.js.map +1 -0
- package/dist/solid-compat.d.ts +204 -0
- package/dist/solid-compat.d.ts.map +1 -0
- package/dist/solid-compat.js +221 -0
- package/dist/solid-compat.js.map +1 -0
- package/dist/store-core/index.d.ts +141 -0
- package/dist/store-core/index.d.ts.map +1 -0
- package/dist/store-core/index.js +277 -0
- package/dist/store-core/index.js.map +1 -0
- package/dist/store.d.ts +12 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +12 -0
- package/dist/store.js.map +1 -0
- package/dist/vanilla.d.ts +111 -0
- package/dist/vanilla.d.ts.map +1 -1
- package/dist/vanilla.js +206 -0
- package/dist/vanilla.js.map +1 -1
- package/dist/verify-core/index.d.ts +98 -0
- package/dist/verify-core/index.d.ts.map +1 -0
- package/dist/verify-core/index.js +186 -0
- package/dist/verify-core/index.js.map +1 -0
- package/dist/verify.d.ts +8 -0
- package/dist/verify.d.ts.map +1 -0
- package/dist/verify.js +8 -0
- package/dist/verify.js.map +1 -0
- package/openapi.json +4516 -1311
- package/package.json +128 -11
- package/src/account-core/index.ts +309 -0
- package/src/account.ts +11 -0
- package/src/angular/headless.ts +519 -0
- package/src/angular/index.ts +3 -0
- package/src/auth-links.ts +76 -0
- package/src/blog-core/index.ts +423 -0
- package/src/blog.ts +11 -0
- package/src/chat-core/index.ts +335 -0
- package/src/chat.ts +11 -0
- package/src/checkout-core/index.ts +225 -0
- package/src/checkout.ts +10 -0
- package/src/cli.ts +184 -28
- package/src/client.ts +1097 -0
- package/src/consent-core/index.ts +213 -0
- package/src/contracts.ts +768 -11
- package/src/data-model-schema.ts +1 -1
- package/src/element.ts +102 -0
- package/src/embed-protocol.ts +100 -0
- package/src/framework-support.ts +440 -0
- package/src/legal-core/index.ts +276 -0
- package/src/marketing-core/index.ts +209 -0
- package/src/marketing.ts +7 -0
- package/src/mcp-adapters/index.ts +264 -0
- package/src/mcp-adapters.ts +7 -0
- package/src/model3d-core/index.ts +248 -0
- package/src/notifications-core/index.ts +650 -0
- package/src/portal-core/index.ts +1564 -0
- package/src/portal.ts +7 -0
- package/src/push-core/index.ts +335 -0
- package/src/qwik.tsx +602 -2
- package/src/react-marketing.tsx +5 -0
- package/src/react.tsx +434 -319
- package/src/seed-core/index.ts +735 -0
- package/src/seed.ts +7 -0
- package/src/seo-core/blog.ts +216 -0
- package/src/seo-core/commerce.ts +138 -0
- package/src/seo-core/index.ts +605 -0
- package/src/seo-core/local.ts +333 -0
- package/src/sitemap-core/index.ts +296 -0
- package/src/social-core/index.ts +103 -0
- package/src/social.ts +7 -0
- package/src/solid-compat.tsx +347 -0
- package/src/solid-surfaces.tsx +1311 -0
- package/src/solid.tsx +82 -60
- package/src/store-core/index.ts +426 -0
- package/src/store.ts +12 -0
- package/src/svelte/SocialLinks.svelte +84 -0
- package/src/svelte/headless.ts +435 -0
- package/src/svelte/index.ts +9 -0
- package/src/vanilla.ts +367 -0
- package/src/verify-core/index.ts +288 -0
- package/src/verify.ts +8 -0
- package/src/vue/headless.ts +527 -0
- package/src/vue/index.ts +3 -0
package/dist/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { addressDetailsResponseSchema, addressFormValuesSchema, addressSearchInputSchema, addressSearchResponseSchema, addressVerifyResponseSchema, aiVisibilityInputSchema, aiVisibilityResponseSchema, attributionHeartbeatInputSchema, attributionHeartbeatResponseSchema, attributionPolicySchema, authIntrospectResponseSchema, blogCategoryListResponseSchema, blogCommentListResponseSchema, blogCommentPostInputSchema, blogCommentPostResponseSchema, blogLikeResponseSchema, blogListPostsResponseSchema, blogPostBySlugResponseSchema, blogSessionInputSchema, blogSessionResponseSchema, blogTagListResponseSchema, cartAddItemInputSchema, cartCouponInputSchema, cartSessionResponseSchema, cartSnapshotSchema, cartUpdateItemInputSchema, chatbotAppendMessageInputSchema, chatbotAvailabilitySchema, chatbotChatInputSchema, chatbotChatResponseSchema, chatbotConfigSchema, chatbotConfigUpdateInputSchema, chatbotFormDefinitionSchema, chatbotFormSubmitInputSchema, chatbotFormSubmitResponseSchema, chatbotMessagesResponseSchema, chatbotPersistedSessionInputSchema, chatbotPersistedSessionResponseSchema, chatbotRequestHumanInputSchema, chatbotRequestHumanResponseSchema, chatbotSessionResponseSchema, chatbotUploadUrlResponseSchema, checkoutSessionInputSchema, checkoutSessionResponseSchema, checkoutStartInputSchema, checkoutStartResponseSchema, checkoutStatusResponseSchema, confirmVerificationInputSchema, confirmVerificationResponseSchema, couponValidateInputSchema, couponValidateResponseSchema, createCollectionInputSchema, createCollectionResponseSchema, createEmailTemplateInputSchema, createEmailTemplateResponseSchema, createEmailTemplateVersionInputSchema, createEmailTemplateVersionResponseSchema, customerContactCompanyInputSchema, customerContactCompanyResponseSchema, customerContractDetailSchema, customerContractSignResponseSchema, customerDownloadsResponseSchema, customerInvoiceDetailSchema, customerInvoicePayInputSchema, customerInvoicePayResponseSchema, customerInvoicePdfSchema, customerJobActivityResponseSchema, customerJobCommentPostInputSchema, customerJobCommentSchema, customerJobCommentsListResponseSchema, customerJobDetailSchema, customerJobEtaResponseSchema, customerNotificationPreferencesResponseSchema, customerNotificationPreferencesUpdateInputSchema, customerNotificationPreferencesUpdateResponseSchema, customerOrderDetailSchema, customerOrderListResponseSchema, customerPaymentHistoryResponseSchema, customerPortalContextResponseSchema, customerPortalOtherOrgsResponseSchema, customerPortalProfileSchema, customerPortalUpdateProfileInputSchema, customerPortalUpdateProfileResponseSchema, customerQuoteActionResponseSchema, customerQuoteDetailSchema, customerReferralHistoryResponseSchema, customerReferralPayoutsResponseSchema, customerReferralStatsSchema, customerReturnRequestCreatedSchema, customerReturnRequestInputSchema, customerReviewListResponseSchema, customerReviewSubmitInputSchema, customerReviewSubmitResponseSchema, customerShipmentTrackingSchema, customerWorkBundleSchema, dashboardSessionResponseSchema, executeActionInputSchema, executeActionResponseSchema, followerEditInputSchema, followerEditResponseSchema, followerJoinInputSchema, followerJoinResponseSchema, followerLeaveInputSchema, followerLeaveResponseSchema, followerMeInputSchema, followerMeResponseSchema, getCollectionResponseSchema, getEmailTemplateResponseSchema, getMarketingLocalesResponseSchema, getMarketingPageBundleResponseSchema, getPublishedMarketingSchemaResponseSchema, getSiteMarketingPageResponseSchema, jobCategoryListResponseSchema, jobPostingListResponseSchema, jobPostingSchema, listCollectionsResponseSchema, listDataModelRecordsInputSchema, listDataModelRecordsResponseSchema, listEmailTemplatesInputSchema, listEmailTemplatesResponseSchema, listRowsInputSchema, listRowsResponseSchema, listSiteMarketingPagesResponseSchema, notificationPreferencesResponseSchema, notificationPreferencesUpdateInputSchema, pageViewsInputSchema, pageViewsResponseSchema, publishMarketingSectionsInputSchema, publishMarketingSectionsResponseSchema, queryRowsInputSchema, queryRowsResponseSchema, reviewWallListResponseSchema, shippingRatesInputSchema, shippingRatesResponseSchema, shippingSettingsResponseSchema, shippingTrackResponseSchema, siteAssetInputSchema, siteBrandingSchema, startVerificationInputSchema, startVerificationResponseSchema, storefrontAddonsResponseSchema, storefrontCategoriesResponseSchema, storefrontListProductsResponseSchema, storefrontProductDetailSchema, storefrontProductReviewsResponseSchema, storefrontProductsWithMetaResponseSchema, storefrontRelatedProductsResponseSchema, storefrontSessionInputSchema, storefrontSessionResponseSchema, subscriptionCheckoutInputSchema, subscriptionCheckoutResponseSchema, subscriptionOfferingSchema, subscriptionOfferingsListResponseSchema, tenantAuthExchangeInputSchema, tenantAuthExchangeResponseSchema, tenantAuthMeResponseSchema, tenantAuthPasswordResetInputSchema, tenantAuthPasswordResetResponseSchema, tenantAuthSignOutResponseSchema, tenantAuthStartInputSchema, tenantAuthStartResponseSchema, uploadSiteAssetResponseSchema, upsertDraftMarketingSchemaInputSchema, upsertDraftMarketingSchemaResponseSchema, upsertRowInputSchema, upsertRowResponseSchema, } from "./contracts.js";
|
|
2
|
+
import { addressDetailsResponseSchema, addressFormValuesSchema, addressSearchInputSchema, addressSearchResponseSchema, addressVerifyResponseSchema, aiVisibilityInputSchema, aiVisibilityResponseSchema, attributionHeartbeatInputSchema, attributionHeartbeatResponseSchema, attributionPolicySchema, authIntrospectResponseSchema, blogCategoryListResponseSchema, blogCommentListResponseSchema, blogCommentPostInputSchema, blogCommentPostResponseSchema, blogLikeResponseSchema, blogListPostsResponseSchema, blogPostBySlugResponseSchema, blogSessionInputSchema, blogSessionResponseSchema, blogTagListResponseSchema, cartAddItemInputSchema, cartCouponInputSchema, cartSessionResponseSchema, cartSnapshotSchema, cartUpdateItemInputSchema, chatbotAppendMessageInputSchema, chatbotAvailabilitySchema, chatbotChatInputSchema, chatbotChatResponseSchema, chatbotConfigSchema, chatbotConfigUpdateInputSchema, chatbotFormDefinitionSchema, chatbotFormSubmitInputSchema, chatbotFormSubmitResponseSchema, chatbotMessagesResponseSchema, chatbotPersistedSessionInputSchema, chatbotPersistedSessionResponseSchema, chatbotRequestHumanInputSchema, chatbotRequestHumanResponseSchema, chatbotSessionResponseSchema, chatbotUploadUrlResponseSchema, checkoutSessionInputSchema, checkoutSessionResponseSchema, checkoutStartInputSchema, checkoutStartResponseSchema, checkoutStatusResponseSchema, confirmVerificationInputSchema, confirmVerificationResponseSchema, couponCreateInputSchema, couponCreateResponseSchema, couponListResponseSchema, couponValidateInputSchema, couponValidateResponseSchema, createCollectionInputSchema, createCollectionResponseSchema, createEmailTemplateInputSchema, createEmailTemplateResponseSchema, createEmailTemplateVersionInputSchema, createEmailTemplateVersionResponseSchema, customerContactCompanyInputSchema, customerContactCompanyResponseSchema, customerContractDetailSchema, customerContractListResponseSchema, customerContractSignResponseSchema, customerDownloadsResponseSchema, customerInviteResendResponseSchema, customerInvoiceDetailSchema, customerInvoiceListResponseSchema, customerInvoicePayInputSchema, customerInvoicePayResponseSchema, customerInvoicePdfSchema, customerJobActivityResponseSchema, customerJobCommentPostInputSchema, customerJobCommentSchema, customerJobCommentsListResponseSchema, customerJobDetailSchema, customerJobEtaResponseSchema, customerNotificationPreferencesResponseSchema, customerNotificationPreferencesUpdateInputSchema, customerNotificationPreferencesUpdateResponseSchema, customerNotReceivedResultSchema, customerOrderDetailSchema, customerOrderListResponseSchema, customerPaymentHistoryResponseSchema, customerPortalContextResponseSchema, customerPortalMessageListResponseSchema, customerPortalMessageSchema, customerPortalMessagesMarkReadResponseSchema, customerPortalOtherOrgsResponseSchema, customerPortalProfileSchema, customerPortalQuizResultsResponseSchema, customerPortalUpdateProfileInputSchema, customerPortalUpdateProfileResponseSchema, customerProductReviewCreatedSchema, customerProductReviewListSchema, customerPushConfigSchema, customerQuoteActionResponseSchema, customerQuoteDetailSchema, customerQuoteListResponseSchema, customerReferralHistoryResponseSchema, customerReferralPayoutsResponseSchema, customerReferralStatsSchema, customerReturnRequestCreatedSchema, customerReturnRequestInputSchema, customerReturnRequestListResponseSchema, customerReviewListResponseSchema, customerReviewSubmitInputSchema, customerReviewSubmitResponseSchema, customerShipmentListResponseSchema, customerShipmentTrackingSchema, customerSubscriberContentResponseSchema, customerSubscriptionCancelResponseSchema, customerSubscriptionResponseSchema, customerWorkBundleSchema, dashboardSessionResponseSchema, executeActionInputSchema, executeActionResponseSchema, followerEditInputSchema, followerEditResponseSchema, followerJoinInputSchema, followerJoinResponseSchema, followerLeaveInputSchema, followerLeaveResponseSchema, followerMeInputSchema, followerMeResponseSchema, getCollectionResponseSchema, getEmailTemplateResponseSchema, getMarketingLocalesResponseSchema, getMarketingPageBundleResponseSchema, getPublishedMarketingSchemaResponseSchema, getSiteMarketingPageResponseSchema, jobCategoryListResponseSchema, jobPostingListResponseSchema, jobPostingSchema, legalDocumentSchema, legalListResponseSchema, listCollectionsResponseSchema, listDataModelRecordsInputSchema, listDataModelRecordsResponseSchema, listEmailTemplatesInputSchema, listEmailTemplatesResponseSchema, listRowsInputSchema, listRowsResponseSchema, listSiteMarketingPagesResponseSchema, notificationPreferencesResponseSchema, notificationPreferencesUpdateInputSchema, pageViewsInputSchema, pageViewsResponseSchema, publishMarketingSectionsInputSchema, publishMarketingSectionsResponseSchema, queryRowsInputSchema, queryRowsResponseSchema, reviewWallListResponseSchema, schedulingBookingResultSchema, schedulingBookingViewSchema, schedulingCancelResultSchema, schedulingEventTypeDetailSchema, schedulingEventTypeListSchema, schedulingRescheduleResultSchema, schedulingSlotsResponseSchema, shippingRatesInputSchema, shippingRatesResponseSchema, shippingSettingsResponseSchema, shippingTrackResponseSchema, siteAssetInputSchema, siteBrandingSchema, startVerificationInputSchema, startVerificationResponseSchema, storefrontAddonsResponseSchema, storefrontCategoriesResponseSchema, storefrontListProductsResponseSchema, storefrontProductDetailSchema, storefrontProductReviewsResponseSchema, storefrontProductsWithMetaResponseSchema, storefrontRelatedProductsResponseSchema, storefrontSessionInputSchema, storefrontSessionResponseSchema, storefrontSyncToStripeResponseSchema, subscriptionCheckoutInputSchema, subscriptionCheckoutResponseSchema, subscriptionOfferingSchema, subscriptionOfferingsListResponseSchema, tenantAuthExchangeInputSchema, tenantAuthExchangeResponseSchema, tenantAuthMeResponseSchema, tenantAuthPasswordResetInputSchema, tenantAuthPasswordResetResponseSchema, tenantAuthSignOutResponseSchema, tenantAuthStartInputSchema, tenantAuthStartResponseSchema, uploadSiteAssetResponseSchema, upsertDraftMarketingSchemaInputSchema, upsertDraftMarketingSchemaResponseSchema, upsertRowInputSchema, upsertRowResponseSchema, } from "./contracts.js";
|
|
3
3
|
import { accessRejectionFromBody, BiabApiError, isBiabPlanGateBody, } from "./errors.js";
|
|
4
4
|
function buildUrl(baseUrl, path, query) {
|
|
5
5
|
/**
|
|
@@ -122,6 +122,10 @@ export class BiabDevClient {
|
|
|
122
122
|
get shipping() {
|
|
123
123
|
return new BiabDevShippingClient(this);
|
|
124
124
|
}
|
|
125
|
+
/** Customer-portal invitations — currently resend. */
|
|
126
|
+
get customerInvites() {
|
|
127
|
+
return new BiabDevCustomerInvitesClient(this);
|
|
128
|
+
}
|
|
125
129
|
get notifications() {
|
|
126
130
|
return new BiabDevNotificationsClient(this);
|
|
127
131
|
}
|
|
@@ -134,10 +138,29 @@ export class BiabDevClient {
|
|
|
134
138
|
get reviews() {
|
|
135
139
|
return new BiabDevReviewsClient(this);
|
|
136
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Tracking consent for this org's site.
|
|
143
|
+
*
|
|
144
|
+
* Pair with `@businessdash/sdk/consent`, which handles the visitor cookie
|
|
145
|
+
* and gives you a gate to check before starting analytics.
|
|
146
|
+
*/
|
|
147
|
+
get consent() {
|
|
148
|
+
return new BiabDevConsentClient(this);
|
|
149
|
+
}
|
|
137
150
|
/** Public job postings — build a careers page on your own domain. */
|
|
138
151
|
get hiring() {
|
|
139
152
|
return new BiabDevHiringClient(this);
|
|
140
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* The org's published legal pages — privacy, terms, refund policy, whatever
|
|
156
|
+
* they authored in the dashboard.
|
|
157
|
+
*
|
|
158
|
+
* Pair with `@businessdash/sdk/legal` to render them without writing a page
|
|
159
|
+
* per document.
|
|
160
|
+
*/
|
|
161
|
+
get legal() {
|
|
162
|
+
return new BiabDevLegalClient(this);
|
|
163
|
+
}
|
|
141
164
|
get chatbot() {
|
|
142
165
|
return new BiabDevChatbotClient(this);
|
|
143
166
|
}
|
|
@@ -240,10 +263,19 @@ export class BiabDevSiteClient {
|
|
|
240
263
|
*/
|
|
241
264
|
marketing;
|
|
242
265
|
parallelPages;
|
|
266
|
+
/**
|
|
267
|
+
* Booking and conference calls.
|
|
268
|
+
*
|
|
269
|
+
* Previously reachable only through `sdk.ts`'s separate scheduling
|
|
270
|
+
* resource, which is why the OpenAPI generator — which reads this file —
|
|
271
|
+
* never saw it, and why no non-JS starter had scheduling at all.
|
|
272
|
+
*/
|
|
273
|
+
scheduling;
|
|
243
274
|
constructor(client, siteId) {
|
|
244
275
|
this.client = client;
|
|
245
276
|
this.siteId = siteId;
|
|
246
277
|
this.collections = new BiabDevCollectionsClient(client, siteId);
|
|
278
|
+
this.scheduling = new BiabDevSchedulingClient(client, siteId);
|
|
247
279
|
this.rows = new BiabDevRowsClient(client, siteId);
|
|
248
280
|
this.dataModel = new BiabDevDataModelClient(client, siteId);
|
|
249
281
|
this.analytics = new BiabDevAnalyticsClient(client, siteId);
|
|
@@ -266,6 +298,25 @@ export class BiabDevSiteClient {
|
|
|
266
298
|
* <img src={b.logoUrl ?? b.orgIcon ?? ""} alt={b.orgName ?? ""} />
|
|
267
299
|
* ```
|
|
268
300
|
*/
|
|
301
|
+
/**
|
|
302
|
+
* Every URL the PLATFORM owns the shape of, as JSON.
|
|
303
|
+
*
|
|
304
|
+
* Published site-builder pages, published legal documents, and every
|
|
305
|
+
* materialised programmatic-page URL. Blog posts and products are not here
|
|
306
|
+
* — the platform does not know where your site renders them. Merge those in
|
|
307
|
+
* with `@businessdash/sdk/sitemap`, which handles the whole job.
|
|
308
|
+
*
|
|
309
|
+
* Paths are relative, so you join them against your own origin rather than
|
|
310
|
+
* the org's primary verified domain.
|
|
311
|
+
*/
|
|
312
|
+
async sitemapEntries() {
|
|
313
|
+
return this.client.request({
|
|
314
|
+
path: `sites/${encodeURIComponent(this.siteId)}/sitemap-entries`,
|
|
315
|
+
responseSchema: z.object({
|
|
316
|
+
entries: z.array(z.object({ loc: z.string(), lastmod: z.string().optional() })),
|
|
317
|
+
}),
|
|
318
|
+
});
|
|
319
|
+
}
|
|
269
320
|
async branding() {
|
|
270
321
|
return this.client.request({
|
|
271
322
|
path: `sites/${encodeURIComponent(this.siteId)}/branding`,
|
|
@@ -1054,6 +1105,42 @@ export class BiabDevStorefrontClient {
|
|
|
1054
1105
|
responseSchema: storefrontSessionResponseSchema,
|
|
1055
1106
|
});
|
|
1056
1107
|
}
|
|
1108
|
+
/**
|
|
1109
|
+
* Push your catalog into YOUR OWN Stripe account.
|
|
1110
|
+
*
|
|
1111
|
+
* Products and their variant combinations become Stripe Products and
|
|
1112
|
+
* Prices on the Stripe account connected to your workspace, so you can
|
|
1113
|
+
* manage the catalog here and let Stripe be the system of record for
|
|
1114
|
+
* money. Safe to re-run: an unchanged product is left alone, and a new
|
|
1115
|
+
* Price is minted only when the amount actually changed (Stripe Prices
|
|
1116
|
+
* are immutable on amount).
|
|
1117
|
+
*
|
|
1118
|
+
* Requires a SECRET key holding `storefront:write` — never a publishable
|
|
1119
|
+
* token, because this spends against Stripe on your behalf.
|
|
1120
|
+
*
|
|
1121
|
+
* Pass `productId` to sync one product. Omit it to sync everything not yet
|
|
1122
|
+
* pushed, in bounded batches: check `remaining` and call again until it
|
|
1123
|
+
* reaches 0.
|
|
1124
|
+
*
|
|
1125
|
+
* ```ts
|
|
1126
|
+
* let remaining = 1;
|
|
1127
|
+
* while (remaining > 0) {
|
|
1128
|
+
* const res = await biab.storefront.syncToStripe();
|
|
1129
|
+
* remaining = res.remaining;
|
|
1130
|
+
* }
|
|
1131
|
+
* ```
|
|
1132
|
+
*
|
|
1133
|
+
* Per-product failures are returned in `failed` rather than throwing, so
|
|
1134
|
+
* one bad product doesn't abandon the batch.
|
|
1135
|
+
*/
|
|
1136
|
+
async syncToStripe(input) {
|
|
1137
|
+
return this.client.request({
|
|
1138
|
+
method: "POST",
|
|
1139
|
+
path: "storefront/products/sync-to-stripe",
|
|
1140
|
+
body: input?.productId ? { productId: input.productId } : {},
|
|
1141
|
+
responseSchema: storefrontSyncToStripeResponseSchema,
|
|
1142
|
+
});
|
|
1143
|
+
}
|
|
1057
1144
|
/**
|
|
1058
1145
|
* Paginated list of live products for the calling org's storefront.
|
|
1059
1146
|
* Cursor is an opaque integer offset — pass back the response's
|
|
@@ -1117,6 +1204,38 @@ export class BiabDevStorefrontClient {
|
|
|
1117
1204
|
* via `BiabApiError` if the product isn't live or doesn't belong
|
|
1118
1205
|
* to the org bound to the API key.
|
|
1119
1206
|
*/
|
|
1207
|
+
/**
|
|
1208
|
+
* The CAD file for a product — STEP, IGES, or a native part file.
|
|
1209
|
+
*
|
|
1210
|
+
* ## Call this from YOUR server, then proxy it
|
|
1211
|
+
*
|
|
1212
|
+
* The API key is a server secret, so a browser cannot reach this directly.
|
|
1213
|
+
* Expose your own route (`/api/products/:id/cad`), call this behind it, and
|
|
1214
|
+
* redirect the visitor to the URL it returns.
|
|
1215
|
+
*
|
|
1216
|
+
* The platform withholds the raw URL from every product payload on purpose:
|
|
1217
|
+
* CAD files are the largest thing it serves and are the org's intellectual
|
|
1218
|
+
* property, so a catalog of naked URLs is a design library published to
|
|
1219
|
+
* anyone willing to write a loop. This endpoint requires a `biab_cad` cookie
|
|
1220
|
+
* on the incoming request, rate-limits per IP, and re-checks the
|
|
1221
|
+
* `ecommerce.product_3d` entitlement before answering.
|
|
1222
|
+
*
|
|
1223
|
+
* `cacheSeconds` is what to put on your own response — CAD at a content URL
|
|
1224
|
+
* does not change, so caching hard is where the bandwidth saving comes from.
|
|
1225
|
+
*
|
|
1226
|
+
* Rejects 404 when the product is a draft, has no CAD file, or the org lacks
|
|
1227
|
+
* the add-on. Those are deliberately one answer.
|
|
1228
|
+
*/
|
|
1229
|
+
async getCadDownload(productId) {
|
|
1230
|
+
return this.client.request({
|
|
1231
|
+
path: `storefront/products/${encodeURIComponent(productId)}/cad`,
|
|
1232
|
+
responseSchema: z.object({
|
|
1233
|
+
url: z.string(),
|
|
1234
|
+
fileName: z.string().nullable(),
|
|
1235
|
+
cacheSeconds: z.number(),
|
|
1236
|
+
}),
|
|
1237
|
+
});
|
|
1238
|
+
}
|
|
1120
1239
|
async getProduct(productId) {
|
|
1121
1240
|
return this.client.request({
|
|
1122
1241
|
path: `storefront/products/${encodeURIComponent(productId)}`,
|
|
@@ -1509,6 +1628,47 @@ export class BiabDevCouponsClient {
|
|
|
1509
1628
|
* else toast.error(result.message);
|
|
1510
1629
|
* ```
|
|
1511
1630
|
*/
|
|
1631
|
+
/**
|
|
1632
|
+
* Create a coupon and make it live in YOUR OWN Stripe account in one call —
|
|
1633
|
+
* a Stripe Coupon plus a Promotion Code, so the same string works on your
|
|
1634
|
+
* storefront and on Stripe-hosted Checkout.
|
|
1635
|
+
*
|
|
1636
|
+
* Creation and the Stripe sync are one operation deliberately: a coupon
|
|
1637
|
+
* that exists locally but not in Stripe is the failure worth designing out,
|
|
1638
|
+
* where a customer types a code your storefront accepts and Stripe rejects.
|
|
1639
|
+
* If the sync fails the coupon is still created and `stripeSynced` comes
|
|
1640
|
+
* back `false` with the reason, rather than pretending it is live.
|
|
1641
|
+
*
|
|
1642
|
+
* Requires a SECRET key holding `storefront:write`.
|
|
1643
|
+
*
|
|
1644
|
+
* ```ts
|
|
1645
|
+
* const { coupon, stripeSynced } = await biab.coupons.create({
|
|
1646
|
+
* code: 'WELCOME10',
|
|
1647
|
+
* discountType: 'percent',
|
|
1648
|
+
* value: 10,
|
|
1649
|
+
* })
|
|
1650
|
+
* ```
|
|
1651
|
+
*
|
|
1652
|
+
* Buy-X-get-Y and bundle-gift coupons aren't available here — Stripe has no
|
|
1653
|
+
* native BXGY, so those run through our own cart math and need the offer
|
|
1654
|
+
* rows the dashboard collects.
|
|
1655
|
+
*/
|
|
1656
|
+
async create(input) {
|
|
1657
|
+
const body = couponCreateInputSchema.parse(input);
|
|
1658
|
+
return this.client.request({
|
|
1659
|
+
method: "POST",
|
|
1660
|
+
path: "coupons",
|
|
1661
|
+
body,
|
|
1662
|
+
responseSchema: couponCreateResponseSchema,
|
|
1663
|
+
});
|
|
1664
|
+
}
|
|
1665
|
+
/** Every coupon on the workspace, newest first. Requires `storefront:write`. */
|
|
1666
|
+
async list() {
|
|
1667
|
+
return this.client.request({
|
|
1668
|
+
path: "coupons",
|
|
1669
|
+
responseSchema: couponListResponseSchema,
|
|
1670
|
+
});
|
|
1671
|
+
}
|
|
1512
1672
|
async validate(code) {
|
|
1513
1673
|
const body = couponValidateInputSchema.parse({ code });
|
|
1514
1674
|
return this.client.request({
|
|
@@ -1944,6 +2104,105 @@ export class BiabDevHiringClient {
|
|
|
1944
2104
|
});
|
|
1945
2105
|
}
|
|
1946
2106
|
}
|
|
2107
|
+
/**
|
|
2108
|
+
* The org's published legal pages.
|
|
2109
|
+
*
|
|
2110
|
+
* Everything here is content the org deliberately put on the public internet;
|
|
2111
|
+
* drafts are filtered server-side and unreachable. Requires `legal:read`, which
|
|
2112
|
+
* is publishable — a browser token is the expected caller.
|
|
2113
|
+
*
|
|
2114
|
+
* @example
|
|
2115
|
+
* ```ts
|
|
2116
|
+
* const { items, presentation } = await client.legal.list();
|
|
2117
|
+
* const privacy = await client.legal.get("privacy");
|
|
2118
|
+
* ```
|
|
2119
|
+
*/
|
|
2120
|
+
export class BiabDevLegalClient {
|
|
2121
|
+
client;
|
|
2122
|
+
constructor(client) {
|
|
2123
|
+
this.client = client;
|
|
2124
|
+
}
|
|
2125
|
+
/**
|
|
2126
|
+
* Every published document, plus the header/footer presentation.
|
|
2127
|
+
*
|
|
2128
|
+
* Both in one response because the common use — a footer link list — needs
|
|
2129
|
+
* the titles and the presentation together, and a second round trip for the
|
|
2130
|
+
* latter is one a site either makes on every page or skips entirely.
|
|
2131
|
+
*/
|
|
2132
|
+
async list() {
|
|
2133
|
+
return this.client.request({
|
|
2134
|
+
path: "legal",
|
|
2135
|
+
responseSchema: legalListResponseSchema,
|
|
2136
|
+
});
|
|
2137
|
+
}
|
|
2138
|
+
/**
|
|
2139
|
+
* One document by slug, body included.
|
|
2140
|
+
*
|
|
2141
|
+
* Rejects with a 404 when the slug is unpublished or absent — the two are
|
|
2142
|
+
* deliberately indistinguishable, since "exists but hidden" would leak that
|
|
2143
|
+
* an org is drafting a policy and is not something a caller can act on.
|
|
2144
|
+
*/
|
|
2145
|
+
async get(slug) {
|
|
2146
|
+
return this.client.request({
|
|
2147
|
+
path: `legal/${encodeURIComponent(slug)}`,
|
|
2148
|
+
responseSchema: legalDocumentSchema,
|
|
2149
|
+
});
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
const consentStateSchema = z.object({
|
|
2153
|
+
/** Categories this org uses at all — one banner row each. */
|
|
2154
|
+
categories: z.array(z.string()),
|
|
2155
|
+
noticeText: z.string().nullable(),
|
|
2156
|
+
noticeVersion: z.number(),
|
|
2157
|
+
/** What may be used right now. */
|
|
2158
|
+
allowed: z.array(z.string()),
|
|
2159
|
+
mustAsk: z.boolean(),
|
|
2160
|
+
reason: z.string(),
|
|
2161
|
+
});
|
|
2162
|
+
/**
|
|
2163
|
+
* Tracking consent, scoped to the calling org.
|
|
2164
|
+
*
|
|
2165
|
+
* Every call is answered for the org whose key made it. There is no shape here
|
|
2166
|
+
* that could read or write another org's consent — consent is given to a
|
|
2167
|
+
* controller, and one controller's record is not another's to act on.
|
|
2168
|
+
*
|
|
2169
|
+
* The visitor is identified by an `x-biab-visitor` header carrying an opaque id
|
|
2170
|
+
* from the caller's own first-party cookie. `@businessdash/sdk/consent` manages
|
|
2171
|
+
* that for you; these methods are the transport underneath it.
|
|
2172
|
+
*/
|
|
2173
|
+
export class BiabDevConsentClient {
|
|
2174
|
+
client;
|
|
2175
|
+
constructor(client) {
|
|
2176
|
+
this.client = client;
|
|
2177
|
+
}
|
|
2178
|
+
/** The notice to show, and what this visitor currently allows. */
|
|
2179
|
+
async get(visitorKey) {
|
|
2180
|
+
return this.client.request({
|
|
2181
|
+
path: "consent",
|
|
2182
|
+
responseSchema: consentStateSchema,
|
|
2183
|
+
...(visitorKey ? { headers: { "x-biab-visitor": visitorKey } } : {}),
|
|
2184
|
+
});
|
|
2185
|
+
}
|
|
2186
|
+
/**
|
|
2187
|
+
* Record the visitor's answer.
|
|
2188
|
+
*
|
|
2189
|
+
* `granted: []` is a real answer — "asked, refused everything" — and is
|
|
2190
|
+
* stored as one, so the banner does not reappear on the next page.
|
|
2191
|
+
*/
|
|
2192
|
+
async record(input) {
|
|
2193
|
+
return this.client.request({
|
|
2194
|
+
method: "POST",
|
|
2195
|
+
path: "consent",
|
|
2196
|
+
body: {
|
|
2197
|
+
granted: input.granted,
|
|
2198
|
+
noticeVersion: input.noticeVersion,
|
|
2199
|
+
source: input.source ?? "banner",
|
|
2200
|
+
},
|
|
2201
|
+
headers: { "x-biab-visitor": input.visitorKey },
|
|
2202
|
+
responseSchema: z.object({ ok: z.boolean() }),
|
|
2203
|
+
});
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
1947
2206
|
export class BiabDevChatbotClient {
|
|
1948
2207
|
client;
|
|
1949
2208
|
constructor(client) {
|
|
@@ -2267,6 +2526,24 @@ export class BiabDevCustomerPortalClient {
|
|
|
2267
2526
|
headers: this.headers(),
|
|
2268
2527
|
});
|
|
2269
2528
|
}
|
|
2529
|
+
/**
|
|
2530
|
+
* The signed-in customer's quiz results at this org — the SDK side of
|
|
2531
|
+
* the account-gated reveal: an invitation completed with "create an
|
|
2532
|
+
* account to see how you did" surfaces its result here (and only to
|
|
2533
|
+
* the invited email). Interview-mode quizzes come back with
|
|
2534
|
+
* `scoreWithheld: true` and no verdict, by the org's own setting.
|
|
2535
|
+
*/
|
|
2536
|
+
async myQuizResults(options) {
|
|
2537
|
+
const params = new URLSearchParams();
|
|
2538
|
+
if (options?.token)
|
|
2539
|
+
params.set("token", options.token);
|
|
2540
|
+
const qs = params.toString();
|
|
2541
|
+
return this.client.request({
|
|
2542
|
+
path: `customer-portal/quiz-results${qs ? `?${qs}` : ""}`,
|
|
2543
|
+
responseSchema: customerPortalQuizResultsResponseSchema,
|
|
2544
|
+
headers: this.headers(),
|
|
2545
|
+
});
|
|
2546
|
+
}
|
|
2270
2547
|
async updateProfile(input) {
|
|
2271
2548
|
const body = customerPortalUpdateProfileInputSchema.parse(input);
|
|
2272
2549
|
return this.client.request({
|
|
@@ -2541,6 +2818,135 @@ export class BiabDevCustomerPortalClient {
|
|
|
2541
2818
|
headers: this.headers(),
|
|
2542
2819
|
});
|
|
2543
2820
|
}
|
|
2821
|
+
/**
|
|
2822
|
+
* The return requests on one order, newest first.
|
|
2823
|
+
*
|
|
2824
|
+
* `resolutionNote` carries staff's answer — when a return is denied that IS
|
|
2825
|
+
* the answer, and hiding it just moves the question to email.
|
|
2826
|
+
*/
|
|
2827
|
+
async listReturnRequests(orderId) {
|
|
2828
|
+
return this.client.request({
|
|
2829
|
+
path: `customer-portal/orders/${encodeURIComponent(orderId)}/return-request`,
|
|
2830
|
+
responseSchema: customerReturnRequestListResponseSchema,
|
|
2831
|
+
headers: this.headers(),
|
|
2832
|
+
});
|
|
2833
|
+
}
|
|
2834
|
+
/**
|
|
2835
|
+
* The customer's message thread with the org's staff, newest first.
|
|
2836
|
+
*
|
|
2837
|
+
* Automated rows — the review-ask and similar — are excluded server-side, so
|
|
2838
|
+
* this is only what a person wrote.
|
|
2839
|
+
*/
|
|
2840
|
+
async listMessages(opts) {
|
|
2841
|
+
const params = new URLSearchParams();
|
|
2842
|
+
if (typeof opts?.limit === "number")
|
|
2843
|
+
params.set("limit", String(opts.limit));
|
|
2844
|
+
if (opts?.jobId)
|
|
2845
|
+
params.set("jobId", opts.jobId);
|
|
2846
|
+
const qs = params.toString();
|
|
2847
|
+
return this.client.request({
|
|
2848
|
+
path: `customer-portal/messages${qs ? `?${qs}` : ""}`,
|
|
2849
|
+
responseSchema: customerPortalMessageListResponseSchema,
|
|
2850
|
+
headers: this.headers(),
|
|
2851
|
+
});
|
|
2852
|
+
}
|
|
2853
|
+
/** Send a message to the org's staff. Lands in the CRM timeline. */
|
|
2854
|
+
async postMessage(input) {
|
|
2855
|
+
return this.client.request({
|
|
2856
|
+
path: "customer-portal/messages",
|
|
2857
|
+
method: "POST",
|
|
2858
|
+
body: input,
|
|
2859
|
+
responseSchema: customerPortalMessageSchema,
|
|
2860
|
+
headers: this.headers(),
|
|
2861
|
+
});
|
|
2862
|
+
}
|
|
2863
|
+
/**
|
|
2864
|
+
* Mark the staff messages read up to now.
|
|
2865
|
+
*
|
|
2866
|
+
* One-way: it never clears a stamp. A portal that could un-read a message
|
|
2867
|
+
* would let a customer hide from staff that they had seen something.
|
|
2868
|
+
*/
|
|
2869
|
+
async markMessagesRead() {
|
|
2870
|
+
return this.client.request({
|
|
2871
|
+
path: "customer-portal/messages",
|
|
2872
|
+
method: "PATCH",
|
|
2873
|
+
responseSchema: customerPortalMessagesMarkReadResponseSchema,
|
|
2874
|
+
headers: this.headers(),
|
|
2875
|
+
});
|
|
2876
|
+
}
|
|
2877
|
+
/**
|
|
2878
|
+
* The customer's invoices, newest first.
|
|
2879
|
+
*
|
|
2880
|
+
* `unpaid: true` filters on the computed BALANCE rather than on the status
|
|
2881
|
+
* string, because a partially-paid invoice still owes money whatever it is
|
|
2882
|
+
* called. This is the call behind "show me everything I owe" — which had no
|
|
2883
|
+
* endpoint at all before 0.9.61.
|
|
2884
|
+
*/
|
|
2885
|
+
async listInvoices(opts) {
|
|
2886
|
+
const params = new URLSearchParams();
|
|
2887
|
+
if (typeof opts?.limit === "number")
|
|
2888
|
+
params.set("limit", String(opts.limit));
|
|
2889
|
+
if (opts?.status)
|
|
2890
|
+
params.set("status", opts.status);
|
|
2891
|
+
if (opts?.unpaid)
|
|
2892
|
+
params.set("unpaid", "1");
|
|
2893
|
+
const qs = params.toString();
|
|
2894
|
+
return this.client.request({
|
|
2895
|
+
path: `customer-portal/invoices${qs ? `?${qs}` : ""}`,
|
|
2896
|
+
responseSchema: customerInvoiceListResponseSchema,
|
|
2897
|
+
headers: this.headers(),
|
|
2898
|
+
});
|
|
2899
|
+
}
|
|
2900
|
+
/** The customer's quotes. `status: "sent"` is the set still awaiting them. */
|
|
2901
|
+
async listQuotes(opts) {
|
|
2902
|
+
const params = new URLSearchParams();
|
|
2903
|
+
if (typeof opts?.limit === "number")
|
|
2904
|
+
params.set("limit", String(opts.limit));
|
|
2905
|
+
if (opts?.status)
|
|
2906
|
+
params.set("status", opts.status);
|
|
2907
|
+
const qs = params.toString();
|
|
2908
|
+
return this.client.request({
|
|
2909
|
+
path: `customer-portal/quotes${qs ? `?${qs}` : ""}`,
|
|
2910
|
+
responseSchema: customerQuoteListResponseSchema,
|
|
2911
|
+
headers: this.headers(),
|
|
2912
|
+
});
|
|
2913
|
+
}
|
|
2914
|
+
/** The customer's contracts. `status: "sent"` still awaits a signature. */
|
|
2915
|
+
async listContracts(opts) {
|
|
2916
|
+
const params = new URLSearchParams();
|
|
2917
|
+
if (typeof opts?.limit === "number")
|
|
2918
|
+
params.set("limit", String(opts.limit));
|
|
2919
|
+
if (opts?.status)
|
|
2920
|
+
params.set("status", opts.status);
|
|
2921
|
+
const qs = params.toString();
|
|
2922
|
+
return this.client.request({
|
|
2923
|
+
path: `customer-portal/contracts${qs ? `?${qs}` : ""}`,
|
|
2924
|
+
responseSchema: customerContractListResponseSchema,
|
|
2925
|
+
headers: this.headers(),
|
|
2926
|
+
});
|
|
2927
|
+
}
|
|
2928
|
+
/**
|
|
2929
|
+
* Every shipment across the customer's orders. `active: true` narrows to
|
|
2930
|
+
* parcels still moving.
|
|
2931
|
+
*
|
|
2932
|
+
* STORED status only — no live carrier poll. `trackShipment(id)` spends a
|
|
2933
|
+
* Shippo request because it is one parcel the customer opened; doing that
|
|
2934
|
+
* per row here would mean a carrier call for every parcel in their history
|
|
2935
|
+
* on every page load.
|
|
2936
|
+
*/
|
|
2937
|
+
async listShipments(opts) {
|
|
2938
|
+
const params = new URLSearchParams();
|
|
2939
|
+
if (typeof opts?.limit === "number")
|
|
2940
|
+
params.set("limit", String(opts.limit));
|
|
2941
|
+
if (opts?.active)
|
|
2942
|
+
params.set("active", "1");
|
|
2943
|
+
const qs = params.toString();
|
|
2944
|
+
return this.client.request({
|
|
2945
|
+
path: `customer-portal/shipments${qs ? `?${qs}` : ""}`,
|
|
2946
|
+
responseSchema: customerShipmentListResponseSchema,
|
|
2947
|
+
headers: this.headers(),
|
|
2948
|
+
});
|
|
2949
|
+
}
|
|
2544
2950
|
/**
|
|
2545
2951
|
* The signed-in customer's orders (newest first), each with a shipment
|
|
2546
2952
|
* roll-up (`overallStatus`, `anyInTransit`, `latestEstimatedDelivery`) for
|
|
@@ -2623,6 +3029,243 @@ export class BiabDevCustomerPortalClient {
|
|
|
2623
3029
|
headers: this.headers(),
|
|
2624
3030
|
});
|
|
2625
3031
|
}
|
|
3032
|
+
/**
|
|
3033
|
+
* Ask for a replacement instead of a refund.
|
|
3034
|
+
*
|
|
3035
|
+
* Sugar over `submitReturnRequest` with `kind: "exchange"`, because an
|
|
3036
|
+
* exchange reads as its own action to the person writing the UI, and burying
|
|
3037
|
+
* it in an options bag is how it stays undiscovered. `variantId` is the one
|
|
3038
|
+
* they want instead — omit it when that still needs a conversation.
|
|
3039
|
+
*
|
|
3040
|
+
* @example
|
|
3041
|
+
* ```ts
|
|
3042
|
+
* await portal.submitExchangeRequest(orderId, {
|
|
3043
|
+
* exchangeForVariantId: largeVariantId,
|
|
3044
|
+
* reason: "wrong size",
|
|
3045
|
+
* });
|
|
3046
|
+
* ```
|
|
3047
|
+
*/
|
|
3048
|
+
async submitExchangeRequest(orderId, input) {
|
|
3049
|
+
return this.submitReturnRequest(orderId, {
|
|
3050
|
+
...(input ?? {}),
|
|
3051
|
+
kind: "exchange",
|
|
3052
|
+
});
|
|
3053
|
+
}
|
|
3054
|
+
/**
|
|
3055
|
+
* Report that a parcel never arrived.
|
|
3056
|
+
*
|
|
3057
|
+
* This does NOT change the shipment's carrier status, and deliberately so:
|
|
3058
|
+
* when the carrier says delivered and the customer says otherwise, both
|
|
3059
|
+
* facts matter — the carrier's scan is what the org files a claim against.
|
|
3060
|
+
* The result carries `carrierStatus` alongside the report so a UI can show
|
|
3061
|
+
* both: *"Carrier says delivered Aug 14 · You reported not received Aug 16."*
|
|
3062
|
+
*
|
|
3063
|
+
* `contested: true` means exactly that disagreement. Re-reporting an open
|
|
3064
|
+
* claim returns it with `alreadyOpen: true` rather than erroring — a
|
|
3065
|
+
* customer tapping twice is anxious, not hostile.
|
|
3066
|
+
*
|
|
3067
|
+
* @example
|
|
3068
|
+
* ```ts
|
|
3069
|
+
* const r = await portal.reportNotReceived(shipmentId, {
|
|
3070
|
+
* note: "Nothing on the porch, checked with neighbours.",
|
|
3071
|
+
* });
|
|
3072
|
+
* if (r.contested) showCarrierDisputeHelp();
|
|
3073
|
+
* ```
|
|
3074
|
+
*/
|
|
3075
|
+
async reportNotReceived(shipmentId, input) {
|
|
3076
|
+
const body = input?.note ? { note: input.note } : {};
|
|
3077
|
+
return this.client.request({
|
|
3078
|
+
method: "POST",
|
|
3079
|
+
path: `customer-portal/shipments/${encodeURIComponent(shipmentId)}/not-received`,
|
|
3080
|
+
body,
|
|
3081
|
+
responseSchema: customerNotReceivedResultSchema,
|
|
3082
|
+
headers: this.headers(),
|
|
3083
|
+
});
|
|
3084
|
+
}
|
|
3085
|
+
/**
|
|
3086
|
+
* The product reviews this customer has written for this org.
|
|
3087
|
+
*
|
|
3088
|
+
* Distinct from `listReviews()`, which is reviews of the ORG. Both exist
|
|
3089
|
+
* because "are these people good to deal with" and "is this thing any good"
|
|
3090
|
+
* are different questions, stored in different tables, and shown in
|
|
3091
|
+
* different places.
|
|
3092
|
+
*
|
|
3093
|
+
* `isApproved: false` means QUEUED, not rejected — render it as "awaiting
|
|
3094
|
+
* review" or the customer will assume it was lost and write it again.
|
|
3095
|
+
*/
|
|
3096
|
+
/**
|
|
3097
|
+
* The customer's subscription with this org, and what the org offers.
|
|
3098
|
+
*
|
|
3099
|
+
* One subscription per org — `user_subscriptions` is unique on
|
|
3100
|
+
* (user, org) — so there is no id to pass. The org's live offerings come
|
|
3101
|
+
* back alongside, because a portal that reports "not subscribed" and
|
|
3102
|
+
* nothing else is a dead end.
|
|
3103
|
+
*
|
|
3104
|
+
* **Render entitlement from `subscription.hasAccess`, not from `status`.**
|
|
3105
|
+
* A lifetime purchase has no period to expire and a cancelled subscription
|
|
3106
|
+
* keeps access until the period already paid for ends; `hasAccess` is
|
|
3107
|
+
* computed by the same function the content gates use, so the portal and
|
|
3108
|
+
* the gate cannot disagree.
|
|
3109
|
+
*/
|
|
3110
|
+
async getSubscription() {
|
|
3111
|
+
return this.client.request({
|
|
3112
|
+
path: "customer-portal/subscription",
|
|
3113
|
+
responseSchema: customerSubscriptionResponseSchema,
|
|
3114
|
+
headers: this.headers(),
|
|
3115
|
+
});
|
|
3116
|
+
}
|
|
3117
|
+
/**
|
|
3118
|
+
* Cancel the subscription at the end of the paid period.
|
|
3119
|
+
*
|
|
3120
|
+
* Cancelling ends the RENEWAL, not the access: the customer has paid for
|
|
3121
|
+
* the period they are in and keeps everything until `accessUntil`. Ending
|
|
3122
|
+
* access on the click would take back something they already bought, which
|
|
3123
|
+
* is the most common way a subscription flow feels like a trap.
|
|
3124
|
+
*
|
|
3125
|
+
* Read `accessUntil` back to them — "active until 14 March" is the true
|
|
3126
|
+
* statement, not "cancelled".
|
|
3127
|
+
*/
|
|
3128
|
+
async cancelSubscription() {
|
|
3129
|
+
return this.client.request({
|
|
3130
|
+
method: "POST",
|
|
3131
|
+
path: "customer-portal/subscription/cancel",
|
|
3132
|
+
body: { resume: false },
|
|
3133
|
+
responseSchema: customerSubscriptionCancelResponseSchema,
|
|
3134
|
+
headers: this.headers(),
|
|
3135
|
+
});
|
|
3136
|
+
}
|
|
3137
|
+
/**
|
|
3138
|
+
* Clear a pending cancellation.
|
|
3139
|
+
*
|
|
3140
|
+
* Between cancelling and the period ending nothing has actually been lost,
|
|
3141
|
+
* so changing your mind should cost one call rather than a re-purchase.
|
|
3142
|
+
* After the period ends there is nothing to resume and they subscribe again
|
|
3143
|
+
* like anyone else.
|
|
3144
|
+
*/
|
|
3145
|
+
async resumeSubscription() {
|
|
3146
|
+
return this.client.request({
|
|
3147
|
+
method: "POST",
|
|
3148
|
+
path: "customer-portal/subscription/cancel",
|
|
3149
|
+
body: { resume: true },
|
|
3150
|
+
responseSchema: customerSubscriptionCancelResponseSchema,
|
|
3151
|
+
headers: this.headers(),
|
|
3152
|
+
});
|
|
3153
|
+
}
|
|
3154
|
+
/**
|
|
3155
|
+
* The content this subscription entitles them to — the answer to "what am
|
|
3156
|
+
* I actually getting for this?", which is the question asked right before
|
|
3157
|
+
* someone cancels.
|
|
3158
|
+
*
|
|
3159
|
+
* When `entitled` is false these are LOCKED previews, not an empty
|
|
3160
|
+
* entitlement: titles, excerpts and images, no bodies. Show them beside the
|
|
3161
|
+
* offer. Rendering an empty list would hide the pitch at exactly the moment
|
|
3162
|
+
* it is most relevant.
|
|
3163
|
+
*/
|
|
3164
|
+
async getSubscriberContent(opts) {
|
|
3165
|
+
const params = new URLSearchParams();
|
|
3166
|
+
if (typeof opts?.limit === "number")
|
|
3167
|
+
params.set("limit", String(opts.limit));
|
|
3168
|
+
const qs = params.toString();
|
|
3169
|
+
return this.client.request({
|
|
3170
|
+
path: `customer-portal/subscription/content${qs ? `?${qs}` : ""}`,
|
|
3171
|
+
responseSchema: customerSubscriberContentResponseSchema,
|
|
3172
|
+
headers: this.headers(),
|
|
3173
|
+
});
|
|
3174
|
+
}
|
|
3175
|
+
/**
|
|
3176
|
+
* Push config and the browsers this customer has registered.
|
|
3177
|
+
*
|
|
3178
|
+
* Returns `vapidPublicKey` too, because a page cannot subscribe without it.
|
|
3179
|
+
*/
|
|
3180
|
+
async getPushConfig() {
|
|
3181
|
+
return this.client.request({
|
|
3182
|
+
path: "customer-portal/push",
|
|
3183
|
+
responseSchema: customerPushConfigSchema,
|
|
3184
|
+
headers: this.headers(),
|
|
3185
|
+
});
|
|
3186
|
+
}
|
|
3187
|
+
/**
|
|
3188
|
+
* Register this browser.
|
|
3189
|
+
*
|
|
3190
|
+
* Pair with `subscribeToPush()` from `@businessdash/sdk/push-core`, which
|
|
3191
|
+
* handles the service worker, the permission prompt and the key encoding
|
|
3192
|
+
* and hands back exactly this payload.
|
|
3193
|
+
*
|
|
3194
|
+
* Upserted on the endpoint, so re-subscribing from the same browser
|
|
3195
|
+
* refreshes the row rather than creating a second one.
|
|
3196
|
+
*/
|
|
3197
|
+
async subscribePush(input) {
|
|
3198
|
+
return this.client.request({
|
|
3199
|
+
method: "POST",
|
|
3200
|
+
path: "customer-portal/push",
|
|
3201
|
+
body: input,
|
|
3202
|
+
responseSchema: z.object({ id: z.string(), created: z.boolean() }),
|
|
3203
|
+
headers: this.headers(),
|
|
3204
|
+
});
|
|
3205
|
+
}
|
|
3206
|
+
/**
|
|
3207
|
+
* Rename a device, or narrow what it receives.
|
|
3208
|
+
*
|
|
3209
|
+
* `categories: []` means "nothing for now" and keeps the subscription
|
|
3210
|
+
* warm — browsers make re-granting a revoked permission deliberately
|
|
3211
|
+
* awkward, so an "off" that discards the subscription is hard to undo.
|
|
3212
|
+
*/
|
|
3213
|
+
async updatePushDevice(input) {
|
|
3214
|
+
return this.client.request({
|
|
3215
|
+
method: "PATCH",
|
|
3216
|
+
path: "customer-portal/push",
|
|
3217
|
+
body: input,
|
|
3218
|
+
responseSchema: z.object({ ok: z.boolean() }),
|
|
3219
|
+
headers: this.headers(),
|
|
3220
|
+
});
|
|
3221
|
+
}
|
|
3222
|
+
/**
|
|
3223
|
+
* Forget a device. Takes an id or the endpoint.
|
|
3224
|
+
*
|
|
3225
|
+
* A browser tearing its own subscription down knows its endpoint, not our
|
|
3226
|
+
* row id — so pass what `unsubscribeFromPush()` returns.
|
|
3227
|
+
*/
|
|
3228
|
+
async unsubscribePush(input) {
|
|
3229
|
+
return this.client.request({
|
|
3230
|
+
method: "DELETE",
|
|
3231
|
+
path: "customer-portal/push",
|
|
3232
|
+
body: input,
|
|
3233
|
+
responseSchema: z.object({
|
|
3234
|
+
ok: z.boolean(),
|
|
3235
|
+
deletedId: z.string().nullable(),
|
|
3236
|
+
}),
|
|
3237
|
+
headers: this.headers(),
|
|
3238
|
+
});
|
|
3239
|
+
}
|
|
3240
|
+
async listProductReviews() {
|
|
3241
|
+
return this.client.request({
|
|
3242
|
+
path: "customer-portal/product-reviews",
|
|
3243
|
+
responseSchema: customerProductReviewListSchema,
|
|
3244
|
+
headers: this.headers(),
|
|
3245
|
+
});
|
|
3246
|
+
}
|
|
3247
|
+
/**
|
|
3248
|
+
* Review a product this customer BOUGHT.
|
|
3249
|
+
*
|
|
3250
|
+
* The portal requires a matching order — it is standing inside the
|
|
3251
|
+
* customer's purchase history, which is the one thing the public storefront
|
|
3252
|
+
* does not know. That makes these verified-buyer reviews, and it stops a
|
|
3253
|
+
* competitor one-starring a catalogue they never bought.
|
|
3254
|
+
*
|
|
3255
|
+
* Rejects with `not_purchased` (403) when no order matches, and
|
|
3256
|
+
* `already_reviewed` (409) on a second review of the same product.
|
|
3257
|
+
* Moderation follows the ORG's policy, so the result may be
|
|
3258
|
+
* `awaitingModeration`.
|
|
3259
|
+
*/
|
|
3260
|
+
async submitProductReview(input) {
|
|
3261
|
+
return this.client.request({
|
|
3262
|
+
method: "POST",
|
|
3263
|
+
path: "customer-portal/product-reviews",
|
|
3264
|
+
body: input,
|
|
3265
|
+
responseSchema: customerProductReviewCreatedSchema,
|
|
3266
|
+
headers: this.headers(),
|
|
3267
|
+
});
|
|
3268
|
+
}
|
|
2626
3269
|
/**
|
|
2627
3270
|
* List the digital downloads the customer is entitled to for a paid order
|
|
2628
3271
|
* (P10d). Each item is a ready-to-use URL — a short-lived presigned link for
|
|
@@ -2718,6 +3361,22 @@ export class BiabDevCustomerPortalClient {
|
|
|
2718
3361
|
* dispatch travel-time recompute layer ships, at which point the
|
|
2719
3362
|
* `eta` field switches sources without breaking this shape.
|
|
2720
3363
|
*/
|
|
3364
|
+
/**
|
|
3365
|
+
* Where the job and its technicians are in the dispatch lifecycle.
|
|
3366
|
+
*
|
|
3367
|
+
* Named for ETA historically; it is the DISPATCH STATUS surface, which is
|
|
3368
|
+
* why `getDispatchStatus` below is the same call under the name people
|
|
3369
|
+
* look for.
|
|
3370
|
+
*
|
|
3371
|
+
* Read `dispatchStatus` (job-level) for "is anyone on the way" and
|
|
3372
|
+
* `assignments[].dispatchStatus` for per-technician detail. They differ on
|
|
3373
|
+
* purpose: the job is `completed` only once the LAST assignee finishes.
|
|
3374
|
+
*
|
|
3375
|
+
* Nothing about the dispatch CASCADE is exposed — who was offered the job,
|
|
3376
|
+
* who declined, how many people were asked before someone accepted. That
|
|
3377
|
+
* is staff-internal, and a customer learning they were the fourth choice
|
|
3378
|
+
* helps nobody.
|
|
3379
|
+
*/
|
|
2721
3380
|
async getJobEta(jobId) {
|
|
2722
3381
|
return this.client.request({
|
|
2723
3382
|
path: `customer-portal/jobs/${encodeURIComponent(jobId)}/eta`,
|
|
@@ -2725,6 +3384,16 @@ export class BiabDevCustomerPortalClient {
|
|
|
2725
3384
|
headers: this.headers(),
|
|
2726
3385
|
});
|
|
2727
3386
|
}
|
|
3387
|
+
/**
|
|
3388
|
+
* Dispatch status for a job — the same call as `getJobEta`, under the name
|
|
3389
|
+
* developers actually search for.
|
|
3390
|
+
*
|
|
3391
|
+
* An alias rather than a second route: two endpoints returning the same
|
|
3392
|
+
* thing is how they drift.
|
|
3393
|
+
*/
|
|
3394
|
+
async getDispatchStatus(jobId) {
|
|
3395
|
+
return this.getJobEta(jobId);
|
|
3396
|
+
}
|
|
2728
3397
|
/**
|
|
2729
3398
|
* Unified job activity feed: structured events (status changes,
|
|
2730
3399
|
* dispatch lifecycle, media uploads, quote/contract/invoice
|
|
@@ -2842,4 +3511,222 @@ export class BiabDevAuthClient {
|
|
|
2842
3511
|
});
|
|
2843
3512
|
}
|
|
2844
3513
|
}
|
|
3514
|
+
/**
|
|
3515
|
+
* Booking, rescheduling, cancelling — and the conference call attached to it.
|
|
3516
|
+
*
|
|
3517
|
+
* ## Both sides of every flow
|
|
3518
|
+
*
|
|
3519
|
+
* An invitee acts with a signed TOKEN from their confirmation email; staff act
|
|
3520
|
+
* with the API key. Both reach the same service, so the same notifications fire
|
|
3521
|
+
* to the invitee AND every host either way, and the booking records which of
|
|
3522
|
+
* them made the change.
|
|
3523
|
+
*
|
|
3524
|
+
* ## Three tokens, not one
|
|
3525
|
+
*
|
|
3526
|
+
* A confirmed booking yields `manageToken`, `rescheduleToken` and `cancelToken`
|
|
3527
|
+
* separately. A cancel link in an email must not also be able to reschedule,
|
|
3528
|
+
* and neither should be able to read the whole booking. One token for all three
|
|
3529
|
+
* would make every emailed link as powerful as the strongest thing it enables.
|
|
3530
|
+
*
|
|
3531
|
+
* ## The conference link is re-minted on reschedule
|
|
3532
|
+
*
|
|
3533
|
+
* Moving a booking can issue a new meeting URL. Read `conferenceLink` back from
|
|
3534
|
+
* the reschedule result rather than reusing the one from confirmation —
|
|
3535
|
+
* otherwise the calendar invite you send points at a dead room.
|
|
3536
|
+
*/
|
|
3537
|
+
/**
|
|
3538
|
+
* Customer-portal invitations.
|
|
3539
|
+
*
|
|
3540
|
+
* For an org running its own admin tooling rather than the dashboard.
|
|
3541
|
+
*/
|
|
3542
|
+
export class BiabDevCustomerInvitesClient {
|
|
3543
|
+
client;
|
|
3544
|
+
constructor(client) {
|
|
3545
|
+
this.client = client;
|
|
3546
|
+
}
|
|
3547
|
+
/**
|
|
3548
|
+
* Hand an invite link out again.
|
|
3549
|
+
*
|
|
3550
|
+
* **Rotates the token** — the previous link stops working. That is the
|
|
3551
|
+
* point rather than a side effect: if the reason for resending was "it went
|
|
3552
|
+
* to the wrong address", rotating IS the fix, and reusing the token would
|
|
3553
|
+
* leave the wrong recipient holding a working invitation. The cost is that
|
|
3554
|
+
* someone who finds the original email later gets a dead link, which is a
|
|
3555
|
+
* support message rather than an account.
|
|
3556
|
+
*
|
|
3557
|
+
* Rate limited to one send a minute per invitation, answering **429** with
|
|
3558
|
+
* a retry hint. Resend mails an address the caller chose, so an unbounded
|
|
3559
|
+
* one is a mail-bombing tool. Staff clicking the button in the dashboard
|
|
3560
|
+
* skip the wait; an API key does not, because an API key is the automated
|
|
3561
|
+
* caller the limit exists for.
|
|
3562
|
+
*
|
|
3563
|
+
* Refuses a **revoked** invitation (resending would quietly un-revoke it)
|
|
3564
|
+
* and a **fully-redeemed** one (it did its job; a new invitation should be
|
|
3565
|
+
* created as one, so the list keeps showing what happened).
|
|
3566
|
+
*/
|
|
3567
|
+
async resend(inviteId, opts) {
|
|
3568
|
+
return this.client.request({
|
|
3569
|
+
method: "POST",
|
|
3570
|
+
path: `customer-invites/${encodeURIComponent(inviteId)}/resend`,
|
|
3571
|
+
body: opts?.expiresInDays === undefined
|
|
3572
|
+
? {}
|
|
3573
|
+
: { expiresInDays: opts.expiresInDays },
|
|
3574
|
+
responseSchema: customerInviteResendResponseSchema,
|
|
3575
|
+
});
|
|
3576
|
+
}
|
|
3577
|
+
}
|
|
3578
|
+
export class BiabDevSchedulingClient {
|
|
3579
|
+
client;
|
|
3580
|
+
siteId;
|
|
3581
|
+
constructor(client, siteId) {
|
|
3582
|
+
this.client = client;
|
|
3583
|
+
this.siteId = siteId;
|
|
3584
|
+
}
|
|
3585
|
+
path(suffix) {
|
|
3586
|
+
return `sites/${encodeURIComponent(this.siteId)}/scheduling/${suffix}`;
|
|
3587
|
+
}
|
|
3588
|
+
/** What the org offers to book. */
|
|
3589
|
+
async listEventTypes() {
|
|
3590
|
+
return this.client.request({
|
|
3591
|
+
path: this.path("event-types"),
|
|
3592
|
+
responseSchema: schedulingEventTypeListSchema,
|
|
3593
|
+
});
|
|
3594
|
+
}
|
|
3595
|
+
/** One event type, plus the questions asked when booking it. */
|
|
3596
|
+
async getEventType(slug) {
|
|
3597
|
+
return this.client.request({
|
|
3598
|
+
path: this.path(`event-types/${encodeURIComponent(slug)}`),
|
|
3599
|
+
responseSchema: schedulingEventTypeDetailSchema,
|
|
3600
|
+
});
|
|
3601
|
+
}
|
|
3602
|
+
/**
|
|
3603
|
+
* Free slots in a window.
|
|
3604
|
+
*
|
|
3605
|
+
* Ask for the window you are about to render, not the whole month: slot
|
|
3606
|
+
* computation walks every host's calendar and busy times, so a wide range
|
|
3607
|
+
* is a slow one.
|
|
3608
|
+
*/
|
|
3609
|
+
async getAvailableSlots(slug, params) {
|
|
3610
|
+
const query = new URLSearchParams({
|
|
3611
|
+
from: typeof params.from === "string"
|
|
3612
|
+
? params.from
|
|
3613
|
+
: params.from.toISOString(),
|
|
3614
|
+
to: typeof params.to === "string" ? params.to : params.to.toISOString(),
|
|
3615
|
+
});
|
|
3616
|
+
return this.client.request({
|
|
3617
|
+
path: this.path(`event-types/${encodeURIComponent(slug)}/slots?${query.toString()}`),
|
|
3618
|
+
responseSchema: schedulingSlotsResponseSchema,
|
|
3619
|
+
});
|
|
3620
|
+
}
|
|
3621
|
+
/**
|
|
3622
|
+
* Book a slot.
|
|
3623
|
+
*
|
|
3624
|
+
* Returns `pending` rather than `confirmed` when the event type requires
|
|
3625
|
+
* approval — say "requested" in the UI for that case, because telling
|
|
3626
|
+
* someone their meeting is booked when staff still have to accept it is the
|
|
3627
|
+
* kind of thing they plan a day around.
|
|
3628
|
+
*/
|
|
3629
|
+
async confirmBooking(input) {
|
|
3630
|
+
const body = {
|
|
3631
|
+
...input,
|
|
3632
|
+
startAt: typeof input.startAt === "string"
|
|
3633
|
+
? input.startAt
|
|
3634
|
+
: input.startAt.toISOString(),
|
|
3635
|
+
};
|
|
3636
|
+
return this.client.request({
|
|
3637
|
+
method: "POST",
|
|
3638
|
+
path: this.path("bookings"),
|
|
3639
|
+
body,
|
|
3640
|
+
responseSchema: schedulingBookingResultSchema,
|
|
3641
|
+
});
|
|
3642
|
+
}
|
|
3643
|
+
/**
|
|
3644
|
+
* Read a booking with one of its signed tokens.
|
|
3645
|
+
*
|
|
3646
|
+
* `type` must match the token you hold — a cancel token will not open the
|
|
3647
|
+
* manage view. That is the point of issuing three.
|
|
3648
|
+
*/
|
|
3649
|
+
async getBooking(token, type = "manage") {
|
|
3650
|
+
return this.client.request({
|
|
3651
|
+
path: this.path(`bookings/by-token/${encodeURIComponent(token)}?type=${encodeURIComponent(type)}`),
|
|
3652
|
+
responseSchema: schedulingBookingViewSchema,
|
|
3653
|
+
});
|
|
3654
|
+
}
|
|
3655
|
+
/**
|
|
3656
|
+
* Move a booking — the INVITEE side, with their reschedule token.
|
|
3657
|
+
*
|
|
3658
|
+
* Notifies the invitee and every host, and cancels the reminder jobs queued
|
|
3659
|
+
* against the old time so nobody gets "your meeting starts in 15 minutes"
|
|
3660
|
+
* for a slot that moved.
|
|
3661
|
+
*/
|
|
3662
|
+
async rescheduleBooking(input) {
|
|
3663
|
+
return this.client.request({
|
|
3664
|
+
method: "POST",
|
|
3665
|
+
path: this.path(`bookings/by-token/${encodeURIComponent(input.token)}`),
|
|
3666
|
+
body: {
|
|
3667
|
+
action: "reschedule",
|
|
3668
|
+
newStartAt: typeof input.newStartAt === "string"
|
|
3669
|
+
? input.newStartAt
|
|
3670
|
+
: input.newStartAt.toISOString(),
|
|
3671
|
+
...(input.reason ? { reason: input.reason } : {}),
|
|
3672
|
+
},
|
|
3673
|
+
responseSchema: schedulingRescheduleResultSchema,
|
|
3674
|
+
});
|
|
3675
|
+
}
|
|
3676
|
+
/**
|
|
3677
|
+
* Move a booking as STAFF, with the API key rather than an invitee token.
|
|
3678
|
+
*
|
|
3679
|
+
* Same service as the token path, so the invitee AND every host are
|
|
3680
|
+
* notified either way, and the reminder jobs for the old time are
|
|
3681
|
+
* cancelled either way. `actorUserId` records WHO moved it, which is what
|
|
3682
|
+
* lets a customer's history say "they rescheduled" rather than leaving an
|
|
3683
|
+
* unexplained change.
|
|
3684
|
+
*/
|
|
3685
|
+
async rescheduleBookingAsStaff(input) {
|
|
3686
|
+
return this.client.request({
|
|
3687
|
+
method: "POST",
|
|
3688
|
+
path: this.path(`bookings/${encodeURIComponent(input.bookingId)}/manage`),
|
|
3689
|
+
body: {
|
|
3690
|
+
action: "reschedule",
|
|
3691
|
+
newStartAt: typeof input.newStartAt === "string"
|
|
3692
|
+
? input.newStartAt
|
|
3693
|
+
: input.newStartAt.toISOString(),
|
|
3694
|
+
...(input.reason ? { reason: input.reason } : {}),
|
|
3695
|
+
...(input.actorUserId ? { actorUserId: input.actorUserId } : {}),
|
|
3696
|
+
},
|
|
3697
|
+
responseSchema: schedulingRescheduleResultSchema,
|
|
3698
|
+
});
|
|
3699
|
+
}
|
|
3700
|
+
/** Cancel a booking as STAFF. Notifies the invitee and every host. */
|
|
3701
|
+
async cancelBookingAsStaff(input) {
|
|
3702
|
+
return this.client.request({
|
|
3703
|
+
method: "POST",
|
|
3704
|
+
path: this.path(`bookings/${encodeURIComponent(input.bookingId)}/manage`),
|
|
3705
|
+
body: {
|
|
3706
|
+
action: "cancel",
|
|
3707
|
+
...(input.reason ? { reason: input.reason } : {}),
|
|
3708
|
+
...(input.actorUserId ? { actorUserId: input.actorUserId } : {}),
|
|
3709
|
+
},
|
|
3710
|
+
responseSchema: schedulingCancelResultSchema,
|
|
3711
|
+
});
|
|
3712
|
+
}
|
|
3713
|
+
/**
|
|
3714
|
+
* Cancel a booking — the INVITEE side, with their cancel token.
|
|
3715
|
+
*
|
|
3716
|
+
* `reason` is passed to the hosts. Worth collecting: "something came up" and
|
|
3717
|
+
* "I booked the wrong service" lead to different follow-ups, and the second
|
|
3718
|
+
* is recoverable revenue.
|
|
3719
|
+
*/
|
|
3720
|
+
async cancelBooking(input) {
|
|
3721
|
+
return this.client.request({
|
|
3722
|
+
method: "POST",
|
|
3723
|
+
path: this.path(`bookings/by-token/${encodeURIComponent(input.token)}`),
|
|
3724
|
+
body: {
|
|
3725
|
+
action: "cancel",
|
|
3726
|
+
...(input.reason ? { reason: input.reason } : {}),
|
|
3727
|
+
},
|
|
3728
|
+
responseSchema: schedulingCancelResultSchema,
|
|
3729
|
+
});
|
|
3730
|
+
}
|
|
3731
|
+
}
|
|
2845
3732
|
//# sourceMappingURL=client.js.map
|