@uniformdev/canvas-next-rsc 20.72.2 → 20.72.3-alpha.14

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/dist/component.js CHANGED
@@ -119,11 +119,11 @@ Add this component mapping to your resolveComponent function on UniformCompositi
119
119
 
120
120
  // src/components/UniformRichText.tsx
121
121
  var import_canvas = require("@uniformdev/canvas");
122
- var import_richtext5 = require("@uniformdev/richtext");
122
+ var import_richtext6 = require("@uniformdev/richtext");
123
123
  var import_react13 = __toESM(require("react"));
124
124
 
125
125
  // src/components/UniformRichTextNode.tsx
126
- var import_richtext4 = require("@uniformdev/richtext");
126
+ var import_richtext5 = require("@uniformdev/richtext");
127
127
  var import_react12 = __toESM(require("react"));
128
128
 
129
129
  // src/components/nodes/AssetRichTextNode.tsx
@@ -161,11 +161,11 @@ var LinebreakRichTextNode = () => {
161
161
  };
162
162
 
163
163
  // src/components/nodes/LinkRichTextNode.tsx
164
- var import_canvas_react = require("@uniformdev/canvas-react");
164
+ var import_richtext = require("@uniformdev/richtext");
165
165
  var import_react5 = __toESM(require("react"));
166
166
  var LinkRichTextNode = ({ children, node }) => {
167
167
  const { link } = node;
168
- return /* @__PURE__ */ import_react5.default.createElement("a", { ...(0, import_canvas_react.linkParamValueToAnchorProps)(link) }, children);
168
+ return /* @__PURE__ */ import_react5.default.createElement("a", { ...(0, import_richtext.linkParamValueToAnchorProps)(link) }, children);
169
169
  };
170
170
 
171
171
  // src/components/nodes/ListItemRichTextNode.tsx
@@ -184,26 +184,26 @@ var ListRichTextNode = ({ children, node }) => {
184
184
  };
185
185
 
186
186
  // src/components/nodes/ParagraphRichTextNode.tsx
187
- var import_richtext = require("@uniformdev/richtext");
187
+ var import_richtext2 = require("@uniformdev/richtext");
188
188
  var import_react8 = __toESM(require("react"));
189
189
  var ParagraphRichTextNode = ({ children, node }) => {
190
190
  const { format, direction } = node;
191
191
  return /* @__PURE__ */ import_react8.default.createElement(
192
192
  "p",
193
193
  {
194
- dir: (0, import_richtext.isPureDirection)(direction) ? direction : void 0,
195
- style: (0, import_richtext.isPureTextAlign)(format) ? { textAlign: format } : void 0
194
+ dir: (0, import_richtext2.isPureDirection)(direction) ? direction : void 0,
195
+ style: (0, import_richtext2.isPureTextAlign)(format) ? { textAlign: format } : void 0
196
196
  },
197
197
  children
198
198
  );
199
199
  };
200
200
 
201
201
  // src/components/nodes/TableCellRichTextNode.tsx
202
- var import_richtext2 = require("@uniformdev/richtext");
202
+ var import_richtext3 = require("@uniformdev/richtext");
203
203
  var import_react9 = __toESM(require("react"));
204
204
  var TableCellRichTextNode = ({ children, node }) => {
205
205
  const { headerState } = node;
206
- const TableCellTag = (0, import_richtext2.getRichTextTagFromTableCellHeaderState)(headerState);
206
+ const TableCellTag = (0, import_richtext3.getRichTextTagFromTableCellHeaderState)(headerState);
207
207
  return /* @__PURE__ */ import_react9.default.createElement(TableCellTag, null, children);
208
208
  };
209
209
 
@@ -214,18 +214,18 @@ var TabRichTextNode = () => {
214
214
  };
215
215
 
216
216
  // src/components/nodes/TextRichTextNode.tsx
217
- var import_richtext3 = require("@uniformdev/richtext");
217
+ var import_richtext4 = require("@uniformdev/richtext");
218
218
  var import_react11 = __toESM(require("react"));
219
219
  var TextRichTextNode = ({ node }) => {
220
220
  const { text, format } = node;
221
- const tags = (0, import_richtext3.getRichTextTagsFromTextFormat)(format);
221
+ const tags = (0, import_richtext4.getRichTextTagsFromTextFormat)(format);
222
222
  return /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, tags.length > 0 ? tags.reduceRight((children, Tag) => /* @__PURE__ */ import_react11.default.createElement(Tag, null, children), text) : text);
223
223
  };
224
224
 
225
225
  // src/components/UniformRichTextNode.tsx
