@commercetools-frontend/application-components 23.3.0 → 24.0.0

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.
Files changed (30) hide show
  1. package/dist/commercetools-frontend-application-components.cjs.dev.js +46 -37
  2. package/dist/commercetools-frontend-application-components.cjs.prod.js +31 -22
  3. package/dist/commercetools-frontend-application-components.esm.js +47 -38
  4. package/dist/declarations/src/components/detail-pages/custom-form-detail-page/custom-form-detail-page.d.ts +3 -3
  5. package/dist/declarations/src/components/detail-pages/form-detail-page/form-detail-page.d.ts +4 -5
  6. package/dist/declarations/src/components/detail-pages/info-detail-page/info-detail-page.d.ts +1 -1
  7. package/dist/declarations/src/components/detail-pages/tabular-detail-page/tabular-detail-page.d.ts +3 -6
  8. package/dist/declarations/src/components/dialogs/form-dialog/form-dialog.d.ts +3 -2
  9. package/dist/declarations/src/components/dialogs/internals/dialog-content.d.ts +1 -1
  10. package/dist/declarations/src/components/dialogs/internals/dialog-footer.d.ts +3 -2
  11. package/dist/declarations/src/components/dialogs/internals/dialog.styles.d.ts +2 -2
  12. package/dist/declarations/src/components/drawer/drawer.d.ts +4 -3
  13. package/dist/declarations/src/components/internals/default-form-buttons.d.ts +3 -2
  14. package/dist/declarations/src/components/internals/page.styles.d.ts +3 -3
  15. package/dist/declarations/src/components/internals/tabular-page.d.ts +4 -4
  16. package/dist/declarations/src/components/main-pages/custom-form-main-page/custom-form-main-page.d.ts +3 -3
  17. package/dist/declarations/src/components/main-pages/form-main-page/form-main-page.d.ts +14 -10
  18. package/dist/declarations/src/components/main-pages/info-main-page/info-main-page.d.ts +1 -1
  19. package/dist/declarations/src/components/main-pages/internals/main-page.styles.d.ts +3 -3
  20. package/dist/declarations/src/components/main-pages/tabular-main-page/tabular-main-page.d.ts +15 -15
  21. package/dist/declarations/src/components/modal-pages/custom-form-modal-page/custom-form-modal-page.d.ts +2 -2
  22. package/dist/declarations/src/components/modal-pages/form-modal-page/form-modal-page.d.ts +3 -4
  23. package/dist/declarations/src/components/modal-pages/internals/modal-page.styles.d.ts +1 -1
  24. package/dist/declarations/src/components/modal-pages/tabular-modal-page/tabular-modal-page.d.ts +2 -2
  25. package/dist/declarations/src/components/modal-pages/utils/modal-page-top-bar.d.ts +1 -1
  26. package/dist/declarations/src/components/public-page-layout/public-page-layout.styles.d.ts +3 -3
  27. package/package.json +37 -39
  28. /package/dist/{custom-views-selector-89258b79.esm.js → custom-views-selector-17209139.esm.js} +0 -0
  29. /package/dist/{custom-views-selector-7238360c.cjs.prod.js → custom-views-selector-4f4e8c43.cjs.prod.js} +0 -0
  30. /package/dist/{custom-views-selector-3fd2f032.cjs.dev.js → custom-views-selector-f1e800af.cjs.dev.js} +0 -0
@@ -83,7 +83,7 @@ var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstancePro
83
83
  var useResizeObserver__default = /*#__PURE__*/_interopDefault(useResizeObserver);
84
84
 
85
85
  // NOTE: This string will be replaced on build time with the package version.
86
- var version = "23.3.0";
86
+ var version = "24.0.0";
87
87
 
88
88
  // We keep these tokens as they are related to page layout components which should have
89
89
  // a slightly different layout (margins/paddings) when used within a Custom View panel.
@@ -500,7 +500,7 @@ FormDialog.TextTitle = TextTitle;
500
500
 
