@clerk/react 6.9.0 → 6.9.1-canary.v20260610190754

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/ClerkProvider-9lxHp9j5.cjs +1623 -0
  2. package/dist/ClerkProvider-9lxHp9j5.cjs.map +1 -0
  3. package/dist/ClerkProvider-LQpPtmNL.mjs +1533 -0
  4. package/dist/ClerkProvider-LQpPtmNL.mjs.map +1 -0
  5. package/dist/errors.cjs +69 -0
  6. package/dist/errors.d.cts +2 -0
  7. package/dist/errors.d.mts +2 -1
  8. package/dist/errors.mjs +2 -29
  9. package/dist/experimental.cjs +270 -0
  10. package/dist/experimental.cjs.map +1 -0
  11. package/dist/{experimental.d.ts → experimental.d.cts} +18 -18
  12. package/dist/experimental.d.mts +18 -18
  13. package/dist/experimental.mjs +201 -165
  14. package/dist/experimental.mjs.map +1 -1
  15. package/dist/hooks-BiY5Zgpp.mjs +1369 -0
  16. package/dist/hooks-BiY5Zgpp.mjs.map +1 -0
  17. package/dist/hooks-CBghYU21.cjs +1606 -0
  18. package/dist/hooks-CBghYU21.cjs.map +1 -0
  19. package/dist/index.cjs +447 -0
  20. package/dist/index.cjs.map +1 -0
  21. package/dist/index.d.cts +345 -0
  22. package/dist/index.d.mts +183 -157
  23. package/dist/index.mjs +285 -380
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/internal.cjs +107 -0
  26. package/dist/internal.cjs.map +1 -0
  27. package/dist/internal.d.cts +51 -0
  28. package/dist/internal.d.mts +24 -26
  29. package/dist/internal.mjs +39 -73
  30. package/dist/internal.mjs.map +1 -1
  31. package/dist/legacy.cjs +134 -0
  32. package/dist/legacy.cjs.map +1 -0
  33. package/dist/{legacy.d.ts → legacy.d.cts} +6 -3
  34. package/dist/legacy.d.mts +6 -3
  35. package/dist/legacy.mjs +126 -42
  36. package/dist/legacy.mjs.map +1 -1
  37. package/dist/types-Bwenmt7y.d.cts +10951 -0
  38. package/dist/types-CiIhevkA.d.mts +10951 -0
  39. package/dist/types.cjs +0 -0
  40. package/dist/types.d.cts +3 -0
  41. package/dist/types.d.mts +3 -109
  42. package/dist/types.mjs +1 -2
  43. package/dist/useAssertWrappedByClerkProvider-Cm0djUcB.cjs +52 -0
  44. package/dist/useAssertWrappedByClerkProvider-Cm0djUcB.cjs.map +1 -0
  45. package/dist/useAssertWrappedByClerkProvider-GaNwZpWo.mjs +29 -0
  46. package/dist/useAssertWrappedByClerkProvider-GaNwZpWo.mjs.map +1 -0
  47. package/dist/{useAuth-Dlg_G1_7.d.mts → useAuth-BK5Y4htK.d.mts} +58 -39
  48. package/dist/{useAuth-Cv6iRjL9.d.ts → useAuth-BMxaWktj.d.cts} +58 -39
  49. package/package.json +18 -18
  50. package/dist/chunk-E5QRIS4Z.mjs +0 -20
  51. package/dist/chunk-E5QRIS4Z.mjs.map +0 -1
  52. package/dist/chunk-FQVXBXXF.mjs +0 -1487
  53. package/dist/chunk-FQVXBXXF.mjs.map +0 -1
  54. package/dist/chunk-GVGS7DUS.mjs +0 -2097
  55. package/dist/chunk-GVGS7DUS.mjs.map +0 -1
  56. package/dist/chunk-RQWALB2R.mjs +0 -26
  57. package/dist/chunk-RQWALB2R.mjs.map +0 -1
  58. package/dist/errors.d.ts +0 -1
  59. package/dist/errors.js +0 -51
  60. package/dist/errors.js.map +0 -1
  61. package/dist/errors.mjs.map +0 -1
  62. package/dist/experimental.js +0 -1505
  63. package/dist/experimental.js.map +0 -1
  64. package/dist/index.d.ts +0 -319
  65. package/dist/index.js +0 -3919
  66. package/dist/index.js.map +0 -1
  67. package/dist/internal.d.ts +0 -53
  68. package/dist/internal.js +0 -3339
  69. package/dist/internal.js.map +0 -1
  70. package/dist/legacy.js +0 -90
  71. package/dist/legacy.js.map +0 -1
  72. package/dist/types.d.ts +0 -109
  73. package/dist/types.js +0 -19
  74. package/dist/types.js.map +0 -1
  75. package/dist/types.mjs.map +0 -1
