@zuplo/zudoku-plugin-monetization 0.0.22 → 0.0.23

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/index.d.mts CHANGED
@@ -6,6 +6,7 @@ type ZudokuMonetizationPluginOptions = {
6
6
  subtitle?: string;
7
7
  title?: string;
8
8
  units?: Record<string, string>;
9
+ showYearlyPrice?: boolean;
9
10
  };
10
11
  };
11
12
  declare const zuploMonetizationPlugin: (options?: ZudokuMonetizationPluginOptions | undefined) => zudoku.ZudokuPlugin;
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { cn, createPlugin, joinUrl } from "zudoku";
2
2
  import { AlertTriangleIcon, ArrowDownIcon, ArrowLeftRightIcon, ArrowUpIcon, CalendarIcon, CheckCheckIcon, CheckIcon, CircleAlert, CircleSlashIcon, ClockIcon, CreditCardIcon, Grid2x2XIcon, InfoIcon, Loader2Icon, LockIcon, MoreVerticalIcon, RefreshCcw, RefreshCwIcon, Settings, ShieldIcon, StarsIcon, Trash2Icon, XIcon } from "zudoku/icons";
3
- import { Button, ClientOnly, Head, Heading, Link } from "zudoku/components";
3
+ import { Button, ClientOnly, Head, Heading, Link, Slot } from "zudoku/components";
4
4
  import { useAuth, useZudoku } from "zudoku/hooks";
5
5
  import { QueryClient, QueryClientProvider, useMutation, useQuery, useQueryClient, useSuspenseQuery } from "zudoku/react-query";
6
6
  import { Link as Link$1, Outlet, useLocation, useNavigate, useParams, useSearchParams } from "zudoku/router";
@@ -603,7 +603,7 @@ const PhaseSection = ({ phase, currency, showName, excludeKeys, units }) => {
603
603
  ]
604
604
  });
605
605
  };
606
- const PricingCard = ({ plan, isPopular = false, isSubscribed = false, units }) => {
606
+ const PricingCard = ({ plan, isPopular = false, isSubscribed = false, showYearlyPrice = true, units }) => {
607
607
  if (plan.phases.length === 0) return null;
608
608
  const price = getPriceFromPlan(plan);
609
609
  const isFree = price.monthly === 0;
@@ -640,7 +640,7 @@ const PricingCard = ({ plan, isPopular = false, isSubscribed = false, units }) =
640
640
  }), !isFree && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
641
641
  className: "text-muted-foreground text-sm",
642
642
  children: "/mo"
643
- }), /* @__PURE__ */ jsxs("div", {
643
+ }), showYearlyPrice && /* @__PURE__ */ jsxs("div", {
644
644
  className: "w-full text-sm text-muted-foreground mt-1",
645
645
  children: [formatPrice(price.yearly, plan.currency), "/year"]
646
646
  })] })] })
@@ -685,7 +685,7 @@ const PricingCard = ({ plan, isPopular = false, isSubscribed = false, units }) =
685
685
 
686
686
  //#endregion
687
687
  //#region src/pages/PricingPage.tsx
688
- const PricingPage = ({ subtitle = "See our pricing options and choose the one that best suits your needs.", title = "Pricing", units }) => {
688
+ const PricingPage = ({ subtitle = "See our pricing options and choose the one that best suits your needs.", title = "Pricing", units, showYearlyPrice = true }) => {
689
689
  const zudoku = useZudoku();
690
690
  const deploymentName = useDeploymentName();
691
691
  const auth = useAuth();
@@ -719,10 +719,12 @@ const PricingPage = ({ subtitle = "See our pricing options and choose the one th
719
719
  children: pricingTable.items.map((plan) => /* @__PURE__ */ jsx(PricingCard, {
720
720
  plan,
721
721
  units,
722
+ showYearlyPrice,
722
723
  isPopular: plan.metadata?.zuplo_most_popular === "true",
723
724
  isSubscribed: subscriptions.items.some((subscription) => ["active", "canceled"].includes(subscription.status))
724
725
  }, plan.id))
725
- })
726
+ }),
727
+ /* @__PURE__ */ jsx(Slot.Target, { name: "pricing-page-after" })
726
728
  ]
727
729
  });
728
730
  };
@@ -1993,7 +1995,8 @@ const zuploMonetizationPlugin = createPlugin((options) => ({
1993
1995
  element: /* @__PURE__ */ jsx(PricingPage, {
1994
1996
  subtitle: options?.pricing?.subtitle,
1995
1997
  title: options?.pricing?.title,
1996
- units: options?.pricing?.units
1998
+ units: options?.pricing?.units,
1999
+ showYearlyPrice: options?.pricing?.showYearlyPrice
1997
2000
  })
1998
2001
  },
1999
2002
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/zudoku-plugin-monetization",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/zuplo/zudoku",
@@ -27,11 +27,11 @@
27
27
  "@testing-library/react": "16.3.2",
28
28
  "@types/react": "19.2.14",
29
29
  "@types/react-dom": "19.2.3",
30
- "happy-dom": "20.7.0",
30
+ "happy-dom": "20.8.3",
31
31
  "react": "19.2.4",
32
32
  "react-dom": "19.2.4",
33
33
  "tsdown": "0.20.3",
34
- "zudoku": "0.70.4"
34
+ "zudoku": "0.71.2"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "react": ">=19.2.0",