@buildcores/render-client 1.2.0 → 1.4.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/dist/api.d.ts +86 -1
- package/dist/hooks/useSpriteRender.d.ts +28 -1
- package/dist/hooks/useZoomPan.d.ts +16 -0
- package/dist/index.d.ts +321 -5
- package/dist/index.esm.js +424 -20
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +426 -18
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +206 -2
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { RenderBuildRequest, AvailablePartsResponse, ApiConfig, PartCategory, GetAvailablePartsOptions } from "./types";
|
|
1
|
+
import { RenderBuildRequest, AvailablePartsResponse, ApiConfig, PartCategory, GetAvailablePartsOptions, BuildResponse, PartsResponse, RenderByShareCodeOptions, RenderByShareCodeJobResponse, RenderByShareCodeResponse } from "./types";
|
|
2
2
|
declare const API_BASE_URL = "https://www.renderapi.buildcores.com";
|
|
3
3
|
export declare const API_ENDPOINTS: {
|
|
4
4
|
readonly RENDER_BUILD_EXPERIMENTAL: "/render-build-experimental";
|
|
5
5
|
readonly RENDER_BUILD: "/render-build";
|
|
6
6
|
readonly AVAILABLE_PARTS: "/available-parts";
|
|
7
|
+
readonly BUILD: "/build";
|
|
8
|
+
readonly PARTS: "/parts";
|
|
9
|
+
readonly RENDER_BY_SHARE_CODE: "/render-by-share-code";
|
|
7
10
|
};
|
|
8
11
|
export interface RenderBuildResponse {
|
|
9
12
|
/**
|
|
@@ -78,4 +81,86 @@ export declare const renderBuild: (request: RenderBuildRequest, config: ApiConfi
|
|
|
78
81
|
}) => Promise<RenderBuildAsyncResponse>;
|
|
79
82
|
export declare const renderSpriteExperimental: (request: RenderBuildRequest, config: ApiConfig) => Promise<RenderSpriteResponse>;
|
|
80
83
|
export declare const getAvailableParts: (category: PartCategory, config: ApiConfig, options?: GetAvailablePartsOptions) => Promise<AvailablePartsResponse>;
|
|
84
|
+
/**
|
|
85
|
+
* Fetch a build by its share code.
|
|
86
|
+
* Returns build metadata and parts organized by category.
|
|
87
|
+
*
|
|
88
|
+
* @param shareCode - The share code of the build to fetch
|
|
89
|
+
* @param config - API configuration (environment, auth token)
|
|
90
|
+
* @returns Promise with build details including parts
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```tsx
|
|
94
|
+
* const build = await getBuildByShareCode('abc123xyz', {
|
|
95
|
+
* environment: 'prod',
|
|
96
|
+
* authToken: 'your-api-key'
|
|
97
|
+
* });
|
|
98
|
+
*
|
|
99
|
+
* console.log(build.name); // "My Gaming PC"
|
|
100
|
+
* console.log(build.parts.CPU); // ["7xjqsomhr"]
|
|
101
|
+
*
|
|
102
|
+
* // Use the parts directly with BuildRender
|
|
103
|
+
* <BuildRender parts={{ parts: build.parts }} size={500} apiConfig={config} />
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
export declare const getBuildByShareCode: (shareCode: string, config: ApiConfig) => Promise<BuildResponse>;
|
|
107
|
+
/**
|
|
108
|
+
* Fetch part details by their BuildCores IDs.
|
|
109
|
+
*
|
|
110
|
+
* @param partIds - Array of BuildCores part IDs to fetch
|
|
111
|
+
* @param config - API configuration (environment, auth token)
|
|
112
|
+
* @returns Promise with part details
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```tsx
|
|
116
|
+
* const response = await getPartsByIds(['7xjqsomhr', 'z7pyphm9k'], {
|
|
117
|
+
* environment: 'prod',
|
|
118
|
+
* authToken: 'your-api-key'
|
|
119
|
+
* });
|
|
120
|
+
*
|
|
121
|
+
* response.parts.forEach(part => {
|
|
122
|
+
* console.log(`${part.name} (${part.category})`);
|
|
123
|
+
* });
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
export declare const getPartsByIds: (partIds: string[], config: ApiConfig) => Promise<PartsResponse>;
|
|
127
|
+
/**
|
|
128
|
+
* Create a render job for a build by its share code.
|
|
129
|
+
* Returns the job ID for polling status.
|
|
130
|
+
*
|
|
131
|
+
* @param shareCode - The share code of the build to render
|
|
132
|
+
* @param config - API configuration (environment, auth token)
|
|
133
|
+
* @param options - Render options (format, dimensions, profile)
|
|
134
|
+
* @returns Promise with job creation response
|
|
135
|
+
*/
|
|
136
|
+
export declare const createRenderByShareCodeJob: (shareCode: string, config: ApiConfig, options?: Omit<RenderByShareCodeOptions, "pollIntervalMs" | "timeoutMs">) => Promise<RenderByShareCodeJobResponse>;
|
|
137
|
+
/**
|
|
138
|
+
* Render a build by its share code.
|
|
139
|
+
* This is a convenience function that creates a render job and polls until completion.
|
|
140
|
+
*
|
|
141
|
+
* @param shareCode - The share code of the build to render
|
|
142
|
+
* @param config - API configuration (environment, auth token)
|
|
143
|
+
* @param options - Render options including polling configuration
|
|
144
|
+
* @returns Promise with the final render URL
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```tsx
|
|
148
|
+
* // Simple usage - just pass share code
|
|
149
|
+
* const result = await renderByShareCode('abc123xyz', {
|
|
150
|
+
* environment: 'prod',
|
|
151
|
+
* authToken: 'your-api-key'
|
|
152
|
+
* });
|
|
153
|
+
* console.log(result.videoUrl); // URL to rendered video
|
|
154
|
+
*
|
|
155
|
+
* // With custom options
|
|
156
|
+
* const result = await renderByShareCode('abc123xyz', config, {
|
|
157
|
+
* format: 'sprite',
|
|
158
|
+
* width: 1920,
|
|
159
|
+
* height: 1080,
|
|
160
|
+
* profile: 'cinematic',
|
|
161
|
+
* timeoutMs: 180000 // 3 minute timeout
|
|
162
|
+
* });
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
export declare const renderByShareCode: (shareCode: string, config: ApiConfig, options?: RenderByShareCodeOptions) => Promise<RenderByShareCodeResponse>;
|
|
81
166
|
export { API_BASE_URL };
|
|
@@ -17,4 +17,31 @@ export interface UseSpriteRenderOptions {
|
|
|
17
17
|
*/
|
|
18
18
|
mode?: "async" | "experimental";
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Grid settings for render composition
|
|
22
|
+
*/
|
|
23
|
+
export interface RenderGridSettings {
|
|
24
|
+
cellThickness?: number;
|
|
25
|
+
sectionThickness?: number;
|
|
26
|
+
color?: string;
|
|
27
|
+
fadeDistance?: number;
|
|
28
|
+
renderOrder?: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Input for sprite rendering - either parts (creates new build) or shareCode (uses existing build)
|
|
32
|
+
*/
|
|
33
|
+
export type SpriteRenderInput = {
|
|
34
|
+
type: 'parts';
|
|
35
|
+
parts: RenderBuildRequest;
|
|
36
|
+
showGrid?: boolean;
|
|
37
|
+
cameraOffsetX?: number;
|
|
38
|
+
gridSettings?: RenderGridSettings;
|
|
39
|
+
} | {
|
|
40
|
+
type: 'shareCode';
|
|
41
|
+
shareCode: string;
|
|
42
|
+
profile?: 'cinematic' | 'flat' | 'fast';
|
|
43
|
+
showGrid?: boolean;
|
|
44
|
+
cameraOffsetX?: number;
|
|
45
|
+
gridSettings?: RenderGridSettings;
|
|
46
|
+
};
|
|
47
|
+
export declare const useSpriteRender: (input: RenderBuildRequest | SpriteRenderInput, apiConfig: ApiConfig, onLoadStart?: () => void, options?: UseSpriteRenderOptions) => UseSpriteRenderReturn;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type TouchEvent as ReactTouchEvent, type WheelEvent as ReactWheelEvent } from "react";
|
|
2
|
+
interface UseZoomOptions {
|
|
3
|
+
displayWidth?: number;
|
|
4
|
+
displayHeight?: number;
|
|
5
|
+
minScale?: number;
|
|
6
|
+
maxScale?: number;
|
|
7
|
+
}
|
|
8
|
+
interface UseZoomReturn {
|
|
9
|
+
scale: number;
|
|
10
|
+
isPinching: boolean;
|
|
11
|
+
handleWheel: (event: ReactWheelEvent<Element>) => void;
|
|
12
|
+
handleTouchStart: (event: ReactTouchEvent<HTMLCanvasElement>) => boolean;
|
|
13
|
+
reset: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const useZoomPan: ({ displayWidth, displayHeight, minScale, maxScale, }?: UseZoomOptions) => UseZoomReturn;
|
|
16
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -131,6 +131,9 @@ interface BuildRenderProps {
|
|
|
131
131
|
* This object defines which PC components should be included in the 3D sprite render.
|
|
132
132
|
* Each part category contains an array with a single part ID that will be rendered.
|
|
133
133
|
*
|
|
134
|
+
* **Note**: If `shareCode` is provided, it will be used instead of `parts`.
|
|
135
|
+
* Using `shareCode` preserves the build's interactive state (including case fan slot placements).
|
|
136
|
+
*
|
|
134
137
|
* **Current Limitation**: Only 1 part per category is supported. Arrays must contain
|
|
135
138
|
* exactly one part ID per category. Future versions will support multiple parts per category.
|
|
136
139
|
*
|
|
@@ -152,7 +155,26 @@ interface BuildRenderProps {
|
|
|
152
155
|
* <SpriteRender parts={parts} size={300} />
|
|
153
156
|
* ```
|
|
154
157
|
*/
|
|
155
|
-
parts
|
|
158
|
+
parts?: RenderBuildRequest;
|
|
159
|
+
/**
|
|
160
|
+
* Share code of an existing build to render.
|
|
161
|
+
*
|
|
162
|
+
* When provided, the build will be rendered using its existing interactive state,
|
|
163
|
+
* which includes case fan slot placements. This is preferred over `parts` when
|
|
164
|
+
* rendering builds that have already been configured with case fans.
|
|
165
|
+
*
|
|
166
|
+
* If both `shareCode` and `parts` are provided, `shareCode` takes precedence.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```tsx
|
|
170
|
+
* <BuildRender
|
|
171
|
+
* shareCode="abc123xyz"
|
|
172
|
+
* size={500}
|
|
173
|
+
* apiConfig={{ environment: 'prod', authToken: 'your-token' }}
|
|
174
|
+
* />
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
shareCode?: string;
|
|
156
178
|
/**
|
|
157
179
|
* Width and height in pixels. If only `size` is provided, both width and height use it.
|
|
158
180
|
* If `width`/`height` are provided, they override `size` individually.
|
|
@@ -202,6 +224,22 @@ interface BuildRenderProps {
|
|
|
202
224
|
* @default 0.2
|
|
203
225
|
*/
|
|
204
226
|
touchSensitivity?: number;
|
|
227
|
+
/**
|
|
228
|
+
* Show grid in render.
|
|
229
|
+
* Works for both parts and shareCode rendering.
|
|
230
|
+
*/
|
|
231
|
+
showGrid?: boolean;
|
|
232
|
+
/**
|
|
233
|
+
* Camera offset X for composition.
|
|
234
|
+
* Positive values shift the build to the right, leaving room for text overlay on the left.
|
|
235
|
+
* Works for both parts and shareCode rendering.
|
|
236
|
+
*/
|
|
237
|
+
cameraOffsetX?: number;
|
|
238
|
+
/**
|
|
239
|
+
* Grid appearance settings for thicker/more visible grid in renders.
|
|
240
|
+
* Works for both parts and shareCode rendering.
|
|
241
|
+
*/
|
|
242
|
+
gridSettings?: GridSettings;
|
|
205
243
|
}
|
|
206
244
|
/**
|
|
207
245
|
* API configuration for environment and authentication
|
|
@@ -271,7 +309,9 @@ declare enum PartCategory {
|
|
|
271
309
|
/** PC Case - The enclosure that houses all components */
|
|
272
310
|
PCCase = "PCCase",
|
|
273
311
|
/** CPU Cooler - Air or liquid cooling for the processor */
|
|
274
|
-
CPUCooler = "CPUCooler"
|
|
312
|
+
CPUCooler = "CPUCooler",
|
|
313
|
+
/** Case Fans - Additional cooling fans for the case */
|
|
314
|
+
CaseFan = "CaseFan"
|
|
275
315
|
}
|
|
276
316
|
/**
|
|
277
317
|
* Request structure for rendering a PC build.
|
|
@@ -368,6 +408,46 @@ interface RenderBuildRequest {
|
|
|
368
408
|
* ```
|
|
369
409
|
*/
|
|
370
410
|
height?: number;
|
|
411
|
+
/**
|
|
412
|
+
* Render quality profile that controls visual effects and rendering speed.
|
|
413
|
+
*
|
|
414
|
+
* - **cinematic**: All effects enabled (shadows, ambient occlusion, bloom) for highest quality
|
|
415
|
+
* - **flat**: No effects for clean, simple product shots
|
|
416
|
+
* - **fast**: Minimal rendering for fastest processing speed
|
|
417
|
+
*
|
|
418
|
+
* @example
|
|
419
|
+
* ```tsx
|
|
420
|
+
* const request: RenderBuildRequest = {
|
|
421
|
+
* parts: { CPU: ["7xjqsomhr"] },
|
|
422
|
+
* profile: 'cinematic' // High quality with all effects
|
|
423
|
+
* };
|
|
424
|
+
* ```
|
|
425
|
+
*
|
|
426
|
+
* @example Fast rendering
|
|
427
|
+
* ```tsx
|
|
428
|
+
* const request: RenderBuildRequest = {
|
|
429
|
+
* parts: { CPU: ["7xjqsomhr"] },
|
|
430
|
+
* profile: 'fast' // Quick render, minimal effects
|
|
431
|
+
* };
|
|
432
|
+
* ```
|
|
433
|
+
*/
|
|
434
|
+
profile?: 'cinematic' | 'flat' | 'fast';
|
|
435
|
+
/**
|
|
436
|
+
* Whether to show the 3D grid in the render.
|
|
437
|
+
* Defaults to true for cinematic profile, false otherwise.
|
|
438
|
+
*/
|
|
439
|
+
showGrid?: boolean;
|
|
440
|
+
/**
|
|
441
|
+
* Horizontal offset for the camera view.
|
|
442
|
+
* Positive values shift the build to the right, leaving room for text overlay on the left.
|
|
443
|
+
* Range: -0.3 to 0.3
|
|
444
|
+
*/
|
|
445
|
+
cameraOffsetX?: number;
|
|
446
|
+
/**
|
|
447
|
+
* Custom grid appearance settings.
|
|
448
|
+
* Only applies when showGrid is true.
|
|
449
|
+
*/
|
|
450
|
+
gridSettings?: GridSettings;
|
|
371
451
|
}
|
|
372
452
|
/**
|
|
373
453
|
* Response structure containing all available parts for each category.
|
|
@@ -465,6 +545,130 @@ interface GetAvailablePartsOptions {
|
|
|
465
545
|
/** Number of parts to skip for pagination (default 0) */
|
|
466
546
|
skip?: number;
|
|
467
547
|
}
|
|
548
|
+
/**
|
|
549
|
+
* Extended part details including category information
|
|
550
|
+
*/
|
|
551
|
+
interface PartDetailsWithCategory {
|
|
552
|
+
/** Unique part identifier (BuildCores ID) */
|
|
553
|
+
id: string;
|
|
554
|
+
/** Human-readable part name */
|
|
555
|
+
name: string;
|
|
556
|
+
/** URL to part image (may be null) */
|
|
557
|
+
image: string | null;
|
|
558
|
+
/** Part category */
|
|
559
|
+
category: PartCategory;
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Response from the get build by share code endpoint.
|
|
563
|
+
* Contains build metadata and parts organized by category.
|
|
564
|
+
*
|
|
565
|
+
* @example
|
|
566
|
+
* ```tsx
|
|
567
|
+
* const build = await getBuildByShareCode('abc123xyz', config);
|
|
568
|
+
* console.log(build.name); // "My Gaming PC"
|
|
569
|
+
* console.log(build.parts.CPU); // ["7xjqsomhr"]
|
|
570
|
+
* console.log(build.partDetails.CPU[0].name); // "AMD Ryzen 7 9800X3D"
|
|
571
|
+
* ```
|
|
572
|
+
*/
|
|
573
|
+
interface BuildResponse {
|
|
574
|
+
/** The share code of the build */
|
|
575
|
+
shareCode: string;
|
|
576
|
+
/** Build name/title */
|
|
577
|
+
name: string;
|
|
578
|
+
/** Build description */
|
|
579
|
+
description: string;
|
|
580
|
+
/**
|
|
581
|
+
* Part IDs mapped by category.
|
|
582
|
+
* Use these IDs directly with RenderBuildRequest.
|
|
583
|
+
*/
|
|
584
|
+
parts: {
|
|
585
|
+
[K in PartCategory]?: string[];
|
|
586
|
+
};
|
|
587
|
+
/**
|
|
588
|
+
* Detailed part information mapped by category.
|
|
589
|
+
* Includes name, image URL, and category for each part.
|
|
590
|
+
*/
|
|
591
|
+
partDetails: {
|
|
592
|
+
[K in PartCategory]?: PartDetailsWithCategory[];
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Response from the get parts by IDs endpoint.
|
|
597
|
+
*
|
|
598
|
+
* @example
|
|
599
|
+
* ```tsx
|
|
600
|
+
* const response = await getPartsByIds(['7xjqsomhr', 'z7pyphm9k'], config);
|
|
601
|
+
* response.parts.forEach(part => {
|
|
602
|
+
* console.log(`${part.name} (${part.category})`);
|
|
603
|
+
* });
|
|
604
|
+
* ```
|
|
605
|
+
*/
|
|
606
|
+
interface PartsResponse {
|
|
607
|
+
/** Array of part details */
|
|
608
|
+
parts: PartDetailsWithCategory[];
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* Grid appearance settings for renders
|
|
612
|
+
*/
|
|
613
|
+
interface GridSettings {
|
|
614
|
+
/** Grid cell line thickness (default: 0.6) */
|
|
615
|
+
cellThickness?: number;
|
|
616
|
+
/** Grid section line thickness (default: 1.2) */
|
|
617
|
+
sectionThickness?: number;
|
|
618
|
+
/** Grid color as hex string (default: #6f6f6f) */
|
|
619
|
+
color?: string;
|
|
620
|
+
/** Distance at which grid starts to fade (default: 3) */
|
|
621
|
+
fadeDistance?: number;
|
|
622
|
+
/** Render order for depth sorting (default: 0, use -1 to render before other objects) */
|
|
623
|
+
renderOrder?: number;
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Options for rendering a build by share code
|
|
627
|
+
*/
|
|
628
|
+
interface RenderByShareCodeOptions {
|
|
629
|
+
/** Output format - video (MP4) or sprite (WebP sprite sheet) */
|
|
630
|
+
format?: "video" | "sprite";
|
|
631
|
+
/** Desired canvas pixel width (256-8192) */
|
|
632
|
+
width?: number;
|
|
633
|
+
/** Desired canvas pixel height (256-8192) */
|
|
634
|
+
height?: number;
|
|
635
|
+
/** Render quality profile */
|
|
636
|
+
profile?: "cinematic" | "flat" | "fast";
|
|
637
|
+
/** Show grid in render (default: true for cinematic profile) */
|
|
638
|
+
showGrid?: boolean;
|
|
639
|
+
/** Camera offset X for composition (positive = shift build right to leave room for text overlay) */
|
|
640
|
+
cameraOffsetX?: number;
|
|
641
|
+
/** Grid appearance settings (for thicker/more visible grid in renders) */
|
|
642
|
+
gridSettings?: GridSettings;
|
|
643
|
+
/** Polling interval in milliseconds (default: 1500) */
|
|
644
|
+
pollIntervalMs?: number;
|
|
645
|
+
/** Timeout in milliseconds (default: 120000 = 2 minutes) */
|
|
646
|
+
timeoutMs?: number;
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Response from the render by share code endpoint (job creation).
|
|
650
|
+
*/
|
|
651
|
+
interface RenderByShareCodeJobResponse {
|
|
652
|
+
/** Unique job identifier for polling status */
|
|
653
|
+
job_id: string;
|
|
654
|
+
/** Current job status */
|
|
655
|
+
status: "queued" | "processing" | "completed" | "error";
|
|
656
|
+
/** The share code of the build being rendered */
|
|
657
|
+
share_code: string;
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Final response after render by share code completes.
|
|
661
|
+
*
|
|
662
|
+
* @example
|
|
663
|
+
* ```tsx
|
|
664
|
+
* const result = await renderByShareCode('abc123xyz', config);
|
|
665
|
+
* // Use result.videoUrl to display the rendered video
|
|
666
|
+
* ```
|
|
667
|
+
*/
|
|
668
|
+
interface RenderByShareCodeResponse {
|
|
669
|
+
/** URL to the rendered video or sprite sheet */
|
|
670
|
+
videoUrl: string;
|
|
671
|
+
}
|
|
468
672
|
|
|
469
673
|
declare const BuildRender: React.FC<BuildRenderProps>;
|
|
470
674
|
|
|
@@ -542,7 +746,34 @@ interface UseSpriteRenderOptions {
|
|
|
542
746
|
*/
|
|
543
747
|
mode?: "async" | "experimental";
|
|
544
748
|
}
|
|
545
|
-
|
|
749
|
+
/**
|
|
750
|
+
* Grid settings for render composition
|
|
751
|
+
*/
|
|
752
|
+
interface RenderGridSettings {
|
|
753
|
+
cellThickness?: number;
|
|
754
|
+
sectionThickness?: number;
|
|
755
|
+
color?: string;
|
|
756
|
+
fadeDistance?: number;
|
|
757
|
+
renderOrder?: number;
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* Input for sprite rendering - either parts (creates new build) or shareCode (uses existing build)
|
|
761
|
+
*/
|
|
762
|
+
type SpriteRenderInput = {
|
|
763
|
+
type: 'parts';
|
|
764
|
+
parts: RenderBuildRequest;
|
|
765
|
+
showGrid?: boolean;
|
|
766
|
+
cameraOffsetX?: number;
|
|
767
|
+
gridSettings?: RenderGridSettings;
|
|
768
|
+
} | {
|
|
769
|
+
type: 'shareCode';
|
|
770
|
+
shareCode: string;
|
|
771
|
+
profile?: 'cinematic' | 'flat' | 'fast';
|
|
772
|
+
showGrid?: boolean;
|
|
773
|
+
cameraOffsetX?: number;
|
|
774
|
+
gridSettings?: RenderGridSettings;
|
|
775
|
+
};
|
|
776
|
+
declare const useSpriteRender: (input: RenderBuildRequest | SpriteRenderInput, apiConfig: ApiConfig, onLoadStart?: () => void, options?: UseSpriteRenderOptions) => UseSpriteRenderReturn;
|
|
546
777
|
|
|
547
778
|
interface DragIconProps {
|
|
548
779
|
width?: number;
|
|
@@ -571,6 +802,9 @@ declare const API_ENDPOINTS: {
|
|
|
571
802
|
readonly RENDER_BUILD_EXPERIMENTAL: "/render-build-experimental";
|
|
572
803
|
readonly RENDER_BUILD: "/render-build";
|
|
573
804
|
readonly AVAILABLE_PARTS: "/available-parts";
|
|
805
|
+
readonly BUILD: "/build";
|
|
806
|
+
readonly PARTS: "/parts";
|
|
807
|
+
readonly RENDER_BY_SHARE_CODE: "/render-by-share-code";
|
|
574
808
|
};
|
|
575
809
|
interface RenderBuildResponse {
|
|
576
810
|
/**
|
|
@@ -622,6 +856,88 @@ declare const buildHeaders: (config: ApiConfig) => Record<string, string>;
|
|
|
622
856
|
declare const renderBuildExperimental: (request: RenderBuildRequest, config: ApiConfig) => Promise<RenderBuildResponse>;
|
|
623
857
|
declare const renderSpriteExperimental: (request: RenderBuildRequest, config: ApiConfig) => Promise<RenderSpriteResponse>;
|
|
624
858
|
declare const getAvailableParts: (category: PartCategory, config: ApiConfig, options?: GetAvailablePartsOptions) => Promise<AvailablePartsResponse>;
|
|
859
|
+
/**
|
|
860
|
+
* Fetch a build by its share code.
|
|
861
|
+
* Returns build metadata and parts organized by category.
|
|
862
|
+
*
|
|
863
|
+
* @param shareCode - The share code of the build to fetch
|
|
864
|
+
* @param config - API configuration (environment, auth token)
|
|
865
|
+
* @returns Promise with build details including parts
|
|
866
|
+
*
|
|
867
|
+
* @example
|
|
868
|
+
* ```tsx
|
|
869
|
+
* const build = await getBuildByShareCode('abc123xyz', {
|
|
870
|
+
* environment: 'prod',
|
|
871
|
+
* authToken: 'your-api-key'
|
|
872
|
+
* });
|
|
873
|
+
*
|
|
874
|
+
* console.log(build.name); // "My Gaming PC"
|
|
875
|
+
* console.log(build.parts.CPU); // ["7xjqsomhr"]
|
|
876
|
+
*
|
|
877
|
+
* // Use the parts directly with BuildRender
|
|
878
|
+
* <BuildRender parts={{ parts: build.parts }} size={500} apiConfig={config} />
|
|
879
|
+
* ```
|
|
880
|
+
*/
|
|
881
|
+
declare const getBuildByShareCode: (shareCode: string, config: ApiConfig) => Promise<BuildResponse>;
|
|
882
|
+
/**
|
|
883
|
+
* Fetch part details by their BuildCores IDs.
|
|
884
|
+
*
|
|
885
|
+
* @param partIds - Array of BuildCores part IDs to fetch
|
|
886
|
+
* @param config - API configuration (environment, auth token)
|
|
887
|
+
* @returns Promise with part details
|
|
888
|
+
*
|
|
889
|
+
* @example
|
|
890
|
+
* ```tsx
|
|
891
|
+
* const response = await getPartsByIds(['7xjqsomhr', 'z7pyphm9k'], {
|
|
892
|
+
* environment: 'prod',
|
|
893
|
+
* authToken: 'your-api-key'
|
|
894
|
+
* });
|
|
895
|
+
*
|
|
896
|
+
* response.parts.forEach(part => {
|
|
897
|
+
* console.log(`${part.name} (${part.category})`);
|
|
898
|
+
* });
|
|
899
|
+
* ```
|
|
900
|
+
*/
|
|
901
|
+
declare const getPartsByIds: (partIds: string[], config: ApiConfig) => Promise<PartsResponse>;
|
|
902
|
+
/**
|
|
903
|
+
* Create a render job for a build by its share code.
|
|
904
|
+
* Returns the job ID for polling status.
|
|
905
|
+
*
|
|
906
|
+
* @param shareCode - The share code of the build to render
|
|
907
|
+
* @param config - API configuration (environment, auth token)
|
|
908
|
+
* @param options - Render options (format, dimensions, profile)
|
|
909
|
+
* @returns Promise with job creation response
|
|
910
|
+
*/
|
|
911
|
+
declare const createRenderByShareCodeJob: (shareCode: string, config: ApiConfig, options?: Omit<RenderByShareCodeOptions, "pollIntervalMs" | "timeoutMs">) => Promise<RenderByShareCodeJobResponse>;
|
|
912
|
+
/**
|
|
913
|
+
* Render a build by its share code.
|
|
914
|
+
* This is a convenience function that creates a render job and polls until completion.
|
|
915
|
+
*
|
|
916
|
+
* @param shareCode - The share code of the build to render
|
|
917
|
+
* @param config - API configuration (environment, auth token)
|
|
918
|
+
* @param options - Render options including polling configuration
|
|
919
|
+
* @returns Promise with the final render URL
|
|
920
|
+
*
|
|
921
|
+
* @example
|
|
922
|
+
* ```tsx
|
|
923
|
+
* // Simple usage - just pass share code
|
|
924
|
+
* const result = await renderByShareCode('abc123xyz', {
|
|
925
|
+
* environment: 'prod',
|
|
926
|
+
* authToken: 'your-api-key'
|
|
927
|
+
* });
|
|
928
|
+
* console.log(result.videoUrl); // URL to rendered video
|
|
929
|
+
*
|
|
930
|
+
* // With custom options
|
|
931
|
+
* const result = await renderByShareCode('abc123xyz', config, {
|
|
932
|
+
* format: 'sprite',
|
|
933
|
+
* width: 1920,
|
|
934
|
+
* height: 1080,
|
|
935
|
+
* profile: 'cinematic',
|
|
936
|
+
* timeoutMs: 180000 // 3 minute timeout
|
|
937
|
+
* });
|
|
938
|
+
* ```
|
|
939
|
+
*/
|
|
940
|
+
declare const renderByShareCode: (shareCode: string, config: ApiConfig, options?: RenderByShareCodeOptions) => Promise<RenderByShareCodeResponse>;
|
|
625
941
|
|
|
626
|
-
export { API_BASE_URL, API_ENDPOINTS, BuildRender, BuildRenderVideo, DragIcon, InstructionTooltip, LoadingErrorOverlay, PartCategory, arePartsEqual, buildApiUrl, buildHeaders, calculateCircularFrame, calculateCircularTime, getAvailableParts, renderBuildExperimental, renderSpriteExperimental, useBouncePatternProgress, useBuildRender, useSpriteRender, useSpriteScrubbing, useVideoScrubbing };
|
|
627
|
-
export type { ApiConfig, AvailablePartsResponse, BuildRenderProps, BuildRenderVideoProps, GetAvailablePartsOptions, PartDetails, RenderAPIService, RenderBuildRequest, RenderBuildResponse, RenderSpriteResponse, UseBuildRenderOptions, UseBuildRenderReturn, UseSpriteRenderOptions, UseSpriteRenderReturn };
|
|
942
|
+
export { API_BASE_URL, API_ENDPOINTS, BuildRender, BuildRenderVideo, DragIcon, InstructionTooltip, LoadingErrorOverlay, PartCategory, arePartsEqual, buildApiUrl, buildHeaders, calculateCircularFrame, calculateCircularTime, createRenderByShareCodeJob, getAvailableParts, getBuildByShareCode, getPartsByIds, renderBuildExperimental, renderByShareCode, renderSpriteExperimental, useBouncePatternProgress, useBuildRender, useSpriteRender, useSpriteScrubbing, useVideoScrubbing };
|
|
943
|
+
export type { ApiConfig, AvailablePartsResponse, BuildRenderProps, BuildRenderVideoProps, BuildResponse, GetAvailablePartsOptions, GridSettings, PartDetails, PartDetailsWithCategory, PartsResponse, RenderAPIService, RenderBuildRequest, RenderBuildResponse, RenderByShareCodeJobResponse, RenderByShareCodeOptions, RenderByShareCodeResponse, RenderSpriteResponse, SpriteRenderInput, UseBuildRenderOptions, UseBuildRenderReturn, UseSpriteRenderOptions, UseSpriteRenderReturn };
|