@shopgate/engage 7.31.8-beta.1 → 7.31.9-beta.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.
@@ -28,6 +28,7 @@ export { generateGoogleMapsDirectionsUrl } from "./googleMaps";
28
28
  export { getDeviceTypeForCms } from "./deviceType";
29
29
  export { default as logGroup } from "@shopgate/pwa-core/helpers/logGroup";
30
30
  export { default as decodeHTML } from "@shopgate/pwa-common/helpers/html/decodeHTML";
31
+ export { default as htmlToText } from "@shopgate/pwa-common/helpers/html/htmlToText";
31
32
  export { default as parseHTML } from "@shopgate/pwa-common/helpers/html/parseHTML";
32
33
  export { default as getTranslator } from "@shopgate/pwa-common/helpers/i18n/getTranslator";
33
34
  export { default as getPriceFormatter } from "@shopgate/pwa-common/helpers/i18n/getPriceFormatter";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../core/helpers/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yDAOO,qCAAqC;uBAArC,qCAAqC;wBAArC,qCAAqC;yCAArC,qCAAqC;yCAArC,qCAAqC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../core/helpers/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yDAOO,qCAAqC;uBAArC,qCAAqC;wBAArC,qCAAqC;yCAArC,qCAAqC;yCAArC,qCAAqC"}
@@ -31,6 +31,7 @@ export * from '@shopgate/pwa-common/helpers/date';
31
31
  export * from '@shopgate/pwa-common/helpers/dom';
32
32
  export { env, isDev, isProd, isRemote, isStaging, isLinux, isWindows } from '@shopgate/pwa-common/helpers/environment';
33
33
  export { default as decodeHTML } from '@shopgate/pwa-common/helpers/html/decodeHTML';
34
+ export { default as htmlToText } from '@shopgate/pwa-common/helpers/html/htmlToText';
34
35
  export * from '@shopgate/pwa-common/helpers/html/handleDOM';
35
36
  export { default as parseHTML } from '@shopgate/pwa-common/helpers/html/parseHTML';
36
37
  export { default as getTranslator } from '@shopgate/pwa-common/helpers/i18n/getTranslator';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopgate/engage",
3
- "version": "7.31.8-beta.1",
3
+ "version": "7.31.9-beta.1",
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.31.8-beta.1",
22
- "@shopgate/pwa-common-commerce": "7.31.8-beta.1",
23
- "@shopgate/pwa-core": "7.31.8-beta.1",
24
- "@shopgate/pwa-ui-ios": "7.31.8-beta.1",
25
- "@shopgate/pwa-ui-material": "7.31.8-beta.1",
26
- "@shopgate/pwa-ui-shared": "7.31.8-beta.1",
21
+ "@shopgate/pwa-common": "7.31.9-beta.1",
22
+ "@shopgate/pwa-common-commerce": "7.31.9-beta.1",
23
+ "@shopgate/pwa-core": "7.31.9-beta.1",
24
+ "@shopgate/pwa-ui-ios": "7.31.9-beta.1",
25
+ "@shopgate/pwa-ui-material": "7.31.9-beta.1",
26
+ "@shopgate/pwa-ui-shared": "7.31.9-beta.1",
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,7 +1,8 @@
1
1
  /**
2
- * List of allowed origin patterns for cms page preview iFrame communication. Incoming messages are
3
- * only processed when their origin matches one of these patterns, and outgoing messages are only
4
- * posted to origins that matched before.
2
+ * List of allowed origin patterns for cms page preview iFrame communication. Both directions are
3
+ * validated against these patterns: incoming messages are only processed when their origin matches,
4
+ * and outgoing messages are only posted to a matching origin - either the origin of the last
5
+ * accepted incoming message, or the origin of the embedding document.
5
6
  *
6
7
  * A "*" acts as a wildcard for one or more domain labels, so "https://*.shopgate.com" matches
7
8
  * "https://app.shopgate.com" as well as "https://next.us.admin.shopgate.com", but neither
@@ -99,7 +99,7 @@ function useIframeMessenger(onMessage, parentOrigins, enabled = true) {
99
99
  return () => {
100
100
  window.removeEventListener('message', handler);
101
101
  };
102
- }, [enabled, parentOrigins, sendToParent]);
102
+ }, [enabled, parentOrigins]);
103
103
  return {
104
104
  sendToParent
105
105
  };
@@ -127,6 +127,10 @@ export const usePreviewIframeCommunication = (isActive = false) => {
127
127
  const {
128
128
  sendToParent
129
129
  } = useIframeMessenger(data => {
130
+ // Allowed parents can also emit unrelated messages with arbitrary payloads.
131
+ if (typeof data !== 'object' || data === null) {
132
+ return;
133
+ }
130
134
  if (data.type === 'receivePageConfig') {
131
135
  // Page preview config received from the parent window.
132
136
  dispatch(receivePageConfigV2({