
* [Invoices] Remove firstName and lastName from billing address of the company and form * Fix fixtures
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import { AppConfig } from "./app-config";
|
|
import { AppConfigContainer } from "./app-config-container";
|
|
import { ChannelFragment, ShopInfoFragment } from "../../../generated/graphql";
|
|
|
|
/**
|
|
* TODO Test
|
|
*/
|
|
export const FallbackAppConfig = {
|
|
createFallbackConfigFromExistingShopAndChannels(
|
|
channels: ChannelFragment[],
|
|
shopAddress: ShopInfoFragment | null
|
|
) {
|
|
return (channels ?? []).reduce<AppConfig>(
|
|
(state, channel) => {
|
|
return AppConfigContainer.setChannelAddress(state)(channel.slug)({
|
|
city: shopAddress?.companyAddress?.city ?? "",
|
|
cityArea: shopAddress?.companyAddress?.cityArea ?? "",
|
|
companyName: shopAddress?.companyAddress?.companyName ?? "",
|
|
country: shopAddress?.companyAddress?.country.country ?? "",
|
|
countryArea: shopAddress?.companyAddress?.countryArea ?? "",
|
|
postalCode: shopAddress?.companyAddress?.postalCode ?? "",
|
|
streetAddress1: shopAddress?.companyAddress?.streetAddress1 ?? "",
|
|
streetAddress2: shopAddress?.companyAddress?.streetAddress2 ?? "",
|
|
});
|
|
},
|
|
{ shopConfigPerChannel: {} }
|
|
);
|
|
},
|
|
};
|