@buildcores/render-client 1.5.0 → 1.7.0
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 +34 -0
- package/dist/api.d.ts +2 -1
- package/dist/hooks/useSpriteRender.d.ts +10 -0
- package/dist/hooks/useZoomPan.d.ts +2 -1
- package/dist/index.d.ts +146 -2
- package/dist/index.esm.js +169 -47
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +169 -47
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +120 -0
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -226,6 +226,24 @@ export interface BuildRenderProps {
|
|
|
226
226
|
* Works for both parts and shareCode rendering.
|
|
227
227
|
*/
|
|
228
228
|
showGrid?: boolean;
|
|
229
|
+
/**
|
|
230
|
+
* Environment scene preset for rendering.
|
|
231
|
+
*/
|
|
232
|
+
scene?: RenderScene;
|
|
233
|
+
/**
|
|
234
|
+
* Whether to show the environment background.
|
|
235
|
+
*/
|
|
236
|
+
showBackground?: boolean;
|
|
237
|
+
/**
|
|
238
|
+
* Enable winter mode effects.
|
|
239
|
+
* Mutually exclusive with springMode.
|
|
240
|
+
*/
|
|
241
|
+
winterMode?: boolean;
|
|
242
|
+
/**
|
|
243
|
+
* Enable spring mode effects.
|
|
244
|
+
* Mutually exclusive with winterMode.
|
|
245
|
+
*/
|
|
246
|
+
springMode?: boolean;
|
|
229
247
|
/**
|
|
230
248
|
* Camera offset X for composition.
|
|
231
249
|
* Positive values shift the build to the right, leaving room for text overlay on the left.
|
|
@@ -312,6 +330,46 @@ export interface BuildRenderProps {
|
|
|
312
330
|
* @default "standard"
|
|
313
331
|
*/
|
|
314
332
|
frameQuality?: 'standard' | 'high';
|
|
333
|
+
/**
|
|
334
|
+
* Initial zoom level for the build.
|
|
335
|
+
* Range: 0.5 (50%) to 2.5 (250%). Values less than 1 make the build appear smaller,
|
|
336
|
+
* values greater than 1 make it appear larger.
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
* ```tsx
|
|
340
|
+
* <BuildRender
|
|
341
|
+
* shareCode="abc123"
|
|
342
|
+
* zoom={0.7} // 70% size - build appears smaller
|
|
343
|
+
* />
|
|
344
|
+
*
|
|
345
|
+
* <BuildRender
|
|
346
|
+
* shareCode="abc123"
|
|
347
|
+
* zoom={1.5} // 150% size - build appears larger
|
|
348
|
+
* />
|
|
349
|
+
* ```
|
|
350
|
+
*
|
|
351
|
+
* @default 1
|
|
352
|
+
*/
|
|
353
|
+
zoom?: number;
|
|
354
|
+
/**
|
|
355
|
+
* Camera zoom level for server-side rendering.
|
|
356
|
+
* Values > 1 move the camera further away (build appears smaller in the sprite).
|
|
357
|
+
* Values < 1 move the camera closer (build appears larger in the sprite).
|
|
358
|
+
*
|
|
359
|
+
* Use this for higher quality scaled-down renders vs client-side zoom scaling.
|
|
360
|
+
* Range: 0.5 to 2.0
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* ```tsx
|
|
364
|
+
* <BuildRender
|
|
365
|
+
* shareCode="abc123"
|
|
366
|
+
* cameraZoom={1.3} // Camera 30% further away - smaller build in sprite
|
|
367
|
+
* />
|
|
368
|
+
* ```
|
|
369
|
+
*
|
|
370
|
+
* @default 1
|
|
371
|
+
*/
|
|
372
|
+
cameraZoom?: number;
|
|
315
373
|
}
|
|
316
374
|
/**
|
|
317
375
|
* API configuration for environment and authentication
|
|
@@ -343,6 +401,22 @@ export interface ApiConfig {
|
|
|
343
401
|
* ```
|
|
344
402
|
*/
|
|
345
403
|
authToken?: string;
|
|
404
|
+
/**
|
|
405
|
+
* Auth mode for API requests.
|
|
406
|
+
* - legacy: Sends `authToken` directly as bearer token.
|
|
407
|
+
* - session: Uses `getRenderSessionToken` to fetch short-lived delegated tokens.
|
|
408
|
+
*
|
|
409
|
+
* @default "legacy"
|
|
410
|
+
*/
|
|
411
|
+
authMode?: 'legacy' | 'session';
|
|
412
|
+
/**
|
|
413
|
+
* Session token supplier used when `authMode` is "session".
|
|
414
|
+
* Should call your backend endpoint that brokers BuildCores session tokens.
|
|
415
|
+
*/
|
|
416
|
+
getRenderSessionToken?: () => Promise<{
|
|
417
|
+
token: string;
|
|
418
|
+
expiresAt: string;
|
|
419
|
+
}>;
|
|
346
420
|
}
|
|
347
421
|
/**
|
|
348
422
|
* Enum defining all available PC part categories that can be rendered.
|
|
@@ -509,6 +583,24 @@ export interface RenderBuildRequest {
|
|
|
509
583
|
* Defaults to true for cinematic profile, false otherwise.
|
|
510
584
|
*/
|
|
511
585
|
showGrid?: boolean;
|
|
586
|
+
/**
|
|
587
|
+
* Environment scene preset.
|
|
588
|
+
*/
|
|
589
|
+
scene?: RenderScene;
|
|
590
|
+
/**
|
|
591
|
+
* Whether to show the environment background.
|
|
592
|
+
*/
|
|
593
|
+
showBackground?: boolean;
|
|
594
|
+
/**
|
|
595
|
+
* Enable winter mode effects.
|
|
596
|
+
* Mutually exclusive with springMode.
|
|
597
|
+
*/
|
|
598
|
+
winterMode?: boolean;
|
|
599
|
+
/**
|
|
600
|
+
* Enable spring mode effects.
|
|
601
|
+
* Mutually exclusive with winterMode.
|
|
602
|
+
*/
|
|
603
|
+
springMode?: boolean;
|
|
512
604
|
/**
|
|
513
605
|
* Horizontal offset for the camera view.
|
|
514
606
|
* Positive values shift the build to the right, leaving room for text overlay on the left.
|
|
@@ -528,6 +620,15 @@ export interface RenderBuildRequest {
|
|
|
528
620
|
* @default "standard"
|
|
529
621
|
*/
|
|
530
622
|
frameQuality?: 'standard' | 'high';
|
|
623
|
+
/**
|
|
624
|
+
* Camera zoom level for server-side rendering.
|
|
625
|
+
* Values > 1 move the camera further away (build appears smaller in the sprite).
|
|
626
|
+
* Values < 1 move the camera closer (build appears larger in the sprite).
|
|
627
|
+
* Range: 0.5 to 2.0
|
|
628
|
+
*
|
|
629
|
+
* @default 1
|
|
630
|
+
*/
|
|
631
|
+
cameraZoom?: number;
|
|
531
632
|
}
|
|
532
633
|
/**
|
|
533
634
|
* Response structure containing all available parts for each category.
|
|
@@ -671,6 +772,11 @@ export interface BuildResponse {
|
|
|
671
772
|
partDetails: {
|
|
672
773
|
[K in PartCategory]?: PartDetailsWithCategory[];
|
|
673
774
|
};
|
|
775
|
+
/**
|
|
776
|
+
* Whether the case in this build has an interactive 3D model available.
|
|
777
|
+
* If false, the build cannot be rendered in 3D.
|
|
778
|
+
*/
|
|
779
|
+
hasInteractiveModel: boolean;
|
|
674
780
|
}
|
|
675
781
|
/**
|
|
676
782
|
* Response from the get parts by IDs endpoint.
|
|
@@ -702,6 +808,10 @@ export interface GridSettings {
|
|
|
702
808
|
/** Render order for depth sorting (default: 0, use -1 to render before other objects) */
|
|
703
809
|
renderOrder?: number;
|
|
704
810
|
}
|
|
811
|
+
/**
|
|
812
|
+
* Supported environment scene presets for render API endpoints.
|
|
813
|
+
*/
|
|
814
|
+
export type RenderScene = "sunset" | "dawn" | "night" | "warehouse" | "forest" | "apartment" | "studio" | "studio_v2" | "city" | "park" | "lobby";
|
|
705
815
|
/**
|
|
706
816
|
* Options for rendering a build by share code
|
|
707
817
|
*/
|
|
@@ -714,14 +824,24 @@ export interface RenderByShareCodeOptions {
|
|
|
714
824
|
height?: number;
|
|
715
825
|
/** Render quality profile */
|
|
716
826
|
profile?: "cinematic" | "flat" | "fast";
|
|
827
|
+
/** Environment scene preset */
|
|
828
|
+
scene?: RenderScene;
|
|
829
|
+
/** Whether to show the environment background */
|
|
830
|
+
showBackground?: boolean;
|
|
717
831
|
/** Show grid in render (default: true for cinematic profile) */
|
|
718
832
|
showGrid?: boolean;
|
|
833
|
+
/** Enable winter mode effects (mutually exclusive with springMode) */
|
|
834
|
+
winterMode?: boolean;
|
|
835
|
+
/** Enable spring mode effects (mutually exclusive with winterMode) */
|
|
836
|
+
springMode?: boolean;
|
|
719
837
|
/** Camera offset X for composition (positive = shift build right to leave room for text overlay) */
|
|
720
838
|
cameraOffsetX?: number;
|
|
721
839
|
/** Grid appearance settings (for thicker/more visible grid in renders) */
|
|
722
840
|
gridSettings?: GridSettings;
|
|
723
841
|
/** Frame quality - 'standard' (72 frames) or 'high' (144 frames for smoother animation) */
|
|
724
842
|
frameQuality?: 'standard' | 'high';
|
|
843
|
+
/** Camera zoom level for rendering. Values > 1 move camera further (build appears smaller). Range: 0.5 to 2.0 */
|
|
844
|
+
cameraZoom?: number;
|
|
725
845
|
/** Polling interval in milliseconds (default: 1500) */
|
|
726
846
|
pollIntervalMs?: number;
|
|
727
847
|
/** Timeout in milliseconds (default: 120000 = 2 minutes) */
|