@@ -0,0 +1,270 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_hooks = require('./hooks-CBghYU21.cjs');
3
+ let react = require("react");
4
+ react = require_hooks.__toESM(react);
5
+ let _clerk_shared_react = require("@clerk/shared/react");
6
+
7
+ //#region src/components/CheckoutButton.tsx
8
+ /**
9
+ * A button component that opens the Clerk Checkout drawer when clicked. Render only when the user is signed in (e.g., wrap with `<Show when="signed-in">`).
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * import { Show } from '@clerk/react';
14
+ * import { CheckoutButton } from '@clerk/react/experimental';
15
+ *
16
+ * // Basic usage with default "Checkout" text
17
+ * function BasicCheckout() {
18
+ * return (
19
+ * <Show when="signed-in">
20
+ * <CheckoutButton planId="plan_123" />
21
+ * </Show>
22
+ * );
23
+ * }
24
+ *
25
+ * // Custom button with organization subscription
26
+ * function OrganizationCheckout() {
27
+ * return (
28
+ * <Show when="signed-in">
29
+ * <CheckoutButton
30
+ * planId="plan_123"
31
+ * planPeriod="month"
32
+ * for="organization"
33
+ * onSubscriptionComplete={() => console.log('Subscription completed!')}
34
+ * >
35
+ * <button className="custom-button">Subscribe Now</button>
36
+ * </CheckoutButton>
37
+ * </Show>
38
+ * );
39
+ * }
40
+ * ```
41
+ *
42
+ * @throws {Error} When rendered while the user is signed out
43
+ * @throws {Error} When `for="organization"` is used without an active organization context
44
+ *
45
+ * @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.
46
+ */
47
+ const CheckoutButton = require_hooks.withClerk(({ clerk, children, ...props }) => {
48
+ const { planId, planPeriod, seatsQuantity, priceId, for: _for, onSubscriptionComplete, newSubscriptionRedirectUrl, checkoutProps, getContainer, component, ...rest } = props;
49
+ const { userId, orgId } = require_hooks.useAuth();
50
+ if (userId === null) throw new Error("Clerk: Ensure that `<CheckoutButton />` is rendered only when the user is signed in (wrap with `<Show when=\"signed-in\">` or guard with `useAuth()`).");
51
+ if (orgId === null && _for === "organization") throw new Error("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");
52
+ children = require_hooks.normalizeWithDefaultValue(children, "Checkout");
53
+ const child = require_hooks.assertSingleChild(children)("CheckoutButton");
54
+ const clickHandler = () => {
55
+ if (!clerk) return;
56
+ return clerk.__internal_openCheckout({
57
+ planId,
58
+ planPeriod,
59
+ seatsQuantity,
60
+ priceId,
61
+ for: _for,
62
+ onSubscriptionComplete,
63
+ newSubscriptionRedirectUrl,
64
+ ...checkoutProps
65
+ });
66
+ };
67
+ const wrappedChildClickHandler = async (e) => {
68
+ if (child && typeof child === "object" && "props" in child) await require_hooks.safeExecute(child.props.onClick)(e);
69
+ return clickHandler();
70
+ };
71
+ const childProps = {
72
+ ...rest,
73
+ onClick: wrappedChildClickHandler
74
+ };
75
+ return react.default.cloneElement(child, childProps);
76
+ }, {
77
+ component: "CheckoutButton",
78
+ renderWhileLoading: true
79
+ });
80
+
81
+ //#endregion
82
+ //#region src/components/PlanDetailsButton.tsx
83
+ /**
84
+ * A button component that opens the Clerk Plan Details drawer when clicked. This component is part of
85
+ * Clerk's Billing feature which is available under a public beta.
86
+ *
87
+ * @example
88
+ * ```tsx
89
+ * import { Show } from '@clerk/react';
90
+ * import { PlanDetailsButton } from '@clerk/react/experimental';
91
+ *
92
+ * // Basic usage with default "Plan details" text
93
+ * function BasicPlanDetails() {
94
+ * return <PlanDetailsButton planId="plan_123" />;
95
+ * }
96
+ *
97
+ * // Custom button with custom text
98
+ * function CustomPlanDetails() {
99
+ * return (
100
+ * <Show when="signed-in">
101
+ * <PlanDetailsButton planId="plan_123">
102
+ * <button>View Plan Details</button>
103
+ * </PlanDetailsButton>
104
+ * </Show>
105
+ * );
106
+ * }
107
+ * ```
108
+ *
109
+ * @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.
110
+ */
111
+ const PlanDetailsButton = require_hooks.withClerk(({ clerk, children, ...props }) => {
112
+ const { plan, planId, initialPlanPeriod, planDetailsProps, getContainer, component, ...rest } = props;
113
+ children = require_hooks.normalizeWithDefaultValue(children, "Plan details");
114
+ const child = require_hooks.assertSingleChild(children)("PlanDetailsButton");
115
+ const clickHandler = () => {
116
+ if (!clerk) return;
117
+ return clerk.__internal_openPlanDetails({
118
+ plan,
119
+ planId,
120
+ initialPlanPeriod,
121
+ ...planDetailsProps
122
+ });
123
+ };
124
+ const wrappedChildClickHandler = async (e) => {
125
+ if (child && typeof child === "object" && "props" in child) await require_hooks.safeExecute(child.props.onClick)(e);
126
+ return clickHandler();
127
+ };
128
+ const childProps = {
129
+ ...rest,
130
+ onClick: wrappedChildClickHandler
131
+ };
132
+ return react.default.cloneElement(child, childProps);
133
+ }, {
134
+ component: "PlanDetailsButton",
135
+ renderWhileLoading: true
136
+ });
137
+
138
+ //#endregion
139
+ //#region src/components/SubscriptionDetailsButton.tsx
140
+ /**
141
+ * A button component that opens the Clerk Subscription Details drawer when clicked. Render only when the user is signed in (e.g., wrap with `<Show when="signed-in">`).
142
+ *
143
+ * @example
144
+ * ```tsx
145
+ * import { Show } from '@clerk/react';
146
+ * import { SubscriptionDetailsButton } from '@clerk/react/experimental';
147
+ *
148
+ * // Basic usage with default "Subscription details" text
149
+ * function BasicSubscriptionDetails() {
150
+ * return (
151
+ * <Show when="signed-in">
152
+ * <SubscriptionDetailsButton />
153
+ * </Show>
154
+ * );
155
+ * }
156
+ *
157
+ * // Custom button with Organization Subscription
158
+ * function OrganizationSubscriptionDetails() {
159
+ * return (
160
+ * <Show when="signed-in">
161
+ * <SubscriptionDetailsButton
162
+ * for="organization"
163
+ * onSubscriptionCancel={() => console.log('Subscription canceled')}
164
+ * >
165
+ * <button>View Organization Subscription</button>
166
+ * </SubscriptionDetailsButton>
167
+ * </Show>
168
+ * );
169
+ * }
170
+ * ```
171
+ *
172
+ * @throws {Error} When rendered while the user is signed out
173
+ * @throws {Error} When `for="organization"` is used without an Active Organization context
174
+ *
175
+ * @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.
176
+ */
177
+ const SubscriptionDetailsButton = require_hooks.withClerk(({ clerk, children, ...props }) => {
178
+ const { for: _for, subscriptionDetailsProps, onSubscriptionCancel, getContainer, component, ...rest } = props;
179
+ children = require_hooks.normalizeWithDefaultValue(children, "Subscription details");
180
+ const child = require_hooks.assertSingleChild(children)("SubscriptionDetailsButton");
181
+ const { userId, orgId } = require_hooks.useAuth();
182
+ if (userId === null) throw new Error("Clerk: Ensure that `<SubscriptionDetailsButton />` is rendered only when the user is signed in (wrap with `<Show when=\"signed-in\">` or guard with `useAuth()`).");
183
+ if (orgId === null && _for === "organization") throw new Error("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");
184
+ const clickHandler = () => {
185
+ if (!clerk) return;
186
+ return clerk.__internal_openSubscriptionDetails({
187
+ for: _for,
188
+ onSubscriptionCancel,
189
+ ...subscriptionDetailsProps
190
+ });
191
+ };
192
+ const wrappedChildClickHandler = async (e) => {
193
+ if (child && typeof child === "object" && "props" in child) await require_hooks.safeExecute(child.props.onClick)(e);
194
+ return clickHandler();
195
+ };
196
+ const childProps = {
197
+ ...rest,
198
+ onClick: wrappedChildClickHandler
199
+ };
200
+ return react.default.cloneElement(child, childProps);
201
+ }, {
202
+ component: "SubscriptionDetailsButton",
203
+ renderWhileLoading: true
204
+ });
205
+
206
+ //#endregion
207
+ exports.CheckoutButton = CheckoutButton;
208
+ Object.defineProperty(exports, 'CheckoutProvider', {
209
+ enumerable: true,
210
+ get: function () {
211
+ return _clerk_shared_react.__experimental_CheckoutProvider;
212
+ }
213
+ });
214
+ Object.defineProperty(exports, 'PaymentElement', {
215
+ enumerable: true,
216
+ get: function () {
217
+ return _clerk_shared_react.__experimental_PaymentElement;
218
+ }
219
+ });
220
+ Object.defineProperty(exports, 'PaymentElementProvider', {
221
+ enumerable: true,
222
+ get: function () {
223
+ return _clerk_shared_react.__experimental_PaymentElementProvider;
224
+ }
225
+ });
226
+ exports.PlanDetailsButton = PlanDetailsButton;
227
+ exports.SubscriptionDetailsButton = SubscriptionDetailsButton;
228
+ Object.defineProperty(exports, 'useCheckout', {
229
+ enumerable: true,
230
+ get: function () {
231
+ return _clerk_shared_react.__experimental_useCheckout;
232
+ }
233
+ });
234
+ Object.defineProperty(exports, 'usePaymentAttempts', {
235
+ enumerable: true,
236
+ get: function () {
237
+ return _clerk_shared_react.__experimental_usePaymentAttempts;
238
+ }
239
+ });
240
+ Object.defineProperty(exports, 'usePaymentElement', {
241
+ enumerable: true,
242
+ get: function () {
243
+ return _clerk_shared_react.__experimental_usePaymentElement;
244
+ }
245
+ });
246
+ Object.defineProperty(exports, 'usePaymentMethods', {
247
+ enumerable: true,
248
+ get: function () {
249
+ return _clerk_shared_react.__experimental_usePaymentMethods;
250
+ }
251
+ });
252
+ Object.defineProperty(exports, 'usePlans', {
253
+ enumerable: true,
254
+ get: function () {
255
+ return _clerk_shared_react.__experimental_usePlans;
256
+ }
257
+ });
258
+ Object.defineProperty(exports, 'useStatements', {
259
+ enumerable: true,
260
+ get: function () {
261
+ return _clerk_shared_react.__experimental_useStatements;
262
+ }
263
+ });
264
+ Object.defineProperty(exports, 'useSubscription', {
265
+ enumerable: true,
266
+ get: function () {
267
+ return _clerk_shared_react.__experimental_useSubscription;
268
+ }
269
+ });
270
+ //# sourceMappingURL=experimental.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"experimental.cjs","names":["withClerk","useAuth","normalizeWithDefaultValue","assertSingleChild","safeExecute","React","withClerk","normalizeWithDefaultValue","assertSingleChild","safeExecute","React","withClerk","normalizeWithDefaultValue","assertSingleChild","useAuth","safeExecute","React"],"sources":["../src/components/CheckoutButton.tsx","../src/components/PlanDetailsButton.tsx","../src/components/SubscriptionDetailsButton.tsx"],"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. Render only when the user is signed in (e.g., wrap with `<Show when=\"signed-in\">`).\n *\n * @example\n * ```tsx\n * import { Show } from '@clerk/react';\n * import { CheckoutButton } from '@clerk/react/experimental';\n *\n * // Basic usage with default \"Checkout\" text\n * function BasicCheckout() {\n * return (\n * <Show when=\"signed-in\">\n * <CheckoutButton planId=\"plan_123\" />\n * </Show>\n * );\n * }\n *\n * // Custom button with organization subscription\n * function OrganizationCheckout() {\n * return (\n * <Show when=\"signed-in\">\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 * </Show>\n * );\n * }\n * ```\n *\n * @throws {Error} When rendered while the user is signed out\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 seatsQuantity,\n priceId,\n for: _for,\n onSubscriptionComplete,\n newSubscriptionRedirectUrl,\n checkoutProps,\n getContainer,\n component,\n ...rest\n } = props;\n\n const { userId, orgId } = useAuth();\n\n if (userId === null) {\n throw new Error(\n 'Clerk: Ensure that `<CheckoutButton />` is rendered only when the user is signed in (wrap with `<Show when=\"signed-in\">` or guard with `useAuth()`).',\n );\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 seatsQuantity,\n priceId,\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 { Show } from '@clerk/react';\n * import { PlanDetailsButton } from '@clerk/react/experimental';\n *\n * // Basic usage with default \"Plan details\" text\n * function BasicPlanDetails() {\n * return <PlanDetailsButton planId=\"plan_123\" />;\n * }\n *\n * // Custom button with custom text\n * function CustomPlanDetails() {\n * return (\n * <Show when=\"signed-in\">\n * <PlanDetailsButton planId=\"plan_123\">\n * <button>View Plan Details</button>\n * </PlanDetailsButton>\n * </Show>\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, getContainer, component, ...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. Render only when the user is signed in (e.g., wrap with `<Show when=\"signed-in\">`).\n *\n * @example\n * ```tsx\n * import { Show } 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 * <Show when=\"signed-in\">\n * <SubscriptionDetailsButton />\n * </Show>\n * );\n * }\n *\n * // Custom button with Organization Subscription\n * function OrganizationSubscriptionDetails() {\n * return (\n * <Show when=\"signed-in\">\n * <SubscriptionDetailsButton\n * for=\"organization\"\n * onSubscriptionCancel={() => console.log('Subscription canceled')}\n * >\n * <button>View Organization Subscription</button>\n * </SubscriptionDetailsButton>\n * </Show>\n * );\n * }\n * ```\n *\n * @throws {Error} When rendered while the user is signed out\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, getContainer, component, ...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 only when the user is signed in (wrap with `<Show when=\"signed-in\">` or guard with `useAuth()`).',\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"],"mappings":"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"}
@@ -1,12 +1,9 @@
1
- import * as _clerk_shared_types from '@clerk/shared/types';
2
- import { __experimental_CheckoutButtonProps, __experimental_PlanDetailsButtonProps, __experimental_SubscriptionDetailsButtonProps } from '@clerk/shared/types';
3
- export { __experimental_CheckoutButtonProps as CheckoutButtonProps, __experimental_PlanDetailsButtonProps as PlanDetailsButtonProps, __experimental_SubscriptionDetailsButtonProps as SubscriptionDetailsButtonProps } from '@clerk/shared/types';
4
- import React from 'react';
5
- import { WithClerkProp } from './types.js';
6
- export { __experimental_CheckoutProvider as CheckoutProvider, __experimental_PaymentElement as PaymentElement, __experimental_PaymentElementProvider as PaymentElementProvider, __experimental_useCheckout as useCheckout, __experimental_usePaymentAttempts as usePaymentAttempts, __experimental_usePaymentElement as usePaymentElement, __experimental_usePaymentMethods as usePaymentMethods, __experimental_usePlans as usePlans, __experimental_useStatements as useStatements, __experimental_useSubscription as useSubscription } from '@clerk/shared/react';
7
- import '@clerk/shared/ui';
8
- import '@clerk/ui/internal';
1
+ import { g as WithClerkProp } from "./types-Bwenmt7y.cjs";
2
+ import { __experimental_CheckoutButtonProps, __experimental_CheckoutButtonProps as CheckoutButtonProps, __experimental_PlanDetailsButtonProps, __experimental_PlanDetailsButtonProps as PlanDetailsButtonProps, __experimental_SubscriptionDetailsButtonProps, __experimental_SubscriptionDetailsButtonProps as SubscriptionDetailsButtonProps } from "@clerk/shared/types";
3
+ import React from "react";
4
+ import { __experimental_CheckoutProvider as CheckoutProvider, __experimental_PaymentElement as PaymentElement, __experimental_PaymentElementProvider as PaymentElementProvider, __experimental_useCheckout as useCheckout, __experimental_usePaymentAttempts as usePaymentAttempts, __experimental_usePaymentElement as usePaymentElement, __experimental_usePaymentMethods as usePaymentMethods, __experimental_usePlans as usePlans, __experimental_useStatements as useStatements, __experimental_useSubscription as useSubscription } from "@clerk/shared/react";
9
5
 
