@primestyleai/tryon 1.0.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/PrimeStyleTryon.d.ts +52 -0
- package/dist/api-client.d.ts +14 -0
- package/dist/image-utils.d.ts +4 -0
- package/dist/index.d.ts +6 -0
- package/dist/primestyle-tryon.es.js +1169 -0
- package/dist/primestyle-tryon.umd.js +1 -0
- package/dist/product-detector.d.ts +2 -0
- package/dist/sse-client.d.ts +17 -0
- package/dist/styles.d.ts +1 -0
- package/dist/types.d.ts +99 -0
- package/package.json +38 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ButtonStyles, ModalStyles } from "./types";
|
|
2
|
+
export declare class PrimeStyleTryon extends HTMLElement {
|
|
3
|
+
private shadow;
|
|
4
|
+
private apiClient;
|
|
5
|
+
private sseClient;
|
|
6
|
+
private sseUnsubscribe;
|
|
7
|
+
private state;
|
|
8
|
+
private selectedFile;
|
|
9
|
+
private previewUrl;
|
|
10
|
+
private resultImageUrl;
|
|
11
|
+
private errorMessage;
|
|
12
|
+
private currentJobId;
|
|
13
|
+
private productImageUrl;
|
|
14
|
+
private buttonStyles;
|
|
15
|
+
private modalStyles;
|
|
16
|
+
static get observedAttributes(): string[];
|
|
17
|
+
constructor();
|
|
18
|
+
connectedCallback(): void;
|
|
19
|
+
disconnectedCallback(): void;
|
|
20
|
+
attributeChangedCallback(name: string, _old: string, val: string): void;
|
|
21
|
+
/** Configure button appearance programmatically */
|
|
22
|
+
setButtonStyles(styles: ButtonStyles): void;
|
|
23
|
+
/** Configure modal appearance programmatically */
|
|
24
|
+
setModalStyles(styles: ModalStyles): void;
|
|
25
|
+
/** Open the try-on modal */
|
|
26
|
+
open(): void;
|
|
27
|
+
/** Close the try-on modal */
|
|
28
|
+
close(): void;
|
|
29
|
+
/** Detect product image from the current page */
|
|
30
|
+
detectProduct(): string | null;
|
|
31
|
+
private init;
|
|
32
|
+
private initApi;
|
|
33
|
+
private cleanup;
|
|
34
|
+
private emit;
|
|
35
|
+
private get buttonText();
|
|
36
|
+
private get showPoweredBy();
|
|
37
|
+
private render;
|
|
38
|
+
private createButton;
|
|
39
|
+
private createModal;
|
|
40
|
+
private createUploadView;
|
|
41
|
+
private createProcessingView;
|
|
42
|
+
private createResultView;
|
|
43
|
+
private createErrorView;
|
|
44
|
+
private handleFileSelect;
|
|
45
|
+
private handleSubmit;
|
|
46
|
+
private handleVtoUpdate;
|
|
47
|
+
private startPolling;
|
|
48
|
+
private handleDownload;
|
|
49
|
+
private resetUpload;
|
|
50
|
+
private applyButtonStyles;
|
|
51
|
+
private applyModalStyles;
|
|
52
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TryOnResponse, TryOnStatus } from "./types";
|
|
2
|
+
export declare class ApiClient {
|
|
3
|
+
private apiKey;
|
|
4
|
+
private baseUrl;
|
|
5
|
+
constructor(apiKey: string, apiUrl?: string);
|
|
6
|
+
private get headers();
|
|
7
|
+
submitTryOn(modelImage: string, garmentImage: string): Promise<TryOnResponse>;
|
|
8
|
+
getStatus(jobId: string): Promise<TryOnStatus>;
|
|
9
|
+
getStreamUrl(): string;
|
|
10
|
+
}
|
|
11
|
+
export declare class PrimeStyleError extends Error {
|
|
12
|
+
code: string;
|
|
13
|
+
constructor(message: string, code: string);
|
|
14
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { PrimeStyleTryon } from "./PrimeStyleTryon";
|
|
2
|
+
export { ApiClient, PrimeStyleError } from "./api-client";
|
|
3
|
+
export { SseClient } from "./sse-client";
|
|
4
|
+
export { detectProductImage } from "./product-detector";
|
|
5
|
+
export { compressImage, isValidImageFile } from "./image-utils";
|
|
6
|
+
export type { PrimeStyleConfig, ButtonStyles, ModalStyles, TryOnResponse, TryOnStatus, VtoUpdate, PrimeStyleEvents, } from "./types";
|