Skip to content

Commit

Permalink
Pwa 2484 refactor (#4341)
Browse files Browse the repository at this point in the history
* Make order confirmation its own page

* Add refresh support for order confirmation page for logged in users

* Update unit tests for useOrderConfirmationPage module

* Update tests for useItemsReview module

* Update OrderConfirmationPage tests

* Run prettier

* Fix linting issues

* Fix broken checkout flow for guest and logged in users

---------

Co-authored-by: James Calcaben <[email protected]>
  • Loading branch information
glo11372 and jcalcaben authored Oct 14, 2024
1 parent 6d38221 commit 78280c8
Show file tree
Hide file tree
Showing 17 changed files with 836 additions and 390 deletions.
Original file line number Diff line number Diff line change
@@ -1,102 +1,129 @@
export default {
cart: {
id: 'GXtkt675mPd3gYuvhWLd5iw5ekVoDj1b',
total_quantity: 7,
items: [
export default [
{
id: '29568',
product: {
id: 1093,
name: 'Jillian Top',
thumbnail: {
url:
'https://master-7rqtwti-c5v7sxvquxwl4.us-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/t/vt12-kh_main_2.jpg',
__typename: 'ProductImage'
},
__typename: 'ConfigurableProduct'
},
quantity: 3,
configurable_options: [
{
configurable_product_option_uid: 179,
option_label: 'Fashion Color',
configurable_product_option_value_uid: 18,
value_label: 'Peach',
__typename: 'SelectedConfigurableOption'
},
{
configurable_product_option_uid: 182,
option_label: 'Fashion Size',
configurable_product_option_value_uid: 27,
value_label: 'M',
__typename: 'SelectedConfigurableOption'
}
],
__typename: 'ConfigurableCartItem'
},
{
id: '29570',
product: {
id: 1115,
name: 'Juno Sweater',
thumbnail: {
url:
'https://master-7rqtwti-c5v7sxvquxwl4.us-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/s/vsw02-pe_main_2.jpg',
__typename: 'ProductImage'
},
__typename: 'ConfigurableProduct'
},
quantity: 1,
configurable_options: [
{
configurable_product_option_uid: 179,
option_label: 'Fashion Color',
configurable_product_option_value_uid: 21,
value_label: 'Rain',
__typename: 'SelectedConfigurableOption'
},
{
id: '29568',
product: {
id: 1093,
name: 'Jillian Top',
thumbnail: {
url:
'https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/t/vt12-kh_main_2.jpg',
__typename: 'ProductImage'
},
__typename: 'ConfigurableProduct'
},
quantity: 3,
configurable_options: [
{
configurable_product_option_uid: 179,
option_label: 'Fashion Color',
configurable_product_option_value_uid: 18,
value_label: 'Peach',
__typename: 'SelectedConfigurableOption'
},
{
configurable_product_option_uid: 182,
option_label: 'Fashion Size',
configurable_product_option_value_uid: 27,
value_label: 'M',
__typename: 'SelectedConfigurableOption'
}
],
__typename: 'ConfigurableCartItem'
configurable_product_option_uid: 182,
option_label: 'Fashion Size',
configurable_product_option_value_uid: 29,
value_label: 'XS',
__typename: 'SelectedConfigurableOption'
}
],
__typename: 'ConfigurableCartItem'
},
{
id: '29572',
product: {
id: 1152,
name: 'Angelina Tank Dress',
thumbnail: {
url:
'https://master-7rqtwti-c5v7sxvquxwl4.us-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/d/vd01-ll_main_2.jpg',
__typename: 'ProductImage'
},
__typename: 'ConfigurableProduct'
},
quantity: 3,
configurable_options: [
{
configurable_product_option_uid: 179,
option_label: 'Fashion Color',
configurable_product_option_value_uid: 20,
value_label: 'Lilac',
__typename: 'SelectedConfigurableOption'
},
{
configurable_product_option_uid: 182,
option_label: 'Fashion Size',
configurable_product_option_value_uid: 26,
value_label: 'L',
__typename: 'SelectedConfigurableOption'
}
],
__typename: 'ConfigurableCartItem'
}
];

export const singleItem = [
{
id: '29568',
product: {
id: 1093,
name: 'Jillian Top',
thumbnail: {
url:
'https://master-7rqtwti-c5v7sxvquxwl4.us-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/t/vt12-kh_main_2.jpg',
__typename: 'ProductImage'
},
__typename: 'ConfigurableProduct'
},
quantity: 3,
configurable_options: [
{
id: '29570',
product: {
id: 1115,
name: 'Juno Sweater',
thumbnail: {
url:
'https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/s/vsw02-pe_main_2.jpg',
__typename: 'ProductImage'
},
__typename: 'ConfigurableProduct'
},
quantity: 1,
configurable_options: [
{
configurable_product_option_uid: 179,
option_label: 'Fashion Color',
configurable_product_option_value_uid: 21,
value_label: 'Rain',
__typename: 'SelectedConfigurableOption'
},
{
configurable_product_option_uid: 182,
option_label: 'Fashion Size',
configurable_product_option_value_uid: 29,
value_label: 'XS',
__typename: 'SelectedConfigurableOption'
}
],
__typename: 'ConfigurableCartItem'
configurable_product_option_uid: 179,
option_label: 'Fashion Color',
configurable_product_option_value_uid: 18,
value_label: 'Peach',
__typename: 'SelectedConfigurableOption'
},
{
id: '29572',
product: {
id: 1152,
name: 'Angelina Tank Dress',
thumbnail: {
url:
'https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/d/vd01-ll_main_2.jpg',
__typename: 'ProductImage'
},
__typename: 'ConfigurableProduct'
},
quantity: 3,
configurable_options: [
{
configurable_product_option_uid: 179,
option_label: 'Fashion Color',
configurable_product_option_value_uid: 20,
value_label: 'Lilac',
__typename: 'SelectedConfigurableOption'
},
{
configurable_product_option_uid: 182,
option_label: 'Fashion Size',
configurable_product_option_value_uid: 26,
value_label: 'L',
__typename: 'SelectedConfigurableOption'
}
],
__typename: 'ConfigurableCartItem'
configurable_product_option_uid: 182,
option_label: 'Fashion Size',
configurable_product_option_value_uid: 27,
value_label: 'M',
__typename: 'SelectedConfigurableOption'
}
],
__typename: 'Cart'
__typename: 'ConfigurableCartItem'
}
};
];
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,100 @@
exports[`returns correct shape 1`] = `
Object {
"configurableThumbnailSource": "parent",
"hasErrors": false,
"isLoading": true,
"items": Array [],
"setShowAllItems": [Function],
"showAllItems": false,
"totalQuantity": 0,
}
`;

exports[`uses static data if provided 1`] = `
Object {
"configurableThumbnailSource": "parent",
"hasErrors": false,
"isLoading": true,
"items": Array [
Object {
"name": "static item",
"__typename": "ConfigurableCartItem",
"configurable_options": Array [
Object {
"__typename": "SelectedConfigurableOption",
"configurable_product_option_uid": 179,
"configurable_product_option_value_uid": 18,
"option_label": "Fashion Color",
"value_label": "Peach",
},
Object {
"__typename": "SelectedConfigurableOption",
"configurable_product_option_uid": 182,
"configurable_product_option_value_uid": 27,
"option_label": "Fashion Size",
"value_label": "M",
},
],
"id": "29568",
"product": Object {
"__typename": "ConfigurableProduct",
"id": 1093,
"name": "Jillian Top",
"thumbnail": Object {
"__typename": "ProductImage",
"url": "https://master-7rqtwti-c5v7sxvquxwl4.us-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/t/vt12-kh_main_2.jpg",
},
},
"quantity": 3,
},
Object {
"__typename": "ConfigurableCartItem",
"configurable_options": Array [
Object {
"__typename": "SelectedConfigurableOption",
"configurable_product_option_uid": 179,
"configurable_product_option_value_uid": 21,
"option_label": "Fashion Color",
"value_label": "Rain",
},
Object {
"__typename": "SelectedConfigurableOption",
"configurable_product_option_uid": 182,
"configurable_product_option_value_uid": 29,
"option_label": "Fashion Size",
"value_label": "XS",
},
],
"id": "29570",
"product": Object {
"__typename": "ConfigurableProduct",
"id": 1115,
"name": "Juno Sweater",
"thumbnail": Object {
"__typename": "ProductImage",
"url": "https://master-7rqtwti-c5v7sxvquxwl4.us-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/s/vsw02-pe_main_2.jpg",
},
},
"quantity": 1,
},
Object {
"__typename": "ConfigurableCartItem",
"configurable_options": Array [
Object {
"__typename": "SelectedConfigurableOption",
"configurable_product_option_uid": 179,
"configurable_product_option_value_uid": 20,
"option_label": "Fashion Color",
"value_label": "Lilac",
},
Object {
"__typename": "SelectedConfigurableOption",
"configurable_product_option_uid": 182,
"configurable_product_option_value_uid": 26,
"option_label": "Fashion Size",
"value_label": "L",
},
],
"id": "29572",
"product": Object {
"__typename": "ConfigurableProduct",
"id": 1152,
"name": "Angelina Tank Dress",
"thumbnail": Object {
"__typename": "ProductImage",
"url": "https://master-7rqtwti-c5v7sxvquxwl4.us-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/d/vd01-ll_main_2.jpg",
},
},
"quantity": 3,
},
],
"setShowAllItems": [Function],
"showAllItems": true,
"totalQuantity": 1,
"showAllItems": false,
"totalQuantity": 7,
}
`;
Loading

0 comments on commit 78280c8

Please sign in to comment.