From 61fe4038a7b2b219cd82187e3c2b547e7fb39df9 Mon Sep 17 00:00:00 2001
From: sstefdev
+ {#if isEmail} + {value} + {:else} + {value} + {/if} +
{/each}Billed to {formData.payerAddress}
-+ {#if isEmail} + {value} + {:else} + {value} + {/if} +
{/each}Payment Chain - {currency?.network ? currency.network.charAt(0).toUpperCase() + currency.network.slice(1).toLowerCase() : ""} + {currency?.network + ? currency.network.charAt(0).toUpperCase() + + currency.network.slice(1).toLowerCase() + : ""}
Invoice Currency - {invoiceCurrency ? invoiceCurrency.symbol: ""} + {invoiceCurrency ? invoiceCurrency.symbol : ""}
Settlement Currency @@ -487,4 +497,37 @@ fill: white; color: white; } + + .invoice-info { + display: flex; + flex-direction: column; + gap: 6px; + } + + .invoice-info p { + display: flex; + gap: 8px; + } + + .invoice-info span { + color: #6e7480; + } + + .invoice-info .company { + font-weight: 600 !important; + } + + .invoice-info a { + color: #6e7480; + } + + .invoice-info a:hover { + text-decoration: underline; + } + + .invoice-section-divider { + width: 100%; + height: 1px; + background-color: var(--mainColor); + } diff --git a/packages/invoice-dashboard/src/lib/dashboard/invoice-view.svelte b/packages/invoice-dashboard/src/lib/dashboard/invoice-view.svelte index 735aa603..1e4d6826 100644 --- a/packages/invoice-dashboard/src/lib/dashboard/invoice-view.svelte +++ b/packages/invoice-dashboard/src/lib/dashboard/invoice-view.svelte @@ -31,6 +31,12 @@ import { getConversionPaymentValues } from "../../utils/getConversionPaymentValues"; import { getEthersSigner } from "../../utils"; + interface BuyerSelerInfo { + value: string; + isCompany?: boolean; + isEmail?: boolean; + } + export let config; export let account: GetAccountReturnType; export let requestNetwork: RequestNetwork | null | undefined; @@ -53,8 +59,8 @@ let address = account.address; let firstItems: any; let otherItems: any; - let sellerInfo: { label: string; value: string }[] = []; - let buyerInfo: { label: string; value: string }[] = []; + let sellerInfo: BuyerSelerInfo[] = []; + let buyerInfo: BuyerSelerInfo[] = []; let isPayee = request?.payee?.value.toLowerCase() === address?.toLowerCase(); let unsupportedNetwork = false; let hexStringChain = "0x" + account.chainId.toString(16); @@ -65,17 +71,37 @@ | undefined; const generateDetailParagraphs = (info: any) => { + const fullName = [info?.firstName, info?.lastName] + .filter(Boolean) + .join(" "); + const fullAddress = [ + info?.address?.["street-address"], + info?.address?.locality, + info?.address?.region, + info?.address?.["postal-code"], + info?.address?.["country-name"], + ] + .filter(Boolean) + .join(", "); + return [ - { label: "First Name", value: info?.firstName }, - { label: "Last Name", value: info?.lastName }, - { label: "Company Name", value: info?.businessName }, - { label: "Tax Registration", value: info?.taxRegistration }, - { label: "Country", value: info?.address?.["country-name"] }, - { label: "City", value: info?.address?.locality }, - { label: "Region", value: info?.address?.region }, - { label: "Postal Code", value: info?.address?.["postal-code"] }, - { label: "Street Address", value: info?.address?.["street-address"] }, - { label: "Email", value: info?.email }, + ...(fullName ? [{ label: "Name", value: fullName }] : []), + ...(info?.businessName + ? [ + { + label: "Company Name", + value: info?.businessName, + isCompany: true, + }, + ] + : []), + ...(info?.taxRegistration + ? [{ label: "Tax Registration", value: info?.taxRegistration }] + : []), + ...(fullAddress ? [{ label: "Address", value: fullAddress }] : []), + ...(info?.email + ? [{ label: "Email", value: info?.email, isEmail: true }] + : []), ].filter((detail) => detail.value); }; @@ -248,7 +274,7 @@ return ( (paymentNetworkExtension?.id && - await approvalCheckers[paymentNetworkExtension.id]?.()) || + (await approvalCheckers[paymentNetworkExtension.id]?.())) || false ); }; @@ -376,11 +402,16 @@
{request?.payee?.value || "-"}
- {label || "-"}: - {value || "-"} + {#if isEmail} + {value} + {:else if isCompany} + {value} + {:else} + {value} + {/if}
{/each}{request?.payer?.value || "-"}
- {label || "-"}: - {value || "-"} + {#if isEmail} + {value} + {:else if isCompany} + {value} + {:else} + {value} + {/if}
{/each}{#if isEmail} {value} @@ -160,7 +160,7 @@ {formData.payerAddress}
{#if isEmail} {value} diff --git a/packages/invoice-dashboard/src/lib/dashboard/invoice-view.svelte b/packages/invoice-dashboard/src/lib/dashboard/invoice-view.svelte index 1e4d6826..76419657 100644 --- a/packages/invoice-dashboard/src/lib/dashboard/invoice-view.svelte +++ b/packages/invoice-dashboard/src/lib/dashboard/invoice-view.svelte @@ -31,12 +31,16 @@ import { getConversionPaymentValues } from "../../utils/getConversionPaymentValues"; import { getEthersSigner } from "../../utils"; - interface BuyerSelerInfo { + interface EntityInfo { value: string; isCompany?: boolean; isEmail?: boolean; } + interface BuyerInfo extends EntityInfo {} + + interface SellerInfo extends EntityInfo {} + export let config; export let account: GetAccountReturnType; export let requestNetwork: RequestNetwork | null | undefined; @@ -46,7 +50,6 @@ export let wagmiConfig: any; let network: string | undefined = request?.currencyInfo?.network || "mainnet"; - // FIXME: Use a non deprecated function let currency: CurrencyTypes.CurrencyDefinition | undefined = getCurrencyFromManager(request.currencyInfo, currencyManager); let paymentCurrencies: (CurrencyTypes.CurrencyDefinition | undefined)[] = []; @@ -59,11 +62,11 @@ let address = account.address; let firstItems: any; let otherItems: any; - let sellerInfo: BuyerSelerInfo[] = []; - let buyerInfo: BuyerSelerInfo[] = []; + let sellerInfo: SellerInfo[] = []; + let buyerInfo: BuyerInfo[] = []; let isPayee = request?.payee?.value.toLowerCase() === address?.toLowerCase(); let unsupportedNetwork = false; - let hexStringChain = "0x" + account.chainId.toString(16); + let hexStringChain = "0x" + account?.chainId?.toString(16); let correctChain = hexStringChain === String(getNetworkIdFromNetworkName(network)); let paymentNetworkExtension: @@ -85,23 +88,18 @@ .join(", "); return [ - ...(fullName ? [{ label: "Name", value: fullName }] : []), + ...(fullName ? [{ value: fullName }] : []), ...(info?.businessName ? [ { - label: "Company Name", value: info?.businessName, isCompany: true, }, ] : []), - ...(info?.taxRegistration - ? [{ label: "Tax Registration", value: info?.taxRegistration }] - : []), - ...(fullAddress ? [{ label: "Address", value: fullAddress }] : []), - ...(info?.email - ? [{ label: "Email", value: info?.email, isEmail: true }] - : []), + ...(info?.taxRegistration ? [{ value: info?.taxRegistration }] : []), + ...(fullAddress ? [{ value: fullAddress }] : []), + ...(info?.email ? [{ value: info?.email, isEmail: true }] : []), ].filter((detail) => detail.value); }; @@ -133,7 +131,6 @@ $: { account = account; network = request?.currencyInfo?.network || "mainnet"; - // FIXME: Use a non deprecated function currency = getCurrencyFromManager(request.currencyInfo, currencyManager); }