@shopgate/engage 7.31.1-alpha.2 → 7.31.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/ScrollHeader/index.jsx"],"names":[],"mappings":";AAsGA;;;;;;;;;;;cArDW,KAAK,CAAC,SAAS;yCAqDwB;kBAtGK,OAAO"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/ScrollHeader/index.jsx"],"names":[],"mappings":";AA6GA;;;;;;;;;;;cA5DW,KAAK,CAAC,SAAS;yCA4DwB;kBA7GK,OAAO"}
@@ -1,7 +1,7 @@
1
1
  import React, { useState, forwardRef, useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { makeStyles, responsiveMediaQuery } from '@shopgate/engage/styles';
4
- import { useScrollDirectionChange } from '@shopgate/engage/core/hooks';
4
+ import { useScrollDirectionChange, useRoute } from '@shopgate/engage/core/hooks';
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  const useStyles = makeStyles()({
7
7
  root: {
@@ -68,8 +68,15 @@ function ScrollHeaderBase({
68
68
  cx
69
69
  } = useStyles();
70
70
  const [shouldHideHeader, setShouldHideHeader] = useState(false);
71
+
72
+ // The `viewScroll$` stream is shared across all mounted views. Cached routes (e.g. a product
73
+ // list) stay mounted in the background while another route is active, so without this guard the
74
+ // header would react to scroll events emitted by a different, currently visible view and end up
75
+ // hidden when the user navigates back. `visible` is true only for the active route.
76
+ const route = useRoute();
77
+ const visible = route ? route.visible !== false : true;
71
78
  useScrollDirectionChange({
72
- enabled: hideOnScroll,
79
+ enabled: hideOnScroll && visible,
73
80
  offset: scrollOffset,
74
81
  onlyFireOnScrollUpAtTop: onlyShowAtTop,
75
82
  onlyFireOnScrollUpAtTopOffset: onlyShowAtTopOffset,
@@ -3,6 +3,7 @@ import { useSelector } from 'react-redux';
3
3
  import { makeStyles } from '@shopgate/engage/styles';
4
4
  import { useLongPress } from '@shopgate/engage/core/hooks';
5
5
  import { getClientInformation } from '@shopgate/engage/core/selectors';
6
+ import { pckVersion } from '@shopgate/pwa-common/helpers/config';
6
7
  import DevelopmentSettings from "../DevelopmentSettings";
7
8
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
8
9
  const useStyles = makeStyles()(theme => ({
@@ -62,7 +63,7 @@ const ClientInformation = () => {
62
63
  "aria-hidden": true,
63
64
  children: [/*#__PURE__*/_jsxs("p", {
64
65
  className: classes.unselectable,
65
- children: [`App Version: ${appVersion} (${codebaseVersion})`, /*#__PURE__*/_jsx("br", {}), `Lib Version: ${libVersion}`]
66
+ children: [`App Version: ${appVersion} (${codebaseVersion})`, /*#__PURE__*/_jsx("br", {}), `Theme Version: ${pckVersion}`, /*#__PURE__*/_jsx("br", {}), `Lib Version: ${libVersion}`]
66
67
  }), deviceIdVisible && /*#__PURE__*/_jsxs(_Fragment, {
67
68
  children: [/*#__PURE__*/_jsx("p", {
68
69
  className: classes.deviceId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopgate/engage",
3
- "version": "7.31.1-alpha.2",
3
+ "version": "7.31.2",
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.25",
21
- "@shopgate/pwa-common": "7.31.1-alpha.2",
22
- "@shopgate/pwa-common-commerce": "7.31.1-alpha.2",
23
- "@shopgate/pwa-core": "7.31.1-alpha.2",
24
- "@shopgate/pwa-ui-ios": "7.31.1-alpha.2",
25
- "@shopgate/pwa-ui-material": "7.31.1-alpha.2",
26
- "@shopgate/pwa-ui-shared": "7.31.1-alpha.2",
21
+ "@shopgate/pwa-common": "7.31.2",
22
+ "@shopgate/pwa-common-commerce": "7.31.2",
23
+ "@shopgate/pwa-core": "7.31.2",
24
+ "@shopgate/pwa-ui-ios": "7.31.2",
25
+ "@shopgate/pwa-ui-material": "7.31.2",
26
+ "@shopgate/pwa-ui-shared": "7.31.2",
27
27
  "@stripe/react-stripe-js": "^1.16.5",
28
28
  "@stripe/stripe-js": "^1.44.1",
29
29
  "@virtuous/conductor": "~2.5.0",
@@ -2,6 +2,7 @@ import React, { useMemo, useState, useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { makeStyles, useResponsiveValue } from '@shopgate/engage/styles';
4
4
  import { useParallax } from 'react-scroll-parallax';
5
+ import { IS_PAGE_PREVIEW_ACTIVE } from "../../constants";
5
6
  import { parseImageUrl } from "../../helpers";
6
7
 
7
8
  /**
@@ -32,7 +33,9 @@ const useStyles = makeStyles()({
32
33
  pointerEvents: 'none'
33
34
  },
34
35
  image: {
35
- width: '100%'
36
+ width: '100%',
37
+ height: 'auto',
38
+ display: 'block'
36
39
  },
37
40
  container: {
38
41
  width: '100%',
@@ -134,8 +137,13 @@ const ResponsiveWidgetImage = ({
134
137
  children: /*#__PURE__*/_jsx("img", {
135
138
  src: imgSrc,
136
139
  ref: parallax.ref,
137
- alt: alt,
138
- loading: "lazy",
140
+ alt: alt
141
+ // In the CMS page-preview iframe, native lazy loading defers the image load after the admin
142
+ // re-posts an updated page config and never triggers it again, so widget images stay at
143
+ // height 0 until a resize forces the browser to re-evaluate. Load eagerly there; keep lazy
144
+ // loading for the live app.
145
+ ,
146
+ loading: IS_PAGE_PREVIEW_ACTIVE ? 'eager' : 'lazy',
139
147
  className: cx(classes.preventSave, classes.image, {
140
148
  [classes.banner]: isBanner
141
149
  }, className),
@@ -4,6 +4,7 @@ import { makeStyles } from '@shopgate/engage/styles';
4
4
  import { useRoute, useThemeWidgets } from '@shopgate/engage/core/hooks';
5
5
  import { PAGE_PREVIEW_PATTERN } from '@shopgate/engage/page/constants';
6
6
  import { ConditionalWrapper } from '@shopgate/engage/components';
7
+ import { isDev } from '@shopgate/engage/core/helpers';
7
8
  import WidgetsPreviewProvider from "./WidgetsPreviewProvider";
8
9
  import Widget from "./Widget";
9
10
  import Overlay from "./Overlay";
@@ -73,7 +74,7 @@ const Widgets = ({
73
74
  }),
74
75
  ref: widgetsRef,
75
76
  children: widgets.map(widget => {
76
- const component = widgetComponents[widget.widgetConfigDefinitionCode] || widgetComponents[PLACEHOLDER_COMPONENT];
77
+ const component = widgetComponents[widget.widgetConfigDefinitionCode] || (isDev ? widgetComponents[PLACEHOLDER_COMPONENT] : null);
77
78
  return /*#__PURE__*/_jsx(Widget, {
78
79
  definition: widget,
79
80
  isPreview: isPreview,
@@ -2,7 +2,7 @@ import React, { memo, useMemo } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { PRODUCT_ITEM_NAME, PRODUCT_ITEM_NAME_BEFORE, PRODUCT_ITEM_NAME_AFTER } from '@shopgate/engage/category/constants';
4
4
  import { Portal } from '@shopgate/engage/components';
5
- import { ProductName, RatingStars } from '@shopgate/engage/product';
5
+ import { ProductName, ProductRatingStars } from '@shopgate/engage/product';
6
6
  import { makeStyles } from '@shopgate/engage/styles';
7
7
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  const useStyles = makeStyles()({
@@ -38,7 +38,7 @@ const ItemName = ({
38
38
  children: [/*#__PURE__*/_jsx(Portal, {
39
39
  name: PRODUCT_ITEM_NAME_BEFORE,
40
40
  props: portalProps
41
- }), /*#__PURE__*/_jsx(RatingStars, {
41
+ }), /*#__PURE__*/_jsx(ProductRatingStars, {
42
42
  productId: productId
43
43
  }), /*#__PURE__*/_jsx(Portal, {
44
44
  name: PRODUCT_ITEM_NAME_AFTER,
@@ -47,7 +47,7 @@ const ItemName = ({
47
47
  });
48
48
  }
49
49
  return /*#__PURE__*/_jsxs(_Fragment, {
50
- children: [/*#__PURE__*/_jsx(RatingStars, {
50
+ children: [/*#__PURE__*/_jsx(ProductRatingStars, {
51
51
  productId: productId
52
52
  }), /*#__PURE__*/_jsx(ProductName, {
53
53
  name: name,
@@ -3,7 +3,8 @@ import { shallow } from 'enzyme';
3
3
  import ItemName from "./index";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  jest.mock('@shopgate/engage/product', () => ({
6
- ProductName: () => null
6
+ ProductName: () => null,
7
+ ProductRatingStars: () => null
7
8
  }));
8
9
  jest.mock('@shopgate/engage/components');
9
10
  const props = {
@@ -11,4 +11,4 @@ interface RatingProps {
11
11
  }
12
12
  declare const _default: import("react").MemoExoticComponent<({ productId, size, }: RatingProps) => import("react/jsx-runtime").JSX.Element | null>;
13
13
  export default _default;
14
- //# sourceMappingURL=RatingStars.d.ts.map
14
+ //# sourceMappingURL=ProductRatingStars.d.ts.map
@@ -0,0 +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"}
@@ -36,7 +36,7 @@ const ProductRatingStars = ({
36
36
  return null;
37
37
  }
38
38
  return /*#__PURE__*/_jsx(RatingStars, {
39
- value: rating?.average || 0,
39
+ value: rating?.average ?? 0,
40
40
  display: size
41
41
  });
42
42
  };
@@ -0,0 +1,2 @@
1
+ export { default as ProductRatingStars } from './ProductRatingStars';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../product/components/ProductRatingStars/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1 @@
1
+ export { default as ProductRatingStars } from "./ProductRatingStars";
@@ -46,7 +46,7 @@ const Rating = ({
46
46
  showEmptyRatingStars = false
47
47
  } = useWidgetSettings('@shopgate/engage/rating');
48
48
  const showRatings = useMemo(() => {
49
- if (hasReviews && rating?.average > 0) {
49
+ if (hasReviews && (rating?.average ?? 0) > 0) {
50
50
  return true;
51
51
  }
52
52
  if (hasReviews && showEmptyRatingStars && rating) {
@@ -24,7 +24,7 @@ export { default as ProductSlider } from "./ProductSlider";
24
24
  export * from "./ProductVariants";
25
25
  export { default as QuantityPicker } from "./QuantityPicker";
26
26
  export { default as Rating } from "./Rating";
27
- export { RatingStars } from "./RatingStars";
27
+ export { ProductRatingStars } from "./ProductRatingStars";
28
28
  export * from "./RelationsSlider";
29
29
  export * from "./Swatch";
30
30
  export * from "./Swatches";
@@ -1 +0,0 @@
1
- {"version":3,"file":"RatingStars.d.ts","sourceRoot":"","sources":["../../../../product/components/RatingStars/RatingStars.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,2 +0,0 @@
1
- export { default as RatingStars } from './RatingStars';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../product/components/RatingStars/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC"}
@@ -1 +0,0 @@
1
- export { default as RatingStars } from "./RatingStars";