@sitecore-feaas/clientside 0.1.50 → 0.1.51

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.
@@ -56,7 +56,7 @@ export default class FEAASExternal extends FEAASBase<FEAASExternalProps, ReactMo
56
56
 
57
57
  static setRegistrationCallback() {
58
58
  // if registerCallback has not already been triggered by another component, set it
59
- if (!FEAASExternal.registrationCallback) {
59
+ if (!FEAASExternal.registrationCallback && typeof window !== 'undefined') {
60
60
  FEAASExternal.registrationCallback = setTimeout(() => {
61
61
  // create components array from object
62
62
  const components = Object.keys(FEAASExternal.registered).map((name) => ({
@@ -66,12 +66,12 @@ export default class FEAASExternal extends FEAASBase<FEAASExternalProps, ReactMo
66
66
  component: FEAASExternal.registered[name].component.toString()
67
67
  }))
68
68
  // send components from iframe to parent window
69
- window.parent.postMessage(
69
+ window?.parent?.postMessage(
70
70
  JSON.stringify({
71
71
  action: 'register-components',
72
72
  data: components
73
73
  }),
74
- '*'
74
+ window?.parent?.origin
75
75
  )
76
76
  }, 500)
77
77
  }
@@ -1,7 +1,7 @@
1
1
  import { beforeEach, describe, expect, it } from 'vitest'
2
2
  import React from 'react'
3
- import * as Clientside from '@sitecore-feaas/clientside/react'
4
- import FEAASExternal from '../types/components/FEAASExternal.js'
3
+ import * as Clientside from '../src/ui/react.js'
4
+ import FEAASExternal from "../src/ui/FEAASExternal.js";
5
5
 
6
6
  describe('External', () => {
7
7
  function Hello(props: { firstName: string; telephone: string }) {