6
+ //#region src/components/CheckoutButton.d.ts
10
7
  /**
11
8
  * A button component that opens the Clerk Checkout drawer when clicked. Render only when the user is signed in (e.g., wrap with `<Show when="signed-in">`).
12
9
  *
@@ -47,10 +44,11 @@ import '@clerk/ui/internal';
47
44
  * @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.
48
45
  */
49
46
  declare const CheckoutButton: {
50
- (props: _clerk_shared_types.Without<WithClerkProp<React.PropsWithChildren<__experimental_CheckoutButtonProps>>, "clerk">): React.JSX.Element | null;
51
- displayName: string;
47
+ (props: import("@clerk/shared/types").Without<WithClerkProp<React.PropsWithChildren<__experimental_CheckoutButtonProps>>, "clerk">): React.JSX.Element | null;
48
+ displayName: string;
52
49
  };
53
-
50
+ //#endregion
51
+ //#region src/components/PlanDetailsButton.d.ts
54
52
  /**
55
53
  * A button component that opens the Clerk Plan Details drawer when clicked. This component is part of
56
54
  * Clerk's Billing feature which is available under a public beta.
@@ -80,10 +78,11 @@ declare const CheckoutButton: {
80
78
  * @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.
81
79
  */
82
80
  declare const PlanDetailsButton: {
83
- (props: _clerk_shared_types.Without<WithClerkProp<React.PropsWithChildren<__experimental_PlanDetailsButtonProps>>, "clerk">): React.JSX.Element | null;
84
- displayName: string;
81
+ (props: import("@clerk/shared/types").Without<WithClerkProp<React.PropsWithChildren<__experimental_PlanDetailsButtonProps>>, "clerk">): React.JSX.Element | null;
82
+ displayName: string;
85
83
  };
