@nextsparkjs/core 0.1.0-beta.128 → 0.1.0-beta.129

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 (76) hide show
  1. package/dist/components/billing/ConfirmPlanChangeModal.d.ts +29 -0
  2. package/dist/components/billing/ConfirmPlanChangeModal.d.ts.map +1 -0
  3. package/dist/components/billing/ConfirmPlanChangeModal.js +100 -0
  4. package/dist/components/billing/PricingTable.d.ts +3 -0
  5. package/dist/components/billing/PricingTable.d.ts.map +1 -1
  6. package/dist/components/billing/PricingTable.js +146 -71
  7. package/dist/components/billing/QuotaGate.d.ts +21 -0
  8. package/dist/components/billing/QuotaGate.d.ts.map +1 -0
  9. package/dist/components/billing/QuotaGate.js +33 -0
  10. package/dist/components/billing/index.d.ts +2 -0
  11. package/dist/components/billing/index.d.ts.map +1 -1
  12. package/dist/components/billing/index.js +4 -0
  13. package/dist/components/dashboard/block-editor/dynamic-form.d.ts.map +1 -1
  14. package/dist/components/dashboard/block-editor/dynamic-form.js +7 -5
  15. package/dist/contexts/SubscriptionContext.d.ts +2 -0
  16. package/dist/contexts/SubscriptionContext.d.ts.map +1 -1
  17. package/dist/contexts/SubscriptionContext.js +2 -0
  18. package/dist/hooks/index.d.ts +1 -0
  19. package/dist/hooks/index.d.ts.map +1 -1
  20. package/dist/hooks/index.js +1 -0
  21. package/dist/hooks/useQuotaCheck.d.ts +26 -0
  22. package/dist/hooks/useQuotaCheck.d.ts.map +1 -0
  23. package/dist/hooks/useQuotaCheck.js +33 -0
  24. package/dist/lib/api/entity/generic-handler.d.ts.map +1 -1
  25. package/dist/lib/api/entity/generic-handler.js +54 -6
  26. package/dist/lib/oauth/index.d.ts +1 -1
  27. package/dist/messages/de/billing.json +10 -0
  28. package/dist/messages/de/index.d.ts +9 -0
  29. package/dist/messages/de/index.d.ts.map +1 -1
  30. package/dist/messages/en/billing.json +21 -0
  31. package/dist/messages/en/index.d.ts +19 -0
  32. package/dist/messages/en/index.d.ts.map +1 -1
  33. package/dist/messages/es/billing.json +21 -0
  34. package/dist/messages/es/index.d.ts +19 -0
  35. package/dist/messages/es/index.d.ts.map +1 -1
  36. package/dist/messages/fr/billing.json +10 -0
  37. package/dist/messages/fr/index.d.ts +9 -0
  38. package/dist/messages/fr/index.d.ts.map +1 -1
  39. package/dist/messages/it/billing.json +10 -0
  40. package/dist/messages/it/index.d.ts +9 -0
  41. package/dist/messages/it/index.d.ts.map +1 -1
  42. package/dist/messages/pt/billing.json +10 -0
  43. package/dist/messages/pt/index.d.ts +9 -0
  44. package/dist/messages/pt/index.d.ts.map +1 -1
  45. package/dist/styles/classes.json +6 -2
  46. package/dist/styles/ui.css +1 -1
  47. package/dist/templates/app/api/v1/billing/cancel/route.ts +1 -1
  48. package/dist/templates/app/api/v1/billing/change-plan/route.ts +1 -1
  49. package/dist/templates/app/api/v1/billing/check-action/route.ts +7 -6
  50. package/dist/templates/app/api/v1/billing/checkout/route.ts +35 -7
  51. package/dist/templates/app/api/v1/billing/portal/route.ts +1 -1
  52. package/dist/templates/app/dashboard/settings/billing/page.tsx +9 -4
  53. package/dist/templates/app/dashboard/settings/plans/page.tsx +29 -7
  54. package/dist/templates/blocks/hero/component.tsx +6 -3
  55. package/dist/templates/blocks/hero/schema.ts +2 -1
  56. package/dist/templates/blocks/testimonials/component.tsx +2 -2
  57. package/dist/templates/blocks/testimonials/schema.ts +2 -2
  58. package/dist/templates/features/pages/blocks/hero/component.tsx +6 -3
  59. package/dist/templates/features/pages/blocks/hero/schema.ts +2 -1
  60. package/dist/types/blocks.d.ts +24 -0
  61. package/dist/types/blocks.d.ts.map +1 -1
  62. package/dist/types/blocks.js +17 -1
  63. package/package.json +2 -2
  64. package/templates/app/api/v1/billing/cancel/route.ts +1 -1
  65. package/templates/app/api/v1/billing/change-plan/route.ts +1 -1
  66. package/templates/app/api/v1/billing/check-action/route.ts +7 -6
  67. package/templates/app/api/v1/billing/checkout/route.ts +35 -7
  68. package/templates/app/api/v1/billing/portal/route.ts +1 -1
  69. package/templates/app/dashboard/settings/billing/page.tsx +9 -4
  70. package/templates/app/dashboard/settings/plans/page.tsx +29 -7
  71. package/templates/blocks/hero/component.tsx +6 -3
  72. package/templates/blocks/hero/schema.ts +2 -1
  73. package/templates/blocks/testimonials/component.tsx +2 -2
  74. package/templates/blocks/testimonials/schema.ts +2 -2
  75. package/templates/features/pages/blocks/hero/component.tsx +6 -3
  76. package/templates/features/pages/blocks/hero/schema.ts +2 -1
