@builder.io/sdk-react 0.5.4 → 0.5.5

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 +1,2 @@
1
- export declare function getPreviewContent(searchParams: URLSearchParams): import("../../types/builder-content").BuilderContent;
1
+ import type { BuilderContent } from '../../types/builder-content';
2
+ export declare function getPreviewContent(_searchParams: URLSearchParams): BuilderContent | undefined;
@@ -1,7 +1,3 @@
1
- import { getIdFromSearchParams } from './helpers';
2
- import { init } from './init';
3
- export function getPreviewContent(searchParams) {
4
- init();
5
- const id = getIdFromSearchParams(searchParams);
6
- return typeof id === 'string' ? globalThis._BUILDER_PREVIEW_LRU_CACHE.get(id) : undefined;
1
+ export function getPreviewContent(_searchParams) {
2
+ return undefined;
7
3
  }
@@ -1 +0,0 @@
1
- export declare const getIdFromSearchParams: (searchParams: URLSearchParams) => string;
@@ -1,9 +0,0 @@
1
- import { logger } from '../logger';
2
- export const getIdFromSearchParams = (searchParams) => {
3
- const previewedModel = searchParams.get('preview');
4
- const previewedId = searchParams.get('overrides.' + previewedModel);
5
- if (!previewedId) {
6
- logger.warn('No previewed ID found in search params.');
7
- }
8
- return previewedId;
9
- };
@@ -3,13 +3,4 @@
3
3
  *
4
4
  * Note: This logic is only used by the NextJS SDK.
5
5
  */
6
- import { LRUCache } from 'lru-cache';
7
- export function init() {
8
- if (!globalThis._BUILDER_PREVIEW_LRU_CACHE) {
9
- globalThis._BUILDER_PREVIEW_LRU_CACHE = new LRUCache({
10
- max: 500,
11
- // how long to live in ms
12
- ttl: 1000 * 60 * 5
13
- });
14
- }
15
- }
6
+ export function init() { }
@@ -1,8 +1,4 @@
1
- 'use server';
2
- import { init } from './init';
3
1
  export async function postPreviewContent({ key, value }) {
4
- init();
5
- globalThis._BUILDER_PREVIEW_LRU_CACHE.set(key, value);
6
2
  return {
7
3
  [key]: value
8
4
  };
@@ -1,12 +0,0 @@
1
- /**
2
- * This is an LRU cache to hold preview content on the server-side.
3
- *
4
- * Note: This logic is only used by the NextJS SDK.
5
- */
6
- import type { LRUCache } from 'lru-cache';
7
- import type { BuilderContent } from '../../types/builder-content';
8
- type BuilderLRUCache = LRUCache<string, BuilderContent>;
9
- export type GlobalWCache = typeof globalThis & {
10
- _BUILDER_PREVIEW_LRU_CACHE: BuilderLRUCache;
11
- };
12
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * This is an LRU cache to hold preview content on the server-side.
3
- *
4
- * Note: This logic is only used by the NextJS SDK.
5
- */
6
- export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-react",
3
3
  "description": "Builder.io SDK for React",
4
- "version": "0.5.4",
4
+ "version": "0.5.5",
5
5
  "files": [
6
6
  "dist"
7
7
  ],