@fluid-app/portal-sdk 0.1.314 → 0.1.316
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/{AddressAutocompleteInput-CmieGMsF.cjs → AddressAutocompleteInput-GBK1tcQ7.cjs} +2 -2
- package/dist/{AddressAutocompleteInput-CmieGMsF.cjs.map → AddressAutocompleteInput-GBK1tcQ7.cjs.map} +1 -1
- package/dist/{AddressAutocompleteInput-BmNxLzmA.mjs → AddressAutocompleteInput-QMNGouHg.mjs} +2 -2
- package/dist/{AddressAutocompleteInput-BmNxLzmA.mjs.map → AddressAutocompleteInput-QMNGouHg.mjs.map} +1 -1
- package/dist/{AlertWidget-DB8l5sMN.mjs → AlertWidget-BF_ORULS.mjs} +3 -3
- package/dist/{AlertWidget-DB8l5sMN.mjs.map → AlertWidget-BF_ORULS.mjs.map} +1 -1
- package/dist/{AppDownloadScreen-Dl1yK9d_.mjs → AppDownloadScreen-dfHFK-i6.mjs} +2 -2
- package/dist/{AppDownloadScreen-Dl1yK9d_.mjs.map → AppDownloadScreen-dfHFK-i6.mjs.map} +1 -1
- package/dist/{BulletListWidget-CGb9c7Oo.mjs → BulletListWidget-Bi1pdsJl.mjs} +2 -2
- package/dist/{BulletListWidget-CGb9c7Oo.mjs.map → BulletListWidget-Bi1pdsJl.mjs.map} +1 -1
- package/dist/{CalendarWidget-ByRhEEhr.mjs → CalendarWidget-LnJmsGpv.mjs} +2 -2
- package/dist/{CalendarWidget-ByRhEEhr.mjs.map → CalendarWidget-LnJmsGpv.mjs.map} +1 -1
- package/dist/{CardWidget-CCfS9Jt8.mjs → CardWidget-DLeadzfN.mjs} +2 -2
- package/dist/{CardWidget-CCfS9Jt8.mjs.map → CardWidget-DLeadzfN.mjs.map} +1 -1
- package/dist/{CarouselWidget-DCO2RF7I.mjs → CarouselWidget-C0TQw3h3.mjs} +2 -2
- package/dist/{CarouselWidget-DCO2RF7I.mjs.map → CarouselWidget-C0TQw3h3.mjs.map} +1 -1
- package/dist/{CatchUpWidget-DrQ9M9sw.mjs → CatchUpWidget-C9jZSlF8.mjs} +2 -2
- package/dist/{CatchUpWidget-DrQ9M9sw.mjs.map → CatchUpWidget-C9jZSlF8.mjs.map} +1 -1
- package/dist/{ChartWidget-BzJzDoOH.mjs → ChartWidget-Ba935aP9.mjs} +2 -2
- package/dist/{ChartWidget-BzJzDoOH.mjs.map → ChartWidget-Ba935aP9.mjs.map} +1 -1
- package/dist/{ContactsScreen-mq9oF6UF.mjs → ContactsScreen-BLVMBxiK.mjs} +2 -2
- package/dist/{ContactsScreen-mq9oF6UF.mjs.map → ContactsScreen-BLVMBxiK.mjs.map} +1 -1
- package/dist/{ContainerWidget-DRhQRcEe.mjs → ContainerWidget-Ci3McBxD.mjs} +3 -3
- package/dist/{ContainerWidget-DRhQRcEe.mjs.map → ContainerWidget-Ci3McBxD.mjs.map} +1 -1
- package/dist/{CustomersScreen-0X_7v_YC.mjs → CustomersScreen-N7FMBCv_.mjs} +2 -2
- package/dist/{CustomersScreen-0X_7v_YC.mjs.map → CustomersScreen-N7FMBCv_.mjs.map} +1 -1
- package/dist/{EmbedWidget-Cl41N8Cb.mjs → EmbedWidget-CATRSHDk.mjs} +2 -2
- package/dist/{EmbedWidget-Cl41N8Cb.mjs.map → EmbedWidget-CATRSHDk.mjs.map} +1 -1
- package/dist/{FluidProvider-DXvgVTmO.cjs → FluidProvider-DTdECylI.cjs} +2 -2
- package/dist/{FluidProvider-DXvgVTmO.cjs.map → FluidProvider-DTdECylI.cjs.map} +1 -1
- package/dist/{FluidProvider-DyMRpPnC.mjs → FluidProvider-DcnRMRD4.mjs} +52 -52
- package/dist/{FluidProvider-DyMRpPnC.mjs.map → FluidProvider-DcnRMRD4.mjs.map} +1 -1
- package/dist/{ImageWidget-DLH_uCj7.mjs → ImageWidget-CyTa5HXr.mjs} +2 -2
- package/dist/{ImageWidget-DLH_uCj7.mjs.map → ImageWidget-CyTa5HXr.mjs.map} +1 -1
- package/dist/{LayoutWidget-_Uonr1Cw.mjs → LayoutWidget-D_0t7pau.mjs} +2 -2
- package/dist/{LayoutWidget-_Uonr1Cw.mjs.map → LayoutWidget-D_0t7pau.mjs.map} +1 -1
- package/dist/{LinkWidget-Ch_tN45F.mjs → LinkWidget-C0zTcGH9.mjs} +2 -2
- package/dist/{LinkWidget-Ch_tN45F.mjs.map → LinkWidget-C0zTcGH9.mjs.map} +1 -1
- package/dist/{ListWidget-Cfo53nE-.mjs → ListWidget-ClotDOth.mjs} +2 -2
- package/dist/{ListWidget-Cfo53nE-.mjs.map → ListWidget-ClotDOth.mjs.map} +1 -1
- package/dist/{MessagingScreen-BOTFXwur.mjs → MessagingScreen-BAv7w_a-.mjs} +5 -5
- package/dist/{MessagingScreen-BOTFXwur.mjs.map → MessagingScreen-BAv7w_a-.mjs.map} +1 -1
- package/dist/{MessagingScreen-BfuT9CBj.cjs → MessagingScreen-BqE51MSA.cjs} +3 -3
- package/dist/{MessagingScreen-D5hYQdxm.cjs → MessagingScreen-CkZOYvYf.cjs} +3 -3
- package/dist/{MessagingScreen-D5hYQdxm.cjs.map → MessagingScreen-CkZOYvYf.cjs.map} +1 -1
- package/dist/MessagingScreen-D44VhiKa.mjs +48 -0
- package/dist/{MySiteScreen-CusL1xHg.mjs → MySiteScreen-BpGt2r_e.mjs} +2 -2
- package/dist/{MySiteScreen-CusL1xHg.mjs.map → MySiteScreen-BpGt2r_e.mjs.map} +1 -1
- package/dist/{MySiteWidget-QDIHLxAz.mjs → MySiteWidget-M1WPkOzw.mjs} +2 -2
- package/dist/{MySiteWidget-QDIHLxAz.mjs.map → MySiteWidget-M1WPkOzw.mjs.map} +1 -1
- package/dist/{NestedWidget-By8SJ-ci.mjs → NestedWidget-Muw0upB1.mjs} +2 -2
- package/dist/{NestedWidget-By8SJ-ci.mjs.map → NestedWidget-Muw0upB1.mjs.map} +1 -1
- package/dist/{OrdersScreen-Dp-m303q.mjs → OrdersScreen-ChC-rMWk.mjs} +3 -3
- package/dist/{OrdersScreen-Dp-m303q.mjs.map → OrdersScreen-ChC-rMWk.mjs.map} +1 -1
- package/dist/{OrdersScreen-gzC4EQtO.cjs → OrdersScreen-D8Qu5jXD.cjs} +3 -3
- package/dist/{OrdersScreen-gzC4EQtO.cjs.map → OrdersScreen-D8Qu5jXD.cjs.map} +1 -1
- package/dist/{OrdersScreen-CuNHXmtg.cjs → OrdersScreen-DIckC7xc.cjs} +3 -3
- package/dist/OrdersScreen-Duhvi7tM.mjs +46 -0
- package/dist/{PointsWidget-C1QIWoTR.mjs → PointsWidget-DwPusoNj.mjs} +2 -2
- package/dist/{PointsWidget-C1QIWoTR.mjs.map → PointsWidget-DwPusoNj.mjs.map} +1 -1
- package/dist/{ProfileScreen-1eUj1pwW.mjs → ProfileScreen-BCqvjCKT.mjs} +9 -7
- package/dist/ProfileScreen-BCqvjCKT.mjs.map +1 -0
- package/dist/{ProfileScreen-CQhgY8xm.cjs → ProfileScreen-C6h4c_y3.cjs} +4 -4
- package/dist/ProfileScreen-CRfV9eaL.mjs +49 -0
- package/dist/{ProfileScreen-CCpujV84.cjs → ProfileScreen-SlF6UJg6.cjs} +9 -7
- package/dist/ProfileScreen-SlF6UJg6.cjs.map +1 -0
- package/dist/{QuickLinksWidget-DO-u6AwT.mjs → QuickLinksWidget-CvTQIsle.mjs} +2 -2
- package/dist/{QuickLinksWidget-DO-u6AwT.mjs.map → QuickLinksWidget-CvTQIsle.mjs.map} +1 -1
- package/dist/{QuickShareWidget-CRHs0Ciz.mjs → QuickShareWidget-Vl5yoJvh.mjs} +2 -2
- package/dist/{QuickShareWidget-CRHs0Ciz.mjs.map → QuickShareWidget-Vl5yoJvh.mjs.map} +1 -1
- package/dist/{RecentActivityWidget-DE9ylj-v.mjs → RecentActivityWidget-60GnZ7Dl.mjs} +2 -2
- package/dist/{RecentActivityWidget-DE9ylj-v.mjs.map → RecentActivityWidget-60GnZ7Dl.mjs.map} +1 -1
- package/dist/{SeparatorWidget-CIoLMluh.mjs → SeparatorWidget-euh5w7vj.mjs} +2 -2
- package/dist/{SeparatorWidget-CIoLMluh.mjs.map → SeparatorWidget-euh5w7vj.mjs.map} +1 -1
- package/dist/{ShareablesScreen-PL7O47Gv.cjs → ShareablesScreen--416M3bG.cjs} +2 -2
- package/dist/{ShareablesScreen-yXCq_akC.mjs → ShareablesScreen-BB4X4MDb.mjs} +92 -9
- package/dist/ShareablesScreen-BB4X4MDb.mjs.map +1 -0
- package/dist/{ShareablesScreen-7umiVWD0.mjs → ShareablesScreen-C82JbCTs.mjs} +3 -5
- package/dist/{ShareablesScreen-QclWhq3D.cjs → ShareablesScreen-MeEPViOc.cjs} +90 -7
- package/dist/ShareablesScreen-MeEPViOc.cjs.map +1 -0
- package/dist/{ShopScreen-WInhfklJ.mjs → ShopScreen-BWU2GXtd.mjs} +2 -2
- package/dist/{ShopScreen-WInhfklJ.mjs.map → ShopScreen-BWU2GXtd.mjs.map} +1 -1
- package/dist/{ShopScreen-Bg4zf_JJ.cjs → ShopScreen-BbuAMA4f.cjs} +3 -3
- package/dist/{ShopScreen-CcZC-9I-.cjs → ShopScreen-CfDJpaeD.cjs} +2 -2
- package/dist/{ShopScreen-CcZC-9I-.cjs.map → ShopScreen-CfDJpaeD.cjs.map} +1 -1
- package/dist/ShopScreen-Dixl-47_.mjs +47 -0
- package/dist/{SpacerWidget-CYG_OOlN.mjs → SpacerWidget-BSK1d3yz.mjs} +2 -2
- package/dist/{SpacerWidget-CYG_OOlN.mjs.map → SpacerWidget-BSK1d3yz.mjs.map} +1 -1
- package/dist/{SubscriptionsScreen-CxXfngW6.mjs → SubscriptionsScreen-0_u-2cUx.mjs} +235 -35
- package/dist/SubscriptionsScreen-0_u-2cUx.mjs.map +1 -0
- package/dist/SubscriptionsScreen-8STRsoh2.mjs +48 -0
- package/dist/{SubscriptionsScreen-CUvV5IzE.cjs → SubscriptionsScreen-BNwDrJ2f.cjs} +4 -4
- package/dist/{SubscriptionsScreen-DhIabp7l.cjs → SubscriptionsScreen-nMZi49Kq.cjs} +234 -34
- package/dist/SubscriptionsScreen-nMZi49Kq.cjs.map +1 -0
- package/dist/{TableWidget-B3iZYt3e.mjs → TableWidget-D9o_Wf3P.mjs} +2 -2
- package/dist/{TableWidget-B3iZYt3e.mjs.map → TableWidget-D9o_Wf3P.mjs.map} +1 -1
- package/dist/{TextWidget-TkRUJ2s_.mjs → TextWidget-B8U3U6MT.mjs} +2 -2
- package/dist/{TextWidget-TkRUJ2s_.mjs.map → TextWidget-B8U3U6MT.mjs.map} +1 -1
- package/dist/{ToDoWidget-sPYwjaiM.mjs → ToDoWidget-G5jYFoWJ.mjs} +2 -2
- package/dist/{ToDoWidget-sPYwjaiM.mjs.map → ToDoWidget-G5jYFoWJ.mjs.map} +1 -1
- package/dist/{UpgradeScreen-Bk26KpcT.mjs → UpgradeScreen-C6l3mpnf.mjs} +2 -2
- package/dist/{UpgradeScreen-Bk26KpcT.mjs.map → UpgradeScreen-C6l3mpnf.mjs.map} +1 -1
- package/dist/{VideoWidget-Cg-MAH4X.mjs → VideoWidget-BBq_SW6C.mjs} +2 -2
- package/dist/{VideoWidget-Cg-MAH4X.mjs.map → VideoWidget-BBq_SW6C.mjs.map} +1 -1
- package/dist/{es-CaDFGDKY.mjs → es-8SY1mBcI.mjs} +2 -2
- package/dist/{es-CaDFGDKY.mjs.map → es-8SY1mBcI.mjs.map} +1 -1
- package/dist/index.cjs +22 -22
- package/dist/index.mjs +63 -63
- package/dist/{portal_tenant_content-CrltRlMW.cjs → portal_tenant_content-Cufl7LSv.cjs} +24 -1
- package/dist/portal_tenant_content-Cufl7LSv.cjs.map +1 -0
- package/dist/{portal_tenant_content-CRrn7i-P.mjs → portal_tenant_content-DKIMptZz.mjs} +19 -2
- package/dist/portal_tenant_content-DKIMptZz.mjs.map +1 -0
- package/dist/{use-account-GjZt_eis.mjs → use-account-Du7Mi_Pi.mjs} +2 -2
- package/dist/{use-account-GjZt_eis.mjs.map → use-account-Du7Mi_Pi.mjs.map} +1 -1
- package/dist/{use-account-CEjH1hp5.cjs → use-account-KSCVzEeP.cjs} +2 -2
- package/dist/{use-account-CEjH1hp5.cjs.map → use-account-KSCVzEeP.cjs.map} +1 -1
- package/package.json +14 -14
- package/dist/MessagingScreen-BAWob9Xh.mjs +0 -49
- package/dist/OrdersScreen-BvC2vAPI.mjs +0 -48
- package/dist/ProfileScreen-1eUj1pwW.mjs.map +0 -1
- package/dist/ProfileScreen-B4nb_OZG.mjs +0 -50
- package/dist/ProfileScreen-CCpujV84.cjs.map +0 -1
- package/dist/ShareablesScreen-QclWhq3D.cjs.map +0 -1
- package/dist/ShareablesScreen-yXCq_akC.mjs.map +0 -1
- package/dist/ShopScreen-D_XPdJVC.mjs +0 -49
- package/dist/SubscriptionsScreen-CaVTy07E.mjs +0 -50
- package/dist/SubscriptionsScreen-CxXfngW6.mjs.map +0 -1
- package/dist/SubscriptionsScreen-DhIabp7l.cjs.map +0 -1
- package/dist/portal_tenant_content-CRrn7i-P.mjs.map +0 -1
- package/dist/portal_tenant_content-CrltRlMW.cjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { at as subscriptions_reactivate, ct as
|
|
2
|
-
import { B as usePayApi, n as useFluidContext } from "./FluidProvider-
|
|
1
|
+
import { at as subscriptions_reactivate, ct as subscriptions_show, et as subscription_bundles_create, it as subscriptions_pause, lt as subscriptions_skip, nt as subscriptions_cancel, ot as subscriptions_resume, rt as subscriptions_list, st as subscriptions_retry, tt as subscription_bundles_list, ut as subscriptions_update } from "./portal_tenant_content-DKIMptZz.mjs";
|
|
2
|
+
import { B as usePayApi, n as useFluidContext } from "./FluidProvider-DcnRMRD4.mjs";
|
|
3
3
|
import { n as useCountriesApi } from "./countries-api-context-DScC_39w.mjs";
|
|
4
4
|
import { n as usePortalTenantClient } from "./PortalTenantClientProvider-_VXOs0t4.mjs";
|
|
5
5
|
import { n as useActiveLocale } from "./locale-context-DGCebJhw.mjs";
|
|
@@ -7,14 +7,14 @@ import { $t as startOfISOWeek, At as Calendar$1, Bt as getWeek, C as SelectConte
|
|
|
7
7
|
import { n as ScreenHeaderBreadcrumbs } from "./ScreenHeaderContext-C22wBIsP.mjs";
|
|
8
8
|
import { t as createTranslationContext } from "./translation-api-context-factory-BYNOdpnp.mjs";
|
|
9
9
|
import { n as payKeys, r as storeKeys } from "./query-keys-BkMRwfNo.mjs";
|
|
10
|
-
import { t as useAccount } from "./use-account-
|
|
10
|
+
import { t as useAccount } from "./use-account-Du7Mi_Pi.mjs";
|
|
11
11
|
import { n as useAppNavigation } from "./AppNavigationContext-DNomMUij.mjs";
|
|
12
12
|
import { n as createDomainTranslations, r as useDomainDict, t as createStaticDictAdapter } from "./static-dict-adapter-CGDunURa.mjs";
|
|
13
|
-
import { a as AddressFormDialog, c as PaymentIcon, f as ConfirmActionDialog, h as useProfileTranslation, i as CreditCardFormDialog, l as getCardDisplayName, m as ProfileTranslationBridge, n as createFluidPayApiAdapter, o as EditPaymentMethodDialog, p as EllipsesDropdown, r as mapToFluidPayPaymentMethod, s as FluidPayCoreProvider, t as AddressAutocompleteInput, u as getCardExpiry } from "./AddressAutocompleteInput-
|
|
13
|
+
import { a as AddressFormDialog, c as PaymentIcon, f as ConfirmActionDialog, h as useProfileTranslation, i as CreditCardFormDialog, l as getCardDisplayName, m as ProfileTranslationBridge, n as createFluidPayApiAdapter, o as EditPaymentMethodDialog, p as EllipsesDropdown, r as mapToFluidPayPaymentMethod, s as FluidPayCoreProvider, t as AddressAutocompleteInput, u as getCardExpiry } from "./AddressAutocompleteInput-QMNGouHg.mjs";
|
|
14
14
|
import { createContext, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
15
15
|
import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
16
16
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
-
import { AlertCircle, CalendarDays, CalendarIcon, Check, ChevronDown, ChevronLeft, ChevronRight, CreditCard, ImageOff, Minus, Package, Pause, Play, Plus, Repeat, RotateCcw, SkipForward, Truck, XCircle } from "lucide-react";
|
|
17
|
+
import { AlertCircle, BadgeAlert, Banknote, Calendar, CalendarClock, CalendarDays, CalendarIcon, Check, ChevronDown, ChevronLeft, ChevronRight, CircleDollarSign, CreditCard, DollarSign, ImageOff, Minus, Package, Pause, PiggyBank, Play, Plus, Receipt, RefreshCw, Repeat, RotateCcw, ShieldCheck, SkipForward, Sparkles, Truck, Wallet, X, XCircle } from "lucide-react";
|
|
18
18
|
import { clsx } from "clsx";
|
|
19
19
|
import { twMerge } from "tailwind-merge";
|
|
20
20
|
//#region ../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getDefaultOptions.js
|
|
@@ -2239,6 +2239,20 @@ function useReactivateSubscription(options) {
|
|
|
2239
2239
|
});
|
|
2240
2240
|
}
|
|
2241
2241
|
//#endregion
|
|
2242
|
+
//#region ../../subscriptions/core/src/hooks/use-retry-subscription.ts
|
|
2243
|
+
function useRetrySubscription(options) {
|
|
2244
|
+
const api = useSubscriptionsApi();
|
|
2245
|
+
const queryClient = useQueryClient();
|
|
2246
|
+
return useMutation({
|
|
2247
|
+
mutationFn: (params) => api.retrySubscription(params.subscriptionToken),
|
|
2248
|
+
onSuccess: () => {
|
|
2249
|
+
queryClient.invalidateQueries({ queryKey: subscriptionsKeys.all });
|
|
2250
|
+
options?.onSuccess?.();
|
|
2251
|
+
},
|
|
2252
|
+
onError: options?.onError
|
|
2253
|
+
});
|
|
2254
|
+
}
|
|
2255
|
+
//#endregion
|
|
2242
2256
|
//#region ../../subscriptions/core/src/hooks/use-update-subscription-info.ts
|
|
2243
2257
|
function useUpdateSubscriptionInfo(options) {
|
|
2244
2258
|
const api = useSubscriptionsApi();
|
|
@@ -2246,7 +2260,7 @@ function useUpdateSubscriptionInfo(options) {
|
|
|
2246
2260
|
return useMutation({
|
|
2247
2261
|
mutationFn: (params) => api.updateSubscriptionInfo(params.subscriptionToken, params.body),
|
|
2248
2262
|
onSuccess: () => {
|
|
2249
|
-
queryClient.invalidateQueries({ queryKey: subscriptionsKeys.all });
|
|
2263
|
+
if (!options?.skipAutoInvalidate) queryClient.invalidateQueries({ queryKey: subscriptionsKeys.all });
|
|
2250
2264
|
options?.onSuccess?.();
|
|
2251
2265
|
},
|
|
2252
2266
|
onError: options?.onError
|
|
@@ -2443,8 +2457,8 @@ function mapDetailSubscription(bff) {
|
|
|
2443
2457
|
last_ship_date: null,
|
|
2444
2458
|
disabled: false,
|
|
2445
2459
|
attempts: 0,
|
|
2446
|
-
last_failed_at: null,
|
|
2447
|
-
next_retry_at: null,
|
|
2460
|
+
last_failed_at: bff.last_failed_at ?? null,
|
|
2461
|
+
next_retry_at: bff.next_retry_at ?? null,
|
|
2448
2462
|
skipped_count: 0,
|
|
2449
2463
|
max_skips: null,
|
|
2450
2464
|
cancelled_at: null,
|
|
@@ -2726,6 +2740,9 @@ function createPortalSubscriptionsAdapter(client) {
|
|
|
2726
2740
|
reactivateSubscription: async (subscriptionToken, _params) => {
|
|
2727
2741
|
return mapSubscriptionDetail(await subscriptions_reactivate(client, subscriptionToken));
|
|
2728
2742
|
},
|
|
2743
|
+
retrySubscription: async (subscriptionToken) => {
|
|
2744
|
+
return mapSubscriptionDetail(await subscriptions_retry(client, subscriptionToken));
|
|
2745
|
+
},
|
|
2729
2746
|
updateSubscriptionInfo: async (subscriptionToken, body) => {
|
|
2730
2747
|
const subscription = {};
|
|
2731
2748
|
if (body.payment_method_id != null) subscription.payment_method_id = body.payment_method_id;
|
|
@@ -2836,6 +2853,7 @@ const subscriptionsDomain = createDomainTranslations({
|
|
|
2836
2853
|
your_upcoming_order: "Your Upcoming Order",
|
|
2837
2854
|
next_order_date: "Next Order Date",
|
|
2838
2855
|
next_bill_amount: "Next Bill Amount",
|
|
2856
|
+
payment_failed_on: "Payment failed on",
|
|
2839
2857
|
product_image_alt: "Product image",
|
|
2840
2858
|
no_image: "No image",
|
|
2841
2859
|
quantity_label: "Quantity",
|
|
@@ -2854,6 +2872,7 @@ const subscriptionsDomain = createDomainTranslations({
|
|
|
2854
2872
|
cancelled_subscription: "Cancelled Subscription",
|
|
2855
2873
|
resume_subscription: "Resume Subscription",
|
|
2856
2874
|
reactivate_subscription: "Reactivate Subscription",
|
|
2875
|
+
update_payment_method_action: "Update Payment Method",
|
|
2857
2876
|
skip_next: "Skip Next",
|
|
2858
2877
|
pause: "Pause",
|
|
2859
2878
|
cancel: "Cancel",
|
|
@@ -3019,7 +3038,19 @@ const subscriptionsDomain = createDomainTranslations({
|
|
|
3019
3038
|
bundle_step4_message: "💳 Last step — choose payment method",
|
|
3020
3039
|
bundle_succeeded: "Subscriptions bundled successfully.",
|
|
3021
3040
|
bundle_partial_payment_failure: "Bundle created but payment method failed for {{n}} subscription(s).",
|
|
3022
|
-
bundle_failed: "Couldn't bundle subscriptions. Please try again."
|
|
3041
|
+
bundle_failed: "Couldn't bundle subscriptions. Please try again.",
|
|
3042
|
+
past_due_banner_heading: "We couldn't process your payment",
|
|
3043
|
+
past_due_banner_heading_for_product: "We couldn't process your payment for {{product}}",
|
|
3044
|
+
past_due_banner_body: "Your payment method may have expired or been declined. Update your card to continue your subscription and avoid interruptions.",
|
|
3045
|
+
past_due_banner_heading_retry_scheduled: "Payment retry scheduled",
|
|
3046
|
+
past_due_banner_heading_retry_scheduled_for_product: "Payment retry scheduled for {{product}}",
|
|
3047
|
+
past_due_banner_body_retry_scheduled: "We're trying your payment again now. We'll update once it's processed.",
|
|
3048
|
+
past_due_banner_body_retry_failed: "The last retry didn't go through. We'll try again automatically {{when}}. You can also update your card to use a different one.",
|
|
3049
|
+
update_your_card: "Update your card",
|
|
3050
|
+
dismiss: "Dismiss",
|
|
3051
|
+
past_due_retry_when_shortly: "shortly",
|
|
3052
|
+
past_due_retry_when_few_hours: "in the next few hours",
|
|
3053
|
+
past_due_retry_when_within_day: "within a day"
|
|
3023
3054
|
},
|
|
3024
3055
|
loaders: {
|
|
3025
3056
|
de: () => import("./de-DZoIVvaZ.mjs").then((m) => m.default),
|
|
@@ -5418,6 +5449,121 @@ function StatusPill({ status, children }) {
|
|
|
5418
5449
|
});
|
|
5419
5450
|
}
|
|
5420
5451
|
//#endregion
|
|
5452
|
+
//#region ../../subscriptions/ui/src/components/past-due-banner.tsx
|
|
5453
|
+
const ICON_STROKE = 1.5;
|
|
5454
|
+
const ICON_SCALE = 26;
|
|
5455
|
+
const ICON_RIGHT_OFFSET = 23;
|
|
5456
|
+
const ICON_OPACITY = .35;
|
|
5457
|
+
const ICON_VERTICAL_SPACING = 26;
|
|
5458
|
+
const COL_SPACING = 18;
|
|
5459
|
+
const ICONS_BY_COLUMN = [
|
|
5460
|
+
{
|
|
5461
|
+
icons: [
|
|
5462
|
+
CreditCard,
|
|
5463
|
+
CircleDollarSign,
|
|
5464
|
+
BadgeAlert,
|
|
5465
|
+
CalendarClock,
|
|
5466
|
+
Sparkles,
|
|
5467
|
+
Wallet
|
|
5468
|
+
],
|
|
5469
|
+
offset: false
|
|
5470
|
+
},
|
|
5471
|
+
{
|
|
5472
|
+
icons: [
|
|
5473
|
+
DollarSign,
|
|
5474
|
+
Receipt,
|
|
5475
|
+
PiggyBank,
|
|
5476
|
+
ShieldCheck,
|
|
5477
|
+
CreditCard
|
|
5478
|
+
],
|
|
5479
|
+
offset: true
|
|
5480
|
+
},
|
|
5481
|
+
{
|
|
5482
|
+
icons: [
|
|
5483
|
+
Calendar,
|
|
5484
|
+
Banknote,
|
|
5485
|
+
RefreshCw,
|
|
5486
|
+
DollarSign,
|
|
5487
|
+
CircleDollarSign,
|
|
5488
|
+
Calendar
|
|
5489
|
+
],
|
|
5490
|
+
offset: false
|
|
5491
|
+
}
|
|
5492
|
+
];
|
|
5493
|
+
function PastDueBanner({ productTitle, nextRetryAt, lastFailedAt, onUpdatePaymentClick, onDismiss, className }) {
|
|
5494
|
+
const { t } = useSubscriptionsTranslation();
|
|
5495
|
+
const [internalDismissed, setInternalDismissed] = useState(false);
|
|
5496
|
+
const retryScheduled = nextRetryAt != null;
|
|
5497
|
+
const previousAttemptFailed = retryScheduled && lastFailedAt != null;
|
|
5498
|
+
if (!onDismiss && internalDismissed) return null;
|
|
5499
|
+
const heading = retryScheduled ? productTitle ? t("past_due_banner_heading_retry_scheduled_for_product", { product: productTitle }) : t("past_due_banner_heading_retry_scheduled") : productTitle ? t("past_due_banner_heading_for_product", { product: productTitle }) : t("past_due_banner_heading");
|
|
5500
|
+
const whenLabel = (() => {
|
|
5501
|
+
if (!nextRetryAt) return t("past_due_retry_when_shortly");
|
|
5502
|
+
const ms = new Date(nextRetryAt).getTime() - Date.now();
|
|
5503
|
+
if (ms < 6e4) return t("past_due_retry_when_shortly");
|
|
5504
|
+
if (ms < 720 * 60 * 1e3) return t("past_due_retry_when_few_hours");
|
|
5505
|
+
return t("past_due_retry_when_within_day");
|
|
5506
|
+
})();
|
|
5507
|
+
const body = previousAttemptFailed ? t("past_due_banner_body_retry_failed", { when: whenLabel }) : retryScheduled ? t("past_due_banner_body_retry_scheduled") : t("past_due_banner_body");
|
|
5508
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
5509
|
+
role: "status",
|
|
5510
|
+
className: cn("border-border bg-background relative overflow-hidden rounded-2xl border p-5 sm:p-6", className),
|
|
5511
|
+
children: [
|
|
5512
|
+
/* @__PURE__ */ jsx("button", {
|
|
5513
|
+
type: "button",
|
|
5514
|
+
onClick: () => onDismiss ? onDismiss() : setInternalDismissed(true),
|
|
5515
|
+
"aria-label": t("dismiss"),
|
|
5516
|
+
className: "text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-ring absolute top-3 right-3 z-10 flex size-6 items-center justify-center rounded-md transition-colors focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
5517
|
+
children: /* @__PURE__ */ jsx(X, {
|
|
5518
|
+
className: "size-4",
|
|
5519
|
+
strokeWidth: 2
|
|
5520
|
+
})
|
|
5521
|
+
}),
|
|
5522
|
+
/* @__PURE__ */ jsx("div", {
|
|
5523
|
+
"aria-hidden": true,
|
|
5524
|
+
className: "pointer-events-none absolute inset-y-0 right-0 hidden w-1/2 max-w-md sm:block",
|
|
5525
|
+
children: ICONS_BY_COLUMN.flatMap((col, colIdx) => {
|
|
5526
|
+
const right = `${ICON_RIGHT_OFFSET + colIdx * COL_SPACING}%`;
|
|
5527
|
+
const baseTop = -ICON_VERTICAL_SPACING * .4 + (col.offset ? ICON_VERTICAL_SPACING / 2 : 0);
|
|
5528
|
+
return col.icons.map((Icon, rowIdx) => {
|
|
5529
|
+
return /* @__PURE__ */ jsx(Icon, {
|
|
5530
|
+
strokeWidth: ICON_STROKE,
|
|
5531
|
+
className: "text-muted-foreground absolute",
|
|
5532
|
+
style: {
|
|
5533
|
+
top: `${baseTop + rowIdx * ICON_VERTICAL_SPACING}%`,
|
|
5534
|
+
right,
|
|
5535
|
+
width: ICON_SCALE,
|
|
5536
|
+
height: ICON_SCALE,
|
|
5537
|
+
opacity: ICON_OPACITY
|
|
5538
|
+
}
|
|
5539
|
+
}, `${colIdx.toString()}-${rowIdx.toString()}`);
|
|
5540
|
+
});
|
|
5541
|
+
})
|
|
5542
|
+
}),
|
|
5543
|
+
/* @__PURE__ */ jsxs("div", {
|
|
5544
|
+
className: "relative flex max-w-xl flex-col gap-3.5",
|
|
5545
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
5546
|
+
className: "flex flex-col gap-1.5",
|
|
5547
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
5548
|
+
className: "text-foreground text-base font-bold tracking-tight sm:text-lg",
|
|
5549
|
+
children: heading
|
|
5550
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
5551
|
+
className: "text-muted-foreground text-sm leading-relaxed",
|
|
5552
|
+
children: body
|
|
5553
|
+
})]
|
|
5554
|
+
}), onUpdatePaymentClick && /* @__PURE__ */ jsx(Button, {
|
|
5555
|
+
type: "button",
|
|
5556
|
+
variant: "destructive",
|
|
5557
|
+
size: "default",
|
|
5558
|
+
onClick: onUpdatePaymentClick,
|
|
5559
|
+
className: "self-start px-5 active:scale-[0.99]",
|
|
5560
|
+
children: t("update_your_card")
|
|
5561
|
+
})]
|
|
5562
|
+
})
|
|
5563
|
+
]
|
|
5564
|
+
});
|
|
5565
|
+
}
|
|
5566
|
+
//#endregion
|
|
5421
5567
|
//#region ../../subscriptions/ui/src/lib/format.ts
|
|
5422
5568
|
/**
|
|
5423
5569
|
* Format a number as currency (USD).
|
|
@@ -5629,11 +5775,11 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
5629
5775
|
children: [
|
|
5630
5776
|
/* @__PURE__ */ jsx("div", {
|
|
5631
5777
|
className: "text-muted-foreground mb-1 text-sm",
|
|
5632
|
-
children: t("next_order_date")
|
|
5778
|
+
children: subscription.status === "past_due" ? t("payment_failed_on") : t("next_order_date")
|
|
5633
5779
|
}),
|
|
5634
5780
|
/* @__PURE__ */ jsx("div", {
|
|
5635
5781
|
className: "text-foreground text-2xl font-bold",
|
|
5636
|
-
children: getNextBillDisplay(displayNextBillDate ? {
|
|
5782
|
+
children: subscription.status === "past_due" ? subscription.last_failed_at ? formatDate(subscription.last_failed_at) : "—" : getNextBillDisplay(displayNextBillDate ? {
|
|
5637
5783
|
...subscription,
|
|
5638
5784
|
next_bill_date: displayNextBillDate
|
|
5639
5785
|
} : subscription)
|
|
@@ -5650,13 +5796,20 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
5650
5796
|
]
|
|
5651
5797
|
}), /* @__PURE__ */ jsxs("div", {
|
|
5652
5798
|
className: "pl-4",
|
|
5653
|
-
children: [
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5799
|
+
children: [
|
|
5800
|
+
/* @__PURE__ */ jsx("div", {
|
|
5801
|
+
className: "text-muted-foreground mb-1 text-sm",
|
|
5802
|
+
children: t("next_bill_amount")
|
|
5803
|
+
}),
|
|
5804
|
+
/* @__PURE__ */ jsx("div", {
|
|
5805
|
+
className: "text-foreground text-2xl font-bold",
|
|
5806
|
+
children: formatCurrency(subscription.price * quantity)
|
|
5807
|
+
}),
|
|
5808
|
+
subscription.status !== "past_due" && (displayNextBillDate ?? subscription.next_bill_date) && /* @__PURE__ */ jsx("div", {
|
|
5809
|
+
className: "text-muted-foreground mt-1 text-xs",
|
|
5810
|
+
children: formatDate(displayNextBillDate ?? subscription.next_bill_date ?? "")
|
|
5811
|
+
})
|
|
5812
|
+
]
|
|
5660
5813
|
})]
|
|
5661
5814
|
}), /* @__PURE__ */ jsx("hr", { className: "border-border mt-4" })]
|
|
5662
5815
|
})]
|
|
@@ -5764,7 +5917,7 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
5764
5917
|
})
|
|
5765
5918
|
});
|
|
5766
5919
|
}
|
|
5767
|
-
function SubscriptionManagementSection({ subscription, isActive, isPaused, isCancelled, isMutating, onSkip, onPause, onResume, onCancel, onReactivate, onEditBillDate, displayNextBillDate, renderPaymentMethod, renderShippingAddress }) {
|
|
5920
|
+
function SubscriptionManagementSection({ subscription, isActive, isPaused, isCancelled, isMutating, onSkip, onPause, onResume, onCancel, onReactivate, onEditBillDate, onUpdatePaymentClick, displayNextBillDate, renderPaymentMethod, renderShippingAddress }) {
|
|
5768
5921
|
const { t } = useSubscriptionsTranslation();
|
|
5769
5922
|
const plan = subscription.subscription_plan;
|
|
5770
5923
|
const quantity = subscription.quantity;
|
|
@@ -5825,6 +5978,16 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
5825
5978
|
children: isCancelled ? t("cancelled_subscription") : t("cancel_subscription")
|
|
5826
5979
|
})]
|
|
5827
5980
|
}),
|
|
5981
|
+
subscription.status === "past_due" && onUpdatePaymentClick && /* @__PURE__ */ jsxs(Button, {
|
|
5982
|
+
variant: "outline",
|
|
5983
|
+
onClick: onUpdatePaymentClick,
|
|
5984
|
+
disabled: isMutating,
|
|
5985
|
+
className: actionButtonClass,
|
|
5986
|
+
children: [/* @__PURE__ */ jsx(CreditCard, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ jsx("span", {
|
|
5987
|
+
className: "truncate",
|
|
5988
|
+
children: t("update_payment_method_action")
|
|
5989
|
+
})]
|
|
5990
|
+
}),
|
|
5828
5991
|
isPaused && /* @__PURE__ */ jsxs(Button, {
|
|
5829
5992
|
variant: "outline",
|
|
5830
5993
|
onClick: onResume,
|
|
@@ -5883,7 +6046,7 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
5883
6046
|
className: "text-foreground font-medium",
|
|
5884
6047
|
children: totalPrice
|
|
5885
6048
|
}),
|
|
5886
|
-
(displayNextBillDate ?? subscription.next_bill_date) && /* @__PURE__ */ jsx("div", {
|
|
6049
|
+
subscription.status !== "past_due" && (displayNextBillDate ?? subscription.next_bill_date) && /* @__PURE__ */ jsx("div", {
|
|
5887
6050
|
className: "text-muted-foreground text-xs",
|
|
5888
6051
|
children: formatDate(displayNextBillDate ?? subscription.next_bill_date ?? "")
|
|
5889
6052
|
})
|
|
@@ -5936,13 +6099,18 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
5936
6099
|
subscription.address.country_code && /* @__PURE__ */ jsx("p", { children: subscription.address.country_code })
|
|
5937
6100
|
]
|
|
5938
6101
|
})]
|
|
5939
|
-
}), paymentMethod && (renderPaymentMethod ?
|
|
5940
|
-
|
|
5941
|
-
|
|
5942
|
-
|
|
5943
|
-
|
|
6102
|
+
}), paymentMethod && (renderPaymentMethod ? /* @__PURE__ */ jsx("div", {
|
|
6103
|
+
id: "subscription-payment-method-section",
|
|
6104
|
+
className: "scroll-mt-24",
|
|
6105
|
+
children: renderPaymentMethod({
|
|
6106
|
+
paymentMethod,
|
|
6107
|
+
subscriptionToken: subscription.subscription_token,
|
|
6108
|
+
customerId: subscription.customer?.id ?? 0,
|
|
6109
|
+
countryCode: subscription.address?.country_code ?? "US"
|
|
6110
|
+
})
|
|
5944
6111
|
}) : /* @__PURE__ */ jsxs("div", {
|
|
5945
|
-
|
|
6112
|
+
id: "subscription-payment-method-section",
|
|
6113
|
+
className: "border-border mb-6 scroll-mt-24 border-b pb-4",
|
|
5946
6114
|
children: [/* @__PURE__ */ jsx("div", {
|
|
5947
6115
|
className: "text-muted-foreground mb-1 text-sm",
|
|
5948
6116
|
children: t("payment_method")
|
|
@@ -6024,13 +6192,14 @@ function OrderHistorySection({ subscription }) {
|
|
|
6024
6192
|
})]
|
|
6025
6193
|
});
|
|
6026
6194
|
}
|
|
6027
|
-
function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationError, onNavigateToSubscription, renderPaymentMethod, renderShippingAddress }) {
|
|
6195
|
+
function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationError, onNavigateToSubscription, renderPaymentMethod, renderShippingAddress, onUpdatePaymentClick }) {
|
|
6028
6196
|
const { t } = useSubscriptionsTranslation();
|
|
6029
6197
|
const [showCancelModal, setShowCancelModal] = useState(false);
|
|
6030
6198
|
const [showPauseModal, setShowPauseModal] = useState(false);
|
|
6031
6199
|
const [showResumeModal, setShowResumeModal] = useState(false);
|
|
6032
6200
|
const [showEditBillDateModal, setShowEditBillDateModal] = useState(false);
|
|
6033
6201
|
const [pendingNextBillDate, setPendingNextBillDate] = useState(null);
|
|
6202
|
+
const [dismissedForFailedAt, setDismissedForFailedAt] = useState(void 0);
|
|
6034
6203
|
const { data, isLoading, error } = useSubscription(token);
|
|
6035
6204
|
const subscription = data?.subscription;
|
|
6036
6205
|
const customerId = subscription?.customer?.id ?? 0;
|
|
@@ -6181,7 +6350,24 @@ function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationE
|
|
|
6181
6350
|
reactivateParams: {}
|
|
6182
6351
|
});
|
|
6183
6352
|
};
|
|
6353
|
+
const bannerDismissed = dismissedForFailedAt !== void 0 && dismissedForFailedAt === subscription.last_failed_at;
|
|
6184
6354
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
6355
|
+
subscription.status === "past_due" && !bannerDismissed && /* @__PURE__ */ jsx("div", {
|
|
6356
|
+
className: "mb-4 px-2 sm:px-0 lg:mb-6",
|
|
6357
|
+
children: /* @__PURE__ */ jsx(PastDueBanner, {
|
|
6358
|
+
productTitle: subscription.variant?.product?.title ?? null,
|
|
6359
|
+
nextRetryAt: subscription.next_retry_at ?? null,
|
|
6360
|
+
lastFailedAt: subscription.last_failed_at ?? null,
|
|
6361
|
+
onUpdatePaymentClick: onUpdatePaymentClick ?? (() => {
|
|
6362
|
+
const el = document.getElementById("subscription-payment-method-section");
|
|
6363
|
+
if (el) el.scrollIntoView({
|
|
6364
|
+
behavior: "smooth",
|
|
6365
|
+
block: "start"
|
|
6366
|
+
});
|
|
6367
|
+
}),
|
|
6368
|
+
onDismiss: () => setDismissedForFailedAt(subscription.last_failed_at ?? null)
|
|
6369
|
+
})
|
|
6370
|
+
}),
|
|
6185
6371
|
/* @__PURE__ */ jsxs("div", {
|
|
6186
6372
|
className: "flex flex-col lg:grid lg:grid-cols-8",
|
|
6187
6373
|
children: [/* @__PURE__ */ jsx(SubscriptionItemsSection, {
|
|
@@ -6203,6 +6389,7 @@ function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationE
|
|
|
6203
6389
|
onCancel: () => setShowCancelModal(true),
|
|
6204
6390
|
onReactivate: handleReactivate,
|
|
6205
6391
|
onEditBillDate: () => setShowEditBillDateModal(true),
|
|
6392
|
+
onUpdatePaymentClick,
|
|
6206
6393
|
displayNextBillDate: pendingNextBillDate ?? void 0,
|
|
6207
6394
|
renderPaymentMethod,
|
|
6208
6395
|
renderShippingAddress
|
|
@@ -6271,7 +6458,7 @@ function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationE
|
|
|
6271
6458
|
}
|
|
6272
6459
|
//#endregion
|
|
6273
6460
|
//#region ../../subscriptions/ui/src/screens/SubscriptionDetailScreen.tsx
|
|
6274
|
-
function SubscriptionDetailScreen$1({ token, onNavigateToList, onNavigateToSubscription, onNotFound, onError, onSuccess, onMutationError, renderPaymentMethod, renderShippingAddress }) {
|
|
6461
|
+
function SubscriptionDetailScreen$1({ token, onNavigateToList, onNavigateToSubscription, onNotFound, onError, onSuccess, onMutationError, renderPaymentMethod, renderShippingAddress, onUpdatePaymentClick }) {
|
|
6275
6462
|
const { t } = useSubscriptionsTranslation();
|
|
6276
6463
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ScreenHeaderBreadcrumbs, { children: /* @__PURE__ */ jsx(Breadcrumb, { children: /* @__PURE__ */ jsxs(BreadcrumbList, {
|
|
6277
6464
|
className: "text-lg",
|
|
@@ -6300,7 +6487,8 @@ function SubscriptionDetailScreen$1({ token, onNavigateToList, onNavigateToSubsc
|
|
|
6300
6487
|
onMutationError,
|
|
6301
6488
|
onNavigateToSubscription,
|
|
6302
6489
|
renderPaymentMethod,
|
|
6303
|
-
renderShippingAddress
|
|
6490
|
+
renderShippingAddress,
|
|
6491
|
+
onUpdatePaymentClick
|
|
6304
6492
|
})
|
|
6305
6493
|
})] });
|
|
6306
6494
|
}
|
|
@@ -6470,14 +6658,19 @@ function subscriptionPaymentMethodToFluidPay(raw) {
|
|
|
6470
6658
|
function PortalSubscriptionPaymentMethodSection(props) {
|
|
6471
6659
|
return /* @__PURE__ */ jsx(ProfileTranslationBridge, { children: /* @__PURE__ */ jsx(PortalSubscriptionPaymentMethodSectionInner, { ...props }) });
|
|
6472
6660
|
}
|
|
6473
|
-
function PortalSubscriptionPaymentMethodSectionInner({ paymentMethod: currentPaymentMethod, subscriptionToken, onSuccess, onError }) {
|
|
6661
|
+
function PortalSubscriptionPaymentMethodSectionInner({ paymentMethod: currentPaymentMethod, subscriptionToken, onSuccess, onError, addDialogOpen, onAddDialogOpenChange }) {
|
|
6474
6662
|
const { t: profileT } = useProfileTranslation();
|
|
6475
6663
|
const { t: subsT } = useSubscriptionsTranslation();
|
|
6476
6664
|
const tFn = useCallback((key) => profileT(key), [profileT]);
|
|
6477
6665
|
const payApi = usePayApi();
|
|
6478
6666
|
const queryClient = useQueryClient();
|
|
6479
6667
|
const fluidPayShim = useMemo(() => createFluidPayApiAdapter(payApi), [payApi]);
|
|
6480
|
-
const [
|
|
6668
|
+
const [internalAddDialogOpen, setInternalAddDialogOpen] = useState(false);
|
|
6669
|
+
const isAddDialogOpen = addDialogOpen ?? internalAddDialogOpen;
|
|
6670
|
+
const setIsAddDialogOpen = (next) => {
|
|
6671
|
+
if (onAddDialogOpenChange) onAddDialogOpenChange(next);
|
|
6672
|
+
else setInternalAddDialogOpen(next);
|
|
6673
|
+
};
|
|
6481
6674
|
const [editingPaymentMethod, setEditingPaymentMethod] = useState(null);
|
|
6482
6675
|
const [deletingPaymentMethod, setDeletingPaymentMethod] = useState(null);
|
|
6483
6676
|
const [deleteError, setDeleteError] = useState(void 0);
|
|
@@ -6504,10 +6697,13 @@ function PortalSubscriptionPaymentMethodSectionInner({ paymentMethod: currentPay
|
|
|
6504
6697
|
iso: c.code,
|
|
6505
6698
|
name: c.name
|
|
6506
6699
|
})).sort((a, b) => a.name.localeCompare(b.name)), [countriesData]);
|
|
6700
|
+
const retrySubscription = useRetrySubscription({ onError: (err) => onError?.("Failed to queue retry", err) });
|
|
6507
6701
|
const updateSubscription = useUpdateSubscriptionInfo({
|
|
6702
|
+
skipAutoInvalidate: true,
|
|
6508
6703
|
onSuccess: () => {
|
|
6509
6704
|
onSuccess?.(profileT("default_payment_method_updated"));
|
|
6510
|
-
queryClient.
|
|
6705
|
+
if (queryClient.getQueryData(subscriptionsKeys.detail(subscriptionToken))?.subscription?.status === "past_due") retrySubscription.mutate({ subscriptionToken });
|
|
6706
|
+
else queryClient.invalidateQueries({ queryKey: subscriptionsKeys.detail(subscriptionToken) });
|
|
6511
6707
|
},
|
|
6512
6708
|
onError: (err) => onError?.(profileT("failed_to_update_payment_method"), err)
|
|
6513
6709
|
});
|
|
@@ -6612,7 +6808,7 @@ function PortalSubscriptionPaymentMethodSectionInner({ paymentMethod: currentPay
|
|
|
6612
6808
|
addPaymentMethodLabel: profileT("add_payment_method_action"),
|
|
6613
6809
|
showAddButton: true,
|
|
6614
6810
|
isLoading: isLoadingMethods,
|
|
6615
|
-
isPending: updateSubscription.isPending || addCardMutation.isPending || updatePaymentMethodMutation.isPending || makeDefaultPaymentMethodMutation.isPending,
|
|
6811
|
+
isPending: updateSubscription.isPending || retrySubscription.isPending || addCardMutation.isPending || updatePaymentMethodMutation.isPending || makeDefaultPaymentMethodMutation.isPending,
|
|
6616
6812
|
selectedPaymentMethodId: currentPaymentMethod.id,
|
|
6617
6813
|
onSelectPaymentMethod: (pm) => {
|
|
6618
6814
|
if (pm.id === currentPaymentMethod.id) return;
|
|
@@ -7067,6 +7263,7 @@ function PortalSubscriptionShippingAddressSectionInner({ address: currentAddress
|
|
|
7067
7263
|
function SubscriptionDetailScreen({ token, onToast }) {
|
|
7068
7264
|
const { navigate } = useAppNavigation();
|
|
7069
7265
|
const { t } = useSubscriptionsTranslation();
|
|
7266
|
+
const [addPaymentDialogOpen, setAddPaymentDialogOpen] = useState(false);
|
|
7070
7267
|
return /* @__PURE__ */ jsx(SubscriptionDetailScreen$1, {
|
|
7071
7268
|
token,
|
|
7072
7269
|
onNavigateToList: useCallback(() => navigate("subscriptions"), [navigate]),
|
|
@@ -7088,12 +7285,15 @@ function SubscriptionDetailScreen({ token, onToast }) {
|
|
|
7088
7285
|
onMutationError: useCallback((message, err) => {
|
|
7089
7286
|
onToast(`${message}: ${err instanceof Error ? err.message : t("error_occurred")}`, "error");
|
|
7090
7287
|
}, [onToast, t]),
|
|
7288
|
+
onUpdatePaymentClick: () => setAddPaymentDialogOpen(true),
|
|
7091
7289
|
renderPaymentMethod: (ctx) => /* @__PURE__ */ jsx(PortalSubscriptionPaymentMethodSection, {
|
|
7092
7290
|
...ctx,
|
|
7093
7291
|
onSuccess: (msg) => onToast(msg, "success"),
|
|
7094
7292
|
onError: (msg, err) => {
|
|
7095
7293
|
onToast(`${msg}: ${err instanceof Error ? err.message : t("error_occurred")}`, "error");
|
|
7096
|
-
}
|
|
7294
|
+
},
|
|
7295
|
+
addDialogOpen: addPaymentDialogOpen,
|
|
7296
|
+
onAddDialogOpenChange: setAddPaymentDialogOpen
|
|
7097
7297
|
}),
|
|
7098
7298
|
renderShippingAddress: (ctx) => /* @__PURE__ */ jsx(PortalSubscriptionShippingAddressSection, {
|
|
7099
7299
|
...ctx,
|
|
@@ -7144,4 +7344,4 @@ const subscriptionsScreenPropertySchema = {
|
|
|
7144
7344
|
//#endregion
|
|
7145
7345
|
export { subscriptionsScreenPropertySchema as n, SubscriptionsScreen as t };
|
|
7146
7346
|
|
|
7147
|
-
//# sourceMappingURL=SubscriptionsScreen-
|
|
7347
|
+
//# sourceMappingURL=SubscriptionsScreen-0_u-2cUx.mjs.map
|