226
226
  function UniformRichTextNode({ node, ...props }) {
227
227
  var _a;
228
- if (!(0, import_richtext4.isRichTextNode)(node)) return null;
228
+ if (!(0, import_richtext5.isRichTextNode)(node)) return null;
229
229
  let NodeRenderer = (_a = props.resolveRichTextRenderer) == null ? void 0 : _a.call(props, node);
230
230
  if (typeof NodeRenderer === "undefined") {
231
231
  NodeRenderer = resolveRichTextDefaultRenderer(node);
@@ -281,8 +281,8 @@ var UniformRichText = import_react13.default.forwardRef(function UniformRichText
281
281
  }
282
282
  const computedPlaceholder = typeof placeholder === "function" ? placeholder({ id: parameterId }) : placeholder;
283
283
  const value = parameter.value;
284
- if (!value || !(0, import_richtext5.isRichTextValue)(value)) return null;
285
- if (!isContextualEditing && (0, import_richtext5.isRichTextValueConsideredEmpty)(value)) return null;
284
+ if (!value || !(0, import_richtext6.isRichTextValue)(value)) return null;
285
+ if (!isContextualEditing && (0, import_richtext6.isRichTextValueConsideredEmpty)(value)) return null;
286
286
  return Tag === null ? /* @__PURE__ */ import_react13.default.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer }) : /* @__PURE__ */ import_react13.default.createElement(
287
287
  Tag,
288
288
  {
@@ -294,7 +294,7 @@ var UniformRichText = import_react13.default.forwardRef(function UniformRichText
294
294
  [import_canvas.ATTRIBUTE_PARAMETER_TYPE]: "richText"
295
295
  } : {}
296
296
  },
297
- (0, import_richtext5.isRichTextValueConsideredEmpty)(value) ? /* @__PURE__ */ import_react13.default.createElement("p", null, /* @__PURE__ */ import_react13.default.createElement("i", null, computedPlaceholder)) : /* @__PURE__ */ import_react13.default.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer })
297
+ (0, import_richtext6.isRichTextValueConsideredEmpty)(value) ? /* @__PURE__ */ import_react13.default.createElement("p", null, /* @__PURE__ */ import_react13.default.createElement("i", null, computedPlaceholder)) : /* @__PURE__ */ import_react13.default.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer })
298
298
  );
299
299
  });
300
300
 
@@ -122,7 +122,7 @@ var LinebreakRichTextNode = () => {
122
122
  };
123
123
 
124
124
  // src/components/nodes/LinkRichTextNode.tsx
125
- import { linkParamValueToAnchorProps } from "@uniformdev/canvas-react";
125
+ import { linkParamValueToAnchorProps } from "@uniformdev/richtext";
126
126
  import React5 from "react";
127
127
  var LinkRichTextNode = ({ children, node }) => {
128
128
  const { link } = node;
package/dist/handler.js CHANGED
@@ -247,8 +247,8 @@ var determineFetchCacheOptions = (mode) => {
247
247
  };
248
248
 
249
249
  // src/clients/canvasClient.ts
250
- var getCanvasClient = (options) => {
251
- return new import_canvas2.CanvasClient({
250
+ var buildCanvasClientOptions = (options) => {
251
+ return {
252
252
  projectId: env.getProjectId(),
253
253
  apiHost: env.getApiHost(),
254
254
  apiKey: env.getApiKey(),
@@ -293,7 +293,10 @@ var getCanvasClient = (options) => {
293
293
  }
294
294
  });
295
295
  }
296
- });
296
+ };
297
+ };
298
+ var getCompositionDeliveryClient = (options) => {
299
+ return new import_canvas2.CompositionDeliveryClient(buildCanvasClientOptions(options));
297
300
  };
298
301
 
299
302
  // src/clients/projectMapClient.ts
@@ -438,13 +441,13 @@ var processCompositionChange = async (compositionId) => {
438
441
  };
439
442
  };