501
501
  const CustomViewSelector = /*#__PURE__*/react$1.lazy(() => {
502
502
  if (typeof window !== 'undefined' && typeof window.app !== 'undefined') {
503
- return Promise.resolve().then(function () { return require('./custom-views-selector-7238360c.cjs.prod.js' /* webpackChunkName: "custom-views-selector" */); });
503
+ return Promise.resolve().then(function () { return require('./custom-views-selector-4f4e8c43.cjs.prod.js' /* webpackChunkName: "custom-views-selector" */); });
504
504
  }
505
505
  return _Promise__default["default"].resolve({
506
506
  default: () => null
@@ -1526,7 +1526,7 @@ const getLink = msg => jsxRuntime.jsx("a", {
1526
1526
  target: "_blank",
1527
1527
  rel: "noopener noreferrer",
1528
1528
  children: msg
1529
- });
1529
+ }, "support-portal-url");
1530
1530
  const PageNotFound = () => {
1531
1531
  const intl = reactIntl.useIntl();
1532
1532
  return jsxRuntime.jsx(MaintenancePageLayout, {
@@ -1564,7 +1564,7 @@ const getSupportUrlLink = msg => jsxRuntime.jsx("a", {
1564
1564
  target: "_blank",
1565
1565
  rel: "noopener noreferrer",
1566
1566
  children: msg
1567
- });
1567
+ }, "support-portal-url");
1568
1568
  const PageUnauthorized = () => {
1569
1569
  const intl = reactIntl.useIntl();
1570
1570
  return jsxRuntime.jsx(MaintenancePageLayout, {
@@ -1814,6 +1814,26 @@ function CustomViewLoader(props) {
1814
1814
  const iFrameCommunicationChannel = react$1.useRef(new MessageChannel());
1815
1815
  const showNotification = actionsGlobal.useShowNotification();
1816
1816
  const intl = reactIntl.useIntl();
1817
+ const sendInitializationMessages = react$1.useCallback(() => {
1818
+ // Transfer port2 to the iFrame so it can send messages back privately
1819
+ iFrameElementRef.current?.contentWindow?.postMessage(constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_BOOTSTRAP, window.location.href, [iFrameCommunicationChannel.current.port2]);
1820
+
1821
+ // Send the initialization message to the iFrame
1822
+ iFrameCommunicationChannel.current.port1.postMessage({
1823
+ source: constants.CUSTOM_VIEWS_EVENTS_META.HOST_APPLICATION_CODE,
1824
+ destination: `${constants.CUSTOM_VIEWS_EVENTS_META.CUSTOM_VIEW_KEY_PREFIX}${props.customView.id}`,
1825
+ eventName: constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_INITIALIZATION,
1826
+ eventData: {
1827
+ context: {
1828
+ dataLocale,
1829
+ projectKey,
1830
+ featureFlags,
1831
+ customViewConfig: props.customView,
1832
+ hostUrl: props.hostUrl || window.location.href
1833
+ }
1834
+ }
1835
+ });
1836
+ }, [dataLocale, featureFlags, props.customView, props.hostUrl, projectKey]);
1817
1837
  const messageFromIFrameHandler = react$1.useCallback(event => {
1818
1838
  if (event.data.origin === window.location.origin) {
1819
1839
  switch (event.data.eventName) {
@@ -1841,24 +1861,13 @@ function CustomViewLoader(props) {
1841
1861
  // Listen for messages from the iFrame
1842
1862
  iFrameCommunicationChannel.current.port1.onmessage = messageFromIFrameHandler;
1843
1863
 
1844
- // Transfer port2 to the iFrame so it can send messages back privately
1845
- iFrameElementRef.current?.contentWindow?.postMessage(constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_BOOTSTRAP, window.location.href, [iFrameCommunicationChannel.current.port2]);
1846
-
1847
- // Send the initialization message to the iFrame
1848
- iFrameCommunicationChannel.current.port1.postMessage({
1849
- source: constants.CUSTOM_VIEWS_EVENTS_META.HOST_APPLICATION_CODE,
1850
- destination: `${constants.CUSTOM_VIEWS_EVENTS_META.CUSTOM_VIEW_KEY_PREFIX}${props.customView.id}`,
1851
- eventName: constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_INITIALIZATION,
1852
- eventData: {
1853
- context: {
1854
- dataLocale,
1855
- projectKey,
1856
- featureFlags,
1857
- customViewConfig: props.customView,
1858
- hostUrl: props.hostUrl || window.location.href
1859
- }
1860
- }
1861
- });
1864
+ // TODO: Locally (starter templates) we're seeing a little delay while rendering
1865
+ // the iFrame. The CustomViewShell gets rendered, but the effect to start listening
1866
+ // for messages is triggered after the iFrame is ready.
1867
+ // This is a temporary fix to avoid the situation when running locally.
1868
+ _setTimeout__default["default"](() => {
1869
+ sendInitializationMessages();
1870
+ }, 500);
1862
1871
 
1863
1872
  // We want the effect to run only once so we don't need the dependencies array.
1864
1873
  // eslint-disable-next-line react-hooks/exhaustive-deps