@clerk/shared 3.28.3 → 3.28.4-canary.v20251026194813

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.
@@ -765,8 +765,9 @@ function createBillingPaginatedHook({
765
765
  }) {
766
766
  return function useBillingHook(params) {
767
767
  const { for: _for, ...paginationParams } = params || {};
768
+ const safeFor = _for || "user";
768
769
  useAssertWrappedByClerkProvider(hookName5);
769
- const fetchFn = useFetcher(_for || "user");
770
+ const fetchFn = useFetcher(safeFor);
770
771
  const safeValues = useWithSafeValues(paginationParams, {
771
772
  initialPage: 1,
772
773
  pageSize: 10,
@@ -779,13 +780,13 @@ function createBillingPaginatedHook({
779
780
  const user = useUserContext();
780
781
  const { organization } = useOrganizationContext();
781
782
  clerk.telemetry?.record(eventMethodCalled(hookName5));
783
+ const isForOrganization = safeFor === "organization";
782
784
  const hookParams = typeof paginationParams === "undefined" ? void 0 : {
783
785
  initialPage: safeValues.initialPage,
784
786
  pageSize: safeValues.pageSize,
785
- ...options?.unauthenticated ? {} : _for === "organization" ? { orgId: organization?.id } : {}
787
+ ...options?.unauthenticated ? {} : isForOrganization ? { orgId: organization?.id } : {}
786
788
  };
787
- const isOrganization = _for === "organization";
788
- const billingEnabled = isOrganization ? environment?.commerceSettings.billing.organization.enabled : environment?.commerceSettings.billing.user.enabled;
789
+ const billingEnabled = isForOrganization ? environment?.commerceSettings.billing.organization.enabled : environment?.commerceSettings.billing.user.enabled;
789
790
  const isEnabled = !!hookParams && clerk.loaded && !!billingEnabled;
790
791
  const result = usePagesOrInfinite(
791
792
  hookParams || {},
@@ -799,10 +800,9 @@ function createBillingPaginatedHook({
799
800
  },
800
801
  {
801
802
  type: resourceType,
802
- // userId: user?.id,
803
- ...options?.unauthenticated ? {} : {
803
+ ...options?.unauthenticated ? { for: safeFor } : {
804
804
  userId: user?.id,
805
- ..._for === "organization" ? { orgId: organization?.id } : {}
805
+ ...isForOrganization ? { orgId: organization?.id } : {}
806
806
  }
807
807
  }
808
808
  );