@replanejs/next 0.9.0 → 0.9.4

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.
package/README.md CHANGED
@@ -4,6 +4,8 @@
4
4
  [![License](https://img.shields.io/github/license/replane-dev/replane-javascript)](https://github.com/replane-dev/replane-javascript/blob/main/LICENSE)
5
5
  [![Community](https://img.shields.io/badge/discussions-join-blue?logo=github)](https://github.com/orgs/replane-dev/discussions)
6
6
 
7
+ > **Tip:** Get started instantly with [Replane Cloud](https://cloud.replane.dev) — no infrastructure required.
8
+
7
9
  Next.js SDK for [Replane](https://github.com/replane-dev/replane) - feature flags and remote configuration with SSR support.
8
10
 
9
11
  ## Installation
@@ -34,7 +36,7 @@ export default async function RootLayout({ children }: { children: React.ReactNo
34
36
  <html lang="en">
35
37
  <body>
36
38
  <ReplaneRoot<AppConfigs>
37
- options={{
39
+ connection={{
38
40
  baseUrl: process.env.NEXT_PUBLIC_REPLANE_BASE_URL!,
39
41
  sdkKey: process.env.NEXT_PUBLIC_REPLANE_SDK_KEY!,
40
42
  }}
@@ -84,7 +86,7 @@ export default function MyApp({ Component, pageProps, replaneSnapshot }: AppProp
84
86
  return (
85
87
  <ReplaneProvider
86
88
  snapshot={replaneSnapshot}
87
- options={{
89
+ connection={{
88
90
  baseUrl: process.env.NEXT_PUBLIC_REPLANE_BASE_URL!,
89
91
  sdkKey: process.env.NEXT_PUBLIC_REPLANE_SDK_KEY!,
90
92
  }}
@@ -99,8 +101,10 @@ MyApp.getInitialProps = async (appContext: AppContext) => {
99
101
  const appProps = await App.getInitialProps(appContext);
100
102
 
101
103
  const replaneSnapshot = await getReplaneSnapshot<AppConfigs>({
102
- baseUrl: process.env.REPLANE_BASE_URL!,
103
- sdkKey: process.env.REPLANE_SDK_KEY!,
104
+ connection: {
105
+ baseUrl: process.env.REPLANE_BASE_URL!,
106
+ sdkKey: process.env.REPLANE_SDK_KEY!,
107
+ },
104
108
  });
105
109
 
106
110
  return { ...appProps, replaneSnapshot };
@@ -174,22 +178,29 @@ export function ConfigDisplay() {
174
178
  }
175
179
  ```
176
180
 
177
- ## Client Options
181
+ ## Provider Props
182
+
183
+ | Prop | Type | Required | Description |
184
+ | ------------ | ------------------------- | -------- | ------------------------------------------------------- |
185
+ | `connection` | `ConnectOptions` | No | Connection options (see below) |
186
+ | `defaults` | `Record<string, unknown>` | No | Default values if server is unavailable |
187
+ | `context` | `Record<string, unknown>` | No | Default context for override evaluations |
188
+ | `snapshot` | `ReplaneSnapshot` | No | Snapshot for SSR hydration |
189
+ | `logger` | `ReplaneLogger` | No | Custom logger (default: console) |
178
190
 
179
- The `options` prop accepts the following options:
191
+ ## Connection Options
192
+
193
+ The `connection` prop accepts the following options:
180
194
 
181
195
  | Option | Type | Required | Description |
182
196
  | --------------------- | --------------------- | -------- | ---------------------------------------- |
183
197
  | `baseUrl` | `string` | Yes | Replane server URL |
184
198
  | `sdkKey` | `string` | Yes | SDK key for authentication |
185
- | `context` | `Record<string, any>` | No | Default context for override evaluations |
186
- | `defaults` | `Record<string, any>` | No | Default values if server is unavailable |
187
199
  | `connectTimeoutMs` | `number` | No | SDK connection timeout (default: 5000) |
188
200
  | `requestTimeoutMs` | `number` | No | Timeout for SSE requests (default: 2000) |
189
201
  | `retryDelayMs` | `number` | No | Base delay between retries (default: 200)|
190
202
  | `inactivityTimeoutMs` | `number` | No | SSE inactivity timeout (default: 30000) |
191
203
  | `fetchFn` | `typeof fetch` | No | Custom fetch implementation |
192
- | `logger` | `ReplaneLogger` | No | Custom logger (default: console) |
193
204
 
194
205
  See [`@replanejs/sdk` documentation](https://github.com/replane-dev/replane-javascript/tree/main/packages/sdk#api) for more details.
195
206
 
@@ -203,10 +214,9 @@ Server component for App Router that fetches configs and provides them to the ap
203
214
 
204
215
  ```tsx
205
216
  <ReplaneRoot<AppConfigs>
206
- options={{
217
+ connection={{
207
218
  baseUrl: string;
208
219
  sdkKey: string;
209
- // ... other ReplaneClientOptions
210
220
  }}
211
221
  >
212
222
  {children}
@@ -220,7 +230,7 @@ Client-side provider for Pages Router or custom setups.
220
230
  ```tsx
221
231
  <ReplaneProvider
222
232
  snapshot={replaneSnapshot}
223
- options={{
233
+ connection={{
224
234
  baseUrl: string;
225
235
  sdkKey: string;
226
236
  }}
@@ -275,8 +285,10 @@ Fetches a snapshot of all configs. Use in `getServerSideProps`, `getStaticProps`
275
285
 
276
286
  ```tsx
277
287
  const snapshot = await getReplaneSnapshot<AppConfigs>({
278
- baseUrl: process.env.REPLANE_BASE_URL!,
279
- sdkKey: process.env.REPLANE_SDK_KEY!,
288
+ connection: {
289
+ baseUrl: process.env.REPLANE_BASE_URL!,
290
+ sdkKey: process.env.REPLANE_SDK_KEY!,
291
+ },
280
292
  // by default, getReplaneSnapshot will reuse the created client for 60 seconds for fast subsequent calls, the client will be syncing with the server in the background during this time
281
293
  keepAliveMs: 60_000,
282
294
  });
package/dist/index.cjs CHANGED
@@ -26,7 +26,7 @@ const __replanejs_react = __toESM(require("@replanejs/react"));
26
26
  const react_jsx_runtime = __toESM(require("react/jsx-runtime"));
27
27
 
28
28
  //#region src/version.ts
29
- const VERSION = "0.9.0";
29
+ const VERSION = "0.9.4";
30
30
  const DEFAULT_AGENT = `replane-js-next/${VERSION}`;
31
31
 
32
32
  //#endregion
@@ -45,7 +45,7 @@ const DEFAULT_AGENT = `replane-js-next/${VERSION}`;
45
45
  * <html>
46
46
  * <body>
47
47
  * <ReplaneRoot
48
- * options={{
48
+ * connection={{
49
49
  * baseUrl: process.env.NEXT_PUBLIC_REPLANE_BASE_URL!,
50
50
  * sdkKey: process.env.NEXT_PUBLIC_REPLANE_SDK_KEY!,
51
51
  * }}
@@ -58,15 +58,20 @@ const DEFAULT_AGENT = `replane-js-next/${VERSION}`;
58
58
  * }
59
59
  * ```
60
60
  */
61
- async function ReplaneRoot({ options, children }) {
62
- const optionsWithAgent = {
63
- ...options,
64
- agent: options.agent ?? DEFAULT_AGENT
65
- };
66
- const snapshot = await (0, __replanejs_sdk.getReplaneSnapshot)(optionsWithAgent);
61
+ async function ReplaneRoot({ children,...options }) {
62
+ const { connection: originalConnection,...replaneOptions } = options;
63
+ const connectionWithAgent = originalConnection ? {
64
+ ...originalConnection,
65
+ agent: originalConnection.agent ?? DEFAULT_AGENT
66
+ } : null;
67
+ const snapshot = await (0, __replanejs_sdk.getReplaneSnapshot)({
68
+ ...replaneOptions,
69
+ connection: connectionWithAgent
70
+ });
67
71
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__replanejs_react.ReplaneProvider, {
68
- options: optionsWithAgent,
72
+ connection: connectionWithAgent,
69
73
  snapshot,
74
+ ...replaneOptions,
70
75
  children
71
76
  });
72
77
  }
package/dist/index.d.cts CHANGED
@@ -1,18 +1,14 @@
1
1
  import * as react_jsx_runtime0 from "react/jsx-runtime";
2
2
  import { ReactNode } from "react";
3
- import { ConnectOptions, GetConfigOptions, GetReplaneSnapshotOptions, Replane, ReplaneContext, ReplaneError, ReplaneErrorCode, ReplaneLogger, ReplaneOptions, ReplaneProvider, ReplaneProviderOptions, ReplaneProviderOptions as ReplaneProviderOptions$1, ReplaneProviderProps, ReplaneProviderWithClientProps, ReplaneProviderWithOptionsProps, ReplaneSnapshot, clearSuspenseCache, createConfigHook, createReplaneHook, getReplaneSnapshot, useConfig, useReplane } from "@replanejs/react";
3
+ import { GetReplaneSnapshotOptions as GetReplaneSnapshotOptions$1 } from "@replanejs/sdk";
4
+ import { ConnectOptions, GetConfigOptions, GetReplaneSnapshotOptions, Replane, ReplaneContext, ReplaneError, ReplaneErrorCode, ReplaneLogger, ReplaneOptions, ReplaneProvider, ReplaneProviderProps, ReplaneProviderWithClientProps, ReplaneProviderWithOptionsProps, ReplaneSnapshot, clearSuspenseCache, createConfigHook, createReplaneHook, getReplaneSnapshot, useConfig, useReplane } from "@replanejs/react";
4
5
 
5
6
  //#region src/root.d.ts
6
7
 
7
8
  /**
8
9
  * Props for ReplaneRoot server component
9
10
  */
10
- interface ReplaneRootProps<T extends object> {
11
- /**
12
- * Options for Replane client.
13
- * Used for both server-side fetching and client-side live updates.
14
- */
15
- options: ReplaneProviderOptions$1<T>;
11
+ interface ReplaneRootProps<T extends object> extends GetReplaneSnapshotOptions$1<T> {
16
12
  /**
17
13
  * React children to render inside the provider
18
14
  */
@@ -32,7 +28,7 @@ interface ReplaneRootProps<T extends object> {
32
28
  * <html>
33
29
  * <body>
34
30
  * <ReplaneRoot
35
- * options={{
31
+ * connection={{
36
32
  * baseUrl: process.env.NEXT_PUBLIC_REPLANE_BASE_URL!,
37
33
  * sdkKey: process.env.NEXT_PUBLIC_REPLANE_SDK_KEY!,
38
34
  * }}
@@ -46,10 +42,10 @@ interface ReplaneRootProps<T extends object> {
46
42
  * ```
47
43
  */
48
44
  declare function ReplaneRoot<T extends object>({
49
- options,
50
- children
45
+ children,
46
+ ...options
51
47
  }: ReplaneRootProps<T>): Promise<react_jsx_runtime0.JSX.Element>;
52
48
  //# sourceMappingURL=root.d.ts.map
53
49
  //#endregion
54
- export { type ConnectOptions, type GetConfigOptions, type GetReplaneSnapshotOptions, Replane, type ReplaneContext, ReplaneError, ReplaneErrorCode, type ReplaneLogger, type ReplaneOptions, ReplaneProvider, type ReplaneProviderOptions, type ReplaneProviderProps, type ReplaneProviderWithClientProps, type ReplaneProviderWithOptionsProps, ReplaneRoot, type ReplaneRootProps, type ReplaneSnapshot, clearSuspenseCache, createConfigHook, createReplaneHook, getReplaneSnapshot, useConfig, useReplane };
50
+ export { type ConnectOptions, type GetConfigOptions, type GetReplaneSnapshotOptions, Replane, type ReplaneContext, ReplaneError, ReplaneErrorCode, type ReplaneLogger, type ReplaneOptions, ReplaneProvider, type ReplaneProviderProps, type ReplaneProviderWithClientProps, type ReplaneProviderWithOptionsProps, ReplaneRoot, type ReplaneRootProps, type ReplaneSnapshot, clearSuspenseCache, createConfigHook, createReplaneHook, getReplaneSnapshot, useConfig, useReplane };
55
51
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/root.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;AAsBY,UATK,gBASL,CAAA,UAAA,MAAA,CAAA,CAAA;EAAS;AA8BrB;;;EAA6D,OAAE,EAlCpD,wBAkCoD,CAlC7B,CAkC6B,CAAA;EAAQ;;;EAAuB,QAAA,EA9BlF,SA8BkF;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAxE;;;GAAqD,iBAAiB,KAAE,QAAA,kBAAA,CAAA,GAAA,CAAA,OAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/root.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAaA;;;AAIY,UAJK,gBAIL,CAAA,UAAA,MAAA,CAAA,SAJgD,2BAIhD,CAJ0E,CAI1E,CAAA,CAAA;EAAS;AAJgE;AAkCrF;EAAiC,QAAA,EA9BrB,SA8BqB;;;;;;AAAgE;;;;;;;;;;;;;;;;;;;;;;;iBAA3E;;;GAAwD,iBAAiB,KAAE,QAAA,kBAAA,CAAA,GAAA,CAAA,OAAA"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { ConnectOptions, GetConfigOptions, GetReplaneSnapshotOptions, Replane, ReplaneContext, ReplaneError, ReplaneErrorCode, ReplaneLogger, ReplaneOptions, ReplaneProvider, ReplaneProviderOptions, ReplaneProviderOptions as ReplaneProviderOptions$1, ReplaneProviderProps, ReplaneProviderWithClientProps, ReplaneProviderWithOptionsProps, ReplaneSnapshot, clearSuspenseCache, createConfigHook, createReplaneHook, getReplaneSnapshot, useConfig, useReplane } from "@replanejs/react";
1
+ import { GetReplaneSnapshotOptions as GetReplaneSnapshotOptions$1 } from "@replanejs/sdk";
2
+ import { ConnectOptions, GetConfigOptions, GetReplaneSnapshotOptions, Replane, ReplaneContext, ReplaneError, ReplaneErrorCode, ReplaneLogger, ReplaneOptions, ReplaneProvider, ReplaneProviderProps, ReplaneProviderWithClientProps, ReplaneProviderWithOptionsProps, ReplaneSnapshot, clearSuspenseCache, createConfigHook, createReplaneHook, getReplaneSnapshot, useConfig, useReplane } from "@replanejs/react";
2
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
3
4
  import { ReactNode } from "react";
4
5
 
@@ -7,12 +8,7 @@ import { ReactNode } from "react";
7
8
  /**
8
9
  * Props for ReplaneRoot server component
9
10
  */
10
- interface ReplaneRootProps<T extends object> {
11
- /**
12
- * Options for Replane client.
13
- * Used for both server-side fetching and client-side live updates.
14
- */
15
- options: ReplaneProviderOptions$1<T>;
11
+ interface ReplaneRootProps<T extends object> extends GetReplaneSnapshotOptions$1<T> {
16
12
  /**
17
13
  * React children to render inside the provider
18
14
  */
@@ -32,7 +28,7 @@ interface ReplaneRootProps<T extends object> {
32
28
  * <html>
33
29
  * <body>
34
30
  * <ReplaneRoot
35
- * options={{
31
+ * connection={{
36
32
  * baseUrl: process.env.NEXT_PUBLIC_REPLANE_BASE_URL!,
37
33
  * sdkKey: process.env.NEXT_PUBLIC_REPLANE_SDK_KEY!,
38
34
  * }}
@@ -46,10 +42,10 @@ interface ReplaneRootProps<T extends object> {
46
42
  * ```
47
43
  */
48
44
  declare function ReplaneRoot<T extends object>({
49
- options,
50
- children
45
+ children,
46
+ ...options
51
47
  }: ReplaneRootProps<T>): Promise<react_jsx_runtime0.JSX.Element>;
52
48
  //# sourceMappingURL=root.d.ts.map
53
49
  //#endregion
54
- export { type ConnectOptions, type GetConfigOptions, type GetReplaneSnapshotOptions, Replane, type ReplaneContext, ReplaneError, ReplaneErrorCode, type ReplaneLogger, type ReplaneOptions, ReplaneProvider, type ReplaneProviderOptions, type ReplaneProviderProps, type ReplaneProviderWithClientProps, type ReplaneProviderWithOptionsProps, ReplaneRoot, type ReplaneRootProps, type ReplaneSnapshot, clearSuspenseCache, createConfigHook, createReplaneHook, getReplaneSnapshot, useConfig, useReplane };
50
+ export { type ConnectOptions, type GetConfigOptions, type GetReplaneSnapshotOptions, Replane, type ReplaneContext, ReplaneError, ReplaneErrorCode, type ReplaneLogger, type ReplaneOptions, ReplaneProvider, type ReplaneProviderProps, type ReplaneProviderWithClientProps, type ReplaneProviderWithOptionsProps, ReplaneRoot, type ReplaneRootProps, type ReplaneSnapshot, clearSuspenseCache, createConfigHook, createReplaneHook, getReplaneSnapshot, useConfig, useReplane };
55
51
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/root.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;AAsBY,UATK,gBASL,CAAA,UAAA,MAAA,CAAA,CAAA;EAAS;AA8BrB;;;EAA6D,OAAE,EAlCpD,wBAkCoD,CAlC7B,CAkC6B,CAAA;EAAQ;;;EAAuB,QAAA,EA9BlF,SA8BkF;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAxE;;;GAAqD,iBAAiB,KAAE,QAAA,kBAAA,CAAA,GAAA,CAAA,OAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/root.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAaA;;;AAIY,UAJK,gBAIL,CAAA,UAAA,MAAA,CAAA,SAJgD,2BAIhD,CAJ0E,CAI1E,CAAA,CAAA;EAAS;AAJgE;AAkCrF;EAAiC,QAAA,EA9BrB,SA8BqB;;;;;;AAAgE;;;;;;;;;;;;;;;;;;;;;;;iBAA3E;;;GAAwD,iBAAiB,KAAE,QAAA,kBAAA,CAAA,GAAA,CAAA,OAAA"}
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { Replane, ReplaneError, ReplaneErrorCode, ReplaneProvider, ReplaneProvid
3
3
  import { jsx } from "react/jsx-runtime";
4
4
 
5
5
  //#region src/version.ts
6
- const VERSION = "0.9.0";
6
+ const VERSION = "0.9.4";
7
7
  const DEFAULT_AGENT = `replane-js-next/${VERSION}`;
8
8
 
9
9
  //#endregion
@@ -22,7 +22,7 @@ const DEFAULT_AGENT = `replane-js-next/${VERSION}`;
22
22
  * <html>
23
23
  * <body>
24
24
  * <ReplaneRoot
25
- * options={{
25
+ * connection={{
26
26
  * baseUrl: process.env.NEXT_PUBLIC_REPLANE_BASE_URL!,
27
27
  * sdkKey: process.env.NEXT_PUBLIC_REPLANE_SDK_KEY!,
28
28
  * }}
@@ -35,15 +35,20 @@ const DEFAULT_AGENT = `replane-js-next/${VERSION}`;
35
35
  * }
36
36
  * ```
37
37
  */
38
- async function ReplaneRoot({ options, children }) {
39
- const optionsWithAgent = {
40
- ...options,
41
- agent: options.agent ?? DEFAULT_AGENT
42
- };
43
- const snapshot = await getReplaneSnapshot$1(optionsWithAgent);
38
+ async function ReplaneRoot({ children,...options }) {
39
+ const { connection: originalConnection,...replaneOptions } = options;
40
+ const connectionWithAgent = originalConnection ? {
41
+ ...originalConnection,
42
+ agent: originalConnection.agent ?? DEFAULT_AGENT
43
+ } : null;
44
+ const snapshot = await getReplaneSnapshot$1({
45
+ ...replaneOptions,
46
+ connection: connectionWithAgent
47
+ });
44
48
  return /* @__PURE__ */ jsx(ReplaneProvider$1, {
45
- options: optionsWithAgent,
49
+ connection: connectionWithAgent,
46
50
  snapshot,
51
+ ...replaneOptions,
47
52
  children
48
53
  });
49
54
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ReplaneProvider"],"sources":["../src/version.ts","../src/root.tsx"],"sourcesContent":["// Auto-generated - do not edit manually\nexport const VERSION = \"0.9.0\";\nexport const DEFAULT_AGENT = `replane-js-next/${VERSION}`;\n","/**\n * Server-side utilities for Next.js\n * Use this module in Server Components, getServerSideProps, or getStaticProps\n */\n\nimport type { ReactNode } from \"react\";\nimport { getReplaneSnapshot } from \"@replanejs/sdk\";\nimport { ReplaneProvider, type ReplaneProviderOptions } from \"@replanejs/react\";\nimport { DEFAULT_AGENT } from \"./version\";\n\n/**\n * Props for ReplaneRoot server component\n */\nexport interface ReplaneRootProps<T extends object> {\n /**\n * Options for Replane client.\n * Used for both server-side fetching and client-side live updates.\n */\n options: ReplaneProviderOptions<T>;\n /**\n * React children to render inside the provider\n */\n children: ReactNode;\n}\n\n/**\n * Server component that fetches Replane configs and provides them to the app.\n * This is the simplest way to set up Replane in Next.js App Router.\n *\n * @example Basic usage in layout.tsx\n * ```tsx\n * // app/layout.tsx\n * import { ReplaneRoot } from \"@replanejs/next\";\n *\n * export default function RootLayout({ children }) {\n * return (\n * <html>\n * <body>\n * <ReplaneRoot\n * options={{\n * baseUrl: process.env.NEXT_PUBLIC_REPLANE_BASE_URL!,\n * sdkKey: process.env.NEXT_PUBLIC_REPLANE_SDK_KEY!,\n * }}\n * >\n * {children}\n * </ReplaneRoot>\n * </body>\n * </html>\n * );\n * }\n * ```\n */\nexport async function ReplaneRoot<T extends object>({ options, children }: ReplaneRootProps<T>) {\n const optionsWithAgent = {\n ...options,\n agent: options.agent ?? DEFAULT_AGENT,\n };\n const snapshot = await getReplaneSnapshot(optionsWithAgent);\n\n return (\n <ReplaneProvider options={optionsWithAgent} snapshot={snapshot}>\n {children}\n </ReplaneProvider>\n );\n}\n"],"mappings":";;;;;AACA,MAAa,UAAU;AACvB,MAAa,iBAAiB,kBAAkB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACkDxD,eAAsB,YAA8B,EAAE,SAAS,UAA+B,EAAE;CAC9F,MAAM,mBAAmB;EACvB,GAAG;EACH,OAAO,QAAQ,SAAS;CACzB;CACD,MAAM,WAAW,MAAM,qBAAmB,iBAAiB;AAE3D,wBACE,IAACA;EAAgB,SAAS;EAA4B;EACnD;GACe;AAErB"}
1
+ {"version":3,"file":"index.js","names":["ReplaneProvider"],"sources":["../src/version.ts","../src/root.tsx"],"sourcesContent":["// Auto-generated - do not edit manually\nexport const VERSION = \"0.9.4\";\nexport const DEFAULT_AGENT = `replane-js-next/${VERSION}`;\n","/**\n * Server-side utilities for Next.js\n * Use this module in Server Components, getServerSideProps, or getStaticProps\n */\n\nimport type { ReactNode } from \"react\";\nimport { getReplaneSnapshot, type GetReplaneSnapshotOptions } from \"@replanejs/sdk\";\nimport { ReplaneProvider } from \"@replanejs/react\";\nimport { DEFAULT_AGENT } from \"./version\";\n\n/**\n * Props for ReplaneRoot server component\n */\nexport interface ReplaneRootProps<T extends object> extends GetReplaneSnapshotOptions<T> {\n /**\n * React children to render inside the provider\n */\n children: ReactNode;\n}\n\n/**\n * Server component that fetches Replane configs and provides them to the app.\n * This is the simplest way to set up Replane in Next.js App Router.\n *\n * @example Basic usage in layout.tsx\n * ```tsx\n * // app/layout.tsx\n * import { ReplaneRoot } from \"@replanejs/next\";\n *\n * export default function RootLayout({ children }) {\n * return (\n * <html>\n * <body>\n * <ReplaneRoot\n * connection={{\n * baseUrl: process.env.NEXT_PUBLIC_REPLANE_BASE_URL!,\n * sdkKey: process.env.NEXT_PUBLIC_REPLANE_SDK_KEY!,\n * }}\n * >\n * {children}\n * </ReplaneRoot>\n * </body>\n * </html>\n * );\n * }\n * ```\n */\nexport async function ReplaneRoot<T extends object>({ children, ...options }: ReplaneRootProps<T>) {\n const { connection: originalConnection, ...replaneOptions } = options;\n const connectionWithAgent = originalConnection\n ? {\n ...originalConnection,\n agent: originalConnection.agent ?? DEFAULT_AGENT,\n }\n : null;\n const snapshot = await getReplaneSnapshot({\n ...replaneOptions,\n connection: connectionWithAgent,\n });\n\n return (\n <ReplaneProvider connection={connectionWithAgent} snapshot={snapshot} {...replaneOptions}>\n {children}\n </ReplaneProvider>\n );\n}\n"],"mappings":";;;;;AACA,MAAa,UAAU;AACvB,MAAa,iBAAiB,kBAAkB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC6CxD,eAAsB,YAA8B,EAAE,SAAU,GAAG,SAA8B,EAAE;CACjG,MAAM,EAAE,YAAY,mBAAoB,GAAG,gBAAgB,GAAG;CAC9D,MAAM,sBAAsB,qBACxB;EACE,GAAG;EACH,OAAO,mBAAmB,SAAS;CACpC,IACD;CACJ,MAAM,WAAW,MAAM,qBAAmB;EACxC,GAAG;EACH,YAAY;CACb,EAAC;AAEF,wBACE,IAACA;EAAgB,YAAY;EAA+B;EAAU,GAAI;EACvE;GACe;AAErB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@replanejs/next",
3
- "version": "0.9.0",
3
+ "version": "0.9.4",
4
4
  "description": "Next.js SDK for Replane - feature flags and remote configuration with SSR support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -45,8 +45,8 @@
45
45
  "react": ">=18.0.0"
46
46
  },
47
47
  "dependencies": {
48
- "@replanejs/sdk": "^0.9.0",
49
- "@replanejs/react": "^0.9.0"
48
+ "@replanejs/react": "^0.9.4",
49
+ "@replanejs/sdk": "^0.9.4"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/node": "^22.19.3",