Remove firstName and lastName from billing address of the company and form (#143)

* [Invoices] Remove firstName and lastName from billing address of the company and form

* Fix fixtures
This commit is contained in:
Lukasz Ostrowski 2023-02-10 16:29:54 +01:00 committed by GitHub
parent 4340b03bb1
commit 0219561dd9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 18 additions and 34 deletions

View file

@ -0,0 +1,5 @@
---
"saleor-app-invoices": minor
---
Remove firstName and lastName fields in billing address of a company

View file

@ -7,8 +7,6 @@ export const getMockAddress = (): SellerShopConfig["address"] => {
companyName: "Saleor",
country: "Poland",
countryArea: "Dolnoslaskie",
firstName: "",
lastName: "",
postalCode: "12-123",
streetAddress1: "Techowa 7",
streetAddress2: "",

View file

@ -1,15 +1,22 @@
import { SellerShopConfig } from "./app-config";
export type SellerAddress = {
companyName: string;
cityArea: string;
countryArea: string;
streetAddress1: string;
streetAddress2: string;
postalCode: string;
city: string;
country: string;
};
export const Address = {
createEmpty(): SellerShopConfig["address"] {
createEmpty(): SellerAddress {
return {
city: "",
cityArea: "",
companyName: "",
country: "",
countryArea: "",
firstName: "",
lastName: "",
postalCode: "",
streetAddress1: "",
streetAddress2: "",

View file

@ -8,8 +8,6 @@ const getDefaultAddressData = (): SellerShopConfig["address"] => ({
companyName: "Saleor",
country: "",
countryArea: "",
firstName: "",
lastName: "",
postalCode: "",
streetAddress1: "",
streetAddress2: "",

View file

@ -6,8 +6,6 @@ const getDefaultEmptyAddress = (): SellerShopConfig["address"] => ({
companyName: "",
country: "",
countryArea: "",
firstName: "",
lastName: "",
postalCode: "",
streetAddress1: "",
streetAddress2: "",

View file

@ -23,8 +23,6 @@ describe("appConfigInputSchema", () => {
companyName: "",
country: "",
countryArea: "",
firstName: "",
lastName: "",
postalCode: "",
streetAddress1: "",
streetAddress2: "",

View file

@ -13,8 +13,6 @@ export const appConfigInputSchema = z.object({
streetAddress1: z.string().min(0),
streetAddress2: z.string().min(0),
postalCode: z.string().min(0),
firstName: z.string().min(0),
lastName: z.string().min(0),
city: z.string().min(0),
country: z.string().min(0),
}),

View file

@ -1,18 +1,7 @@
import { AddressFragment } from "../../../generated/graphql";
import { SellerAddress } from "./address";
export interface SellerShopConfig {
address: {
companyName: string;
cityArea: string;
countryArea: string;
streetAddress1: string;
streetAddress2: string;
postalCode: string;
firstName: string;
lastName: string;
city: string;
country: string;
};
address: SellerAddress;
}
export type ShopConfigPerChannelSlug = Record<string, SellerShopConfig>;

View file

@ -18,8 +18,6 @@ export const FallbackAppConfig = {
companyName: shopAddress?.companyAddress?.companyName ?? "",
country: shopAddress?.companyAddress?.country.country ?? "",
countryArea: shopAddress?.companyAddress?.countryArea ?? "",
firstName: shopAddress?.companyAddress?.firstName ?? "",
lastName: shopAddress?.companyAddress?.lastName ?? "",
postalCode: shopAddress?.companyAddress?.postalCode ?? "",
streetAddress1: shopAddress?.companyAddress?.streetAddress1 ?? "",
streetAddress2: shopAddress?.companyAddress?.streetAddress2 ?? "",

View file

@ -61,8 +61,6 @@ export const AddressForm = (props: Props) => {
channel:
</Typography>
<TextField label="Company Name" {...CommonFieldProps} {...register("companyName")} />
<TextField {...CommonFieldProps} label="First Name" {...register("firstName")} />
<TextField {...CommonFieldProps} label="Last Name" {...register("lastName")} />
<TextField label="Street Address 1" {...CommonFieldProps} {...register("streetAddress1")} />
<TextField {...CommonFieldProps} label="Street Address 2" {...register("streetAddress2")} />
<div style={{ display: "grid", gap: 20, gridTemplateColumns: "1fr 2fr" }}>

View file

@ -70,7 +70,6 @@ export class MicroinvoiceInvoiceGenerator implements InvoiceGenerator {
{
label: "Seller",
value: [
`${companyAddressData.firstName} ${companyAddressData.lastName}`,
companyAddressData.companyName,
companyAddressData.streetAddress1,
companyAddressData.streetAddress2,

View file

@ -9,8 +9,6 @@ gql`
code
}
city
firstName
lastName
streetAddress1
streetAddress2
companyName