@crystaldesign/diva-core 26.14.0-beta.13 → 26.14.0-beta.15
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/build/esm/{ModalsWrapper-f1fc9b26.js → ModalsWrapper-945f1edc.js} +1 -1
- package/build/esm/{index-965b2622.js → index-16cf36e9.js} +1 -1
- package/build/esm/{index-e68a320a.js → index-b6d57602.js} +179 -244
- package/build/esm/index.js +1 -1
- package/build/types/core/src/handler/AIHandler/index.d.ts +71 -41
- package/build/types/core/src/handler/AIHandler/index.d.ts.map +1 -1
- package/build/types/core/src/index.d.ts +1 -0
- package/build/types/core/src/index.d.ts.map +1 -1
- package/build/umd/diva-core.umd.min.js +1 -1
- package/build/umd/report.html +1 -1
- package/package.json +10 -10
|
@@ -1,60 +1,90 @@
|
|
|
1
1
|
import { IRootStore } from '../../store/RootStore';
|
|
2
|
+
export type RenderingStatus = 'queued' | 'generating' | 'done' | 'error';
|
|
3
|
+
/** Why a variant or a release failed: `errorCode` tells the cases apart (e.g. CONTENT_BLOCKED, MEDIA_0010), `error` is for people. */
|
|
4
|
+
export interface RenderingError {
|
|
5
|
+
errorCode: string;
|
|
6
|
+
error: string;
|
|
7
|
+
}
|
|
8
|
+
export interface RenderingJobVariant {
|
|
9
|
+
index: number;
|
|
10
|
+
status: RenderingStatus;
|
|
11
|
+
/** The display version: at most 1200 px, watermarked. */
|
|
12
|
+
image?: {
|
|
13
|
+
url: string;
|
|
14
|
+
mimeType: string;
|
|
15
|
+
};
|
|
16
|
+
error?: RenderingError;
|
|
17
|
+
}
|
|
18
|
+
export interface RenderingRelease {
|
|
19
|
+
variant: number;
|
|
20
|
+
/** slotTaken: the product's slot for the image was taken by the time it finished; the renderjob waits approved for a decision in the approval. */
|
|
21
|
+
status: 'pending' | 'done' | 'error' | 'slotTaken';
|
|
22
|
+
renderJobId?: string;
|
|
23
|
+
/** The released original. */
|
|
24
|
+
image?: {
|
|
25
|
+
url: string;
|
|
26
|
+
mimeType: string;
|
|
27
|
+
};
|
|
28
|
+
/** Once done: the name the asset got - the one the tenant's media service derived, else the one sent. */
|
|
29
|
+
fileName?: string;
|
|
30
|
+
error?: RenderingError;
|
|
31
|
+
}
|
|
32
|
+
/** A rendering job of diva-ai (GET /v2/renderings/jobs/{id}): the variants of its current run and its release. */
|
|
33
|
+
export interface RenderingJob {
|
|
34
|
+
id: string;
|
|
35
|
+
status: RenderingStatus;
|
|
36
|
+
variants: RenderingJobVariant[];
|
|
37
|
+
release?: RenderingRelease;
|
|
38
|
+
}
|
|
39
|
+
/** A failed rendering call: the HTTP status, and the code and details diva-ai sends along. */
|
|
40
|
+
export interface AIServiceError extends Error {
|
|
41
|
+
status: number;
|
|
42
|
+
errorCode?: string;
|
|
43
|
+
details?: unknown;
|
|
44
|
+
}
|
|
2
45
|
export declare class AIHandler {
|
|
3
46
|
private root;
|
|
4
47
|
constructor(root: IRootStore);
|
|
5
48
|
private get aiService();
|
|
6
49
|
private get jwt();
|
|
7
50
|
private get organizationId();
|
|
8
|
-
private get organizationName();
|
|
9
51
|
getPrompts(options?: {
|
|
10
52
|
includeProductRooms?: boolean;
|
|
11
53
|
}): Promise<any>;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
promptId
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
54
|
+
/** Starts a rendering job whose variants render in the background (POST /v2/renderings/jobs); poll it with getRenderingJob. */
|
|
55
|
+
createRenderingJob(data: {
|
|
56
|
+
/** The template; `upscale` upscales the original of `sourceVariant` of the job `sourceJobId`. */
|
|
57
|
+
promptId: string;
|
|
58
|
+
prompt?: string;
|
|
59
|
+
images?: string[];
|
|
60
|
+
sourceJobId?: string;
|
|
61
|
+
sourceVariant?: number;
|
|
62
|
+
aspectRatio?: string;
|
|
63
|
+
size?: '512' | '1K' | '2K' | '4K';
|
|
64
|
+
variants?: number;
|
|
20
65
|
/** 'content-studio' marks a Content Studio generation, which diva-ai exempts from the AI limits for users who may create AI images directly. */
|
|
21
66
|
useCase?: 'content-studio';
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
67
|
+
}): Promise<RenderingJob>;
|
|
68
|
+
/** Renders the job's variants again; `prompt` replaces the addition of its last run (POST /v2/renderings/jobs/{id}/rerun). */
|
|
69
|
+
rerunRenderingJob(id: string, prompt?: string): Promise<RenderingJob>;
|
|
70
|
+
getRenderingJob(id: string): Promise<RenderingJob>;
|
|
71
|
+
/**
|
|
72
|
+
* Releases a variant of a job into the media library and, with a product, onto the product (POST
|
|
73
|
+
* /v2/renderings/jobs/{id}/release): diva-media's renderjob is created right away, the upload follows once the job is done.
|
|
74
|
+
*/
|
|
75
|
+
releaseRenderingJob(id: string, data: {
|
|
76
|
+
variant?: number;
|
|
27
77
|
fileName: string;
|
|
28
|
-
/**
|
|
29
|
-
productId?: string;
|
|
30
|
-
divaNr?: string;
|
|
31
|
-
reference?: string;
|
|
32
|
-
promptId?: string;
|
|
33
|
-
additionalPrompt?: string;
|
|
34
|
-
diva3DProject?: string;
|
|
35
|
-
/** Saved on the created renderjob's `group` field, so images can be found again by campaign in the media library. */
|
|
78
|
+
/** Saved on the renderjob's `group` field, so images can be found again by campaign in the media library. */
|
|
36
79
|
group?: string;
|
|
80
|
+
/** Omit for a standalone photo (e.g. generated from an uploaded, non-catalog photo) — the result then isn't attached to any product. */
|
|
81
|
+
product?: {
|
|
82
|
+
productId: string;
|
|
83
|
+
};
|
|
37
84
|
/** The product medium (its ref id) the photo may replace when its slot on the product is taken. */
|
|
38
85
|
replaceRef?: string;
|
|
39
|
-
}): Promise<
|
|
40
|
-
|
|
41
|
-
}>;
|
|
42
|
-
generatePreviewPhoto(data: {
|
|
43
|
-
referenceImages?: string[];
|
|
44
|
-
resolution?: string;
|
|
45
|
-
promptId?: string;
|
|
46
|
-
additionalPrompt?: string;
|
|
47
|
-
}): Promise<{
|
|
48
|
-
previewJobId: string;
|
|
49
|
-
}>;
|
|
50
|
-
getPreviewJob(id: string): Promise<{
|
|
51
|
-
_id: string;
|
|
52
|
-
status: 'queued' | 'generating' | 'done' | 'error';
|
|
53
|
-
fileUrl?: string;
|
|
54
|
-
mediaItemId?: string;
|
|
55
|
-
previewImageId?: string;
|
|
56
|
-
errorMessage?: string;
|
|
57
|
-
}>;
|
|
86
|
+
}): Promise<RenderingJob>;
|
|
87
|
+
private renderingCall;
|
|
58
88
|
createOrder(data: {
|
|
59
89
|
campaignName?: string;
|
|
60
90
|
stepIndex?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/handler/AIHandler/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/handler/AIHandler/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAEzE,sIAAsI;AACtI,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,eAAe,CAAC;IACxB,yDAAyD;IACzD,KAAK,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,kJAAkJ;IAClJ,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,WAAW,CAAC;IACnD,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AK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,GAAG,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAwBjI,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAkB5C"}
|
|
@@ -24,6 +24,7 @@ export * from './handler/AnalyticsHandler';
|
|
|
24
24
|
export * from './handler/OrganizationHandler';
|
|
25
25
|
export * from './handler/SupportHandler';
|
|
26
26
|
export * from './handler/ClientArticleHandler';
|
|
27
|
+
export type { AIServiceError, RenderingError, RenderingJob, RenderingJobVariant, RenderingRelease, RenderingStatus } from './handler/AIHandler';
|
|
27
28
|
export * from './elements/HelpButton';
|
|
28
29
|
export { getUserAgentInfo } from './utils/analyzeUserAgent';
|
|
29
30
|
export { getNativeArPlatform, isWebXrArSupported, openQuickLook } from './utils/nativeAr';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,IAAI,MAAM,cAAc,CAAC;AAKhC,OAAO,cAAc,CAAC;AACtB,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAClD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,mBAAmB,MAAM,uB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