@fluid-app/portal-sdk 0.1.282 → 0.1.284
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/{SubscriptionsScreen-ytYw9K4M.cjs → SubscriptionsScreen-BaVQHSBl.cjs} +1 -1
- package/dist/{SubscriptionsScreen-TwddR9dd.mjs → SubscriptionsScreen-CWnj0SIk.mjs} +310 -132
- package/dist/SubscriptionsScreen-CWnj0SIk.mjs.map +1 -0
- package/dist/{SubscriptionsScreen-CG0lUArL.cjs → SubscriptionsScreen-D82JKEST.cjs} +310 -132
- package/dist/SubscriptionsScreen-D82JKEST.cjs.map +1 -0
- package/dist/de-D-pTKAfW.mjs +6 -0
- package/dist/de-D-pTKAfW.mjs.map +1 -0
- package/dist/de-DlGTKoNF.cjs +12 -0
- package/dist/de-DlGTKoNF.cjs.map +1 -0
- package/dist/el-DJHdmWRg.mjs +6 -0
- package/dist/el-DJHdmWRg.mjs.map +1 -0
- package/dist/el-DmE3Hzmx.cjs +12 -0
- package/dist/el-DmE3Hzmx.cjs.map +1 -0
- package/dist/es-BktZit95.mjs +6 -0
- package/dist/es-BktZit95.mjs.map +1 -0
- package/dist/es-CdUtxnpO.cjs +12 -0
- package/dist/es-CdUtxnpO.cjs.map +1 -0
- package/dist/fr-BupLb6QX.cjs +12 -0
- package/dist/fr-BupLb6QX.cjs.map +1 -0
- package/dist/fr-Cw5sl5qD.mjs +6 -0
- package/dist/fr-Cw5sl5qD.mjs.map +1 -0
- package/dist/he-POkv2_Vj.cjs +12 -0
- package/dist/he-POkv2_Vj.cjs.map +1 -0
- package/dist/he-ud7jtKmt.mjs +6 -0
- package/dist/he-ud7jtKmt.mjs.map +1 -0
- package/dist/hu-DM6iXy8A.cjs +12 -0
- package/dist/hu-DM6iXy8A.cjs.map +1 -0
- package/dist/hu-i6hsv2P1.mjs +6 -0
- package/dist/hu-i6hsv2P1.mjs.map +1 -0
- package/dist/id-DrazPWpH.cjs +12 -0
- package/dist/id-DrazPWpH.cjs.map +1 -0
- package/dist/id-DwQYjW0y.mjs +6 -0
- package/dist/id-DwQYjW0y.mjs.map +1 -0
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/it-CeDTGyHZ.mjs +6 -0
- package/dist/it-CeDTGyHZ.mjs.map +1 -0
- package/dist/it-DJZTksMf.cjs +12 -0
- package/dist/it-DJZTksMf.cjs.map +1 -0
- package/dist/ja-BsDZKtuF.mjs +6 -0
- package/dist/ja-BsDZKtuF.mjs.map +1 -0
- package/dist/ja-EkL2I43a.cjs +12 -0
- package/dist/ja-EkL2I43a.cjs.map +1 -0
- package/dist/ko-CAJT7oX_.mjs +6 -0
- package/dist/ko-CAJT7oX_.mjs.map +1 -0
- package/dist/ko-nvUbObdA.cjs +12 -0
- package/dist/ko-nvUbObdA.cjs.map +1 -0
- package/dist/nl-BGK_iU4v.mjs +6 -0
- package/dist/nl-BGK_iU4v.mjs.map +1 -0
- package/dist/nl-DmYVhUdz.cjs +12 -0
- package/dist/nl-DmYVhUdz.cjs.map +1 -0
- package/dist/pl-CXkmBkzj.mjs +6 -0
- package/dist/pl-CXkmBkzj.mjs.map +1 -0
- package/dist/pl-DcI4V80q.cjs +12 -0
- package/dist/pl-DcI4V80q.cjs.map +1 -0
- package/dist/pt-Bu4CWKGe.mjs +6 -0
- package/dist/pt-Bu4CWKGe.mjs.map +1 -0
- package/dist/pt-C3OW-rk-.cjs +12 -0
- package/dist/pt-C3OW-rk-.cjs.map +1 -0
- package/dist/ro-CgxOj7vq.cjs +12 -0
- package/dist/ro-CgxOj7vq.cjs.map +1 -0
- package/dist/ro-D4VP5JZk.mjs +6 -0
- package/dist/ro-D4VP5JZk.mjs.map +1 -0
- package/dist/ru-BmPMRg7Z.mjs +6 -0
- package/dist/ru-BmPMRg7Z.mjs.map +1 -0
- package/dist/ru-DuWWq-BM.cjs +12 -0
- package/dist/ru-DuWWq-BM.cjs.map +1 -0
- package/dist/th-BbInWYyP.mjs +6 -0
- package/dist/th-BbInWYyP.mjs.map +1 -0
- package/dist/th-_sG5tZjo.cjs +12 -0
- package/dist/th-_sG5tZjo.cjs.map +1 -0
- package/dist/tl-5CmO-_sk.mjs +6 -0
- package/dist/tl-5CmO-_sk.mjs.map +1 -0
- package/dist/tl-BbpJzTrp.cjs +12 -0
- package/dist/tl-BbpJzTrp.cjs.map +1 -0
- package/dist/tr-Bp9hpupi.cjs +12 -0
- package/dist/tr-Bp9hpupi.cjs.map +1 -0
- package/dist/tr-CBAj6vfD.mjs +6 -0
- package/dist/tr-CBAj6vfD.mjs.map +1 -0
- package/dist/zh_CN-DDuxhKf9.cjs +12 -0
- package/dist/zh_CN-DDuxhKf9.cjs.map +1 -0
- package/dist/zh_CN-uqlHFHuc.mjs +6 -0
- package/dist/zh_CN-uqlHFHuc.mjs.map +1 -0
- package/dist/zh_TW-85s6CrDM.mjs +6 -0
- package/dist/zh_TW-85s6CrDM.mjs.map +1 -0
- package/dist/zh_TW-C24oYhoK.cjs +12 -0
- package/dist/zh_TW-C24oYhoK.cjs.map +1 -0
- package/package.json +18 -18
- package/dist/SubscriptionsScreen-CG0lUArL.cjs.map +0 -1
- package/dist/SubscriptionsScreen-TwddR9dd.mjs.map +0 -1
|
@@ -3,6 +3,7 @@ import { C as subscriptions_reactivate, D as subscriptions_update, E as subscrip
|
|
|
3
3
|
import { i as usePayApi } from "./api-context-3GmfqvIB.mjs";
|
|
4
4
|
import { n as useCountriesApi } from "./countries-api-context-CMh13cfX.mjs";
|
|
5
5
|
import { n as usePortalTenantClient } from "./PortalTenantClientProvider-BF-1Fy27.mjs";
|
|
6
|
+
import { i as createTranslationContext, n as createDomainTranslations, o as useActiveLocale, r as useDomainDict, t as createStaticDictAdapter } from "./static-dict-adapter-OprHuHgs.mjs";
|
|
6
7
|
import { $t as constructFrom, At as isProtectedDayOfYearToken, C as SelectContent, Cn as cn$1, E as SelectValue, Ft as getWeekYear, Ht as addWeeks, It as getISOWeek, Jt as startOfWeek, Kt as getTimezoneOffsetInMilliseconds, Lt as enUS, Mt as warnOrThrowProtectedError, Nt as longFormatters, Ot as isAfter, Pt as getWeek, Q as DialogContent, Qt as toDate, R as Label, S as Select, T as SelectTrigger, Vt as addYears, X as Dialog, Xt as addMonths, Yt as getDefaultOptions$1, Zt as addDays, _n as AlertDialogTitle, an as BreadcrumbLink, at as Popover, cn as BreadcrumbSeparator, en as millisecondsInHour, et as DialogFooter, f as fluidToast, fn as AlertDialogCancel, gn as AlertDialogHeader, h as Skeleton, hn as AlertDialogFooter, in as BreadcrumbItem, it as DialogTitle, jt as isProtectedWeekYearToken, k as Input, kt as format, mn as AlertDialogDescription, nn as millisecondsInSecond, on as BreadcrumbList, ot as PopoverContent, pn as AlertDialogContent, qt as startOfISOWeek, rn as Breadcrumb, sn as BreadcrumbPage, st as PopoverTrigger, tn as millisecondsInMinute, tt as DialogHeader, un as AlertDialog, vn as Button, w as SelectItem, wt as Calendar$1, xn as PortalContainerProvider } from "./src-Dk1FJOX0.mjs";
|
|
7
8
|
import { n as ScreenHeaderBreadcrumbs } from "./ScreenHeaderContext-Dn12BZyj.mjs";
|
|
8
9
|
import { n as payKeys, r as storeKeys } from "./query-keys-BkMRwfNo.mjs";
|
|
@@ -2659,6 +2660,170 @@ function PortalSubscriptionsApiProvider({ children }) {
|
|
|
2659
2660
|
});
|
|
2660
2661
|
}
|
|
2661
2662
|
//#endregion
|
|
2663
|
+
//#region ../../subscriptions/core/src/translation-api-context.ts
|
|
2664
|
+
const { Provider, useTranslation } = createTranslationContext("Subscriptions");
|
|
2665
|
+
const SubscriptionsTranslationProvider = Provider;
|
|
2666
|
+
const useSubscriptionsTranslation = useTranslation;
|
|
2667
|
+
//#endregion
|
|
2668
|
+
//#region ../../subscriptions/core/src/translation-adapter.ts
|
|
2669
|
+
const subscriptionsDomain = createDomainTranslations({
|
|
2670
|
+
fallback: {
|
|
2671
|
+
breadcrumb: "Subscriptions",
|
|
2672
|
+
breadcrumb_detail: "Subscription #{{token}}",
|
|
2673
|
+
all: "All",
|
|
2674
|
+
active: "Active",
|
|
2675
|
+
inactive: "Inactive",
|
|
2676
|
+
search_placeholder: "Search subscriptions...",
|
|
2677
|
+
product: "Product",
|
|
2678
|
+
next_bill_date: "Next Bill Date",
|
|
2679
|
+
price: "Price",
|
|
2680
|
+
status: "Status",
|
|
2681
|
+
no_subscriptions_found: "No subscriptions found",
|
|
2682
|
+
unknown_status: "Unknown",
|
|
2683
|
+
total: "Total",
|
|
2684
|
+
results: "results",
|
|
2685
|
+
previous: "Previous",
|
|
2686
|
+
next: "Next",
|
|
2687
|
+
pagination: "Pagination",
|
|
2688
|
+
your_upcoming_order: "Your Upcoming Order",
|
|
2689
|
+
next_order_date: "Next Order Date",
|
|
2690
|
+
next_bill_amount: "Next Bill Amount",
|
|
2691
|
+
product_image_alt: "Product image",
|
|
2692
|
+
no_image: "No image",
|
|
2693
|
+
quantity_label: "Quantity",
|
|
2694
|
+
quantity_aria: "Quantity",
|
|
2695
|
+
subtotal: "Subtotal",
|
|
2696
|
+
discount: "Discount",
|
|
2697
|
+
total_label: "Total",
|
|
2698
|
+
tax_shipping_note: "*Tax and shipping calculated at checkout",
|
|
2699
|
+
order_actions: "Order Actions",
|
|
2700
|
+
skip_next_order: "Skip Next Order",
|
|
2701
|
+
edit_bill_date: "Edit Bill Date",
|
|
2702
|
+
pause_subscription: "Pause Subscription",
|
|
2703
|
+
cancel_subscription: "Cancel Subscription",
|
|
2704
|
+
cancelled_subscription: "Cancelled Subscription",
|
|
2705
|
+
resume_subscription: "Resume Subscription",
|
|
2706
|
+
reactivate_subscription: "Reactivate Subscription",
|
|
2707
|
+
skip_next: "Skip Next",
|
|
2708
|
+
pause: "Pause",
|
|
2709
|
+
cancel: "Cancel",
|
|
2710
|
+
resume: "Resume",
|
|
2711
|
+
reactivate: "Reactivate",
|
|
2712
|
+
subscription_details: "Subscription Details",
|
|
2713
|
+
order_frequency: "Order Frequency",
|
|
2714
|
+
next_payment: "Next Payment",
|
|
2715
|
+
last_billed: "Last Billed",
|
|
2716
|
+
payment_and_shipping: "Payment & Shipping",
|
|
2717
|
+
shipping_address: "Shipping Address",
|
|
2718
|
+
payment_method: "Payment Method",
|
|
2719
|
+
card_fallback: "Card",
|
|
2720
|
+
ending_in: "ending in {{last4}}",
|
|
2721
|
+
no_payment_method: "No payment method",
|
|
2722
|
+
no_shipping_address: "No shipping address available",
|
|
2723
|
+
subscription_order_history: "Subscription Order History",
|
|
2724
|
+
order: "Order",
|
|
2725
|
+
date: "Date",
|
|
2726
|
+
amount: "Amount",
|
|
2727
|
+
not_available: "N/A",
|
|
2728
|
+
cancel_dialog_title: "Cancel Subscription",
|
|
2729
|
+
cancel_dialog_description: "Are you sure you want to cancel this subscription? You can reactivate it later.",
|
|
2730
|
+
cancel_dialog_pause_question: "Would you like to pause your subscription instead?",
|
|
2731
|
+
cancel_dialog_pause_button: "Pause Subscription",
|
|
2732
|
+
cancel_dialog_cancel_button: "Cancel",
|
|
2733
|
+
cancel_dialog_confirm_button: "Cancel Subscription",
|
|
2734
|
+
pause_for: "Pause for",
|
|
2735
|
+
select_duration: "Select duration",
|
|
2736
|
+
month_singular: "{{count}} month",
|
|
2737
|
+
month_plural: "{{count}} months",
|
|
2738
|
+
pause_dialog_title: "Pause subscription",
|
|
2739
|
+
pause_dialog_description: "Are you sure you want to pause subscription?",
|
|
2740
|
+
pause_dialog_action: "Pause",
|
|
2741
|
+
pause_indefinitely: "Pause indefinitely",
|
|
2742
|
+
pause_for_orders: "Pause for a number of upcoming orders",
|
|
2743
|
+
choose_orders_to_skip: "Choose how many orders to skip",
|
|
2744
|
+
select: "Select",
|
|
2745
|
+
pause_dialog_cancel: "Cancel",
|
|
2746
|
+
pause_indefinite_message_prefix: "If you pause indefinitely no further charges will occur. To restart, simply select",
|
|
2747
|
+
pause_indefinite_message_resume: "Resume",
|
|
2748
|
+
pause_indefinite_message_suffix: "from your account.",
|
|
2749
|
+
pause_resume_message_prefix: "You won't be charged until your subscription resumes on",
|
|
2750
|
+
pause_resume_message_suffix: ".",
|
|
2751
|
+
resume_dialog_title: "Resume subscription",
|
|
2752
|
+
resume_dialog_description: "Choose the date your subscription should resume.",
|
|
2753
|
+
resume_dialog_action: "Resume",
|
|
2754
|
+
resume_date: "Resume date",
|
|
2755
|
+
date_placeholder: "mm/dd/yyyy",
|
|
2756
|
+
resume_dialog_cancel: "Cancel",
|
|
2757
|
+
resume_charge_message_prefix: "Your subscription will resume and you'll be charged on",
|
|
2758
|
+
resume_charge_message_suffix: ".",
|
|
2759
|
+
edit_bill_date_title: "Edit bill date",
|
|
2760
|
+
edit_bill_date_description: "Select a new date for your next bill.",
|
|
2761
|
+
edit_bill_date_action: "Save",
|
|
2762
|
+
next_bill_date_label: "Next bill date",
|
|
2763
|
+
edit_bill_date_cancel: "Cancel",
|
|
2764
|
+
bill_date_preview_prefix: "Your next bill will be on",
|
|
2765
|
+
bill_date_preview_suffix: ".",
|
|
2766
|
+
your_other_subscriptions: "Your other subscriptions",
|
|
2767
|
+
other_subs_product: "Product",
|
|
2768
|
+
other_subs_bill_date: "Bill Date",
|
|
2769
|
+
subscription_paused: "Subscription paused",
|
|
2770
|
+
failed_to_pause: "Failed to pause subscription",
|
|
2771
|
+
subscription_resumed: "Subscription resumed",
|
|
2772
|
+
failed_to_resume: "Failed to resume subscription",
|
|
2773
|
+
next_billing_skipped: "Next billing skipped",
|
|
2774
|
+
failed_to_skip: "Failed to skip billing",
|
|
2775
|
+
subscription_cancelled: "Subscription cancelled",
|
|
2776
|
+
failed_to_cancel: "Failed to cancel subscription",
|
|
2777
|
+
subscription_reactivated: "Subscription reactivated",
|
|
2778
|
+
failed_to_reactivate: "Failed to reactivate subscription",
|
|
2779
|
+
quantity_updated: "Quantity updated",
|
|
2780
|
+
failed_to_update_quantity: "Failed to update quantity",
|
|
2781
|
+
bill_date_updated: "Bill date updated",
|
|
2782
|
+
failed_to_update_bill_date: "Failed to update bill date",
|
|
2783
|
+
bill_date_error: "Could not update the bill date. Please try a different date.",
|
|
2784
|
+
generic_error: "Something went wrong. Please try again.",
|
|
2785
|
+
account_load_error: "Unable to load account data. Please try again later.",
|
|
2786
|
+
subscription_not_found: "Subscription not found",
|
|
2787
|
+
error_occurred: "An error occurred",
|
|
2788
|
+
failed_to_load_subscription: "Failed to load subscription: {{message}}"
|
|
2789
|
+
},
|
|
2790
|
+
loaders: {
|
|
2791
|
+
de: () => import("./de-D-pTKAfW.mjs").then((m) => m.default),
|
|
2792
|
+
el: () => import("./el-DJHdmWRg.mjs").then((m) => m.default),
|
|
2793
|
+
es: () => import("./es-BktZit95.mjs").then((m) => m.default),
|
|
2794
|
+
fr: () => import("./fr-Cw5sl5qD.mjs").then((m) => m.default),
|
|
2795
|
+
he: () => import("./he-ud7jtKmt.mjs").then((m) => m.default),
|
|
2796
|
+
hu: () => import("./hu-i6hsv2P1.mjs").then((m) => m.default),
|
|
2797
|
+
id: () => import("./id-DwQYjW0y.mjs").then((m) => m.default),
|
|
2798
|
+
it: () => import("./it-CeDTGyHZ.mjs").then((m) => m.default),
|
|
2799
|
+
ja: () => import("./ja-BsDZKtuF.mjs").then((m) => m.default),
|
|
2800
|
+
ko: () => import("./ko-CAJT7oX_.mjs").then((m) => m.default),
|
|
2801
|
+
nl: () => import("./nl-BGK_iU4v.mjs").then((m) => m.default),
|
|
2802
|
+
pl: () => import("./pl-CXkmBkzj.mjs").then((m) => m.default),
|
|
2803
|
+
pt: () => import("./pt-Bu4CWKGe.mjs").then((m) => m.default),
|
|
2804
|
+
ro: () => import("./ro-D4VP5JZk.mjs").then((m) => m.default),
|
|
2805
|
+
ru: () => import("./ru-BmPMRg7Z.mjs").then((m) => m.default),
|
|
2806
|
+
th: () => import("./th-BbInWYyP.mjs").then((m) => m.default),
|
|
2807
|
+
tl: () => import("./tl-5CmO-_sk.mjs").then((m) => m.default),
|
|
2808
|
+
tr: () => import("./tr-CBAj6vfD.mjs").then((m) => m.default),
|
|
2809
|
+
zh_CN: () => import("./zh_CN-uqlHFHuc.mjs").then((m) => m.default),
|
|
2810
|
+
zh_TW: () => import("./zh_TW-85s6CrDM.mjs").then((m) => m.default)
|
|
2811
|
+
}
|
|
2812
|
+
});
|
|
2813
|
+
function createSubscriptionsTranslationAdapter(locale, dict) {
|
|
2814
|
+
return createStaticDictAdapter(locale, dict);
|
|
2815
|
+
}
|
|
2816
|
+
//#endregion
|
|
2817
|
+
//#region src/providers/SubscriptionsTranslationBridge.tsx
|
|
2818
|
+
function SubscriptionsTranslationBridge({ children }) {
|
|
2819
|
+
const { locale } = useActiveLocale();
|
|
2820
|
+
const dict = useDomainDict(subscriptionsDomain, locale);
|
|
2821
|
+
return /* @__PURE__ */ jsx(SubscriptionsTranslationProvider, {
|
|
2822
|
+
value: useMemo(() => createSubscriptionsTranslationAdapter(locale, dict), [locale, dict]),
|
|
2823
|
+
children
|
|
2824
|
+
});
|
|
2825
|
+
}
|
|
2826
|
+
//#endregion
|
|
2662
2827
|
//#region src/screens/subscriptions/portal-subscriptions-list-helpers.ts
|
|
2663
2828
|
const replaceN = (s, n) => s.replace("{n}", String(n));
|
|
2664
2829
|
const STATUS_LOOKUP = {
|
|
@@ -3227,7 +3392,8 @@ const PAUSE_MONTH_OPTIONS = [
|
|
|
3227
3392
|
2,
|
|
3228
3393
|
3
|
|
3229
3394
|
];
|
|
3230
|
-
function CancelSubscriptionDialog({ open, onOpenChange, onConfirm, onPauseInstead, errorMessage
|
|
3395
|
+
function CancelSubscriptionDialog({ open, onOpenChange, onConfirm, onPauseInstead, errorMessage }) {
|
|
3396
|
+
const { t } = useSubscriptionsTranslation();
|
|
3231
3397
|
const [isPending, setIsPending] = useState(false);
|
|
3232
3398
|
const [selectedMonths, setSelectedMonths] = useState(null);
|
|
3233
3399
|
useEffect(() => {
|
|
@@ -3257,18 +3423,18 @@ function CancelSubscriptionDialog({ open, onOpenChange, onConfirm, onPauseInstea
|
|
|
3257
3423
|
open,
|
|
3258
3424
|
onOpenChange: (v) => !isPending && onOpenChange(v),
|
|
3259
3425
|
children: /* @__PURE__ */ jsxs(AlertDialogContent, { children: [
|
|
3260
|
-
/* @__PURE__ */ jsxs(AlertDialogHeader, { children: [/* @__PURE__ */ jsx(AlertDialogTitle, { children:
|
|
3426
|
+
/* @__PURE__ */ jsxs(AlertDialogHeader, { children: [/* @__PURE__ */ jsx(AlertDialogTitle, { children: t("cancel_dialog_title") }), /* @__PURE__ */ jsx(AlertDialogDescription, { children: t("cancel_dialog_description") })] }),
|
|
3261
3427
|
/* @__PURE__ */ jsxs("div", {
|
|
3262
3428
|
className: "border-border space-y-2 rounded-md border p-3",
|
|
3263
3429
|
children: [
|
|
3264
3430
|
/* @__PURE__ */ jsx("p", {
|
|
3265
3431
|
className: "text-foreground text-sm font-medium",
|
|
3266
|
-
children:
|
|
3432
|
+
children: t("cancel_dialog_pause_question")
|
|
3267
3433
|
}),
|
|
3268
3434
|
/* @__PURE__ */ jsx(Label, {
|
|
3269
3435
|
htmlFor: "cancel-pause-months",
|
|
3270
3436
|
className: "text-foreground text-sm font-semibold",
|
|
3271
|
-
children: "
|
|
3437
|
+
children: t("pause_for")
|
|
3272
3438
|
}),
|
|
3273
3439
|
/* @__PURE__ */ jsxs(Select, {
|
|
3274
3440
|
value: selectedMonths ? String(selectedMonths) : void 0,
|
|
@@ -3277,14 +3443,10 @@ function CancelSubscriptionDialog({ open, onOpenChange, onConfirm, onPauseInstea
|
|
|
3277
3443
|
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
3278
3444
|
id: "cancel-pause-months",
|
|
3279
3445
|
className: "w-full",
|
|
3280
|
-
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "
|
|
3281
|
-
}), /* @__PURE__ */ jsx(SelectContent, { children: PAUSE_MONTH_OPTIONS.map((months) => /* @__PURE__ */
|
|
3446
|
+
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("select_duration") })
|
|
3447
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: PAUSE_MONTH_OPTIONS.map((months) => /* @__PURE__ */ jsx(SelectItem, {
|
|
3282
3448
|
value: String(months),
|
|
3283
|
-
children:
|
|
3284
|
-
months,
|
|
3285
|
-
" ",
|
|
3286
|
-
months === 1 ? "month" : "months"
|
|
3287
|
-
]
|
|
3449
|
+
children: months === 1 ? t("month_singular", { count: String(months) }) : t("month_plural", { count: String(months) })
|
|
3288
3450
|
}, months)) })]
|
|
3289
3451
|
}),
|
|
3290
3452
|
/* @__PURE__ */ jsx(Button, {
|
|
@@ -3292,7 +3454,7 @@ function CancelSubscriptionDialog({ open, onOpenChange, onConfirm, onPauseInstea
|
|
|
3292
3454
|
onClick: handlePause,
|
|
3293
3455
|
disabled: isPending || !selectedMonths,
|
|
3294
3456
|
className: "w-full",
|
|
3295
|
-
children:
|
|
3457
|
+
children: t("cancel_dialog_pause_button")
|
|
3296
3458
|
})
|
|
3297
3459
|
]
|
|
3298
3460
|
}),
|
|
@@ -3304,13 +3466,13 @@ function CancelSubscriptionDialog({ open, onOpenChange, onConfirm, onPauseInstea
|
|
|
3304
3466
|
className: "flex-col gap-2 sm:flex-row sm:justify-end",
|
|
3305
3467
|
children: [/* @__PURE__ */ jsx(AlertDialogCancel, {
|
|
3306
3468
|
disabled: isPending,
|
|
3307
|
-
children:
|
|
3469
|
+
children: t("cancel_dialog_cancel_button")
|
|
3308
3470
|
}), /* @__PURE__ */ jsx(Button, {
|
|
3309
3471
|
variant: "destructive",
|
|
3310
3472
|
onClick: handleConfirm,
|
|
3311
3473
|
disabled: isPending,
|
|
3312
3474
|
autoFocus: true,
|
|
3313
|
-
children: isPending ? "..." :
|
|
3475
|
+
children: isPending ? "..." : t("cancel_dialog_confirm_button")
|
|
3314
3476
|
})]
|
|
3315
3477
|
})
|
|
3316
3478
|
] })
|
|
@@ -3318,7 +3480,8 @@ function CancelSubscriptionDialog({ open, onOpenChange, onConfirm, onPauseInstea
|
|
|
3318
3480
|
}
|
|
3319
3481
|
//#endregion
|
|
3320
3482
|
//#region ../../subscriptions/ui/src/components/pause-subscription-dialog.tsx
|
|
3321
|
-
function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, errorMessage, currentNextBillDate, billingInterval = 1, billingIntervalUnit = "month"
|
|
3483
|
+
function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, errorMessage, currentNextBillDate, billingInterval = 1, billingIntervalUnit = "month" }) {
|
|
3484
|
+
const { t } = useSubscriptionsTranslation();
|
|
3322
3485
|
const [pauseType, setPauseType] = useState("indefinite");
|
|
3323
3486
|
const [selectedOrderCount, setSelectedOrderCount] = useState(null);
|
|
3324
3487
|
const orderCountOptions = Array.from({ length: 99 }, (_, i) => i + 1);
|
|
@@ -3347,19 +3510,22 @@ function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, err
|
|
|
3347
3510
|
};
|
|
3348
3511
|
const statusMessage = (() => {
|
|
3349
3512
|
if (pauseType === "indefinite") return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
3350
|
-
"
|
|
3351
|
-
|
|
3352
|
-
"
|
|
3513
|
+
t("pause_indefinite_message_prefix"),
|
|
3514
|
+
" ",
|
|
3515
|
+
/* @__PURE__ */ jsx("strong", { children: t("pause_indefinite_message_resume") }),
|
|
3516
|
+
" ",
|
|
3517
|
+
t("pause_indefinite_message_suffix")
|
|
3353
3518
|
] });
|
|
3354
3519
|
if (!selectedOrderCount) return null;
|
|
3520
|
+
const displayDate = calculatedResumeDate ? format(calculatedResumeDate, "MMMM d, yyyy") : "a future date";
|
|
3355
3521
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
3356
|
-
|
|
3522
|
+
t("pause_resume_message_prefix"),
|
|
3357
3523
|
" ",
|
|
3358
3524
|
/* @__PURE__ */ jsx("span", {
|
|
3359
3525
|
className: "font-semibold",
|
|
3360
|
-
children:
|
|
3526
|
+
children: displayDate
|
|
3361
3527
|
}),
|
|
3362
|
-
"
|
|
3528
|
+
t("pause_resume_message_suffix")
|
|
3363
3529
|
] });
|
|
3364
3530
|
})();
|
|
3365
3531
|
const isActionDisabled = pauseType === "order_count" && !selectedOrderCount;
|
|
@@ -3374,7 +3540,7 @@ function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, err
|
|
|
3374
3540
|
className: "flex flex-row justify-between",
|
|
3375
3541
|
children: /* @__PURE__ */ jsx(DialogTitle, {
|
|
3376
3542
|
className: "text-md w-full text-left font-medium",
|
|
3377
|
-
children:
|
|
3543
|
+
children: t("pause_dialog_title")
|
|
3378
3544
|
})
|
|
3379
3545
|
}),
|
|
3380
3546
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -3382,7 +3548,7 @@ function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, err
|
|
|
3382
3548
|
children: [/* @__PURE__ */ jsx("p", {
|
|
3383
3549
|
id: "pause-subscription-dialog-description",
|
|
3384
3550
|
className: "text-muted-foreground text-sm",
|
|
3385
|
-
children:
|
|
3551
|
+
children: t("pause_dialog_description")
|
|
3386
3552
|
}), /* @__PURE__ */ jsxs("div", {
|
|
3387
3553
|
className: "space-y-4",
|
|
3388
3554
|
children: [
|
|
@@ -3397,7 +3563,7 @@ function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, err
|
|
|
3397
3563
|
}), /* @__PURE__ */ jsx(Label, {
|
|
3398
3564
|
htmlFor: "pause-indefinitely",
|
|
3399
3565
|
className: "text-foreground cursor-pointer text-sm font-medium",
|
|
3400
|
-
children: "
|
|
3566
|
+
children: t("pause_indefinitely")
|
|
3401
3567
|
})]
|
|
3402
3568
|
}),
|
|
3403
3569
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -3413,13 +3579,13 @@ function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, err
|
|
|
3413
3579
|
}), /* @__PURE__ */ jsx(Label, {
|
|
3414
3580
|
htmlFor: "pause-order-count",
|
|
3415
3581
|
className: "text-foreground cursor-pointer text-sm font-medium",
|
|
3416
|
-
children: "
|
|
3582
|
+
children: t("pause_for_orders")
|
|
3417
3583
|
})]
|
|
3418
3584
|
}), pauseType === "order_count" && /* @__PURE__ */ jsxs("div", {
|
|
3419
3585
|
className: "ml-6 space-y-2",
|
|
3420
3586
|
children: [/* @__PURE__ */ jsx(Label, {
|
|
3421
3587
|
className: "text-foreground text-sm font-semibold",
|
|
3422
|
-
children: "
|
|
3588
|
+
children: t("choose_orders_to_skip")
|
|
3423
3589
|
}), /* @__PURE__ */ jsxs("select", {
|
|
3424
3590
|
value: selectedOrderCount ?? "",
|
|
3425
3591
|
onChange: (e) => setSelectedOrderCount(Number(e.target.value)),
|
|
@@ -3427,7 +3593,7 @@ function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, err
|
|
|
3427
3593
|
children: [/* @__PURE__ */ jsx("option", {
|
|
3428
3594
|
value: "",
|
|
3429
3595
|
disabled: true,
|
|
3430
|
-
children: "
|
|
3596
|
+
children: t("select")
|
|
3431
3597
|
}), orderCountOptions.map((count) => /* @__PURE__ */ jsx("option", {
|
|
3432
3598
|
value: count,
|
|
3433
3599
|
children: count
|
|
@@ -3452,13 +3618,13 @@ function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, err
|
|
|
3452
3618
|
variant: "outline",
|
|
3453
3619
|
className: "h-10 min-w-[70px] rounded p-3",
|
|
3454
3620
|
onClick: () => handleDismiss(false),
|
|
3455
|
-
children: "
|
|
3621
|
+
children: t("pause_dialog_cancel")
|
|
3456
3622
|
}), /* @__PURE__ */ jsx(Button, {
|
|
3457
3623
|
type: "button",
|
|
3458
3624
|
className: "h-10 min-w-[70px] rounded p-3",
|
|
3459
3625
|
onClick: handleConfirm,
|
|
3460
3626
|
disabled: isActionDisabled || isLoading,
|
|
3461
|
-
children: isLoading ? /* @__PURE__ */ jsx("div", { className: "border-primary-foreground h-5 w-5 animate-spin rounded-full border-4 border-t-4 border-t-transparent" }) :
|
|
3627
|
+
children: isLoading ? /* @__PURE__ */ jsx("div", { className: "border-primary-foreground h-5 w-5 animate-spin rounded-full border-4 border-t-4 border-t-transparent" }) : t("pause_dialog_action")
|
|
3462
3628
|
})]
|
|
3463
3629
|
}) })
|
|
3464
3630
|
]
|
|
@@ -3479,7 +3645,8 @@ function parseIsoDate(value) {
|
|
|
3479
3645
|
}
|
|
3480
3646
|
//#endregion
|
|
3481
3647
|
//#region ../../subscriptions/ui/src/components/resume-subscription-dialog.tsx
|
|
3482
|
-
function ResumeSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, errorMessage, defaultNextBillDate
|
|
3648
|
+
function ResumeSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, errorMessage, defaultNextBillDate }) {
|
|
3649
|
+
const { t } = useSubscriptionsTranslation();
|
|
3483
3650
|
const [selectedDate, setSelectedDate] = useState(void 0);
|
|
3484
3651
|
const [calendarOpen, setCalendarOpen] = useState(false);
|
|
3485
3652
|
const today = /* @__PURE__ */ new Date();
|
|
@@ -3511,7 +3678,7 @@ function ResumeSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, er
|
|
|
3511
3678
|
className: "flex flex-row justify-between",
|
|
3512
3679
|
children: /* @__PURE__ */ jsx(DialogTitle, {
|
|
3513
3680
|
className: "text-md w-full text-left font-medium",
|
|
3514
|
-
children:
|
|
3681
|
+
children: t("resume_dialog_title")
|
|
3515
3682
|
})
|
|
3516
3683
|
}),
|
|
3517
3684
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -3519,13 +3686,13 @@ function ResumeSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, er
|
|
|
3519
3686
|
children: [/* @__PURE__ */ jsx("p", {
|
|
3520
3687
|
id: "resume-subscription-dialog-description",
|
|
3521
3688
|
className: "text-muted-foreground text-left text-sm",
|
|
3522
|
-
children:
|
|
3689
|
+
children: t("resume_dialog_description")
|
|
3523
3690
|
}), /* @__PURE__ */ jsxs("div", {
|
|
3524
3691
|
className: "space-y-2",
|
|
3525
3692
|
children: [
|
|
3526
3693
|
/* @__PURE__ */ jsx(Label, {
|
|
3527
3694
|
className: "text-foreground text-sm font-semibold",
|
|
3528
|
-
children: "
|
|
3695
|
+
children: t("resume_date")
|
|
3529
3696
|
}),
|
|
3530
3697
|
/* @__PURE__ */ jsxs(Popover, {
|
|
3531
3698
|
open: calendarOpen,
|
|
@@ -3535,7 +3702,7 @@ function ResumeSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, er
|
|
|
3535
3702
|
children: /* @__PURE__ */ jsxs(Button, {
|
|
3536
3703
|
variant: "outline",
|
|
3537
3704
|
className: cn$1("border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground h-9 w-full justify-start border px-3 py-2 text-left font-normal", !selectedDate && "text-muted-foreground hover:text-muted-foreground"),
|
|
3538
|
-
children: [selectedDate ? format(selectedDate, "MM/dd/yyyy") : /* @__PURE__ */ jsx("span", { children: "
|
|
3705
|
+
children: [selectedDate ? format(selectedDate, "MM/dd/yyyy") : /* @__PURE__ */ jsx("span", { children: t("date_placeholder") }), /* @__PURE__ */ jsx(CalendarIcon, { className: "text-muted-foreground ml-auto h-4 w-4" })]
|
|
3539
3706
|
})
|
|
3540
3707
|
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
3541
3708
|
className: "bg-popover w-auto rounded-md border p-0 shadow-lg",
|
|
@@ -3562,13 +3729,13 @@ function ResumeSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, er
|
|
|
3562
3729
|
selectedDate && /* @__PURE__ */ jsxs("p", {
|
|
3563
3730
|
className: "text-muted-foreground text-xs",
|
|
3564
3731
|
children: [
|
|
3565
|
-
"
|
|
3732
|
+
t("resume_charge_message_prefix"),
|
|
3566
3733
|
" ",
|
|
3567
3734
|
/* @__PURE__ */ jsx("span", {
|
|
3568
3735
|
className: "font-semibold",
|
|
3569
3736
|
children: format(selectedDate, "MMMM d, yyyy")
|
|
3570
3737
|
}),
|
|
3571
|
-
"
|
|
3738
|
+
t("resume_charge_message_suffix")
|
|
3572
3739
|
]
|
|
3573
3740
|
})
|
|
3574
3741
|
]
|
|
@@ -3583,13 +3750,13 @@ function ResumeSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, er
|
|
|
3583
3750
|
children: [/* @__PURE__ */ jsx(Button, {
|
|
3584
3751
|
className: "bg-muted text-foreground ring-border hover:bg-muted/80 h-10 min-w-[70px] rounded p-3 ring-1",
|
|
3585
3752
|
onClick: () => handleDismiss(false),
|
|
3586
|
-
children: "
|
|
3753
|
+
children: t("resume_dialog_cancel")
|
|
3587
3754
|
}), /* @__PURE__ */ jsx(Button, {
|
|
3588
3755
|
type: "button",
|
|
3589
3756
|
className: "bg-primary text-primary-foreground h-10 min-w-[70px] rounded p-3 hover:opacity-90 disabled:opacity-50",
|
|
3590
3757
|
onClick: handleConfirm,
|
|
3591
3758
|
disabled: !selectedDate || isLoading,
|
|
3592
|
-
children: isLoading ? /* @__PURE__ */ jsx("div", { className: "border-primary-foreground h-5 w-5 animate-spin rounded-full border-4 border-t-4 border-t-transparent" }) :
|
|
3759
|
+
children: isLoading ? /* @__PURE__ */ jsx("div", { className: "border-primary-foreground h-5 w-5 animate-spin rounded-full border-4 border-t-4 border-t-transparent" }) : t("resume_dialog_action")
|
|
3593
3760
|
})]
|
|
3594
3761
|
}) })
|
|
3595
3762
|
]
|
|
@@ -3620,7 +3787,8 @@ const SUBSCRIPTION_COLORS = [
|
|
|
3620
3787
|
"#84cc16"
|
|
3621
3788
|
];
|
|
3622
3789
|
const MAX_PROJECTIONS_PER_SUB = 104;
|
|
3623
|
-
function EditBillDateDialog({ open, onOpenChange, onConfirm, isLoading, errorMessage, currentNextBillDate, otherSubscriptions, onNavigateToSubscription
|
|
3790
|
+
function EditBillDateDialog({ open, onOpenChange, onConfirm, isLoading, errorMessage, currentNextBillDate, otherSubscriptions, onNavigateToSubscription }) {
|
|
3791
|
+
const { t } = useSubscriptionsTranslation();
|
|
3624
3792
|
const [selectedDate, setSelectedDate] = useState(void 0);
|
|
3625
3793
|
const [calendarOpen, setCalendarOpen] = useState(false);
|
|
3626
3794
|
const [popoverContainer, setPopoverContainer] = useState(null);
|
|
@@ -3703,7 +3871,7 @@ function EditBillDateDialog({ open, onOpenChange, onConfirm, isLoading, errorMes
|
|
|
3703
3871
|
className: "flex flex-row justify-between",
|
|
3704
3872
|
children: /* @__PURE__ */ jsx(DialogTitle, {
|
|
3705
3873
|
className: "text-md w-full text-left font-medium",
|
|
3706
|
-
children:
|
|
3874
|
+
children: t("edit_bill_date_title")
|
|
3707
3875
|
})
|
|
3708
3876
|
}),
|
|
3709
3877
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -3712,13 +3880,13 @@ function EditBillDateDialog({ open, onOpenChange, onConfirm, isLoading, errorMes
|
|
|
3712
3880
|
/* @__PURE__ */ jsx("p", {
|
|
3713
3881
|
id: "edit-bill-date-dialog-description",
|
|
3714
3882
|
className: "text-muted-foreground text-sm",
|
|
3715
|
-
children:
|
|
3883
|
+
children: t("edit_bill_date_description")
|
|
3716
3884
|
}),
|
|
3717
3885
|
/* @__PURE__ */ jsxs("div", {
|
|
3718
3886
|
className: "space-y-2",
|
|
3719
3887
|
children: [/* @__PURE__ */ jsx(Label, {
|
|
3720
3888
|
className: "text-foreground text-sm font-semibold",
|
|
3721
|
-
children: "
|
|
3889
|
+
children: t("next_bill_date_label")
|
|
3722
3890
|
}), /* @__PURE__ */ jsx(PortalContainerProvider, {
|
|
3723
3891
|
container: popoverContainer,
|
|
3724
3892
|
children: /* @__PURE__ */ jsxs(Popover, {
|
|
@@ -3729,7 +3897,7 @@ function EditBillDateDialog({ open, onOpenChange, onConfirm, isLoading, errorMes
|
|
|
3729
3897
|
children: /* @__PURE__ */ jsxs(Button, {
|
|
3730
3898
|
variant: "outline",
|
|
3731
3899
|
className: cn$1("border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground h-9 w-full justify-start border px-3 py-2 text-left font-normal", !selectedDate && "text-muted-foreground hover:text-muted-foreground"),
|
|
3732
|
-
children: [selectedDate ? format(selectedDate, "MM/dd/yyyy") : /* @__PURE__ */ jsx("span", { children: "
|
|
3900
|
+
children: [selectedDate ? format(selectedDate, "MM/dd/yyyy") : /* @__PURE__ */ jsx("span", { children: t("date_placeholder") }), /* @__PURE__ */ jsx(CalendarIcon, { className: "text-muted-foreground ml-auto h-4 w-4" })]
|
|
3733
3901
|
})
|
|
3734
3902
|
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
3735
3903
|
className: "bg-popover pointer-events-auto z-[9999] w-auto rounded-md border p-0 shadow-lg",
|
|
@@ -3759,20 +3927,20 @@ function EditBillDateDialog({ open, onOpenChange, onConfirm, isLoading, errorMes
|
|
|
3759
3927
|
selectedDate && /* @__PURE__ */ jsxs("div", {
|
|
3760
3928
|
className: "text-muted-foreground text-xs",
|
|
3761
3929
|
children: [
|
|
3762
|
-
"
|
|
3930
|
+
t("bill_date_preview_prefix"),
|
|
3763
3931
|
" ",
|
|
3764
3932
|
/* @__PURE__ */ jsx("span", {
|
|
3765
3933
|
className: "font-semibold",
|
|
3766
3934
|
children: previewDate
|
|
3767
3935
|
}),
|
|
3768
|
-
"
|
|
3936
|
+
t("bill_date_preview_suffix")
|
|
3769
3937
|
]
|
|
3770
3938
|
}),
|
|
3771
3939
|
subscriptionsWithColor.length > 0 && /* @__PURE__ */ jsxs("div", {
|
|
3772
3940
|
className: "space-y-2",
|
|
3773
3941
|
children: [/* @__PURE__ */ jsx(Label, {
|
|
3774
3942
|
className: "text-foreground text-sm font-semibold",
|
|
3775
|
-
children: "
|
|
3943
|
+
children: t("your_other_subscriptions")
|
|
3776
3944
|
}), /* @__PURE__ */ jsx("div", {
|
|
3777
3945
|
className: "border-border max-h-40 overflow-auto rounded-md border",
|
|
3778
3946
|
children: /* @__PURE__ */ jsxs("table", {
|
|
@@ -3786,11 +3954,11 @@ function EditBillDateDialog({ open, onOpenChange, onConfirm, isLoading, errorMes
|
|
|
3786
3954
|
}),
|
|
3787
3955
|
/* @__PURE__ */ jsx("th", {
|
|
3788
3956
|
className: "px-3 py-2 text-left font-medium",
|
|
3789
|
-
children: "
|
|
3957
|
+
children: t("other_subs_product")
|
|
3790
3958
|
}),
|
|
3791
3959
|
/* @__PURE__ */ jsx("th", {
|
|
3792
3960
|
className: "w-28 px-3 py-2 text-left font-medium",
|
|
3793
|
-
children: "
|
|
3961
|
+
children: t("other_subs_bill_date")
|
|
3794
3962
|
})
|
|
3795
3963
|
] })
|
|
3796
3964
|
}), /* @__PURE__ */ jsx("tbody", {
|
|
@@ -3841,13 +4009,13 @@ function EditBillDateDialog({ open, onOpenChange, onConfirm, isLoading, errorMes
|
|
|
3841
4009
|
variant: "outline",
|
|
3842
4010
|
className: "h-10 min-w-[70px] rounded p-3",
|
|
3843
4011
|
onClick: () => handleDismiss(false),
|
|
3844
|
-
children: "
|
|
4012
|
+
children: t("edit_bill_date_cancel")
|
|
3845
4013
|
}), /* @__PURE__ */ jsx(Button, {
|
|
3846
4014
|
type: "button",
|
|
3847
4015
|
className: "h-10 min-w-[70px] rounded p-3",
|
|
3848
4016
|
onClick: handleConfirm,
|
|
3849
4017
|
disabled: !selectedDate || isLoading,
|
|
3850
|
-
children: isLoading ? /* @__PURE__ */ jsx("div", { className: "border-primary-foreground h-5 w-5 animate-spin rounded-full border-4 border-t-4 border-t-transparent" }) :
|
|
4018
|
+
children: isLoading ? /* @__PURE__ */ jsx("div", { className: "border-primary-foreground h-5 w-5 animate-spin rounded-full border-4 border-t-4 border-t-transparent" }) : t("edit_bill_date_action")
|
|
3851
4019
|
})]
|
|
3852
4020
|
}) })
|
|
3853
4021
|
]
|
|
@@ -4034,6 +4202,7 @@ function QuantityInput({ inputId, quantity, isUpdatingQuantity, onQuantityChange
|
|
|
4034
4202
|
});
|
|
4035
4203
|
}
|
|
4036
4204
|
function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBillDate, canEditQuantity = false, onQuantityChange, isUpdatingQuantity = false }) {
|
|
4205
|
+
const { t } = useSubscriptionsTranslation();
|
|
4037
4206
|
const variant = subscription.variant;
|
|
4038
4207
|
const product = variant?.product;
|
|
4039
4208
|
const quantity = displayQuantity ?? subscription.quantity;
|
|
@@ -4050,7 +4219,7 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
4050
4219
|
className: "mt-4",
|
|
4051
4220
|
children: [/* @__PURE__ */ jsx("h2", {
|
|
4052
4221
|
className: "text-foreground mb-2 text-lg font-medium",
|
|
4053
|
-
children: "
|
|
4222
|
+
children: t("your_upcoming_order")
|
|
4054
4223
|
}), /* @__PURE__ */ jsxs("div", {
|
|
4055
4224
|
className: "text-muted-foreground",
|
|
4056
4225
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
@@ -4059,7 +4228,7 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
4059
4228
|
className: "border-border border-r pr-4",
|
|
4060
4229
|
children: [/* @__PURE__ */ jsx("div", {
|
|
4061
4230
|
className: "text-muted-foreground mb-1 text-sm",
|
|
4062
|
-
children: "
|
|
4231
|
+
children: t("next_order_date")
|
|
4063
4232
|
}), /* @__PURE__ */ jsx("div", {
|
|
4064
4233
|
className: "text-foreground text-2xl font-bold",
|
|
4065
4234
|
children: getNextBillDisplay(displayNextBillDate ? {
|
|
@@ -4072,7 +4241,7 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
4072
4241
|
children: [
|
|
4073
4242
|
/* @__PURE__ */ jsx("div", {
|
|
4074
4243
|
className: "text-muted-foreground mb-1 text-sm",
|
|
4075
|
-
children: "
|
|
4244
|
+
children: t("next_bill_amount")
|
|
4076
4245
|
}),
|
|
4077
4246
|
/* @__PURE__ */ jsx("div", {
|
|
4078
4247
|
className: "text-foreground text-2xl font-bold",
|
|
@@ -4099,13 +4268,13 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
4099
4268
|
className: "bg-muted h-24 w-24 overflow-hidden rounded",
|
|
4100
4269
|
children: [product?.image_url ? /* @__PURE__ */ jsx("img", {
|
|
4101
4270
|
src: product.image_url,
|
|
4102
|
-
alt: variant?.title || "
|
|
4271
|
+
alt: variant?.title || t("product_image_alt"),
|
|
4103
4272
|
width: 96,
|
|
4104
4273
|
height: 96,
|
|
4105
4274
|
className: "h-full w-full object-cover"
|
|
4106
4275
|
}) : /* @__PURE__ */ jsx("div", {
|
|
4107
4276
|
className: "text-muted-foreground flex h-full w-full items-center justify-center",
|
|
4108
|
-
children: "
|
|
4277
|
+
children: t("no_image")
|
|
4109
4278
|
}), quantity > 1 && /* @__PURE__ */ jsx("span", {
|
|
4110
4279
|
className: "bg-foreground text-background absolute -top-2 -right-2 z-10 flex h-6 w-6 items-center justify-center rounded-full text-xs font-medium",
|
|
4111
4280
|
children: quantity
|
|
@@ -4134,7 +4303,7 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
4134
4303
|
children: [/* @__PURE__ */ jsx("label", {
|
|
4135
4304
|
htmlFor: quantityInputId,
|
|
4136
4305
|
className: "text-muted-foreground mb-1 text-xs",
|
|
4137
|
-
children: "
|
|
4306
|
+
children: t("quantity_label")
|
|
4138
4307
|
}), /* @__PURE__ */ jsx(QuantityInput, {
|
|
4139
4308
|
inputId: quantityInputId,
|
|
4140
4309
|
quantity,
|
|
@@ -4151,7 +4320,7 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
4151
4320
|
className: "flex justify-between text-sm",
|
|
4152
4321
|
children: [/* @__PURE__ */ jsx("p", {
|
|
4153
4322
|
className: "text-muted-foreground text-sm font-medium",
|
|
4154
|
-
children: "
|
|
4323
|
+
children: t("subtotal")
|
|
4155
4324
|
}), /* @__PURE__ */ jsx("p", {
|
|
4156
4325
|
className: "text-muted-foreground text-sm font-medium",
|
|
4157
4326
|
children: subtotal
|
|
@@ -4160,7 +4329,7 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
4160
4329
|
className: "mt-2 flex justify-between text-sm",
|
|
4161
4330
|
children: [/* @__PURE__ */ jsx("p", {
|
|
4162
4331
|
className: "text-muted-foreground text-sm font-medium",
|
|
4163
|
-
children: "
|
|
4332
|
+
children: t("discount")
|
|
4164
4333
|
}), /* @__PURE__ */ jsxs("p", {
|
|
4165
4334
|
className: "text-muted-foreground text-sm font-medium",
|
|
4166
4335
|
children: ["-", formatCurrency(discount * quantity)]
|
|
@@ -4170,7 +4339,7 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
4170
4339
|
className: "mt-4 flex items-center justify-between text-base font-medium",
|
|
4171
4340
|
children: [/* @__PURE__ */ jsx("p", {
|
|
4172
4341
|
className: "text-muted-foreground text-sm font-medium",
|
|
4173
|
-
children: "
|
|
4342
|
+
children: t("total_label")
|
|
4174
4343
|
}), /* @__PURE__ */ jsx("p", {
|
|
4175
4344
|
className: "text-foreground text-base font-bold",
|
|
4176
4345
|
children: formatCurrency(subscription.price * quantity)
|
|
@@ -4178,7 +4347,7 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
4178
4347
|
}),
|
|
4179
4348
|
/* @__PURE__ */ jsx("span", {
|
|
4180
4349
|
className: "text-muted-foreground text-xs",
|
|
4181
|
-
children: "
|
|
4350
|
+
children: t("tax_shipping_note")
|
|
4182
4351
|
})
|
|
4183
4352
|
]
|
|
4184
4353
|
})
|
|
@@ -4187,6 +4356,7 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
4187
4356
|
});
|
|
4188
4357
|
}
|
|
4189
4358
|
function SubscriptionManagementSection({ subscription, isActive, isPaused, isCancelled, isMutating, onSkip, onPause, onResume, onCancel, onReactivate, onEditBillDate, displayNextBillDate, renderPaymentMethod, renderShippingAddress }) {
|
|
4359
|
+
const { t } = useSubscriptionsTranslation();
|
|
4190
4360
|
const plan = subscription.subscription_plan;
|
|
4191
4361
|
const quantity = subscription.quantity;
|
|
4192
4362
|
const totalPrice = formatCurrency(subscription.price * quantity);
|
|
@@ -4202,7 +4372,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4202
4372
|
className: "border-border mb-6 border-b pb-6",
|
|
4203
4373
|
children: [/* @__PURE__ */ jsx("h2", {
|
|
4204
4374
|
className: "text-foreground mb-3 text-sm/6 font-semibold",
|
|
4205
|
-
children: "
|
|
4375
|
+
children: t("order_actions")
|
|
4206
4376
|
}), /* @__PURE__ */ jsxs("div", {
|
|
4207
4377
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-2",
|
|
4208
4378
|
children: [
|
|
@@ -4213,7 +4383,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4213
4383
|
className: actionButtonClass,
|
|
4214
4384
|
children: [/* @__PURE__ */ jsx(SkipForward, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ jsx("span", {
|
|
4215
4385
|
className: "truncate",
|
|
4216
|
-
children: "
|
|
4386
|
+
children: t("skip_next_order")
|
|
4217
4387
|
})]
|
|
4218
4388
|
}),
|
|
4219
4389
|
isActive && /* @__PURE__ */ jsxs(Button, {
|
|
@@ -4223,7 +4393,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4223
4393
|
className: actionButtonClass,
|
|
4224
4394
|
children: [/* @__PURE__ */ jsx(CalendarDays, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ jsx("span", {
|
|
4225
4395
|
className: "truncate",
|
|
4226
|
-
children: "
|
|
4396
|
+
children: t("edit_bill_date")
|
|
4227
4397
|
})]
|
|
4228
4398
|
}),
|
|
4229
4399
|
isActive && /* @__PURE__ */ jsxs(Button, {
|
|
@@ -4233,7 +4403,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4233
4403
|
className: actionButtonClass,
|
|
4234
4404
|
children: [/* @__PURE__ */ jsx(Pause, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ jsx("span", {
|
|
4235
4405
|
className: "truncate",
|
|
4236
|
-
children: "
|
|
4406
|
+
children: t("pause_subscription")
|
|
4237
4407
|
})]
|
|
4238
4408
|
}),
|
|
4239
4409
|
/* @__PURE__ */ jsxs(Button, {
|
|
@@ -4243,7 +4413,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4243
4413
|
className: actionButtonClass,
|
|
4244
4414
|
children: [/* @__PURE__ */ jsx(XCircle, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ jsx("span", {
|
|
4245
4415
|
className: "truncate",
|
|
4246
|
-
children: isCancelled ? "
|
|
4416
|
+
children: isCancelled ? t("cancelled_subscription") : t("cancel_subscription")
|
|
4247
4417
|
})]
|
|
4248
4418
|
}),
|
|
4249
4419
|
isPaused && /* @__PURE__ */ jsxs(Button, {
|
|
@@ -4253,7 +4423,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4253
4423
|
className: actionButtonClass,
|
|
4254
4424
|
children: [/* @__PURE__ */ jsx(Play, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ jsx("span", {
|
|
4255
4425
|
className: "truncate",
|
|
4256
|
-
children: "
|
|
4426
|
+
children: t("resume_subscription")
|
|
4257
4427
|
})]
|
|
4258
4428
|
}),
|
|
4259
4429
|
isCancelled && /* @__PURE__ */ jsxs(Button, {
|
|
@@ -4263,7 +4433,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4263
4433
|
className: actionButtonClass,
|
|
4264
4434
|
children: [/* @__PURE__ */ jsx(RotateCcw, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ jsx("span", {
|
|
4265
4435
|
className: "truncate",
|
|
4266
|
-
children: "
|
|
4436
|
+
children: t("reactivate_subscription")
|
|
4267
4437
|
})]
|
|
4268
4438
|
})
|
|
4269
4439
|
]
|
|
@@ -4275,7 +4445,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4275
4445
|
className: "mb-4 flex items-center justify-between",
|
|
4276
4446
|
children: [/* @__PURE__ */ jsx("h3", {
|
|
4277
4447
|
className: "text-foreground text-sm/6 font-semibold",
|
|
4278
|
-
children: "
|
|
4448
|
+
children: t("subscription_details")
|
|
4279
4449
|
}), /* @__PURE__ */ jsx(StatusPill, {
|
|
4280
4450
|
status: subscription.status,
|
|
4281
4451
|
children: startCase(subscription.status)
|
|
@@ -4287,7 +4457,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4287
4457
|
className: "flex-1 pr-4",
|
|
4288
4458
|
children: [/* @__PURE__ */ jsx("div", {
|
|
4289
4459
|
className: "text-muted-foreground text-sm",
|
|
4290
|
-
children: "
|
|
4460
|
+
children: t("order_frequency")
|
|
4291
4461
|
}), /* @__PURE__ */ jsx("div", {
|
|
4292
4462
|
className: "text-foreground font-medium",
|
|
4293
4463
|
children: formatSubscriptionFrequency(plan.billing_interval_unit)
|
|
@@ -4298,7 +4468,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4298
4468
|
children: [
|
|
4299
4469
|
/* @__PURE__ */ jsx("div", {
|
|
4300
4470
|
className: "text-muted-foreground text-sm",
|
|
4301
|
-
children: "
|
|
4471
|
+
children: t("next_payment")
|
|
4302
4472
|
}),
|
|
4303
4473
|
/* @__PURE__ */ jsx("div", {
|
|
4304
4474
|
className: "text-foreground font-medium",
|
|
@@ -4314,7 +4484,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4314
4484
|
className: "flex-1 pl-4 text-right",
|
|
4315
4485
|
children: [/* @__PURE__ */ jsx("div", {
|
|
4316
4486
|
className: "text-muted-foreground text-sm",
|
|
4317
|
-
children: "
|
|
4487
|
+
children: t("last_billed")
|
|
4318
4488
|
}), /* @__PURE__ */ jsx("div", {
|
|
4319
4489
|
className: "text-foreground font-medium",
|
|
4320
4490
|
children: formatDate(subscription.last_bill_date)
|
|
@@ -4327,7 +4497,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4327
4497
|
className: "pt-2",
|
|
4328
4498
|
children: [/* @__PURE__ */ jsx("h3", {
|
|
4329
4499
|
className: "text-foreground mb-4 text-sm/6 font-semibold",
|
|
4330
|
-
children: "
|
|
4500
|
+
children: t("payment_and_shipping")
|
|
4331
4501
|
}), /* @__PURE__ */ jsxs("div", {
|
|
4332
4502
|
className: "flex flex-col",
|
|
4333
4503
|
children: [renderShippingAddress ? renderShippingAddress({
|
|
@@ -4339,7 +4509,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4339
4509
|
className: "border-border mb-6 border-b pb-4",
|
|
4340
4510
|
children: [/* @__PURE__ */ jsx("div", {
|
|
4341
4511
|
className: "text-muted-foreground mt-3 mb-1 text-sm",
|
|
4342
|
-
children: "
|
|
4512
|
+
children: t("shipping_address")
|
|
4343
4513
|
}), /* @__PURE__ */ jsxs("div", {
|
|
4344
4514
|
className: "text-foreground text-sm",
|
|
4345
4515
|
children: [
|
|
@@ -4366,16 +4536,16 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4366
4536
|
className: "border-border mb-6 border-b pb-4",
|
|
4367
4537
|
children: [/* @__PURE__ */ jsx("div", {
|
|
4368
4538
|
className: "text-muted-foreground mb-1 text-sm",
|
|
4369
|
-
children: "
|
|
4539
|
+
children: t("payment_method")
|
|
4370
4540
|
}), /* @__PURE__ */ jsxs("div", {
|
|
4371
4541
|
className: "text-foreground flex items-center gap-2 text-sm",
|
|
4372
4542
|
children: [paymentDetails?.logo_url && /* @__PURE__ */ jsx("img", {
|
|
4373
4543
|
src: paymentDetails.logo_url,
|
|
4374
|
-
alt: paymentDetails.card_type ?? "
|
|
4544
|
+
alt: paymentDetails.card_type ?? t("card_fallback"),
|
|
4375
4545
|
className: "h-6"
|
|
4376
4546
|
}), /* @__PURE__ */ jsxs("span", {
|
|
4377
4547
|
className: "font-medium",
|
|
4378
|
-
children: [paymentDetails?.card_type ? startCase(paymentDetails.card_type) : paymentMethod.payment_type, paymentDetails?.last4 ? `
|
|
4548
|
+
children: [paymentDetails?.card_type ? startCase(paymentDetails.card_type) : paymentMethod.payment_type, paymentDetails?.last4 ? ` ${t("ending_in", { last4: paymentDetails.last4 })}` : ""]
|
|
4379
4549
|
})]
|
|
4380
4550
|
})]
|
|
4381
4551
|
}))]
|
|
@@ -4386,12 +4556,13 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4386
4556
|
});
|
|
4387
4557
|
}
|
|
4388
4558
|
function OrderHistorySection({ subscription }) {
|
|
4559
|
+
const { t } = useSubscriptionsTranslation();
|
|
4389
4560
|
if (subscription.orders.length === 0) return null;
|
|
4390
4561
|
return /* @__PURE__ */ jsxs("section", {
|
|
4391
4562
|
className: "mt-6 px-8 pt-6 pb-8",
|
|
4392
4563
|
children: [/* @__PURE__ */ jsx("h3", {
|
|
4393
4564
|
className: "text-foreground mb-3 text-sm/6 font-semibold",
|
|
4394
|
-
children: "
|
|
4565
|
+
children: t("subscription_order_history")
|
|
4395
4566
|
}), /* @__PURE__ */ jsx("div", {
|
|
4396
4567
|
className: "border-border overflow-x-auto rounded-md border",
|
|
4397
4568
|
children: /* @__PURE__ */ jsxs("table", {
|
|
@@ -4401,19 +4572,19 @@ function OrderHistorySection({ subscription }) {
|
|
|
4401
4572
|
children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
4402
4573
|
/* @__PURE__ */ jsx("th", {
|
|
4403
4574
|
className: "text-muted-foreground py-2 pr-3 pl-3 text-left font-medium",
|
|
4404
|
-
children: "
|
|
4575
|
+
children: t("order")
|
|
4405
4576
|
}),
|
|
4406
4577
|
/* @__PURE__ */ jsx("th", {
|
|
4407
4578
|
className: "text-muted-foreground px-3 py-2 text-left font-medium",
|
|
4408
|
-
children: "
|
|
4579
|
+
children: t("date")
|
|
4409
4580
|
}),
|
|
4410
4581
|
/* @__PURE__ */ jsx("th", {
|
|
4411
4582
|
className: "text-muted-foreground px-3 py-2 text-left font-medium",
|
|
4412
|
-
children: "
|
|
4583
|
+
children: t("status")
|
|
4413
4584
|
}),
|
|
4414
4585
|
/* @__PURE__ */ jsx("th", {
|
|
4415
4586
|
className: "text-muted-foreground py-2 pr-3 pl-3 text-right font-medium",
|
|
4416
|
-
children: "
|
|
4587
|
+
children: t("amount")
|
|
4417
4588
|
})
|
|
4418
4589
|
] })
|
|
4419
4590
|
}), /* @__PURE__ */ jsx("tbody", {
|
|
@@ -4436,7 +4607,7 @@ function OrderHistorySection({ subscription }) {
|
|
|
4436
4607
|
}),
|
|
4437
4608
|
/* @__PURE__ */ jsx("td", {
|
|
4438
4609
|
className: "text-foreground py-2 pr-3 pl-3 text-right",
|
|
4439
|
-
children: order.amount != null ? formatCurrency(Number(order.amount)) : "
|
|
4610
|
+
children: order.amount != null ? formatCurrency(Number(order.amount)) : t("not_available")
|
|
4440
4611
|
})
|
|
4441
4612
|
] }, order.id))
|
|
4442
4613
|
})]
|
|
@@ -4445,6 +4616,7 @@ function OrderHistorySection({ subscription }) {
|
|
|
4445
4616
|
});
|
|
4446
4617
|
}
|
|
4447
4618
|
function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationError, onNavigateToSubscription, renderPaymentMethod, renderShippingAddress }) {
|
|
4619
|
+
const { t } = useSubscriptionsTranslation();
|
|
4448
4620
|
const [showCancelModal, setShowCancelModal] = useState(false);
|
|
4449
4621
|
const [showPauseModal, setShowPauseModal] = useState(false);
|
|
4450
4622
|
const [showResumeModal, setShowResumeModal] = useState(false);
|
|
@@ -4456,53 +4628,57 @@ function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationE
|
|
|
4456
4628
|
const customerSubscriptionsQuery = useSubscriptions({ perPage: 100 }, { enabled: showEditBillDateModal });
|
|
4457
4629
|
const otherSubscriptionsForBillDate = useMemo(() => (customerSubscriptionsQuery.data?.subscriptions ?? []).filter((s) => s.subscription_token !== token).map((s) => ({
|
|
4458
4630
|
token: s.subscription_token,
|
|
4459
|
-
productTitle: s.variant?.product?.title ?? "
|
|
4631
|
+
productTitle: s.variant?.product?.title ?? t("breadcrumb"),
|
|
4460
4632
|
nextBillDate: s.next_bill_date,
|
|
4461
4633
|
billingInterval: s.subscription_plan?.billing_interval ?? 1,
|
|
4462
4634
|
billingIntervalUnit: s.subscription_plan?.billing_interval_unit ?? "month"
|
|
4463
|
-
})), [
|
|
4635
|
+
})), [
|
|
4636
|
+
customerSubscriptionsQuery.data,
|
|
4637
|
+
token,
|
|
4638
|
+
t
|
|
4639
|
+
]);
|
|
4464
4640
|
const pauseMutation = usePauseSubscription({
|
|
4465
|
-
onSuccess: () => onSuccess?.("
|
|
4466
|
-
onError: (err) => onMutationError?.("
|
|
4641
|
+
onSuccess: () => onSuccess?.(t("subscription_paused")),
|
|
4642
|
+
onError: (err) => onMutationError?.(t("failed_to_pause"), err)
|
|
4467
4643
|
});
|
|
4468
4644
|
const resumeMutation = useResumeSubscription({
|
|
4469
|
-
onSuccess: () => onSuccess?.("
|
|
4470
|
-
onError: (err) => onMutationError?.("
|
|
4645
|
+
onSuccess: () => onSuccess?.(t("subscription_resumed")),
|
|
4646
|
+
onError: (err) => onMutationError?.(t("failed_to_resume"), err)
|
|
4471
4647
|
});
|
|
4472
4648
|
const skipMutation = useSkipSubscription({
|
|
4473
|
-
onSuccess: () => onSuccess?.("
|
|
4474
|
-
onError: (err) => onMutationError?.("
|
|
4649
|
+
onSuccess: () => onSuccess?.(t("next_billing_skipped")),
|
|
4650
|
+
onError: (err) => onMutationError?.(t("failed_to_skip"), err)
|
|
4475
4651
|
});
|
|
4476
4652
|
const cancelMutation = useCancelSubscription({
|
|
4477
4653
|
onSuccess: () => {
|
|
4478
|
-
onSuccess?.("
|
|
4654
|
+
onSuccess?.(t("subscription_cancelled"));
|
|
4479
4655
|
setShowCancelModal(false);
|
|
4480
4656
|
},
|
|
4481
|
-
onError: (err) => onMutationError?.("
|
|
4657
|
+
onError: (err) => onMutationError?.(t("failed_to_cancel"), err)
|
|
4482
4658
|
});
|
|
4483
4659
|
const reactivateMutation = useReactivateSubscription({
|
|
4484
|
-
onSuccess: () => onSuccess?.("
|
|
4485
|
-
onError: (err) => onMutationError?.("
|
|
4660
|
+
onSuccess: () => onSuccess?.(t("subscription_reactivated")),
|
|
4661
|
+
onError: (err) => onMutationError?.(t("failed_to_reactivate"), err)
|
|
4486
4662
|
});
|
|
4487
4663
|
const [pendingQuantity, setPendingQuantity] = useState(null);
|
|
4488
4664
|
const quantityDebounceRef = useRef(null);
|
|
4489
4665
|
const quantityMutation = useUpdateSubscriptionInfo({
|
|
4490
4666
|
onSuccess: () => {
|
|
4491
|
-
onSuccess?.("
|
|
4667
|
+
onSuccess?.(t("quantity_updated"));
|
|
4492
4668
|
},
|
|
4493
4669
|
onError: (err) => {
|
|
4494
4670
|
setPendingQuantity(null);
|
|
4495
|
-
onMutationError?.("
|
|
4671
|
+
onMutationError?.(t("failed_to_update_quantity"), err);
|
|
4496
4672
|
}
|
|
4497
4673
|
});
|
|
4498
4674
|
const editBillDateMutation = useUpdateSubscriptionInfo({
|
|
4499
4675
|
onSuccess: () => {
|
|
4500
|
-
onSuccess?.("
|
|
4676
|
+
onSuccess?.(t("bill_date_updated"));
|
|
4501
4677
|
setShowEditBillDateModal(false);
|
|
4502
4678
|
},
|
|
4503
4679
|
onError: (err) => {
|
|
4504
4680
|
setPendingNextBillDate(null);
|
|
4505
|
-
onMutationError?.("
|
|
4681
|
+
onMutationError?.(t("failed_to_update_bill_date"), err);
|
|
4506
4682
|
}
|
|
4507
4683
|
});
|
|
4508
4684
|
const serverNextBillDate = data?.subscription.next_bill_date ?? null;
|
|
@@ -4653,7 +4829,7 @@ function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationE
|
|
|
4653
4829
|
});
|
|
4654
4830
|
},
|
|
4655
4831
|
isLoading: editBillDateMutation.isPending,
|
|
4656
|
-
errorMessage: editBillDateMutation.isError ? "
|
|
4832
|
+
errorMessage: editBillDateMutation.isError ? t("bill_date_error") : void 0,
|
|
4657
4833
|
currentNextBillDate: subscription.next_bill_date,
|
|
4658
4834
|
otherSubscriptions: otherSubscriptionsForBillDate,
|
|
4659
4835
|
onNavigateToSubscription
|
|
@@ -4666,7 +4842,7 @@ function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationE
|
|
|
4666
4842
|
},
|
|
4667
4843
|
onConfirm: handlePauseConfirm,
|
|
4668
4844
|
isLoading: pauseMutation.isPending,
|
|
4669
|
-
errorMessage: pauseMutation.isError ? "
|
|
4845
|
+
errorMessage: pauseMutation.isError ? t("generic_error") : void 0,
|
|
4670
4846
|
currentNextBillDate: subscription.next_bill_date,
|
|
4671
4847
|
billingInterval: plan.billing_interval,
|
|
4672
4848
|
billingIntervalUnit: plan.billing_interval_unit
|
|
@@ -4679,7 +4855,7 @@ function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationE
|
|
|
4679
4855
|
},
|
|
4680
4856
|
onConfirm: handleResumeConfirm,
|
|
4681
4857
|
isLoading: resumeMutation.isPending,
|
|
4682
|
-
errorMessage: resumeMutation.isError ? "
|
|
4858
|
+
errorMessage: resumeMutation.isError ? t("generic_error") : void 0,
|
|
4683
4859
|
defaultNextBillDate: calculateNextBillDate(plan.billing_interval, plan.billing_interval_unit)
|
|
4684
4860
|
})
|
|
4685
4861
|
] });
|
|
@@ -4687,6 +4863,7 @@ function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationE
|
|
|
4687
4863
|
//#endregion
|
|
4688
4864
|
//#region ../../subscriptions/ui/src/screens/SubscriptionDetailScreen.tsx
|
|
4689
4865
|
function SubscriptionDetailScreen$1({ token, onNavigateToList, onNavigateToSubscription, onNotFound, onError, onSuccess, onMutationError, renderPaymentMethod, renderShippingAddress }) {
|
|
4866
|
+
const { t } = useSubscriptionsTranslation();
|
|
4690
4867
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ScreenHeaderBreadcrumbs, { children: /* @__PURE__ */ jsx(Breadcrumb, { children: /* @__PURE__ */ jsxs(BreadcrumbList, {
|
|
4691
4868
|
className: "text-lg",
|
|
4692
4869
|
children: [
|
|
@@ -4696,12 +4873,12 @@ function SubscriptionDetailScreen$1({ token, onNavigateToList, onNavigateToSubsc
|
|
|
4696
4873
|
e.preventDefault();
|
|
4697
4874
|
onNavigateToList();
|
|
4698
4875
|
},
|
|
4699
|
-
children: "
|
|
4876
|
+
children: t("breadcrumb")
|
|
4700
4877
|
}) }),
|
|
4701
4878
|
/* @__PURE__ */ jsx(BreadcrumbSeparator, {}),
|
|
4702
|
-
/* @__PURE__ */ jsx(BreadcrumbItem, { children: /* @__PURE__ */
|
|
4879
|
+
/* @__PURE__ */ jsx(BreadcrumbItem, { children: /* @__PURE__ */ jsx(BreadcrumbPage, {
|
|
4703
4880
|
className: "font-semibold",
|
|
4704
|
-
children:
|
|
4881
|
+
children: t("breadcrumb_detail", { token })
|
|
4705
4882
|
}) })
|
|
4706
4883
|
]
|
|
4707
4884
|
}) }) }), /* @__PURE__ */ jsx("div", {
|
|
@@ -5462,35 +5639,40 @@ function PortalSubscriptionShippingAddressSection({ address: currentAddress, sub
|
|
|
5462
5639
|
//#region src/screens/SubscriptionDetailScreen.tsx
|
|
5463
5640
|
function SubscriptionDetailScreen({ token, onToast }) {
|
|
5464
5641
|
const { navigate } = useAppNavigation();
|
|
5642
|
+
const { t } = useSubscriptionsTranslation();
|
|
5465
5643
|
return /* @__PURE__ */ jsx(SubscriptionDetailScreen$1, {
|
|
5466
5644
|
token,
|
|
5467
|
-
onNavigateToList: () => navigate("subscriptions"),
|
|
5468
|
-
onNavigateToSubscription: (nextToken) => navigate(`subscriptions/${nextToken}`),
|
|
5469
|
-
onNotFound: () => {
|
|
5470
|
-
onToast("
|
|
5645
|
+
onNavigateToList: useCallback(() => navigate("subscriptions"), [navigate]),
|
|
5646
|
+
onNavigateToSubscription: useCallback((nextToken) => navigate(`subscriptions/${nextToken}`), [navigate]),
|
|
5647
|
+
onNotFound: useCallback(() => {
|
|
5648
|
+
onToast(t("subscription_not_found"), "warning");
|
|
5471
5649
|
navigate("subscriptions");
|
|
5472
|
-
},
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5650
|
+
}, [
|
|
5651
|
+
onToast,
|
|
5652
|
+
navigate,
|
|
5653
|
+
t
|
|
5654
|
+
]),
|
|
5655
|
+
onError: useCallback((err) => {
|
|
5656
|
+
onToast(t("failed_to_load_subscription", { message: err instanceof Error ? err.message : t("error_occurred") }), "error");
|
|
5657
|
+
}, [onToast, t]),
|
|
5658
|
+
onSuccess: useCallback((message) => {
|
|
5477
5659
|
onToast(message, "success");
|
|
5478
|
-
},
|
|
5479
|
-
onMutationError: (message, err) => {
|
|
5480
|
-
onToast(`${message}: ${err instanceof Error ? err.message : "
|
|
5481
|
-
},
|
|
5660
|
+
}, [onToast]),
|
|
5661
|
+
onMutationError: useCallback((message, err) => {
|
|
5662
|
+
onToast(`${message}: ${err instanceof Error ? err.message : t("error_occurred")}`, "error");
|
|
5663
|
+
}, [onToast, t]),
|
|
5482
5664
|
renderPaymentMethod: (ctx) => /* @__PURE__ */ jsx(PortalSubscriptionPaymentMethodSection, {
|
|
5483
5665
|
...ctx,
|
|
5484
|
-
onSuccess: (
|
|
5485
|
-
onError: (
|
|
5486
|
-
onToast(`${
|
|
5666
|
+
onSuccess: (msg) => onToast(msg, "success"),
|
|
5667
|
+
onError: (msg, err) => {
|
|
5668
|
+
onToast(`${msg}: ${err instanceof Error ? err.message : t("error_occurred")}`, "error");
|
|
5487
5669
|
}
|
|
5488
5670
|
}),
|
|
5489
5671
|
renderShippingAddress: (ctx) => /* @__PURE__ */ jsx(PortalSubscriptionShippingAddressSection, {
|
|
5490
5672
|
...ctx,
|
|
5491
|
-
onSuccess: (
|
|
5492
|
-
onError: (
|
|
5493
|
-
onToast(`${
|
|
5673
|
+
onSuccess: (msg) => onToast(msg, "success"),
|
|
5674
|
+
onError: (msg, err) => {
|
|
5675
|
+
onToast(`${msg}: ${err instanceof Error ? err.message : t("error_occurred")}`, "error");
|
|
5494
5676
|
}
|
|
5495
5677
|
})
|
|
5496
5678
|
});
|
|
@@ -5515,19 +5697,15 @@ function SubscriptionsScreen({ onToast, background, textColor, accentColor, padd
|
|
|
5515
5697
|
const { data: account } = useAccount();
|
|
5516
5698
|
const customerId = account?.id;
|
|
5517
5699
|
const isLoadingCustomer = account === void 0;
|
|
5518
|
-
|
|
5700
|
+
return /* @__PURE__ */ jsx("div", {
|
|
5519
5701
|
...divProps,
|
|
5520
|
-
children: /* @__PURE__ */ jsx(PortalSubscriptionsApiProvider, { children: /* @__PURE__ */ jsx(SubscriptionDetailScreen, {
|
|
5702
|
+
children: /* @__PURE__ */ jsx(SubscriptionsTranslationBridge, { children: isDetailView ? /* @__PURE__ */ jsx(PortalSubscriptionsApiProvider, { children: /* @__PURE__ */ jsx(SubscriptionDetailScreen, {
|
|
5521
5703
|
token: detailToken,
|
|
5522
5704
|
onToast: effectiveToast
|
|
5523
|
-
}) })
|
|
5524
|
-
});
|
|
5525
|
-
return /* @__PURE__ */ jsx("div", {
|
|
5526
|
-
...divProps,
|
|
5527
|
-
children: /* @__PURE__ */ jsx(PortalSubscriptionsApiProvider, { children: /* @__PURE__ */ jsx(SubscriptionsListScreen, {
|
|
5705
|
+
}) }) : /* @__PURE__ */ jsx(PortalSubscriptionsApiProvider, { children: /* @__PURE__ */ jsx(SubscriptionsListScreen, {
|
|
5528
5706
|
customerId,
|
|
5529
5707
|
isLoadingCustomer
|
|
5530
|
-
}) })
|
|
5708
|
+
}) }) })
|
|
5531
5709
|
});
|
|
5532
5710
|
}
|
|
5533
5711
|
const subscriptionsScreenPropertySchema = {
|
|
@@ -5542,4 +5720,4 @@ const subscriptionsScreenPropertySchema = {
|
|
|
5542
5720
|
//#endregion
|
|
5543
5721
|
export { SubscriptionsScreen_exports as n, subscriptionsScreenPropertySchema as r, SubscriptionsScreen as t };
|
|
5544
5722
|
|
|
5545
|
-
//# sourceMappingURL=SubscriptionsScreen-
|
|
5723
|
+
//# sourceMappingURL=SubscriptionsScreen-CWnj0SIk.mjs.map
|