@shopgate/pwa-common 7.31.4-beta.1 → 7.32.0-beta.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,8 +1,4 @@
1
1
  import { css } from '@shopgate/engage/styles';
2
- import { themeConfig } from '@shopgate/pwa-common/helpers/config';
3
- const {
4
- colors
5
- } = themeConfig;
6
2
  const responsiveContainer = css({
7
3
  position: 'relative',
8
4
  height: 0,
@@ -29,19 +25,18 @@ const consentContainer = css({
29
25
  justifyContent: 'center',
30
26
  textAlign: 'center',
31
27
  gap: 16,
32
- background: colors.shade10,
33
- border: `1px solid ${colors.shade5}`,
34
- // Add a tiny little border radius to make the message container look nice with padding
28
+ background: 'var(--sg-palette-grey-light)',
29
+ border: '1px solid var(--sg-components-border-medium)',
35
30
  borderRadius: 4,
36
31
  top: 0
37
32
  });
38
33
  const consentLink = css({
39
34
  textAlign: 'center',
40
- color: colors.primary,
35
+ color: 'var(--sg-palette-primary-main)',
41
36
  fontWeight: 500
42
37
  }).toString();
43
38
  const consentIcon = css({
44
- fill: colors.shade5,
39
+ fill: 'var(--sg-palette-grey-medium)',
45
40
  height: 40
46
41
  });
47
42
  export default {
@@ -104,7 +104,7 @@ function Backdrop({
104
104
  }
105
105
  Backdrop.defaultProps = {
106
106
  className: '',
107
- color: '#000',
107
+ color: 'var(--sg-palette-common-black)',
108
108
  duration: 200,
109
109
  isVisible: false,
110
110
  level: 2,
@@ -31,6 +31,6 @@ export interface IconProps {
31
31
  * Provides basic styling via `currentColor` and supports size and color
32
32
  * overrides through props while allowing external class-based overrides.
33
33
  */
34
- declare const Icon: ({ content, className, color, viewBox, size, }: IconProps) => import("react/jsx-runtime").JSX.Element;
34
+ declare const Icon: ({ content, className, color, viewBox, size, }: IconProps) => import("react").JSX.Element;
35
35
  export default Icon;
36
36
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Icon/index.tsx"],"names":[],"mappings":"AAUA,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,QAAA,MAAM,IAAI,GAAI,+CAMX,SAAS,4CAgBX,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Icon/index.tsx"],"names":[],"mappings":"AAUA,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,QAAA,MAAM,IAAI,GAAI,+CAMX,SAAS,gCAgBX,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -1,14 +1,10 @@
1
1
  import React, { useMemo, useState, useEffect, useRef, useCallback, memo } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import noop from 'lodash/noop';
4
- import { themeConfig } from '@shopgate/engage';
5
4
  import { makeStyles } from '@shopgate/engage/styles';
6
5
  import { getFullImageSource } from '@shopgate/engage/core/helpers';
7
6
  import ImageInner from "./ImageInner";
8
7
  import { jsx as _jsx } from "react/jsx-runtime";
9
- const {
10
- colors: themeColors
11
- } = themeConfig;
12
8
  const useStyles = makeStyles()((_theme, {
13
9
  background,
14
10
  paddingTop
@@ -204,7 +200,7 @@ const defaultResolutions = [{
204
200
  }];
205
201
  Image.defaultProps = {
206
202
  alt: null,
207
- backgroundColor: themeColors.placeholder,
203
+ backgroundColor: 'var(--sg-palette-background-emphasized)',
208
204
  className: '',
209
205
  classNameImg: '',
210
206
  forcePlaceholder: false,
@@ -4,7 +4,7 @@ import { createPortal } from 'react-dom';
4
4
  import { useTrackModalState } from '@shopgate/engage/a11y/hooks';
5
5
  import { makeStyles, responsiveMediaQuery } from '@shopgate/engage/styles';
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
- const useStyles = makeStyles()({
7
+ const useStyles = makeStyles()(theme => ({
8
8
  container: {
9
9
  position: 'fixed',
10
10
  top: 0,
@@ -25,8 +25,8 @@ const useStyles = makeStyles()({
25
25
  position: 'relative',
26
26
  maxWidth: '100vw',
27
27
  maxHeight: '100vh',
28
- paddingTop: 'var(--safe-area-inset-top)',
29
- paddingBottom: 'var(--safe-area-inset-bottom)',
28
+ paddingTop: theme.layout.safeArea.top,
29
+ paddingBottom: theme.layout.safeArea.bottom,
30
30
  overflowY: 'scroll',
31
31
  [responsiveMediaQuery('>xs', {
32
32
  webOnly: true
@@ -34,7 +34,7 @@ const useStyles = makeStyles()({
34
34
  overflowY: 'initial'
35
35
  }
36
36
  }
37
- });
37
+ }));
38
38
 
39
39
  /**
40
40
  * The Modal component.
@@ -19,6 +19,6 @@ export interface SurroundPortalsProps {
19
19
  *
20
20
  * @returns The SurroundPortals component.
21
21
  */
22
- declare const SurroundPortals: ({ portalName, portalProps, children, }: SurroundPortalsProps) => import("react/jsx-runtime").JSX.Element;
22
+ declare const SurroundPortals: ({ portalName, portalProps, children, }: SurroundPortalsProps) => React.JSX.Element;
23
23
  export default SurroundPortals;
24
24
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/SurroundPortals/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,QAAA,MAAM,eAAe,GAAI,wCAItB,oBAAoB,4CAQtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/SurroundPortals/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,QAAA,MAAM,eAAe,GAAI,wCAItB,oBAAoB,sBAQtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -9,10 +9,9 @@ import 'swiper/css/navigation';
9
9
  import 'swiper/css/zoom';
10
10
  import { useReduceMotion } from '@shopgate/engage/a11y/hooks';
11
11
  import { makeStyles } from '@shopgate/engage/styles';
12
- import { themeColors } from '@shopgate/pwa-common/helpers/config';
13
12
  import SwiperItem from "./components/SwiperItem";
14
13
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
15
- const useStyles = makeStyles()(() => ({
14
+ const useStyles = makeStyles()(theme => ({
16
15
  container: {
17
16
  position: 'relative',
18
17
  maxHeight: '100%',
@@ -27,7 +26,7 @@ const useStyles = makeStyles()(() => ({
27
26
  },
28
27
  innerContainer: {
29
28
  overflow: 'hidden',
30
- '--swiper-navigation-color': themeColors.gray,
29
+ '--swiper-navigation-color': theme.components.swiper.paginationBulletColor,
31
30
  '& .swiper-wrapper': {
32
31
  alignItems: 'stretch'
33
32
  },
@@ -36,11 +35,10 @@ const useStyles = makeStyles()(() => ({
36
35
  },
37
36
  '& .swiper-pagination': {
38
37
  '& .swiper-pagination-bullet': {
39
- background: themeColors.gray,
38
+ background: theme.components.swiper.paginationBulletActiveColor,
40
39
  opacity: '.5',
41
40
  margin: '0 4px',
42
- transition: 'opacity 300ms cubic-bezier(0.25, 0.1, 0.25, 1)',
43
- border: `1px solid ${themeColors.dark}`
41
+ transition: 'opacity 300ms cubic-bezier(0.25, 0.1, 0.25, 1)'
44
42
  },
45
43
  '& .swiper-pagination-bullet-active.swiper-pagination-bullet-active-main': {
46
44
  opacity: 1
@@ -51,8 +49,8 @@ const useStyles = makeStyles()(() => ({
51
49
  left: 'auto',
52
50
  right: 0,
53
51
  bottom: 'auto',
54
- fontSize: 12,
55
- background: themeColors.background,
52
+ fontSize: theme.typography.caption.fontSize,
53
+ background: theme.components.swiper.paginationFractionBackground,
56
54
  borderRadius: '50px',
57
55
  width: 'fit-content',
58
56
  padding: '4px 8px',
@@ -60,9 +58,9 @@ const useStyles = makeStyles()(() => ({
60
58
  transition: 'opacity 300ms cubic-bezier(0.25, 0.1, 0.25, 1)'
61
59
  },
62
60
  '& .swiper-pagination-progressbar': {
63
- background: themeColors.shade7,
61
+ background: theme.components.swiper.paginationProgressbarBackground,
64
62
  '& .swiper-pagination-progressbar-fill': {
65
- background: themeColors.dark
63
+ background: theme.components.swiper.paginationProgressbarActiveColor
66
64
  }
67
65
  }
68
66
  },
@@ -51,44 +51,5 @@ export default appConfig;
51
51
  * Be careful when changing existing properties on the fly, reassignments should never be done!
52
52
  * @mixes AppConfig
53
53
  */
54
- declare const appConfig: string | {
55
- appId: string;
56
- browserConnector: boolean;
57
- colors: {};
58
- forgotPasswordUrl: null;
59
- hasFavorites: boolean;
60
- hasReviews: boolean;
61
- showWriteReview: boolean;
62
- language: string;
63
- logo: string;
64
- marketId: string;
65
- publicPath: string;
66
- shopName: string;
67
- webCheckoutShopify: null;
68
- hasNoScanner: boolean;
69
- apiUrl: string;
70
- shopCNAME: null;
71
- currency: string;
72
- showGmdMenuSubHeaders: boolean;
73
- benchmark: boolean;
74
- sentry: {};
75
- theme: {};
76
- cartShippingHideAnonymousLegacy: null;
77
- cartShippingTextAnonymousLegacy: null;
78
- variantSelectionMode: null;
79
- product: {
80
- variantPreselect: boolean;
81
- };
82
- cart: {};
83
- scanner: {};
84
- favorites: {};
85
- tracking: {
86
- hasWebTrackingEngage: boolean;
87
- useSkuAsProductId: boolean;
88
- };
89
- webTrackingEngage: {
90
- android: string;
91
- ios: string;
92
- };
93
- } | undefined;
54
+ declare const appConfig: any;
94
55
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../helpers/config/index.js"],"names":[],"mappings":"AAyJA;;;;GAIG;AACH,yCAHW,MAAM,oBACN,mBAAmB,GAAC,IAAI,QAKlC;AA/GD;;GAEG;AACH,yBAFU,MAAM,CAEsB;AAWtC;;;GAGG;AACH,+BAFU,MAAM,CAKd;AASF;;;GAGG;AACH,wBAFU,MAAM,CAEsC;AAEtD;;;GAGG;AACH,0BAFU,WAAW,CAEkC;AAEvD,yBAAyB;AACzB,8BAA8C;AAC9C,0BAA0B;AAC1B,+BAAgD;AAChD,4BAA4B;AAC5B,iCAAoD;AACpD,wBAAwB;AACxB,6BAA4C;AAK5C;;;;;;;;;;GAUG;AACH,2CANU,mBAAmB,CA8B3B;AAWK,gDAPI,MAAM,SACN,GAAC,SACD,GAAC,aACD,MAAM,aACN,MAAM,GACJ,OAAO,CAGK;AAiBzB,6BAAkE;;AA/FlE;;;;GAIG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAA8F"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../helpers/config/index.js"],"names":[],"mappings":"AAyJA;;;;GAIG;AACH,yCAHW,MAAM,oBACN,mBAAmB,GAAC,IAAI,QAKlC;AA/GD;;GAEG;AACH,yBAFU,MAAM,CAEsB;AAWtC;;;GAGG;AACH,+BAFU,MAAM,CAKd;AASF;;;GAGG;AACH,wBAFU,MAAM,CAEsC;AAEtD;;;GAGG;AACH,0BAFU,WAAW,CAEkC;AAEvD,yBAAyB;AACzB,8BAA8C;AAC9C,0BAA0B;AAC1B,+BAAgD;AAChD,4BAA4B;AAC5B,iCAAoD;AACpD,wBAAwB;AACxB,6BAA4C;AAK5C;;;;;;;;;;GAUG;AACH,2CANU,mBAAmB,CA8B3B;AAWK,gDAPI,MAAM,SACN,GAAC,SACD,GAAC,aACD,MAAM,aACN,MAAM,GACJ,OAAO,CAGK;AAiBzB,6BAAkE;;AA/FlE;;;;GAIG;AACH,6BAA8F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopgate/pwa-common",
3
- "version": "7.31.4-beta.1",
3
+ "version": "7.32.0-beta.2",
4
4
  "description": "Common library for the Shopgate Connect PWA.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Shopgate <support@shopgate.com>",
@@ -17,7 +17,7 @@
17
17
  "dependencies": {
18
18
  "@redux-devtools/extension": "^3.3.0",
19
19
  "@sentry/browser": "6.0.1",
20
- "@shopgate/pwa-benchmark": "7.31.4-beta.1",
20
+ "@shopgate/pwa-benchmark": "7.32.0-beta.2",
21
21
  "@virtuous/conductor": "~2.5.0",
22
22
  "@virtuous/react-conductor": "~2.5.0",
23
23
  "@virtuous/redux-persister": "1.1.0-beta.7",
@@ -26,7 +26,7 @@
26
26
  "glamor": "^2.20.40",
27
27
  "gsap": "^3.14.2",
28
28
  "history": "^4.9.0",
29
- "intl-messageformat": "^11.1.2",
29
+ "intl-messageformat": "^11.2.9",
30
30
  "path-match": "^1.2.4",
31
31
  "react-dotdotdot": "~1.3.1",
32
32
  "react-helmet": "^6.1.0",
@@ -37,10 +37,10 @@
37
37
  "redux-thunk": "^3.1.0",
38
38
  "reselect": "^4.1.8",
39
39
  "rxjs": "~5.5.12",
40
- "swiper": "12.1.0"
40
+ "swiper": "12.2.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@shopgate/pwa-core": "7.31.4-beta.1",
43
+ "@shopgate/pwa-core": "7.32.0-beta.2",
44
44
  "@types/lodash": "^4.17.24",
45
45
  "@types/react-portal": "^3.0.9",
46
46
  "lodash": "^4.17.23",
@@ -3,20 +3,20 @@ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
3
3
  import React, { Component } from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import { UIEvents } from '@shopgate/pwa-core';
6
- import { themeConfig } from '@shopgate/pwa-common/helpers/config';
6
+ import { withTheme } from '@shopgate/engage/styles/theme/hocs/withTheme';
7
7
  import ToastContext from "./context";
8
- import { jsx as _jsx } from "react/jsx-runtime";
9
- const {
10
- variables: {
11
- toast: {
12
- duration = 5000
13
- } = {}
14
- } = {}
15
- } = themeConfig;
8
+
9
+ /**
10
+ * @typedef {Object} ToastProviderProps
11
+ * @property {import('react').ReactNode} children
12
+ * @property {import('@shopgate/engage/styles').Theme} theme
13
+ */
16
14
 
17
15
  /**
18
16
  * The ToastProvider component
17
+ * @augments {Component<ToastProviderProps>}
19
18
  */
19
+ import { jsx as _jsx } from "react/jsx-runtime";
20
20
  let ToastProvider = /*#__PURE__*/function (_Component) {
21
21
  /**
22
22
  * @param {Object} props The component props.
@@ -47,7 +47,7 @@ let ToastProvider = /*#__PURE__*/function (_Component) {
47
47
  found.actionLabel = toast.actionLabel;
48
48
  found.message = toast.message;
49
49
  found.messageParams = toast.messageParams;
50
- found.duration = toast.duration || duration;
50
+ found.duration = toast.duration || _this.props.theme.transitions.duration.toast;
51
51
  } else {
52
52
  toasts.push({
53
53
  id: toast.id,
@@ -55,7 +55,7 @@ let ToastProvider = /*#__PURE__*/function (_Component) {
55
55
  actionLabel: toast.actionLabel,
56
56
  message: toast.message,
57
57
  messageParams: toast.messageParams,
58
- duration: toast.duration || duration
58
+ duration: toast.duration || _this.props.theme.transitions.duration.toast
59
59
  });
60
60
  }
61
61
  _this.setState({
@@ -117,4 +117,4 @@ let ToastProvider = /*#__PURE__*/function (_Component) {
117
117
  }(Component);
118
118
  ToastProvider.ADD = 'toast_add';
119
119
  ToastProvider.FLUSH = 'toast_flush';
120
- export default ToastProvider;
120
+ export default withTheme(ToastProvider);
@@ -9,7 +9,7 @@ import Route from '@virtuous/conductor/Route';
9
9
  import { Linking } from '@shopgate/native-modules';
10
10
  import { HISTORY_RESET_TO } from '@shopgate/pwa-common/constants/ActionTypes';
11
11
  import { logger } from '@shopgate/pwa-core';
12
- import { IS_PAGE_PREVIEW_ACTIVE } from '@shopgate/engage/page/constants';
12
+ import { isPageAdminPreviewActive } from '@shopgate/engage/admin-preview/helpers';
13
13
  import addCouponsToCart from '@shopgate/pwa-common-commerce/cart/actions/addCouponsToCart';
14
14
  import { getCurrentRoute, getRouterStackIndex } from "../selectors/router";
15
15
  import { LoadingProvider } from "../providers";
@@ -31,7 +31,7 @@ import ToastProvider from "../providers/toast";
31
31
  */
32
32
  export default function routerSubscriptions(subscribe) {
33
33
  subscribe(navigate$, async params => {
34
- if (IS_PAGE_PREVIEW_ACTIVE) {
34
+ if (isPageAdminPreviewActive()) {
35
35
  // No navigation is allowed in page preview mode.
36
36
  return;
37
37
  }