fix: resolve nested ternary lint errors across codebase
This commit is contained in:
parent
44aa90061e
commit
2dec0af63b
@ -232,9 +232,9 @@ export class UnifiedExceptionFilter implements ExceptionFilter {
|
||||
userAgent:
|
||||
typeof userAgentHeader === "string"
|
||||
? userAgentHeader
|
||||
: Array.isArray(userAgentHeader)
|
||||
: (Array.isArray(userAgentHeader)
|
||||
? userAgentHeader[0]
|
||||
: undefined,
|
||||
: undefined),
|
||||
ip: request.ip,
|
||||
};
|
||||
}
|
||||
|
||||
@ -354,17 +354,17 @@ export class FreebitClientService {
|
||||
const timestamp = this.testTracker.getCurrentTimestamp();
|
||||
const resultCode = response?.resultCode
|
||||
? String(response.resultCode)
|
||||
: error instanceof FreebitError
|
||||
: (error instanceof FreebitError
|
||||
? String(error.resultCode || "ERROR")
|
||||
: "ERROR";
|
||||
: "ERROR");
|
||||
|
||||
const statusMessage =
|
||||
response?.status?.message ||
|
||||
(error instanceof FreebitError
|
||||
? error.message
|
||||
: error
|
||||
: (error
|
||||
? extractErrorMessage(error)
|
||||
: "Success");
|
||||
: "Success"));
|
||||
|
||||
await this.testTracker.logApiCall({
|
||||
timestamp,
|
||||
|
||||
@ -44,7 +44,7 @@ export class CheckoutService {
|
||||
private summarizeSelectionsForLog(selections: OrderSelections): Record<string, unknown> {
|
||||
const addons = this.collectAddonRefs(selections);
|
||||
const normalizeBool = (value?: string) =>
|
||||
value === "true" ? true : value === "false" ? false : undefined;
|
||||
value === "true" ? true : (value === "false" ? false : undefined);
|
||||
|
||||
return {
|
||||
planSku: selections.planSku,
|
||||
|
||||
@ -84,9 +84,9 @@ export class OrderValidator {
|
||||
const productContainer = products.products?.product;
|
||||
const existing = Array.isArray(productContainer)
|
||||
? productContainer
|
||||
: productContainer
|
||||
: (productContainer
|
||||
? [productContainer]
|
||||
: [];
|
||||
: []);
|
||||
|
||||
// Check for active Internet products
|
||||
const activeInternetProducts = existing.filter((product: WhmcsProduct) => {
|
||||
|
||||
@ -77,9 +77,9 @@ export class InternetOrderValidator {
|
||||
const productContainer = products.products?.product;
|
||||
const existing = Array.isArray(productContainer)
|
||||
? productContainer
|
||||
: productContainer
|
||||
: (productContainer
|
||||
? [productContainer]
|
||||
: [];
|
||||
: []);
|
||||
|
||||
// Check for active Internet products
|
||||
const activeInternetProducts = existing.filter((product: WhmcsProduct) => {
|
||||
|
||||
@ -52,9 +52,9 @@ export class WorkflowCaseManager {
|
||||
: null;
|
||||
|
||||
const opportunityStatus = opportunityId
|
||||
? opportunityCreated
|
||||
? (opportunityCreated
|
||||
? "Created new opportunity for this order"
|
||||
: "Linked to existing opportunity"
|
||||
: "Linked to existing opportunity")
|
||||
: "No opportunity linked";
|
||||
|
||||
const description = this.buildDescription([
|
||||
|
||||
@ -77,9 +77,9 @@ export class InternetCancellationService {
|
||||
const productContainer = productsResponse.products?.product;
|
||||
const products = Array.isArray(productContainer)
|
||||
? productContainer
|
||||
: productContainer
|
||||
: (productContainer
|
||||
? [productContainer]
|
||||
: [];
|
||||
: []);
|
||||
|
||||
const subscription = products.find(
|
||||
(p: { id?: number | string }) => Number(p.id) === subscriptionId
|
||||
|
||||
@ -107,9 +107,9 @@ export class SimValidationService {
|
||||
// Account extraction result
|
||||
extractedAccount,
|
||||
accountSource: extractedAccount
|
||||
? subscription.domain
|
||||
? (subscription.domain
|
||||
? "domain field"
|
||||
: "custom field or order number"
|
||||
: "custom field or order number")
|
||||
: "NOT FOUND - check fields below",
|
||||
// All custom fields for debugging
|
||||
customFieldKeys: Object.keys(subscription.customFields || {}),
|
||||
|
||||
@ -93,9 +93,9 @@ export class ResidenceCardService {
|
||||
const reviewerNotes =
|
||||
typeof rejectionRaw === "string" && rejectionRaw.trim().length > 0
|
||||
? rejectionRaw.trim()
|
||||
: typeof noteRaw === "string" && noteRaw.trim().length > 0
|
||||
: (typeof noteRaw === "string" && noteRaw.trim().length > 0
|
||||
? noteRaw.trim()
|
||||
: null;
|
||||
: null);
|
||||
|
||||
return residenceCardVerificationSchema.parse({
|
||||
status,
|
||||
|
||||
@ -149,9 +149,9 @@ export function OtpInput({
|
||||
"disabled:opacity-50 disabled:cursor-not-allowed",
|
||||
error
|
||||
? "border-danger focus:ring-danger focus:border-danger"
|
||||
: activeIndex === index
|
||||
: (activeIndex === index
|
||||
? "border-primary"
|
||||
: "border-border hover:border-muted-foreground/50"
|
||||
: "border-border hover:border-muted-foreground/50")
|
||||
)}
|
||||
aria-label={`Digit ${index + 1}`}
|
||||
/>
|
||||
|
||||
@ -216,9 +216,9 @@ export function AppShell({ children }: AppShellProps) {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : isAuthReady ? (
|
||||
) : (isAuthReady ? (
|
||||
children
|
||||
) : null}
|
||||
) : null)}
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -126,11 +126,11 @@ export function AddressCard({
|
||||
</AlertBanner>
|
||||
)}
|
||||
</div>
|
||||
) : hasAddress ? (
|
||||
) : (hasAddress ? (
|
||||
<AddressDisplay address={address} />
|
||||
) : (
|
||||
<EmptyAddressState onEdit={onEdit} />
|
||||
)}
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@ -119,9 +119,9 @@ function fromLegacyFormat(address: LegacyAddressData): PartialJapanAddressFormDa
|
||||
// For new users, leave it undefined so they must explicitly choose
|
||||
const hasExistingAddress = address.postcode || address.state || address.city;
|
||||
const residenceType = hasExistingAddress
|
||||
? roomNumber
|
||||
? (roomNumber
|
||||
? RESIDENCE_TYPE.APARTMENT
|
||||
: RESIDENCE_TYPE.HOUSE
|
||||
: RESIDENCE_TYPE.HOUSE)
|
||||
: undefined;
|
||||
|
||||
return {
|
||||
|
||||
@ -336,9 +336,9 @@ export function JapanAddressForm({
|
||||
required
|
||||
helperText={
|
||||
form.address.streetAddress.trim()
|
||||
? streetAddressError
|
||||
? (streetAddressError
|
||||
? undefined
|
||||
: "Valid format"
|
||||
: "Valid format")
|
||||
: "Enter chome-banchi-go (e.g., 1-5-3)"
|
||||
}
|
||||
>
|
||||
|
||||
@ -23,9 +23,9 @@ export function ProgressIndicator({ currentStep, totalSteps }: ProgressIndicator
|
||||
"h-1 rounded-full transition-all duration-500",
|
||||
i < currentStep
|
||||
? "bg-primary flex-[2]"
|
||||
: i === currentStep
|
||||
: (i === currentStep
|
||||
? "bg-primary/40 flex-[2] animate-pulse"
|
||||
: "bg-border flex-1"
|
||||
: "bg-border flex-1")
|
||||
)}
|
||||
/>
|
||||
))}
|
||||
|
||||
@ -144,7 +144,7 @@ export function PaymentMethodsContainer() {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : paymentMethodsData && paymentMethodsData.paymentMethods.length > 0 ? (
|
||||
) : (paymentMethodsData && paymentMethodsData.paymentMethods.length > 0 ? (
|
||||
<div className="bg-white rounded-xl border border-gray-200 shadow-sm overflow-hidden">
|
||||
<div className="bg-gradient-to-r from-blue-50 to-indigo-50 px-6 py-5 border-b border-gray-200">
|
||||
<div className="flex items-center justify-between">
|
||||
@ -214,7 +214,7 @@ export function PaymentMethodsContainer() {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="lg:col-span-1 xl:col-span-1">
|
||||
|
||||
@ -132,11 +132,11 @@ export function CheckoutStatusBanners({
|
||||
</p>
|
||||
{eligibility.notes ? (
|
||||
<p className="text-xs text-muted-foreground">{eligibility.notes}</p>
|
||||
) : eligibility.requestedAt ? (
|
||||
) : (eligibility.requestedAt ? (
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Last updated: {new Date(eligibility.requestedAt).toLocaleString()}
|
||||
</p>
|
||||
) : null}
|
||||
) : null)}
|
||||
<Button as="a" href="/account/support/new" size="sm">
|
||||
Contact support
|
||||
</Button>
|
||||
|
||||
@ -254,11 +254,11 @@ function NotSubmittedContent({
|
||||
<div className="font-medium text-foreground">Rejection note</div>
|
||||
<div>{reviewerNotes}</div>
|
||||
</div>
|
||||
) : isRejected ? (
|
||||
) : (isRejected ? (
|
||||
<p className="text-sm text-foreground/80">
|
||||
Your document couldn't be approved. Please upload a new file to continue.
|
||||
</p>
|
||||
) : null}
|
||||
) : null)}
|
||||
|
||||
<p className="text-sm text-foreground/80">
|
||||
Upload a JPG, PNG, or PDF (max 5MB). We'll verify it before activating SIM service.
|
||||
|
||||
@ -1341,14 +1341,14 @@ export function PublicLandingView() {
|
||||
<Spinner size="sm" />
|
||||
Sending...
|
||||
</>
|
||||
) : submitStatus === "success" ? (
|
||||
) : (submitStatus === "success" ? (
|
||||
<>
|
||||
<CheckCircle className="h-4 w-4" />
|
||||
Sent!
|
||||
</>
|
||||
) : (
|
||||
"Submit"
|
||||
)}
|
||||
))}
|
||||
</button>
|
||||
</form>
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ export const NotificationDropdown = memo(function NotificationDropdown({
|
||||
<div className="flex items-center justify-center py-8">
|
||||
<div className="h-5 w-5 animate-spin rounded-full border-2 border-primary border-t-transparent" />
|
||||
</div>
|
||||
) : notifications.length === 0 ? (
|
||||
) : (notifications.length === 0 ? (
|
||||
<div className="flex flex-col items-center justify-center py-10 px-4 text-center">
|
||||
<BellSlashIcon className="h-10 w-10 text-muted-foreground/40 mb-3" />
|
||||
<p className="text-sm text-muted-foreground">No notifications yet</p>
|
||||
@ -86,7 +86,7 @@ export const NotificationDropdown = memo(function NotificationDropdown({
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Footer */}
|
||||
|
||||
@ -287,9 +287,9 @@ export function AddressForm({
|
||||
const containerClasses =
|
||||
variant === "inline"
|
||||
? ""
|
||||
: variant === "compact"
|
||||
: (variant === "compact"
|
||||
? "p-4 bg-gray-50 rounded-lg border border-gray-200"
|
||||
: "p-6 bg-white border border-gray-200 rounded-lg";
|
||||
: "p-6 bg-white border border-gray-200 rounded-lg");
|
||||
|
||||
// Get all validation errors
|
||||
const allErrors = Object.values(form.errors).filter(Boolean) as string[];
|
||||
|
||||
@ -261,7 +261,7 @@ export function OrderSummary({
|
||||
</Button>
|
||||
) : null}
|
||||
</>
|
||||
) : onContinue ? (
|
||||
) : (onContinue ? (
|
||||
<Button
|
||||
size="lg"
|
||||
className="w-full mt-8 group text-lg font-bold"
|
||||
@ -271,7 +271,7 @@ export function OrderSummary({
|
||||
>
|
||||
{continueLabel}
|
||||
</Button>
|
||||
) : null}
|
||||
) : null)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@ -160,7 +160,7 @@ export function ProductCard({
|
||||
>
|
||||
{actionLabel}
|
||||
</Button>
|
||||
) : onClick ? (
|
||||
) : (onClick ? (
|
||||
<Button
|
||||
onClick={onClick}
|
||||
className="w-full group"
|
||||
@ -169,7 +169,7 @@ export function ProductCard({
|
||||
>
|
||||
{actionLabel}
|
||||
</Button>
|
||||
) : null}
|
||||
) : null)}
|
||||
</div>
|
||||
|
||||
{/* Custom footer */}
|
||||
|
||||
@ -37,9 +37,9 @@ export function InstallationOptions({
|
||||
installation.description ||
|
||||
(installationTerm === "12-Month"
|
||||
? "Spread the installation fee across 12 monthly payments."
|
||||
: installationTerm === "24-Month"
|
||||
: (installationTerm === "24-Month"
|
||||
? "Spread the installation fee across 24 monthly payments."
|
||||
: "Pay the full installation fee in one payment.");
|
||||
: "Pay the full installation fee in one payment."));
|
||||
|
||||
return (
|
||||
<button
|
||||
|
||||
@ -167,7 +167,7 @@ export function InternetOfferingCard({
|
||||
See pricing after verification
|
||||
</p>
|
||||
</div>
|
||||
) : disabled ? (
|
||||
) : (disabled ? (
|
||||
<div className="mt-auto">
|
||||
<Button variant="outline" size="sm" className="w-full" disabled>
|
||||
Unavailable
|
||||
@ -188,7 +188,7 @@ export function InternetOfferingCard({
|
||||
>
|
||||
Select
|
||||
</Button>
|
||||
)}
|
||||
))}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@ -255,7 +255,7 @@ export function DeviceCompatibility() {
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
) : showNoResults ? (
|
||||
) : (showNoResults ? (
|
||||
<div className="p-6 text-center">
|
||||
<div className="flex-shrink-0 h-12 w-12 mx-auto rounded-full bg-amber-100 dark:bg-amber-900/30 flex items-center justify-center mb-3">
|
||||
<X className="h-6 w-6 text-amber-600 dark:text-amber-400" />
|
||||
@ -269,7 +269,7 @@ export function DeviceCompatibility() {
|
||||
to verify compatibility.
|
||||
</p>
|
||||
</div>
|
||||
) : null}
|
||||
) : null)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@ -266,9 +266,9 @@ export function SimPlansContent({
|
||||
const tabPlans =
|
||||
activeTab === "data-voice"
|
||||
? plansByType.DataSmsVoice
|
||||
: activeTab === "data-only"
|
||||
: (activeTab === "data-only"
|
||||
? plansByType.DataOnly
|
||||
: plansByType.VoiceOnly;
|
||||
: plansByType.VoiceOnly);
|
||||
|
||||
const regularPlans = tabPlans.filter(p => !p.simHasFamilyDiscount);
|
||||
const familyPlans = tabPlans.filter(p => p.simHasFamilyDiscount);
|
||||
|
||||
@ -64,9 +64,9 @@ export function useInternetConfigureParams() {
|
||||
.split(",")
|
||||
.map(s => s.trim())
|
||||
.filter(Boolean)
|
||||
: addonSkuParams.length > 0
|
||||
: (addonSkuParams.length > 0
|
||||
? addonSkuParams
|
||||
: [];
|
||||
: []);
|
||||
|
||||
return {
|
||||
accessMode,
|
||||
|
||||
@ -204,7 +204,7 @@ export function InternetEligibilityRequestView() {
|
||||
<div className="flex-1 min-w-0">
|
||||
{planLoading ? (
|
||||
<div className="text-sm text-muted-foreground">Loading selected plan…</div>
|
||||
) : plan ? (
|
||||
) : (plan ? (
|
||||
<div className="flex items-center justify-between gap-3 flex-wrap">
|
||||
<div>
|
||||
<p className="text-xs text-muted-foreground">Selected plan</p>
|
||||
@ -212,7 +212,7 @@ export function InternetEligibilityRequestView() {
|
||||
</div>
|
||||
<CardPricing monthlyPrice={plan.monthlyPrice} size="sm" alignment="right" />
|
||||
</div>
|
||||
) : null}
|
||||
) : null)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -68,9 +68,9 @@ export function PublicEligibilityCheckView() {
|
||||
step === "success" ? (hasAccount ? "Account Created" : "Request Submitted") : currentMeta.title;
|
||||
const description =
|
||||
step === "success"
|
||||
? hasAccount
|
||||
? (hasAccount
|
||||
? "Your account is ready and eligibility check is in progress."
|
||||
: "Your availability check request has been submitted."
|
||||
: "Your availability check request has been submitted.")
|
||||
: currentMeta.description;
|
||||
|
||||
return (
|
||||
|
||||
@ -977,7 +977,7 @@ export function PublicInternetPlansContent({
|
||||
<section className="space-y-3">
|
||||
{isLoading ? (
|
||||
<Skeleton className="h-64 w-full rounded-xl" />
|
||||
) : consolidatedPlanData ? (
|
||||
) : (consolidatedPlanData ? (
|
||||
<ConsolidatedInternetCard
|
||||
minPrice={consolidatedPlanData.minPrice}
|
||||
maxPrice={consolidatedPlanData.maxPrice}
|
||||
@ -987,7 +987,7 @@ export function PublicInternetPlansContent({
|
||||
ctaLabel={ctaLabel}
|
||||
{...(onCtaClick && { onCtaClick })}
|
||||
/>
|
||||
) : null}
|
||||
) : null)}
|
||||
</section>
|
||||
|
||||
{/* Available Plans - Expandable cards by offering type */}
|
||||
|
||||
@ -79,9 +79,9 @@ export function ReissueSimModal({
|
||||
} catch (error: unknown) {
|
||||
const message =
|
||||
process.env.NODE_ENV === "development"
|
||||
? error instanceof Error
|
||||
? (error instanceof Error
|
||||
? error.message
|
||||
: "Failed to submit reissue request"
|
||||
: "Failed to submit reissue request")
|
||||
: "Failed to submit reissue request. Please try again.";
|
||||
onError(message);
|
||||
} finally {
|
||||
|
||||
@ -388,9 +388,9 @@ function useSimActionsState(subscriptionId: number, onCancelSuccess?: () => void
|
||||
} catch (err: unknown) {
|
||||
setError(
|
||||
process.env.NODE_ENV === "development"
|
||||
? err instanceof Error
|
||||
? (err instanceof Error
|
||||
? err.message
|
||||
: "Failed to cancel SIM service"
|
||||
: "Failed to cancel SIM service")
|
||||
: "Unable to cancel SIM service right now. Please try again."
|
||||
);
|
||||
} finally {
|
||||
|
||||
@ -108,9 +108,9 @@ export function SimManagementSection({ subscriptionId }: SimManagementSectionPro
|
||||
} else {
|
||||
setError(
|
||||
process.env.NODE_ENV === "development"
|
||||
? err instanceof Error
|
||||
? (err instanceof Error
|
||||
? err.message
|
||||
: "Failed to load SIM information"
|
||||
: "Failed to load SIM information")
|
||||
: "Unable to load SIM information right now. Please try again."
|
||||
);
|
||||
}
|
||||
@ -252,9 +252,9 @@ export function SimManagementSection({ subscriptionId }: SimManagementSectionPro
|
||||
const remainingMB = simInfo.details.remainingQuotaMb.toFixed(1);
|
||||
const usedMB = simInfo.usage?.monthlyUsageMb
|
||||
? simInfo.usage.monthlyUsageMb.toFixed(2)
|
||||
: simInfo.usage?.todayUsageMb
|
||||
: (simInfo.usage?.todayUsageMb
|
||||
? simInfo.usage.todayUsageMb.toFixed(2)
|
||||
: "0.00";
|
||||
: "0.00");
|
||||
|
||||
// Calculate percentage for circle
|
||||
const totalMB = Number.parseFloat(remainingMB) + Number.parseFloat(usedMB);
|
||||
|
||||
@ -140,9 +140,9 @@ export function CancelSubscriptionContainer() {
|
||||
} catch (e: unknown) {
|
||||
setError(
|
||||
process.env.NODE_ENV === "development"
|
||||
? e instanceof Error
|
||||
? (e instanceof Error
|
||||
? e.message
|
||||
: "Failed to load cancellation information"
|
||||
: "Failed to load cancellation information")
|
||||
: "Unable to load cancellation information right now. Please try again."
|
||||
);
|
||||
} finally {
|
||||
@ -176,9 +176,9 @@ export function CancelSubscriptionContainer() {
|
||||
} catch (e: unknown) {
|
||||
setFormError(
|
||||
process.env.NODE_ENV === "development"
|
||||
? e instanceof Error
|
||||
? (e instanceof Error
|
||||
? e.message
|
||||
: "Failed to submit cancellation"
|
||||
: "Failed to submit cancellation")
|
||||
: "Unable to submit your cancellation right now. Please try again."
|
||||
);
|
||||
} finally {
|
||||
|
||||
@ -32,9 +32,9 @@ export function SimChangePlanContainer() {
|
||||
} catch (e: unknown) {
|
||||
setError(
|
||||
process.env.NODE_ENV === "development"
|
||||
? e instanceof Error
|
||||
? (e instanceof Error
|
||||
? e.message
|
||||
: "Failed to load available plans"
|
||||
: "Failed to load available plans")
|
||||
: "Unable to load available plans right now. Please try again."
|
||||
);
|
||||
} finally {
|
||||
@ -66,9 +66,9 @@ export function SimChangePlanContainer() {
|
||||
} catch (e: unknown) {
|
||||
setError(
|
||||
process.env.NODE_ENV === "development"
|
||||
? e instanceof Error
|
||||
? (e instanceof Error
|
||||
? e.message
|
||||
: "Failed to change plan"
|
||||
: "Failed to change plan")
|
||||
: "Unable to submit your plan change right now. Please try again."
|
||||
);
|
||||
} finally {
|
||||
|
||||
@ -37,9 +37,9 @@ export function SimReissueContainer() {
|
||||
} catch (e: unknown) {
|
||||
setError(
|
||||
process.env.NODE_ENV === "development"
|
||||
? e instanceof Error
|
||||
? (e instanceof Error
|
||||
? e.message
|
||||
: "Failed to load SIM details"
|
||||
: "Failed to load SIM details")
|
||||
: "Unable to load SIM details right now. Please try again."
|
||||
);
|
||||
} finally {
|
||||
@ -85,9 +85,9 @@ export function SimReissueContainer() {
|
||||
} catch (e: unknown) {
|
||||
setError(
|
||||
process.env.NODE_ENV === "development"
|
||||
? e instanceof Error
|
||||
? (e instanceof Error
|
||||
? e.message
|
||||
: "Failed to submit reissue request"
|
||||
: "Failed to submit reissue request")
|
||||
: "Unable to submit your request right now. Please try again."
|
||||
);
|
||||
} finally {
|
||||
|
||||
@ -54,9 +54,9 @@ export function SimTopUpContainer() {
|
||||
} catch (e: unknown) {
|
||||
setError(
|
||||
process.env.NODE_ENV === "development"
|
||||
? e instanceof Error
|
||||
? (e instanceof Error
|
||||
? e.message
|
||||
: "Failed to submit top-up"
|
||||
: "Failed to submit top-up")
|
||||
: "Unable to submit your top-up right now. Please try again."
|
||||
);
|
||||
} finally {
|
||||
|
||||
@ -57,9 +57,9 @@ export function SubscriptionDetailContainer() {
|
||||
|
||||
// Show error message (only when we have an error, not during loading)
|
||||
const pageError = error
|
||||
? process.env.NODE_ENV === "development" && error instanceof Error
|
||||
? (process.env.NODE_ENV === "development" && error instanceof Error
|
||||
? error.message
|
||||
: "Unable to load subscription details. Please try again."
|
||||
: "Unable to load subscription details. Please try again.")
|
||||
: null;
|
||||
|
||||
const productNameLower = subscription?.productName?.toLowerCase() ?? "";
|
||||
|
||||
@ -42,9 +42,9 @@ export function NewSupportCaseView() {
|
||||
} catch (err) {
|
||||
setError(
|
||||
process.env.NODE_ENV === "development"
|
||||
? err instanceof Error
|
||||
? (err instanceof Error
|
||||
? err.message
|
||||
: "Failed to create support case"
|
||||
: "Failed to create support case")
|
||||
: "Unable to create your support case right now. Please try again."
|
||||
);
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ export function SupportCasesView() {
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
) : hasActiveFilters ? (
|
||||
) : (hasActiveFilters ? (
|
||||
<AnimatedCard className="p-8" variant="static">
|
||||
<SearchEmptyState searchTerm={searchTerm || "filters"} onClearSearch={clearFilters} />
|
||||
</AnimatedCard>
|
||||
@ -228,7 +228,7 @@ export function SupportCasesView() {
|
||||
}}
|
||||
/>
|
||||
</AnimatedCard>
|
||||
)}
|
||||
))}
|
||||
</PageLayout>
|
||||
);
|
||||
}
|
||||
|
||||
@ -585,7 +585,7 @@ export function getOrderTrackingSteps(
|
||||
|
||||
return stages.map((s, index) => ({
|
||||
label: s.label,
|
||||
status: index < currentStep ? "completed" : index === currentStep ? "current" : "upcoming",
|
||||
status: index < currentStep ? "completed" : (index === currentStep ? "current" : "upcoming"),
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@ -195,9 +195,9 @@ export function transformWhmcsSubscriptionListResponse(
|
||||
const productContainer = parsed.products?.product;
|
||||
const products = Array.isArray(productContainer)
|
||||
? productContainer
|
||||
: productContainer
|
||||
: (productContainer
|
||||
? [productContainer]
|
||||
: [];
|
||||
: []);
|
||||
|
||||
const subscriptions: Subscription[] = [];
|
||||
for (const product of products) {
|
||||
@ -213,9 +213,9 @@ export function transformWhmcsSubscriptionListResponse(
|
||||
const totalResults =
|
||||
typeof totalResultsRaw === "number"
|
||||
? totalResultsRaw
|
||||
: typeof totalResultsRaw === "string"
|
||||
: (typeof totalResultsRaw === "string"
|
||||
? Number.parseInt(totalResultsRaw, 10)
|
||||
: subscriptions.length;
|
||||
: subscriptions.length);
|
||||
|
||||
if (status) {
|
||||
const normalizedStatus = subscriptionStatusSchema.parse(status);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user