@zuplo/zudoku-plugin-monetization 0.0.29 → 0.0.30

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 (2) hide show
  1. package/dist/index.mjs +22 -10
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -156,6 +156,12 @@ const formatPrice = (amount, currency) => new Intl.NumberFormat("en-US", {
156
156
  maximumFractionDigits: 6,
157
157
  trailingZeroDisplay: "stripIfInteger"
158
158
  }).format(amount);
159
+ const formatPriceTwoDecimals = (amount, currency) => new Intl.NumberFormat("en-US", {
160
+ style: "currency",
161
+ currency: currency ?? "USD",
162
+ minimumFractionDigits: 2,
163
+ maximumFractionDigits: 2
164
+ }).format(amount);
159
165
 
160
166
  //#endregion
161
167
  //#region src/utils/categorizeRateCards.ts
@@ -232,7 +238,7 @@ const getPlanFromPurchaseDetails = (response) => {
232
238
  return response;
233
239
  };
234
240
  const getTaxAmountFromPurchaseDetails = (response) => {
235
- const taxAmount = response?.tax?.taxAmount;
241
+ const taxAmount = response?.tax?.items[0]?.taxAmount;
236
242
  const numericAmount = typeof taxAmount === "number" ? taxAmount : Number.parseFloat(taxAmount ?? "");
237
243
  if (!Number.isFinite(numericAmount)) return;
238
244
  return numericAmount;
@@ -411,13 +417,13 @@ const CheckoutConfirmPage = () => {
411
417
  className: "text-2xl font-bold",
412
418
  children: formatPrice(price.monthly, selectedPlan?.currency)
413
419
  }),
420
+ taxAmount != null && /* @__PURE__ */ jsx("div", {
421
+ className: "text-xs font-normal mt-1",
422
+ children: taxInclusive ? `${formatPriceTwoDecimals(taxAmount, selectedPlan?.currency)} ${taxLabel} included` : `+ ${formatPriceTwoDecimals(taxAmount, selectedPlan?.currency)} ${taxLabel}`
423
+ }),
414
424
  billingCycle && /* @__PURE__ */ jsxs("div", {
415
425
  className: "text-sm text-muted-foreground font-normal",
416
426
  children: ["Billed ", formatBillingCycle(billingCycle)]
417
- }),
418
- taxAmount != null && /* @__PURE__ */ jsx("div", {
419
- className: "text-xs text-muted-foreground font-normal mt-1",
420
- children: taxInclusive ? `${formatPrice(taxAmount, selectedPlan?.currency)} ${taxLabel} included` : `+ ${formatPrice(taxAmount, selectedPlan?.currency)} ${taxLabel}`
421
427
  })
422
428
  ]
423
429
  }),
@@ -783,7 +789,13 @@ const PricingPage = () => {
783
789
  children: pricing?.subtitle ?? "See our pricing options and choose the one that best suits your needs."
784
790
  })]
785
791
  }),
786
- /* @__PURE__ */ jsx("div", {
792
+ pricingTable.items.length === 0 ? /* @__PURE__ */ jsxs("div", {
793
+ className: "text-center py-12 text-muted-foreground",
794
+ children: [/* @__PURE__ */ jsx("p", { children: "No plans are currently available." }), /* @__PURE__ */ jsx("p", {
795
+ className: "text-sm mt-2",
796
+ children: "Make sure your plans are set up and published."
797
+ })]
798
+ }) : /* @__PURE__ */ jsx("div", {
787
799
  className: "w-full grid grid-cols-1 sm:grid-cols-[repeat(auto-fit,minmax(300px,max-content))] justify-center gap-6",
788
800
  children: pricingTable.items.map((plan) => /* @__PURE__ */ jsx(PricingCard, {
789
801
  plan,
@@ -931,13 +943,13 @@ const SubscriptionChangeConfirmPage = () => {
931
943
  className: "text-2xl font-bold",
932
944
  children: formatPrice(price.monthly, selectedPlan?.currency)
933
945
  }),
946
+ taxAmount != null && /* @__PURE__ */ jsx("div", {
947
+ className: "text-xs font-normal mt-1",
948
+ children: taxInclusive ? `${formatPriceTwoDecimals(taxAmount, selectedPlan?.currency)} ${taxLabel} included` : `+ ${formatPriceTwoDecimals(taxAmount, selectedPlan?.currency)} ${taxLabel}`
949
+ }),
934
950
  billingCycle && /* @__PURE__ */ jsxs("div", {
935
951
  className: "text-sm text-muted-foreground font-normal",
936
952
  children: ["Billed ", formatBillingCycle(billingCycle)]
937
- }),
938
- taxAmount != null && /* @__PURE__ */ jsx("div", {
939
- className: "text-xs text-muted-foreground font-normal mt-1",
940
- children: taxInclusive ? `${formatPrice(taxAmount, selectedPlan?.currency)} ${taxLabel} included` : `+ ${formatPrice(taxAmount, selectedPlan?.currency)} ${taxLabel}`
941
953
  })
942
954
  ]
943
955
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/zudoku-plugin-monetization",
3
- "version": "0.0.29",
3
+ "version": "0.0.30",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/zuplo/zudoku",
@@ -31,7 +31,7 @@
31
31
  "react": "19.2.4",
32
32
  "react-dom": "19.2.4",
33
33
  "tsdown": "0.20.3",
34
- "zudoku": "0.73.1"
34
+ "zudoku": "0.75.0"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "react": ">=19.2.0",