@@ -0,0 +1,29 @@
1
+ interface ConfirmPlanChangeModalProps {
2
+ open: boolean;
3
+ onOpenChange: (open: boolean) => void;
4
+ currentPlanSlug: string;
5
+ targetPlanSlug: string;
6
+ onConfirm: () => void;
7
+ loading?: boolean;
8
+ }
9
+ /**
10
+ * ConfirmPlanChangeModal - Confirmation dialog for plan upgrades/downgrades
11
+ *
12
+ * Detects whether the change is an upgrade or downgrade based on plan price,
13
+ * and shows an appropriate message to the user before confirming.
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * <ConfirmPlanChangeModal
18
+ * open={isOpen}
19
+ * onOpenChange={setIsOpen}
20
+ * currentPlanSlug="starter"
21
+ * targetPlanSlug="pro"
22
+ * onConfirm={() => handlePlanChange('pro')}
23
+ * loading={isChanging}
24
+ * />
25
+ * ```
26
+ */
27
+ export declare function ConfirmPlanChangeModal({ open, onOpenChange, currentPlanSlug, targetPlanSlug, onConfirm, loading }: ConfirmPlanChangeModalProps): import("react/jsx-runtime").JSX.Element;
28
+ export {};
29
+ //# sourceMappingURL=ConfirmPlanChangeModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfirmPlanChangeModal.d.ts","sourceRoot":"","sources":["../../../src/components/billing/ConfirmPlanChangeModal.tsx"],"names":[],"mappings":"AAiBA,UAAU,2BAA2B;IACnC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,eAAe,EAAE,MAAM,CAAA;IACvB,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,IAAI,EACJ,YAAY,EACZ,eAAe,EACf,cAAc,EACd,SAAS,EACT,OAAe,EAChB,EAAE,2BAA2B,2CA4F7B"}
@@ -0,0 +1,100 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useMemo } from "react";
4
+ import { BILLING_REGISTRY } from "@nextsparkjs/registries/billing-registry";
5
+ import {
6
+ Dialog,
7
+ DialogContent,
8
+ DialogDescription,
9
+ DialogFooter,
10
+ DialogHeader,
11
+ DialogTitle
12
+ } from "../ui/dialog.js";
13
+ import { Button } from "../ui/button.js";
14
+ import { Badge } from "../ui/badge.js";
15
+ import { ArrowRight } from "lucide-react";
16
+ import { useTranslations } from "next-intl";
17
+ function ConfirmPlanChangeModal({
18
+ open,
19
+ onOpenChange,
20
+ currentPlanSlug,
21
+ targetPlanSlug,
22
+ onConfirm,
23
+ loading = false
24
+ }) {
25
+ var _a, _b, _c, _d;
26
+ const t = useTranslations("billing");
27
+ const { currentPlan, targetPlan, isUpgrade, isDowngradeToFree } = useMemo(() => {
28
+ var _a2, _b2;
29
+ const current = BILLING_REGISTRY.plans.find((p) => p.slug === currentPlanSlug);
30
+ const target = BILLING_REGISTRY.plans.find((p) => p.slug === targetPlanSlug);
31
+ const currentPrice = ((_a2 = current == null ? void 0 : current.price) == null ? void 0 : _a2.monthly) ?? 0;
32
+ const targetPrice = ((_b2 = target == null ? void 0 : target.price) == null ? void 0 : _b2.monthly) ?? 0;
33
+ return {
34
+ currentPlan: current,
35
+ targetPlan: target,
36
+ isUpgrade: targetPrice > currentPrice,
37
+ isDowngradeToFree: (target == null ? void 0 : target.type) === "free"
38
+ };
39
+ }, [currentPlanSlug, targetPlanSlug]);
40
+ const currentPriceDisplay = ((_a = currentPlan == null ? void 0 : currentPlan.price) == null ? void 0 : _a.monthly) ? `$${(currentPlan.price.monthly / 100).toFixed(0)}` : t("plans.free.name");
41
+ const targetPriceDisplay = ((_b = targetPlan == null ? void 0 : targetPlan.price) == null ? void 0 : _b.monthly) ? `$${(targetPlan.price.monthly / 100).toFixed(0)}` : t("plans.free.name");
42
+ const description = isDowngradeToFree ? t("changePlan.downgradeToFreeDescription") : isUpgrade ? t("changePlan.upgradeDescription") : t("changePlan.downgradeDescription");
43
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-md", "data-cy": "confirm-plan-change-modal", children: [
44
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [
45
+ /* @__PURE__ */ jsx(DialogTitle, { "data-cy": "confirm-plan-change-title", children: t("changePlan.title") }),
46
+ /* @__PURE__ */ jsx(DialogDescription, { "data-cy": "confirm-plan-change-description", children: description })
47
+ ] }),
48
+ /* @__PURE__ */ jsxs(
49
+ "div",
50
+ {
51
+ className: "flex items-center justify-center gap-3 py-4 px-2 rounded-lg bg-muted/50",
52
+ "data-cy": "confirm-plan-change-plans",
53
+ children: [
54
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1.5 min-w-0", children: [
55
+ /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: t("changePlan.from") }),
56
+ /* @__PURE__ */ jsx(Badge, { variant: "outline", "data-cy": "confirm-plan-change-current", children: t(`plans.${currentPlanSlug}.name`) }),
57
+ /* @__PURE__ */ jsxs("span", { className: "text-sm font-medium tabular-nums text-muted-foreground", children: [
58
+ currentPriceDisplay,
59
+ ((_c = currentPlan == null ? void 0 : currentPlan.price) == null ? void 0 : _c.monthly) ? t("perMonth") : ""
60
+ ] })
61
+ ] }),
62
+ /* @__PURE__ */ jsx(ArrowRight, { className: "h-4 w-4 text-muted-foreground shrink-0", "aria-hidden": "true" }),
63
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1.5 min-w-0", children: [
64
+ /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: t("changePlan.to") }),
65
+ /* @__PURE__ */ jsx(Badge, { variant: "default", "data-cy": "confirm-plan-change-target", children: t(`plans.${targetPlanSlug}.name`) }),
66
+ /* @__PURE__ */ jsxs("span", { className: "text-sm font-bold tabular-nums", children: [
67
+ targetPriceDisplay,
68
+ ((_d = targetPlan == null ? void 0 : targetPlan.price) == null ? void 0 : _d.monthly) ? t("perMonth") : ""
69
+ ] })
70
+ ] })
71
+ ]
72
+ }
73
+ ),
74
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [
75
+ /* @__PURE__ */ jsx(
76
+ Button,
77
+ {
78
+ variant: "outline",
79
+ onClick: () => onOpenChange(false),
80
+ disabled: loading,
81
+ "data-cy": "confirm-plan-change-cancel",
82
+ children: t("changePlan.cancel")
83
+ }
84
+ ),
85
+ /* @__PURE__ */ jsx(
86
+ Button,
87
+ {
88
+ onClick: onConfirm,
89
+ disabled: loading,
90
+ "aria-busy": loading,
91
+ "data-cy": "confirm-plan-change-confirm",
92
+ children: loading ? t("changePlan.confirming") : t("changePlan.confirm")
93
+ }
94
+ )
95
+ ] })
96
+ ] }) });
97
+ }
98
+ export {
99
+ ConfirmPlanChangeModal
100
+ };
@@ -5,6 +5,9 @@ interface PricingTableProps {
5
5
  /**
6
6
  * PricingTable - Plan comparison table with features and limits
7
7
  *
8
+ * Shows skeleton cards while subscription data loads to avoid
9
+ * a flash of incorrect button states (INP optimization).
10
+ *
8
11
  * @example
9
12
  * ```tsx
10
13
  * <PricingTable onSelectPlan={(slug) => handleUpgrade(slug)} />
@@ -1 +1 @@
1
- {"version":3,"file":"PricingTable.d.ts","sourceRoot":"","sources":["../../../src/components/billing/PricingTable.tsx"],"names":[],"mappings":"AAWA,UAAU,iBAAiB;IACzB,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACzC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,iBAAiB,2CAgI1E"}
1
+ {"version":3,"file":"PricingTable.d.ts","sourceRoot":"","sources":["../../../src/components/billing/PricingTable.tsx"],"names":[],"mappings":"AAcA,UAAU,iBAAiB;IACzB,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACzC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AA0CD;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,iBAAiB,2CA4L1E"}
@@ -1,90 +1,165 @@
1
1
  "use client";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
3
4
  import { BILLING_REGISTRY } from "@nextsparkjs/registries/billing-registry";
4
5
  import { useSubscription } from "../../hooks/useSubscription.js";
5
6
  import { Button } from "../ui/button.js";
6
7
  import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "../ui/card.js";
7
8
  import { Badge } from "../ui/badge.js";
9
+ import { Skeleton } from "../ui/skeleton.js";
8
10
  import { Check, X } from "lucide-react";
9
11
  import { useTranslations } from "next-intl";
10
12
  import { cn } from "../../lib/utils/index.js";
13
+ import { ConfirmPlanChangeModal } from "./ConfirmPlanChangeModal.js";
14
+ function PricingCardSkeleton() {
15
+ return /* @__PURE__ */ jsxs(Card, { className: "relative flex flex-col", children: [
16
+ /* @__PURE__ */ jsxs(CardHeader, { children: [
17
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-28" }),
18
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-48 mt-2" }),
19
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-20 mt-4" })
20
+ ] }),
21
+ /* @__PURE__ */ jsxs(CardContent, { className: "flex-1 flex flex-col", children: [
22
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-24 mb-3" }),
23
+ /* @__PURE__ */ jsx("div", { className: "space-y-2.5 mb-6", children: Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
24
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-4 rounded-full shrink-0" }),
25
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-3.5 w-32" })
26
+ ] }, i)) }),
27
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-16 mb-3" }),
28
+ /* @__PURE__ */ jsx("div", { className: "space-y-2.5 mb-6", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
29
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-3.5 w-24" }),
30
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-3.5 w-16" })
31
+ ] }, i)) }),
32
+ /* @__PURE__ */ jsx("div", { className: "mt-auto", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-full rounded-md" }) })
33
+ ] })
34
+ ] });
35
+ }
11
36
  function PricingTable({ onSelectPlan, className }) {
12
37
  const t = useTranslations("billing");
13
- const { planSlug: currentPlanSlug } = useSubscription();
38
+ const { planSlug: currentPlanSlug, subscription, isReady } = useSubscription();
39
+ const [confirmModalOpen, setConfirmModalOpen] = useState(false);
40
+ const [targetPlanSlug, setTargetPlanSlug] = useState(null);
41
+ const [changePlanLoading, setChangePlanLoading] = useState(false);
42
+ const hasActiveSubscription = !!(subscription == null ? void 0 : subscription.externalSubscriptionId);
43
+ const handleSelectPlan = (planSlug) => {
44
+ if (hasActiveSubscription && currentPlanSlug && planSlug !== currentPlanSlug) {
45
+ setTargetPlanSlug(planSlug);
46
+ setConfirmModalOpen(true);
47
+ } else {
48
+ onSelectPlan == null ? void 0 : onSelectPlan(planSlug);
49
+ }
50
+ };
51
+ const handleConfirmChange = async () => {
52
+ if (!targetPlanSlug) return;
53
+ setChangePlanLoading(true);
54
+ try {
55
+ onSelectPlan == null ? void 0 : onSelectPlan(targetPlanSlug);
56
+ } finally {
57
+ setChangePlanLoading(false);
58
+ setConfirmModalOpen(false);
59
+ setTargetPlanSlug(null);
60
+ }
61
+ };
14
62
  const visiblePlans = BILLING_REGISTRY.plans.filter(
15
63
  (p) => p.visibility === "public" || p.visibility === void 0
16
64
  );
17
- return /* @__PURE__ */ jsx(
18
- "div",
19
- {
20
- className: cn("grid gap-6 md:grid-cols-2 lg:grid-cols-3", className),
21
- "data-cy": "pricing-table",
22
- children: visiblePlans.map((plan) => {
23
- var _a;
24
- const isCurrentPlan = plan.slug === currentPlanSlug;
25
- const priceMonthly = ((_a = plan.price) == null ? void 0 : _a.monthly) ? plan.price.monthly / 100 : 0;
26
- return /* @__PURE__ */ jsxs(
27
- Card,
28
- {
29
- className: cn(
30
- "relative flex flex-col",
31
- isCurrentPlan && "border-primary border-2"
32
- ),
33
- "data-cy": `pricing-plan-${plan.slug}`,
34
- children: [
35
- isCurrentPlan && /* @__PURE__ */ jsx("div", { className: "absolute -top-3 left-1/2 -translate-x-1/2", children: /* @__PURE__ */ jsx(Badge, { variant: "default", "data-cy": "pricing-current-badge", children: t("currentPlan") }) }),
36
- /* @__PURE__ */ jsxs(CardHeader, { children: [
37
- /* @__PURE__ */ jsx(CardTitle, { className: "text-2xl", "data-cy": "pricing-plan-name", children: t(`plans.${plan.slug}.name`) }),
38
- /* @__PURE__ */ jsx(CardDescription, { "data-cy": "pricing-plan-description", children: t(`plans.${plan.slug}.description`) }),
39
- /* @__PURE__ */ jsx("div", { className: "mt-4", "data-cy": "pricing-plan-price", children: priceMonthly > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
40
- /* @__PURE__ */ jsxs("span", { className: "text-4xl font-bold", children: [
41
- "$",
42
- priceMonthly.toFixed(0)
43
- ] }),
44
- /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "/mo" })
45
- ] }) : plan.type === "enterprise" ? /* @__PURE__ */ jsx("span", { className: "text-2xl font-bold", children: t("contactUs") }) : /* @__PURE__ */ jsx("span", { className: "text-4xl font-bold", children: t("plans.free.name") }) })
46
- ] }),
47
- /* @__PURE__ */ jsxs(CardContent, { className: "flex-1 flex flex-col", children: [
48
- /* @__PURE__ */ jsxs("div", { className: "space-y-3 mb-6", "data-cy": "pricing-plan-features", children: [
49
- /* @__PURE__ */ jsx("h4", { className: "font-semibold text-sm text-muted-foreground", children: t("features.title") || "Features" }),
50
- /* @__PURE__ */ jsx("ul", { className: "space-y-2", children: Object.entries(BILLING_REGISTRY.features).map(([slug, feature]) => {
51
- const hasFeature = plan.features.includes("*") || plan.features.includes(slug);
52
- return /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-2", "data-cy": `feature-${slug}`, children: [
53
- hasFeature ? /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 text-green-600 flex-shrink-0" }) : /* @__PURE__ */ jsx(X, { className: "h-4 w-4 text-muted-foreground flex-shrink-0" }),
54
- /* @__PURE__ */ jsx("span", { className: cn("text-sm", !hasFeature && "text-muted-foreground"), children: t(`features.${slug}`) })
55
- ] }, slug);
56
- }) })
57
- ] }),
58
- /* @__PURE__ */ jsxs("div", { className: "space-y-3 mb-6", "data-cy": "pricing-plan-limits", children: [
59
- /* @__PURE__ */ jsx("h4", { className: "font-semibold text-sm text-muted-foreground", children: t("limits.title") || "Limits" }),
60
- /* @__PURE__ */ jsx("ul", { className: "space-y-2", children: Object.entries(BILLING_REGISTRY.limits).map(([slug, limit]) => {
61
- const value = plan.limits[slug];
62
- const displayValue = value === -1 ? t("unlimited") : value !== void 0 ? value.toString() : "-";
63
- return /* @__PURE__ */ jsxs("li", { className: "flex items-center justify-between text-sm", "data-cy": `limit-${slug}`, children: [
64
- /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: t(`limits.${slug}`) }),
65
- /* @__PURE__ */ jsx("span", { className: "font-medium", children: displayValue })
66
- ] }, slug);
67
- }) })
65
+ if (!isReady) {
66
+ return /* @__PURE__ */ jsx(
67
+ "div",
68
+ {
69
+ className: cn("grid gap-6 md:grid-cols-2 lg:grid-cols-3", className),
70
+ "data-cy": "pricing-table-loading",
71
+ children: visiblePlans.map((plan) => /* @__PURE__ */ jsx(PricingCardSkeleton, {}, plan.slug))
72
+ }
73
+ );
74
+ }
75
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
76
+ /* @__PURE__ */ jsx(
77
+ "div",
78
+ {
79
+ className: cn("grid gap-6 md:grid-cols-2 lg:grid-cols-3", className),
80
+ "data-cy": "pricing-table",
81
+ children: visiblePlans.map((plan) => {
82
+ var _a;
83
+ const isCurrentPlan = plan.slug === currentPlanSlug;
84
+ const priceMonthly = ((_a = plan.price) == null ? void 0 : _a.monthly) ? plan.price.monthly / 100 : 0;
85
+ return /* @__PURE__ */ jsxs(
86
+ Card,
87
+ {
88
+ className: cn(
89
+ "relative flex flex-col transition-all duration-200",
90
+ isCurrentPlan ? "border-primary border-2 shadow-md ring-1 ring-primary/20" : "hover:border-border/80 hover:shadow-sm"
91
+ ),
92
+ "data-cy": `pricing-plan-${plan.slug}`,
93
+ "aria-current": isCurrentPlan ? "true" : void 0,
94
+ children: [
95
+ isCurrentPlan && /* @__PURE__ */ jsx("div", { className: "absolute -top-3 left-1/2 -translate-x-1/2", children: /* @__PURE__ */ jsx(Badge, { variant: "default", "data-cy": "pricing-current-badge", children: t("currentPlan") }) }),
96
+ /* @__PURE__ */ jsxs(CardHeader, { children: [
97
+ /* @__PURE__ */ jsx(CardTitle, { className: "text-2xl", "data-cy": "pricing-plan-name", children: t(`plans.${plan.slug}.name`) }),
98
+ /* @__PURE__ */ jsx(CardDescription, { "data-cy": "pricing-plan-description", children: t(`plans.${plan.slug}.description`) }),
99
+ /* @__PURE__ */ jsx("div", { className: "mt-4", "data-cy": "pricing-plan-price", children: priceMonthly > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
100
+ /* @__PURE__ */ jsxs("span", { className: "text-4xl font-bold tabular-nums", children: [
101
+ "$",
102
+ priceMonthly.toFixed(0)
103
+ ] }),
104
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-sm", children: t("perMonth") })
105
+ ] }) : plan.type === "enterprise" ? /* @__PURE__ */ jsx("span", { className: "text-2xl font-bold", children: t("contactUs") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
106
+ /* @__PURE__ */ jsx("span", { className: "text-4xl font-bold tabular-nums", children: "$0" }),
107
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-sm", children: t("perMonth") })
108
+ ] }) })
68
109
  ] }),
69
- /* @__PURE__ */ jsx("div", { className: "mt-auto", children: /* @__PURE__ */ jsx(
70
- Button,
71
- {
72
- className: "w-full",
73
- variant: isCurrentPlan ? "outline" : "default",
74
- disabled: isCurrentPlan,
75
- onClick: () => onSelectPlan == null ? void 0 : onSelectPlan(plan.slug),
76
- "data-cy": `pricing-select-${plan.slug}`,
77
- children: isCurrentPlan ? t("currentPlan") : plan.type === "enterprise" ? t("contactSales") : t("selectPlan")
78
- }
79
- ) })
80
- ] })
81
- ]
82
- },
83
- plan.slug
84
- );
85
- })
86
- }
87
- );
110
+ /* @__PURE__ */ jsxs(CardContent, { className: "flex-1 flex flex-col", children: [
111
+ /* @__PURE__ */ jsxs("div", { className: "space-y-3 mb-6", "data-cy": "pricing-plan-features", children: [
112
+ /* @__PURE__ */ jsx("h4", { className: "font-semibold text-sm text-muted-foreground", children: t("features.title") || "Features" }),
113
+ /* @__PURE__ */ jsx("ul", { className: "space-y-2", children: Object.entries(BILLING_REGISTRY.features).map(([slug, feature]) => {
114
+ const hasFeature = plan.features.includes("*") || plan.features.includes(slug);
115
+ return /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-2", "data-cy": `feature-${slug}`, children: [
116
+ hasFeature ? /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 text-green-600 flex-shrink-0" }) : /* @__PURE__ */ jsx(X, { className: "h-4 w-4 text-muted-foreground flex-shrink-0" }),
117
+ /* @__PURE__ */ jsx("span", { className: cn("text-sm", !hasFeature && "text-muted-foreground"), children: t(`features.${slug}`) })
118
+ ] }, slug);
119
+ }) })
120
+ ] }),
121
+ /* @__PURE__ */ jsxs("div", { className: "space-y-3 mb-6", "data-cy": "pricing-plan-limits", children: [
122
+ /* @__PURE__ */ jsx("h4", { className: "font-semibold text-sm text-muted-foreground", children: t("limits.title") || "Limits" }),
123
+ /* @__PURE__ */ jsx("ul", { className: "space-y-2", children: Object.entries(BILLING_REGISTRY.limits).map(([slug, limit]) => {
124
+ const value = plan.limits[slug];
125
+ const displayValue = value === -1 ? t("unlimited") : value !== void 0 ? value.toString() : "-";
126
+ return /* @__PURE__ */ jsxs("li", { className: "flex items-center justify-between text-sm", "data-cy": `limit-${slug}`, children: [
127
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: t(`limits.${slug}`) }),
128
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: displayValue })
129
+ ] }, slug);
130
+ }) })
131
+ ] }),
132
+ /* @__PURE__ */ jsx("div", { className: "mt-auto", children: /* @__PURE__ */ jsx(
133
+ Button,
134
+ {
135
+ className: "w-full",
136
+ variant: isCurrentPlan ? "outline" : "default",
137
+ disabled: isCurrentPlan,
138
+ onClick: () => handleSelectPlan(plan.slug),
139
+ "data-cy": `pricing-select-${plan.slug}`,
140
+ children: isCurrentPlan ? t("currentPlan") : plan.type === "enterprise" ? t("contactSales") : t("selectPlan")
141
+ }
142
+ ) })
143
+ ] })
144
+ ]
145
+ },
146
+ plan.slug
147
+ );
148
+ })
149
+ }
150
+ ),
151
+ currentPlanSlug && targetPlanSlug && /* @__PURE__ */ jsx(
152
+ ConfirmPlanChangeModal,
153
+ {
154
+ open: confirmModalOpen,
155
+ onOpenChange: setConfirmModalOpen,
156
+ currentPlanSlug,
157
+ targetPlanSlug,
158
+ onConfirm: handleConfirmChange,
159
+ loading: changePlanLoading
160
+ }
161
+ )
162
+ ] });
88
163
  }