86
-
84
+ //#endregion
85
+ //#region src/components/SubscriptionDetailsButton.d.ts
87
86
  /**
88
87
  * A button component that opens the Clerk Subscription Details drawer when clicked. Render only when the user is signed in (e.g., wrap with `<Show when="signed-in">`).
89
88
  *
@@ -122,8 +121,9 @@ declare const PlanDetailsButton: {
122
121
  * @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.
123
122
  */
124
123
  declare const SubscriptionDetailsButton: {
125
- (props: _clerk_shared_types.Without<WithClerkProp<React.PropsWithChildren<__experimental_SubscriptionDetailsButtonProps>>, "clerk">): React.JSX.Element | null;
126
- displayName: string;
124
+ (props: import("@clerk/shared/types").Without<WithClerkProp<React.PropsWithChildren<__experimental_SubscriptionDetailsButtonProps>>, "clerk">): React.JSX.Element | null;
125
+ displayName: string;
127
126
  };
128
-
129
- export { CheckoutButton, PlanDetailsButton, SubscriptionDetailsButton };
127
+ //#endregion
128
+ export { CheckoutButton, type CheckoutButtonProps, CheckoutProvider, PaymentElement, PaymentElementProvider, PlanDetailsButton, type PlanDetailsButtonProps, SubscriptionDetailsButton, type SubscriptionDetailsButtonProps, useCheckout, usePaymentAttempts, usePaymentElement, usePaymentMethods, usePlans, useStatements, useSubscription };
129
+ //# sourceMappingURL=experimental.d.cts.map
@@ -1,12 +1,9 @@
1
- import * as _clerk_shared_types from '@clerk/shared/types';
2
- import { __experimental_CheckoutButtonProps, __experimental_PlanDetailsButtonProps, __experimental_SubscriptionDetailsButtonProps } from '@clerk/shared/types';
3
- export { __experimental_CheckoutButtonProps as CheckoutButtonProps, __experimental_PlanDetailsButtonProps as PlanDetailsButtonProps, __experimental_SubscriptionDetailsButtonProps as SubscriptionDetailsButtonProps } from '@clerk/shared/types';
4
- import React from 'react';
5
- import { WithClerkProp } from './types.mjs';
6
- export { __experimental_CheckoutProvider as CheckoutProvider, __experimental_PaymentElement as PaymentElement, __experimental_PaymentElementProvider as PaymentElementProvider, __experimental_useCheckout as useCheckout, __experimental_usePaymentAttempts as usePaymentAttempts, __experimental_usePaymentElement as usePaymentElement, __experimental_usePaymentMethods as usePaymentMethods, __experimental_usePlans as usePlans, __experimental_useStatements as useStatements, __experimental_useSubscription as useSubscription } from '@clerk/shared/react';
7
- import '@clerk/shared/ui';
8
- import '@clerk/ui/internal';
1
+ import { g as WithClerkProp } from "./types-CiIhevkA.mjs";
2
+ import React from "react";
3
+ import { __experimental_CheckoutProvider as CheckoutProvider, __experimental_PaymentElement as PaymentElement, __experimental_PaymentElementProvider as PaymentElementProvider, __experimental_useCheckout as useCheckout, __experimental_usePaymentAttempts as usePaymentAttempts, __experimental_usePaymentElement as usePaymentElement, __experimental_usePaymentMethods as usePaymentMethods, __experimental_usePlans as usePlans, __experimental_useStatements as useStatements, __experimental_useSubscription as useSubscription } from "@clerk/shared/react";
4
+ import { __experimental_CheckoutButtonProps, __experimental_CheckoutButtonProps as CheckoutButtonProps, __experimental_PlanDetailsButtonProps, __experimental_PlanDetailsButtonProps as PlanDetailsButtonProps, __experimental_SubscriptionDetailsButtonProps, __experimental_SubscriptionDetailsButtonProps as SubscriptionDetailsButtonProps } from "@clerk/shared/types";
9
5
 
