@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 @@ const require_portal_tenant = require("./portal_tenant-DG4gKXnu.cjs");
|
|
|
3
3
|
const require_api_context = require("./api-context-BkBvyFVK.cjs");
|
|
4
4
|
const require_countries_api_context = require("./countries-api-context-C0C0K9gJ.cjs");
|
|
5
5
|
const require_PortalTenantClientProvider = require("./PortalTenantClientProvider-CVv-4rQ9.cjs");
|
|
6
|
+
const require_static_dict_adapter = require("./static-dict-adapter-D1ErNskC.cjs");
|
|
6
7
|
const require_src = require("./src-B0ut9PTw.cjs");
|
|
7
8
|
const require_ScreenHeaderContext = require("./ScreenHeaderContext-CsfhnuJk.cjs");
|
|
8
9
|
const require_query_keys = require("./query-keys-D3lK70Ea.cjs");
|
|
@@ -2720,6 +2721,170 @@ function PortalSubscriptionsApiProvider({ children }) {
|
|
|
2720
2721
|
});
|
|
2721
2722
|
}
|
|
2722
2723
|
//#endregion
|
|
2724
|
+
//#region ../../subscriptions/core/src/translation-api-context.ts
|
|
2725
|
+
const { Provider, useTranslation } = require_static_dict_adapter.createTranslationContext("Subscriptions");
|
|
2726
|
+
const SubscriptionsTranslationProvider = Provider;
|
|
2727
|
+
const useSubscriptionsTranslation = useTranslation;
|
|
2728
|
+
//#endregion
|
|
2729
|
+
//#region ../../subscriptions/core/src/translation-adapter.ts
|
|
2730
|
+
const subscriptionsDomain = require_static_dict_adapter.createDomainTranslations({
|
|
2731
|
+
fallback: {
|
|
2732
|
+
breadcrumb: "Subscriptions",
|
|
2733
|
+
breadcrumb_detail: "Subscription #{{token}}",
|
|
2734
|
+
all: "All",
|
|
2735
|
+
active: "Active",
|
|
2736
|
+
inactive: "Inactive",
|
|
2737
|
+
search_placeholder: "Search subscriptions...",
|
|
2738
|
+
product: "Product",
|
|
2739
|
+
next_bill_date: "Next Bill Date",
|
|
2740
|
+
price: "Price",
|
|
2741
|
+
status: "Status",
|
|
2742
|
+
no_subscriptions_found: "No subscriptions found",
|
|
2743
|
+
unknown_status: "Unknown",
|
|
2744
|
+
total: "Total",
|
|
2745
|
+
results: "results",
|
|
2746
|
+
previous: "Previous",
|
|
2747
|
+
next: "Next",
|
|
2748
|
+
pagination: "Pagination",
|
|
2749
|
+
your_upcoming_order: "Your Upcoming Order",
|
|
2750
|
+
next_order_date: "Next Order Date",
|
|
2751
|
+
next_bill_amount: "Next Bill Amount",
|
|
2752
|
+
product_image_alt: "Product image",
|
|
2753
|
+
no_image: "No image",
|
|
2754
|
+
quantity_label: "Quantity",
|
|
2755
|
+
quantity_aria: "Quantity",
|
|
2756
|
+
subtotal: "Subtotal",
|
|
2757
|
+
discount: "Discount",
|
|
2758
|
+
total_label: "Total",
|
|
2759
|
+
tax_shipping_note: "*Tax and shipping calculated at checkout",
|
|
2760
|
+
order_actions: "Order Actions",
|
|
2761
|
+
skip_next_order: "Skip Next Order",
|
|
2762
|
+
edit_bill_date: "Edit Bill Date",
|
|
2763
|
+
pause_subscription: "Pause Subscription",
|
|
2764
|
+
cancel_subscription: "Cancel Subscription",
|
|
2765
|
+
cancelled_subscription: "Cancelled Subscription",
|
|
2766
|
+
resume_subscription: "Resume Subscription",
|
|
2767
|
+
reactivate_subscription: "Reactivate Subscription",
|
|
2768
|
+
skip_next: "Skip Next",
|
|
2769
|
+
pause: "Pause",
|
|
2770
|
+
cancel: "Cancel",
|
|
2771
|
+
resume: "Resume",
|
|
2772
|
+
reactivate: "Reactivate",
|
|
2773
|
+
subscription_details: "Subscription Details",
|
|
2774
|
+
order_frequency: "Order Frequency",
|
|
2775
|
+
next_payment: "Next Payment",
|
|
2776
|
+
last_billed: "Last Billed",
|
|
2777
|
+
payment_and_shipping: "Payment & Shipping",
|
|
2778
|
+
shipping_address: "Shipping Address",
|
|
2779
|
+
payment_method: "Payment Method",
|
|
2780
|
+
card_fallback: "Card",
|
|
2781
|
+
ending_in: "ending in {{last4}}",
|
|
2782
|
+
no_payment_method: "No payment method",
|
|
2783
|
+
no_shipping_address: "No shipping address available",
|
|
2784
|
+
subscription_order_history: "Subscription Order History",
|
|
2785
|
+
order: "Order",
|
|
2786
|
+
date: "Date",
|
|
2787
|
+
amount: "Amount",
|
|
2788
|
+
not_available: "N/A",
|
|
2789
|
+
cancel_dialog_title: "Cancel Subscription",
|
|
2790
|
+
cancel_dialog_description: "Are you sure you want to cancel this subscription? You can reactivate it later.",
|
|
2791
|
+
cancel_dialog_pause_question: "Would you like to pause your subscription instead?",
|
|
2792
|
+
cancel_dialog_pause_button: "Pause Subscription",
|
|
2793
|
+
cancel_dialog_cancel_button: "Cancel",
|
|
2794
|
+
cancel_dialog_confirm_button: "Cancel Subscription",
|
|
2795
|
+
pause_for: "Pause for",
|
|
2796
|
+
select_duration: "Select duration",
|
|
2797
|
+
month_singular: "{{count}} month",
|
|
2798
|
+
month_plural: "{{count}} months",
|
|
2799
|
+
pause_dialog_title: "Pause subscription",
|
|
2800
|
+
pause_dialog_description: "Are you sure you want to pause subscription?",
|
|
2801
|
+
pause_dialog_action: "Pause",
|
|
2802
|
+
pause_indefinitely: "Pause indefinitely",
|
|
2803
|
+
pause_for_orders: "Pause for a number of upcoming orders",
|
|
2804
|
+
choose_orders_to_skip: "Choose how many orders to skip",
|
|
2805
|
+
select: "Select",
|
|
2806
|
+
pause_dialog_cancel: "Cancel",
|
|
2807
|
+
pause_indefinite_message_prefix: "If you pause indefinitely no further charges will occur. To restart, simply select",
|
|
2808
|
+
pause_indefinite_message_resume: "Resume",
|
|
2809
|
+
pause_indefinite_message_suffix: "from your account.",
|
|
2810
|
+
pause_resume_message_prefix: "You won't be charged until your subscription resumes on",
|
|
2811
|
+
pause_resume_message_suffix: ".",
|
|
2812
|
+
resume_dialog_title: "Resume subscription",
|
|
2813
|
+
resume_dialog_description: "Choose the date your subscription should resume.",
|
|
2814
|
+
resume_dialog_action: "Resume",
|
|
2815
|
+
resume_date: "Resume date",
|
|
2816
|
+
date_placeholder: "mm/dd/yyyy",
|
|
2817
|
+
resume_dialog_cancel: "Cancel",
|
|
2818
|
+
resume_charge_message_prefix: "Your subscription will resume and you'll be charged on",
|
|
2819
|
+
resume_charge_message_suffix: ".",
|
|
2820
|
+
edit_bill_date_title: "Edit bill date",
|
|
2821
|
+
edit_bill_date_description: "Select a new date for your next bill.",
|
|
2822
|
+
edit_bill_date_action: "Save",
|
|
2823
|
+
next_bill_date_label: "Next bill date",
|
|
2824
|
+
edit_bill_date_cancel: "Cancel",
|
|
2825
|
+
bill_date_preview_prefix: "Your next bill will be on",
|
|
2826
|
+
bill_date_preview_suffix: ".",
|
|
2827
|
+
your_other_subscriptions: "Your other subscriptions",
|
|
2828
|
+
other_subs_product: "Product",
|
|
2829
|
+
other_subs_bill_date: "Bill Date",
|
|
2830
|
+
subscription_paused: "Subscription paused",
|
|
2831
|
+
failed_to_pause: "Failed to pause subscription",
|
|
2832
|
+
subscription_resumed: "Subscription resumed",
|
|
2833
|
+
failed_to_resume: "Failed to resume subscription",
|
|
2834
|
+
next_billing_skipped: "Next billing skipped",
|
|
2835
|
+
failed_to_skip: "Failed to skip billing",
|
|
2836
|
+
subscription_cancelled: "Subscription cancelled",
|
|
2837
|
+
failed_to_cancel: "Failed to cancel subscription",
|
|
2838
|
+
subscription_reactivated: "Subscription reactivated",
|
|
2839
|
+
failed_to_reactivate: "Failed to reactivate subscription",
|
|
2840
|
+
quantity_updated: "Quantity updated",
|
|
2841
|
+
failed_to_update_quantity: "Failed to update quantity",
|
|
2842
|
+
bill_date_updated: "Bill date updated",
|
|
2843
|
+
failed_to_update_bill_date: "Failed to update bill date",
|
|
2844
|
+
bill_date_error: "Could not update the bill date. Please try a different date.",
|
|
2845
|
+
generic_error: "Something went wrong. Please try again.",
|
|
2846
|
+
account_load_error: "Unable to load account data. Please try again later.",
|
|
2847
|
+
subscription_not_found: "Subscription not found",
|
|
2848
|
+
error_occurred: "An error occurred",
|
|
2849
|
+
failed_to_load_subscription: "Failed to load subscription: {{message}}"
|
|
2850
|
+
},
|
|
2851
|
+
loaders: {
|
|
2852
|
+
de: () => Promise.resolve().then(() => require("./de-DlGTKoNF.cjs")).then((m) => m.default),
|
|
2853
|
+
el: () => Promise.resolve().then(() => require("./el-DmE3Hzmx.cjs")).then((m) => m.default),
|
|
2854
|
+
es: () => Promise.resolve().then(() => require("./es-CdUtxnpO.cjs")).then((m) => m.default),
|
|
2855
|
+
fr: () => Promise.resolve().then(() => require("./fr-BupLb6QX.cjs")).then((m) => m.default),
|
|
2856
|
+
he: () => Promise.resolve().then(() => require("./he-POkv2_Vj.cjs")).then((m) => m.default),
|
|
2857
|
+
hu: () => Promise.resolve().then(() => require("./hu-DM6iXy8A.cjs")).then((m) => m.default),
|
|
2858
|
+
id: () => Promise.resolve().then(() => require("./id-DrazPWpH.cjs")).then((m) => m.default),
|
|
2859
|
+
it: () => Promise.resolve().then(() => require("./it-DJZTksMf.cjs")).then((m) => m.default),
|
|
2860
|
+
ja: () => Promise.resolve().then(() => require("./ja-EkL2I43a.cjs")).then((m) => m.default),
|
|
2861
|
+
ko: () => Promise.resolve().then(() => require("./ko-nvUbObdA.cjs")).then((m) => m.default),
|
|
2862
|
+
nl: () => Promise.resolve().then(() => require("./nl-DmYVhUdz.cjs")).then((m) => m.default),
|
|
2863
|
+
pl: () => Promise.resolve().then(() => require("./pl-DcI4V80q.cjs")).then((m) => m.default),
|
|
2864
|
+
pt: () => Promise.resolve().then(() => require("./pt-C3OW-rk-.cjs")).then((m) => m.default),
|
|
2865
|
+
ro: () => Promise.resolve().then(() => require("./ro-CgxOj7vq.cjs")).then((m) => m.default),
|
|
2866
|
+
ru: () => Promise.resolve().then(() => require("./ru-DuWWq-BM.cjs")).then((m) => m.default),
|
|
2867
|
+
th: () => Promise.resolve().then(() => require("./th-_sG5tZjo.cjs")).then((m) => m.default),
|
|
2868
|
+
tl: () => Promise.resolve().then(() => require("./tl-BbpJzTrp.cjs")).then((m) => m.default),
|
|
2869
|
+
tr: () => Promise.resolve().then(() => require("./tr-Bp9hpupi.cjs")).then((m) => m.default),
|
|
2870
|
+
zh_CN: () => Promise.resolve().then(() => require("./zh_CN-DDuxhKf9.cjs")).then((m) => m.default),
|
|
2871
|
+
zh_TW: () => Promise.resolve().then(() => require("./zh_TW-C24oYhoK.cjs")).then((m) => m.default)
|
|
2872
|
+
}
|
|
2873
|
+
});
|
|
2874
|
+
function createSubscriptionsTranslationAdapter(locale, dict) {
|
|
2875
|
+
return require_static_dict_adapter.createStaticDictAdapter(locale, dict);
|
|
2876
|
+
}
|
|
2877
|
+
//#endregion
|
|
2878
|
+
//#region src/providers/SubscriptionsTranslationBridge.tsx
|
|
2879
|
+
function SubscriptionsTranslationBridge({ children }) {
|
|
2880
|
+
const { locale } = require_static_dict_adapter.useActiveLocale();
|
|
2881
|
+
const dict = require_static_dict_adapter.useDomainDict(subscriptionsDomain, locale);
|
|
2882
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SubscriptionsTranslationProvider, {
|
|
2883
|
+
value: (0, react.useMemo)(() => createSubscriptionsTranslationAdapter(locale, dict), [locale, dict]),
|
|
2884
|
+
children
|
|
2885
|
+
});
|
|
2886
|
+
}
|
|
2887
|
+
//#endregion
|
|
2723
2888
|
//#region src/screens/subscriptions/portal-subscriptions-list-helpers.ts
|
|
2724
2889
|
const replaceN = (s, n) => s.replace("{n}", String(n));
|
|
2725
2890
|
const STATUS_LOOKUP = {
|
|
@@ -3288,7 +3453,8 @@ const PAUSE_MONTH_OPTIONS = [
|
|
|
3288
3453
|
2,
|
|
3289
3454
|
3
|
|
3290
3455
|
];
|
|
3291
|
-
function CancelSubscriptionDialog({ open, onOpenChange, onConfirm, onPauseInstead, errorMessage
|
|
3456
|
+
function CancelSubscriptionDialog({ open, onOpenChange, onConfirm, onPauseInstead, errorMessage }) {
|
|
3457
|
+
const { t } = useSubscriptionsTranslation();
|
|
3292
3458
|
const [isPending, setIsPending] = (0, react.useState)(false);
|
|
3293
3459
|
const [selectedMonths, setSelectedMonths] = (0, react.useState)(null);
|
|
3294
3460
|
(0, react.useEffect)(() => {
|
|
@@ -3318,18 +3484,18 @@ function CancelSubscriptionDialog({ open, onOpenChange, onConfirm, onPauseInstea
|
|
|
3318
3484
|
open,
|
|
3319
3485
|
onOpenChange: (v) => !isPending && onOpenChange(v),
|
|
3320
3486
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.AlertDialogContent, { children: [
|
|
3321
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.AlertDialogHeader, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.AlertDialogTitle, { children:
|
|
3487
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.AlertDialogHeader, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.AlertDialogTitle, { children: t("cancel_dialog_title") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.AlertDialogDescription, { children: t("cancel_dialog_description") })] }),
|
|
3322
3488
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3323
3489
|
className: "border-border space-y-2 rounded-md border p-3",
|
|
3324
3490
|
children: [
|
|
3325
3491
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3326
3492
|
className: "text-foreground text-sm font-medium",
|
|
3327
|
-
children:
|
|
3493
|
+
children: t("cancel_dialog_pause_question")
|
|
3328
3494
|
}),
|
|
3329
3495
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Label, {
|
|
3330
3496
|
htmlFor: "cancel-pause-months",
|
|
3331
3497
|
className: "text-foreground text-sm font-semibold",
|
|
3332
|
-
children: "
|
|
3498
|
+
children: t("pause_for")
|
|
3333
3499
|
}),
|
|
3334
3500
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Select, {
|
|
3335
3501
|
value: selectedMonths ? String(selectedMonths) : void 0,
|
|
@@ -3338,14 +3504,10 @@ function CancelSubscriptionDialog({ open, onOpenChange, onConfirm, onPauseInstea
|
|
|
3338
3504
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.SelectTrigger, {
|
|
3339
3505
|
id: "cancel-pause-months",
|
|
3340
3506
|
className: "w-full",
|
|
3341
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.SelectValue, { placeholder: "
|
|
3342
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.SelectContent, { children: PAUSE_MONTH_OPTIONS.map((months) => /* @__PURE__ */ (0, react_jsx_runtime.
|
|
3507
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.SelectValue, { placeholder: t("select_duration") })
|
|
3508
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.SelectContent, { children: PAUSE_MONTH_OPTIONS.map((months) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.SelectItem, {
|
|
3343
3509
|
value: String(months),
|
|
3344
|
-
children:
|
|
3345
|
-
months,
|
|
3346
|
-
" ",
|
|
3347
|
-
months === 1 ? "month" : "months"
|
|
3348
|
-
]
|
|
3510
|
+
children: months === 1 ? t("month_singular", { count: String(months) }) : t("month_plural", { count: String(months) })
|
|
3349
3511
|
}, months)) })]
|
|
3350
3512
|
}),
|
|
3351
3513
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Button, {
|
|
@@ -3353,7 +3515,7 @@ function CancelSubscriptionDialog({ open, onOpenChange, onConfirm, onPauseInstea
|
|
|
3353
3515
|
onClick: handlePause,
|
|
3354
3516
|
disabled: isPending || !selectedMonths,
|
|
3355
3517
|
className: "w-full",
|
|
3356
|
-
children:
|
|
3518
|
+
children: t("cancel_dialog_pause_button")
|
|
3357
3519
|
})
|
|
3358
3520
|
]
|
|
3359
3521
|
}),
|
|
@@ -3365,13 +3527,13 @@ function CancelSubscriptionDialog({ open, onOpenChange, onConfirm, onPauseInstea
|
|
|
3365
3527
|
className: "flex-col gap-2 sm:flex-row sm:justify-end",
|
|
3366
3528
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.AlertDialogCancel, {
|
|
3367
3529
|
disabled: isPending,
|
|
3368
|
-
children:
|
|
3530
|
+
children: t("cancel_dialog_cancel_button")
|
|
3369
3531
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Button, {
|
|
3370
3532
|
variant: "destructive",
|
|
3371
3533
|
onClick: handleConfirm,
|
|
3372
3534
|
disabled: isPending,
|
|
3373
3535
|
autoFocus: true,
|
|
3374
|
-
children: isPending ? "..." :
|
|
3536
|
+
children: isPending ? "..." : t("cancel_dialog_confirm_button")
|
|
3375
3537
|
})]
|
|
3376
3538
|
})
|
|
3377
3539
|
] })
|
|
@@ -3379,7 +3541,8 @@ function CancelSubscriptionDialog({ open, onOpenChange, onConfirm, onPauseInstea
|
|
|
3379
3541
|
}
|
|
3380
3542
|
//#endregion
|
|
3381
3543
|
//#region ../../subscriptions/ui/src/components/pause-subscription-dialog.tsx
|
|
3382
|
-
function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, errorMessage, currentNextBillDate, billingInterval = 1, billingIntervalUnit = "month"
|
|
3544
|
+
function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, errorMessage, currentNextBillDate, billingInterval = 1, billingIntervalUnit = "month" }) {
|
|
3545
|
+
const { t } = useSubscriptionsTranslation();
|
|
3383
3546
|
const [pauseType, setPauseType] = (0, react.useState)("indefinite");
|
|
3384
3547
|
const [selectedOrderCount, setSelectedOrderCount] = (0, react.useState)(null);
|
|
3385
3548
|
const orderCountOptions = Array.from({ length: 99 }, (_, i) => i + 1);
|
|
@@ -3408,19 +3571,22 @@ function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, err
|
|
|
3408
3571
|
};
|
|
3409
3572
|
const statusMessage = (() => {
|
|
3410
3573
|
if (pauseType === "indefinite") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
3411
|
-
"
|
|
3412
|
-
|
|
3413
|
-
|
|
3574
|
+
t("pause_indefinite_message_prefix"),
|
|
3575
|
+
" ",
|
|
3576
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t("pause_indefinite_message_resume") }),
|
|
3577
|
+
" ",
|
|
3578
|
+
t("pause_indefinite_message_suffix")
|
|
3414
3579
|
] });
|
|
3415
3580
|
if (!selectedOrderCount) return null;
|
|
3581
|
+
const displayDate = calculatedResumeDate ? require_isAfter.format(calculatedResumeDate, "MMMM d, yyyy") : "a future date";
|
|
3416
3582
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
3417
|
-
|
|
3583
|
+
t("pause_resume_message_prefix"),
|
|
3418
3584
|
" ",
|
|
3419
3585
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3420
3586
|
className: "font-semibold",
|
|
3421
|
-
children:
|
|
3587
|
+
children: displayDate
|
|
3422
3588
|
}),
|
|
3423
|
-
"
|
|
3589
|
+
t("pause_resume_message_suffix")
|
|
3424
3590
|
] });
|
|
3425
3591
|
})();
|
|
3426
3592
|
const isActionDisabled = pauseType === "order_count" && !selectedOrderCount;
|
|
@@ -3435,7 +3601,7 @@ function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, err
|
|
|
3435
3601
|
className: "flex flex-row justify-between",
|
|
3436
3602
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.DialogTitle, {
|
|
3437
3603
|
className: "text-md w-full text-left font-medium",
|
|
3438
|
-
children:
|
|
3604
|
+
children: t("pause_dialog_title")
|
|
3439
3605
|
})
|
|
3440
3606
|
}),
|
|
3441
3607
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -3443,7 +3609,7 @@ function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, err
|
|
|
3443
3609
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3444
3610
|
id: "pause-subscription-dialog-description",
|
|
3445
3611
|
className: "text-muted-foreground text-sm",
|
|
3446
|
-
children:
|
|
3612
|
+
children: t("pause_dialog_description")
|
|
3447
3613
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3448
3614
|
className: "space-y-4",
|
|
3449
3615
|
children: [
|
|
@@ -3458,7 +3624,7 @@ function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, err
|
|
|
3458
3624
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Label, {
|
|
3459
3625
|
htmlFor: "pause-indefinitely",
|
|
3460
3626
|
className: "text-foreground cursor-pointer text-sm font-medium",
|
|
3461
|
-
children: "
|
|
3627
|
+
children: t("pause_indefinitely")
|
|
3462
3628
|
})]
|
|
3463
3629
|
}),
|
|
3464
3630
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -3474,13 +3640,13 @@ function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, err
|
|
|
3474
3640
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Label, {
|
|
3475
3641
|
htmlFor: "pause-order-count",
|
|
3476
3642
|
className: "text-foreground cursor-pointer text-sm font-medium",
|
|
3477
|
-
children: "
|
|
3643
|
+
children: t("pause_for_orders")
|
|
3478
3644
|
})]
|
|
3479
3645
|
}), pauseType === "order_count" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3480
3646
|
className: "ml-6 space-y-2",
|
|
3481
3647
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Label, {
|
|
3482
3648
|
className: "text-foreground text-sm font-semibold",
|
|
3483
|
-
children: "
|
|
3649
|
+
children: t("choose_orders_to_skip")
|
|
3484
3650
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
3485
3651
|
value: selectedOrderCount ?? "",
|
|
3486
3652
|
onChange: (e) => setSelectedOrderCount(Number(e.target.value)),
|
|
@@ -3488,7 +3654,7 @@ function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, err
|
|
|
3488
3654
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
3489
3655
|
value: "",
|
|
3490
3656
|
disabled: true,
|
|
3491
|
-
children: "
|
|
3657
|
+
children: t("select")
|
|
3492
3658
|
}), orderCountOptions.map((count) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
3493
3659
|
value: count,
|
|
3494
3660
|
children: count
|
|
@@ -3513,13 +3679,13 @@ function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, err
|
|
|
3513
3679
|
variant: "outline",
|
|
3514
3680
|
className: "h-10 min-w-[70px] rounded p-3",
|
|
3515
3681
|
onClick: () => handleDismiss(false),
|
|
3516
|
-
children: "
|
|
3682
|
+
children: t("pause_dialog_cancel")
|
|
3517
3683
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Button, {
|
|
3518
3684
|
type: "button",
|
|
3519
3685
|
className: "h-10 min-w-[70px] rounded p-3",
|
|
3520
3686
|
onClick: handleConfirm,
|
|
3521
3687
|
disabled: isActionDisabled || isLoading,
|
|
3522
|
-
children: isLoading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "border-primary-foreground h-5 w-5 animate-spin rounded-full border-4 border-t-4 border-t-transparent" }) :
|
|
3688
|
+
children: isLoading ? /* @__PURE__ */ (0, react_jsx_runtime.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")
|
|
3523
3689
|
})]
|
|
3524
3690
|
}) })
|
|
3525
3691
|
]
|
|
@@ -3540,7 +3706,8 @@ function parseIsoDate(value) {
|
|
|
3540
3706
|
}
|
|
3541
3707
|
//#endregion
|
|
3542
3708
|
//#region ../../subscriptions/ui/src/components/resume-subscription-dialog.tsx
|
|
3543
|
-
function ResumeSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, errorMessage, defaultNextBillDate
|
|
3709
|
+
function ResumeSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, errorMessage, defaultNextBillDate }) {
|
|
3710
|
+
const { t } = useSubscriptionsTranslation();
|
|
3544
3711
|
const [selectedDate, setSelectedDate] = (0, react.useState)(void 0);
|
|
3545
3712
|
const [calendarOpen, setCalendarOpen] = (0, react.useState)(false);
|
|
3546
3713
|
const today = /* @__PURE__ */ new Date();
|
|
@@ -3572,7 +3739,7 @@ function ResumeSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, er
|
|
|
3572
3739
|
className: "flex flex-row justify-between",
|
|
3573
3740
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.DialogTitle, {
|
|
3574
3741
|
className: "text-md w-full text-left font-medium",
|
|
3575
|
-
children:
|
|
3742
|
+
children: t("resume_dialog_title")
|
|
3576
3743
|
})
|
|
3577
3744
|
}),
|
|
3578
3745
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -3580,13 +3747,13 @@ function ResumeSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, er
|
|
|
3580
3747
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3581
3748
|
id: "resume-subscription-dialog-description",
|
|
3582
3749
|
className: "text-muted-foreground text-left text-sm",
|
|
3583
|
-
children:
|
|
3750
|
+
children: t("resume_dialog_description")
|
|
3584
3751
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3585
3752
|
className: "space-y-2",
|
|
3586
3753
|
children: [
|
|
3587
3754
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Label, {
|
|
3588
3755
|
className: "text-foreground text-sm font-semibold",
|
|
3589
|
-
children: "
|
|
3756
|
+
children: t("resume_date")
|
|
3590
3757
|
}),
|
|
3591
3758
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Popover, {
|
|
3592
3759
|
open: calendarOpen,
|
|
@@ -3596,7 +3763,7 @@ function ResumeSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, er
|
|
|
3596
3763
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Button, {
|
|
3597
3764
|
variant: "outline",
|
|
3598
3765
|
className: require_src.cn("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"),
|
|
3599
|
-
children: [selectedDate ? require_isAfter.format(selectedDate, "MM/dd/yyyy") : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "
|
|
3766
|
+
children: [selectedDate ? require_isAfter.format(selectedDate, "MM/dd/yyyy") : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("date_placeholder") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CalendarIcon, { className: "text-muted-foreground ml-auto h-4 w-4" })]
|
|
3600
3767
|
})
|
|
3601
3768
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.PopoverContent, {
|
|
3602
3769
|
className: "bg-popover w-auto rounded-md border p-0 shadow-lg",
|
|
@@ -3623,13 +3790,13 @@ function ResumeSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, er
|
|
|
3623
3790
|
selectedDate && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
3624
3791
|
className: "text-muted-foreground text-xs",
|
|
3625
3792
|
children: [
|
|
3626
|
-
"
|
|
3793
|
+
t("resume_charge_message_prefix"),
|
|
3627
3794
|
" ",
|
|
3628
3795
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3629
3796
|
className: "font-semibold",
|
|
3630
3797
|
children: require_isAfter.format(selectedDate, "MMMM d, yyyy")
|
|
3631
3798
|
}),
|
|
3632
|
-
"
|
|
3799
|
+
t("resume_charge_message_suffix")
|
|
3633
3800
|
]
|
|
3634
3801
|
})
|
|
3635
3802
|
]
|
|
@@ -3644,13 +3811,13 @@ function ResumeSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, er
|
|
|
3644
3811
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Button, {
|
|
3645
3812
|
className: "bg-muted text-foreground ring-border hover:bg-muted/80 h-10 min-w-[70px] rounded p-3 ring-1",
|
|
3646
3813
|
onClick: () => handleDismiss(false),
|
|
3647
|
-
children: "
|
|
3814
|
+
children: t("resume_dialog_cancel")
|
|
3648
3815
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Button, {
|
|
3649
3816
|
type: "button",
|
|
3650
3817
|
className: "bg-primary text-primary-foreground h-10 min-w-[70px] rounded p-3 hover:opacity-90 disabled:opacity-50",
|
|
3651
3818
|
onClick: handleConfirm,
|
|
3652
3819
|
disabled: !selectedDate || isLoading,
|
|
3653
|
-
children: isLoading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "border-primary-foreground h-5 w-5 animate-spin rounded-full border-4 border-t-4 border-t-transparent" }) :
|
|
3820
|
+
children: isLoading ? /* @__PURE__ */ (0, react_jsx_runtime.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")
|
|
3654
3821
|
})]
|
|
3655
3822
|
}) })
|
|
3656
3823
|
]
|
|
@@ -3681,7 +3848,8 @@ const SUBSCRIPTION_COLORS = [
|
|
|
3681
3848
|
"#84cc16"
|
|
3682
3849
|
];
|
|
3683
3850
|
const MAX_PROJECTIONS_PER_SUB = 104;
|
|
3684
|
-
function EditBillDateDialog({ open, onOpenChange, onConfirm, isLoading, errorMessage, currentNextBillDate, otherSubscriptions, onNavigateToSubscription
|
|
3851
|
+
function EditBillDateDialog({ open, onOpenChange, onConfirm, isLoading, errorMessage, currentNextBillDate, otherSubscriptions, onNavigateToSubscription }) {
|
|
3852
|
+
const { t } = useSubscriptionsTranslation();
|
|
3685
3853
|
const [selectedDate, setSelectedDate] = (0, react.useState)(void 0);
|
|
3686
3854
|
const [calendarOpen, setCalendarOpen] = (0, react.useState)(false);
|
|
3687
3855
|
const [popoverContainer, setPopoverContainer] = (0, react.useState)(null);
|
|
@@ -3764,7 +3932,7 @@ function EditBillDateDialog({ open, onOpenChange, onConfirm, isLoading, errorMes
|
|
|
3764
3932
|
className: "flex flex-row justify-between",
|
|
3765
3933
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.DialogTitle, {
|
|
3766
3934
|
className: "text-md w-full text-left font-medium",
|
|
3767
|
-
children:
|
|
3935
|
+
children: t("edit_bill_date_title")
|
|
3768
3936
|
})
|
|
3769
3937
|
}),
|
|
3770
3938
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -3773,13 +3941,13 @@ function EditBillDateDialog({ open, onOpenChange, onConfirm, isLoading, errorMes
|
|
|
3773
3941
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3774
3942
|
id: "edit-bill-date-dialog-description",
|
|
3775
3943
|
className: "text-muted-foreground text-sm",
|
|
3776
|
-
children:
|
|
3944
|
+
children: t("edit_bill_date_description")
|
|
3777
3945
|
}),
|
|
3778
3946
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3779
3947
|
className: "space-y-2",
|
|
3780
3948
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Label, {
|
|
3781
3949
|
className: "text-foreground text-sm font-semibold",
|
|
3782
|
-
children: "
|
|
3950
|
+
children: t("next_bill_date_label")
|
|
3783
3951
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.PortalContainerProvider, {
|
|
3784
3952
|
container: popoverContainer,
|
|
3785
3953
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Popover, {
|
|
@@ -3790,7 +3958,7 @@ function EditBillDateDialog({ open, onOpenChange, onConfirm, isLoading, errorMes
|
|
|
3790
3958
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Button, {
|
|
3791
3959
|
variant: "outline",
|
|
3792
3960
|
className: require_src.cn("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"),
|
|
3793
|
-
children: [selectedDate ? require_isAfter.format(selectedDate, "MM/dd/yyyy") : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "
|
|
3961
|
+
children: [selectedDate ? require_isAfter.format(selectedDate, "MM/dd/yyyy") : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("date_placeholder") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CalendarIcon, { className: "text-muted-foreground ml-auto h-4 w-4" })]
|
|
3794
3962
|
})
|
|
3795
3963
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.PopoverContent, {
|
|
3796
3964
|
className: "bg-popover pointer-events-auto z-[9999] w-auto rounded-md border p-0 shadow-lg",
|
|
@@ -3820,20 +3988,20 @@ function EditBillDateDialog({ open, onOpenChange, onConfirm, isLoading, errorMes
|
|
|
3820
3988
|
selectedDate && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3821
3989
|
className: "text-muted-foreground text-xs",
|
|
3822
3990
|
children: [
|
|
3823
|
-
"
|
|
3991
|
+
t("bill_date_preview_prefix"),
|
|
3824
3992
|
" ",
|
|
3825
3993
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3826
3994
|
className: "font-semibold",
|
|
3827
3995
|
children: previewDate
|
|
3828
3996
|
}),
|
|
3829
|
-
"
|
|
3997
|
+
t("bill_date_preview_suffix")
|
|
3830
3998
|
]
|
|
3831
3999
|
}),
|
|
3832
4000
|
subscriptionsWithColor.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3833
4001
|
className: "space-y-2",
|
|
3834
4002
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Label, {
|
|
3835
4003
|
className: "text-foreground text-sm font-semibold",
|
|
3836
|
-
children: "
|
|
4004
|
+
children: t("your_other_subscriptions")
|
|
3837
4005
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3838
4006
|
className: "border-border max-h-40 overflow-auto rounded-md border",
|
|
3839
4007
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("table", {
|
|
@@ -3847,11 +4015,11 @@ function EditBillDateDialog({ open, onOpenChange, onConfirm, isLoading, errorMes
|
|
|
3847
4015
|
}),
|
|
3848
4016
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
3849
4017
|
className: "px-3 py-2 text-left font-medium",
|
|
3850
|
-
children: "
|
|
4018
|
+
children: t("other_subs_product")
|
|
3851
4019
|
}),
|
|
3852
4020
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
3853
4021
|
className: "w-28 px-3 py-2 text-left font-medium",
|
|
3854
|
-
children: "
|
|
4022
|
+
children: t("other_subs_bill_date")
|
|
3855
4023
|
})
|
|
3856
4024
|
] })
|
|
3857
4025
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", {
|
|
@@ -3902,13 +4070,13 @@ function EditBillDateDialog({ open, onOpenChange, onConfirm, isLoading, errorMes
|
|
|
3902
4070
|
variant: "outline",
|
|
3903
4071
|
className: "h-10 min-w-[70px] rounded p-3",
|
|
3904
4072
|
onClick: () => handleDismiss(false),
|
|
3905
|
-
children: "
|
|
4073
|
+
children: t("edit_bill_date_cancel")
|
|
3906
4074
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Button, {
|
|
3907
4075
|
type: "button",
|
|
3908
4076
|
className: "h-10 min-w-[70px] rounded p-3",
|
|
3909
4077
|
onClick: handleConfirm,
|
|
3910
4078
|
disabled: !selectedDate || isLoading,
|
|
3911
|
-
children: isLoading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "border-primary-foreground h-5 w-5 animate-spin rounded-full border-4 border-t-4 border-t-transparent" }) :
|
|
4079
|
+
children: isLoading ? /* @__PURE__ */ (0, react_jsx_runtime.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")
|
|
3912
4080
|
})]
|
|
3913
4081
|
}) })
|
|
3914
4082
|
]
|
|
@@ -4095,6 +4263,7 @@ function QuantityInput({ inputId, quantity, isUpdatingQuantity, onQuantityChange
|
|
|
4095
4263
|
});
|
|
4096
4264
|
}
|
|
4097
4265
|
function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBillDate, canEditQuantity = false, onQuantityChange, isUpdatingQuantity = false }) {
|
|
4266
|
+
const { t } = useSubscriptionsTranslation();
|
|
4098
4267
|
const variant = subscription.variant;
|
|
4099
4268
|
const product = variant?.product;
|
|
4100
4269
|
const quantity = displayQuantity ?? subscription.quantity;
|
|
@@ -4111,7 +4280,7 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
4111
4280
|
className: "mt-4",
|
|
4112
4281
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
|
|
4113
4282
|
className: "text-foreground mb-2 text-lg font-medium",
|
|
4114
|
-
children: "
|
|
4283
|
+
children: t("your_upcoming_order")
|
|
4115
4284
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4116
4285
|
className: "text-muted-foreground",
|
|
4117
4286
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -4120,7 +4289,7 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
4120
4289
|
className: "border-border border-r pr-4",
|
|
4121
4290
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4122
4291
|
className: "text-muted-foreground mb-1 text-sm",
|
|
4123
|
-
children: "
|
|
4292
|
+
children: t("next_order_date")
|
|
4124
4293
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4125
4294
|
className: "text-foreground text-2xl font-bold",
|
|
4126
4295
|
children: getNextBillDisplay(displayNextBillDate ? {
|
|
@@ -4133,7 +4302,7 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
4133
4302
|
children: [
|
|
4134
4303
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4135
4304
|
className: "text-muted-foreground mb-1 text-sm",
|
|
4136
|
-
children: "
|
|
4305
|
+
children: t("next_bill_amount")
|
|
4137
4306
|
}),
|
|
4138
4307
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4139
4308
|
className: "text-foreground text-2xl font-bold",
|
|
@@ -4160,13 +4329,13 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
4160
4329
|
className: "bg-muted h-24 w-24 overflow-hidden rounded",
|
|
4161
4330
|
children: [product?.image_url ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
4162
4331
|
src: product.image_url,
|
|
4163
|
-
alt: variant?.title || "
|
|
4332
|
+
alt: variant?.title || t("product_image_alt"),
|
|
4164
4333
|
width: 96,
|
|
4165
4334
|
height: 96,
|
|
4166
4335
|
className: "h-full w-full object-cover"
|
|
4167
4336
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4168
4337
|
className: "text-muted-foreground flex h-full w-full items-center justify-center",
|
|
4169
|
-
children: "
|
|
4338
|
+
children: t("no_image")
|
|
4170
4339
|
}), quantity > 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4171
4340
|
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",
|
|
4172
4341
|
children: quantity
|
|
@@ -4195,7 +4364,7 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
4195
4364
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
4196
4365
|
htmlFor: quantityInputId,
|
|
4197
4366
|
className: "text-muted-foreground mb-1 text-xs",
|
|
4198
|
-
children: "
|
|
4367
|
+
children: t("quantity_label")
|
|
4199
4368
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuantityInput, {
|
|
4200
4369
|
inputId: quantityInputId,
|
|
4201
4370
|
quantity,
|
|
@@ -4212,7 +4381,7 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
4212
4381
|
className: "flex justify-between text-sm",
|
|
4213
4382
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
4214
4383
|
className: "text-muted-foreground text-sm font-medium",
|
|
4215
|
-
children: "
|
|
4384
|
+
children: t("subtotal")
|
|
4216
4385
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
4217
4386
|
className: "text-muted-foreground text-sm font-medium",
|
|
4218
4387
|
children: subtotal
|
|
@@ -4221,7 +4390,7 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
4221
4390
|
className: "mt-2 flex justify-between text-sm",
|
|
4222
4391
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
4223
4392
|
className: "text-muted-foreground text-sm font-medium",
|
|
4224
|
-
children: "
|
|
4393
|
+
children: t("discount")
|
|
4225
4394
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
4226
4395
|
className: "text-muted-foreground text-sm font-medium",
|
|
4227
4396
|
children: ["-", formatCurrency(discount * quantity)]
|
|
@@ -4231,7 +4400,7 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
4231
4400
|
className: "mt-4 flex items-center justify-between text-base font-medium",
|
|
4232
4401
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
4233
4402
|
className: "text-muted-foreground text-sm font-medium",
|
|
4234
|
-
children: "
|
|
4403
|
+
children: t("total_label")
|
|
4235
4404
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
4236
4405
|
className: "text-foreground text-base font-bold",
|
|
4237
4406
|
children: formatCurrency(subscription.price * quantity)
|
|
@@ -4239,7 +4408,7 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
4239
4408
|
}),
|
|
4240
4409
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4241
4410
|
className: "text-muted-foreground text-xs",
|
|
4242
|
-
children: "
|
|
4411
|
+
children: t("tax_shipping_note")
|
|
4243
4412
|
})
|
|
4244
4413
|
]
|
|
4245
4414
|
})
|
|
@@ -4248,6 +4417,7 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
4248
4417
|
});
|
|
4249
4418
|
}
|
|
4250
4419
|
function SubscriptionManagementSection({ subscription, isActive, isPaused, isCancelled, isMutating, onSkip, onPause, onResume, onCancel, onReactivate, onEditBillDate, displayNextBillDate, renderPaymentMethod, renderShippingAddress }) {
|
|
4420
|
+
const { t } = useSubscriptionsTranslation();
|
|
4251
4421
|
const plan = subscription.subscription_plan;
|
|
4252
4422
|
const quantity = subscription.quantity;
|
|
4253
4423
|
const totalPrice = formatCurrency(subscription.price * quantity);
|
|
@@ -4263,7 +4433,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4263
4433
|
className: "border-border mb-6 border-b pb-6",
|
|
4264
4434
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
|
|
4265
4435
|
className: "text-foreground mb-3 text-sm/6 font-semibold",
|
|
4266
|
-
children: "
|
|
4436
|
+
children: t("order_actions")
|
|
4267
4437
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4268
4438
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-2",
|
|
4269
4439
|
children: [
|
|
@@ -4274,7 +4444,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4274
4444
|
className: actionButtonClass,
|
|
4275
4445
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.SkipForward, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4276
4446
|
className: "truncate",
|
|
4277
|
-
children: "
|
|
4447
|
+
children: t("skip_next_order")
|
|
4278
4448
|
})]
|
|
4279
4449
|
}),
|
|
4280
4450
|
isActive && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Button, {
|
|
@@ -4284,7 +4454,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4284
4454
|
className: actionButtonClass,
|
|
4285
4455
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CalendarDays, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4286
4456
|
className: "truncate",
|
|
4287
|
-
children: "
|
|
4457
|
+
children: t("edit_bill_date")
|
|
4288
4458
|
})]
|
|
4289
4459
|
}),
|
|
4290
4460
|
isActive && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Button, {
|
|
@@ -4294,7 +4464,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4294
4464
|
className: actionButtonClass,
|
|
4295
4465
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Pause, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4296
4466
|
className: "truncate",
|
|
4297
|
-
children: "
|
|
4467
|
+
children: t("pause_subscription")
|
|
4298
4468
|
})]
|
|
4299
4469
|
}),
|
|
4300
4470
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Button, {
|
|
@@ -4304,7 +4474,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4304
4474
|
className: actionButtonClass,
|
|
4305
4475
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.XCircle, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4306
4476
|
className: "truncate",
|
|
4307
|
-
children: isCancelled ? "
|
|
4477
|
+
children: isCancelled ? t("cancelled_subscription") : t("cancel_subscription")
|
|
4308
4478
|
})]
|
|
4309
4479
|
}),
|
|
4310
4480
|
isPaused && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Button, {
|
|
@@ -4314,7 +4484,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4314
4484
|
className: actionButtonClass,
|
|
4315
4485
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Play, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4316
4486
|
className: "truncate",
|
|
4317
|
-
children: "
|
|
4487
|
+
children: t("resume_subscription")
|
|
4318
4488
|
})]
|
|
4319
4489
|
}),
|
|
4320
4490
|
isCancelled && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Button, {
|
|
@@ -4324,7 +4494,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4324
4494
|
className: actionButtonClass,
|
|
4325
4495
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.RotateCcw, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4326
4496
|
className: "truncate",
|
|
4327
|
-
children: "
|
|
4497
|
+
children: t("reactivate_subscription")
|
|
4328
4498
|
})]
|
|
4329
4499
|
})
|
|
4330
4500
|
]
|
|
@@ -4336,7 +4506,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4336
4506
|
className: "mb-4 flex items-center justify-between",
|
|
4337
4507
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
4338
4508
|
className: "text-foreground text-sm/6 font-semibold",
|
|
4339
|
-
children: "
|
|
4509
|
+
children: t("subscription_details")
|
|
4340
4510
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StatusPill, {
|
|
4341
4511
|
status: subscription.status,
|
|
4342
4512
|
children: startCase(subscription.status)
|
|
@@ -4348,7 +4518,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4348
4518
|
className: "flex-1 pr-4",
|
|
4349
4519
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4350
4520
|
className: "text-muted-foreground text-sm",
|
|
4351
|
-
children: "
|
|
4521
|
+
children: t("order_frequency")
|
|
4352
4522
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4353
4523
|
className: "text-foreground font-medium",
|
|
4354
4524
|
children: formatSubscriptionFrequency(plan.billing_interval_unit)
|
|
@@ -4359,7 +4529,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4359
4529
|
children: [
|
|
4360
4530
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4361
4531
|
className: "text-muted-foreground text-sm",
|
|
4362
|
-
children: "
|
|
4532
|
+
children: t("next_payment")
|
|
4363
4533
|
}),
|
|
4364
4534
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4365
4535
|
className: "text-foreground font-medium",
|
|
@@ -4375,7 +4545,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4375
4545
|
className: "flex-1 pl-4 text-right",
|
|
4376
4546
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4377
4547
|
className: "text-muted-foreground text-sm",
|
|
4378
|
-
children: "
|
|
4548
|
+
children: t("last_billed")
|
|
4379
4549
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4380
4550
|
className: "text-foreground font-medium",
|
|
4381
4551
|
children: formatDate(subscription.last_bill_date)
|
|
@@ -4388,7 +4558,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4388
4558
|
className: "pt-2",
|
|
4389
4559
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
4390
4560
|
className: "text-foreground mb-4 text-sm/6 font-semibold",
|
|
4391
|
-
children: "
|
|
4561
|
+
children: t("payment_and_shipping")
|
|
4392
4562
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4393
4563
|
className: "flex flex-col",
|
|
4394
4564
|
children: [renderShippingAddress ? renderShippingAddress({
|
|
@@ -4400,7 +4570,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4400
4570
|
className: "border-border mb-6 border-b pb-4",
|
|
4401
4571
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4402
4572
|
className: "text-muted-foreground mt-3 mb-1 text-sm",
|
|
4403
|
-
children: "
|
|
4573
|
+
children: t("shipping_address")
|
|
4404
4574
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4405
4575
|
className: "text-foreground text-sm",
|
|
4406
4576
|
children: [
|
|
@@ -4427,16 +4597,16 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4427
4597
|
className: "border-border mb-6 border-b pb-4",
|
|
4428
4598
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4429
4599
|
className: "text-muted-foreground mb-1 text-sm",
|
|
4430
|
-
children: "
|
|
4600
|
+
children: t("payment_method")
|
|
4431
4601
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4432
4602
|
className: "text-foreground flex items-center gap-2 text-sm",
|
|
4433
4603
|
children: [paymentDetails?.logo_url && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
4434
4604
|
src: paymentDetails.logo_url,
|
|
4435
|
-
alt: paymentDetails.card_type ?? "
|
|
4605
|
+
alt: paymentDetails.card_type ?? t("card_fallback"),
|
|
4436
4606
|
className: "h-6"
|
|
4437
4607
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
4438
4608
|
className: "font-medium",
|
|
4439
|
-
children: [paymentDetails?.card_type ? startCase(paymentDetails.card_type) : paymentMethod.payment_type, paymentDetails?.last4 ? `
|
|
4609
|
+
children: [paymentDetails?.card_type ? startCase(paymentDetails.card_type) : paymentMethod.payment_type, paymentDetails?.last4 ? ` ${t("ending_in", { last4: paymentDetails.last4 })}` : ""]
|
|
4440
4610
|
})]
|
|
4441
4611
|
})]
|
|
4442
4612
|
}))]
|
|
@@ -4447,12 +4617,13 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
4447
4617
|
});
|
|
4448
4618
|
}
|
|
4449
4619
|
function OrderHistorySection({ subscription }) {
|
|
4620
|
+
const { t } = useSubscriptionsTranslation();
|
|
4450
4621
|
if (subscription.orders.length === 0) return null;
|
|
4451
4622
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
4452
4623
|
className: "mt-6 px-8 pt-6 pb-8",
|
|
4453
4624
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
4454
4625
|
className: "text-foreground mb-3 text-sm/6 font-semibold",
|
|
4455
|
-
children: "
|
|
4626
|
+
children: t("subscription_order_history")
|
|
4456
4627
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4457
4628
|
className: "border-border overflow-x-auto rounded-md border",
|
|
4458
4629
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("table", {
|
|
@@ -4462,19 +4633,19 @@ function OrderHistorySection({ subscription }) {
|
|
|
4462
4633
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
|
|
4463
4634
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
4464
4635
|
className: "text-muted-foreground py-2 pr-3 pl-3 text-left font-medium",
|
|
4465
|
-
children: "
|
|
4636
|
+
children: t("order")
|
|
4466
4637
|
}),
|
|
4467
4638
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
4468
4639
|
className: "text-muted-foreground px-3 py-2 text-left font-medium",
|
|
4469
|
-
children: "
|
|
4640
|
+
children: t("date")
|
|
4470
4641
|
}),
|
|
4471
4642
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
4472
4643
|
className: "text-muted-foreground px-3 py-2 text-left font-medium",
|
|
4473
|
-
children: "
|
|
4644
|
+
children: t("status")
|
|
4474
4645
|
}),
|
|
4475
4646
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
4476
4647
|
className: "text-muted-foreground py-2 pr-3 pl-3 text-right font-medium",
|
|
4477
|
-
children: "
|
|
4648
|
+
children: t("amount")
|
|
4478
4649
|
})
|
|
4479
4650
|
] })
|
|
4480
4651
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", {
|
|
@@ -4497,7 +4668,7 @@ function OrderHistorySection({ subscription }) {
|
|
|
4497
4668
|
}),
|
|
4498
4669
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
|
|
4499
4670
|
className: "text-foreground py-2 pr-3 pl-3 text-right",
|
|
4500
|
-
children: order.amount != null ? formatCurrency(Number(order.amount)) : "
|
|
4671
|
+
children: order.amount != null ? formatCurrency(Number(order.amount)) : t("not_available")
|
|
4501
4672
|
})
|
|
4502
4673
|
] }, order.id))
|
|
4503
4674
|
})]
|
|
@@ -4506,6 +4677,7 @@ function OrderHistorySection({ subscription }) {
|
|
|
4506
4677
|
});
|
|
4507
4678
|
}
|
|
4508
4679
|
function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationError, onNavigateToSubscription, renderPaymentMethod, renderShippingAddress }) {
|
|
4680
|
+
const { t } = useSubscriptionsTranslation();
|
|
4509
4681
|
const [showCancelModal, setShowCancelModal] = (0, react.useState)(false);
|
|
4510
4682
|
const [showPauseModal, setShowPauseModal] = (0, react.useState)(false);
|
|
4511
4683
|
const [showResumeModal, setShowResumeModal] = (0, react.useState)(false);
|
|
@@ -4517,53 +4689,57 @@ function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationE
|
|
|
4517
4689
|
const customerSubscriptionsQuery = useSubscriptions({ perPage: 100 }, { enabled: showEditBillDateModal });
|
|
4518
4690
|
const otherSubscriptionsForBillDate = (0, react.useMemo)(() => (customerSubscriptionsQuery.data?.subscriptions ?? []).filter((s) => s.subscription_token !== token).map((s) => ({
|
|
4519
4691
|
token: s.subscription_token,
|
|
4520
|
-
productTitle: s.variant?.product?.title ?? "
|
|
4692
|
+
productTitle: s.variant?.product?.title ?? t("breadcrumb"),
|
|
4521
4693
|
nextBillDate: s.next_bill_date,
|
|
4522
4694
|
billingInterval: s.subscription_plan?.billing_interval ?? 1,
|
|
4523
4695
|
billingIntervalUnit: s.subscription_plan?.billing_interval_unit ?? "month"
|
|
4524
|
-
})), [
|
|
4696
|
+
})), [
|
|
4697
|
+
customerSubscriptionsQuery.data,
|
|
4698
|
+
token,
|
|
4699
|
+
t
|
|
4700
|
+
]);
|
|
4525
4701
|
const pauseMutation = usePauseSubscription({
|
|
4526
|
-
onSuccess: () => onSuccess?.("
|
|
4527
|
-
onError: (err) => onMutationError?.("
|
|
4702
|
+
onSuccess: () => onSuccess?.(t("subscription_paused")),
|
|
4703
|
+
onError: (err) => onMutationError?.(t("failed_to_pause"), err)
|
|
4528
4704
|
});
|
|
4529
4705
|
const resumeMutation = useResumeSubscription({
|
|
4530
|
-
onSuccess: () => onSuccess?.("
|
|
4531
|
-
onError: (err) => onMutationError?.("
|
|
4706
|
+
onSuccess: () => onSuccess?.(t("subscription_resumed")),
|
|
4707
|
+
onError: (err) => onMutationError?.(t("failed_to_resume"), err)
|
|
4532
4708
|
});
|
|
4533
4709
|
const skipMutation = useSkipSubscription({
|
|
4534
|
-
onSuccess: () => onSuccess?.("
|
|
4535
|
-
onError: (err) => onMutationError?.("
|
|
4710
|
+
onSuccess: () => onSuccess?.(t("next_billing_skipped")),
|
|
4711
|
+
onError: (err) => onMutationError?.(t("failed_to_skip"), err)
|
|
4536
4712
|
});
|
|
4537
4713
|
const cancelMutation = useCancelSubscription({
|
|
4538
4714
|
onSuccess: () => {
|
|
4539
|
-
onSuccess?.("
|
|
4715
|
+
onSuccess?.(t("subscription_cancelled"));
|
|
4540
4716
|
setShowCancelModal(false);
|
|
4541
4717
|
},
|
|
4542
|
-
onError: (err) => onMutationError?.("
|
|
4718
|
+
onError: (err) => onMutationError?.(t("failed_to_cancel"), err)
|
|
4543
4719
|
});
|
|
4544
4720
|
const reactivateMutation = useReactivateSubscription({
|
|
4545
|
-
onSuccess: () => onSuccess?.("
|
|
4546
|
-
onError: (err) => onMutationError?.("
|
|
4721
|
+
onSuccess: () => onSuccess?.(t("subscription_reactivated")),
|
|
4722
|
+
onError: (err) => onMutationError?.(t("failed_to_reactivate"), err)
|
|
4547
4723
|
});
|
|
4548
4724
|
const [pendingQuantity, setPendingQuantity] = (0, react.useState)(null);
|
|
4549
4725
|
const quantityDebounceRef = (0, react.useRef)(null);
|
|
4550
4726
|
const quantityMutation = useUpdateSubscriptionInfo({
|
|
4551
4727
|
onSuccess: () => {
|
|
4552
|
-
onSuccess?.("
|
|
4728
|
+
onSuccess?.(t("quantity_updated"));
|
|
4553
4729
|
},
|
|
4554
4730
|
onError: (err) => {
|
|
4555
4731
|
setPendingQuantity(null);
|
|
4556
|
-
onMutationError?.("
|
|
4732
|
+
onMutationError?.(t("failed_to_update_quantity"), err);
|
|
4557
4733
|
}
|
|
4558
4734
|
});
|
|
4559
4735
|
const editBillDateMutation = useUpdateSubscriptionInfo({
|
|
4560
4736
|
onSuccess: () => {
|
|
4561
|
-
onSuccess?.("
|
|
4737
|
+
onSuccess?.(t("bill_date_updated"));
|
|
4562
4738
|
setShowEditBillDateModal(false);
|
|
4563
4739
|
},
|
|
4564
4740
|
onError: (err) => {
|
|
4565
4741
|
setPendingNextBillDate(null);
|
|
4566
|
-
onMutationError?.("
|
|
4742
|
+
onMutationError?.(t("failed_to_update_bill_date"), err);
|
|
4567
4743
|
}
|
|
4568
4744
|
});
|
|
4569
4745
|
const serverNextBillDate = data?.subscription.next_bill_date ?? null;
|
|
@@ -4714,7 +4890,7 @@ function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationE
|
|
|
4714
4890
|
});
|
|
4715
4891
|
},
|
|
4716
4892
|
isLoading: editBillDateMutation.isPending,
|
|
4717
|
-
errorMessage: editBillDateMutation.isError ? "
|
|
4893
|
+
errorMessage: editBillDateMutation.isError ? t("bill_date_error") : void 0,
|
|
4718
4894
|
currentNextBillDate: subscription.next_bill_date,
|
|
4719
4895
|
otherSubscriptions: otherSubscriptionsForBillDate,
|
|
4720
4896
|
onNavigateToSubscription
|
|
@@ -4727,7 +4903,7 @@ function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationE
|
|
|
4727
4903
|
},
|
|
4728
4904
|
onConfirm: handlePauseConfirm,
|
|
4729
4905
|
isLoading: pauseMutation.isPending,
|
|
4730
|
-
errorMessage: pauseMutation.isError ? "
|
|
4906
|
+
errorMessage: pauseMutation.isError ? t("generic_error") : void 0,
|
|
4731
4907
|
currentNextBillDate: subscription.next_bill_date,
|
|
4732
4908
|
billingInterval: plan.billing_interval,
|
|
4733
4909
|
billingIntervalUnit: plan.billing_interval_unit
|
|
@@ -4740,7 +4916,7 @@ function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationE
|
|
|
4740
4916
|
},
|
|
4741
4917
|
onConfirm: handleResumeConfirm,
|
|
4742
4918
|
isLoading: resumeMutation.isPending,
|
|
4743
|
-
errorMessage: resumeMutation.isError ? "
|
|
4919
|
+
errorMessage: resumeMutation.isError ? t("generic_error") : void 0,
|
|
4744
4920
|
defaultNextBillDate: calculateNextBillDate(plan.billing_interval, plan.billing_interval_unit)
|
|
4745
4921
|
})
|
|
4746
4922
|
] });
|
|
@@ -4748,6 +4924,7 @@ function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationE
|
|
|
4748
4924
|
//#endregion
|
|
4749
4925
|
//#region ../../subscriptions/ui/src/screens/SubscriptionDetailScreen.tsx
|
|
4750
4926
|
function SubscriptionDetailScreen$1({ token, onNavigateToList, onNavigateToSubscription, onNotFound, onError, onSuccess, onMutationError, renderPaymentMethod, renderShippingAddress }) {
|
|
4927
|
+
const { t } = useSubscriptionsTranslation();
|
|
4751
4928
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ScreenHeaderContext.ScreenHeaderBreadcrumbs, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Breadcrumb, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.BreadcrumbList, {
|
|
4752
4929
|
className: "text-lg",
|
|
4753
4930
|
children: [
|
|
@@ -4757,12 +4934,12 @@ function SubscriptionDetailScreen$1({ token, onNavigateToList, onNavigateToSubsc
|
|
|
4757
4934
|
e.preventDefault();
|
|
4758
4935
|
onNavigateToList();
|
|
4759
4936
|
},
|
|
4760
|
-
children: "
|
|
4937
|
+
children: t("breadcrumb")
|
|
4761
4938
|
}) }),
|
|
4762
4939
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.BreadcrumbSeparator, {}),
|
|
4763
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.BreadcrumbItem, { children: /* @__PURE__ */ (0, react_jsx_runtime.
|
|
4940
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.BreadcrumbItem, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.BreadcrumbPage, {
|
|
4764
4941
|
className: "font-semibold",
|
|
4765
|
-
children:
|
|
4942
|
+
children: t("breadcrumb_detail", { token })
|
|
4766
4943
|
}) })
|
|
4767
4944
|
]
|
|
4768
4945
|
}) }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -5523,35 +5700,40 @@ function PortalSubscriptionShippingAddressSection({ address: currentAddress, sub
|
|
|
5523
5700
|
//#region src/screens/SubscriptionDetailScreen.tsx
|
|
5524
5701
|
function SubscriptionDetailScreen({ token, onToast }) {
|
|
5525
5702
|
const { navigate } = require_AppNavigationContext.useAppNavigation();
|
|
5703
|
+
const { t } = useSubscriptionsTranslation();
|
|
5526
5704
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SubscriptionDetailScreen$1, {
|
|
5527
5705
|
token,
|
|
5528
|
-
onNavigateToList: () => navigate("subscriptions"),
|
|
5529
|
-
onNavigateToSubscription: (nextToken) => navigate(`subscriptions/${nextToken}`),
|
|
5530
|
-
onNotFound: () => {
|
|
5531
|
-
onToast("
|
|
5706
|
+
onNavigateToList: (0, react.useCallback)(() => navigate("subscriptions"), [navigate]),
|
|
5707
|
+
onNavigateToSubscription: (0, react.useCallback)((nextToken) => navigate(`subscriptions/${nextToken}`), [navigate]),
|
|
5708
|
+
onNotFound: (0, react.useCallback)(() => {
|
|
5709
|
+
onToast(t("subscription_not_found"), "warning");
|
|
5532
5710
|
navigate("subscriptions");
|
|
5533
|
-
},
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5711
|
+
}, [
|
|
5712
|
+
onToast,
|
|
5713
|
+
navigate,
|
|
5714
|
+
t
|
|
5715
|
+
]),
|
|
5716
|
+
onError: (0, react.useCallback)((err) => {
|
|
5717
|
+
onToast(t("failed_to_load_subscription", { message: err instanceof Error ? err.message : t("error_occurred") }), "error");
|
|
5718
|
+
}, [onToast, t]),
|
|
5719
|
+
onSuccess: (0, react.useCallback)((message) => {
|
|
5538
5720
|
onToast(message, "success");
|
|
5539
|
-
},
|
|
5540
|
-
onMutationError: (message, err) => {
|
|
5541
|
-
onToast(`${message}: ${err instanceof Error ? err.message : "
|
|
5542
|
-
},
|
|
5721
|
+
}, [onToast]),
|
|
5722
|
+
onMutationError: (0, react.useCallback)((message, err) => {
|
|
5723
|
+
onToast(`${message}: ${err instanceof Error ? err.message : t("error_occurred")}`, "error");
|
|
5724
|
+
}, [onToast, t]),
|
|
5543
5725
|
renderPaymentMethod: (ctx) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PortalSubscriptionPaymentMethodSection, {
|
|
5544
5726
|
...ctx,
|
|
5545
|
-
onSuccess: (
|
|
5546
|
-
onError: (
|
|
5547
|
-
onToast(`${
|
|
5727
|
+
onSuccess: (msg) => onToast(msg, "success"),
|
|
5728
|
+
onError: (msg, err) => {
|
|
5729
|
+
onToast(`${msg}: ${err instanceof Error ? err.message : t("error_occurred")}`, "error");
|
|
5548
5730
|
}
|
|
5549
5731
|
}),
|
|
5550
5732
|
renderShippingAddress: (ctx) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PortalSubscriptionShippingAddressSection, {
|
|
5551
5733
|
...ctx,
|
|
5552
|
-
onSuccess: (
|
|
5553
|
-
onError: (
|
|
5554
|
-
onToast(`${
|
|
5734
|
+
onSuccess: (msg) => onToast(msg, "success"),
|
|
5735
|
+
onError: (msg, err) => {
|
|
5736
|
+
onToast(`${msg}: ${err instanceof Error ? err.message : t("error_occurred")}`, "error");
|
|
5555
5737
|
}
|
|
5556
5738
|
})
|
|
5557
5739
|
});
|
|
@@ -5572,19 +5754,15 @@ function SubscriptionsScreen({ onToast, background, textColor, accentColor, padd
|
|
|
5572
5754
|
const { data: account } = require_use_account.useAccount();
|
|
5573
5755
|
const customerId = account?.id;
|
|
5574
5756
|
const isLoadingCustomer = account === void 0;
|
|
5575
|
-
|
|
5757
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5576
5758
|
...divProps,
|
|
5577
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PortalSubscriptionsApiProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SubscriptionDetailScreen, {
|
|
5759
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SubscriptionsTranslationBridge, { children: isDetailView ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PortalSubscriptionsApiProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SubscriptionDetailScreen, {
|
|
5578
5760
|
token: detailToken,
|
|
5579
5761
|
onToast: effectiveToast
|
|
5580
|
-
}) })
|
|
5581
|
-
});
|
|
5582
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5583
|
-
...divProps,
|
|
5584
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PortalSubscriptionsApiProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SubscriptionsListScreen, {
|
|
5762
|
+
}) }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PortalSubscriptionsApiProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SubscriptionsListScreen, {
|
|
5585
5763
|
customerId,
|
|
5586
5764
|
isLoadingCustomer
|
|
5587
|
-
}) })
|
|
5765
|
+
}) }) })
|
|
5588
5766
|
});
|
|
5589
5767
|
}
|
|
5590
5768
|
const subscriptionsScreenPropertySchema = {
|
|
@@ -5610,4 +5788,4 @@ Object.defineProperty(exports, "subscriptionsScreenPropertySchema", {
|
|
|
5610
5788
|
}
|
|
5611
5789
|
});
|
|
5612
5790
|
|
|
5613
|
-
//# sourceMappingURL=SubscriptionsScreen-
|
|
5791
|
+
//# sourceMappingURL=SubscriptionsScreen-D82JKEST.cjs.map
|