@salesforce/retail-react-app 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +179 -173
- package/app/components/_app/index.jsx +49 -8
- package/app/components/_app/index.test.js +63 -2
- package/app/components/_app-config/index.jsx +1 -1
- package/app/components/_app-config/index.test.js +3 -1
- package/app/components/_error/index.jsx +9 -1
- package/app/components/action-card/index.jsx +1 -1
- package/app/components/address-display/index.jsx +1 -1
- package/app/components/basic-tile/index.jsx +7 -1
- package/app/components/breadcrumb/index.jsx +1 -1
- package/app/components/confirmation-modal/index.jsx +1 -1
- package/app/components/confirmation-modal/index.test.js +1 -1
- package/app/components/drawer-menu/index.jsx +1 -1
- package/app/components/dynamic-image/index.jsx +1 -1
- package/app/components/field/index.jsx +1 -1
- package/app/components/footer/index.jsx +2 -2
- package/app/components/forms/address-fields.jsx +6 -1
- package/app/components/forms/credit-card-fields.jsx +9 -1
- package/app/components/forms/form-action-buttons.jsx +1 -1
- package/app/components/forms/login-fields.jsx +1 -1
- package/app/components/forms/password-requirements.jsx +1 -1
- package/app/components/forms/post-checkout-registration-fields.jsx +1 -1
- package/app/components/forms/profile-fields.jsx +1 -1
- package/app/components/forms/promo-code-fields.jsx +1 -1
- package/app/components/forms/registration-fields.jsx +1 -1
- package/app/components/forms/reset-password-fields.jsx +1 -1
- package/app/components/forms/update-password-fields.jsx +6 -1
- package/app/components/header/index.jsx +1 -1
- package/app/components/header/index.test.js +4 -2
- package/app/components/hero/index.jsx +7 -1
- package/app/components/icons/index.jsx +1 -1
- package/app/components/image-gallery/index.jsx +1 -1
- package/app/components/item-variant/item-attributes.jsx +5 -2
- package/app/components/item-variant/item-image.jsx +1 -1
- package/app/components/item-variant/item-price.jsx +3 -2
- package/app/components/link/index.jsx +1 -1
- package/app/components/links-list/index.jsx +8 -1
- package/app/components/links-list/index.test.js +4 -1
- package/app/components/list-menu/index.jsx +1 -1
- package/app/components/loading-spinner/index.jsx +1 -1
- package/app/components/locale-selector/index.jsx +1 -1
- package/app/components/login/index.jsx +7 -1
- package/app/components/nested-accordion/index.jsx +1 -1
- package/app/components/offline-banner/index.jsx +1 -1
- package/app/components/offline-boundary/index.jsx +1 -1
- package/app/components/order-summary/index.jsx +9 -1
- package/app/components/page-action-placeholder/index.jsx +1 -1
- package/app/components/pagination/index.jsx +1 -1
- package/app/components/product-item/index.jsx +1 -1
- package/app/components/product-scroller/index.jsx +8 -1
- package/app/components/product-tile/index.jsx +1 -1
- package/app/components/product-view/index.jsx +17 -4
- package/app/components/product-view/index.test.js +26 -1
- package/app/components/product-view-modal/index.jsx +7 -1
- package/app/components/product-view-modal/index.test.js +1 -1
- package/app/components/promo-code/index.jsx +1 -1
- package/app/components/promo-popover/index.jsx +1 -1
- package/app/components/quantity-picker/index.jsx +6 -1
- package/app/components/radio-card/index.jsx +1 -1
- package/app/components/recommended-products/index.jsx +1 -1
- package/app/components/register/index.jsx +7 -1
- package/app/components/reset-password/index.jsx +1 -1
- package/app/components/responsive/index.jsx +1 -1
- package/app/components/search/index.jsx +1 -1
- package/app/components/search/partials/recent-searches.jsx +1 -1
- package/app/components/search/partials/search-suggestions.jsx +1 -1
- package/app/components/search/partials/suggestions.jsx +1 -1
- package/app/components/section/index.jsx +7 -1
- package/app/components/shared/theme/index.jsx +10 -0
- package/app/components/shared/ui/Accordion/index.jsx +8 -0
- package/app/components/shared/ui/AccordionButton/index.jsx +8 -0
- package/app/components/shared/ui/AccordionIcon/index.jsx +8 -0
- package/app/components/shared/ui/AccordionItem/index.jsx +8 -0
- package/app/components/shared/ui/AccordionPanel/index.jsx +8 -0
- package/app/components/shared/ui/Alert/index.jsx +8 -0
- package/app/components/shared/ui/AlertDialog/index.jsx +8 -0
- package/app/components/shared/ui/AlertDialogBody/index.jsx +8 -0
- package/app/components/shared/ui/AlertDialogContent/index.jsx +8 -0
- package/app/components/shared/ui/AlertDialogFooter/index.jsx +8 -0
- package/app/components/shared/ui/AlertDialogHeader/index.jsx +8 -0
- package/app/components/shared/ui/AlertDialogOverlay/index.jsx +8 -0
- package/app/components/shared/ui/AlertIcon/index.jsx +8 -0
- package/app/components/shared/ui/AlertTitle/index.jsx +8 -0
- package/app/components/shared/ui/AspectRatio/index.jsx +8 -0
- package/app/components/shared/ui/Badge/index.jsx +8 -0
- package/app/components/shared/ui/Box/index.jsx +8 -0
- package/app/components/shared/ui/Breadcrumb/index.jsx +8 -0
- package/app/components/shared/ui/BreadcrumbItem/index.jsx +8 -0
- package/app/components/shared/ui/BreadcrumbLink/index.jsx +8 -0
- package/app/components/shared/ui/Button/index.jsx +8 -0
- package/app/components/shared/ui/ButtonGroup/index.jsx +8 -0
- package/app/components/shared/ui/Center/index.jsx +8 -0
- package/app/components/shared/ui/ChakraProvider/index.jsx +8 -0
- package/app/components/shared/ui/Checkbox/index.jsx +8 -0
- package/app/components/shared/ui/CloseButton/index.jsx +8 -0
- package/app/components/shared/ui/Container/index.jsx +8 -0
- package/app/components/shared/ui/Divider/index.jsx +8 -0
- package/app/components/shared/ui/Drawer/index.jsx +8 -0
- package/app/components/shared/ui/DrawerBody/index.jsx +8 -0
- package/app/components/shared/ui/DrawerCloseButton/index.jsx +8 -0
- package/app/components/shared/ui/DrawerContent/index.jsx +8 -0
- package/app/components/shared/ui/DrawerFooter/index.jsx +8 -0
- package/app/components/shared/ui/DrawerHeader/index.jsx +8 -0
- package/app/components/shared/ui/DrawerOverlay/index.jsx +8 -0
- package/app/components/shared/ui/Fade/index.jsx +8 -0
- package/app/components/shared/ui/Flex/index.jsx +8 -0
- package/app/components/shared/ui/FormControl/index.jsx +8 -0
- package/app/components/shared/ui/FormErrorMessage/index.jsx +8 -0
- package/app/components/shared/ui/FormLabel/index.jsx +8 -0
- package/app/components/shared/ui/Grid/index.jsx +8 -0
- package/app/components/shared/ui/GridItem/index.jsx +8 -0
- package/app/components/shared/ui/HStack/index.jsx +8 -0
- package/app/components/shared/ui/Heading/index.jsx +8 -0
- package/app/components/shared/ui/Icon/index.jsx +8 -0
- package/app/components/shared/ui/IconButton/index.jsx +8 -0
- package/app/components/shared/ui/Image/index.jsx +8 -0
- package/app/components/shared/ui/Img/index.jsx +8 -0
- package/app/components/shared/ui/Input/index.jsx +8 -0
- package/app/components/shared/ui/InputGroup/index.jsx +8 -0
- package/app/components/shared/ui/InputLeftElement/index.jsx +8 -0
- package/app/components/shared/ui/InputRightElement/index.jsx +8 -0
- package/app/components/shared/ui/Link/index.jsx +8 -0
- package/app/components/shared/ui/List/index.jsx +8 -0
- package/app/components/shared/ui/ListItem/index.jsx +8 -0
- package/app/components/shared/ui/Modal/index.jsx +8 -0
- package/app/components/shared/ui/ModalBody/index.jsx +8 -0
- package/app/components/shared/ui/ModalCloseButton/index.jsx +8 -0
- package/app/components/shared/ui/ModalContent/index.jsx +8 -0
- package/app/components/shared/ui/ModalFooter/index.jsx +8 -0
- package/app/components/shared/ui/ModalHeader/index.jsx +8 -0
- package/app/components/shared/ui/ModalOverlay/index.jsx +8 -0
- package/app/components/shared/ui/Popover/index.jsx +8 -0
- package/app/components/shared/ui/PopoverArrow/index.jsx +8 -0
- package/app/components/shared/ui/PopoverBody/index.jsx +8 -0
- package/app/components/shared/ui/PopoverCloseButton/index.jsx +8 -0
- package/app/components/shared/ui/PopoverContent/index.jsx +8 -0
- package/app/components/shared/ui/PopoverFooter/index.jsx +8 -0
- package/app/components/shared/ui/PopoverHeader/index.jsx +8 -0
- package/app/components/shared/ui/PopoverTrigger/index.jsx +8 -0
- package/app/components/shared/ui/Portal/index.jsx +8 -0
- package/app/components/shared/ui/Radio/index.jsx +8 -0
- package/app/components/shared/ui/RadioGroup/index.jsx +8 -0
- package/app/components/shared/ui/Select/index.jsx +8 -0
- package/app/components/shared/ui/SimpleGrid/index.jsx +8 -0
- package/app/components/shared/ui/Skeleton/index.jsx +8 -0
- package/app/components/shared/ui/Spacer/index.jsx +8 -0
- package/app/components/shared/ui/Spinner/index.jsx +8 -0
- package/app/components/shared/ui/Stack/index.jsx +8 -0
- package/app/components/shared/ui/StackDivider/index.jsx +8 -0
- package/app/components/shared/ui/StylesProvider/index.jsx +8 -0
- package/app/components/shared/ui/Text/index.jsx +8 -0
- package/app/components/shared/ui/Tooltip/index.jsx +8 -0
- package/app/components/shared/ui/VStack/index.jsx +8 -0
- package/app/components/shared/ui/Wrap/index.jsx +8 -0
- package/app/components/shared/ui/WrapItem/index.jsx +8 -0
- package/app/components/shared/ui/createStylesContext/index.jsx +8 -0
- package/app/components/shared/ui/extendTheme/index.jsx +8 -0
- package/app/components/shared/ui/index.jsx +107 -0
- package/app/components/shared/ui/useBreakpoint/index.jsx +8 -0
- package/app/components/shared/ui/useBreakpointValue/index.jsx +8 -0
- package/app/components/shared/ui/useDisclosure/index.jsx +8 -0
- package/app/components/shared/ui/useMediaQuery/index.jsx +8 -0
- package/app/components/shared/ui/useMultiStyleConfig/index.jsx +8 -0
- package/app/components/shared/ui/useNumberInput/index.jsx +8 -0
- package/app/components/shared/ui/useRadio/index.jsx +8 -0
- package/app/components/shared/ui/useRadioGroup/index.jsx +8 -0
- package/app/components/shared/ui/useStyleConfig/index.jsx +8 -0
- package/app/components/shared/ui/useStyles/index.jsx +8 -0
- package/app/components/shared/ui/useTheme/index.jsx +8 -0
- package/app/components/shared/ui/useToast/index.jsx +8 -0
- package/app/components/shared/util/SkipNavContent/index.jsx +8 -0
- package/app/components/shared/util/SkipNavLink/index.jsx +8 -0
- package/app/components/shared/util/index.jsx +9 -0
- package/app/components/social-icons/index.jsx +1 -1
- package/app/components/swatch-group/index.jsx +6 -1
- package/app/components/swatch-group/index.test.js +1 -1
- package/app/components/swatch-group/swatch.jsx +6 -1
- package/app/components/toggle-card/index.jsx +7 -1
- package/app/components/with-registration/index.test.js +1 -1
- package/app/hooks/use-add-to-cart-modal.js +1 -1
- package/app/hooks/use-auth-modal.js +1 -1
- package/app/hooks/use-current-basket.js +3 -6
- package/app/hooks/use-toast.js +1 -1
- package/app/hooks/use-toast.test.js +1 -1
- package/app/page-designer/README.md +2 -2
- package/app/page-designer/assets/image-tile/index.jsx +1 -1
- package/app/page-designer/assets/image-with-text/index.jsx +6 -1
- package/app/page-designer/layouts/carousel/index.jsx +1 -1
- package/app/page-designer/layouts/mobileGrid1r1c/index.jsx +1 -1
- package/app/page-designer/layouts/mobileGrid2r1c/index.jsx +1 -1
- package/app/page-designer/layouts/mobileGrid2r2c/index.jsx +1 -1
- package/app/page-designer/layouts/mobileGrid2r3c/index.jsx +1 -1
- package/app/page-designer/layouts/mobileGrid3r1c/index.jsx +1 -1
- package/app/page-designer/layouts/mobileGrid3r2c/index.jsx +1 -1
- package/app/pages/account/addresses.jsx +1 -1
- package/app/pages/account/index.jsx +1 -1
- package/app/pages/account/order-detail.jsx +1 -1
- package/app/pages/account/order-history.jsx +1 -1
- package/app/pages/account/profile.jsx +1 -1
- package/app/pages/account/wishlist/index.jsx +1 -1
- package/app/pages/account/wishlist/partials/wishlist-primary-action.jsx +1 -1
- package/app/pages/account/wishlist/partials/wishlist-secondary-button-group.jsx +5 -1
- package/app/pages/cart/index.jsx +9 -1
- package/app/pages/cart/partials/cart-cta.jsx +1 -1
- package/app/pages/cart/partials/cart-secondary-button-group.jsx +1 -1
- package/app/pages/cart/partials/cart-skeleton.jsx +1 -1
- package/app/pages/cart/partials/cart-title.jsx +1 -1
- package/app/pages/cart/partials/empty-cart.jsx +7 -1
- package/app/pages/checkout/confirmation.jsx +1 -1
- package/app/pages/checkout/index.jsx +10 -1
- package/app/pages/checkout/index.test.js +10 -0
- package/app/pages/checkout/partials/cc-radio-group.jsx +9 -1
- package/app/pages/checkout/partials/checkout-footer.jsx +1 -1
- package/app/pages/checkout/partials/checkout-header.jsx +7 -1
- package/app/pages/checkout/partials/checkout-skeleton.jsx +8 -1
- package/app/pages/checkout/partials/contact-info.jsx +8 -2
- package/app/pages/checkout/partials/payment-form.jsx +9 -1
- package/app/pages/checkout/partials/payment.jsx +10 -1
- package/app/pages/checkout/partials/shipping-address-selection.jsx +8 -1
- package/app/pages/checkout/partials/shipping-options.jsx +10 -1
- package/app/pages/home/index.jsx +1 -1
- package/app/pages/login/index.jsx +1 -1
- package/app/pages/page-not-found/index.jsx +8 -1
- package/app/pages/product-detail/index.jsx +8 -1
- package/app/pages/product-detail/index.mock.js +14 -0
- package/app/pages/product-detail/index.test.js +69 -6
- package/app/pages/product-detail/partials/information-accordion.jsx +1 -1
- package/app/pages/product-list/index.jsx +1 -1
- package/app/pages/product-list/partials/checkbox-refinements.jsx +1 -1
- package/app/pages/product-list/partials/color-refinements.jsx +9 -1
- package/app/pages/product-list/partials/empty-results.jsx +7 -1
- package/app/pages/product-list/partials/link-refinements.jsx +1 -1
- package/app/pages/product-list/partials/page-header.jsx +1 -1
- package/app/pages/product-list/partials/radio-refinements.jsx +7 -1
- package/app/pages/product-list/partials/refinements.jsx +1 -1
- package/app/pages/product-list/partials/selected-refinements.jsx +1 -1
- package/app/pages/product-list/partials/size-refinements.jsx +6 -1
- package/app/pages/registration/index.jsx +1 -1
- package/app/pages/reset-password/index.jsx +7 -1
- package/app/routes.jsx +1 -1
- package/app/ssr.js +9 -8
- package/app/theme/components/project/_app.js +1 -1
- package/app/theme/index.js +1 -1
- package/app/utils/locale.js +1 -1
- package/app/utils/locale.test.js +2 -0
- package/app/utils/responsive-image.js +1 -1
- package/app/utils/test-utils.js +1 -1
- package/config/default.js +1 -1
- package/config/mocks/default.js +1 -1
- package/jest-setup.js +3 -2
- package/jsconfig.json +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,178 +1,184 @@
|
|
|
1
|
+
## v1.0.1 (Jul 26, 2023)
|
|
2
|
+
|
|
3
|
+
- Fix price display when a discounted price is zero [#1361](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1361)
|
|
4
|
+
- Fix price adjustments of a line item when more than one is present [#1362](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1362)
|
|
5
|
+
- Registered user checkout should set order with an email [#1363](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1363)
|
|
6
|
+
|
|
1
7
|
## v1.0.0 (June 15, 2023)
|
|
2
8
|
|
|
3
|
-
-
|
|
4
|
-
-
|
|
5
|
-
-
|
|
6
|
-
-
|
|
9
|
+
- First public release of package on npm under `@salesforce/retail-react-app`
|
|
10
|
+
- Upgrade React v18, React DOM v18, React-hook-form v7, and Chakra 2 libraries [#1166](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1166)
|
|
11
|
+
- Add app `above-header` and product-list `above-page-header` convenience components [#1183](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1183)
|
|
12
|
+
- Migration to "hooks" / `@salesforce/commerce-sdk-react` integration follow the [upgrade guide](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/upgrade-to-v3.html) and [view the diff](https://github.com/SalesforceCommerceCloud/pwa-kit/compare/release-2.7.x...release-3.0.x?diff=unified#files_bucket)
|
|
7
13
|
|
|
8
14
|
## Older Versions Without Namespace
|
|
9
15
|
|
|
10
|
-
The
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
-
|
|
87
|
-
-
|
|
88
|
-
-
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
98
|
-
-
|
|
99
|
-
-
|
|
100
|
-
-
|
|
101
|
-
-
|
|
102
|
-
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
-
|
|
110
|
-
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
-
|
|
117
|
-
-
|
|
118
|
-
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
-
|
|
125
|
-
-
|
|
126
|
-
-
|
|
127
|
-
-
|
|
128
|
-
-
|
|
129
|
-
-
|
|
130
|
-
-
|
|
131
|
-
-
|
|
132
|
-
-
|
|
133
|
-
-
|
|
134
|
-
-
|
|
135
|
-
-
|
|
136
|
-
-
|
|
137
|
-
-
|
|
138
|
-
-
|
|
139
|
-
-
|
|
140
|
-
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
-
|
|
145
|
-
-
|
|
146
|
-
-
|
|
147
|
-
-
|
|
148
|
-
-
|
|
149
|
-
-
|
|
150
|
-
-
|
|
151
|
-
-
|
|
152
|
-
-
|
|
153
|
-
-
|
|
154
|
-
-
|
|
155
|
-
-
|
|
156
|
-
-
|
|
157
|
-
-
|
|
158
|
-
-
|
|
159
|
-
-
|
|
160
|
-
-
|
|
161
|
-
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
-
|
|
166
|
-
-
|
|
167
|
-
-
|
|
168
|
-
-
|
|
169
|
-
-
|
|
170
|
-
-
|
|
171
|
-
-
|
|
172
|
-
-
|
|
173
|
-
-
|
|
174
|
-
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
-
|
|
16
|
+
The versions published below were not published on npm, and the versioning matched that of the PWA Kit SDK. These versions did not use the `@salesforce` namespace.
|
|
17
|
+
|
|
18
|
+
### v2.7.1 (May 11, 2023)
|
|
19
|
+
|
|
20
|
+
- Replace invalid row value with nowrap [#1179](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1179)
|
|
21
|
+
- Add a redirect to login page after user signs out from checkout page [#1172](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1172)
|
|
22
|
+
- PWA Kit should have a mechanism for replacing the access token when a SFRA login state is changed [#1171](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1171)
|
|
23
|
+
- Added session bridge call to login for phased launch [#1159](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1159)
|
|
24
|
+
- Fix Page Designer ImageWithText Link component [#1092](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1092)
|
|
25
|
+
- Remove site alias and locale from location.state.directedFrom path [#1065)](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1065)
|
|
26
|
+
- Product list refinements [#957](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/957)
|
|
27
|
+
- Prevent modal to open when it fails to add an item to cart [#1053](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1053)
|
|
28
|
+
- Make `mergeBasket` conditional more robust [#1048](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1048)
|
|
29
|
+
- Fix addresses not having preferred address first. [#1051](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1051)
|
|
30
|
+
- Changed type of the phone number field to bring up numberic keyboard on mobile devices - W-9871940 [#1016)](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1016)
|
|
31
|
+
|
|
32
|
+
### v2.7.0 (Mar 03, 2023)
|
|
33
|
+
|
|
34
|
+
- Add Page Designer ImageTile component [#967](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/967)
|
|
35
|
+
- Add Page Designer ImageWithText component [#991](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/991)
|
|
36
|
+
- Add Page Designer carousel component [#977](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/977)
|
|
37
|
+
- Add Page Designer layout components [#993](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/993)
|
|
38
|
+
- Support the product-set type [#1019](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1019)
|
|
39
|
+
|
|
40
|
+
### v2.6.0 (Jan 25, 2023)
|
|
41
|
+
|
|
42
|
+
- Mega menu fixes [#875](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/875) and [#910](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/910)
|
|
43
|
+
- Cache SLAS callback using request processor [#884](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/884)
|
|
44
|
+
- Fix padding of footer drawer component [#899](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/899)
|
|
45
|
+
- Update createOrder to send SLAS USID [#920](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/920)
|
|
46
|
+
- Fix PropTypes [#924](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/924)
|
|
47
|
+
- Remove unnecessary map statement [#929](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/929)
|
|
48
|
+
|
|
49
|
+
### v2.5.0 (Jan 5, 2023)
|
|
50
|
+
|
|
51
|
+
- Add instanceType to Einstein activity body [#858](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/858)
|
|
52
|
+
- Do not use a proxy to call Einstein [#857](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/857)
|
|
53
|
+
- Einstein handle variants [#867](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/867)
|
|
54
|
+
- Fix cc exp year [#874](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/874)
|
|
55
|
+
|
|
56
|
+
### v2.4.0 (Dec 1, 2022)
|
|
57
|
+
|
|
58
|
+
- Dynamic footer Copyright date [#741](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/741)
|
|
59
|
+
- Footer copyright: remove the remaining hardcoded year [#760](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/760)
|
|
60
|
+
- ImageGallery uses image.link when DIS is not set [#786](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/786)
|
|
61
|
+
- Use default locale as target if none is specified [#788](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/788)
|
|
62
|
+
- Password change bug fix [#803](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/803)
|
|
63
|
+
- pwa-kit-dev command for tailing logs [#789](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/789)
|
|
64
|
+
- Update usages of zzrf-001 ODS instance to the new short URL format [#816](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/816)
|
|
65
|
+
|
|
66
|
+
### v2.3.0 (Oct 27, 2022)
|
|
67
|
+
|
|
68
|
+
- Fix locale `alias` by including `locale` object inside the MultiSite Context. [#716](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/716)
|
|
69
|
+
- Updated translations. [#725](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/725)
|
|
70
|
+
- Add new Einstein API activities. [#714](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/714)
|
|
71
|
+
- Fix search field to recognize `“&”` character. [#736](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/736)
|
|
72
|
+
- Fix filters on search results page. [#742](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/742)
|
|
73
|
+
- Dynamic footer copyright date. [#741](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/741)
|
|
74
|
+
- Bugfix: image gallery thumbnails not working without DIS [#786](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/786)
|
|
75
|
+
- Ensure that a valid target locale is use if none is provided [#788](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/788)
|
|
76
|
+
|
|
77
|
+
### v2.2.0 (Aug 25, 2022)
|
|
78
|
+
|
|
79
|
+
- Update zzrf-001 url [#694](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/694)
|
|
80
|
+
- Optimize Server-side performance [#667](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/667)
|
|
81
|
+
- Remove references to session bridging [#684](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/684)
|
|
82
|
+
|
|
83
|
+
### v2.1.0 (Jul 05, 2022)
|
|
84
|
+
|
|
85
|
+
- Update translations [#643](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/643)
|
|
86
|
+
- Update translations [#653](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/653)
|
|
87
|
+
- Add bundlesize test back into CI [#652](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/652)
|
|
88
|
+
- Fix UI bug on notifications badge [#620](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/620)
|
|
89
|
+
|
|
90
|
+
### v2.0.0 (May 16, 2022)
|
|
91
|
+
|
|
92
|
+
- Update translation docs [#570](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/570)
|
|
93
|
+
- Fixed loading correct amount of skeletons [#576] (<https://github.com/SalesforceCommerceCloud/pwa-kit/pull/576>)
|
|
94
|
+
- Remove manifest path [#582](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/582)
|
|
95
|
+
- Fix Verbose ShellJS Command [#588](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/588)
|
|
96
|
+
- Drop node 12 support for [#589](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/589)
|
|
97
|
+
- Multi-site, Fix the case when no site aliases is set [#551](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/551)
|
|
98
|
+
- Fix invalid refresh token [#528](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/528)
|
|
99
|
+
- Add valid token check before using refresh token on login [#533](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/533)
|
|
100
|
+
- Fix localization scripts to output to the correct default locale [#539](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/539)
|
|
101
|
+
- Merge guest cart and registered cart [#540](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/540)
|
|
102
|
+
- Move retail react app jest setup out from pwa-kit-dev [#545](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/545)
|
|
103
|
+
- Remove legacy remote proxy, which allowed remote environments to use proxy configs in package.json [#425](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/425)
|
|
104
|
+
- Rename 'pwa' directory into 'template-retail-react-app' [#485](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/485)
|
|
105
|
+
- Optimize visibility-off.svg [#512](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/512)
|
|
106
|
+
- Support Multi-site implementation using dynamic config [#469](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/469)
|
|
107
|
+
- Service worker loading for dev server [#464](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/464)
|
|
108
|
+
- Environment Specific Configuration Support [#477](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/447)
|
|
109
|
+
|
|
110
|
+
### v1.5.0 (Mar 17, 2022)
|
|
111
|
+
|
|
112
|
+
- Support storing authentication tokens in cookie [#429](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/429)
|
|
113
|
+
- Make sure the forgot-password modal also shows up in the checkout flow [#373](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/373)
|
|
114
|
+
- On Windows, the locale selector dropdown in the footer now showing all of the options properly [#381](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/381)
|
|
115
|
+
- Import cross-fetch to make OCAPI client isomorphic [#382](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/382)
|
|
116
|
+
- Multi-site implementation for Retail React App [#391](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/391)
|
|
117
|
+
|
|
118
|
+
### v1.4.0 (Jan 27, 2022)
|
|
119
|
+
|
|
120
|
+
- Do not send HSTS header during local development [#288](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/288)
|
|
121
|
+
- Add constants for `<meta>` tags `theme-color` and `apple-mobile-web-app-title` [#287](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/287)
|
|
122
|
+
- Upgrade to React 17 [#278](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/278)
|
|
123
|
+
- Import preliminary translations [#324](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/324)
|
|
124
|
+
- Remove old dependencies that are no longer used [#317](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/317)
|
|
125
|
+
|
|
126
|
+
### v1.3.0 (Jan 06, 2022)
|
|
127
|
+
|
|
128
|
+
- Remove Einstein from home page [#208](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/208)
|
|
129
|
+
- Add git2gus config to allow git2gus integration [210](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/210)
|
|
130
|
+
- Set common HTTP security headers [#263](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/263)
|
|
131
|
+
- Add message ids to all the translated text, so they provide context for the translators [#239](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/239) [#207](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/207) [#195](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/195)
|
|
132
|
+
- Minor translation fixes [260](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/260) [#252](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/252)
|
|
133
|
+
- Provide Url Customization for the Retail React App [#228](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/228/files)
|
|
134
|
+
- Add an image component to allow for easier-implementation of responsive images [#186](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/186)
|
|
135
|
+
- Add shop Products section with products from the Catalog [#216](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/216)
|
|
136
|
+
- Remove `upgrade-insecure-requests` for local development [#270](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/270)
|
|
137
|
+
- Fix the missing out-of-stock message on mobile screens [#231](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/231)
|
|
138
|
+
- Fix order summary prices on the check out page misaligned on mobile [#233](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/233)
|
|
139
|
+
- Skip irrelevant jobs on CI on forked PR [#237](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/237) [#240](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/240)
|
|
140
|
+
- Add webpack plugin [#255](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/255)
|
|
141
|
+
- Combine config files [#256](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/256)
|
|
142
|
+
- Improve unsupported locale error message [#225](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/225)
|
|
143
|
+
- Add github template [#226](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/226)
|
|
144
|
+
- Fix shipping method description overflows the price section [#232](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/232)
|
|
145
|
+
- Fix show applied promotion codes case sensitive issue [#224](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/224)
|
|
146
|
+
- Fix section subtitle incorrect prop warning [#282](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/282)
|
|
147
|
+
|
|
148
|
+
### v1.2.0 (Nov 18, 2021)
|
|
149
|
+
|
|
150
|
+
- Simplify homepage for Retail React App [#201](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/201)
|
|
151
|
+
- Ensure `cookieId` value is sent always for Einstein recommendations [#179](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/179)
|
|
152
|
+
- Remove `x-powered-by` HTTP response header [#165](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/165)
|
|
153
|
+
- For search engine crawlers, add `hreflang` links to the current page's html [#137](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/137)
|
|
154
|
+
- Use the preferred currency when switching locales. [#105](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/105)
|
|
155
|
+
- Integrate wishlist with einstein recommended products. [#131](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/131)
|
|
156
|
+
- When adding a new locale, minimize configuring the locale selector UI by having a list of commonly-used locales [#175](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/175)
|
|
157
|
+
- Enable adding wishlist item to the cart. [#158](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/158)
|
|
158
|
+
- Rename CartItemVariant to ItemVariantProvider [#155](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/155)
|
|
159
|
+
- Enabling pseudo locale now affects only the loading of the translation messages. The rest of the app still knows about English and the other locales. [#177](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/177)
|
|
160
|
+
- Allow individual Commerce API calls to pass in a different locale/currency and override the global value. [#177](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/177)
|
|
161
|
+
- Fix regression with loading the correct translation file [#193](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/193)
|
|
162
|
+
- Upgrade `chakra-ui/react` to `^1.7.1` version. [#204](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/204)
|
|
163
|
+
- Rename the `extract-messages` and `compile-messages` commands to `extract-default-translations` and `compile-translations` [#160](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/160)
|
|
164
|
+
- Enable favourite icons on product tiles for guest users [#173](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/173)
|
|
165
|
+
- Fix Missing Locale Param for Commerce API Calls [#174](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/174)
|
|
166
|
+
- Add cache control header to product details page [#172](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/172)
|
|
167
|
+
- Clear SLAS tokens when OID is changed [#178](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/178)
|
|
168
|
+
|
|
169
|
+
### v1.1.0 (Sep 27, 2021)
|
|
170
|
+
|
|
171
|
+
- Fix wishlist bugs and provide better hooks for wishlist features. [#64](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/64)
|
|
172
|
+
- Lazy load Popover component. [#134](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/134)
|
|
173
|
+
- Fix pseudo local command to use `en-XB`. [#101](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/101)
|
|
174
|
+
- Ensure generated projects ship with a working .gitignore file. [#95](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/95)
|
|
175
|
+
- Remove eslint rule which check for Salesforce copyright. [#104](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/104)
|
|
176
|
+
- Improve error page design. [#74](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/74)
|
|
177
|
+
- Localize cart and checkout messages. [#106](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/106)
|
|
178
|
+
- Add default cache control header to home page. [#103](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/103)
|
|
179
|
+
- Security - `inquirer` package upgrade. [#121](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/121)
|
|
180
|
+
- New quantity picker. [#102](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/102)
|
|
181
|
+
|
|
182
|
+
### v1.0.0 (Sep 08, 2021)
|
|
183
|
+
|
|
184
|
+
- PWA Kit General Availability and open source. 🎉
|
|
@@ -22,7 +22,11 @@ import {
|
|
|
22
22
|
} from '@salesforce/commerce-sdk-react'
|
|
23
23
|
import * as queryKeyHelpers from '@salesforce/commerce-sdk-react/hooks/ShopperProducts/queryKeyHelpers'
|
|
24
24
|
// Chakra
|
|
25
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
Box,
|
|
27
|
+
useDisclosure,
|
|
28
|
+
useStyleConfig
|
|
29
|
+
} from '@salesforce/retail-react-app/app/components/shared/ui'
|
|
26
30
|
import {SkipNavLink, SkipNavContent} from '@chakra-ui/skip-nav'
|
|
27
31
|
|
|
28
32
|
// Contexts
|
|
@@ -46,6 +50,7 @@ import {AuthModal, useAuthModal} from '@salesforce/retail-react-app/app/hooks/us
|
|
|
46
50
|
import {AddToCartModalProvider} from '@salesforce/retail-react-app/app/hooks/use-add-to-cart-modal'
|
|
47
51
|
import useMultiSite from '@salesforce/retail-react-app/app/hooks/use-multi-site'
|
|
48
52
|
import {useCurrentCustomer} from '@salesforce/retail-react-app/app/hooks/use-current-customer'
|
|
53
|
+
import {useCurrentBasket} from '@salesforce/retail-react-app/app/hooks/use-current-basket'
|
|
49
54
|
|
|
50
55
|
// Localization
|
|
51
56
|
import {IntlProvider} from 'react-intl'
|
|
@@ -71,7 +76,7 @@ import Seo from '@salesforce/retail-react-app/app/components/seo'
|
|
|
71
76
|
|
|
72
77
|
const onClient = typeof window !== 'undefined'
|
|
73
78
|
|
|
74
|
-
/*
|
|
79
|
+
/*
|
|
75
80
|
The categories tree can be really large! For performance reasons,
|
|
76
81
|
we only load the level 0 categories on server side, and load the rest
|
|
77
82
|
on client side to reduce SSR page size.
|
|
@@ -83,7 +88,7 @@ const useLazyLoadCategories = () => {
|
|
|
83
88
|
parameters: {id: CAT_MENU_DEFAULT_ROOT_CATEGORY, levels: CAT_MENU_DEFAULT_NAV_SSR_DEPTH}
|
|
84
89
|
})
|
|
85
90
|
|
|
86
|
-
const ids = levelZeroCategoriesQuery.data?.[itemsKey]
|
|
91
|
+
const ids = levelZeroCategoriesQuery.data?.[itemsKey]?.map((category) => category.id)
|
|
87
92
|
const queries = useCategoryBulk(ids, {
|
|
88
93
|
enabled: onClient && ids?.length > 0
|
|
89
94
|
})
|
|
@@ -139,10 +144,23 @@ const App = (props) => {
|
|
|
139
144
|
l10nConfig: site.l10n
|
|
140
145
|
})
|
|
141
146
|
|
|
147
|
+
// If the translation file exists, it'll be served directly from static folder (and won't reach this code here).
|
|
148
|
+
// However, if the file is missing, the App would render a 404 page.
|
|
149
|
+
const is404ForMissingTranslationFile = /\/static\/translations\/compiled\/[^.]+\.json$/.test(
|
|
150
|
+
location?.pathname
|
|
151
|
+
)
|
|
152
|
+
|
|
142
153
|
// Fetch the translation message data using the target locale.
|
|
143
154
|
const {data: messages} = useQuery({
|
|
144
|
-
queryKey: ['app', '
|
|
145
|
-
queryFn: () =>
|
|
155
|
+
queryKey: ['app', 'translations', 'messages', targetLocale],
|
|
156
|
+
queryFn: () => {
|
|
157
|
+
if (is404ForMissingTranslationFile) {
|
|
158
|
+
// Return early to prevent an infinite loop
|
|
159
|
+
// Otherwise, it'll continue to fetch the missing translation file again
|
|
160
|
+
return {}
|
|
161
|
+
}
|
|
162
|
+
return fetchTranslations(targetLocale)
|
|
163
|
+
},
|
|
146
164
|
enabled: isServer
|
|
147
165
|
})
|
|
148
166
|
|
|
@@ -160,8 +178,11 @@ const App = (props) => {
|
|
|
160
178
|
{parameters: {customerId: customer.customerId}},
|
|
161
179
|
{enabled: !!customer.customerId && !isServer}
|
|
162
180
|
)
|
|
181
|
+
const {data: basket} = useCurrentBasket()
|
|
182
|
+
|
|
163
183
|
const createBasket = useShopperBasketsMutation('createBasket')
|
|
164
184
|
const updateBasket = useShopperBasketsMutation('updateBasket')
|
|
185
|
+
const updateCustomerForBasket = useShopperBasketsMutation('updateCustomerForBasket')
|
|
165
186
|
|
|
166
187
|
useEffect(() => {
|
|
167
188
|
// Create a new basket if the current customer doesn't have one.
|
|
@@ -170,14 +191,34 @@ const App = (props) => {
|
|
|
170
191
|
body: {}
|
|
171
192
|
})
|
|
172
193
|
}
|
|
194
|
+
}, [baskets])
|
|
195
|
+
|
|
196
|
+
useEffect(() => {
|
|
173
197
|
// update the basket currency if it doesn't match the current locale currency
|
|
174
|
-
if (
|
|
198
|
+
if (basket?.currency && basket?.currency !== currency) {
|
|
175
199
|
updateBasket.mutate({
|
|
176
|
-
parameters: {basketId:
|
|
200
|
+
parameters: {basketId: basket.basketId},
|
|
177
201
|
body: {currency}
|
|
178
202
|
})
|
|
179
203
|
}
|
|
180
|
-
}, [
|
|
204
|
+
}, [basket?.currency])
|
|
205
|
+
|
|
206
|
+
useEffect(() => {
|
|
207
|
+
// update the basket customer email
|
|
208
|
+
if (
|
|
209
|
+
basket &&
|
|
210
|
+
customer?.isRegistered &&
|
|
211
|
+
customer?.email &&
|
|
212
|
+
customer?.email !== basket?.customerInfo?.email
|
|
213
|
+
) {
|
|
214
|
+
updateCustomerForBasket.mutate({
|
|
215
|
+
parameters: {basketId: basket.basketId},
|
|
216
|
+
body: {
|
|
217
|
+
email: customer.email
|
|
218
|
+
}
|
|
219
|
+
})
|
|
220
|
+
}
|
|
221
|
+
}, [customer?.isRegistered, customer?.email, basket?.customerInfo?.email])
|
|
181
222
|
|
|
182
223
|
useEffect(() => {
|
|
183
224
|
// Listen for online status changes.
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react'
|
|
8
|
-
import {screen} from '@testing-library/react'
|
|
8
|
+
import {screen, waitFor} from '@testing-library/react'
|
|
9
9
|
import {Helmet} from 'react-helmet'
|
|
10
|
+
import {rest} from 'msw'
|
|
10
11
|
|
|
11
12
|
import App from '@salesforce/retail-react-app/app/components/_app/index.jsx'
|
|
12
13
|
import {renderWithProviders} from '@salesforce/retail-react-app/app/utils/test-utils'
|
|
@@ -14,7 +15,9 @@ import {DEFAULT_LOCALE} from '@salesforce/retail-react-app/app/utils/test-utils'
|
|
|
14
15
|
import useMultiSite from '@salesforce/retail-react-app/app/hooks/use-multi-site'
|
|
15
16
|
import messages from '@salesforce/retail-react-app/app/static/translations/compiled/en-GB.json'
|
|
16
17
|
import mockConfig from '@salesforce/retail-react-app/config/mocks/default'
|
|
18
|
+
|
|
17
19
|
jest.mock('../../hooks/use-multi-site', () => jest.fn())
|
|
20
|
+
|
|
18
21
|
let windowSpy
|
|
19
22
|
beforeAll(() => {
|
|
20
23
|
jest.spyOn(console, 'log').mockImplementation(jest.fn())
|
|
@@ -60,7 +63,6 @@ describe('App', () => {
|
|
|
60
63
|
<p>Any children here</p>
|
|
61
64
|
</App>
|
|
62
65
|
)
|
|
63
|
-
screen.debug()
|
|
64
66
|
expect(screen.getByRole('main')).toBeInTheDocument()
|
|
65
67
|
expect(screen.getByText('Any children here')).toBeInTheDocument()
|
|
66
68
|
})
|
|
@@ -82,4 +84,63 @@ describe('App', () => {
|
|
|
82
84
|
expect(hreflangLinks.some((link) => hasGeneralLocale(link))).toBe(true)
|
|
83
85
|
expect(hreflangLinks.some((link) => link.hrefLang === 'x-default')).toBe(true)
|
|
84
86
|
})
|
|
87
|
+
|
|
88
|
+
test('App component updates the basket with correct currency and customer email', async () => {
|
|
89
|
+
const customerEmail = 'email@test.com'
|
|
90
|
+
|
|
91
|
+
// Test basket. _app will be manipulating this basket's currency and customerInfo.email for this test
|
|
92
|
+
const basket = {
|
|
93
|
+
basketId: 'basket_id',
|
|
94
|
+
currency: 'CAD',
|
|
95
|
+
customerInfo: {
|
|
96
|
+
customerId: 'customer_id',
|
|
97
|
+
email: ''
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
jest.mock('../../hooks/use-current-customer', () => {
|
|
102
|
+
return {
|
|
103
|
+
useCurrentCustomer: jest.fn().mockImplementation(() => {
|
|
104
|
+
return {data: basket, derivedData: {hasBasket: true, totalItems: 0}}
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
jest.mock('../../hooks/use-current-basket', () => {
|
|
110
|
+
return {
|
|
111
|
+
useCurrentBasket: jest.fn().mockImplementation(() => {
|
|
112
|
+
return {
|
|
113
|
+
data: basket,
|
|
114
|
+
derivedData: {
|
|
115
|
+
hasBasket: true,
|
|
116
|
+
totalItems: 0
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
})
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
global.server.use(
|
|
124
|
+
// mock updating basket currency
|
|
125
|
+
rest.patch('*/baskets/:basketId', (req, res, ctx) => {
|
|
126
|
+
basket.currency = 'GBP'
|
|
127
|
+
return res(ctx.json(basket))
|
|
128
|
+
}),
|
|
129
|
+
// mock adding guest email to basket
|
|
130
|
+
rest.put('*/baskets/:basketId/customer', (req, res, ctx) => {
|
|
131
|
+
basket.customerInfo.email = customerEmail
|
|
132
|
+
return res(ctx.json(basket))
|
|
133
|
+
})
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
useMultiSite.mockImplementation(() => resultUseMultiSite)
|
|
137
|
+
renderWithProviders(
|
|
138
|
+
<App targetLocale={DEFAULT_LOCALE} defaultLocale={DEFAULT_LOCALE} messages={messages} />
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
await waitFor(() => {
|
|
142
|
+
expect(basket.currency).toBe('GBP')
|
|
143
|
+
expect(basket.customerInfo.email).toBe(customerEmail)
|
|
144
|
+
})
|
|
145
|
+
})
|
|
85
146
|
})
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react'
|
|
8
8
|
import PropTypes from 'prop-types'
|
|
9
|
-
import {ChakraProvider} from '@
|
|
9
|
+
import {ChakraProvider} from '@salesforce/retail-react-app/app/components/shared/ui'
|
|
10
10
|
|
|
11
11
|
// Removes focus for non-keyboard interactions for the whole application
|
|
12
12
|
import 'focus-visible/dist/focus-visible'
|
|
@@ -17,8 +17,10 @@ import {rest} from 'msw'
|
|
|
17
17
|
import {registerUserToken} from '@salesforce/retail-react-app/app/utils/test-utils'
|
|
18
18
|
|
|
19
19
|
describe('AppConfig', () => {
|
|
20
|
+
let originalFetch
|
|
20
21
|
beforeAll(() => {
|
|
21
22
|
jest.spyOn(window.localStorage, 'setItem')
|
|
23
|
+
originalFetch = global.fetch
|
|
22
24
|
global.fetch = jest.fn().mockImplementation(() => mockConfig.mockFetchOCAPISessions)
|
|
23
25
|
})
|
|
24
26
|
|
|
@@ -45,7 +47,7 @@ describe('AppConfig', () => {
|
|
|
45
47
|
afterAll(() => {
|
|
46
48
|
window.localStorage.setItem.mockRestore()
|
|
47
49
|
global.fetch.mockClear()
|
|
48
|
-
|
|
50
|
+
global.fetch = originalFetch
|
|
49
51
|
})
|
|
50
52
|
|
|
51
53
|
test('renders', async () => {
|