@buildbase/sdk 0.0.60 → 0.0.62
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/CHANGELOG.md +32 -0
- package/README.md +95 -0
- package/dist/css/styles.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +84 -0
- package/dist/index.mjs +1 -1
- package/dist/mcp/index.cjs +1 -1
- package/dist/mcp/index.d.ts +23 -0
- package/dist/mcp/index.mjs +1 -1
- package/dist/react/chunks/SettingsDialog-CKwldz7y.mjs +2 -0
- package/dist/react/chunks/{SettingsDialog-DzcwBYsg.cjs → SettingsDialog-D4FCwpN7.cjs} +1 -1
- package/dist/react/chunks/SubscriptionDialog-DJmrU0r1.cjs +2 -0
- package/dist/react/chunks/SubscriptionDialog-DoWnS_JD.mjs +2 -0
- package/dist/react/chunks/react-Be1VMiVO.mjs +2 -0
- package/dist/react/chunks/react-ClieHJPH.cjs +2 -0
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.d.ts +186 -26
- package/dist/react/index.mjs +1 -1
- package/dist/tracking/index.cjs +2 -0
- package/dist/tracking/index.d.ts +657 -0
- package/dist/tracking/index.mjs +2 -0
- package/package.json +12 -2
- package/dist/react/chunks/SettingsDialog-4yk6t4tT.mjs +0 -2
- package/dist/react/chunks/SubscriptionDialog-COw79gAi.cjs +0 -2
- package/dist/react/chunks/SubscriptionDialog-DLM_WA84.mjs +0 -2
- package/dist/react/chunks/react-D6q1fjoE.cjs +0 -2
- package/dist/react/chunks/react-DX2YGh4O.mjs +0 -2
- /package/dist/react/chunks/{ar-DHxjPtfZ.mjs → ar-CHTRXlXt.mjs} +0 -0
- /package/dist/react/chunks/{ar-D7uaSur2.cjs → ar-DPJVNHJV.cjs} +0 -0
- /package/dist/react/chunks/{de-D_xfGk1N.mjs → de-CdPeKWZ2.mjs} +0 -0
- /package/dist/react/chunks/{de-CBzx6NJq.cjs → de-DPd09yf-.cjs} +0 -0
- /package/dist/react/chunks/{es-D4-Dv2t5.mjs → es-BWGnjJKJ.mjs} +0 -0
- /package/dist/react/chunks/{es-WVRwuj-e.cjs → es-WdOYGt6G.cjs} +0 -0
- /package/dist/react/chunks/{fr-DurP7qkZ.mjs → fr-Big5DFPB.mjs} +0 -0
- /package/dist/react/chunks/{fr-CEpK52jT.cjs → fr-LIbCvYeh.cjs} +0 -0
- /package/dist/react/chunks/{hi-CVqVRSoy.cjs → hi-BoCY3pFe.cjs} +0 -0
- /package/dist/react/chunks/{hi-7roM83DB.mjs → hi-jArNRknR.mjs} +0 -0
- /package/dist/react/chunks/{ja-DT8x4SW1.mjs → ja-Cwdz0hCu.mjs} +0 -0
- /package/dist/react/chunks/{ja-BrDXec_v.cjs → ja-E0jqCiVq.cjs} +0 -0
- /package/dist/react/chunks/{zh-CH1Z55Je.mjs → zh-glRKcdia.mjs} +0 -0
- /package/dist/react/chunks/{zh-CdCzcD53.cjs → zh-tU-AqFYI.cjs} +0 -0
package/dist/react/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";var e=require("./chunks/react-
|
|
2
|
+
"use strict";var e=require("./chunks/react-ClieHJPH.cjs");require("react/jsx-runtime"),require("react"),require("clsx"),require("tailwind-merge"),require("intl-messageformat"),require("@hookform/resolvers/zod"),require("react-hook-form"),require("@radix-ui/react-slot"),require("class-variance-authority"),require("lucide-react"),require("@radix-ui/react-label"),require("zod"),require("@radix-ui/react-avatar"),require("@radix-ui/react-dialog"),require("@radix-ui/react-icons"),require("@radix-ui/react-radio-group"),require("@radix-ui/react-scroll-area"),require("@radix-ui/react-separator"),require("@radix-ui/react-accordion"),require("@radix-ui/react-alert-dialog"),Object.defineProperty(exports,"ApiVersion",{enumerable:!0,get:function(){return e.ApiVersion}}),exports.AuthApi=e.AuthApi,Object.defineProperty(exports,"AuthStatus",{enumerable:!0,get:function(){return e.AuthStatus}}),exports.BBAction=e.BBAction,exports.BBScreen=e.BBScreen,exports.BBStatus=e.BBStatus,exports.BB_PARAM=e.BB_PARAM,exports.BaseApi=e.BaseApi,exports.BetaForm=e.BetaForm,exports.BillingIntervals=e.BillingIntervals,exports.BuildBaseBadge=e.BuildBaseBadge,exports.BuildBaseProvider=e.SaaSOSProvider,exports.CURRENCY_DISPLAY=e.CURRENCY_DISPLAY,exports.CURRENCY_FLAG=e.CURRENCY_FLAG,exports.ConnectMcpGuide=e.ConnectMcpGuide,exports.ConnectedAgents=e.ConnectedAgents,exports.ConnectedAgentsApi=e.ConnectedAgentsApi,exports.CreditActionsProvider=e.CreditActionsProvider,exports.CreditBalance=e.CreditBalance,exports.CreditBalanceContextProvider=e.CreditBalanceContextProvider,exports.CreditBucketSource=e.CreditBucketSource,exports.CreditBucketStatus=e.CreditBucketStatus,exports.CreditStorePage=e.CreditStorePage,exports.CreditTransactionType=e.CreditTransactionType,exports.DEFAULT_ROLE_PERMISSIONS=e.DEFAULT_ROLE_PERMISSIONS,exports.Devices=e.Devices,exports.DevicesApi=e.DevicesApi,exports.DunningState=e.DunningState,exports.EmptyState=e.EmptyState,exports.EventEmitter=e.EventEmitter,exports.FullScreenLoader=e.FullScreenLoader,exports.InvoiceStatuses=e.InvoiceStatuses,exports.LoadingState=e.LoadingState,exports.PLAN_CURRENCY_CODES=e.PLAN_CURRENCY_CODES,exports.PLAN_CURRENCY_OPTIONS=e.PLAN_CURRENCY_OPTIONS,exports.PUSH_SERVICE_WORKER_SCRIPT=e.PUSH_SERVICE_WORKER_SCRIPT,exports.Permission=e.Permission,exports.PricingPage=e.PricingPage,exports.PushApi=e.PushApi,exports.PushNotificationProvider=e.PushNotificationProvider,exports.QuotaUsageContextProvider=e.QuotaUsageContextProvider,exports.SDKEvent=e.SDKEvent,exports.SETTINGS_SCREENS=e.SETTINGS_SCREENS,exports.SUPPORTED_LOCALES=e.SUPPORTED_LOCALES,exports.SaaSOSProvider=e.SaaSOSProvider,exports.SectionHeader=e.SectionHeader,exports.Sessions=e.Sessions,exports.SessionsApi=e.SessionsApi,exports.SettingsApi=e.SettingsApi,exports.SettingsScreen=e.SettingsScreen,exports.SidebarNavItem=e.SidebarNavItem,exports.SidebarNavSection=e.SidebarNavSection,exports.StatusBanner=e.StatusBanner,exports.SubscriptionContextProvider=e.SubscriptionContextProvider,exports.SubscriptionItemType=e.SubscriptionItemType,exports.SubscriptionStatus=e.SubscriptionStatus,exports.UserApi=e.UserApi,exports.WhenAuthenticated=e.WhenAuthenticated,exports.WhenCreditsAvailable=e.WhenCreditsAvailable,exports.WhenCreditsExhausted=e.WhenCreditsExhausted,exports.WhenCreditsLow=e.WhenCreditsLow,exports.WhenNoSubscription=e.WhenNoSubscription,exports.WhenNotTrialing=e.WhenNotTrialing,exports.WhenPermission=e.WhenPermission,exports.WhenQuotaAvailable=e.WhenQuotaAvailable,exports.WhenQuotaExhausted=e.WhenQuotaExhausted,exports.WhenQuotaOverage=e.WhenQuotaOverage,exports.WhenQuotaThreshold=e.WhenQuotaThreshold,exports.WhenRoles=e.WhenRoles,exports.WhenSubscription=e.WhenSubscription,exports.WhenSubscriptionToPlans=e.WhenSubscriptionToPlans,exports.WhenTrialEnding=e.WhenTrialEnding,exports.WhenTrialing=e.WhenTrialing,exports.WhenUnauthenticated=e.WhenUnauthenticated,exports.WhenUserFeatureDisabled=e.WhenUserFeatureDisabled,exports.WhenUserFeatureEnabled=e.WhenUserFeatureEnabled,exports.WhenWorkspaceFeatureDisabled=e.WhenWorkspaceFeatureDisabled,exports.WhenWorkspaceFeatureEnabled=e.WhenWorkspaceFeatureEnabled,exports.WhenWorkspaceRoles=e.WhenWorkspaceRoles,exports.WorkspaceApi=e.WorkspaceApi,exports.WorkspaceSwitcher=e.WorkspaceSwitcher,exports.calculateBillableSeats=e.calculateBillableSeats,exports.calculateSeatOverageCents=e.calculateSeatOverageCents,exports.calculateTotalSubscriptionCents=e.calculateTotalSubscriptionCents,exports.cleanBBParams=e.cleanBBParams,exports.clearAuthIntent=e.clearAuthIntent,exports.coerceBadgeRef=e.coerceBadgeRef,exports.consumeAuthIntent=e.consumeAuthIntent,exports.createBBUrl=e.createBBUrl,exports.createCheckoutRedirectUrls=e.createCheckoutRedirectUrls,exports.createCreditPurchaseRedirectUrls=e.createCreditPurchaseRedirectUrls,exports.eventEmitter=e.eventEmitter,exports.fillMcpTemplate=e.fillMcpTemplate,exports.formatCents=e.formatCents,exports.formatMinorAmountIntl=e.formatMinorAmountIntl,exports.formatOverageRate=e.formatOverageRate,exports.formatOverageRateWithLabel=e.formatOverageRateWithLabel,exports.formatQuotaIncludedOverage=e.formatQuotaIncludedOverage,exports.formatQuotaWithPrice=e.formatQuotaWithPrice,exports.getAvailableCurrenciesFromPlans=e.getAvailableCurrenciesFromPlans,exports.getBasePriceCents=e.getBasePriceCents,exports.getBillingIntervalAndCurrencyFromPriceId=e.getBillingIntervalAndCurrencyFromPriceId,exports.getCurrencyDecimals=e.getCurrencyDecimals,exports.getCurrencyFlag=e.getCurrencyFlag,exports.getCurrencySymbol=e.getCurrencySymbol,exports.getDisplayCurrency=e.getDisplayCurrency,exports.getPerSeatPriceCents=e.getPerSeatPriceCents,exports.getPricingVariant=e.getPricingVariant,exports.getQuotaDisplayValue=e.getQuotaDisplayValue,exports.getQuotaDisplayWithVariant=e.getQuotaDisplayWithVariant,exports.getQuotaOverageCents=e.getQuotaOverageCents,exports.getQuotaUnitLabelFromName=e.getQuotaUnitLabelFromName,exports.getSeatPricing=e.getSeatPricing,exports.getStripePriceIdForInterval=e.getStripePriceIdForInterval,exports.hasPermission=e.hasPermission,exports.invalidateCreditBalance=e.invalidateCreditBalance,exports.invalidateQuotaUsage=e.invalidateQuotaUsage,exports.invalidateSubscription=e.invalidateSubscription,exports.isZeroDecimalCurrency=e.isZeroDecimalCurrency,exports.mcpServerKey=e.mcpServerKey,exports.mergeUIConfig=e.mergeUIConfig,exports.minorAmountToDisplay=e.minorAmountToDisplay,exports.readBBParams=e.readBBParams,exports.resolveMaxUsers=e.resolveMaxUsers,exports.resolvePermissions=e.resolvePermissions,exports.safeRedirect=e.safeRedirect,exports.saveAuthIntent=e.saveAuthIntent,exports.useAllQuotaUsage=e.useAllQuotaUsage,exports.useBillingPortal=e.useBillingPortal,exports.useCancelSubscription=e.useCancelSubscription,exports.useConnectedAgents=e.useConnectedAgents,exports.useConnectedAgentsApi=e.useConnectedAgentsApi,exports.useConsumeCredits=e.useConsumeCredits,exports.useCreateCheckoutSession=e.useCreateCheckoutSession,exports.useCreditBalance=e.useCreditBalance,exports.useCreditBalanceContext=e.useCreditBalanceContext,exports.useCreditPackages=e.useCreditPackages,exports.useCreditTransactions=e.useCreditTransactions,exports.useDevices=e.useDevices,exports.useDevicesApi=e.useDevicesApi,exports.useExpiringCredits=e.useExpiringCredits,exports.useFullScreenLoader=e.useFullScreenLoader,exports.useInvoice=e.useInvoice,exports.useInvoices=e.useInvoices,exports.useMcpConnection=e.useMcpConnection,exports.usePermissions=e.usePermissions,exports.usePlanGroup=e.usePlanGroup,exports.usePlanGroupVersions=e.usePlanGroupVersions,exports.usePublicCreditPackages=e.usePublicCreditPackages,exports.usePublicPlanGroupVersion=e.usePublicPlanGroupVersion,exports.usePublicPlans=e.usePublicPlans,exports.usePurchaseCredits=e.usePurchaseCredits,exports.usePushNotifications=e.usePushNotifications,exports.useQuotaUsageContext=e.useQuotaUsageContext,exports.useQuotaUsageStatus=e.useQuotaUsageStatus,exports.useRecordUsage=e.useRecordUsage,exports.useResumeSubscription=e.useResumeSubscription,exports.useSaaSAuth=e.useSaaSAuth,exports.useSaaSOs=e.useSaaSOs,exports.useSaaSSettings=e.useSaaSSettings,exports.useSaaSWorkspaces=e.useSaaSWorkspaces,exports.useSeatStatus=e.useSeatStatus,exports.useSessions=e.useSessions,exports.useSessionsApi=e.useSessionsApi,exports.useSubscription=e.useSubscription,exports.useSubscriptionContext=e.useSubscriptionContext,exports.useSubscriptionManagement=e.useSubscriptionManagement,exports.useTranslation=e.useTranslation,exports.useTrialStatus=e.useTrialStatus,exports.useUIConfig=e.useUIConfig,exports.useUIVisibility=e.useUIVisibility,exports.useUpdateSubscription=e.useUpdateSubscription,exports.useUsageLogs=e.useUsageLogs,exports.useUserAttributes=e.useUserAttributes,exports.useUserFeatures=e.useUserFeatures,exports.validateInvite=e.validateInvite,exports.validateRedirectUrl=e.validateRedirectUrl,exports.workspaceSettingsManager=e.workspaceSettingsManager;
|
package/dist/react/index.d.ts
CHANGED
|
@@ -425,6 +425,11 @@ interface ICheckoutSessionResponse {
|
|
|
425
425
|
success: boolean;
|
|
426
426
|
checkoutUrl: string;
|
|
427
427
|
sessionId: string;
|
|
428
|
+
/** What Stripe charges today, in the currency's minor unit. Absent on older servers. */
|
|
429
|
+
amountTotal?: number | null;
|
|
430
|
+
currency?: string;
|
|
431
|
+
/** True when this checkout starts a trial rather than a paid period. */
|
|
432
|
+
trial?: boolean;
|
|
428
433
|
message: string;
|
|
429
434
|
planVersion?: {
|
|
430
435
|
_id: string;
|
|
@@ -471,6 +476,19 @@ interface ISubscriptionUpdateRequest {
|
|
|
471
476
|
cancelUrl?: string;
|
|
472
477
|
}
|
|
473
478
|
interface ISubscriptionUpdateResponse {
|
|
479
|
+
/**
|
|
480
|
+
* Set when the change was applied in place and prorated, rather than sent
|
|
481
|
+
* out to a Stripe checkout. The two paths report differently: a checkout
|
|
482
|
+
* comes back through `purchase`, a proration is reported here and the money
|
|
483
|
+
* lands later on an invoice.
|
|
484
|
+
*/
|
|
485
|
+
prorated?: boolean;
|
|
486
|
+
/** Present when the proration needs paying now. Minor units. */
|
|
487
|
+
invoice?: {
|
|
488
|
+
id?: string;
|
|
489
|
+
amount_due?: number;
|
|
490
|
+
status?: string | null;
|
|
491
|
+
} | null;
|
|
474
492
|
_id: string;
|
|
475
493
|
subscriptionStatus: string;
|
|
476
494
|
workspace: string;
|
|
@@ -720,11 +738,16 @@ interface ICreditPurchaseRequest {
|
|
|
720
738
|
currency?: string;
|
|
721
739
|
successUrl: string;
|
|
722
740
|
cancelUrl: string;
|
|
741
|
+
/** Written onto the Stripe session. The SDK adds its `bb_` tracking keys here. */
|
|
742
|
+
metadata?: Record<string, string>;
|
|
723
743
|
}
|
|
724
744
|
/** Response from POST .../credits/purchase */
|
|
725
745
|
interface ICreditPurchaseResponse {
|
|
726
746
|
sessionId: string;
|
|
727
747
|
url: string;
|
|
748
|
+
/** What Stripe charges, in the currency's minor unit. Absent on older servers. */
|
|
749
|
+
amountTotal?: number | null;
|
|
750
|
+
currency?: string;
|
|
728
751
|
}
|
|
729
752
|
/** Query params for GET .../credits/transactions */
|
|
730
753
|
interface ICreditTransactionsQuery {
|
|
@@ -917,6 +940,15 @@ interface AuthUser {
|
|
|
917
940
|
clientId: string;
|
|
918
941
|
role: string;
|
|
919
942
|
image?: string;
|
|
943
|
+
/** When the account was created, as the API returned it. */
|
|
944
|
+
createdAt?: string;
|
|
945
|
+
/**
|
|
946
|
+
* When this account first completed an authentication, stamped once by the
|
|
947
|
+
* server. Carried so tracking can tell a sign-up from a login: the SDK sees
|
|
948
|
+
* only "an authentication resolved", and account age alone counts the same
|
|
949
|
+
* person twice when they sign up on one device and open the app on another.
|
|
950
|
+
*/
|
|
951
|
+
firstAuthAt?: string;
|
|
920
952
|
}
|
|
921
953
|
interface AuthSession {
|
|
922
954
|
user: AuthUser;
|
|
@@ -1190,6 +1222,42 @@ interface AuthRequestParams {
|
|
|
1190
1222
|
error: string;
|
|
1191
1223
|
};
|
|
1192
1224
|
state?: string;
|
|
1225
|
+
/**
|
|
1226
|
+
* What the visitor answered about cookies, handed to the hosted sign-in
|
|
1227
|
+
* pages so they can honour it.
|
|
1228
|
+
*
|
|
1229
|
+
* Those pages live on a different registrable domain from your app, so the
|
|
1230
|
+
* cookie your banner wrote cannot be read there. Without this they have no
|
|
1231
|
+
* answer, and the one page where somebody actually signs up is the one page
|
|
1232
|
+
* your pixel cannot see.
|
|
1233
|
+
*
|
|
1234
|
+
* Sent in the request body rather than on the redirect URL: it stays out of
|
|
1235
|
+
* server logs and Referer headers, and out of reach of anyone minded to edit
|
|
1236
|
+
* a "yes" into their own URL.
|
|
1237
|
+
*
|
|
1238
|
+
* Populated automatically from the tracking provider when one is mounted.
|
|
1239
|
+
* Omitted means unanswered, which is not the same as refused.
|
|
1240
|
+
*/
|
|
1241
|
+
trackingConsent?: {
|
|
1242
|
+
analytics: boolean;
|
|
1243
|
+
marketing: boolean;
|
|
1244
|
+
};
|
|
1245
|
+
/**
|
|
1246
|
+
* This page's GA4 identity, so the hosted sign-in pages measure as the same
|
|
1247
|
+
* user rather than a new one.
|
|
1248
|
+
*
|
|
1249
|
+
* GA4 writes `_ga` per registrable domain, so those pages start a fresh
|
|
1250
|
+
* client id and the sign-in step lands under somebody who never visited
|
|
1251
|
+
* your app - which makes the funnel unbuildable rather than merely
|
|
1252
|
+
* incomplete. Carried through the auth state, which is what Google's `_gl`
|
|
1253
|
+
* linker parameter does through the URL.
|
|
1254
|
+
*
|
|
1255
|
+
* Populated automatically when a GA4 tag is on the page.
|
|
1256
|
+
*/
|
|
1257
|
+
trackingIdentity?: {
|
|
1258
|
+
gaClientId?: string;
|
|
1259
|
+
gaSessionId?: string;
|
|
1260
|
+
};
|
|
1193
1261
|
}
|
|
1194
1262
|
/**
|
|
1195
1263
|
* Unwrapped payload of a successful auth request.
|
|
@@ -1824,6 +1892,15 @@ declare class WorkspaceApi extends BaseApi {
|
|
|
1824
1892
|
*/
|
|
1825
1893
|
declare class EventEmitter {
|
|
1826
1894
|
private callbacks;
|
|
1895
|
+
/**
|
|
1896
|
+
* Internal subscribers, alongside - never instead of - the app's callback.
|
|
1897
|
+
*
|
|
1898
|
+
* `setCallbacks` holds exactly one handler, which is the app's. The SDK's
|
|
1899
|
+
* own features need to observe the same events, and taking that slot would
|
|
1900
|
+
* silently unregister whatever the app registered. Listeners are additive
|
|
1901
|
+
* and get the event after the app's handler has run.
|
|
1902
|
+
*/
|
|
1903
|
+
private listeners;
|
|
1827
1904
|
/**
|
|
1828
1905
|
* Set the event callbacks
|
|
1829
1906
|
* @param callbacks - The event callbacks to register
|
|
@@ -1840,6 +1917,13 @@ declare class EventEmitter {
|
|
|
1840
1917
|
* @param data - The event data
|
|
1841
1918
|
*/
|
|
1842
1919
|
private emit;
|
|
1920
|
+
/**
|
|
1921
|
+
* Subscribe to an event. Returns an unsubscribe function.
|
|
1922
|
+
*
|
|
1923
|
+
* Additive, unlike `setCallbacks`: several subscribers can watch the same
|
|
1924
|
+
* event and none of them displaces the app's own handler.
|
|
1925
|
+
*/
|
|
1926
|
+
on(eventType: EventType, listener: (data: EventData) => void): () => void;
|
|
1843
1927
|
/**
|
|
1844
1928
|
* Trigger user created event
|
|
1845
1929
|
* @param user - The newly created user
|
|
@@ -3462,6 +3546,84 @@ declare function useTranslation(): {
|
|
|
3462
3546
|
messages: SDKMessages;
|
|
3463
3547
|
};
|
|
3464
3548
|
|
|
3549
|
+
/**
|
|
3550
|
+
* The events the SDK fires on the app's behalf.
|
|
3551
|
+
*
|
|
3552
|
+
* Deliberately only the moments BuildBase itself observes. A customer's own
|
|
3553
|
+
* events go through `track()` and reach the data layer, but are never mapped
|
|
3554
|
+
* onto a vendor's standard event - guessing that someone's `upgraded_seat` is
|
|
3555
|
+
* Meta's `Purchase` is how a conversion report becomes fiction.
|
|
3556
|
+
*/
|
|
3557
|
+
type CanonicalEventName = 'sign_up' | 'login' | 'trial_started' | 'checkout_started' | 'purchase' | 'subscription_created' | 'subscription_upgraded' | 'lead' | 'workspace_created';
|
|
3558
|
+
/** Who fires a given event: the SDK, or the app. */
|
|
3559
|
+
type EventOwnership = 'auto' | 'manual';
|
|
3560
|
+
interface TrackingEvent {
|
|
3561
|
+
name: CanonicalEventName | string;
|
|
3562
|
+
params: Record<string, unknown>;
|
|
3563
|
+
/** Shared with any later server-side send, so the two can be deduplicated. */
|
|
3564
|
+
eventId: string;
|
|
3565
|
+
handledBy: EventOwnership;
|
|
3566
|
+
}
|
|
3567
|
+
interface TrackingEventsConfig {
|
|
3568
|
+
/** Default `auto`: the SDK fires to every installed script. */
|
|
3569
|
+
mode?: EventOwnership;
|
|
3570
|
+
/** Per-event override, for the few a customer wants to own. */
|
|
3571
|
+
overrides?: Partial<Record<CanonicalEventName, EventOwnership>>;
|
|
3572
|
+
}
|
|
3573
|
+
interface TrackingOptions {
|
|
3574
|
+
/** Set false to fetch nothing and render nothing. */
|
|
3575
|
+
enabled?: boolean;
|
|
3576
|
+
/**
|
|
3577
|
+
* `auto` (default) sets Consent Mode v2 to denied and waits for
|
|
3578
|
+
* `setConsent`. `granted` is the app asserting it has a lawful basis
|
|
3579
|
+
* already - documented as their assertion, not ours. `denied` keeps
|
|
3580
|
+
* everything off.
|
|
3581
|
+
*/
|
|
3582
|
+
consent?: 'auto' | 'granted' | 'denied';
|
|
3583
|
+
/**
|
|
3584
|
+
* Fire a `page_view` on SPA navigation. Turn it off when the app's GTM
|
|
3585
|
+
* container already does it - double-counted pageviews is the single most
|
|
3586
|
+
* likely support ticket this feature generates.
|
|
3587
|
+
*/
|
|
3588
|
+
autoPageview?: boolean;
|
|
3589
|
+
events?: TrackingEventsConfig;
|
|
3590
|
+
/**
|
|
3591
|
+
* Called for every canonical event. Returning `true` tells the SDK the app
|
|
3592
|
+
* handled this occurrence and suppresses its own fire.
|
|
3593
|
+
*/
|
|
3594
|
+
onEvent?: (event: TrackingEvent) => boolean | void;
|
|
3595
|
+
/**
|
|
3596
|
+
* Fields added to every event, including the ones the SDK fires itself.
|
|
3597
|
+
*
|
|
3598
|
+
* The events BuildBase owns - a signup, a checkout, a purchase - carry what
|
|
3599
|
+
* BuildBase knows, which is never the thing a particular business builds
|
|
3600
|
+
* its funnel on. A plan intent chosen before signup, an experiment variant,
|
|
3601
|
+
* an industry: without somewhere to put them, the only way to get one onto
|
|
3602
|
+
* a signup was to take the event over as `manual` and hand-write the
|
|
3603
|
+
* fan-out to every vendor, which is a bad trade for one field.
|
|
3604
|
+
*
|
|
3605
|
+
* Use `setProperties` for anything not known at mount.
|
|
3606
|
+
*/
|
|
3607
|
+
properties?: Record<string, unknown>;
|
|
3608
|
+
/**
|
|
3609
|
+
* The last word on what an event carries, called just before it is sent.
|
|
3610
|
+
*
|
|
3611
|
+
* Returns fields to merge in - which may overwrite anything already there,
|
|
3612
|
+
* including ours. Use it for values that depend on the event: a plan on
|
|
3613
|
+
* `checkout_started`, a source on `sign_up`. To suppress an event entirely,
|
|
3614
|
+
* return `true` from `onEvent` instead and send nothing.
|
|
3615
|
+
*
|
|
3616
|
+
* It cannot rename an event: the name is what every vendor mapping is keyed
|
|
3617
|
+
* on, and renaming one here would silently unmap it.
|
|
3618
|
+
*/
|
|
3619
|
+
enrich?: (event: {
|
|
3620
|
+
name: string;
|
|
3621
|
+
params: Record<string, unknown>;
|
|
3622
|
+
}) => Record<string, unknown> | void;
|
|
3623
|
+
/** Log what was installed, skipped and fired. */
|
|
3624
|
+
debug?: boolean;
|
|
3625
|
+
}
|
|
3626
|
+
|
|
3465
3627
|
interface SaaSOSProviderProps extends IOsState {
|
|
3466
3628
|
children: React__default.ReactNode;
|
|
3467
3629
|
/** SDK UI language. Defaults to 'en'. Supported: en, es, fr, de, ja, zh, hi, ar */
|
|
@@ -3500,6 +3662,30 @@ interface SaaSOSProviderProps extends IOsState {
|
|
|
3500
3662
|
* ```
|
|
3501
3663
|
*/
|
|
3502
3664
|
getCheckoutStripeParams?: GetCheckoutStripeParams;
|
|
3665
|
+
/**
|
|
3666
|
+
* Install the analytics and advertising tags this app's auth client is
|
|
3667
|
+
* configured with in the BuildBase console, and fire the conversion events
|
|
3668
|
+
* the SDK already observes - sign-up, login, checkout, workspace creation.
|
|
3669
|
+
*
|
|
3670
|
+
* Omit it and nothing is fetched and nothing is installed. Pass `{}` to
|
|
3671
|
+
* take the defaults: Consent Mode denied until `consent.set()`, SPA
|
|
3672
|
+
* pageviews on, every canonical event fired automatically.
|
|
3673
|
+
*
|
|
3674
|
+
* Reads `auth.clientId`, which is what decides which tags load here rather
|
|
3675
|
+
* than on the org's other properties, so a marketing site and a product app
|
|
3676
|
+
* carry different tags without either of them naming an id in code.
|
|
3677
|
+
*
|
|
3678
|
+
* @example
|
|
3679
|
+
* ```tsx
|
|
3680
|
+
* <SaaSOSProvider
|
|
3681
|
+
* tracking={{
|
|
3682
|
+
* events: { overrides: { purchase: 'manual' } },
|
|
3683
|
+
* onEvent: e => myAnalytics.record(e.name, e.params),
|
|
3684
|
+
* }}
|
|
3685
|
+
* >
|
|
3686
|
+
* ```
|
|
3687
|
+
*/
|
|
3688
|
+
tracking?: TrackingOptions;
|
|
3503
3689
|
/**
|
|
3504
3690
|
* Custom content or render function for the full-screen loading overlay.
|
|
3505
3691
|
* Used during auth code exchange, and available to any SDK feature via `useFullScreenLoader()`.
|
|
@@ -6041,32 +6227,6 @@ declare const useConsumeCredits: (workspaceId: string | null | undefined) => {
|
|
|
6041
6227
|
loading: boolean;
|
|
6042
6228
|
error: string | null;
|
|
6043
6229
|
};
|
|
6044
|
-
/**
|
|
6045
|
-
* Hook to create a Stripe checkout session for purchasing a credit package.
|
|
6046
|
-
* Returns a mutation function that resolves with { sessionId, url }.
|
|
6047
|
-
*
|
|
6048
|
-
* @param workspaceId - The workspace ID. Can be null/undefined.
|
|
6049
|
-
* @returns { purchaseCredits, loading, error }
|
|
6050
|
-
*
|
|
6051
|
-
* @example
|
|
6052
|
-
* ```tsx
|
|
6053
|
-
* function BuyCreditsButton({ packageId }) {
|
|
6054
|
-
* const { currentWorkspace } = useSaaSWorkspaces();
|
|
6055
|
-
* const { purchaseCredits, loading } = usePurchaseCredits(currentWorkspace?._id);
|
|
6056
|
-
*
|
|
6057
|
-
* const handleBuy = async () => {
|
|
6058
|
-
* const result = await purchaseCredits({
|
|
6059
|
-
* creditPackageId: packageId,
|
|
6060
|
-
* successUrl: `${window.location.origin}/credits/success`,
|
|
6061
|
-
* cancelUrl: `${window.location.origin}/credits`,
|
|
6062
|
-
* });
|
|
6063
|
-
* window.location.href = result.url;
|
|
6064
|
-
* };
|
|
6065
|
-
*
|
|
6066
|
-
* return <button onClick={handleBuy} disabled={loading}>Buy Credits</button>;
|
|
6067
|
-
* }
|
|
6068
|
-
* ```
|
|
6069
|
-
*/
|
|
6070
6230
|
declare const usePurchaseCredits: (workspaceId: string | null | undefined) => {
|
|
6071
6231
|
purchaseCredits: (request: ICreditPurchaseRequest) => Promise<ICreditPurchaseResponse>;
|
|
6072
6232
|
loading: boolean;
|
package/dist/react/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export{
|
|
2
|
+
export{aS as ApiVersion,aT as AuthApi,aU as AuthStatus,o as BBAction,aV as BBScreen,p as BBStatus,aW as BB_PARAM,aX as BaseApi,aY as BetaForm,ag as BillingIntervals,aZ as BuildBaseBadge,a_ as BuildBaseProvider,a$ as CURRENCY_DISPLAY,b0 as CURRENCY_FLAG,b1 as ConnectMcpGuide,C as ConnectedAgents,b2 as ConnectedAgentsApi,b3 as CreditActionsProvider,b4 as CreditBalance,b5 as CreditBalanceContextProvider,b6 as CreditBucketSource,b7 as CreditBucketStatus,b8 as CreditStorePage,y as CreditTransactionType,b9 as DEFAULT_ROLE_PERMISSIONS,R as Devices,ba as DevicesApi,ax as DunningState,E as EmptyState,bb as EventEmitter,bc as FullScreenLoader,ae as InvoiceStatuses,L as LoadingState,bd as PLAN_CURRENCY_CODES,be as PLAN_CURRENCY_OPTIONS,bf as PUSH_SERVICE_WORKER_SCRIPT,P as Permission,bg as PricingPage,bh as PushApi,bi as PushNotificationProvider,bj as QuotaUsageContextProvider,bk as SDKEvent,aO as SETTINGS_SCREENS,bl as SUPPORTED_LOCALES,a_ as SaaSOSProvider,s as SectionHeader,T as Sessions,bm as SessionsApi,bn as SettingsApi,aH as SettingsScreen,aJ as SidebarNavItem,aI as SidebarNavSection,r as StatusBanner,bo as SubscriptionContextProvider,ah as SubscriptionItemType,ak as SubscriptionStatus,bp as UserApi,bq as WhenAuthenticated,br as WhenCreditsAvailable,bs as WhenCreditsExhausted,bt as WhenCreditsLow,bu as WhenNoSubscription,bv as WhenNotTrialing,bw as WhenPermission,bx as WhenQuotaAvailable,by as WhenQuotaExhausted,bz as WhenQuotaOverage,bA as WhenQuotaThreshold,bB as WhenRoles,bC as WhenSubscription,bD as WhenSubscriptionToPlans,bE as WhenTrialEnding,bF as WhenTrialing,bG as WhenUnauthenticated,bH as WhenUserFeatureDisabled,bI as WhenUserFeatureEnabled,bJ as WhenWorkspaceFeatureDisabled,bK as WhenWorkspaceFeatureEnabled,bL as WhenWorkspaceRoles,bM as WorkspaceApi,bN as WorkspaceSwitcher,bO as calculateBillableSeats,bP as calculateSeatOverageCents,bQ as calculateTotalSubscriptionCents,bR as cleanBBParams,bS as clearAuthIntent,bT as coerceBadgeRef,bU as consumeAuthIntent,bV as createBBUrl,az as createCheckoutRedirectUrls,v as createCreditPurchaseRedirectUrls,bW as eventEmitter,bX as fillMcpTemplate,bY as formatCents,f as formatMinorAmountIntl,bZ as formatOverageRate,b_ as formatOverageRateWithLabel,b$ as formatQuotaIncludedOverage,c0 as formatQuotaWithPrice,aQ as getAvailableCurrenciesFromPlans,au as getBasePriceCents,at as getBillingIntervalAndCurrencyFromPriceId,e as getCurrencyDecimals,a0 as getCurrencyFlag,g as getCurrencySymbol,c1 as getDisplayCurrency,aw as getPerSeatPriceCents,aP as getPricingVariant,aj as getQuotaDisplayValue,ai as getQuotaDisplayWithVariant,aD as getQuotaOverageCents,c2 as getQuotaUnitLabelFromName,av as getSeatPricing,ay as getStripePriceIdForInterval,c3 as hasPermission,q as invalidateCreditBalance,c4 as invalidateQuotaUsage,aA as invalidateSubscription,c5 as isZeroDecimalCurrency,c6 as mcpServerKey,aL as mergeUIConfig,c7 as minorAmountToDisplay,c8 as readBBParams,c9 as resolveMaxUsers,ca as resolvePermissions,x as safeRedirect,cb as saveAuthIntent,cc as useAllQuotaUsage,aq as useBillingPortal,ao as useCancelSubscription,cd as useConnectedAgents,ce as useConnectedAgentsApi,cf as useConsumeCredits,an as useCreateCheckoutSession,cg as useCreditBalance,j as useCreditBalanceContext,k as useCreditPackages,m as useCreditTransactions,ch as useDevices,ci as useDevicesApi,l as useExpiringCredits,cj as useFullScreenLoader,ck as useInvoice,ac as useInvoices,cl as useMcpConnection,h as usePermissions,cm as usePlanGroup,ar as usePlanGroupVersions,cn as usePublicCreditPackages,co as usePublicPlanGroupVersion,cp as usePublicPlans,n as usePurchaseCredits,a7 as usePushNotifications,aB as useQuotaUsageContext,cq as useQuotaUsageStatus,cr as useRecordUsage,ap as useResumeSubscription,aE as useSaaSAuth,cs as useSaaSOs,A as useSaaSSettings,z as useSaaSWorkspaces,aF as useSeatStatus,ct as useSessions,cu as useSessionsApi,cv as useSubscription,aC as useSubscriptionContext,am as useSubscriptionManagement,u as useTranslation,cw as useTrialStatus,aK as useUIConfig,i as useUIVisibility,cx as useUpdateSubscription,cy as useUsageLogs,cz as useUserAttributes,cA as useUserFeatures,cB as validateInvite,cC as validateRedirectUrl,w as workspaceSettingsManager}from"./chunks/react-Be1VMiVO.mjs";import"react/jsx-runtime";import"react";import"clsx";import"tailwind-merge";import"intl-messageformat";import"@hookform/resolvers/zod";import"react-hook-form";import"@radix-ui/react-slot";import"class-variance-authority";import"lucide-react";import"@radix-ui/react-label";import"zod";import"@radix-ui/react-avatar";import"@radix-ui/react-dialog";import"@radix-ui/react-icons";import"@radix-ui/react-radio-group";import"@radix-ui/react-scroll-area";import"@radix-ui/react-separator";import"@radix-ui/react-accordion";import"@radix-ui/react-alert-dialog";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react");const n="bb_attr",r=["gclid","gbraid","wbraid","dclid","fbclid","msclkid","li_fat_id","twclid","ttclid","rdt_cid","epik","irclickid","utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"],i=/^[\w.~-]{1,200}$/;function o(){return"undefined"==typeof window?null:window}function a(e,t){if(!e||!e.includes("."))return"";if(/^\d{1,3}(\.\d{1,3}){3}$/.test(e))return"";const n=t??o()?.document;if(!n)return"";const r=e.split(".");for(let e=r.length-2;e>=0;e--){const t="."+r.slice(e).join("."),i=`__bb_probe_${Date.now()}`;n.cookie=`${i}=1; domain=${t}; path=/; SameSite=Lax`;const o=n.cookie.includes(`${i}=1`);if(n.cookie=`${i}=; domain=${t}; path=/; max-age=0; SameSite=Lax`,o)return t}return""}function s(e){const t=e.cookie.split("; ").find(e=>e.startsWith(`${n}=`));if(!t)return{};try{const e=JSON.parse(decodeURIComponent(t.slice(8)));return"object"==typeof e&&e?e:{}}catch{return{}}}function c(){const e=o();if(!e)return{};const t=e.document,c=s(t),d={...function(e){const t=new URLSearchParams(e),n={};for(const e of r){const r=t.get(e);r&&(r.length>200||i.test(r)&&(n[e]=r))}return n}(e.location.search),...c};if(0===Object.keys(d).length)return{};return Object.keys(d).some(e=>void 0===c[e])&&function(e,t,r){const i=encodeURIComponent(JSON.stringify(t));e.cookie=`${n}=${i}; path=/; max-age=7776000; SameSite=Lax`+(r?`; domain=${r}`:"")}(t,d,a(e.location.hostname,t)),d}function d(e){try{const t=new URLSearchParams(e);return t.has("code")&&t.has("state")}catch{return!1}}const l="bb_pending_checkout";function u(){try{return"undefined"==typeof window?null:window.sessionStorage}catch{return null}}const p="bb_co";function g(){try{return"undefined"==typeof window?null:window.document??null}catch{return null}}function f(){const e=g();if(e)try{const t=a(window.location?.hostname??"",e);e.cookie=`${p}=; path=/; max-age=0; SameSite=Lax`+(t?`; domain=${t}`:"")}catch{}}function m(e,t){if(!e)return null;try{const n=JSON.parse(e);return n&&"string"==typeof n.eventId&&n.eventId?"number"!=typeof n.startedAt||t-n.startedAt>216e5?null:n:null}catch{return null}}function h(e=Date.now()){const t=u();if(!t)return null;let n=null;try{n=t.getItem(l),t.removeItem(l)}catch{return null}const r=m(n,e);return r&&f(),r}function y(e){try{return m(u()?.getItem(l)??null,e)}catch{return null}}function w(e,t=Date.now()){let n=null;try{n=new URLSearchParams(e).get("session_id")}catch{return null}if(!n)return null;const r=y(t);if(r?.sessionId===n)return h(t);const i=function(e){const t=g();if(!t||"string"!=typeof t.cookie)return null;const n=t.cookie.split("; ").find(e=>e.startsWith(`${p}=`));return n?m(decodeURIComponent(n.slice(6)),e):null}(t);return i?.sessionId!==n?null:(f(),i)}function v(e,t=Date.now()){return function(e){let t=null;try{t=new URLSearchParams(e).get("bb")}catch{return!1}if(!t)return!1;const n={};for(const e of t.split(",")){const t=e.indexOf(":");if(-1!==t)try{n[decodeURIComponent(e.slice(0,t))]=decodeURIComponent(e.slice(t+1))}catch{}}return"checkout"===n.action&&"cancel"===n.status}(e)&&y(t)?h(t):null}const _=new Set(["bif","clp","djf","gnf","jpy","kmf","krw","mga","pyg","rwf","ugx","vnd","vuv","xaf","xof","xpf"]),k=new Set(["bhd","jod","kwd","omr","tnd"]);function b(e,t){if("number"!=typeof e||!Number.isFinite(e))return;const n=(t??"").toLowerCase();return _.has(n)?e:e/(k.has(n)?1e3:100)}function I(){return"undefined"==typeof window?null:window}function C(e){const t=I();if(!t)return;t.gtag?.("consent","update",{ad_storage:e.marketing?"granted":"denied",ad_user_data:e.marketing?"granted":"denied",ad_personalization:e.marketing?"granted":"denied",analytics_storage:e.analytics?"granted":"denied"});const n=t.fbq;n?.("consent",e.marketing?"grant":"revoke")}const x={gtm:{title:"Google Tag Manager",vendor:"Google LLC",privacyUrl:"https://policies.google.com/privacy",idLabel:"Container ID",idPattern:"^GTM-[A-Z0-9]{4,10}$",idExample:"GTM-ABC1234",scriptOrigin:"https://www.googletagmanager.com",defaultConsentCategory:"analytics",supportsConsentMode:!0,needsConversionIds:!1},ga4:{title:"Google Analytics 4",vendor:"Google LLC",privacyUrl:"https://policies.google.com/privacy",idLabel:"Measurement ID",idPattern:"^G-[A-Z0-9]{8,12}$",idExample:"G-ABCD123456",scriptOrigin:"https://www.googletagmanager.com",defaultConsentCategory:"analytics",supportsConsentMode:!0,needsConversionIds:!1},google_ads:{title:"Google Ads",vendor:"Google LLC",privacyUrl:"https://policies.google.com/privacy",idLabel:"Conversion ID",idPattern:"^AW-[0-9]{9,12}$",idExample:"AW-123456789",scriptOrigin:"https://www.googletagmanager.com",defaultConsentCategory:"marketing",supportsConsentMode:!0,needsConversionIds:!0},meta_pixel:{title:"Meta Pixel",vendor:"Meta Platforms Ireland Limited",privacyUrl:"https://www.facebook.com/privacy/policy",idLabel:"Pixel ID",idPattern:"^[0-9]{15,16}$",idExample:"123456789012345",scriptOrigin:"https://connect.facebook.net",defaultConsentCategory:"marketing",supportsConsentMode:!1,needsConversionIds:!1,multiInstance:!0},x_pixel:{title:"X (Twitter) Pixel",vendor:"X Corp.",privacyUrl:"https://x.com/en/privacy",idLabel:"Pixel ID",idPattern:"^o[a-z0-9]{4,6}$",idExample:"o1a2b3",scriptOrigin:"https://static.ads-twitter.com",defaultConsentCategory:"marketing",supportsConsentMode:!1,needsConversionIds:!0,multiInstance:!0},linkedin:{title:"LinkedIn Insight Tag",vendor:"LinkedIn Ireland Unlimited Company",privacyUrl:"https://www.linkedin.com/legal/privacy-policy",idLabel:"Partner ID",idPattern:"^[0-9]{6,9}$",idExample:"1234567",scriptOrigin:"https://snap.licdn.com",defaultConsentCategory:"marketing",supportsConsentMode:!1,needsConversionIds:!0,multiInstance:!0},tiktok:{title:"TikTok Pixel",vendor:"TikTok Information Technologies UK Limited",privacyUrl:"https://www.tiktok.com/legal/privacy-policy",idLabel:"Pixel ID",idPattern:"^[A-Z0-9]{20}$",idExample:"C4A1B2C3D4E5F6G7H8I9",scriptOrigin:"https://analytics.tiktok.com",defaultConsentCategory:"marketing",supportsConsentMode:!1,needsConversionIds:!1,multiInstance:!0},reddit:{title:"Reddit Pixel",vendor:"Reddit, Inc.",privacyUrl:"https://www.reddit.com/policies/privacy-policy",idLabel:"Advertiser ID",idPattern:"^t2_[a-z0-9]{4,12}$",idExample:"t2_abc123",scriptOrigin:"https://www.redditstatic.com",defaultConsentCategory:"marketing",supportsConsentMode:!1,needsConversionIds:!1,multiInstance:!0},bing_uet:{title:"Microsoft Advertising (UET)",vendor:"Microsoft Corporation",privacyUrl:"https://privacy.microsoft.com/en-us/privacystatement",idLabel:"Tag ID",idPattern:"^[0-9]{7,9}$",idExample:"12345678",scriptOrigin:"https://bat.bing.com",defaultConsentCategory:"marketing",supportsConsentMode:!1,needsConversionIds:!1,multiInstance:!0},clarity:{title:"Microsoft Clarity",vendor:"Microsoft Corporation",privacyUrl:"https://privacy.microsoft.com/en-us/privacystatement",idLabel:"Project ID",idPattern:"^[a-z0-9]{10}$",idExample:"ab12cd34ef",scriptOrigin:"https://www.clarity.ms",defaultConsentCategory:"analytics",supportsConsentMode:!1,needsConversionIds:!1},hotjar:{title:"Hotjar",vendor:"Hotjar Limited",privacyUrl:"https://www.hotjar.com/legal/policies/privacy/",idLabel:"Site ID",idPattern:"^[0-9]{6,9}$",idExample:"1234567",scriptOrigin:"https://static.hotjar.com",defaultConsentCategory:"analytics",supportsConsentMode:!1,needsConversionIds:!1},posthog:{title:"PostHog",vendor:"PostHog, Inc.",privacyUrl:"https://posthog.com/privacy",idLabel:"Project API key",idPattern:"^phc_[A-Za-z0-9]{32,48}$",idExample:"phc_abcdefghijklmnopqrstuvwxyz012345",scriptOrigin:"https://us-assets.i.posthog.com",defaultConsentCategory:"analytics",supportsConsentMode:!1,needsConversionIds:!1,hosts:["us.i.posthog.com","eu.i.posthog.com"]},plausible:{title:"Plausible Analytics",vendor:"Plausible Insights OÜ",privacyUrl:"https://plausible.io/privacy",idLabel:"Domain",idPattern:"^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$",idExample:"example.com",scriptOrigin:"https://plausible.io",defaultConsentCategory:"analytics",supportsConsentMode:!1,needsConversionIds:!1},ahrefs:{title:"Ahrefs Analytics",vendor:"Ahrefs Pte. Ltd.",privacyUrl:"https://ahrefs.com/privacy",idLabel:"Analytics key",idPattern:"^[A-Za-z0-9+/=]{20,64}$",idExample:"AbCdEfGhIjKlMnOpQrStUv==",scriptOrigin:"https://analytics.ahrefs.com",defaultConsentCategory:"analytics",supportsConsentMode:!1,needsConversionIds:!1}},$=Object.keys(x);function j(e){return"string"==typeof e&&Object.prototype.hasOwnProperty.call(x,e)}function A(e,t){return!!j(e)&&("string"==typeof t&&0!==t.length&&new RegExp(x[e].idPattern).test(t))}const q=/^[a-z][a-z0-9-]{0,40}$/,S=/^[\w.:/@+=-]{1,200}$/;function P(e){return function(e){if("string"!=typeof e)return!1;if(0===e.length||e.length>300)return!1;let t;try{t=new URL(e)}catch{return!1}return!("https:"!==t.protocol||!t.hostname||!t.hostname.includes(".")||e.includes("?")||e.includes("#")||t.username||t.password)}(e.src)&&function(e){if(null==e)return!0;if("object"!=typeof e||Array.isArray(e))return!1;const t=Object.entries(e);return!(t.length>12)&&t.every(([e,t])=>q.test(e)&&"string"==typeof t&&S.test(t))}(e.dataAttributes)}const E=Array.from(new Set($.map(e=>x[e].scriptOrigin))).sort(),O={sign_up:{ga4:"sign_up",meta:"CompleteRegistration",tiktok:"CompleteRegistration",reddit:"SignUp"},login:{ga4:"login",meta:null,tiktok:null,reddit:null},trial_started:{ga4:"begin_checkout",meta:"StartTrial",tiktok:"StartTrial",reddit:"Lead"},checkout_started:{ga4:"begin_checkout",meta:"InitiateCheckout",tiktok:"InitiateCheckout",reddit:"AddToCart"},purchase:{ga4:"purchase",meta:"Purchase",tiktok:"CompletePayment",reddit:"Purchase"},subscription_created:{ga4:"purchase",meta:"Subscribe",tiktok:"Subscribe",reddit:"Purchase"},subscription_upgraded:{ga4:"subscription_upgraded",meta:null,tiktok:null,reddit:null},lead:{ga4:"generate_lead",meta:"Lead",tiktok:"SubmitForm",reddit:"Lead"},workspace_created:{ga4:"workspace_created",meta:null,tiktok:null,reddit:null}},T=Object.keys(O);function U(e){return T.includes(e)}function L(){return"undefined"==typeof window?null:window}const R={gtm:"dataLayer",ga4:"gtag",google_ads:"gtag",meta_pixel:"fbq",x_pixel:"twq",linkedin:"lintrk",tiktok:"ttq",reddit:"rdt",bing_uet:"uetq",clarity:"clarity",hotjar:"hj",posthog:"posthog",plausible:"plausible",ahrefs:"__ahrefs_loaded"};function M(){return"undefined"==typeof window?null:window}function D(e,t={}){const n=M();if(!n)return null;const r=n.document.createElement("script");r.async=!0,r.src=e;for(const[e,n]of Object.entries(t))r.setAttribute(e,n);return n.document.head.appendChild(r),r}function N(e){const t=M();if(!t)return;const n=t.document.createElement("script");n.text=e,t.document.head.appendChild(n)}function B(e){const t=M();t&&(Array.isArray(t[e])||(t[e]=[]),"function"!=typeof t.gtag&&(t.gtag=function(){t[e].push(arguments)}))}const G=new Set;function V(e){for(const t of G)if(t.slice(0,t.indexOf(":"))===e)return!0;return!1}function z(e,t){const n=M();if(!n)return!1;if("gtm"===e||"ga4"===e||"google_ads"===e){const e=n.google_tag_manager;return!(!e||"object"!=typeof e)&&Object.prototype.hasOwnProperty.call(e,t)}const r=R[e];if(!r)return!1;if(void 0===n[r])return!1;if(G.has(`${e}:${t}`))return!0;return!x[e].multiInstance||!V(e)}const F={meta_pixel:e=>`fbq('init','${e}');fbq('track','PageView');`,x_pixel:e=>`twq('config','${e}');`,tiktok:e=>`ttq.load('${e}');ttq.page();`,reddit:e=>`rdt('init','${e}');rdt('track','PageVisit');`,bing_uet:e=>`window.uetq=window.uetq||[];window.uetq.push({ti:'${e}',enableAutoSpaTracking:false});`,linkedin:e=>`window._linkedin_data_partner_ids=window._linkedin_data_partner_ids||[];window._linkedin_data_partner_ids.push('${e}');`};function H(e,t,n){const r=function(e,t,n){const r=M();if(!r)return!1;if("external"===e.provider){if(!e.src)return!1;const t={};for(const[n,r]of Object.entries(e.dataAttributes??{}))t[`data-${n}`]=r;return D(e.src,t),!0}const i=e.provider,o=x[i];if(!o)return!1;const a=e.providerId;if(!a)return!1;const s=F[i];if(s&&V(i))return N(s(a)),!0;switch(i){case"gtm":{B(t),r[t].push({"gtm.start":Date.now(),event:"gtm.js"});const e="dataLayer"===t?"":`&l=${t}`;return D(`${o.scriptOrigin}/gtm.js?id=${a}${e}`),!0}case"ga4":case"google_ads":{B(t),D(`${o.scriptOrigin}/gtag/js?id=${a}`);const e=r.gtag;e("js",new Date);const s="ga4"===i&&n?.gaClientId?{client_id:n.gaClientId}:void 0;return s?e("config",a,s):e("config",a),!0}case"meta_pixel":return N(`!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,document,'script','${o.scriptOrigin}/en_US/fbevents.js');fbq('init','${a}');fbq('track','PageView');`),!0;case"x_pixel":return N(`!function(e,t,n,s,u,a){e.twq||(s=e.twq=function(){s.exe?s.exe.apply(s,arguments):s.queue.push(arguments)},s.version='1.1',s.queue=[],u=t.createElement(n),u.async=!0,u.src='${o.scriptOrigin}/uwt.js',a=t.getElementsByTagName(n)[0],a.parentNode.insertBefore(u,a))}(window,document,'script');twq('config','${a}');`),!0;case"linkedin":return N(`window._linkedin_partner_id='${a}';window._linkedin_data_partner_ids=window._linkedin_data_partner_ids||[];window._linkedin_data_partner_ids.push('${a}');window.lintrk=window.lintrk||function(a,b){(window.lintrk.q=window.lintrk.q||[]).push([a,b])};window.lintrk.q=window.lintrk.q||[];`),D(`${o.scriptOrigin}/li.lms-analytics/insight.min.js`),!0;case"tiktok":return N(`!function(w,d,t){w.TiktokAnalyticsObject=t;var ttq=w[t]=w[t]||[];ttq.methods=['page','track','identify','instances','debug','on','off','once','ready','alias','group','enableCookie','disableCookie'];ttq.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};for(var i=0;i<ttq.methods.length;i++)ttq.setAndDefer(ttq,ttq.methods[i]);ttq.load=function(e,n){var r='${o.scriptOrigin}/i18n/pixel/events.js';ttq._i=ttq._i||{};ttq._i[e]=[];ttq._i[e]._u=r;ttq._t=ttq._t||{};ttq._t[e]=+new Date;ttq._o=ttq._o||{};ttq._o[e]=n||{};var o=d.createElement('script');o.type='text/javascript';o.async=!0;o.src=r+'?sdkid='+e+'&lib='+t;var a=d.getElementsByTagName('script')[0];a.parentNode.insertBefore(o,a)};ttq.load('${a}');ttq.page()}(window,document,'ttq');`),!0;case"reddit":return N(`!function(w,d){if(!w.rdt){var p=w.rdt=function(){p.sendEvent?p.sendEvent.apply(p,arguments):p.callQueue.push(arguments)};p.callQueue=[];var t=d.createElement('script');t.src='${o.scriptOrigin}/ads/pixel.js';t.async=!0;var s=d.getElementsByTagName('script')[0];s.parentNode.insertBefore(t,s)}}(window,document);rdt('init','${a}');rdt('track','PageVisit');`),!0;case"bing_uet":return N(`(function(w,d,t,r,u){w[u]=w[u]||[];w[u].push({ti:'${a}',enableAutoSpaTracking:false});var o=d.createElement(t);o.src='${o.scriptOrigin}/bat.js';o.async=1;var i=d.getElementsByTagName(t)[0];i.parentNode.insertBefore(o,i)})(window,document,'script',0,'uetq');`),!0;case"clarity":return N(`(function(c,l,a,r,i,t,y){c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};t=l.createElement(r);t.async=1;t.src='${o.scriptOrigin}/tag/'+i;y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y)})(window,document,'clarity','script','${a}');`),!0;case"hotjar":return N(`(function(h,o,t,j,a,r){h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};h._hjSettings={hjid:${a},hjsv:6};a=o.getElementsByTagName('head')[0];r=o.createElement('script');r.async=1;r.src='${o.scriptOrigin}/hotjar-'+h._hjSettings.hjid+'.js?sv='+h._hjSettings.hjsv;a.appendChild(r)})(window,document);`),!0;case"posthog":{const t=o.hosts,n=t?.includes(e.host??"")?e.host:t?.[0]??"us.i.posthog.com";return N(`!function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split('.');2==o.length&&(t=t[o[0]],e=o[1]);t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement('script')).type='text/javascript',p.async=!0,p.src='${o.scriptOrigin}/static/array.js',(r=t.getElementsByTagName('script')[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a='posthog',u.people=u.people||[],u.toString=function(t){var e='posthog';return'posthog'!==a&&(e+='.'+a),t||(e+=' (stub)'),e},u.people.toString=function(){return u.toString(1)+'.people (stub)'},o='init capture register register_once identify alias people.set people.set_once set_config get_distinct_id getFeatureFlag isFeatureEnabled onFeatureFlags reloadFeatureFlags group reset'.split(' '),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,window.posthog||[]);posthog.init('${a}',{api_host:'https://${n}'});`),!0}case"plausible":return N("window.plausible=window.plausible||function(){(window.plausible.q=window.plausible.q||[]).push(arguments)};"),D(`${o.scriptOrigin}/js/script.js`,{"data-domain":a,defer:"true"}),!0;case"ahrefs":return D(`${o.scriptOrigin}/analytics.js`,{"data-key":a}),r.__ahrefs_loaded=!0,!0;default:return!1}}(e,t,n);return r&&"external"!==e.provider&&e.providerId&&G.add(`${e.provider}:${e.providerId}`),r}const Z=Symbol.for("@buildbase/sdk.tracking.context"),J=globalThis,K=J[Z]??(J[Z]=t.createContext(null)),W={consent:{manifest:[],state:null,set:()=>{}},track:()=>{},setUser:()=>{},setProperties:()=>{},getProperties:()=>({}),completeCheckout:async()=>{},installed:{},ready:!0,attribution:{}};function Q(){return t.useContext(K)??W}const X=({serverUrl:n,orgId:r,clientId:i,enabled:o=!0,consent:a="auto",autoPageview:s=!0,events:l,onEvent:u,properties:p,enrich:g,identity:f,debug:m=!1,children:h})=>{const y=t.useRef(f);y.current=f;const[_,k]=t.useState(null),[$,q]=t.useState(!1),[S,E]=t.useState(!1),T="granted"===a?{analytics:!0,marketing:!0}:"denied"===a?{analytics:!1,marketing:!1}:null,[R,M]=t.useState(T),D=t.useRef(null),N=t.useRef(u);N.current=u;const G=t.useRef(g);G.current=g;const V=t.useRef({});V.current=p??{};const F=t.useRef({}),Z=t.useCallback(()=>({...V.current,...F.current}),[]),J=t.useCallback(e=>{const t={...F.current,...e};for(const[e,n]of Object.entries(t))void 0===n&&delete t[e];F.current=t},[]),[W,Q]=t.useState({}),X=t.useRef({}),[Y,ee]=t.useState(0),te=_?.dataLayerName??"dataLayer",ne=t.useCallback((...e)=>{m&&console.info("[buildbase:tracking]",...e)},[m]);t.useEffect(()=>{if(!(o&&n&&r&&i))return void q(!0);let e=!1;const t=`${n.replace(/\/$/,"")}/api/v1/public/${r}/tracking?clientId=${encodeURIComponent(i)}`;return fetch(t).then(e=>e.ok?e.json():null).then(t=>{if(e||!t)return;const n=t.data??t;n&&Array.isArray(n.scripts)&&k(n)}).catch(()=>{ne("config fetch failed; nothing installed")}).finally(()=>{e||q(!0)}),()=>{e=!0}},[o,n,r,i,ne]),t.useEffect(()=>{o&&Q(c())},[o]),t.useEffect(()=>{o&&_?.enabled&&(B(te),function(e,t){const n=I();if(!n)return;Array.isArray(n[e])||(n[e]=[]),"function"!=typeof n.gtag&&(n.gtag=function(){n[e].push(arguments)});const r="granted"===t?"granted":"denied";n.gtag("consent","default",{ad_storage:r,ad_user_data:r,ad_personalization:r,analytics_storage:r,wait_for_update:500})}(te,a),D.current&&C(D.current))},[o,_?.enabled,te,a]);const re=t.useMemo(()=>_?.enabled?_.scripts.filter(e=>{const t=j(e.provider)&&x[e.provider].supportsConsentMode;return function(e,t,n,r){return"denied"!==r&&("granted"===r||(n?"marketing"===e?n.marketing:n.analytics:t&&"analytics"===e))}(e.consentCategory,t,R,a)}):[],[_,R,a]),[ie,oe]=t.useState(()=>"undefined"==typeof window||!d(window.location.search));t.useEffect(()=>{if(ie)return;const e=setInterval(()=>{d(window.location.search)||oe(!0)},50),t=setTimeout(()=>oe(!0),5e3);return()=>{clearInterval(e),clearTimeout(t)}},[ie]),t.useEffect(()=>{if(!ie)return;if(!o||!_?.enabled)return void($&&E(!0));let e=0;for(const t of re)if(!X.current[t.key]){if("external"===t.provider){if(!P({src:t.src,dataAttributes:t.dataAttributes})){ne("rejected external script",t.key);continue}}else{if(!j(t.provider)){ne("rejected unknown provider",t.provider);continue}if(!A(t.provider,t.providerId)){ne("rejected id for",t.provider);continue}if(z(t.provider,t.providerId??"")){ne(`${t.provider} ${t.providerId} is already on the page; skipping. Configure each tag in exactly one place.`);continue}}H(t,te,y.current)&&(X.current[t.key]=t.providerId??t.src??"",e+=1,ne("installed",t.key))}e&&ee(e=>e+1);const t=window;t.__buildbase=t.__buildbase??{},t.__buildbase.tracking={installed:{...X.current},dataLayerName:te,clientId:i};const n=Object.keys(X.current).length>0,r=null!==R||0===_.scripts.length;(n||r)&&E(!0)},[o,_,re,$,R,te,ne,ie,i]),t.useEffect(()=>{if(!o||!s||!_?.enabled)return;if("undefined"==typeof window)return;if(!ie)return;let e=null;const t=()=>{e&&clearTimeout(e),e=setTimeout(()=>function(e,t){const n=L();if(!n)return;const r=n[t];Array.isArray(r)&&r.push({event:"page_view",page_path:n.location.pathname,page_location:n.location.href,page_title:n.document.title});for(const t of e)switch(t.provider){case"ga4":n.gtag?.("event","page_view",{send_to:t.providerId,page_path:n.location.pathname,page_location:n.location.href,page_title:n.document.title});break;case"meta_pixel":n.fbq?.("track","PageView");break;case"tiktok":{const e=n.ttq;e?.page?.();break}case"reddit":n.rdt?.("track","PageVisit")}}(re,te),50)},n=window.history,r=n.pushState,i=n.replaceState;return n.pushState=function(...e){const n=r.apply(this,e);return t(),n},n.replaceState=function(...e){const n=i.apply(this,e);return t(),n},window.addEventListener("popstate",t),()=>{n.pushState=r,n.replaceState=i,window.removeEventListener("popstate",t),e&&clearTimeout(e)}},[o,s,_?.enabled,re,te,ie]),t.useEffect(()=>{if(!o)return;const e=function(e,t){const n=e?.mode??"auto",r=e?.overrides??{};if(("manual"===n||Object.values(r).some(e=>"manual"===e))&&!t)return'[buildbase:tracking] events are set to "manual" but no onEvent handler was provided, so those events would never fire anywhere. Pass onEvent, or use mode "auto".';for(const e of Object.keys(r))if(!U(e))return`[buildbase:tracking] unknown event "${e}" in events.overrides. Overrides only apply to the events the SDK fires itself.`;return null}(l,!!u);if(e)throw new Error(e)},[o,l,u]);const ae=t.useCallback((e,t={},n)=>{if(!o)return;const r=n?.eventId||function(){const e=globalThis.crypto;return e?.randomUUID?e.randomUUID():`${Date.now().toString(16)}-${Math.random().toString(16).slice(2,10)}`}(),i=l?.mode??"auto",a=(U(e)?l?.overrides?.[e]:void 0)??i,s={...V.current,...F.current,...W,...t},c=G.current?.({name:e,params:s})??{},d={...s,...c},u=N.current?.({name:e,params:d,eventId:r,handledBy:a});"manual"!==a&&!0!==u?(!function(e,t,n,r,i){const o=L();if(!o)return;const a=o[i];Array.isArray(a)&&a.push({event:e,...t,event_id:n});const s=U(e)?O[e]:{ga4:e,meta:null,tiktok:null,reddit:null};for(const i of r){const r=i.provider,a=x[r];if(a){if(a.needsConversionIds){const a=i.conversionIds?.[e];if(!a)continue;"google_ads"===r?o.gtag?.("event","conversion",{send_to:`${i.providerId}/${a}`,transaction_id:n,...t}):"x_pixel"===r?o.twq?.("event",a,{...t,conversion_id:n}):"linkedin"===r&&o.lintrk?.("track",{conversion_id:a});continue}switch(r){case"ga4":s.ga4&&o.gtag?.("event",s.ga4,{...t,send_to:i.providerId,event_id:n});break;case"meta_pixel":s.meta&&o.fbq?.("track",s.meta,t,{eventID:n});break;case"tiktok":if(s.tiktok){const e=o.ttq;e?.track?.(s.tiktok,{...t,event_id:n})}break;case"reddit":s.reddit&&o.rdt?.("track",s.reddit,{...t,conversionId:n});break;case"bing_uet":{const r=o.uetq;r?.push?.("event",s.ga4??e,{...t,event_id:n});break}case"clarity":o.clarity?.("event",e);break;case"hotjar":{const t=o.hj;t?.("event",e);break}case"posthog":{const r=o.posthog;r?.capture?.(e,{...t,event_id:n});break}case"plausible":o.plausible?.(e,{props:t})}}}}(e,d,r,re,te),ne("event fired:",e,r)):ne("event handled by app:",e)},[o,l,re,te,W,ne]),se=t.useCallback(async(e,t={})=>{const i=function(e){return{name:"trial_started"===e.kind?"trial_started":"purchase",params:{...e.workspaceId?{workspace_id:e.workspaceId}:{},...e.planVersionId?{plan_version_id:e.planVersionId}:{},...e.creditPackageId?{credit_package_id:e.creditPackageId}:{},...e.billingInterval?{billing_interval:e.billingInterval}:{},...e.currency?{currency:e.currency.toUpperCase()}:{},..."number"==typeof e.value?{value:e.value}:{},...e.sessionId?{transaction_id:e.sessionId}:{}}}}(e);let o=i.params;if(e.sessionId&&n&&r){const t=await async function(e,t){try{const n=e.serverUrl.replace(/\/$/,""),r=await fetch(`${n}/api/v1/public/${encodeURIComponent(e.orgId)}/checkout/${encodeURIComponent(t)}`,{credentials:"omit",..."undefined"!=typeof AbortSignal&&AbortSignal.timeout?{signal:AbortSignal.timeout(2e3)}:{}});if(!r.ok)return null;const i=await r.json(),o=i?.data??i;return"number"!=typeof o?.amount?null:{value:b(o.amount,o.currency),currency:"string"==typeof o.currency?o.currency:void 0,...Array.isArray(o.items)&&o.items.length?{items:o.items}:{}}}catch{return null}}({serverUrl:n,orgId:r},e.sessionId);t&&"number"==typeof t.value&&(o={...o,value:t.value,...t.currency?{currency:t.currency.toUpperCase()}:{},...t.items?.length?{items:t.items}:{}})}if(ae(i.name,{...o,...t},{eventId:e.eventId}),"purchase"===i.name&&e.sessionId&&n&&r){const t=(_?.scripts??[]).find(e=>"ga4"===e.provider&&e.providerId);t&&z("ga4",t.providerId??"")&&function(e,t,n){try{const r=e.serverUrl.replace(/\/$/,"");fetch(`${r}/api/v1/public/${encodeURIComponent(e.orgId)}/checkout/${encodeURIComponent(t)}/reported`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:n}),keepalive:!0,credentials:"omit"}).catch(()=>{})}catch{}}({serverUrl:n,orgId:r},e.sessionId,"ga4")}},[n,r,ae,_]),[ce]=t.useState(()=>"undefined"==typeof window?"":window.location.search);t.useEffect(()=>{if(!o||!S)return;if("undefined"==typeof window)return;const e=w(window.location.search);if(e)return void se(e);const t=v(ce);t&&ae("checkout_abandoned",{...t.workspaceId?{workspace_id:t.workspaceId}:{},...t.planVersionId?{plan_version_id:t.planVersionId}:{},...t.creditPackageId?{credit_package_id:t.creditPackageId}:{},...t.billingInterval?{billing_interval:t.billingInterval}:{},...t.currency?{currency:t.currency.toUpperCase()}:{},..."number"==typeof t.value?{value:t.value}:{},seconds_at_checkout:Math.max(0,Math.round((Date.now()-t.startedAt)/1e3))})},[o,S,se,ce,ae]);const de=t.useCallback(e=>{D.current=e,M(e),C(e)},[]),le=t.useCallback((e,t)=>function(e,t,n){const r=L();if(!r)return;const i=!!n&&Object.keys(n).length>0;for(const o of t)switch(o.provider){case"ga4":case"google_ads":r.gtag?.("set",{user_id:e}),i&&r.gtag?.("set",{user_properties:n});break;case"meta_pixel":o.providerId&&r.fbq?.("init",o.providerId,{external_id:e});break;case"posthog":r.posthog?.identify?.(e,i?n:void 0);break;case"clarity":if(r.clarity?.("identify",e),i)for(const[e,t]of Object.entries(n))r.clarity?.("set",e,String(t));break;case"hotjar":r.hj?.("identify",e,{});break;case"tiktok":{const t=r.ttq;t?.identify?.({external_id:e});break}}}(e,re,t),[re]),ue=t.useMemo(()=>({consent:{manifest:_?.consent?.manifest??[],state:R,set:de},track:ae,setUser:le,setProperties:J,getProperties:Z,completeCheckout:se,installed:{...X.current},ready:S,attribution:W}),[_,R,de,ae,le,J,Z,se,S,Y,W]);return e.jsx(K.Provider,{value:ue,children:h})};X.displayName="BuildBaseTracking";exports.ATTRIBUTION_PARAMS=r,exports.BuildBaseTracking=X,exports.EVENT_MAPPINGS=O,exports.FUNNEL_EVENTS={sign_in_started:"The sign-in / sign-up button was pressed.",pricing_viewed:"A <PricingPage> finished loading its plans.",pricing_plan_selected:"A plan was chosen on a <PricingPage>.",workspace_switcher_opened:"The workspace switcher was opened.",workspace_settings_opened:"The workspace settings modal was opened.",workspace_settings_section_viewed:"A different section of the settings modal was opened.",plan_picker_opened:"The plan picker was shown.",billing_interval_changed:"Monthly / quarterly / yearly was switched in the plan picker.",plan_selected:"A plan was chosen in the plan picker.",plan_picker_dismissed:"The plan picker was closed without choosing a plan.",checkout_abandoned:"The customer came back from Stripe without paying.",billing_portal_opened:"Stripe’s billing portal was opened.",subscription_cancel_started:"The cancel-subscription confirmation was opened.",subscription_cancelled:"A subscription was cancelled.",subscription_resumed:"A cancelled subscription was resumed.",feature_gate_shown:'A feature gate rendered its "not on your plan" side.',quota_limit_reached:"A quota gate rendered because a quota is used up.",quota_threshold_reached:"A usage-threshold gate rendered.",plan_gate_shown:'A plan gate rendered its "needs another plan" side.',subscription_notice_shown:"A billing notice (trial ending, payment failed…) was shown.",sdk_error:"An SDK operation failed (component, action and code only)."},exports.TAG_PROVIDERS=x,exports.TAG_PROVIDER_IDS=$,exports.TAG_SCRIPT_ORIGINS=E,exports.captureAttribution=c,exports.getAttribution=function(){const e=o();return e?s(e.document):{}},exports.isCanonicalEvent=U,exports.isTagProviderId=j,exports.isValidProviderId=A,exports.useCheckoutCompleted=function(e={}){const{completeCheckout:n,ready:r}=Q(),i=t.useRef(e);i.current=e;const o=t.useRef(!1);t.useEffect(()=>{if(!r)return;if(o.current)return;const e=w(window.location.search)??h();e&&(o.current=!0,n(e,i.current))},[r,n])},exports.useTracking=Q;
|