@shopgate/engage 7.30.0-alpha.8 → 7.30.0-alpha.9

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.
@@ -22,7 +22,6 @@ const messageStyles = {
22
22
 
23
23
  /**
24
24
  * The CartProduct component.
25
- * @param {Object} props The component props.
26
25
  * @returns {JSX}
27
26
  */
28
27
  const CartItemProduct = () => {
@@ -15,7 +15,6 @@ import { useCartItem, useCartItemProduct } from "./CartItem.hooks";
15
15
  import { container, containerInactive, imageColumn, detailsColumn, priceColumnWide, productName, productProperties, column, quantityPicker, quantityPickerDisabled, price, priceInfo, priceListEntry, priceListPromo, contextMenu, messageContainer, messageContainerRope } from "./CartItemProductLayoutWide.style";
16
16
 
17
17
  /**
18
- * @param {Object} props The component properties.
19
18
  * @returns {JSX}
20
19
  */
21
20
  const CartItemProductLayoutWide = () => {
@@ -42,11 +42,11 @@ export const locationColumn = css(column, {
42
42
  lineHeight: '1.625rem',
43
43
  fontWeight: 500,
44
44
  flexGrow: 2
45
- });
45
+ }).toString();
46
46
  export const statusColumn = css(column, {
47
47
  fontSize: '1.25rem',
48
48
  lineHeight: '1.625rem'
49
- });
49
+ }).toString();
50
50
  export const productName = css({
51
51
  fontSize: '1.25rem',
52
52
  lineHeight: '1.5rem',
@@ -5,8 +5,7 @@ import { label } from "./CartItemProductLayoutWideFulfillmentLabel.style";
5
5
  import { useCartItemProduct } from "./CartItem.hooks";
6
6
 
7
7
  /**
8
- * @param {Object} props The component props
9
- * @returns {JSX}
8
+ * @returns {JSX.Element}
10
9
  */
11
10
  const CartItemProductLayoutWideFulfillmentLabel = () => {
12
11
  const {
@@ -7,4 +7,4 @@ export const label = css({
7
7
  color: `var(--color-secondary, ${colors.accent})`,
8
8
  fontSize: '0.875rem',
9
9
  marginTop: 'auto'
10
- });
10
+ }).toString();
@@ -5,7 +5,7 @@ import { useCartItem, useCartItemProduct } from "./CartItem.hooks";
5
5
  import { column, locationColumn, statusColumn, quantityPickerDisabled } from "./CartItemProductLayoutWide.style";
6
6
 
7
7
  /**
8
- * @returns {JSX}
8
+ * @returns {JSX.Element}
9
9
  */
10
10
  const CartItemProductLayoutWide = () => {
11
11
  const {
@@ -4,8 +4,7 @@ import { button, ripple } from "./CartItemProductLayoutWideRemoveItem.style";
4
4
  import { useCartItemProduct } from "./CartItem.hooks";
5
5
 
6
6
  /**
7
- * @param {Object} props The component props
8
- * @returns {JSX}
7
+ * @returns {JSX.Element}
9
8
  */
10
9
  const CartItemProductLayoutWideRemoveItem = () => {
11
10
  const {
@@ -9,7 +9,7 @@ import { useCartItemProduct } from "./CartItem.hooks";
9
9
  import { caption } from "./CartItemProductPriceCaption.style";
10
10
 
11
11
  /**
12
- * @returns {JSX}
12
+ * @returns {JSX.Element}
13
13
  */
14
14
  const CartItemProductPriceCaption = ({
15
15
  className
@@ -27,7 +27,10 @@ const styles = {
27
27
 
28
28
  /**
29
29
  * @param {Object} props The component props
30
- * @returns {JSX}
30
+ * @param {Object} [props.classes] CSS class names
31
+ * @param {boolean} [props.isSubtotal] Whether to show subtotal prices
32
+ * @param {boolean} [props.showLabels] Whether to show promotion labels
33
+ * @returns {JSX.Element}
31
34
  */
32
35
  const CartItemProductPriceList = ({
33
36
  classes,
@@ -73,7 +73,9 @@ const mapDispatchToProps = dispatch => ({
73
73
 
74
74
  /**
75
75
  * @param {Object} props The component props
76
- * @returns {JSX}
76
+ * @param {string} props.text The promotional text
77
+ * @param {Function} props.showText The function to show the promotional text
78
+ * @returns {JSX.Element}
77
79
  */
78
80
  const PromotionalTextInfoIcon = ({
79
81
  text,
@@ -10,7 +10,9 @@ import { root } from "./CartItemSubstitution.style";
10
10
  /**
11
11
  * Renders the cart reservation card label.
12
12
  * @param {Object} props The component props.
13
- * @returns {JSX}
13
+ * @param {Function} props.setSubstitutionAllowed The action to set substitution allowed flag.
14
+ * @param {boolean} props.editable Whether the substitution option is editable.
15
+ * @returns {JSX.Element}
14
16
  */
15
17
  const CartItemSubstitution = ({
16
18
  setSubstitutionAllowed,
@@ -72,6 +72,7 @@ const initialOptInFormState = {
72
72
 
73
73
  /**
74
74
  * Checkout Provider
75
+ * @param {CheckoutProviderProps} props The component props.
75
76
  * @returns {JSX.Element}
76
77
  */
77
78
  const CheckoutProvider = ({
@@ -448,13 +449,18 @@ const CheckoutProvider = ({
448
449
  }, children);
449
450
  };
450
451
  CheckoutProvider.defaultProps = {
452
+ billingAddress: null,
453
+ campaignAttribution: null,
454
+ fulfillmentSlot: null,
455
+ isGuestCheckout: false,
456
+ isPickupContactSelectionEnabled: false,
457
+ isShippingAddressSelectionEnabled: false,
458
+ order: null,
451
459
  orderInitialized: false,
452
460
  orderReadOnly: false,
453
461
  orderReserveOnly: false,
454
- isShippingAddressSelectionEnabled: false,
455
- isPickupContactSelectionEnabled: false,
456
- isGuestCheckout: false,
457
- campaignAttribution: null
462
+ pickupAddress: null,
463
+ shippingAddress: null
458
464
  };
459
465
  export default connect(CheckoutProvider);
460
466
  /* eslint-enable no-unused-expressions */
@@ -1,11 +1,18 @@
1
1
  import React, { useState, useCallback, useMemo, useEffect } from 'react';
2
2
  import ArrowDrop from '@shopgate/pwa-ui-shared/icons/ArrowDropIcon';
3
+ import PropTypes from 'prop-types';
3
4
  import { chevronButton, chevronUp, chevronDown, open } from "./SideNavigationCategoriesItem.style";
4
5
  import SideNavigationItem from "./SideNavigationItem";
5
6
 
6
7
  /**
7
8
  * The SideNavigationCategoriesItem component
8
- * @returns {JSX}
9
+ * @param {Object} props The component props.
10
+ * @param {number} props.level The nesting level.
11
+ * @param {string} props.label The item label.
12
+ * @param {string} props.href The item href.
13
+ * @param {JSX.Element} props.children The nested items.
14
+ * @param {boolean} props.forceActive Whether the item should be forced open.
15
+ * @returns {JSX.Element}
9
16
  */
10
17
  const SideNavigationNestedItem = ({
11
18
  level,
@@ -7,11 +7,7 @@ jest.mock('@shopgate/engage/core', () => ({
7
7
  text: string => string
8
8
  }
9
9
  }));
10
- jest.mock('@shopgate/engage/components', () => ({
11
- Accordion: ({
12
- children
13
- }) => children
14
- }));
10
+ jest.mock('@shopgate/engage/components');
15
11
  jest.mock('@shopgate/engage/filter', () => ({
16
12
  FilterItem: ({
17
13
  children
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopgate/engage",
3
- "version": "7.30.0-alpha.8",
3
+ "version": "7.30.0-alpha.9",
4
4
  "description": "Shopgate's ENGAGE library.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Shopgate <support@shopgate.com>",
@@ -17,17 +17,15 @@
17
17
  "dependencies": {
18
18
  "@emotion/react": "^11.14.0",
19
19
  "@shopgate/native-modules": "1.0.0-beta.25",
20
- "@shopgate/pwa-common": "7.30.0-alpha.8",
21
- "@shopgate/pwa-common-commerce": "7.30.0-alpha.8",
22
- "@shopgate/pwa-core": "7.30.0-alpha.8",
23
- "@shopgate/pwa-ui-ios": "7.30.0-alpha.8",
24
- "@shopgate/pwa-ui-material": "7.30.0-alpha.8",
25
- "@shopgate/pwa-ui-shared": "7.30.0-alpha.8",
20
+ "@shopgate/pwa-common": "7.30.0-alpha.9",
21
+ "@shopgate/pwa-common-commerce": "7.30.0-alpha.9",
22
+ "@shopgate/pwa-core": "7.30.0-alpha.9",
23
+ "@shopgate/pwa-ui-ios": "7.30.0-alpha.9",
24
+ "@shopgate/pwa-ui-material": "7.30.0-alpha.9",
25
+ "@shopgate/pwa-ui-shared": "7.30.0-alpha.9",
26
26
  "@stripe/react-stripe-js": "^1.16.5",
27
27
  "@stripe/stripe-js": "^1.3.1",
28
28
  "@virtuous/conductor": "~2.5.0",
29
- "babel-plugin-transform-es3-member-expression-literals": "^6.8.0",
30
- "babel-plugin-transform-es3-property-literals": "^6.8.0",
31
29
  "color": "^3.1.2",
32
30
  "focus-trap-react": "^11.0.3",
33
31
  "immer": "^8.0.1",
@@ -35,7 +33,7 @@
35
33
  "leaflet": "^1.8.0",
36
34
  "leaflet-gesture-handling": "^1.2.2",
37
35
  "lodash": "^4.17.21",
38
- "moment": "^2.27.0",
36
+ "moment": "^2.30.1",
39
37
  "react-helmet": "^6.1.0",
40
38
  "react-leaflet": "^3.2.5",
41
39
  "react-phone-number-input": "^3.2.16",
@@ -47,7 +45,7 @@
47
45
  },
48
46
  "devDependencies": {
49
47
  "classnames": "2.5.1",
50
- "jest-mock-console": "^0.4.2",
48
+ "jest-mock-console": "^2.0.0",
51
49
  "lodash": "^4.17.21",
52
50
  "prop-types": "~15.8.1",
53
51
  "react": "~16.14.0",
@@ -22,7 +22,8 @@ const ButtonWidget = () => {
22
22
  classes
23
23
  } = useStyles();
24
24
  const {
25
- config
25
+ config,
26
+ isPreview
26
27
  } = useWidget();
27
28
  const {
28
29
  text,
@@ -32,12 +33,14 @@ const ButtonWidget = () => {
32
33
  push
33
34
  } = useNavigation();
34
35
  const handleClick = useCallback(e => {
35
- e.stopPropagation();
36
36
  if (!link) return;
37
+ if (!isPreview) {
38
+ e.stopPropagation();
39
+ }
37
40
  push({
38
41
  pathname: link
39
42
  });
40
- }, [link, push]);
43
+ }, [link, isPreview, push]);
41
44
  if (!text) return null;
42
45
  return /*#__PURE__*/React.createElement("div", {
43
46
  className: classes.root
@@ -3,16 +3,18 @@ import { mount, shallow } from 'enzyme';
3
3
  import { PickerUtilize as Picker } from '@shopgate/engage/components';
4
4
  import Options from "./index";
5
5
  jest.mock('@shopgate/engage/components');
6
- jest.mock('@shopgate/engage/product/contexts', () => ({
7
- ProductContext: {
8
- Consumer: jest.fn(({
9
- children
10
- }) => children({
6
+ jest.mock('@shopgate/engage/product/components', () => ({
7
+ PriceDifference: () => null
8
+ }));
9
+ jest.mock('@shopgate/engage/product/contexts', () => {
10
+ const ReactCopy = jest.requireActual('react');
11
+ return {
12
+ ProductContext: ReactCopy.createContext({
11
13
  setOption: jest.fn(),
12
14
  currency: 'EUR'
13
- }))
14
- }
15
- }));
15
+ })
16
+ };
17
+ });
16
18
 
17
19
  // Mock the redux connect() method instead of providing a fake store.
18
20
  jest.mock("./connector", () => obj => {
@@ -1,9 +1,8 @@
1
1
  import React from 'react';
2
2
  import { shallow } from 'enzyme';
3
3
  import ItemImage from "./index";
4
- jest.mock('@shopgate/engage/components', () => ({
5
- ProductImage: () => null
6
- }));
4
+ jest.mock('@shopgate/engage/components');
5
+ jest.mock('@shopgate/engage/product');
7
6
  describe('<ItemImage />', () => {
8
7
  it('should render', () => {
9
8
  const wrapper = shallow(/*#__PURE__*/React.createElement(ItemImage, {
@@ -4,6 +4,7 @@ import ItemName from "./index";
4
4
  jest.mock('@shopgate/engage/product', () => ({
5
5
  ProductName: () => null
6
6
  }));
7
+ jest.mock('@shopgate/engage/components');
7
8
  const props = {
8
9
  productId: '1234',
9
10
  name: 'Foo'
@@ -5,11 +5,7 @@ import ItemPrice from "./index";
5
5
  jest.mock('@shopgate/engage/product', () => ({
6
6
  ProductGridPrice: () => null
7
7
  }));
8
- jest.mock('@shopgate/engage/components', () => ({
9
- Portal: ({
10
- children
11
- }) => children
12
- }));
8
+ jest.mock('@shopgate/engage/components');
13
9
  jest.mock('@shopgate/engage/category', () => ({
14
10
  PRODUCT_ITEM_PRICE: 'PRODUCT_ITEM_PRICE',
15
11
  PRODUCT_ITEM_PRICE_AFTER: 'PRODUCT_ITEM_PRICE_AFTER',