89
164
  export {
90
165
  PricingTable
@@ -0,0 +1,21 @@
1
+ import type { ReactNode } from 'react';
2
+ interface QuotaGateProps {
3
+ /** Action to check (e.g., 'professionals.create') */
4
+ action: string;
5
+ /** Human-readable entity name for the message */
6
+ entityName: string;
7
+ /** Link to go back to the list */
8
+ backHref: string;
9
+ /** Content to render when allowed */
10
+ children: ReactNode;
11
+ }
12
+ /**
13
+ * Wraps a create form. If quota is exceeded, shows an upgrade prompt
14
+ * instead of the form. Prevents the user from filling a form they can't submit.
15
+ *
16
+ * Design: neutral card with border — avoids amber/orange full-screen that
17
+ * was nearly invisible in dark mode and felt more like an error than a prompt.
18
+ */
19
+ export declare function QuotaGate({ action, entityName, backHref, children }: QuotaGateProps): import("react/jsx-runtime").JSX.Element;
20
+ export {};
21
+ //# sourceMappingURL=QuotaGate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuotaGate.d.ts","sourceRoot":"","sources":["../../../src/components/billing/QuotaGate.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAOtC,UAAU,cAAc;IACtB,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAA;IACd,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAA;IAClB,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAA;IAChB,qCAAqC;IACrC,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,cAAc,2CAkDnF"}
@@ -0,0 +1,33 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import Link from "next/link";
4
+ import { useTranslations } from "next-intl";
5
+ import { Button } from "../ui/button.js";
6
+ import { Lock, ArrowLeft, ArrowRight } from "lucide-react";
7
+ import { useQuotaCheck } from "../../hooks/useQuotaCheck.js";
8
+ function QuotaGate({ action, entityName, backHref, children }) {
9
+ const t = useTranslations("billing");
10
+ const { canCreate, isLoading, isQuotaExceeded } = useQuotaCheck(action);
11
+ if (isLoading) return null;
12
+ if (canCreate) return /* @__PURE__ */ jsx(Fragment, { children });
13
+ return /* @__PURE__ */ jsx("div", { className: "px-2 sm:px-4 lg:px-6 py-12 max-w-md mx-auto", "data-cy": "quota-gate", children: /* @__PURE__ */ jsxs("div", { className: "rounded-xl border bg-card p-8 text-center space-y-5", children: [
14
+ /* @__PURE__ */ jsx("div", { className: "inline-flex items-center justify-center w-12 h-12 rounded-full bg-muted mx-auto", children: /* @__PURE__ */ jsx(Lock, { className: "h-6 w-6 text-muted-foreground", "aria-hidden": "true" }) }),
15
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
16
+ /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-foreground", children: isQuotaExceeded ? t("quota.limitReached", { entity: entityName }) : t("quota.featureNotIncluded") }),
17
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground leading-relaxed", children: isQuotaExceeded ? t("quota.limitReachedDetail", { entity: entityName }) : t("quota.featureNotIncludedDetail") })
18
+ ] }),
19
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row justify-center gap-3 pt-1", children: [
20
+ /* @__PURE__ */ jsx(Button, { asChild: true, className: "gap-1.5", children: /* @__PURE__ */ jsxs(Link, { href: "/dashboard/settings/plans", children: [
21
+ t("quota.viewPlans"),
22
+ /* @__PURE__ */ jsx(ArrowRight, { className: "h-4 w-4", "aria-hidden": "true" })
23
+ ] }) }),
24
+ /* @__PURE__ */ jsx(Button, { asChild: true, variant: "outline", className: "gap-1.5", children: /* @__PURE__ */ jsxs(Link, { href: backHref, children: [
25
+ /* @__PURE__ */ jsx(ArrowLeft, { className: "h-4 w-4", "aria-hidden": "true" }),
26
+ t("quota.goBack")
27
+ ] }) })
28
+ ] })
29
+ ] }) });
30
+ }
31
+ export {
32
+ QuotaGate
33
+ };
@@ -11,4 +11,6 @@ export { PricingTable } from './PricingTable';
11
11
  export { SubscriptionStatus } from './SubscriptionStatus';
