Skip to content

Commit

Permalink
Merge branch 'develop' into PWA-3180
Browse files Browse the repository at this point in the history
  • Loading branch information
glo82145 committed Mar 18, 2024
2 parents 3b88d69 + 2dad3a2 commit 407a429
Show file tree
Hide file tree
Showing 15 changed files with 53 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@magento/experience-platform-connector",
"version": "1.0.5",
"version": "1.0.6",
"publishConfig": {
"access": "public"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Array [
},
"productType": "ConfigurableProduct",
"sku": "VSK02",
"topLevelSku": "VSK02",
},
"quantity": 1,
},
Expand Down Expand Up @@ -82,6 +83,7 @@ Array [
},
"productType": "SimpleProduct",
"sku": "VA17-SI-NA",
"topLevelSku": "VA17-SI-NA",
},
"quantity": 2,
},
Expand Down Expand Up @@ -130,6 +132,7 @@ Array [
},
"productType": "ConfigurableProduct",
"sku": "VA04",
"topLevelSku": "VA04",
},
"quantity": 3,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Object {
},
"productType": "ConfigurableProduct",
"sku": "VSK02",
"topLevelSku": "VSK02",
},
"quantity": 1,
},
Expand Down Expand Up @@ -78,6 +79,7 @@ Object {
},
"productType": "SimpleProduct",
"sku": "VA17-SI-NA",
"topLevelSku": "VA17-SI-NA",
},
"quantity": 2,
},
Expand Down Expand Up @@ -122,6 +124,7 @@ Object {
},
"productType": "ConfigurableProduct",
"sku": "VA04",
"topLevelSku": "VA04",
},
"quantity": 3,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ describe('handle()', () => {
},
"productType": "ConfigurableProduct",
"sku": "VSK02",
"topLevelSku": "VSK02",
},
"quantity": 1,
},
Expand Down Expand Up @@ -116,6 +117,7 @@ describe('handle()', () => {
},
"productType": "SimpleProduct",
"sku": "VA17-SI-NA",
"topLevelSku": "VA17-SI-NA",
},
"quantity": 2,
},
Expand Down Expand Up @@ -164,6 +166,7 @@ describe('handle()', () => {
},
"productType": "ConfigurableProduct",
"sku": "VA04",
"topLevelSku": "VA04",
},
"quantity": 3,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ describe('handle()', () => {
},
"productType": "ConfigurableProduct",
"sku": "VP08",
"topLevelSku": "VP08",
},
"quantity": 3,
},
Expand Down Expand Up @@ -138,6 +139,7 @@ describe('handle()', () => {
},
"productType": "ConfigurableProduct",
"sku": "VA09",
"topLevelSku": "VA09",
},
"quantity": 1,
},
Expand Down Expand Up @@ -173,6 +175,7 @@ describe('handle()', () => {
},
"productType": "SimpleProduct",
"sku": "VA22-SI-NA",
"topLevelSku": "VA22-SI-NA",
},
"quantity": 1,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export const getFormattedProducts = products => {
product: {
name: name,
sku: sku,
topLevelSku: product.sku,
productType: type,
pricing: {
regularPrice: prices.price.value,
Expand Down
2 changes: 1 addition & 1 deletion packages/extensions/upward-security-headers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@magento/upward-security-headers",
"version": "1.0.14",
"version": "1.0.15",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/extensions/venia-sample-backends/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@magento/venia-sample-backends",
"version": "0.0.10",
"version": "0.0.11",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/extensions/venia-sample-eventing/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@magento/venia-sample-eventing",
"version": "0.0.6",
"version": "0.0.7",
"publishConfig": {
"access": "public"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@magento/venia-sample-language-packs",
"version": "0.0.14",
"version": "0.0.15",
"publishConfig": {
"access": "public"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@magento/venia-sample-payments-checkmo",
"version": "0.0.12",
"version": "0.0.13",
"publishConfig": {
"access": "public"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`#useSuggestedCategory returns valid destination 1`] = `"/search.html?query=bar&category_id%5Bfilter%5D=foo%2C1"`;
exports[`#useSuggestedCategory returns valid destination 1`] = `"/search.html?query=bar&category_uid%5Bfilter%5D=foo%2C1"`;
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const setSearchParams = (existing, options) => {
const { categoryId, label, searchValue } = options;

params.set('query', searchValue);
params.set('category_id[filter]', `${label}${DELIMITER}${categoryId}`);
params.set('category_uid[filter]', `${label}${DELIMITER}${categoryId}`);

return `${params}`;
};
Expand Down
13 changes: 13 additions & 0 deletions packages/peregrine/lib/talons/SignIn/__tests__/useSignIn.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,19 @@ test('handleForgotPassword triggers callbacks', () => {
expect(initialProps.showForgotPassword).toHaveBeenCalled();
});

test('forgotPasswordHandleEnterKeyPress triggers callbacks on click', () => {
const mockUsername = 'fry@planetexpress.com';
const mockApi = {
getValue: jest.fn().mockReturnValue(mockUsername)
};
var event = new KeyboardEvent('keydown', { keyCode: 13 });
document.dispatchEvent(event);

const { result } = renderHookWithProviders();
act(() => result.current.setFormApi(mockApi));
act(() => result.current.forgotPasswordHandleEnterKeyPress());
});

test('handleCreateAccount triggers callbacks', () => {
const mockUsername = 'fry@planetexpress.com';
const mockApi = {
Expand Down
29 changes: 19 additions & 10 deletions packages/peregrine/lib/talons/SignIn/useSignIn.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import { useCartContext } from '../../context/cart';
import { useUserContext } from '../../context/user';
import { useAwaitQuery } from '../../hooks/useAwaitQuery';
import { retrieveCartId } from '../../store/actions/cart';
import { useDropdown } from '@magento/peregrine/lib/hooks/useDropdown';

import DEFAULT_OPERATIONS from './signIn.gql';
import { useEventingContext } from '../../context/eventing';

export const useSignIn = props => {
const {
handleTriggerClick,
getCartDetailsQuery,
setDefaultUsername,
showCreateAccount,
Expand Down Expand Up @@ -64,10 +64,17 @@ export const useSignIn = props => {
const formApiRef = useRef(null);
const setFormApi = useCallback(api => (formApiRef.current = api), []);

const { setExpanded: setCurrencyMenuIsOpen } = useDropdown();

const handleTrigger = useCallback(() => {
// Toggle Stores Menu.
setCurrencyMenuIsOpen(isOpen => !isOpen);
}, [setCurrencyMenuIsOpen]);

const handleSubmit = useCallback(
async ({ email, password }) => {
setIsSigningIn(true);
handleTriggerClick();
handleTrigger();
try {
// Get source cart id (guest cart id).
const sourceCartId = cartId;
Expand Down Expand Up @@ -98,13 +105,15 @@ export const useSignIn = props => {
});
const destinationCartId = await retrieveCartId();

// Merge the guest cart into the customer cart.
await mergeCarts({
variables: {
destinationCartId,
sourceCartId
}
});
if (destinationCartId != sourceCartId) {
// Merge the guest cart into the customer cart.
await mergeCarts({
variables: {
destinationCartId,
sourceCartId
}
});
}

// Ensure old stores are updated with any new data.

Expand Down Expand Up @@ -145,7 +154,7 @@ export const useSignIn = props => {
getCartDetails,
fetchCartDetails,
dispatch,
handleTriggerClick
handleTrigger
]
);

Expand Down

0 comments on commit 407a429

Please sign in to comment.