6
+ //#region src/components/CheckoutButton.d.ts
10
7
  /**
11
8
  * A button component that opens the Clerk Checkout drawer when clicked. Render only when the user is signed in (e.g., wrap with `<Show when="signed-in">`).
12
9
  *
@@ -47,10 +44,11 @@ import '@clerk/ui/internal';
47
44
  * @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.
48
45
  */
49
46
  declare const CheckoutButton: {
50
- (props: _clerk_shared_types.Without<WithClerkProp<React.PropsWithChildren<__experimental_CheckoutButtonProps>>, "clerk">): React.JSX.Element | null;
51
- displayName: string;
47
+ (props: import("@clerk/shared/types").Without<WithClerkProp<React.PropsWithChildren<__experimental_CheckoutButtonProps>>, "clerk">): React.JSX.Element | null;
48
+ displayName: string;
52
49
  };
53
-
50
+ //#endregion
51
+ //#region src/components/PlanDetailsButton.d.ts
54
52
  /**
55
53
  * A button component that opens the Clerk Plan Details drawer when clicked. This component is part of
56
54
  * Clerk's Billing feature which is available under a public beta.
@@ -80,10 +78,11 @@ declare const CheckoutButton: {
80
78
  * @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.
81
79
  */
82
80
  declare const PlanDetailsButton: {
83
- (props: _clerk_shared_types.Without<WithClerkProp<React.PropsWithChildren<__experimental_PlanDetailsButtonProps>>, "clerk">): React.JSX.Element | null;
84
- displayName: string;
81
+ (props: import("@clerk/shared/types").Without<WithClerkProp<React.PropsWithChildren<__experimental_PlanDetailsButtonProps>>, "clerk">): React.JSX.Element | null;
82
+ displayName: string;
85
83
  };
