@clerk/react 6.0.0-snapshot.v20251208202852 → 6.0.0-snapshot.v20251211120550
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/dist/{chunk-2XN2S2YH.mjs → chunk-4F7CSI4T.mjs} +2 -2
- package/dist/{chunk-PS5BRRRD.mjs → chunk-J32KHXBI.mjs} +1 -1
- package/dist/{chunk-PS5BRRRD.mjs.map → chunk-J32KHXBI.mjs.map} +1 -1
- package/dist/{chunk-FGM7Y3PB.mjs → chunk-YKGYOPLG.mjs} +2 -2
- package/dist/experimental.d.mts +2 -2
- package/dist/experimental.d.ts +2 -2
- package/dist/experimental.js.map +1 -1
- package/dist/experimental.mjs +2 -2
- package/dist/experimental.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/internal.d.mts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js.map +1 -1
- package/dist/internal.mjs +2 -2
- package/dist/{useAuth-Deiz0BGe.d.mts → useAuth-CWdoLXfj.d.mts} +1 -1
- package/dist/{useAuth-QSe8Smhk.d.ts → useAuth-D6F79Q4u.d.ts} +1 -1
- package/package.json +4 -4
- /package/dist/{chunk-2XN2S2YH.mjs.map → chunk-4F7CSI4T.mjs.map} +0 -0
- /package/dist/{chunk-FGM7Y3PB.mjs.map → chunk-YKGYOPLG.mjs.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/CheckoutButton.tsx","../src/components/PlanDetailsButton.tsx","../src/components/SubscriptionDetailsButton.tsx","../src/experimental.ts"],"sourcesContent":["import type { __experimental_CheckoutButtonProps } from '@clerk/shared/types';\nimport React from 'react';\n\nimport { useAuth } from '../hooks';\nimport type { WithClerkProp } from '../types';\nimport { assertSingleChild, normalizeWithDefaultValue, safeExecute } from '../utils';\nimport { withClerk } from './withClerk';\n\n/**\n * A button component that opens the Clerk Checkout drawer when clicked. This component must be rendered\n * inside a `<SignedIn />` component to ensure the user is authenticated.\n *\n * @example\n * ```tsx\n * import { SignedIn } from '@clerk/react';\n * import { CheckoutButton } from '@clerk/react/experimental';\n *\n * // Basic usage with default \"Checkout\" text\n * function BasicCheckout() {\n * return (\n * <SignedIn>\n * <CheckoutButton planId=\"plan_123\" />\n * </SignedIn>\n * );\n * }\n *\n * // Custom button with organization subscription\n * function OrganizationCheckout() {\n * return (\n * <SignedIn>\n * <CheckoutButton\n * planId=\"plan_123\"\n * planPeriod=\"month\"\n * for=\"organization\"\n * onSubscriptionComplete={() => console.log('Subscription completed!')}\n * >\n * <button className=\"custom-button\">Subscribe Now</button>\n * </CheckoutButton>\n * </SignedIn>\n * );\n * }\n * ```\n *\n * @throws {Error} When rendered outside of a `<SignedIn />` component\n * @throws {Error} When `for=\"organization\"` is used without an active organization context\n *\n * @experimental This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change. It is advised to [pin](https://clerk.com/docs/pinning) the SDK version and the clerk-js version to avoid breaking changes.\n */\nexport const CheckoutButton = withClerk(\n ({ clerk, children, ...props }: WithClerkProp<React.PropsWithChildren<__experimental_CheckoutButtonProps>>) => {\n const {\n planId,\n planPeriod,\n for: _for,\n onSubscriptionComplete,\n newSubscriptionRedirectUrl,\n checkoutProps,\n ...rest\n } = props;\n\n const { userId, orgId } = useAuth();\n\n if (userId === null) {\n throw new Error('Clerk: Ensure that `<CheckoutButton />` is rendered inside a `<SignedIn />` component.');\n }\n\n if (orgId === null && _for === 'organization') {\n throw new Error(\n 'Clerk: Wrap `<CheckoutButton for=\"organization\" />` with a check for an active organization. Retrieve `orgId` from `useAuth()` and confirm it is defined. For SSR, see: https://clerk.com/docs/reference/backend/types/auth-object#how-to-access-the-auth-object',\n );\n }\n\n children = normalizeWithDefaultValue(children, 'Checkout');\n const child = assertSingleChild(children)('CheckoutButton');\n\n const clickHandler = () => {\n if (!clerk) {\n return;\n }\n\n return clerk.__internal_openCheckout({\n planId,\n planPeriod,\n for: _for,\n onSubscriptionComplete,\n newSubscriptionRedirectUrl,\n ...checkoutProps,\n });\n };\n\n const wrappedChildClickHandler: React.MouseEventHandler = async e => {\n if (child && typeof child === 'object' && 'props' in child) {\n await safeExecute(child.props.onClick)(e);\n }\n return clickHandler();\n };\n\n const childProps = { ...rest, onClick: wrappedChildClickHandler };\n return React.cloneElement(child as React.ReactElement<unknown>, childProps);\n },\n { component: 'CheckoutButton', renderWhileLoading: true },\n);\n","import type { __experimental_PlanDetailsButtonProps } from '@clerk/shared/types';\nimport React from 'react';\n\nimport type { WithClerkProp } from '../types';\nimport { assertSingleChild, normalizeWithDefaultValue, safeExecute } from '../utils';\nimport { withClerk } from './withClerk';\n\n/**\n * A button component that opens the Clerk Plan Details drawer when clicked. This component is part of\n * Clerk's Billing feature which is available under a public beta.\n *\n * @example\n * ```tsx\n * import { SignedIn } from '@clerk/react';\n * import { PlanDetailsButton } from '@clerk/react/experimental';\n *\n * // Basic usage with default \"Plan details\" text\n * function BasicPlanDetails() {\n * return (\n * <PlanDetailsButton planId=\"plan_123\" />\n * );\n * }\n *\n * // Custom button with custom text\n * function CustomPlanDetails() {\n * return (\n * <PlanDetailsButton planId=\"plan_123\">\n * <button>View Plan Details</button>\n * </PlanDetailsButton>\n * );\n * }\n * ```\n *\n * @experimental This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change. It is advised to [pin](https://clerk.com/docs/pinning) the SDK version and the clerk-js version to avoid breaking changes.\n */\nexport const PlanDetailsButton = withClerk(\n ({ clerk, children, ...props }: WithClerkProp<React.PropsWithChildren<__experimental_PlanDetailsButtonProps>>) => {\n const { plan, planId, initialPlanPeriod, planDetailsProps, ...rest } = props;\n\n children = normalizeWithDefaultValue(children, 'Plan details');\n const child = assertSingleChild(children)('PlanDetailsButton');\n\n const clickHandler = () => {\n if (!clerk) {\n return;\n }\n\n return clerk.__internal_openPlanDetails({\n plan,\n planId,\n initialPlanPeriod,\n ...planDetailsProps,\n } as __experimental_PlanDetailsButtonProps);\n };\n\n const wrappedChildClickHandler: React.MouseEventHandler = async e => {\n if (child && typeof child === 'object' && 'props' in child) {\n await safeExecute(child.props.onClick)(e);\n }\n return clickHandler();\n };\n\n const childProps = { ...rest, onClick: wrappedChildClickHandler };\n return React.cloneElement(child as React.ReactElement<unknown>, childProps);\n },\n { component: 'PlanDetailsButton', renderWhileLoading: true },\n);\n","import type { __experimental_SubscriptionDetailsButtonProps } from '@clerk/shared/types';\nimport React from 'react';\n\nimport { useAuth } from '../hooks';\nimport type { WithClerkProp } from '../types';\nimport { assertSingleChild, normalizeWithDefaultValue, safeExecute } from '../utils';\nimport { withClerk } from './withClerk';\n\n/**\n * A button component that opens the Clerk Subscription Details drawer when clicked. This component must be rendered inside a `<SignedIn />` component to ensure the user is authenticated.\n *\n * @example\n * ```tsx\n * import { SignedIn } from '@clerk/react';\n * import { SubscriptionDetailsButton } from '@clerk/react/experimental';\n *\n * // Basic usage with default \"Subscription details\" text\n * function BasicSubscriptionDetails() {\n * return (\n * <SubscriptionDetailsButton />\n * );\n * }\n *\n * // Custom button with organization subscription\n * function OrganizationSubscriptionDetails() {\n * return (\n * <SubscriptionDetailsButton\n * for=\"organization\"\n * onSubscriptionCancel={() => console.log('Subscription canceled')}\n * >\n * <button>View Organization Subscription</button>\n * </SubscriptionDetailsButton>\n * );\n * }\n * ```\n *\n * @throws {Error} When rendered outside of a `<SignedIn />` component\n * @throws {Error} When `for=\"organization\"` is used without an active organization context\n *\n * @experimental This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change. It is advised to [pin](https://clerk.com/docs/pinning) the SDK version and the clerk-js version to avoid breaking changes.\n */\nexport const SubscriptionDetailsButton = withClerk(\n ({\n clerk,\n children,\n ...props\n }: WithClerkProp<React.PropsWithChildren<__experimental_SubscriptionDetailsButtonProps>>) => {\n const { for: _for, subscriptionDetailsProps, onSubscriptionCancel, ...rest } = props;\n children = normalizeWithDefaultValue(children, 'Subscription details');\n const child = assertSingleChild(children)('SubscriptionDetailsButton');\n\n const { userId, orgId } = useAuth();\n\n if (userId === null) {\n throw new Error(\n 'Clerk: Ensure that `<SubscriptionDetailsButton />` is rendered inside a `<SignedIn />` component.',\n );\n }\n\n if (orgId === null && _for === 'organization') {\n throw new Error(\n 'Clerk: Wrap `<SubscriptionDetailsButton for=\"organization\" />` with a check for an active organization. Retrieve `orgId` from `useAuth()` and confirm it is defined. For SSR, see: https://clerk.com/docs/reference/backend/types/auth-object#how-to-access-the-auth-object',\n );\n }\n\n const clickHandler = () => {\n if (!clerk) {\n return;\n }\n\n return clerk.__internal_openSubscriptionDetails({\n for: _for,\n onSubscriptionCancel,\n ...subscriptionDetailsProps,\n });\n };\n\n const wrappedChildClickHandler: React.MouseEventHandler = async e => {\n if (child && typeof child === 'object' && 'props' in child) {\n await safeExecute(child.props.onClick)(e);\n }\n return clickHandler();\n };\n\n const childProps = { ...rest, onClick: wrappedChildClickHandler };\n return React.cloneElement(child as React.ReactElement<unknown>, childProps);\n },\n { component: 'SubscriptionDetailsButton', renderWhileLoading: true },\n);\n","export { CheckoutButton } from './components/CheckoutButton';\nexport { PlanDetailsButton } from './components/PlanDetailsButton';\nexport { SubscriptionDetailsButton } from './components/SubscriptionDetailsButton';\n\nexport type {\n __experimental_CheckoutButtonProps as CheckoutButtonProps,\n __experimental_SubscriptionDetailsButtonProps as SubscriptionDetailsButtonProps,\n __experimental_PlanDetailsButtonProps as PlanDetailsButtonProps,\n} from '@clerk/shared/types';\n\nexport {\n __experimental_useAPIKeys as useAPIKeys,\n __experimental_PaymentElementProvider as PaymentElementProvider,\n __experimental_usePaymentElement as usePaymentElement,\n __experimental_PaymentElement as PaymentElement,\n __experimental_usePaymentAttempts as usePaymentAttempts,\n __experimental_useStatements as useStatements,\n __experimental_usePaymentMethods as usePaymentMethods,\n __experimental_usePlans as usePlans,\n __experimental_useSubscription as useSubscription,\n __experimental_CheckoutProvider as CheckoutProvider,\n __experimental_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L,CAAC;AAAA,IACH;AAEA,UAAM,2BAAoD,OAAM,MAAK;AACnE,UAAI,SAAS,OAAO,UAAU,YAAY,WAAW,OAAO;AAC1D,cAAM,YAAY,MAAM,MAAM,OAAO,EAAE,CAAC;AAAA,MAC1C;AACA,aAAO,aAAa;AAAA,IACtB;AAEA,UAAM,aAAa,EAAE,GAAG,MAAM,SAAS,yBAAyB;AAChE,WAAOC,OAAM,aAAa,OAAsC,UAAU;AAAA,EAC5E;AAAA,EACA,EAAE,WAAW,6BAA6B,oBAAoB,KAAK;AACrE;;;AC9EA;AAAA,EAC+B;AAAA,EACY;AAAA,EACL;AAAA,EACH;AAAA,EACI;AAAA,EACL;AAAA,EACI;AAAA,EACT;AAAA,EACO;AAAA,EACC;AAAA,EACL;AAAA,OACzB;","names":["React","React","React","React"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/CheckoutButton.tsx","../src/components/PlanDetailsButton.tsx","../src/components/SubscriptionDetailsButton.tsx","../src/experimental.ts"],"sourcesContent":["import type { __experimental_CheckoutButtonProps } from '@clerk/shared/types';\nimport React from 'react';\n\nimport { useAuth } from '../hooks';\nimport type { WithClerkProp } from '../types';\nimport { assertSingleChild, normalizeWithDefaultValue, safeExecute } from '../utils';\nimport { withClerk } from './withClerk';\n\n/**\n * A button component that opens the Clerk Checkout drawer when clicked. This component must be rendered\n * inside a `<SignedIn />` component to ensure the user is authenticated.\n *\n * @example\n * ```tsx\n * import { SignedIn } from '@clerk/react';\n * import { CheckoutButton } from '@clerk/react/experimental';\n *\n * // Basic usage with default \"Checkout\" text\n * function BasicCheckout() {\n * return (\n * <SignedIn>\n * <CheckoutButton planId=\"plan_123\" />\n * </SignedIn>\n * );\n * }\n *\n * // Custom button with organization subscription\n * function OrganizationCheckout() {\n * return (\n * <SignedIn>\n * <CheckoutButton\n * planId=\"plan_123\"\n * planPeriod=\"month\"\n * for=\"organization\"\n * onSubscriptionComplete={() => console.log('Subscription completed!')}\n * >\n * <button className=\"custom-button\">Subscribe Now</button>\n * </CheckoutButton>\n * </SignedIn>\n * );\n * }\n * ```\n *\n * @throws {Error} When rendered outside of a `<SignedIn />` component\n * @throws {Error} When `for=\"organization\"` is used without an active organization context\n *\n * @experimental This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change. It is advised to [pin](https://clerk.com/docs/pinning) the SDK version and the clerk-js version to avoid breaking changes.\n */\nexport const CheckoutButton = withClerk(\n ({ clerk, children, ...props }: WithClerkProp<React.PropsWithChildren<__experimental_CheckoutButtonProps>>) => {\n const {\n planId,\n planPeriod,\n for: _for,\n onSubscriptionComplete,\n newSubscriptionRedirectUrl,\n checkoutProps,\n ...rest\n } = props;\n\n const { userId, orgId } = useAuth();\n\n if (userId === null) {\n throw new Error('Clerk: Ensure that `<CheckoutButton />` is rendered inside a `<SignedIn />` component.');\n }\n\n if (orgId === null && _for === 'organization') {\n throw new Error(\n 'Clerk: Wrap `<CheckoutButton for=\"organization\" />` with a check for an active organization. Retrieve `orgId` from `useAuth()` and confirm it is defined. For SSR, see: https://clerk.com/docs/reference/backend/types/auth-object#how-to-access-the-auth-object',\n );\n }\n\n children = normalizeWithDefaultValue(children, 'Checkout');\n const child = assertSingleChild(children)('CheckoutButton');\n\n const clickHandler = () => {\n if (!clerk) {\n return;\n }\n\n return clerk.__internal_openCheckout({\n planId,\n planPeriod,\n for: _for,\n onSubscriptionComplete,\n newSubscriptionRedirectUrl,\n ...checkoutProps,\n });\n };\n\n const wrappedChildClickHandler: React.MouseEventHandler = async e => {\n if (child && typeof child === 'object' && 'props' in child) {\n await safeExecute(child.props.onClick)(e);\n }\n return clickHandler();\n };\n\n const childProps = { ...rest, onClick: wrappedChildClickHandler };\n return React.cloneElement(child as React.ReactElement<unknown>, childProps);\n },\n { component: 'CheckoutButton', renderWhileLoading: true },\n);\n","import type { __experimental_PlanDetailsButtonProps } from '@clerk/shared/types';\nimport React from 'react';\n\nimport type { WithClerkProp } from '../types';\nimport { assertSingleChild, normalizeWithDefaultValue, safeExecute } from '../utils';\nimport { withClerk } from './withClerk';\n\n/**\n * A button component that opens the Clerk Plan Details drawer when clicked. This component is part of\n * Clerk's Billing feature which is available under a public beta.\n *\n * @example\n * ```tsx\n * import { SignedIn } from '@clerk/react';\n * import { PlanDetailsButton } from '@clerk/react/experimental';\n *\n * // Basic usage with default \"Plan details\" text\n * function BasicPlanDetails() {\n * return (\n * <PlanDetailsButton planId=\"plan_123\" />\n * );\n * }\n *\n * // Custom button with custom text\n * function CustomPlanDetails() {\n * return (\n * <PlanDetailsButton planId=\"plan_123\">\n * <button>View Plan Details</button>\n * </PlanDetailsButton>\n * );\n * }\n * ```\n *\n * @experimental This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change. It is advised to [pin](https://clerk.com/docs/pinning) the SDK version and the clerk-js version to avoid breaking changes.\n */\nexport const PlanDetailsButton = withClerk(\n ({ clerk, children, ...props }: WithClerkProp<React.PropsWithChildren<__experimental_PlanDetailsButtonProps>>) => {\n const { plan, planId, initialPlanPeriod, planDetailsProps, ...rest } = props;\n\n children = normalizeWithDefaultValue(children, 'Plan details');\n const child = assertSingleChild(children)('PlanDetailsButton');\n\n const clickHandler = () => {\n if (!clerk) {\n return;\n }\n\n return clerk.__internal_openPlanDetails({\n plan,\n planId,\n initialPlanPeriod,\n ...planDetailsProps,\n } as __experimental_PlanDetailsButtonProps);\n };\n\n const wrappedChildClickHandler: React.MouseEventHandler = async e => {\n if (child && typeof child === 'object' && 'props' in child) {\n await safeExecute(child.props.onClick)(e);\n }\n return clickHandler();\n };\n\n const childProps = { ...rest, onClick: wrappedChildClickHandler };\n return React.cloneElement(child as React.ReactElement<unknown>, childProps);\n },\n { component: 'PlanDetailsButton', renderWhileLoading: true },\n);\n","import type { __experimental_SubscriptionDetailsButtonProps } from '@clerk/shared/types';\nimport React from 'react';\n\nimport { useAuth } from '../hooks';\nimport type { WithClerkProp } from '../types';\nimport { assertSingleChild, normalizeWithDefaultValue, safeExecute } from '../utils';\nimport { withClerk } from './withClerk';\n\n/**\n * A button component that opens the Clerk Subscription Details drawer when clicked. This component must be rendered inside a `<SignedIn />` component to ensure the user is authenticated.\n *\n * @example\n * ```tsx\n * import { SignedIn } from '@clerk/react';\n * import { SubscriptionDetailsButton } from '@clerk/react/experimental';\n *\n * // Basic usage with default \"Subscription details\" text\n * function BasicSubscriptionDetails() {\n * return (\n * <SubscriptionDetailsButton />\n * );\n * }\n *\n * // Custom button with Organization Subscription\n * function OrganizationSubscriptionDetails() {\n * return (\n * <SubscriptionDetailsButton\n * for=\"organization\"\n * onSubscriptionCancel={() => console.log('Subscription canceled')}\n * >\n * <button>View Organization Subscription</button>\n * </SubscriptionDetailsButton>\n * );\n * }\n * ```\n *\n * @throws {Error} When rendered outside of a `<SignedIn />` component\n * @throws {Error} When `for=\"organization\"` is used without an Active Organization context\n *\n * @experimental This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change. It is advised to [pin](https://clerk.com/docs/pinning) the SDK version and the clerk-js version to avoid breaking changes.\n */\nexport const SubscriptionDetailsButton = withClerk(\n ({\n clerk,\n children,\n ...props\n }: WithClerkProp<React.PropsWithChildren<__experimental_SubscriptionDetailsButtonProps>>) => {\n const { for: _for, subscriptionDetailsProps, onSubscriptionCancel, ...rest } = props;\n children = normalizeWithDefaultValue(children, 'Subscription details');\n const child = assertSingleChild(children)('SubscriptionDetailsButton');\n\n const { userId, orgId } = useAuth();\n\n if (userId === null) {\n throw new Error(\n 'Clerk: Ensure that `<SubscriptionDetailsButton />` is rendered inside a `<SignedIn />` component.',\n );\n }\n\n if (orgId === null && _for === 'organization') {\n throw new Error(\n 'Clerk: Wrap `<SubscriptionDetailsButton for=\"organization\" />` with a check for an active organization. Retrieve `orgId` from `useAuth()` and confirm it is defined. For SSR, see: https://clerk.com/docs/reference/backend/types/auth-object#how-to-access-the-auth-object',\n );\n }\n\n const clickHandler = () => {\n if (!clerk) {\n return;\n }\n\n return clerk.__internal_openSubscriptionDetails({\n for: _for,\n onSubscriptionCancel,\n ...subscriptionDetailsProps,\n });\n };\n\n const wrappedChildClickHandler: React.MouseEventHandler = async e => {\n if (child && typeof child === 'object' && 'props' in child) {\n await safeExecute(child.props.onClick)(e);\n }\n return clickHandler();\n };\n\n const childProps = { ...rest, onClick: wrappedChildClickHandler };\n return React.cloneElement(child as React.ReactElement<unknown>, childProps);\n },\n { component: 'SubscriptionDetailsButton', renderWhileLoading: true },\n);\n","export { CheckoutButton } from './components/CheckoutButton';\nexport { PlanDetailsButton } from './components/PlanDetailsButton';\nexport { SubscriptionDetailsButton } from './components/SubscriptionDetailsButton';\n\nexport type {\n __experimental_CheckoutButtonProps as CheckoutButtonProps,\n __experimental_SubscriptionDetailsButtonProps as SubscriptionDetailsButtonProps,\n __experimental_PlanDetailsButtonProps as PlanDetailsButtonProps,\n} from '@clerk/shared/types';\n\nexport {\n __experimental_useAPIKeys as useAPIKeys,\n __experimental_PaymentElementProvider as PaymentElementProvider,\n __experimental_usePaymentElement as usePaymentElement,\n __experimental_PaymentElement as PaymentElement,\n __experimental_usePaymentAttempts as usePaymentAttempts,\n __experimental_useStatements as useStatements,\n __experimental_usePaymentMethods as usePaymentMethods,\n __experimental_usePlans as usePlans,\n __experimental_useSubscription as useSubscription,\n __experimental_CheckoutProvider as CheckoutProvider,\n __experimental_useCheckout as useCheckout,\n} from '@clerk/shared/react';\n"],"mappings":";;;;;;;;;;;;;AACA,OAAO,WAAW;AA+CX,IAAM,iBAAiB;AAAA,EAC5B,CAAC,EAAE,OAAO,UAAU,GAAG,MAAM,MAAkF;AAC7G,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA,KAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL,IAAI;AAEJ,UAAM,EAAE,QAAQ,MAAM,IAAI,QAAQ;AAElC,QAAI,WAAW,MAAM;AACnB,YAAM,IAAI,MAAM,wFAAwF;AAAA,IAC1G;AAEA,QAAI,UAAU,QAAQ,SAAS,gBAAgB;AAC7C,YAAM,IAAI;A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,EACO;AAAA,EACC;AAAA,EACL;AAAA,OACzB;","names":["React","React","React","React"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ import { Without, APIKeysProps, CreateOrganizationProps, OrganizationListProps,
|
|
|
4
4
|
export { BrowserClerk, BrowserClerkConstructor, ClerkProp, HeadlessBrowserClerk, HeadlessBrowserClerkConstructor, IsomorphicClerkOptions } from '@clerk/shared/types';
|
|
5
5
|
import React, { ReactNode, PropsWithChildren } from 'react';
|
|
6
6
|
import { W as WithClerkProp, O as OrganizationProfilePageProps, a as OrganizationProfileLinkProps, U as UserProfilePageProps, b as UserProfileLinkProps, c as UserButtonActionProps, d as UserButtonLinkProps, S as SignInWithMetamaskButtonProps, C as ClerkProviderProps } from './types-C7pBea4d.mjs';
|
|
7
|
-
export { A as AuthenticateWithRedirectCallback, C as ClerkDegraded, a as ClerkFailed, b as ClerkLoaded, c as ClerkLoading, P as Protect, j as ProtectProps, R as RedirectToCreateOrganization, d as RedirectToOrganizationProfile, e as RedirectToSignIn, f as RedirectToSignUp, g as RedirectToTasks, h as RedirectToUserProfile, S as SignedIn, i as SignedOut, k as useAuth } from './useAuth-
|
|
7
|
+
export { A as AuthenticateWithRedirectCallback, C as ClerkDegraded, a as ClerkFailed, b as ClerkLoaded, c as ClerkLoading, P as Protect, j as ProtectProps, R as RedirectToCreateOrganization, d as RedirectToOrganizationProfile, e as RedirectToSignIn, f as RedirectToSignUp, g as RedirectToTasks, h as RedirectToUserProfile, S as SignedIn, i as SignedOut, k as useAuth } from './useAuth-CWdoLXfj.mjs';
|
|
8
8
|
export { __experimental_CheckoutProvider, __experimental_PaymentElement, __experimental_PaymentElementProvider, __experimental_useCheckout, __experimental_usePaymentElement, useClerk, useOrganization, useOrganizationList, useReverification, useSession, useSessionList, useUser } from '@clerk/shared/react';
|
|
9
9
|
import '@clerk/shared/ui';
|
|
10
10
|
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Without, APIKeysProps, CreateOrganizationProps, OrganizationListProps,
|
|
|
4
4
|
export { BrowserClerk, BrowserClerkConstructor, ClerkProp, HeadlessBrowserClerk, HeadlessBrowserClerkConstructor, IsomorphicClerkOptions } from '@clerk/shared/types';
|
|
5
5
|
import React, { ReactNode, PropsWithChildren } from 'react';
|
|
6
6
|
import { W as WithClerkProp, O as OrganizationProfilePageProps, a as OrganizationProfileLinkProps, U as UserProfilePageProps, b as UserProfileLinkProps, c as UserButtonActionProps, d as UserButtonLinkProps, S as SignInWithMetamaskButtonProps, C as ClerkProviderProps } from './types-C7pBea4d.js';
|
|
7
|
-
export { A as AuthenticateWithRedirectCallback, C as ClerkDegraded, a as ClerkFailed, b as ClerkLoaded, c as ClerkLoading, P as Protect, j as ProtectProps, R as RedirectToCreateOrganization, d as RedirectToOrganizationProfile, e as RedirectToSignIn, f as RedirectToSignUp, g as RedirectToTasks, h as RedirectToUserProfile, S as SignedIn, i as SignedOut, k as useAuth } from './useAuth-
|
|
7
|
+
export { A as AuthenticateWithRedirectCallback, C as ClerkDegraded, a as ClerkFailed, b as ClerkLoaded, c as ClerkLoading, P as Protect, j as ProtectProps, R as RedirectToCreateOrganization, d as RedirectToOrganizationProfile, e as RedirectToSignIn, f as RedirectToSignUp, g as RedirectToTasks, h as RedirectToUserProfile, S as SignedIn, i as SignedOut, k as useAuth } from './useAuth-D6F79Q4u.js';
|
|
8
8
|
export { __experimental_CheckoutProvider, __experimental_PaymentElement, __experimental_PaymentElementProvider, __experimental_useCheckout, __experimental_usePaymentElement, useClerk, useOrganization, useOrganizationList, useReverification, useSession, useSessionList, useUser } from '@clerk/shared/react';
|
|
9
9
|
import '@clerk/shared/ui';
|
|
10
10
|
|
package/dist/index.js
CHANGED
|
@@ -1968,7 +1968,7 @@ if (typeof globalThis.__BUILD_DISABLE_RHC__ === "undefined") {
|
|
|
1968
1968
|
}
|
|
1969
1969
|
var SDK_METADATA = {
|
|
1970
1970
|
name: "@clerk/react",
|
|
1971
|
-
version: "6.0.0-snapshot.
|
|
1971
|
+
version: "6.0.0-snapshot.v20251211120550",
|
|
1972
1972
|
environment: process.env.NODE_ENV
|
|
1973
1973
|
};
|
|
1974
1974
|
var _status, _domain, _proxyUrl, _publishableKey, _eventBus, _stateProxy, _instance, _IsomorphicClerk_instances, waitForClerkJS_fn;
|