@carlonicora/nextjs-jsonapi 6.4.0 → 6.5.0

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.
@@ -1317,7 +1317,8 @@ function SubscriptionDetails({
1317
1317
  open,
1318
1318
  onOpenChange,
1319
1319
  onSubscriptionChange,
1320
- onChangePlan
1320
+ onChangePlan,
1321
+ renderCancelDialog
1321
1322
  }) {
1322
1323
  const t = useTranslations16();
1323
1324
  const fmt = useBillingFormatOptions();
@@ -1380,7 +1381,19 @@ function SubscriptionDetails({
1380
1381
  ] })
1381
1382
  ] })
1382
1383
  ] }) }),
1383
- showCancel && /* @__PURE__ */ jsx17(
1384
+ showCancel && (renderCancelDialog ? renderCancelDialog({
1385
+ subscription,
1386
+ open: showCancel,
1387
+ onOpenChange: setShowCancel,
1388
+ onSuccess: /* @__PURE__ */ __name(() => {
1389
+ onSubscriptionChange();
1390
+ setShowCancel(false);
1391
+ }, "onSuccess"),
1392
+ openChangePlan: onChangePlan ? () => {
1393
+ onChangePlan(subscription);
1394
+ onOpenChange(false);
1395
+ } : void 0
1396
+ }) : /* @__PURE__ */ jsx17(
1384
1397
  CancelSubscriptionDialog,
1385
1398
  {
1386
1399
  subscription,
@@ -1391,7 +1404,7 @@ function SubscriptionDetails({
1391
1404
  setShowCancel(false);
1392
1405
  }
1393
1406
  }
1394
- )
1407
+ ))
1395
1408
  ] });
1396
1409
  }
1397
1410
  __name(SubscriptionDetails, "SubscriptionDetails");
@@ -1417,7 +1430,12 @@ function formatPlanName3(price, t) {
1417
1430
  return interval ? `${planLabel} (${interval})` : planLabel || t("billing.ui.not_available");
1418
1431
  }
1419
1432
  __name(formatPlanName3, "formatPlanName");
1420
- function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan }) {
1433
+ function SubscriptionsList({
1434
+ subscriptions,
1435
+ onSubscriptionsChange,
1436
+ onChangePlan,
1437
+ renderCancelDialog
1438
+ }) {
1421
1439
  const t = useTranslations17();
1422
1440
  const fmt = useBillingFormatOptions();
1423
1441
  const [selectedSub, setSelectedSub] = useState9(null);
@@ -1488,7 +1506,8 @@ function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan
1488
1506
  onChangePlan: onChangePlan ? (sub) => {
1489
1507
  setSelectedSub(null);
1490
1508
  onChangePlan(sub);
1491
- } : void 0
1509
+ } : void 0,
1510
+ renderCancelDialog
1492
1511
  }
1493
1512
  )
1494
1513
  ] });
@@ -1501,7 +1520,8 @@ function SubscriptionsContainer({
1501
1520
  onOpenWizard,
1502
1521
  hasActiveRecurringSubscription,
1503
1522
  subscriptions: parentSubscriptions,
1504
- onSubscriptionsChange
1523
+ onSubscriptionsChange,
1524
+ renderCancelDialog
1505
1525
  }) {
1506
1526
  const t = useTranslations18();
1507
1527
  const isControlled = parentSubscriptions !== void 0;
@@ -1555,7 +1575,8 @@ function SubscriptionsContainer({
1555
1575
  {
1556
1576
  subscriptions,
1557
1577
  onSubscriptionsChange: loadSubscriptions,
1558
- onChangePlan: (sub) => onOpenWizard?.(sub)
1578
+ onChangePlan: (sub) => onOpenWizard?.(sub),
1579
+ renderCancelDialog
1559
1580
  }
1560
1581
  )
1561
1582
  ] });
@@ -2996,7 +3017,7 @@ __name(BillingAlertBanner, "BillingAlertBanner");
2996
3017
 
2997
3018
  // src/features/billing/components/containers/BillingDashboardContainer.tsx
2998
3019
  import { Fragment as Fragment7, jsx as jsx38, jsxs as jsxs34 } from "react/jsx-runtime";
2999
- function BillingDashboardContainer() {
3020
+ function BillingDashboardContainer({ renderCancelDialog } = {}) {
3000
3021
  const t = useTranslations37();
3001
3022
  const [data, setData] = useState16({
3002
3023
  customer: null,
@@ -3316,7 +3337,8 @@ function BillingDashboardContainer() {
3316
3337
  onOpenWizard: handleOpenWizard,
3317
3338
  hasActiveRecurringSubscription,
3318
3339
  subscriptions: data.subscriptions,
3319
- onSubscriptionsChange: refreshData
3340
+ onSubscriptionsChange: refreshData,
3341
+ renderCancelDialog
3320
3342
  }
3321
3343
  )
3322
3344
  }