@fluid-app/portal-sdk 0.1.521 → 0.1.523
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/{FluidProvider-1RcvRveh.cjs → FluidProvider-Ch_tyk-O.cjs} +3 -2
- package/dist/{FluidProvider-1RcvRveh.cjs.map → FluidProvider-Ch_tyk-O.cjs.map} +1 -1
- package/dist/{FluidProvider-D4NciHuM.mjs → FluidProvider-xCT9m0AV.mjs} +3 -2
- package/dist/{FluidProvider-D4NciHuM.mjs.map → FluidProvider-xCT9m0AV.mjs.map} +1 -1
- package/dist/{MessagingScreen-D3rPEhKs.mjs → MessagingScreen-BLeMJBlZ.mjs} +3 -3
- package/dist/{MessagingScreen-D8KHP1Ve.cjs → MessagingScreen-CsXm0cqp.cjs} +2 -2
- package/dist/{MessagingScreen-D8KHP1Ve.cjs.map → MessagingScreen-CsXm0cqp.cjs.map} +1 -1
- package/dist/{MessagingScreen-CODydTyP.mjs → MessagingScreen-Cx1HMX4z.mjs} +2 -2
- package/dist/{MessagingScreen-CODydTyP.mjs.map → MessagingScreen-Cx1HMX4z.mjs.map} +1 -1
- package/dist/{MessagingScreen-C4ODci0C.cjs → MessagingScreen-jDXAQrjW.cjs} +3 -3
- package/dist/{OrdersScreen-DLWgsnr_.mjs → OrdersScreen-C2qOTfFC.mjs} +3 -3
- package/dist/{OrdersScreen-DLWgsnr_.mjs.map → OrdersScreen-C2qOTfFC.mjs.map} +1 -1
- package/dist/{OrdersScreen-BVyouyIY.cjs → OrdersScreen-DR_Aiyui.cjs} +3 -3
- package/dist/{OrdersScreen-BVyouyIY.cjs.map → OrdersScreen-DR_Aiyui.cjs.map} +1 -1
- package/dist/{OrdersScreen-wMSTv3GN.mjs → OrdersScreen-DXDqL5ec.mjs} +3 -3
- package/dist/{OrdersScreen-DcwIkATf.cjs → OrdersScreen-RdIKrkWk.cjs} +3 -3
- package/dist/{ProfileScreen-D3eX2UyZ.mjs → ProfileScreen-5xAu0suR.mjs} +3 -3
- package/dist/{ProfileScreen-D3eX2UyZ.mjs.map → ProfileScreen-5xAu0suR.mjs.map} +1 -1
- package/dist/{ProfileScreen-D_dXM5FI.mjs → ProfileScreen-C5i0U4Cg.mjs} +4 -4
- package/dist/{ProfileScreen-B8xddobu.cjs → ProfileScreen-CVjKS2Tx.cjs} +3 -3
- package/dist/{ProfileScreen-B8xddobu.cjs.map → ProfileScreen-CVjKS2Tx.cjs.map} +1 -1
- package/dist/{ProfileScreen-BHDUQ45N.cjs → ProfileScreen-Ct1eY-TI.cjs} +4 -4
- package/dist/{SubscriptionsScreen-Dm_1xjOv.cjs → SubscriptionsScreen-BXBojuLi.cjs} +4 -4
- package/dist/{SubscriptionsScreen-Bm9yALAj.mjs → SubscriptionsScreen-C_Wt4-wY.mjs} +107 -43
- package/dist/SubscriptionsScreen-C_Wt4-wY.mjs.map +1 -0
- package/dist/{SubscriptionsScreen-m4rM6RFP.mjs → SubscriptionsScreen-CqLyS0HD.mjs} +4 -4
- package/dist/{SubscriptionsScreen-pod3ogsE.cjs → SubscriptionsScreen-DCDoF2c3.cjs} +107 -43
- package/dist/SubscriptionsScreen-DCDoF2c3.cjs.map +1 -0
- package/dist/build-widget-registry-C4vaFR1S.d.mts.map +1 -1
- package/dist/build-widget-registry-C7BPrtGS.d.cts.map +1 -1
- package/dist/{build-widget-registry-EXxP6gv1.mjs → build-widget-registry-DgPaypsV.mjs} +2 -1
- package/dist/{build-widget-registry-EXxP6gv1.mjs.map → build-widget-registry-DgPaypsV.mjs.map} +1 -1
- package/dist/{build-widget-registry-By1GKqAd.cjs → build-widget-registry-iHNtigmM.cjs} +2 -1
- package/dist/{build-widget-registry-By1GKqAd.cjs.map → build-widget-registry-iHNtigmM.cjs.map} +1 -1
- package/dist/index.cjs +17 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +18 -16
- package/dist/index.mjs.map +1 -1
- package/dist/styles/remote-widget-shadow.css +2 -2
- package/dist/{use-portal-card-add-3ds-flow-CjQi2W_2.cjs → use-portal-card-add-3ds-flow-BK7rp-NL.cjs} +3 -3
- package/dist/{use-portal-card-add-3ds-flow-CjQi2W_2.cjs.map → use-portal-card-add-3ds-flow-BK7rp-NL.cjs.map} +1 -1
- package/dist/{use-portal-card-add-3ds-flow-B3pU5kcB.mjs → use-portal-card-add-3ds-flow-DEPhZhOv.mjs} +3 -3
- package/dist/{use-portal-card-add-3ds-flow-B3pU5kcB.mjs.map → use-portal-card-add-3ds-flow-DEPhZhOv.mjs.map} +1 -1
- package/dist/utils/build-remote-widget-plugin-manifests.cjs +1 -1
- package/dist/utils/build-remote-widget-plugin-manifests.mjs +1 -1
- package/dist/utils/build-widget-registry.cjs +1 -1
- package/dist/utils/build-widget-registry.mjs +1 -1
- package/package.json +13 -13
- package/dist/SubscriptionsScreen-Bm9yALAj.mjs.map +0 -1
- package/dist/SubscriptionsScreen-pod3ogsE.cjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { $t as addYears, Bt as isAfter, C as SheetTitle, D as SelectItem, E as SelectContent, G as DropdownMenuContent, Gt as longFormatters, H as Label, Ht as isProtectedDayOfYearToken, It as Calendar$1, Jt as getISOWeek, K as DropdownMenuItem, Kt as getWeek, Ln as PortalContainerProvider, N as Input, O as SelectTrigger, T as Select, Tn as Button, U as DropdownMenu, Ut as isProtectedWeekYearToken, Vt as format, Wt as warnOrThrowProtectedError, Yt as enUS, _ as Skeleton, _n as BreadcrumbLink, an as startOfISOWeek, at as DialogFooter, bn as BreadcrumbSeparator, cn as addMonths, d as Switch, dn as constructFrom, dt as Popover, en as addWeeks, et as DropdownMenuTrigger, fn as millisecondsInHour, ft as PopoverContent, gn as BreadcrumbItem, hn as Breadcrumb, in as getTimezoneOffsetInMilliseconds, it as DialogDescription, k as SelectValue, ln as addDays, lt as DialogTitle, m as fluidToast, mn as millisecondsInSecond, on as startOfWeek, ot as DialogHeader, pn as millisecondsInMinute, pt as PopoverTrigger, qt as getWeekYear, rt as DialogContent, sn as getDefaultOptions$1, tt as Dialog, un as toDate, v as Sheet, vn as BreadcrumbList, xn as Badge, y as SheetContent, yn as BreadcrumbPage, zn as cn$1 } from "./src-BfINy9nC.mjs";
|
|
2
|
-
import { A as isCardPaymentDescriptor, B as normalizeCardBrand, Ct as usePayApi, I as resolvePaymentMethodDisplay, N as normalizePaymentDescriptor, P as paymentDescriptorLabel, z as getPaymentBrandName } from "./build-widget-registry-
|
|
2
|
+
import { A as isCardPaymentDescriptor, B as normalizeCardBrand, Ct as usePayApi, I as resolvePaymentMethodDisplay, N as normalizePaymentDescriptor, P as paymentDescriptorLabel, z as getPaymentBrandName } from "./build-widget-registry-DgPaypsV.mjs";
|
|
3
3
|
import { i as useOptionalStore } from "./use-optional-store-DpB_jK4Q.mjs";
|
|
4
4
|
import { r as useCountriesApi } from "./Combobox-D8ukt9Tb.mjs";
|
|
5
|
-
import { c as createSubscriptionsTranslationAdapter, l as subscriptionsDomain } from "./FluidProvider-
|
|
5
|
+
import { c as createSubscriptionsTranslationAdapter, l as subscriptionsDomain } from "./FluidProvider-xCT9m0AV.mjs";
|
|
6
6
|
import { i as toApiErrorBody, r as isApiError } from "./fetch-client-VuLKnuMk.mjs";
|
|
7
7
|
import { i as useFluidContext } from "./ContactsTranslationBridge-7hUvizHe.mjs";
|
|
8
8
|
import { $ as subscriptionsCancel, Q as subscriptionBundlesList, T as usePortalTenantClient, Z as subscriptionBundlesCreate, at as subscriptionsResume, ct as subscriptionsSkip, et as subscriptionsFailedCycleWaiverCreate, it as subscriptionsReactivate, lt as subscriptionsUpdate, nt as subscriptionsList, ot as subscriptionsRetry, rt as subscriptionsPause, st as subscriptionsShow, tt as subscriptionsFailedCycleWaiverPreview } from "./prop-types-CwLyDfek.mjs";
|
|
@@ -16,7 +16,7 @@ import { n as useAppNavigation } from "./AppNavigationContext-PCbmG3nH.mjs";
|
|
|
16
16
|
import { t as useStore } from "./use-store-BdJfR_s4.mjs";
|
|
17
17
|
import { p as useSidebar, r as SidebarContext } from "./sidebar-CQpJWKMc.mjs";
|
|
18
18
|
import { n as ScreenHeaderBreadcrumbs } from "./ScreenHeaderContext-DahYFA_m.mjs";
|
|
19
|
-
import { _ as ProfileTranslationBridge, a as getBrowserInfo, c as EditPaymentMethodDialog, d as getCardDisplayName, f as getCardExpiry, g as EllipsesDropdown, h as ConfirmActionDialog, i as isThreeDsRequiredCreate, l as FluidPayCoreProvider, n as createFluidPayApiAdapter, o as CreditCardFormDialog, p as getPaymentMethodLogoBrand, r as mapToFluidPayPaymentMethod, s as AddressFormDialog, t as usePortalCardAdd3DSFlow, u as PaymentIcon, v as useProfileTranslation } from "./use-portal-card-add-3ds-flow-
|
|
19
|
+
import { _ as ProfileTranslationBridge, a as getBrowserInfo, c as EditPaymentMethodDialog, d as getCardDisplayName, f as getCardExpiry, g as EllipsesDropdown, h as ConfirmActionDialog, i as isThreeDsRequiredCreate, l as FluidPayCoreProvider, n as createFluidPayApiAdapter, o as CreditCardFormDialog, p as getPaymentMethodLogoBrand, r as mapToFluidPayPaymentMethod, s as AddressFormDialog, t as usePortalCardAdd3DSFlow, u as PaymentIcon, v as useProfileTranslation } from "./use-portal-card-add-3ds-flow-DEPhZhOv.mjs";
|
|
20
20
|
import { createContext, use, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
21
21
|
import { useInfiniteQuery, useIsFetching, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
22
22
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -8587,14 +8587,22 @@ function useUpdateAutoApplyPoints({ queryKeys, currentSubscriptionToken, onSucce
|
|
|
8587
8587
|
* this component renders: the host owns the surrounding layout, so it has to
|
|
8588
8588
|
* know whether to draw the frame rather than leaving an empty one behind.
|
|
8589
8589
|
*
|
|
8590
|
-
*
|
|
8591
|
-
*
|
|
8592
|
-
*
|
|
8590
|
+
* Two ways a control cannot act, and both hide it:
|
|
8591
|
+
*
|
|
8592
|
+
* - An absent `pointsEnabled` counts as off rather than on. The field is
|
|
8593
|
+
* additive, so an older payload, or a read path that quietly drops it, must
|
|
8594
|
+
* hide a setting that could not act instead of offering it.
|
|
8595
|
+
* - A payload with no renewal bundle can only be written through the host's
|
|
8596
|
+
* fallback writer, because the bundle-aware port needs a scope and both
|
|
8597
|
+
* token arrays and such a server sends neither. A host that supplies no
|
|
8598
|
+
* fallback writer therefore has no way to honour a toggle, so offering one
|
|
8599
|
+
* would take a customer's choice and drop it.
|
|
8593
8600
|
*
|
|
8594
8601
|
* Returns true when the control should render.
|
|
8595
8602
|
*/
|
|
8596
|
-
function autoApplyPointsControlVisible(
|
|
8597
|
-
|
|
8603
|
+
function autoApplyPointsControlVisible(input) {
|
|
8604
|
+
if (input.pointsEnabled !== true) return false;
|
|
8605
|
+
return input.renewalBundle != null || input.hasFallbackWrite;
|
|
8598
8606
|
}
|
|
8599
8607
|
/**
|
|
8600
8608
|
* Resolve what the auto-apply-points switch shows, from server state alone.
|
|
@@ -8613,7 +8621,11 @@ function autoApplyPointsControlVisible(pointsEnabled) {
|
|
|
8613
8621
|
*/
|
|
8614
8622
|
function autoApplyPointsControlState(input) {
|
|
8615
8623
|
return {
|
|
8616
|
-
visible: autoApplyPointsControlVisible(
|
|
8624
|
+
visible: autoApplyPointsControlVisible({
|
|
8625
|
+
pointsEnabled: input.pointsEnabled,
|
|
8626
|
+
renewalBundle: input.renewalBundle,
|
|
8627
|
+
hasFallbackWrite: input.hasFallbackWrite
|
|
8628
|
+
}),
|
|
8617
8629
|
checked: input.autoApplyPoints === true,
|
|
8618
8630
|
disabled: input.subscriptionDisabled || input.writeInFlight
|
|
8619
8631
|
};
|
|
@@ -8653,6 +8665,32 @@ function autoApplyPointsMembershipDrifted(input) {
|
|
|
8653
8665
|
const expected = input.confirmedScope === "bundle" ? input.renderedTokens : [input.targetToken];
|
|
8654
8666
|
return [...input.resolvedTokens].sort().join("\0") !== [...expected].sort().join("\0");
|
|
8655
8667
|
}
|
|
8668
|
+
/**
|
|
8669
|
+
* Whether choosing "just this one" would leave the renewal group disagreeing.
|
|
8670
|
+
*
|
|
8671
|
+
* The consequence copy in the fan-out dialog is asserted to a customer, so it
|
|
8672
|
+
* is rendered only when it is true of the choice in front of them. Three ways
|
|
8673
|
+
* this goes wrong if derived loosely:
|
|
8674
|
+
*
|
|
8675
|
+
* - A single-record change can REUNIFY a mixed group rather than split it.
|
|
8676
|
+
* The target being the only opted-out member of an otherwise opted-in
|
|
8677
|
+
* bundle is the case: turning it on leaves every member agreeing, so
|
|
8678
|
+
* claiming a split there describes the opposite of what happens (AC-21).
|
|
8679
|
+
* - `auto_apply_points_state` alone cannot answer it. A "mixed" bundle can
|
|
8680
|
+
* end up unanimous and an "all" bundle can end up mixed, and which one
|
|
8681
|
+
* depends on the value being written and on which member is the target.
|
|
8682
|
+
* - A bundle-scoped write moves every member to the same value, so it can
|
|
8683
|
+
* never partition the group.
|
|
8684
|
+
*
|
|
8685
|
+
* Returns true when the members would hold different values afterwards.
|
|
8686
|
+
*/
|
|
8687
|
+
function autoApplyPointsSplitsRenewal(input) {
|
|
8688
|
+
if (input.scope === "bundle") return false;
|
|
8689
|
+
const members = input.renewalBundle?.members ?? [];
|
|
8690
|
+
if (members.length < 2) return false;
|
|
8691
|
+
const after = members.map((member) => member.subscription_token === input.targetToken ? input.nextValue : member.auto_apply_points);
|
|
8692
|
+
return after.some((value) => value !== after[0]);
|
|
8693
|
+
}
|
|
8656
8694
|
//#endregion
|
|
8657
8695
|
//#region ../../subscriptions/ui/src/components/AutoApplyPointsFanOutDialog.tsx
|
|
8658
8696
|
/**
|
|
@@ -8665,8 +8703,14 @@ function autoApplyPointsMembershipDrifted(input) {
|
|
|
8665
8703
|
* this gets a focus trap, escape-to-close and backdrop dismissal for free
|
|
8666
8704
|
* rather than reimplementing dialog semantics by hand.
|
|
8667
8705
|
*/
|
|
8668
|
-
function AutoApplyPointsFanOutDialog({ bundle, pointsLabel, nextValue, presentation = "dialog", onConfirmAll, onConfirmOne, onCancel }) {
|
|
8706
|
+
function AutoApplyPointsFanOutDialog({ bundle, pointsLabel, targetToken, nextValue, presentation = "dialog", onConfirmAll, onConfirmOne, onCancel }) {
|
|
8669
8707
|
const { t } = useSubscriptionsTranslation();
|
|
8708
|
+
const wouldSplit = autoApplyPointsSplitsRenewal({
|
|
8709
|
+
renewalBundle: bundle,
|
|
8710
|
+
targetToken,
|
|
8711
|
+
nextValue,
|
|
8712
|
+
scope: "subscription"
|
|
8713
|
+
});
|
|
8670
8714
|
return /* @__PURE__ */ jsxs(ResponsiveDialog, {
|
|
8671
8715
|
open: true,
|
|
8672
8716
|
onOpenChange: (next) => {
|
|
@@ -8675,32 +8719,39 @@ function AutoApplyPointsFanOutDialog({ bundle, pointsLabel, nextValue, presentat
|
|
|
8675
8719
|
title: t(nextValue ? "auto_apply_points_bundle_title" : "auto_apply_points_bundle_title_off", { label: pointsLabel }),
|
|
8676
8720
|
description: t("auto_apply_points_bundle_body"),
|
|
8677
8721
|
presentation,
|
|
8678
|
-
children: [
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8682
|
-
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
/* @__PURE__ */ jsx(Button, {
|
|
8686
|
-
type: "button",
|
|
8687
|
-
className: "bg-muted text-foreground ring-border hover:bg-muted/80 h-10 min-w-[70px] rounded p-3 ring-1",
|
|
8688
|
-
onClick: onCancel,
|
|
8689
|
-
children: t("auto_apply_points_bundle_cancel")
|
|
8690
|
-
}),
|
|
8691
|
-
/* @__PURE__ */ jsx(Button, {
|
|
8692
|
-
type: "button",
|
|
8693
|
-
className: "bg-muted text-foreground ring-border hover:bg-muted/80 h-10 min-w-[70px] rounded p-3 ring-1",
|
|
8694
|
-
onClick: onConfirmOne,
|
|
8695
|
-
children: t("auto_apply_points_bundle_confirm_one")
|
|
8722
|
+
children: [
|
|
8723
|
+
/* @__PURE__ */ jsx("ul", {
|
|
8724
|
+
className: "space-y-1 text-sm",
|
|
8725
|
+
children: bundle.members.map((bundleMember) => /* @__PURE__ */ jsx("li", {
|
|
8726
|
+
className: "text-foreground",
|
|
8727
|
+
children: bundleMember.status === "paused" ? t("auto_apply_points_bundle_member_paused", { name: bundleMember.label }) : bundleMember.label
|
|
8728
|
+
}, bundleMember.subscription_token))
|
|
8696
8729
|
}),
|
|
8697
|
-
/* @__PURE__ */ jsx(
|
|
8698
|
-
|
|
8699
|
-
|
|
8700
|
-
|
|
8701
|
-
|
|
8702
|
-
|
|
8703
|
-
|
|
8730
|
+
wouldSplit ? /* @__PURE__ */ jsx("p", {
|
|
8731
|
+
className: "text-muted-foreground mt-3 text-sm",
|
|
8732
|
+
children: t("auto_apply_points_bundle_split_warning")
|
|
8733
|
+
}) : null,
|
|
8734
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [
|
|
8735
|
+
/* @__PURE__ */ jsx(Button, {
|
|
8736
|
+
type: "button",
|
|
8737
|
+
className: "bg-muted text-foreground ring-border hover:bg-muted/80 h-10 min-w-[70px] rounded p-3 ring-1",
|
|
8738
|
+
onClick: onCancel,
|
|
8739
|
+
children: t("auto_apply_points_bundle_cancel")
|
|
8740
|
+
}),
|
|
8741
|
+
/* @__PURE__ */ jsx(Button, {
|
|
8742
|
+
type: "button",
|
|
8743
|
+
className: "bg-muted text-foreground ring-border hover:bg-muted/80 h-10 min-w-[70px] rounded p-3 ring-1",
|
|
8744
|
+
onClick: onConfirmOne,
|
|
8745
|
+
children: t("auto_apply_points_bundle_confirm_one")
|
|
8746
|
+
}),
|
|
8747
|
+
/* @__PURE__ */ jsx(Button, {
|
|
8748
|
+
type: "button",
|
|
8749
|
+
className: "bg-primary text-primary-foreground h-10 min-w-[70px] rounded p-3 hover:opacity-90",
|
|
8750
|
+
onClick: onConfirmAll,
|
|
8751
|
+
children: t(nextValue ? "auto_apply_points_bundle_confirm_all" : "auto_apply_points_bundle_confirm_all_off")
|
|
8752
|
+
})
|
|
8753
|
+
] })
|
|
8754
|
+
]
|
|
8704
8755
|
});
|
|
8705
8756
|
}
|
|
8706
8757
|
//#endregion
|
|
@@ -8720,7 +8771,7 @@ function AutoApplyPointsFanOutDialog({ bundle, pointsLabel, nextValue, presentat
|
|
|
8720
8771
|
* frame should ask autoApplyPointsControlVisible first, because this renders
|
|
8721
8772
|
* nothing for a company without a points program.
|
|
8722
8773
|
*/
|
|
8723
|
-
function AutoApplyPointsSection({ autoApplyPoints, pointsEnabled, subscriptionToken, disabled, renewalBundle, pointsLabel, queryKeys, presentation = "dialog", onSuccess, onError }) {
|
|
8774
|
+
function AutoApplyPointsSection({ autoApplyPoints, pointsEnabled, subscriptionToken, disabled, renewalBundle, pointsLabel, queryKeys, presentation = "dialog", fallbackWrite, onSuccess, onError }) {
|
|
8724
8775
|
const { t } = useSubscriptionsTranslation();
|
|
8725
8776
|
const labelId = useId();
|
|
8726
8777
|
const queryClient = useQueryClient();
|
|
@@ -8734,16 +8785,19 @@ function AutoApplyPointsSection({ autoApplyPoints, pointsEnabled, subscriptionTo
|
|
|
8734
8785
|
setPendingValue(null);
|
|
8735
8786
|
confirmedRef.current = false;
|
|
8736
8787
|
}
|
|
8737
|
-
const updateSubscription =
|
|
8738
|
-
|
|
8739
|
-
|
|
8788
|
+
const updateSubscription = useMutation({
|
|
8789
|
+
mutationFn: (variables) => {
|
|
8790
|
+
if (!fallbackWrite) return Promise.reject(/* @__PURE__ */ new Error("auto-apply-points: no fallbackWrite supplied for a payload without a renewal bundle"));
|
|
8791
|
+
return fallbackWrite(variables);
|
|
8792
|
+
},
|
|
8793
|
+
onSuccess: async (_written, { subscriptionToken: updatedSubscriptionToken, autoApplyPoints: writtenValue }) => {
|
|
8740
8794
|
for (const listKey of queryKeys.lists) queryClient.invalidateQueries({ queryKey: listKey });
|
|
8741
8795
|
await queryClient.refetchQueries({
|
|
8742
8796
|
queryKey: queryKeys.detail(updatedSubscriptionToken),
|
|
8743
8797
|
exact: true
|
|
8744
8798
|
});
|
|
8745
8799
|
if (latestSubscriptionTokenRef.current !== updatedSubscriptionToken) return;
|
|
8746
|
-
if (queryClient.getQueryData(queryKeys.detail(updatedSubscriptionToken))?.subscription.auto_apply_points !==
|
|
8800
|
+
if (queryClient.getQueryData(queryKeys.detail(updatedSubscriptionToken))?.subscription.auto_apply_points !== writtenValue) {
|
|
8747
8801
|
onSuccess?.(t("auto_apply_points_saved_but_not_refreshed", { label: pointsLabel }), "warning");
|
|
8748
8802
|
return;
|
|
8749
8803
|
}
|
|
@@ -8787,6 +8841,8 @@ function AutoApplyPointsSection({ autoApplyPoints, pointsEnabled, subscriptionTo
|
|
|
8787
8841
|
const control = autoApplyPointsControlState({
|
|
8788
8842
|
autoApplyPoints,
|
|
8789
8843
|
pointsEnabled,
|
|
8844
|
+
renewalBundle,
|
|
8845
|
+
hasFallbackWrite: fallbackWrite != null,
|
|
8790
8846
|
subscriptionDisabled: disabled,
|
|
8791
8847
|
writeInFlight: updateSubscription.isPending && updateSubscription.variables?.subscriptionToken === subscriptionToken || fanOut.isPending && (fanOut.variables?.subscriptionToken === subscriptionToken || fanOut.variables?.bundleTokens?.includes(subscriptionToken)) || detailRefetching
|
|
8792
8848
|
});
|
|
@@ -8795,7 +8851,7 @@ function AutoApplyPointsSection({ autoApplyPoints, pointsEnabled, subscriptionTo
|
|
|
8795
8851
|
if (route === "fallback") {
|
|
8796
8852
|
updateSubscription.mutate({
|
|
8797
8853
|
subscriptionToken,
|
|
8798
|
-
|
|
8854
|
+
autoApplyPoints: next
|
|
8799
8855
|
});
|
|
8800
8856
|
return;
|
|
8801
8857
|
}
|
|
@@ -8843,6 +8899,7 @@ function AutoApplyPointsSection({ autoApplyPoints, pointsEnabled, subscriptionTo
|
|
|
8843
8899
|
}), pendingValue !== null && renewalBundle ? /* @__PURE__ */ jsx(AutoApplyPointsFanOutDialog, {
|
|
8844
8900
|
bundle: renewalBundle,
|
|
8845
8901
|
pointsLabel,
|
|
8902
|
+
targetToken: subscriptionToken,
|
|
8846
8903
|
nextValue: pendingValue,
|
|
8847
8904
|
presentation,
|
|
8848
8905
|
onConfirmAll: () => confirm("bundle"),
|
|
@@ -8865,13 +8922,20 @@ function AutoApplyPointsSection({ autoApplyPoints, pointsEnabled, subscriptionTo
|
|
|
8865
8922
|
function PortalSubscriptionAutoApplyPointsSection(props) {
|
|
8866
8923
|
const { data: store } = useOptionalStore();
|
|
8867
8924
|
const sidebar = useContext(SidebarContext);
|
|
8868
|
-
|
|
8925
|
+
const api = useSubscriptionsApi();
|
|
8926
|
+
const fallbackWrite = useCallback(({ subscriptionToken, autoApplyPoints }) => api.updateSubscriptionInfo(subscriptionToken, { auto_apply_points: autoApplyPoints }), [api]);
|
|
8927
|
+
if (!autoApplyPointsControlVisible({
|
|
8928
|
+
pointsEnabled: props.pointsEnabled,
|
|
8929
|
+
renewalBundle: props.renewalBundle,
|
|
8930
|
+
hasFallbackWrite: true
|
|
8931
|
+
})) return null;
|
|
8869
8932
|
return /* @__PURE__ */ jsx("div", {
|
|
8870
8933
|
className: "border-border mb-6 border-b pb-4",
|
|
8871
8934
|
children: /* @__PURE__ */ jsx(AutoApplyPointsSection, {
|
|
8872
8935
|
...props,
|
|
8873
8936
|
pointsLabel: store?.reward_points_label_plural || "points",
|
|
8874
8937
|
presentation: sidebar?.isMobile ? "bottom-sheet" : "dialog",
|
|
8938
|
+
fallbackWrite,
|
|
8875
8939
|
queryKeys: {
|
|
8876
8940
|
detail: subscriptionsKeys.detail,
|
|
8877
8941
|
lists: [subscriptionsKeys.lists, subscriptionsKeys.infiniteLists]
|
|
@@ -9079,4 +9143,4 @@ const subscriptionsScreenPropertySchema = {
|
|
|
9079
9143
|
//#endregion
|
|
9080
9144
|
export { subscriptionsScreenPropertySchema as n, SubscriptionsScreen as t };
|
|
9081
9145
|
|
|
9082
|
-
//# sourceMappingURL=SubscriptionsScreen-
|
|
9146
|
+
//# sourceMappingURL=SubscriptionsScreen-C_Wt4-wY.mjs.map
|