@shopgate/engage 7.32.0-beta.16 → 7.32.0-beta.18

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.
@@ -7,8 +7,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
7
7
  const useStyles = makeStyles()(theme => ({
8
8
  inputStyle: {
9
9
  border: 'none',
10
- background: theme.palette.background.emphasized,
11
- color: theme.contrastColor(theme.palette.background.emphasized),
10
+ background: theme.components.input.background,
11
+ color: theme.components.input.text,
12
12
  display: 'block',
13
13
  fontSize: theme.typography.caption.fontSize,
14
14
  textAlign: 'center',
@@ -13,6 +13,9 @@ const useStyles = makeStyles()(theme => ({
13
13
  left: theme.spacing(2),
14
14
  right: theme.spacing(2),
15
15
  borderTop: `1px solid ${theme.components.separatorLine.borderColor}`
16
+ },
17
+ '&:first-child::before': {
18
+ display: 'none'
16
19
  }
17
20
  }
18
21
  }));
@@ -10,6 +10,13 @@ const {
10
10
  currency
11
11
  } = appConfig;
12
12
  const useStyles = makeStyles()(theme => ({
13
+ priceRange: {
14
+ display: 'flex',
15
+ flexWrap: 'wrap',
16
+ alignItems: 'center',
17
+ columnGap: theme.spacing(0.5),
18
+ rowGap: theme.spacing(1)
19
+ },
13
20
  editableField: {
14
21
  color: theme.palette.text.primary,
15
22
  fontWeight: theme.typography.fontWeightMedium,
@@ -20,6 +27,16 @@ const useStyles = makeStyles()(theme => ({
20
27
  margin: theme.spacing(0, 0.5),
21
28
  border: `1px solid ${theme.components.input.border}`,
22
29
  borderRadius: 3,
30
+ appearance: 'textfield',
31
+ WebkitAppearance: 'textfield',
32
+ '&::-webkit-outer-spin-button': {
33
+ WebkitAppearance: 'none',
34
+ margin: 0
35
+ },
36
+ '&::-webkit-inner-spin-button': {
37
+ WebkitAppearance: 'none',
38
+ margin: 0
39
+ },
23
40
  ':focus': {
24
41
  borderColor: theme.components.border.medium
25
42
  },
@@ -58,7 +75,7 @@ const useStyles = makeStyles()(theme => ({
58
75
  * @param {number} length Amount of characters the field has to fit.
59
76
  * @returns {string}
60
77
  */
61
- const fieldWidth = length => `${length + 2}ch`;
78
+ const fieldWidth = length => `${length + 1}ch`;
62
79
 
63
80
  /**
64
81
  * The filter price range slider label component.
@@ -133,6 +150,7 @@ function Label(props) {
133
150
  }), /*#__PURE__*/_jsxs(I18n.Text, {
134
151
  string: "price.range",
135
152
  "aria-hidden": true,
153
+ className: classes.priceRange,
136
154
  children: [/*#__PURE__*/_jsx(I18n.Placeholder, {
137
155
  forKey: "fromPrice",
138
156
  children: /*#__PURE__*/_jsxs("span", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopgate/engage",
3
- "version": "7.32.0-beta.16",
3
+ "version": "7.32.0-beta.18",
4
4
  "description": "Shopgate's ENGAGE library.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Shopgate <support@shopgate.com>",
@@ -18,12 +18,12 @@
18
18
  "dependencies": {
19
19
  "@emotion/react": "^11.14.0",
20
20
  "@shopgate/native-modules": "1.0.0-beta.34",
21
- "@shopgate/pwa-common": "7.32.0-beta.16",
22
- "@shopgate/pwa-common-commerce": "7.32.0-beta.16",
23
- "@shopgate/pwa-core": "7.32.0-beta.16",
24
- "@shopgate/pwa-ui-ios": "7.32.0-beta.16",
25
- "@shopgate/pwa-ui-material": "7.32.0-beta.16",
26
- "@shopgate/pwa-ui-shared": "7.32.0-beta.16",
21
+ "@shopgate/pwa-common": "7.32.0-beta.18",
22
+ "@shopgate/pwa-common-commerce": "7.32.0-beta.18",
23
+ "@shopgate/pwa-core": "7.32.0-beta.18",
24
+ "@shopgate/pwa-ui-ios": "7.32.0-beta.18",
25
+ "@shopgate/pwa-ui-material": "7.32.0-beta.18",
26
+ "@shopgate/pwa-ui-shared": "7.32.0-beta.18",
27
27
  "@stripe/react-stripe-js": "^1.16.5",
28
28
  "@stripe/stripe-js": "^1.44.1",
29
29
  "@virtuous/conductor": "~2.5.0",
@@ -1 +1 @@
1
- {"version":3,"file":"ProductRatingStars.d.ts","sourceRoot":"","sources":["../../../../product/components/ProductRatingStars/ProductRatingStars.tsx"],"names":[],"mappings":"AAiBA,UAAU,WAAW;IACnB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,OAAO,CAAC;CAClC;mFAQE,WAAW;AA4Bd,wBAAwC"}
1
+ {"version":3,"file":"ProductRatingStars.d.ts","sourceRoot":"","sources":["../../../../product/components/ProductRatingStars/ProductRatingStars.tsx"],"names":[],"mappings":"AAeA,UAAU,WAAW;IACnB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,OAAO,CAAC;CAClC;mFAQE,WAAW;AAmBd,wBAAwC"}
@@ -1,13 +1,10 @@
1
- import { memo, useMemo } from 'react';
1
+ import { memo } from 'react';
2
2
  import { useSelector } from 'react-redux';
3
3
  import appConfig from '@shopgate/pwa-common/helpers/config';
4
4
  import { getProductRating } from '@shopgate/pwa-common-commerce/product/selectors/product';
5
5
  import { RatingStars } from '@shopgate/engage/components';
6
6
  import useShowEmptyRatingStars from "../../hooks/useShowEmptyRatingStars";
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
- const {
9
- hasReviews
10
- } = appConfig;
11
8
  /**
12
9
  * The product RatingStars component.
13
10
  */
@@ -21,15 +18,7 @@ const ProductRatingStars = ({
21
18
  productId
22
19
  }));
23
20
  const showEmptyRatingStars = useShowEmptyRatingStars();
24
- const showRatings = useMemo(() => {
25
- if (hasReviews && (rating?.average ?? 0) > 0) {
26
- return true;
27
- }
28
- if (hasReviews && showEmptyRatingStars && rating) {
29
- return true;
30
- }
31
- return false;
32
- }, [rating, showEmptyRatingStars]);
21
+ const showRatings = appConfig.hasReviews && ((rating?.average ?? 0) > 0 || showEmptyRatingStars && Boolean(rating));
33
22
  if (!showRatings) {
34
23
  return null;
35
24
  }
@@ -1,16 +1,14 @@
1
- import React, { memo, useMemo } from 'react';
1
+ import React, { memo } from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import { useSelector } from 'react-redux';
3
4
  import appConfig from '@shopgate/pwa-common/helpers/config';
5
+ import { getProductRating } from '@shopgate/pwa-common-commerce/product/selectors/product';
4
6
  import { RatingStars, SurroundPortals } from '@shopgate/engage/components';
5
7
  import { PRODUCT_RATING } from '@shopgate/engage/product/constants';
6
8
  import RatingCount from '@shopgate/engage/reviews/components/Reviews/components/RatingCount';
7
9
  import { useShowEmptyRatingStars } from '@shopgate/engage/product/hooks';
8
10
  import { makeStyles } from '@shopgate/engage/styles';
9
- import connect from "./connector";
10
11
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
- const {
12
- hasReviews
13
- } = appConfig;
14
12
  const useStyles = makeStyles()(theme => ({
15
13
  container: {
16
14
  display: 'flex',
@@ -37,21 +35,16 @@ const scrollToRating = () => {
37
35
  * @return {JSX.Element}
38
36
  */
39
37
  const Rating = ({
40
- rating
38
+ productId
41
39
  }) => {
42
40
  const {
43
41
  classes
44
42
  } = useStyles();
43
+ const rating = useSelector(state => getProductRating(state, {
44
+ productId
45
+ }));
45
46
  const showEmptyRatingStars = useShowEmptyRatingStars();
46
- const showRatings = useMemo(() => {
47
- if (hasReviews && (rating?.average ?? 0) > 0) {
48
- return true;
49
- }
50
- if (hasReviews && showEmptyRatingStars && rating) {
51
- return true;
52
- }
53
- return false;
54
- }, [rating, showEmptyRatingStars]);
47
+ const showRatings = appConfig.hasReviews && ((rating?.average ?? 0) > 0 || showEmptyRatingStars && Boolean(rating));
55
48
  return /*#__PURE__*/_jsx(SurroundPortals, {
56
49
  portalName: PRODUCT_RATING,
57
50
  children: showRatings && /*#__PURE__*/_jsxs("div", {
@@ -69,6 +62,6 @@ const Rating = ({
69
62
  });
70
63
  };
71
64
  Rating.defaultProps = {
72
- rating: null
65
+ productId: null
73
66
  };
74
- export default connect(/*#__PURE__*/memo(Rating));
67
+ export default /*#__PURE__*/memo(Rating);
@@ -1,26 +0,0 @@
1
- import { connect } from 'react-redux';
2
- import { getProductRating } from '@shopgate/pwa-common-commerce/product/selectors/product';
3
-
4
- /**
5
- * @param {Object} state The current application state.
6
- * @param {Object} props The component props.
7
- * @return {Object} The extended component props.
8
- */
9
- const mapStateToProps = (state, props) => ({
10
- rating: getProductRating(state, props)
11
- });
12
-
13
- /**
14
- * @param {Object} next The next component props.
15
- * @param {Object} prev The previous component props.
16
- * @return {boolean}
17
- */
18
- const areStatePropsEqual = (next, prev) => {
19
- if (!prev.rating && next.rating) {
20
- return false;
21
- }
22
- return true;
23
- };
24
- export default connect(mapStateToProps, null, null, {
25
- areStatePropsEqual
26
- });