subos-frontend 1.0.103 → 1.0.104

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
@@ -617,6 +617,27 @@ var formatDate = (dateString, format = "date") => {
617
617
  day: "numeric"
618
618
  }).format(date);
619
619
  };
620
+ var getGracePeriodInfo = (subscription) => {
621
+ var _a;
622
+ if (!((_a = subscription == null ? void 0 : subscription.meta) == null ? void 0 : _a.isGracePeriod)) {
623
+ return null;
624
+ }
625
+ const startDate = subscription.meta.gracePeriodStart;
626
+ const endDate = subscription.meta.gracePeriodEnd;
627
+ let remainingDays = subscription.remainingGracePeriodDays ?? 0;
628
+ if (endDate) {
629
+ const end = new Date(endDate).getTime();
630
+ const now = (/* @__PURE__ */ new Date()).getTime();
631
+ const diff = end - now;
632
+ remainingDays = Math.max(0, Math.ceil(diff / (1e3 * 60 * 60 * 24)));
633
+ }
634
+ return {
635
+ startDate,
636
+ endDate,
637
+ remainingDays,
638
+ message: `Your 7-day grace period started on ${startDate ? formatDate(startDate) : "N/A"}. You have ${remainingDays} days remaining to update your payment method to continue your subscription without interruption.`
639
+ };
640
+ };
620
641
 
621
642
  // src/hooks/usePlans.ts
622
643
  var usePlans = () => {
@@ -3768,6 +3789,7 @@ exports.getApiBaseUrl = getApiBaseUrl;
3768
3789
  exports.getCandidateUnits = getCandidateUnits;
3769
3790
  exports.getCurrentSelectionText = getCurrentSelectionText;
3770
3791
  exports.getDropdownOptions = getDropdownOptions;
3792
+ exports.getGracePeriodInfo = getGracePeriodInfo;
3771
3793
  exports.getPlanDescription = getPlanDescription;
3772
3794
  exports.getPlanFeatures = getPlanFeatures;
3773
3795
  exports.getProjectId = getProjectId;