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