Skip to content

Commit a7d27b8

Browse files
committed
Merge branch '20220613-add-getting-started-section' of https://github.com/vuestorefront/magento2 into 20220613-add-getting-started-section
2 parents 0149778 + dc32989 commit a7d27b8

File tree

24 files changed

+152
-79
lines changed

24 files changed

+152
-79
lines changed

.github/workflows/conventional-pr-name.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- uses: actions/checkout@v1
1616

1717
- name: Setup node
18-
uses: actions/setup-node@v2
18+
uses: actions/setup-node@v3
1919
with:
2020
node-version: "16"
2121

.github/workflows/publish-npm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
uses: actions/checkout@v2
1919

2020
- name: Setup node
21-
uses: actions/setup-node@v2
21+
uses: actions/setup-node@v3
2222
with:
2323
node-version: "16"
2424
registry-url: "https://registry.npmjs.org/"

.github/workflows/test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@ jobs:
2525
uses: actions/checkout@v2
2626

2727
- name: Setup node
28-
uses: actions/setup-node@v2
28+
uses: actions/setup-node@v3
2929
with:
3030
node-version: '16.13.0'
31-
cache: 'yarn'
3231

3332
- name: Install dependencies
3433
run: yarn install

packages/api-client/src/api/addProductsToCart/addProductsToCart.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@ export default gql`
185185
}
186186
}
187187
}
188+
user_errors {
189+
code
190+
message
191+
}
188192
}
189193
}
190194
`;

