subos-frontend 1.0.20 → 1.0.22

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.js CHANGED
@@ -1833,6 +1833,7 @@ var TransactionFilter = ({
1833
1833
  showStatusFilter = true,
1834
1834
  showDateFilter = true,
1835
1835
  showSearchFilter = true,
1836
+ showClearFilters = true,
1836
1837
  customStatusOptions
1837
1838
  }) => {
1838
1839
  const handleFilterChange = (key, value) => {
@@ -1889,18 +1890,15 @@ var TransactionFilter = ({
1889
1890
  )
1890
1891
  ] })
1891
1892
  ] }),
1892
- showStatusFilter && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1893
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium text-gray-700", children: "Status:" }),
1894
- /* @__PURE__ */ jsxRuntime.jsx(
1895
- TransactionStatusFilter,
1896
- {
1897
- selectedStatus: filters.status,
1898
- onStatusChange: (status) => handleFilterChange("status", status),
1899
- customStatuses: customStatusOptions
1900
- }
1901
- )
1902
- ] }),
1903
- hasActiveFilters && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(
1893
+ showStatusFilter && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: /* @__PURE__ */ jsxRuntime.jsx(
1894
+ TransactionStatusFilter,
1895
+ {
1896
+ selectedStatus: filters.status,
1897
+ onStatusChange: (status) => handleFilterChange("status", status),
1898
+ customStatuses: customStatusOptions
1899
+ }
1900
+ ) }),
1901
+ hasActiveFilters && showClearFilters && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(
1904
1902
  "button",
1905
1903
  {
1906
1904
  onClick: clearFilters,
@@ -2149,9 +2147,7 @@ var SubscriptionInfoGrid = ({
2149
2147
  fields,
2150
2148
  className = "",
2151
2149
  gridCols = 3,
2152
- showDefaultFields = true,
2153
- labelFontWeight = "normal",
2154
- valueFontWeight = "medium"
2150
+ showDefaultFields = true
2155
2151
  }) => {
2156
2152
  const displayFields = fields || (showDefaultFields ? defaultFields : []);
2157
2153
  if (!subscription || displayFields.length === 0) {
@@ -2205,9 +2201,7 @@ var SubscriptionUsageDisplay = ({
2205
2201
  usageMetrics,
2206
2202
  className = "",
2207
2203
  gridCols = 3,
2208
- showProgressBars = false,
2209
- labelFontWeight = "normal",
2210
- valueFontWeight = "medium"
2204
+ showProgressBars = false
2211
2205
  }) => {
2212
2206
  if (!subscription || usageMetrics.length === 0) {
2213
2207
  return null;
@@ -2240,22 +2234,6 @@ var SubscriptionUsageDisplay = ({
2240
2234
  if (percentage >= 75) return "bg-yellow-500";
2241
2235
  return "bg-green-500";
2242
2236
  };
2243
- const getFontWeightClass = (weight) => {
2244
- switch (weight) {
2245
- case "light":
2246
- return "font-light";
2247
- case "normal":
2248
- return "font-normal";
2249
- case "medium":
2250
- return "font-medium";
2251
- case "semibold":
2252
- return "font-semibold";
2253
- case "bold":
2254
- return "font-bold";
2255
- default:
2256
- return "font-normal";
2257
- }
2258
- };
2259
2237
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `grid ${getGridClass()} gap-4 ${className}`, children: usageMetrics.map((metric) => {
2260
2238
  var _a, _b;
2261
2239
  const used = ((_a = subscription.usage) == null ? void 0 : _a[metric.key]) || 0;
@@ -2264,8 +2242,30 @@ var SubscriptionUsageDisplay = ({
2264
2242
  const percentage = getProgressPercentage(used, total);
2265
2243
  const shouldShowProgress = showProgressBars || metric.showProgress;
2266
2244
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4 border border-gray-200 rounded-lg bg-white space-y-1", children: [
2267
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: `text-sm text-gray-500 ${getFontWeightClass(labelFontWeight)}`, children: metric.label }),
2268
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: getFontWeightClass(valueFontWeight), children: displayValue }),
2245
+ /* @__PURE__ */ jsxRuntime.jsx(
2246
+ "p",
2247
+ {
2248
+ className: "text-sm text-gray-500",
2249
+ style: {
2250
+ fontSize: "var(--subos-font-size-subscription-label, 0.875rem)",
2251
+ fontWeight: "var(--subos-font-weight-subscription-label, 400)",
2252
+ color: "var(--subos-color-subscription-label, #6c757d)"
2253
+ },
2254
+ children: metric.label
2255
+ }
2256
+ ),
2257
+ /* @__PURE__ */ jsxRuntime.jsx(
2258
+ "p",
2259
+ {
2260
+ className: "font-medium",
2261
+ style: {
2262
+ fontSize: "var(--subos-font-size-subscription-value, 1rem)",
2263
+ fontWeight: "var(--subos-font-weight-subscription-value, 500)",
2264
+ color: "var(--subos-color-subscription-value, inherit)"
2265
+ },
2266
+ children: displayValue
2267
+ }
2268
+ ),
2269
2269
  shouldShowProgress && total > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full bg-gray-200 rounded-full h-2", children: /* @__PURE__ */ jsxRuntime.jsx(
2270
2270
  "div",
2271
2271
  {
@@ -2619,6 +2619,7 @@ var SubscriptionDetails = ({
2619
2619
  };
2620
2620
  var UpgradeSummary = ({
2621
2621
  selectedPlan,
2622
+ currentPlan,
2622
2623
  externalId,
2623
2624
  onUpgrade,
2624
2625
  isVisible = true
@@ -2626,10 +2627,25 @@ var UpgradeSummary = ({
2626
2627
  const [checkoutInfo, setCheckoutInfo] = React8.useState(null);
2627
2628
  const [loading, setLoading] = React8.useState(false);
2628
2629
  React8.useEffect(() => {
2629
- if (!selectedPlan || !isVisible || Number(selectedPlan.fixedCost) === 0) {
2630
+ const planToDisplay2 = selectedPlan || currentPlan;
2631
+ if (!planToDisplay2 || !isVisible || Number(planToDisplay2.fixedCost) === 0) {
2630
2632
  setCheckoutInfo(null);
2631
2633
  return;
2632
2634
  }
2635
+ if (!selectedPlan && currentPlan) {
2636
+ const mockCheckoutInfo = {
2637
+ planName: currentPlan.name,
2638
+ planPrice: currentPlan.fixedCost,
2639
+ planInterval: currentPlan.interval,
2640
+ proration: 0,
2641
+ // No proration for current plan
2642
+ planCode: currentPlan.code,
2643
+ planCurrency: "USD"
2644
+ // Default currency
2645
+ };
2646
+ setCheckoutInfo(mockCheckoutInfo);
2647
+ return;
2648
+ }
2633
2649
  const fetchCheckoutInfo = async () => {
2634
2650
  setLoading(true);
2635
2651
  try {
@@ -2645,8 +2661,10 @@ var UpgradeSummary = ({
2645
2661
  }
2646
2662
  };
2647
2663
  fetchCheckoutInfo();
2648
- }, [selectedPlan, externalId, isVisible]);
2649
- if (!selectedPlan || !isVisible || Number(selectedPlan.fixedCost) === 0 || loading || !checkoutInfo) {
2664
+ }, [selectedPlan, currentPlan, externalId, isVisible]);
2665
+ const planToDisplay = selectedPlan || currentPlan;
2666
+ const isShowingCurrentPlan = !selectedPlan && currentPlan;
2667
+ if (!planToDisplay || !isVisible || Number(planToDisplay.fixedCost) === 0 || loading || !checkoutInfo) {
2650
2668
  return null;
2651
2669
  }
2652
2670
  const displayInfo = checkoutInfo;
@@ -2655,9 +2673,9 @@ var UpgradeSummary = ({
2655
2673
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
2656
2674
  "div",
2657
2675
  {
2658
- className: "shadow-xl rounded-md border px-4 py-3",
2676
+ className: "shadow-xl rounded-md border px-4 py-3 backdrop-blur-md",
2659
2677
  style: {
2660
- backgroundColor: "var(--subos-background, #ffffff)",
2678
+ backgroundColor: "rgba(255, 255, 255, 0.6)",
2661
2679
  borderColor: "var(--subos-border, #e2e8f0)",
2662
2680
  boxShadow: "var(--subos-shadow-card-hover, 0 8px 24px rgba(0,0,0,0.15))"
2663
2681
  },
@@ -2701,7 +2719,7 @@ var UpgradeSummary = ({
2701
2719
  {
2702
2720
  className: "text-sm",
2703
2721
  style: { color: "var(--subos-muted-foreground, #64748b)" },
2704
- children: "Due Today"
2722
+ children: isShowingCurrentPlan ? "Current Cost" : "Due Today"
2705
2723
  }
2706
2724
  ),
2707
2725
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2715,7 +2733,7 @@ var UpgradeSummary = ({
2715
2733
  ]
2716
2734
  }
2717
2735
  ),
2718
- displayInfo.proration > 0 && /* @__PURE__ */ jsxRuntime.jsx(
2736
+ displayInfo.proration > 0 && !isShowingCurrentPlan && /* @__PURE__ */ jsxRuntime.jsx(
2719
2737
  "p",
2720
2738
  {
2721
2739
  className: "text-xs mt-1",
@@ -2727,26 +2745,28 @@ var UpgradeSummary = ({
2727
2745
  /* @__PURE__ */ jsxRuntime.jsx(
2728
2746
  "button",
2729
2747
  {
2730
- onClick: onUpgrade,
2731
- disabled: loading,
2732
- className: "text-white px-8 py-3 rounded-lg font-semibold transition-all duration-200 text-sm disabled:opacity-50 shadow-md",
2748
+ onClick: isShowingCurrentPlan ? void 0 : onUpgrade,
2749
+ disabled: loading || !!isShowingCurrentPlan,
2750
+ className: "text-white px-8 py-3 rounded-lg font-medium transition-all duration-200 text-sm disabled:opacity-50 shadow-md",
2733
2751
  style: {
2734
- backgroundColor: loading ? "var(--subos-muted, #f1f5f9)" : "var(--subos-primary-500, #ef4444)",
2735
- color: loading ? "var(--subos-muted-foreground, #64748b)" : "white",
2736
- border: "none",
2737
- boxShadow: loading ? "none" : "0 4px 12px rgba(239, 68, 68, 0.3)"
2752
+ backgroundColor: loading || isShowingCurrentPlan ? "var(--subos-muted, #f1f5f9)" : "var(--subos-primary-500, #ef4444)",
2753
+ color: loading || isShowingCurrentPlan ? "var(--subos-muted-foreground, #64748b)" : "white",
2754
+ border: isShowingCurrentPlan ? "1px solid var(--subos-border, #e2e8f0)" : "none",
2755
+ boxShadow: loading || isShowingCurrentPlan ? "none" : "0 4px 12px rgba(239, 68, 68, 0.3)",
2756
+ cursor: isShowingCurrentPlan ? "not-allowed" : "pointer"
2738
2757
  },
2739
- onMouseEnter: !loading ? (e) => {
2758
+ onMouseEnter: !loading && !isShowingCurrentPlan ? (e) => {
2740
2759
  e.currentTarget.style.backgroundColor = "#dc2626";
2741
2760
  e.currentTarget.style.transform = "translateY(-1px)";
2742
2761
  e.currentTarget.style.boxShadow = "0 6px 16px rgba(239, 68, 68, 0.4)";
2743
2762
  } : void 0,
2744
- onMouseLeave: !loading ? (e) => {
2763
+ onMouseLeave: !loading && !isShowingCurrentPlan ? (e) => {
2745
2764
  e.currentTarget.style.backgroundColor = "var(--subos-primary-500, #ef4444)";
2746
2765
  e.currentTarget.style.transform = "translateY(0)";
2747
2766
  e.currentTarget.style.boxShadow = "0 4px 12px rgba(239, 68, 68, 0.3)";
2748
2767
  } : void 0,
2749
- children: loading ? "Loading..." : "Upgrade Now"
2768
+ title: isShowingCurrentPlan ? "This is your current active plan" : void 0,
2769
+ children: loading ? "Loading..." : isShowingCurrentPlan ? "Current Plan" : "Upgrade Now"
2750
2770
  }
2751
2771
  )
2752
2772
  ] })
@@ -2963,7 +2983,7 @@ var Pagination = ({
2963
2983
  var DashboardPage = ({
2964
2984
  externalId
2965
2985
  }) => {
2966
- var _a;
2986
+ var _a, _b, _c;
2967
2987
  const subscription = useSubscription();
2968
2988
  const plans = usePlans();
2969
2989
  const lastLoadedIdRef = React8.useRef(null);
@@ -3016,9 +3036,23 @@ var DashboardPage = ({
3016
3036
  UpgradeSummary,
3017
3037
  {
3018
3038
  selectedPlan: plans.selectedPlan,
3039
+ currentPlan: ((_b = subscription.subscription) == null ? void 0 : _b.plan) ? {
3040
+ id: subscription.subscription.plan.code,
3041
+ name: subscription.subscription.plan.name,
3042
+ code: subscription.subscription.plan.code,
3043
+ fixedCost: subscription.subscription.plan.fixedCost,
3044
+ paymentMode: subscription.subscription.plan.paymentMode,
3045
+ interval: subscription.subscription.plan.interval,
3046
+ successRedirectUrl: "",
3047
+ order: 0,
3048
+ isDefault: false,
3049
+ intervalCount: 1,
3050
+ projectId: "",
3051
+ charges: subscription.subscription.plan.charges || []
3052
+ } : null,
3019
3053
  externalId,
3020
3054
  onUpgrade: handleUpgrade,
3021
- isVisible: !!plans.selectedPlan
3055
+ isVisible: !!plans.selectedPlan || !!((_c = subscription.subscription) == null ? void 0 : _c.plan)
3022
3056
  }
3023
3057
  )
3024
3058
  ] }) }) });