12
12
  export { UsageDashboard } from './UsageDashboard';
13
13
  export { UpgradeModal } from './UpgradeModal';
14
+ export { ConfirmPlanChangeModal } from './ConfirmPlanChangeModal';
15
+ export { QuotaGate } from './QuotaGate';
14
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/billing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,YAAY,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAG9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/billing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,YAAY,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAG9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA"}
@@ -9,7 +9,10 @@ import { PricingTable } from "./PricingTable.js";
9
9
  import { SubscriptionStatus } from "./SubscriptionStatus.js";
10
10
  import { UsageDashboard } from "./UsageDashboard.js";
11
11
  import { UpgradeModal } from "./UpgradeModal.js";
12
+ import { ConfirmPlanChangeModal } from "./ConfirmPlanChangeModal.js";
13
+ import { QuotaGate } from "./QuotaGate.js";
12
14
  export {
15
+ ConfirmPlanChangeModal,
13
16
  FeatureGate,
14
17
  FeaturePlaceholder,
15
18
  InvoiceStatusBadge,
@@ -17,6 +20,7 @@ export {
17
20
  InvoicesPagination,
18
21
  InvoicesTable,
19
22
  PricingTable,
23
+ QuotaGate,
20
24
  SubscriptionStatus,
21
25
  UpgradeModal,
22
26
  UsageBar,
@@ -1 +1 @@
1
- {"version":3,"file":"dynamic-form.d.ts","sourceRoot":"","sources":["../../../../src/components/dashboard/block-editor/dynamic-form.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAG5D,UAAU,gBAAgB;IACxB,gBAAgB,EAAE,eAAe,EAAE,CAAA;IACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;CACpD;AAyRD;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,EAAE,gBAAgB,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,gBAAgB,2CAodnF"}
1
+ {"version":3,"file":"dynamic-form.d.ts","sourceRoot":"","sources":["../../../../src/components/dashboard/block-editor/dynamic-form.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,eAAe,EAAY,MAAM,uBAAuB,CAAA;AAItE,UAAU,gBAAgB;IACxB,gBAAgB,EAAE,eAAe,EAAE,CAAA;IACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;CACpD;AA4RD;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,EAAE,gBAAgB,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,gBAAgB,2CAodnF"}
@@ -27,6 +27,7 @@ import { Button } from "../../ui/button.js";
27
27
  import { format } from "date-fns";
28
28
  import { ArrayField } from "./array-field.js";
29
29
  import { fetchWithTeam } from "../../../lib/api/entities.js";
30
+ import { resolveMediaUrl } from "../../../types/blocks.js";
30
31
  function evaluateCondition(condition, values) {
31
32
  if (!condition) return true;
32
33
  const fieldValue = values[condition.field];
@@ -74,19 +75,20 @@ function MediaLibraryField({
74
75
  }) {
75
76
  const [isOpen, setIsOpen] = useState(false);
76
77
  const t = useTranslations("admin.blockEditor.form");
78
+ const displayUrl = resolveMediaUrl(value || void 0) || "";
77
79
  const handleSelect = (media) => {
78
80
  if (Array.isArray(media)) return;
79
- onChange(media.url);
81
+ onChange({ mediaId: media.id, url: media.url });
80
82
  setIsOpen(false);
81
83
  };
82
84
  return /* @__PURE__ */ jsxs(Fragment, { children: [
83
- value ? /* @__PURE__ */ jsxs(
85
+ displayUrl ? /* @__PURE__ */ jsxs(
84
86
  "div",
85
87
  {
86
88
  className: "relative group rounded-md overflow-hidden",
87
89
  "data-cy": sel("blockEditor.blockPropertiesPanel.form.mediaField.preview", { name: fieldName }),
88
90
  children: [
89
- /* @__PURE__ */ jsx("img", { src: value, alt: "", className: "w-full h-40 object-cover" }),
91
+ /* @__PURE__ */ jsx("img", { src: displayUrl, alt: "", className: "w-full h-40 object-cover" }),
90
92
  /* @__PURE__ */ jsxs("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2", children: [
91
93
  /* @__PURE__ */ jsx(
92
94
  Button,
@@ -386,8 +388,8 @@ function DynamicForm({ fieldDefinitions, values, onChange }) {
386
388
  return /* @__PURE__ */ jsx(
387
389
  MediaLibraryField,
388
390
  {
389
- value: String(value || ""),
390
- onChange: (url) => handleFieldChange(field.name, url),
391
+ value: value || "",
392
+ onChange: (ref) => handleFieldChange(field.name, ref || void 0),
391
393
  fieldName: field.name
392
394
  }
393
395
  );
@@ -28,6 +28,8 @@ export interface SubscriptionContextValue {
28
28
  isPastDue: boolean;
29
29
  isCanceled: boolean;
30
30
  isLoading: boolean;
31
+ /** True once subscription data has been fetched at least once (success or error) */
32
+ isReady: boolean;
31
33
  error: Error | null;
32
34
  refetch: () => void;
33
35
  features: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"SubscriptionContext.d.ts","sourceRoot":"","sources":["../../src/contexts/SubscriptionContext.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA6B,SAAS,EAAW,MAAM,OAAO,CAAA;AAGrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAG3D,UAAU,SAAS;IACjB,GA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,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IAEjC,eAAe,EAAE,eAAe,CAAA;CACjC;AAID,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAmGzE;AAED,wBAAgB,sBAAsB,6BAMrC"}
@@ -11,6 +11,7 @@ function SubscriptionProvider({ children }) {
11
11
  const {
12
12
  data: subscription,
13
13
  isLoading,
14
+ isFetched,
14
15
  error,
15
16
  refetch
16
17
  } = useQuery({
@@ -76,6 +77,7 @@ function SubscriptionProvider({ children }) {
76
77
  isPastDue: (subscription == null ? void 0 : subscription.status) === "past_due",
77
78
  isCanceled: (subscription == null ? void 0 : subscription.status) === "canceled",
78
79
  isLoading,
80
+ isReady: isFetched,
79
81
  error,
80
82
  refetch: () => {
81
83
  refetch();
@@ -26,6 +26,7 @@ export * from './useOrigin';
26
26
  export * from './usePatternUsages';
27
27
  export * from './useQuickCreateEntities';
28
28
  export * from './useQuota';
29
+ export * from './useQuotaCheck';
29
30
  export * from './useSearch';
30
31
  export * from './useSidebarState';
31
32
  export * from './useSubscription';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAGA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,WAAW,CAAA;AACzB,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA;AACvC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,eAAe,CAAA;AAC7B,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA;AACvC,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB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5B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,WAAW,CAAA;AACzB,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA;AAC1B,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,wBAAwB,CAAA"}
@@ -26,6 +26,7 @@ export * from "./useOrigin.js";
26
26
  export * from "./usePatternUsages.js";
27
27
  export * from "./useQuickCreateEntities.js";
28
28
  export * from "./useQuota.js";
29
+ export * from "./useQuotaCheck.js";
29
30
  export * from "./useSearch.js";
30
31
  export * from "./useSidebarState.js";
31
32
  export * from "./useSubscription.js";