packages/api-client/src/types/API.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@ import { DocumentNode, ExecutionResult } from 'graphql';
33
import { CustomQuery } from '@vue-storefront/core';
44
import {
55
AddConfigurableProductsToCartInput,
6-
AddConfigurableProductsToCartMutation,
76
AddSimpleProductsToCartInput,
8-
AddSimpleProductsToCartMutation,
97
AddDownloadableProductsToCartInput,
10-
AddDownloadableProductsToCartMutation,
118
AddVirtualProductsToCartInput,
12-
AddVirtualProductsToCartMutation,
139
AppliedCoupon,
1410
ApplyCouponToCartInput,
1511
ApplyCouponToCartMutation,
@@ -95,19 +91,22 @@ import {
9591
RemoveProductsFromWishlistMutationVariables,
9692
RemoveProductsFromWishlistMutation,
9793
GetCustomerAddressesQuery,
98-
AddProductsToCartMutation,
9994
CmsBlockQuery,
10095
GroupedProduct,
10196
AddBundleProductsToCartInput,
102-
AddBundleProductsToCartMutation,
10397
RequestPasswordResetEmailMutation,
10498
RequestPasswordResetEmailMutationVariables,
10599
ResetPasswordMutationVariables,
106100
ResetPasswordMutation,
107101
ChangeCustomerPasswordMutation,
108102
CreateCustomerAddressMutation,
109103
DownloadableProduct,
110-
VirtualProduct, CustomerOrdersFilterInput, RoutableInterface,
104+
VirtualProduct,
105+
CustomerOrdersFilterInput,
106+
RoutableInterface,
107+
AddProductsToCartOutput,
108+
AddConfigurableProductsToCartMutation,
109+
AddBundleProductsToCartMutation, AddSimpleProductsToCartMutation, AddDownloadableProductsToCartMutation, AddVirtualProductsToCartMutation,
111110
} from './GraphQL';
112111
import { SetPaymentMethodOnCartInputs } from '../api/setPaymentMethodOnCart';
113112
import { CustomerProductReviewParams } from '../api/customerProductReview';
@@ -179,7 +178,7 @@ export interface MagentoApiMethods {
179178
addProductsToCart(
180179
input: AddProductsToCartInput,
181180
customQuery?: CustomQuery
182-
): Promise<FetchResult<AddProductsToCartMutation>>;
181+
): Promise<FetchResult<{ addProductsToCart: AddProductsToCartOutput }>>;
183182

184183
addProductToWishList(
185184
input: AddProductsToWishlistMutationVariables,

packages/theme/helpers/checkout/address.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const addressFromApiToForm = (address: CustomerAddress | CartAddressInter
2525
apartment: address.street?.[1],
2626
city: address.city,
2727
region: (address as CustomerAddress)?.region?.region_code ?? (address as CartAddressInterface).region.code,
28-
country_code: (address as CustomerAddress)?.country_code ?? (address as CartAddressInterface).region.code,
28+
country_code: (address as CustomerAddress)?.country_code ?? (address as CartAddressInterface).country.code,
2929
postcode: address.postcode,
3030
telephone: address.telephone,
3131
});

packages/theme/lang/de.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default {
1515
"Back to home": "Zurück Zur Startseite",
1616
"Back to homepage": "Zurück zur Homepage",
1717
"Billing": "Abrechnung",
18-
"Billing Address": "Rechnungsadresse",
18+
"Billing address": "Rechnungsadresse",
1919
"Brand": "Marke",
2020
"Cancel": "Abbrechen",
2121
"Cart": "Warenkorb",
@@ -156,13 +156,14 @@ export default {
156156
"Set up newsletter": "Richten Sie Ihren Newsletter ein und wir senden Ihnen wöchentlich Informationen zu neuen Produkten und Trends aus den von Ihnen ausgewählten Bereichen",
157157
"Share your look": "Teile deinen Look",
158158
"Shipping": "Versand",
159-
"Shipping Address": "Lieferanschrift",
160-
"Shipping Details": "Versanddetails",
161-
"Shipping Method": "Versandart",
159+
"Shipping address": "Lieferanschrift",
160+
"Shipping details": "Versanddetails",
161+
"Shipping method": "Versandart",
162162
"Show":"Show",
163163
"show more": "mehr anzeigen",
164164
"Show on page": "Auf Seite anzeigen",
165165
"Sign in": "Einloggen",
166+
"Size guide": "Größentabelle",
166167
"Sign Up for Newsletter": "Anmeldung für Newsletter",
167168
"Sort by": "Sortieren nach",
168169
"Sort: Default": "Standard",

packages/theme/lang/en.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default {
1515
"Back to home": "Back to home",
1616
"Back to homepage": "Back to homepage",
1717
"Billing": "Billing",
18-
"Billing Address": "Billing Address",
18+
"Billing address": "Billing address",
1919
"Brand": "Brand",
2020
"Cancel": "Cancel",
2121
"Cart": "Cart",
@@ -151,13 +151,14 @@ export default {
151151
"Set up newsletter": "Set up your newsletter and we will send you information about new products and trends from the sections you selected every week.",
152152
"Share your look": "Share your look",
153153
"Shipping": "Shipping",
154-
"Shipping Address": "Shipping Address",
155-
"Shipping Details": "Shipping Details",
156-
"Shipping Method": "Shipping Method",
154+
"Shipping address": "Shipping address",
155+
"Shipping details": "Shipping details",
156+
"Shipping method": "Shipping method",
157157
"Show":"Show",
158158
"show more": "show more",
159159
"Show on page": "Show on page",
160160
"Sign in": "Sign in",
161+
"Size guide": "Size guide",
161162
"Sign Up for Newsletter": "Sign Up for Newsletter",
162163
"Sort by": "Sort by",
163164
"Sort: Default": "Default",

packages/theme/modules/catalog/product/components/product-types/bundle/BundleProductSelector.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@
7373
>
7474
Add to Cart
7575
</SfButton>
76+
<SfAlert
77+
:style="{ visibility: !!addToCartError ? 'visible' : 'hidden'}"
78+
class="product__add-to-cart-error"
79+
:message="addToCartError"
80+
type="danger"
81+
/>
7682
</div>
7783
</template>
7884
<script lang="ts">
@@ -82,6 +88,7 @@ import {
8288
SfQuantitySelector,
8389
SfRadio,
8490
SfButton,
91+
SfAlert,
8592
} from '@storefront-ui/vue';
8693
import {
8794
computed, defineComponent, PropType, ref, watch,
@@ -105,6 +112,7 @@ export default defineComponent({
105112
SfPrice,
106113
SfQuantitySelector,
107114
SfRadio,
115+
SfAlert,
108116
},
109117
props: {
110118
canAddToCart: {
@@ -119,9 +127,10 @@ export default defineComponent({
119127
},
120128
emits: ['update-bundle', 'update-price'],
121129
setup(props, { emit }) {
122-
const { loading, addItem } = useCart();
130+
const { loading, addItem, error: cartError } = useCart();
123131
const bundleProduct = computed(() => getBundleProducts(props.product));
124132
const selectedOptions = ref({});
133+
const addToCartError = computed(() => cartError.value?.addItem?.message);
125134
126135
selectedOptions.value = bundleProductInitialSelector(bundleProduct.value);
127136
@@ -185,6 +194,7 @@ export default defineComponent({
185194
getProductName,
186195
getProductPrice,
187196
selectedOptions,
197+
addToCartError,
188198
};
189199
},
190200
});

packages/theme/modules/catalog/product/components/product-types/configurable/ConfigurableProduct.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@
132132
class="product__add-to-cart"
133133
@click="addItem({ product, quantity: parseInt(qty) })"
134134
/>
135+
<SfAlert
136+
:style="{ visibility: !!addToCartError ? 'visible' : 'hidden'}"
137+
class="product__add-to-cart-error"
138+
:message="addToCartError"
139+
type="danger"
140+
/>
135141
<div class="product__additional-actions">
136142
<AddToWishlist
137143
:is-in-wishlist="isInWishlist"
@@ -162,6 +168,7 @@ import {
162168
SfPrice,
163169
SfRating,
164170
SfSelect,
171+
SfAlert,
165172
} from '@storefront-ui/vue';
166173
import {
167174
ref,
@@ -210,6 +217,7 @@ export default defineComponent({
210217
SfPrice,
211218
SfRating,
212219
SfSelect,
220+
SfAlert,
213221
AddToWishlist,
214222
SvgImage,
215223
ProductTabs,
@@ -230,7 +238,9 @@ export default defineComponent({
230238
const product = toRef(props, 'product');
231239
const route = useRoute();
232240
const router = useRouter();
233-
const { addItem, loading: isCartLoading, canAddToCart } = useCart();
241+
const {
242+
addItem, error: cartError, loading: isCartLoading, canAddToCart,
243+
} = useCart();
234244
const { productGallery, imageSizes } = useProductGallery(product);
235245
const { activeTab, setActiveTab, openNewReviewTab } = useProductTabs();
236246
@@ -264,7 +274,7 @@ export default defineComponent({
264274
265275
const totalReviews = computed(() => getTotalReviews(props.product));
266276
const averageRating = computed(() => getAverageRating(props.product));
267-
277+
const addToCartError = computed(() => cartError.value?.addItem?.message);
268278
const updateProductConfiguration = (label: string, value: string) => {
269279
if (productConfiguration.value[label] === value) return;
270280
@@ -304,6 +314,7 @@ export default defineComponent({
304314
openNewReviewTab,
305315
activeTab,
306316
TabsConfig,
317+
addToCartError,
307318
};
308319
},
309320
});

0 commit comments

Comments
 (0)