440
443
  var getComposition = async ({ compositionId }) => {
441
- const canvasClient = getCanvasClient({
444
+ const canvasClient = getCompositionDeliveryClient({
442
445
  cache: {
443
446
  type: "no-cache"
444
447
  }
445
448
  });
446
449
  try {
447
- const composition = await canvasClient.getCompositionById({
450
+ const composition = await canvasClient.get({
448
451
  compositionId
449
452
  });
450
453
  return composition;
@@ -510,7 +513,7 @@ var processEdgeConfigChange = async ({ source_url }) => {
510
513
  type: "no-cache"
511
514
  }
512
515
  });
513
- const route = await routeClient.getRoute({
516
+ const route = await routeClient.get({
514
517
  path: source_url
515
518
  });
516
519
  let valueToStore = void 0;
package/dist/handler.mjs CHANGED
@@ -155,7 +155,7 @@ import { parseConnectionString } from "@vercel/edge-config";
155
155
  import { Webhook } from "svix";
156
156
 
157
157
  // src/clients/canvasClient.ts
158
- import { CanvasClient } from "@uniformdev/canvas";
158
+ import { CanvasClient, CompositionDeliveryClient } from "@uniformdev/canvas";
159
159
 
160
160
  // src/config/helpers.ts
161
161
  import serverConfig from "uniform.server.config";
@@ -214,8 +214,8 @@ var determineFetchCacheOptions = (mode) => {
214
214
  };
215
215
 
216
216
  // src/clients/canvasClient.ts
217
- var getCanvasClient = (options) => {
218
- return new CanvasClient({
217
+ var buildCanvasClientOptions = (options) => {
218
+ return {
219
219
  projectId: env.getProjectId(),
220
220
  apiHost: env.getApiHost(),
221
221
  apiKey: env.getApiKey(),
@@ -260,7 +260,10 @@ var getCanvasClient = (options) => {
260
260
  }
261
261
  });
262
262
  }
263
- });
263
+ };
264
+ };
265
+ var getCompositionDeliveryClient = (options) => {
266
+ return new CompositionDeliveryClient(buildCanvasClientOptions(options));
264
267
  };
265
268
 
266
269
  // src/clients/projectMapClient.ts
@@ -405,13 +408,13 @@ var processCompositionChange = async (compositionId) => {
405
408
  };
406
409
  };
407
410
  var getComposition = async ({ compositionId }) => {
408
- const canvasClient = getCanvasClient({
411
+ const canvasClient = getCompositionDeliveryClient({
409
412
  cache: {
410
413
  type: "no-cache"
411
414
  }
412
415
  });
413
416
  try {
414
- const composition = await canvasClient.getCompositionById({
417
+ const composition = await canvasClient.get({
415
418
  compositionId
416
419
  });
417
420
  return composition;
@@ -477,7 +480,7 @@ var processEdgeConfigChange = async ({ source_url }) => {
477
480
  type: "no-cache"
478
481
  }
479
482
  });
480
- const route = await routeClient.getRoute({
483
+ const route = await routeClient.get({
481
484
  path: source_url
482
485
  });
483
486
  let valueToStore = void 0;
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { CanvasClient, RouteClient, CompositionGetBySlugParameters, ResolvedRouteGetResponse, RouteGetParameters } from '@uniformdev/canvas';
1
+ import { CanvasClient, CompositionDeliveryClient, RouteClient, CompositionGetBySlugParameters, ResolvedRouteGetResponse, RouteGetParameters } from '@uniformdev/canvas';
2
2
  import { UniformServerConfig, CompositionContext, AppDirectoryContextState, AppDirectoryServerContext, PlaygroundParameters, AwaitedPageParameters, PageParameters } from '@uniformdev/canvas-next-rsc-shared';
3
3
  export { PageParameters, PlaygroundParameters } from '@uniformdev/canvas-next-rsc-shared';
4
4
  import { ManifestClient } from '@uniformdev/context/api';
@@ -12,8 +12,17 @@ import { ClientContextComponent } from '@uniformdev/canvas-next-rsc-client';
12
12
  type GetCanvasClientOptions = {
13
13
  cache: NonNullable<UniformServerConfig['canvasCache']>;
14
14
  };
15
+ type GetCompositionDeliveryClientOptions = GetCanvasClientOptions;
16
+ /**
17
+ * @deprecated Use {@link getCompositionDeliveryClient} instead
18
+ */
15
19
  declare const getCanvasClient: (options: GetCanvasClientOptions) => CanvasClient;
20
+ declare const getCompositionDeliveryClient: (options: GetCompositionDeliveryClientOptions) => CompositionDeliveryClient;
21
+ /**
22
+ * @deprecated Use {@link getDefaultCompositionDeliveryClient} instead.
23
+ */
16
24
  declare const getDefaultCanvasClient: (options: Pick<CompositionContext, "searchParams">) => Promise<CanvasClient>;
25
+ declare const getDefaultCompositionDeliveryClient: (options: Pick<CompositionContext, "searchParams">) => Promise<CompositionDeliveryClient>;
17
26
 
18
27
  type GetManifestClientOptions = {
19
28
  cache: NonNullable<UniformServerConfig['manifestCache']>;
@@ -248,8 +257,8 @@ type RetrieveSlugOptions = Pick<CompositionGetBySlugParameters, 'slug' | 'locale
248
257
  [key: string]: string | undefined;
249
258
  };
250
259
  } & RetrieveCommonOptions;
251
- type RetrieveRouteFetchOptions = Omit<RouteGetParameters, 'projectId' | 'path' | 'withComponentIDs' | 'withContentSourceMap' | 'state'>;
260
+ type RetrieveRouteFetchOptions = Omit<RouteGetParameters, 'projectId' | 'path' | 'withComponentIDs' | 'state'>;
252
261
  declare const retrieveCompositionBySlug: ({ slug, searchParams, skipPrefetch, locale, releaseId, versionId, }: RetrieveSlugOptions) => Promise<ResolvedRouteGetResponse>;
253
262
  declare const retrieveRoute: ({ params, searchParams: providedSearchParams, skipPrefetch }: RetrieveRouteOptions, fetchOptions?: RetrieveRouteFetchOptions) => Promise<ResolvedRouteGetResponse>;
254
263
 
255
- export { ContextUpdateTransfer, type ContextUpdateTransferProps, type CreateServerUniformContextProps, type CreateStaticParamsOptions, type GetCanvasClientOptions, type GetManifestClientOptions, type GetProjectMapClientOptions, type GetRouteClientOptions, UniformCompositionProps, UniformContext, type UniformContextProps, UniformPlayground, type UniformPlaygroundProps, createServerUniformContext, createStaticParams, generateStaticParams, getCanvasClient, getDefaultCanvasClient, getDefaultManifestClient, getDefaultProjectMapClient, getDefaultRouteClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, isDevelopmentEnvironment, isDraftModeEnabled, isIncontextEditingEnabled, isOnVercelPreviewEnvironment, retrieveCompositionBySlug, retrieveRoute };
264
+ export { ContextUpdateTransfer, type ContextUpdateTransferProps, type CreateServerUniformContextProps, type CreateStaticParamsOptions, type GetCanvasClientOptions, type GetCompositionDeliveryClientOptions, type GetManifestClientOptions, type GetProjectMapClientOptions, type GetRouteClientOptions, UniformCompositionProps, UniformContext, type UniformContextProps, UniformPlayground, type UniformPlaygroundProps, createServerUniformContext, createStaticParams, generateStaticParams, getCanvasClient, getCompositionDeliveryClient, getDefaultCanvasClient, getDefaultCompositionDeliveryClient, getDefaultManifestClient, getDefaultProjectMapClient, getDefaultRouteClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, isDevelopmentEnvironment, isDraftModeEnabled, isIncontextEditingEnabled, isOnVercelPreviewEnvironment, retrieveCompositionBySlug, retrieveRoute };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CanvasClient, RouteClient, CompositionGetBySlugParameters, ResolvedRouteGetResponse, RouteGetParameters } from '@uniformdev/canvas';
1
+ import { CanvasClient, CompositionDeliveryClient, RouteClient, CompositionGetBySlugParameters, ResolvedRouteGetResponse, RouteGetParameters } from '@uniformdev/canvas';
2
2
  import { UniformServerConfig, CompositionContext, AppDirectoryContextState, AppDirectoryServerContext, PlaygroundParameters, AwaitedPageParameters, PageParameters } from '@uniformdev/canvas-next-rsc-shared';
3
3
  export { PageParameters, PlaygroundParameters } from '@uniformdev/canvas-next-rsc-shared';
4
4
  import { ManifestClient } from '@uniformdev/context/api';
@@ -12,8 +12,17 @@ import { ClientContextComponent } from '@uniformdev/canvas-next-rsc-client';
12
12
  type GetCanvasClientOptions = {
13
13
  cache: NonNullable<UniformServerConfig['canvasCache']>;
14
14
  };
15
+ type GetCompositionDeliveryClientOptions = GetCanvasClientOptions;
16
+ /**
17
+ * @deprecated Use {@link getCompositionDeliveryClient} instead
18
+ */
15
19
  declare const getCanvasClient: (options: GetCanvasClientOptions) => CanvasClient;
20
+ declare const getCompositionDeliveryClient: (options: GetCompositionDeliveryClientOptions) => CompositionDeliveryClient;
21
+ /**
22
+ * @deprecated Use {@link getDefaultCompositionDeliveryClient} instead.
23
+ */
16
24
  declare const getDefaultCanvasClient: (options: Pick<CompositionContext, "searchParams">) => Promise<CanvasClient>;
25
+ declare const getDefaultCompositionDeliveryClient: (options: Pick<CompositionContext, "searchParams">) => Promise<CompositionDeliveryClient>;
17
26
 
18
27
  type GetManifestClientOptions = {
19
28
  cache: NonNullable<UniformServerConfig['manifestCache']>;
@@ -248,8 +257,8 @@ type RetrieveSlugOptions = Pick<CompositionGetBySlugParameters, 'slug' | 'locale
248
257
  [key: string]: string | undefined;
249
258
  };
250
259
  } & RetrieveCommonOptions;
251
- type RetrieveRouteFetchOptions = Omit<RouteGetParameters, 'projectId' | 'path' | 'withComponentIDs' | 'withContentSourceMap' | 'state'>;
260
+ type RetrieveRouteFetchOptions = Omit<RouteGetParameters, 'projectId' | 'path' | 'withComponentIDs' | 'state'>;
252
261
  declare const retrieveCompositionBySlug: ({ slug, searchParams, skipPrefetch, locale, releaseId, versionId, }: RetrieveSlugOptions) => Promise<ResolvedRouteGetResponse>;
253
262
  declare const retrieveRoute: ({ params, searchParams: providedSearchParams, skipPrefetch }: RetrieveRouteOptions, fetchOptions?: RetrieveRouteFetchOptions) => Promise<ResolvedRouteGetResponse>;
254
263
 
255
- export { ContextUpdateTransfer, type ContextUpdateTransferProps, type CreateServerUniformContextProps, type CreateStaticParamsOptions, type GetCanvasClientOptions, type GetManifestClientOptions, type GetProjectMapClientOptions, type GetRouteClientOptions, UniformCompositionProps, UniformContext, type UniformContextProps, UniformPlayground, type UniformPlaygroundProps, createServerUniformContext, createStaticParams, generateStaticParams, getCanvasClient, getDefaultCanvasClient, getDefaultManifestClient, getDefaultProjectMapClient, getDefaultRouteClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, isDevelopmentEnvironment, isDraftModeEnabled, isIncontextEditingEnabled, isOnVercelPreviewEnvironment, retrieveCompositionBySlug, retrieveRoute };
264
+ export { ContextUpdateTransfer, type ContextUpdateTransferProps, type CreateServerUniformContextProps, type CreateStaticParamsOptions, type GetCanvasClientOptions, type GetCompositionDeliveryClientOptions, type GetManifestClientOptions, type GetProjectMapClientOptions, type GetRouteClientOptions, UniformCompositionProps, UniformContext, type UniformContextProps, UniformPlayground, type UniformPlaygroundProps, createServerUniformContext, createStaticParams, generateStaticParams, getCanvasClient, getCompositionDeliveryClient, getDefaultCanvasClient, getDefaultCompositionDeliveryClient, getDefaultManifestClient, getDefaultProjectMapClient, getDefaultRouteClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, isDevelopmentEnvironment, isDraftModeEnabled, isIncontextEditingEnabled, isOnVercelPreviewEnvironment, retrieveCompositionBySlug, retrieveRoute };
package/dist/index.esm.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import "server-only";
3
3
 
4
4
  // src/clients/canvasClient.ts
5
- import { CanvasClient } from "@uniformdev/canvas";
5
+ import { CanvasClient, CompositionDeliveryClient } from "@uniformdev/canvas";
6
6
 
7
7
  // src/config/helpers.ts
8
8
  import serverConfig from "uniform.server.config";
@@ -184,8 +184,8 @@ var determineFetchCacheOptions = (mode) => {
184
184
  };
185
185
 
186
186
  // src/clients/canvasClient.ts
187
- var getCanvasClient = (options) => {
188
- return new CanvasClient({
187
+ var buildCanvasClientOptions = (options) => {
188
+ return {
189
189
  projectId: env.getProjectId(),
190
190
  apiHost: env.getApiHost(),
191
191
  apiKey: env.getApiKey(),
@@ -230,13 +230,24 @@ var getCanvasClient = (options) => {
230
230
  }
231
231
  });
232
232
  }
233
- });
233
+ };
234
+ };
235
+ var getCanvasClient = (options) => {
236
+ return new CanvasClient(buildCanvasClientOptions(options));
237
+ };
238
+ var getCompositionDeliveryClient = (options) => {
239
+ return new CompositionDeliveryClient(buildCanvasClientOptions(options));
234
240
  };
235
241
  var getDefaultCanvasClient = async (options) => {
236
242
  return getCanvasClient({
237
243
  cache: await getCanvasCacheStrategy(options)
238
244
  });
239
245
  };
246
+ var getDefaultCompositionDeliveryClient = async (options) => {
247
+ return getCompositionDeliveryClient({
248
+ cache: await getCanvasCacheStrategy(options)
249
+ });
250
+ };
240
251
 
241
252
  // src/clients/manifestClient.ts
242
253
  import { ManifestClient } from "@uniformdev/context/api";
@@ -477,7 +488,6 @@ var retrieveCompositionBySlug = async ({
477
488
  releaseId,
478
489
  versionId
479
490
  }) => {
480
- var _a;
481
491
  if (!skipPrefetch) {
482
492
  void getManifest({
483
493
  searchParams
@@ -489,15 +499,14 @@ var retrieveCompositionBySlug = async ({
489
499
  });
490
500
  for (let i = 0; i < states.length; i++) {
491
501
  const state = states[i];
492
- const canvasClient = await getDefaultCanvasClient({
502
+ const canvasClient = await getDefaultCompositionDeliveryClient({
493
503
  searchParams
494
504
  });
495
505
  try {
496
- const composition = await canvasClient.getCompositionBySlug({
506
+ const composition = await canvasClient.get({
497
507
  slug,
498
508
  state,
499
509
  withComponentIDs: true,
500
- withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing),
501
510
  locale,
502
511
  releaseId,
503
512
  versionId
@@ -571,7 +580,6 @@ var retrieveRouteByPath = async ({
571
580
  fetchOptions,
572
581
  releaseId
573
582
  }) => {
574
- var _a;
575
583
  const client = await getDefaultRouteClient({
576
584
  searchParams
577
585
  });
@@ -588,13 +596,12 @@ var retrieveRouteByPath = async ({
588
596
  queryPath = `${helper.pathname}${helper.search}`;
589
597
  }
590
598
  }
591
- return await client.getRoute({
599
+ return await client.get({
592
600
  ...fetchOptions,
593
601
  path: queryPath,
594
602
  state,
595
603
  dataSourceVariant: getDataSourceVariantFromRouteGetParams(fetchOptions != null ? fetchOptions : {}, state),
596
604
  withComponentIDs: true,
597
- withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing),
598
605
  releaseId
599
606
  });
600
607
  };
@@ -1158,7 +1165,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
1158
1165
  if (!id) {
1159
1166
  notFound2();
1160
1167
  }
1161
- const canvasClient = getCanvasClient({
1168
+ const canvasClient = getCompositionDeliveryClient({
1162
1169
  cache: {
1163
1170
  type: "no-cache"
1164
1171
  }
@@ -1168,7 +1175,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
1168
1175
  for (let i = 0; i < possibleStates.length; i++) {
1169
1176
  const state = possibleStates[i];
1170
1177
  try {
1171
- composition = await canvasClient.getCompositionById({
1178
+ composition = await canvasClient.get({
1172
1179
  compositionId: id,
1173
1180
  state,
1174
1181
  withComponentIDs: true
@@ -1207,7 +1214,9 @@ export {
1207
1214
  createStaticParams,
1208
1215
  generateStaticParams,
1209
1216
  getCanvasClient,
1217
+ getCompositionDeliveryClient,
1210
1218
  getDefaultCanvasClient,
1219
+ getDefaultCompositionDeliveryClient,
1211
1220
  getDefaultManifestClient,
1212
1221
  getDefaultProjectMapClient,
1213
1222
  getDefaultRouteClient,
package/dist/index.js CHANGED
@@ -38,7 +38,9 @@ __export(index_exports, {
38
38
  createStaticParams: () => createStaticParams,
39
39
  generateStaticParams: () => generateStaticParams,
40
40
  getCanvasClient: () => getCanvasClient,
41
+ getCompositionDeliveryClient: () => getCompositionDeliveryClient,
41
42
  getDefaultCanvasClient: () => getDefaultCanvasClient,
43
+ getDefaultCompositionDeliveryClient: () => getDefaultCompositionDeliveryClient,
42
44
  getDefaultManifestClient: () => getDefaultManifestClient,
43
45
  getDefaultProjectMapClient: () => getDefaultProjectMapClient,
44
46
  getDefaultRouteClient: () => getDefaultRouteClient,
@@ -237,8 +239,8 @@ var determineFetchCacheOptions = (mode) => {
237
239
  };
238
240
 
239
241
  // src/clients/canvasClient.ts
240
- var getCanvasClient = (options) => {
241
- return new import_canvas2.CanvasClient({
242
+ var buildCanvasClientOptions = (options) => {
243
+ return {
242
244
  projectId: env.getProjectId(),
243
245
  apiHost: env.getApiHost(),
244
246
  apiKey: env.getApiKey(),
@@ -283,13 +285,24 @@ var getCanvasClient = (options) => {
283
285
  }
284
286
  });
285
287
  }
286
- });
288
+ };
289
+ };
290
+ var getCanvasClient = (options) => {
291
+ return new import_canvas2.CanvasClient(buildCanvasClientOptions(options));
292
+ };
293
+ var getCompositionDeliveryClient = (options) => {
294
+ return new import_canvas2.CompositionDeliveryClient(buildCanvasClientOptions(options));
287
295
  };
288
296
  var getDefaultCanvasClient = async (options) => {
289
297
  return getCanvasClient({
290
298
  cache: await getCanvasCacheStrategy(options)
291
299
  });
292
300
  };
301
+ var getDefaultCompositionDeliveryClient = async (options) => {
302
+ return getCompositionDeliveryClient({
303
+ cache: await getCanvasCacheStrategy(options)
304
+ });
305
+ };
293
306
 
294
307
  // src/clients/manifestClient.ts
295
308
  var import_api = require("@uniformdev/context/api");
@@ -505,7 +518,6 @@ var retrieveCompositionBySlug = async ({
505
518
  releaseId,
506
519
  versionId
507
520
  }) => {
508
- var _a;
509
521
  if (!skipPrefetch) {
510
522
  void getManifest({
511
523
  searchParams
@@ -517,15 +529,14 @@ var retrieveCompositionBySlug = async ({
517
529
  });
518
530
  for (let i = 0; i < states.length; i++) {
519
531
  const state = states[i];
520
- const canvasClient = await getDefaultCanvasClient({
532
+ const canvasClient = await getDefaultCompositionDeliveryClient({
521
533
  searchParams
522
534
  });
523
535
  try {
524
- const composition = await canvasClient.getCompositionBySlug({
536
+ const composition = await canvasClient.get({
525
537
  slug,
526
538
  state,
527
539
  withComponentIDs: true,
528
- withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing),
529
540
  locale,
530
541
  releaseId,
531
542
  versionId
@@ -599,7 +610,6 @@ var retrieveRouteByPath = async ({
599
610
  fetchOptions,
600
611
  releaseId
601
612
  }) => {
602
- var _a;
603
613
  const client = await getDefaultRouteClient({
604
614
  searchParams
605
615
  });
@@ -616,13 +626,12 @@ var retrieveRouteByPath = async ({
616
626
  queryPath = `${helper.pathname}${helper.search}`;
617
627
  }
618
628
  }
619
- return await client.getRoute({
629
+ return await client.get({
620
630
  ...fetchOptions,
621
631
  path: queryPath,
622
632
  state,
623
633
  dataSourceVariant: (0, import_canvas4.getDataSourceVariantFromRouteGetParams)(fetchOptions != null ? fetchOptions : {}, state),
624
634
  withComponentIDs: true,
625
- withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing),
626
635
  releaseId
627
636
  });
628
637
  };
@@ -1178,7 +1187,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
1178
1187
  if (!id) {
1179
1188
  (0, import_navigation2.notFound)();
1180
1189
  }
1181
- const canvasClient = getCanvasClient({
1190
+ const canvasClient = getCompositionDeliveryClient({
1182
1191
  cache: {
1183
1192
  type: "no-cache"
1184
1193
  }
@@ -1188,7 +1197,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
1188
1197
  for (let i = 0; i < possibleStates.length; i++) {
1189
1198
  const state = possibleStates[i];
1190
1199
  try {
1191
- composition = await canvasClient.getCompositionById({
1200
+ composition = await canvasClient.get({
1192
1201
  compositionId: id,
1193
1202
  state,
1194
1203
  withComponentIDs: true
@@ -1228,7 +1237,9 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
1228
1237
  createStaticParams,
1229
1238
  generateStaticParams,
1230
1239
  getCanvasClient,
1240
+ getCompositionDeliveryClient,
1231
1241
  getDefaultCanvasClient,
1242
+ getDefaultCompositionDeliveryClient,
1232
1243
  getDefaultManifestClient,
1233
1244
  getDefaultProjectMapClient,
1234
1245
  getDefaultRouteClient,
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import "server-only";
3
3
 
4
4
  // src/clients/canvasClient.ts
5
- import { CanvasClient } from "@uniformdev/canvas";
5
+ import { CanvasClient, CompositionDeliveryClient } from "@uniformdev/canvas";
6
6
 
7
7
  // src/config/helpers.ts
8
8
  import serverConfig from "uniform.server.config";
@@ -184,8 +184,8 @@ var determineFetchCacheOptions = (mode) => {
184
184
  };
185
185
 
186
186
  // src/clients/canvasClient.ts
187
- var getCanvasClient = (options) => {
188
- return new CanvasClient({
187
+ var buildCanvasClientOptions = (options) => {
188
+ return {
189
189
  projectId: env.getProjectId(),
190
190
  apiHost: env.getApiHost(),
191
191
  apiKey: env.getApiKey(),
@@ -230,13 +230,24 @@ var getCanvasClient = (options) => {
230
230
  }
231
231
  });
232
232
  }
233
- });
233
+ };
234
+ };
235
+ var getCanvasClient = (options) => {
236
+ return new CanvasClient(buildCanvasClientOptions(options));
237
+ };
238
+ var getCompositionDeliveryClient = (options) => {
239
+ return new CompositionDeliveryClient(buildCanvasClientOptions(options));
234
240
  };
235
241
  var getDefaultCanvasClient = async (options) => {
236
242
  return getCanvasClient({
237
243
  cache: await getCanvasCacheStrategy(options)
238
244
  });
239
245
  };
246
+ var getDefaultCompositionDeliveryClient = async (options) => {
247
+ return getCompositionDeliveryClient({
248
+ cache: await getCanvasCacheStrategy(options)
249
+ });
250
+ };
240
251
 
241
252
  // src/clients/manifestClient.ts
242
253
  import { ManifestClient } from "@uniformdev/context/api";
@@ -477,7 +488,6 @@ var retrieveCompositionBySlug = async ({
477
488
  releaseId,
478
489
  versionId
479
490
  }) => {
480
- var _a;
481
491
  if (!skipPrefetch) {
482
492
  void getManifest({
483
493
  searchParams
@@ -489,15 +499,14 @@ var retrieveCompositionBySlug = async ({
489
499
  });
490
500
  for (let i = 0; i < states.length; i++) {
491
501
  const state = states[i];
492
- const canvasClient = await getDefaultCanvasClient({
502
+ const canvasClient = await getDefaultCompositionDeliveryClient({
493
503
  searchParams
494
504
  });
495
505
  try {
496
- const composition = await canvasClient.getCompositionBySlug({
506
+ const composition = await canvasClient.get({
497
507
  slug,
498
508
  state,
499
509
  withComponentIDs: true,
500
- withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing),
501
510
  locale,
502
511
  releaseId,
503
512
  versionId
@@ -571,7 +580,6 @@ var retrieveRouteByPath = async ({
571
580
  fetchOptions,
572
581
  releaseId
573
582
  }) => {
574
- var _a;
575
583
  const client = await getDefaultRouteClient({
576
584
  searchParams
577
585
  });
@@ -588,13 +596,12 @@ var retrieveRouteByPath = async ({
588
596
  queryPath = `${helper.pathname}${helper.search}`;
589
597
  }
590
598
  }
591
- return await client.getRoute({
599
+ return await client.get({
592
600
  ...fetchOptions,
593
601
  path: queryPath,
594
602
  state,
595
603
  dataSourceVariant: getDataSourceVariantFromRouteGetParams(fetchOptions != null ? fetchOptions : {}, state),
596
604
  withComponentIDs: true,
597
- withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing),
598
605
  releaseId
599
606
  });
600
607
  };
@@ -1158,7 +1165,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
1158
1165
  if (!id) {
1159
1166
  notFound2();
1160
1167
  }
1161
- const canvasClient = getCanvasClient({
1168
+ const canvasClient = getCompositionDeliveryClient({
1162
1169
  cache: {
1163
1170
  type: "no-cache"
1164
1171
  }
@@ -1168,7 +1175,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
1168
1175
  for (let i = 0; i < possibleStates.length; i++) {
1169
1176
  const state = possibleStates[i];
1170
1177
  try {
1171
- composition = await canvasClient.getCompositionById({
1178
+ composition = await canvasClient.get({
1172
1179
  compositionId: id,
1173
1180
  state,
1174
1181
  withComponentIDs: true
@@ -1207,7 +1214,9 @@ export {
1207
1214
  createStaticParams,
1208
1215
  generateStaticParams,
1209
1216
  getCanvasClient,
1217
+ getCompositionDeliveryClient,
1210
1218
  getDefaultCanvasClient,
1219
+ getDefaultCompositionDeliveryClient,
1211
1220
  getDefaultManifestClient,
1212
1221
  getDefaultProjectMapClient,
1213
1222
  getDefaultRouteClient,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-next-rsc",
3
- "version": "20.72.2",
3
+ "version": "20.72.3-alpha.14+1e232e59cd",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "scripts": {
6
6
  "build": "tsup",
@@ -60,15 +60,15 @@
60
60
  "react-dom": "19.2.1"
61
61
  },
62
62
  "dependencies": {
63
- "@uniformdev/canvas": "20.72.2",
64
- "@uniformdev/canvas-next-rsc-client": "^20.72.2",
65
- "@uniformdev/canvas-next-rsc-shared": "^20.72.2",
66
- "@uniformdev/canvas-react": "20.72.2",
67
- "@uniformdev/context": "20.72.2",
68
- "@uniformdev/project-map": "20.72.2",
69
- "@uniformdev/redirect": "20.72.2",
70
- "@uniformdev/richtext": "20.72.2",
71
- "@uniformdev/webhooks": "20.72.2",
63
+ "@uniformdev/canvas": "20.72.3-alpha.14+1e232e59cd",
64
+ "@uniformdev/canvas-next-rsc-client": "^20.72.3-alpha.14+1e232e59cd",
65
+ "@uniformdev/canvas-next-rsc-shared": "^20.72.3-alpha.14+1e232e59cd",
66
+ "@uniformdev/canvas-react": "20.72.3-alpha.14+1e232e59cd",
67
+ "@uniformdev/context": "20.72.3-alpha.14+1e232e59cd",
68
+ "@uniformdev/project-map": "20.72.3-alpha.14+1e232e59cd",
69
+ "@uniformdev/redirect": "20.72.3-alpha.14+1e232e59cd",
70
+ "@uniformdev/richtext": "20.72.3-alpha.14+1e232e59cd",
71
+ "@uniformdev/webhooks": "20.72.3-alpha.14+1e232e59cd",
72
72
  "@vercel/edge-config": "^1.4.3",
73
73
  "encoding": "^0.1.13",
74
74
  "server-only": "^0.0.1",
@@ -85,5 +85,5 @@
85
85
  "publishConfig": {
86
86
  "access": "public"
87
87
  },
88
- "gitHead": "8b65535fb3ec81e23f9eb8e0ed0b0be478f6e0e8"
88
+ "gitHead": "1e232e59cd3ded97b85b063986cc95e954b8c937"
89
89
  }