Skip to content

Commit c7d11f4

Browse files
committed
fix: removing labels and adding better types for enityt info
1 parent 422c4fb commit c7d11f4

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

packages/create-invoice-form/src/lib/invoice/form-view.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
{formData.payeeAddress}
143143
</p>
144144
<div class={`invoice-info`}>
145-
{#each sellerInfo as { label, value, isEmail, isCompany }}
145+
{#each sellerInfo as { value, isEmail, isCompany }}
146146
<p>
147147
{#if isEmail}
148148
<a href="mailto:{value}">{value}</a>
@@ -160,7 +160,7 @@
160160
{formData.payerAddress}
161161
</p>
162162
<div class={`invoice-info`}>
163-
{#each buyerInfo as { label, value, isEmail, isCompany }}
163+
{#each buyerInfo as { value, isEmail, isCompany }}
164164
<p>
165165
{#if isEmail}
166166
<a href="mailto:{value}">{value}</a>

packages/invoice-dashboard/src/lib/dashboard/invoice-view.svelte

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,16 @@
3131
import { getConversionPaymentValues } from "../../utils/getConversionPaymentValues";
3232
import { getEthersSigner } from "../../utils";
3333
34-
interface BuyerSelerInfo {
34+
interface EntityInfo {
3535
value: string;
3636
isCompany?: boolean;
3737
isEmail?: boolean;
3838
}
3939
40+
interface BuyerInfo extends EntityInfo {}
41+
42+
interface SellerInfo extends EntityInfo {}
43+
4044
export let config;
4145
export let account: GetAccountReturnType;
4246
export let requestNetwork: RequestNetwork | null | undefined;
@@ -46,7 +50,6 @@
4650
export let wagmiConfig: any;
4751
4852
let network: string | undefined = request?.currencyInfo?.network || "mainnet";
49-
// FIXME: Use a non deprecated function
5053
let currency: CurrencyTypes.CurrencyDefinition | undefined =
5154
getCurrencyFromManager(request.currencyInfo, currencyManager);
5255
let paymentCurrencies: (CurrencyTypes.CurrencyDefinition | undefined)[] = [];
@@ -59,11 +62,11 @@
5962
let address = account.address;
6063
let firstItems: any;
6164
let otherItems: any;
62-
let sellerInfo: BuyerSelerInfo[] = [];
63-
let buyerInfo: BuyerSelerInfo[] = [];
65+
let sellerInfo: SellerInfo[] = [];
66+
let buyerInfo: BuyerInfo[] = [];
6467
let isPayee = request?.payee?.value.toLowerCase() === address?.toLowerCase();
6568
let unsupportedNetwork = false;
66-
let hexStringChain = "0x" + account.chainId.toString(16);
69+
let hexStringChain = "0x" + account?.chainId?.toString(16);
6770
let correctChain =
6871
hexStringChain === String(getNetworkIdFromNetworkName(network));
6972
let paymentNetworkExtension:
@@ -85,23 +88,18 @@
8588
.join(", ");
8689
8790
return [
88-
...(fullName ? [{ label: "Name", value: fullName }] : []),
91+
...(fullName ? [{ value: fullName }] : []),
8992
...(info?.businessName
9093
? [
9194
{
92-
label: "Company Name",
9395
value: info?.businessName,
9496
isCompany: true,
9597
},
9698
]
9799
: []),
98-
...(info?.taxRegistration
99-
? [{ label: "Tax Registration", value: info?.taxRegistration }]
100-
: []),
101-
...(fullAddress ? [{ label: "Address", value: fullAddress }] : []),
102-
...(info?.email
103-
? [{ label: "Email", value: info?.email, isEmail: true }]
104-
: []),
100+
...(info?.taxRegistration ? [{ value: info?.taxRegistration }] : []),
101+
...(fullAddress ? [{ value: fullAddress }] : []),
102+
...(info?.email ? [{ value: info?.email, isEmail: true }] : []),
105103
].filter((detail) => detail.value);
106104
};
107105
@@ -133,7 +131,6 @@
133131
$: {
134132
account = account;
135133
network = request?.currencyInfo?.network || "mainnet";
136-
// FIXME: Use a non deprecated function
137134
currency = getCurrencyFromManager(request.currencyInfo, currencyManager);
138135
}
139136

0 commit comments

Comments
 (0)