Skip to content

Commit

Permalink
Merge branch 'main' into mobile_payment
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianGerke authored Oct 30, 2024
2 parents b0a0504 + eb6666d commit d6a47f5
Show file tree
Hide file tree
Showing 45 changed files with 613 additions and 388 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/compliance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,15 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: ${{ github.head_ref }}
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v4
- name: 'Dependency Review'
uses: actions/dependency-review-action@v4
with:
license-check: true
deny-licenses: 'AGPL-1.0-or-later, GPL-1.0-or-later, LGPL-2.0-or-later, NGPL'
vulnerability-check: false
comment-summary-in-pr: on-failure
1 change: 1 addition & 0 deletions apps/server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"display": "Server",
"compilerOptions": {
"resolveJsonModule": true,
"lib": ["DOM", "DOM.Iterable", "ES2019"],
"composite": false,
"declaration": false,
Expand Down
31 changes: 22 additions & 9 deletions apps/web/components/AddressForm/AddressForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,29 @@
</template>

<script setup lang="ts">
import { type Address, AddressType, userAddressGetters } from '@plentymarkets/shop-api';
import {
type ActiveShippingCountry,
type Address,
AddressType,
type GeoRegulatedCountry,
userAddressGetters,
} from '@plentymarkets/shop-api';
import { SfCheckbox, SfInput, SfLoaderCircular, SfSelect } from '@storefront-ui/vue';
import type { AddressFormProps } from '~/components/AddressForm/types';
import { type AddressFormProps } from '~/components/AddressForm/types';
const { type, savedAddress: propertySavedAddress, useAsShippingDefault = true } = defineProps<AddressFormProps>();
const { loading: loadBilling } = useAddress(AddressType.Billing);
const { loading: loadShipping } = useAddress(AddressType.Shipping);
const {
type,
savedAddress: propertySavedAddress,
countries,
useAsShippingDefault = true,
} = defineProps<AddressFormProps>();
useGeoRegulatedCountries,
default: defaultCountries,
geoRegulated: geoRegulatedCountries,
} = useAggregatedCountries();
const countries = computed(() =>
type === AddressType.Billing && useGeoRegulatedCountries ? geoRegulatedCountries.value : defaultCountries.value,
);
const isCartUpdateLoading = computed(() => loadBilling.value || loadShipping.value);
const useAsShippingAddress = ref(useAsShippingDefault);
const savedAddress = propertySavedAddress || ({} as Address);
Expand Down Expand Up @@ -146,7 +155,11 @@ const clearInputs = () => {
const states = computed(() => {
const selectedCountry = defaultValues.value.country;
return countries.find((country) => country.id === Number(selectedCountry))?.states ?? [];
return (
countries.value.find(
(country: ActiveShippingCountry | GeoRegulatedCountry) => country.id === Number(selectedCountry),
)?.states ?? []
);
});
defineEmits(['on-save', 'on-close']);
Expand Down
3 changes: 1 addition & 2 deletions apps/web/components/AddressForm/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { Address, ActiveShippingCountry, AddressType } from '@plentymarkets/shop-api';
import { type Address, AddressType } from '@plentymarkets/shop-api';

export type AddressFormProps = {
type: AddressType;
savedAddress?: Address;
countries: ActiveShippingCountry[];
useAsShippingDefault?: boolean;
};
15 changes: 10 additions & 5 deletions apps/web/components/AddressFormBilling/AddressFormBilling.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@
:invalid="Boolean(errors['country'])"
>
<option
v-for="(shippingCountry, index) in countries"
v-for="(billingCountry, index) in countries"
:key="`billing-country-${index}`"
:value="shippingCountry.id.toString()"
:value="billingCountry.id.toString()"
>
{{ shippingCountry.currLangName }}
{{ billingCountry.currLangName }}
</option>
</SfSelect>
<ErrorMessage as="span" name="country" class="flex text-negative-700 text-sm mt-2" />
Expand All @@ -139,12 +139,17 @@ import { type Address, AddressType, userAddressGetters } from '@plentymarkets/sh
const { address, addAddress = false } = defineProps<AddressFormProps>();
const { data: countries } = useActiveShippingCountries();
const { hasCompany, addressToSave, save: saveAddress, validationSchema } = useAddressForm(AddressType.Billing);
const { addresses: billingAddresses } = useAddressStore(AddressType.Billing);
const { set: setCheckoutAddress } = useCheckoutAddress(AddressType.Billing);
const { defineField, errors, setValues, validate, handleSubmit } = useForm({ validationSchema: validationSchema });
const {
useGeoRegulatedCountries,
default: defaultCountries,
geoRegulated: geoRegulatedCountries,
} = useAggregatedCountries();
const countries = computed(() => (useGeoRegulatedCountries ? geoRegulatedCountries.value : defaultCountries.value));
const [firstName, firstNameAttributes] = defineField('firstName');
const [lastName, lastNameAttributes] = defineField('lastName');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
:invalid="Boolean(errors['country'])"
>
<option
v-for="(shippingCountry, index) in countries"
v-for="(shippingCountry, index) in defaultCountries"
:key="`shipping-country-${index}`"
:value="shippingCountry.id.toString()"
>
Expand All @@ -147,7 +147,7 @@ import { type Address, AddressType, userAddressGetters } from '@plentymarkets/sh
const { address, addAddress = false } = defineProps<AddressFormProps>();
const { isGuest } = useCustomer();
const { data: countries } = useActiveShippingCountries();
const { default: defaultCountries } = useAggregatedCountries();
const { shippingAsBilling } = useShippingAsBilling();
const { addresses: shippingAddresses } = useAddressStore(AddressType.Shipping);
const { addresses: billingAddresses } = useAddressStore(AddressType.Billing);
Expand All @@ -161,7 +161,6 @@ const {
validationSchema: shippingSchema,
refreshAddressDependencies,
} = useAddressForm(AddressType.Shipping);
const { defineField, errors, setValues, validate, handleSubmit } = useForm({ validationSchema: shippingSchema });
const [firstName, firstNameAttributes] = defineField('firstName');
Expand Down
4 changes: 1 addition & 3 deletions apps/web/components/AddressesList/AddressesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
</h3>
</header>
<AddressForm
:countries="activeShippingCountries"
:saved-address="selectedAddress"
:use-as-shipping-default="false"
:type="type"
Expand All @@ -65,7 +64,6 @@ import { type AddressesListProps } from './types';
const { type, editAddressText, addAddressText } = defineProps<AddressesListProps>();
const { isOpen, open, close } = useDisclosure();
const { data: activeShippingCountries, getActiveShippingCountries } = useActiveShippingCountries();
const { saveAddress: saveShippingAddress } = useAddress(AddressType.Shipping);
const {
data: addresses,
Expand All @@ -77,7 +75,7 @@ const {
loading,
} = useAddress(type);
await getActiveShippingCountries();
await useAggregatedCountries().fetchAggregatedCountries();
await getAddresses();
const selectedAddress = ref();
Expand Down
37 changes: 0 additions & 37 deletions apps/web/components/HeroContent/HeroContent.vue

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
"
>
{{ manufacturerResponsibleInfo.postCode }}
<span v-if="manufacturerResponsibleInfo.town"> {{ manufacturerResponsibleInfo.town }},&nbsp;</span>
{{ manufacturerResponsibleInfo.country }}
<span v-if="manufacturerResponsibleInfo.town"> {{ manufacturerResponsibleInfo.town }}</span>
<span v-if="manufacturerResponsibleInfo.town && manufacturerResponsibleInfo.country">, &nbsp;</span>
<span v-if="manufacturerResponsibleInfo.country">{{ manufacturerResponsibleInfo.country }}</span>
</p>
<p v-if="manufacturerResponsibleInfo.phoneNo">{{ t('phone') }}: {{ manufacturerResponsibleInfo.phoneNo }}</p>
<p v-if="manufacturerResponsibleInfo.email">{{ t('email') }}: {{ manufacturerResponsibleInfo.email }}</p>
Expand Down
Loading

0 comments on commit d6a47f5

Please sign in to comment.