86
-
84
+ //#endregion
85
+ //#region src/components/SubscriptionDetailsButton.d.ts
87
86
  /**
88
87
  * A button component that opens the Clerk Subscription Details drawer when clicked. Render only when the user is signed in (e.g., wrap with `<Show when="signed-in">`).
89
88
  *
@@ -122,8 +121,9 @@ declare const PlanDetailsButton: {
122
121
  * @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.
123
122
  */
124
123
  declare const SubscriptionDetailsButton: {
125
- (props: _clerk_shared_types.Without<WithClerkProp<React.PropsWithChildren<__experimental_SubscriptionDetailsButtonProps>>, "clerk">): React.JSX.Element | null;
126
- displayName: string;
124
+ (props: import("@clerk/shared/types").Without<WithClerkProp<React.PropsWithChildren<__experimental_SubscriptionDetailsButtonProps>>, "clerk">): React.JSX.Element | null;
125
+ displayName: string;
127
126
  };
128
-
129
- export { CheckoutButton, PlanDetailsButton, SubscriptionDetailsButton };
127
+ //#endregion
128
+ export { CheckoutButton, type CheckoutButtonProps, CheckoutProvider, PaymentElement, PaymentElementProvider, PlanDetailsButton, type PlanDetailsButtonProps, SubscriptionDetailsButton, type SubscriptionDetailsButtonProps, useCheckout, usePaymentAttempts, usePaymentElement, usePaymentMethods, usePlans, useStatements, useSubscription };
129
+ //# sourceMappingURL=experimental.d.mts.map