@memori.ai/memori-react 8.6.4 → 8.6.6

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.
@@ -21,6 +21,7 @@ Object.defineProperty(window, 'matchMedia', {
21
21
  // Mock window.location
22
22
  const mockLocation = {
23
23
  hostname: 'localhost',
24
+ href: 'http://localhost:3000',
24
25
  };
25
26
 
26
27
  Object.defineProperty(window, 'location', {
package/src/index.tsx CHANGED
@@ -269,25 +269,21 @@ const Memori: React.FC<Props> = ({
269
269
  layoutIntegration?.customData ?? '{}'
270
270
  );
271
271
 
272
- const whiteListedDomains = layoutIntegrationConfig.whiteListedDomains;
273
- if (whiteListedDomains) {
272
+ const whiteListedDomains = [
273
+ tenant?.name,
274
+ ...(tenant?.aliases || []),
275
+ ...(layoutIntegrationConfig.whiteListedDomains || []),
276
+ ];
277
+ if (layoutIntegrationConfig?.whiteListedDomains?.length) {
274
278
  // check if we are client side
275
279
  if (typeof window !== 'undefined') {
276
- // In whitelist bypass logic
277
- const isPreview =
278
- window.parent !== window &&
279
- document.referrer &&
280
- (document.referrer.includes(window.location.hostname));
281
- // Skip whitelist check for preview
282
- if (!isPreview) {
283
- // check if the current domain is in the whiteListedDomains with Regex
284
- if (
285
- !whiteListedDomains.some((domain: string) =>
286
- new RegExp(domain).test(window.location.hostname)
287
- )
288
- ) {
289
- return null;
290
- }
280
+ // check if the current domain is in the whiteListedDomains with Regex
281
+ if (
282
+ !whiteListedDomains.some((domain: string) =>
283
+ new RegExp(domain).test(window.location.hostname)
284
+ )
285
+ ) {
286
+ return null;
291
287
  }
292
288
  }
293
289
  }