@kittl/sdk 0.0.4 → 0.0.6
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/kittl-sdk.esm.js +51 -11
- package/dist/kittl-sdk.js +51 -11
- package/dist/sdk.d.ts +154 -24
- package/package.json +1 -1
package/dist/kittl-sdk.esm.js
CHANGED
|
@@ -195,6 +195,13 @@ var createSDKCallMessage = {
|
|
|
195
195
|
args,
|
|
196
196
|
messageId,
|
|
197
197
|
apiType: "upload"
|
|
198
|
+
}),
|
|
199
|
+
data: (dots, args, messageId) => ({
|
|
200
|
+
command: "sdk-call",
|
|
201
|
+
dots,
|
|
202
|
+
args,
|
|
203
|
+
messageId,
|
|
204
|
+
apiType: "data"
|
|
198
205
|
})
|
|
199
206
|
};
|
|
200
207
|
function createApiProxy(apiType) {
|
|
@@ -213,6 +220,7 @@ function createApiProxy(apiType) {
|
|
|
213
220
|
|
|
214
221
|
// ../../packages/editor-core/sdk/sdk-bridge/dist/bridge/sandboxed/handlers/apiProxy/aiApiProxy.js
|
|
215
222
|
var generationHandlers = /* @__PURE__ */ new Map();
|
|
223
|
+
var generationSubscriptions = /* @__PURE__ */ new Map();
|
|
216
224
|
var dispatchAIGenerationUpdate = (subscriptionId, update) => {
|
|
217
225
|
const handler = generationHandlers.get(subscriptionId);
|
|
218
226
|
if (!handler) {
|
|
@@ -221,6 +229,20 @@ var dispatchAIGenerationUpdate = (subscriptionId, update) => {
|
|
|
221
229
|
void handler(update);
|
|
222
230
|
};
|
|
223
231
|
function createAIApiProxy() {
|
|
232
|
+
const unregisterGenerationHandler = (generatorId) => {
|
|
233
|
+
const subscriptionId = generationSubscriptions.get(generatorId);
|
|
234
|
+
if (!subscriptionId) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
generationHandlers.delete(subscriptionId);
|
|
238
|
+
generationSubscriptions.delete(generatorId);
|
|
239
|
+
const unregisterMessage = {
|
|
240
|
+
command: "ai-unregister-handler",
|
|
241
|
+
generatorId,
|
|
242
|
+
subscriptionId
|
|
243
|
+
};
|
|
244
|
+
postMessageToParent(unregisterMessage);
|
|
245
|
+
};
|
|
224
246
|
return {
|
|
225
247
|
spendCredits: async (options) => {
|
|
226
248
|
const { onAccept, onDecline, ...serializable } = options;
|
|
@@ -250,16 +272,18 @@ function createAIApiProxy() {
|
|
|
250
272
|
return sendMessage(message);
|
|
251
273
|
},
|
|
252
274
|
registerHandler: async (generatorId, onStatusUpdate) => {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
275
|
+
if (generationSubscriptions.has(generatorId)) {
|
|
276
|
+
return {
|
|
277
|
+
isOk: false,
|
|
278
|
+
error: {
|
|
279
|
+
message: `AI handler for generator "${generatorId}" is already registered`,
|
|
280
|
+
name: "SdkInternalError"
|
|
281
|
+
}
|
|
259
282
|
};
|
|
260
|
-
|
|
261
|
-
|
|
283
|
+
}
|
|
284
|
+
const subscriptionId = generateMessageId();
|
|
262
285
|
generationHandlers.set(subscriptionId, onStatusUpdate);
|
|
286
|
+
generationSubscriptions.set(generatorId, subscriptionId);
|
|
263
287
|
const registerMessage = {
|
|
264
288
|
command: "ai-register-handler",
|
|
265
289
|
messageId: generateMessageId(),
|
|
@@ -270,11 +294,16 @@ function createAIApiProxy() {
|
|
|
270
294
|
const response = await sendMessage(registerMessage);
|
|
271
295
|
if (!response.isOk) {
|
|
272
296
|
generationHandlers.delete(subscriptionId);
|
|
297
|
+
generationSubscriptions.delete(generatorId);
|
|
273
298
|
return response;
|
|
274
299
|
}
|
|
275
|
-
return {
|
|
300
|
+
return {
|
|
301
|
+
isOk: true,
|
|
302
|
+
result: () => unregisterGenerationHandler(generatorId)
|
|
303
|
+
};
|
|
276
304
|
} catch {
|
|
277
305
|
generationHandlers.delete(subscriptionId);
|
|
306
|
+
generationSubscriptions.delete(generatorId);
|
|
278
307
|
return {
|
|
279
308
|
isOk: false,
|
|
280
309
|
error: {
|
|
@@ -283,6 +312,10 @@ function createAIApiProxy() {
|
|
|
283
312
|
}
|
|
284
313
|
};
|
|
285
314
|
}
|
|
315
|
+
},
|
|
316
|
+
unregisterHandler: async (generatorId) => {
|
|
317
|
+
unregisterGenerationHandler(generatorId);
|
|
318
|
+
return { isOk: true, result: void 0 };
|
|
286
319
|
}
|
|
287
320
|
};
|
|
288
321
|
}
|
|
@@ -428,8 +461,7 @@ var createAuthBridgeApi = () => {
|
|
|
428
461
|
const message = {
|
|
429
462
|
command: "auth-refresh",
|
|
430
463
|
messageId: generateMessageId(),
|
|
431
|
-
provider: request.provider
|
|
432
|
-
refresh_token: request.refresh_token
|
|
464
|
+
provider: request.provider
|
|
433
465
|
};
|
|
434
466
|
return sendMessage(message);
|
|
435
467
|
},
|
|
@@ -440,6 +472,13 @@ var createAuthBridgeApi = () => {
|
|
|
440
472
|
provider: request.provider
|
|
441
473
|
};
|
|
442
474
|
return sendMessage(message);
|
|
475
|
+
},
|
|
476
|
+
getUserToken: () => {
|
|
477
|
+
const message = {
|
|
478
|
+
command: "auth-get-user-token",
|
|
479
|
+
messageId: generateMessageId()
|
|
480
|
+
};
|
|
481
|
+
return sendMessage(message);
|
|
443
482
|
}
|
|
444
483
|
};
|
|
445
484
|
};
|
|
@@ -699,6 +738,7 @@ var handleIncomingMessage = (event) => {
|
|
|
699
738
|
var bridgeHandlers = {
|
|
700
739
|
ai: createAIApiProxy(),
|
|
701
740
|
context: contextApi,
|
|
741
|
+
data: createApiProxy("data"),
|
|
702
742
|
design: createApiProxy("design"),
|
|
703
743
|
designStore: designStateApi,
|
|
704
744
|
appStore: appStateApi,
|
package/dist/kittl-sdk.js
CHANGED
|
@@ -196,6 +196,13 @@
|
|
|
196
196
|
args,
|
|
197
197
|
messageId,
|
|
198
198
|
apiType: "upload"
|
|
199
|
+
}),
|
|
200
|
+
data: (dots, args, messageId) => ({
|
|
201
|
+
command: "sdk-call",
|
|
202
|
+
dots,
|
|
203
|
+
args,
|
|
204
|
+
messageId,
|
|
205
|
+
apiType: "data"
|
|
199
206
|
})
|
|
200
207
|
};
|
|
201
208
|
function createApiProxy(apiType) {
|
|
@@ -214,6 +221,7 @@
|
|
|
214
221
|
|
|
215
222
|
// ../../packages/editor-core/sdk/sdk-bridge/dist/bridge/sandboxed/handlers/apiProxy/aiApiProxy.js
|
|
216
223
|
var generationHandlers = /* @__PURE__ */ new Map();
|
|
224
|
+
var generationSubscriptions = /* @__PURE__ */ new Map();
|
|
217
225
|
var dispatchAIGenerationUpdate = (subscriptionId, update) => {
|
|
218
226
|
const handler = generationHandlers.get(subscriptionId);
|
|
219
227
|
if (!handler) {
|
|
@@ -222,6 +230,20 @@
|
|
|
222
230
|
void handler(update);
|
|
223
231
|
};
|
|
224
232
|
function createAIApiProxy() {
|
|
233
|
+
const unregisterGenerationHandler = (generatorId) => {
|
|
234
|
+
const subscriptionId = generationSubscriptions.get(generatorId);
|
|
235
|
+
if (!subscriptionId) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
generationHandlers.delete(subscriptionId);
|
|
239
|
+
generationSubscriptions.delete(generatorId);
|
|
240
|
+
const unregisterMessage = {
|
|
241
|
+
command: "ai-unregister-handler",
|
|
242
|
+
generatorId,
|
|
243
|
+
subscriptionId
|
|
244
|
+
};
|
|
245
|
+
postMessageToParent(unregisterMessage);
|
|
246
|
+
};
|
|
225
247
|
return {
|
|
226
248
|
spendCredits: async (options) => {
|
|
227
249
|
const { onAccept, onDecline, ...serializable } = options;
|
|
@@ -251,16 +273,18 @@
|
|
|
251
273
|
return sendMessage(message);
|
|
252
274
|
},
|
|
253
275
|
registerHandler: async (generatorId, onStatusUpdate) => {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
276
|
+
if (generationSubscriptions.has(generatorId)) {
|
|
277
|
+
return {
|
|
278
|
+
isOk: false,
|
|
279
|
+
error: {
|
|
280
|
+
message: `AI handler for generator "${generatorId}" is already registered`,
|
|
281
|
+
name: "SdkInternalError"
|
|
282
|
+
}
|
|
260
283
|
};
|
|
261
|
-
|
|
262
|
-
|
|
284
|
+
}
|
|
285
|
+
const subscriptionId = generateMessageId();
|
|
263
286
|
generationHandlers.set(subscriptionId, onStatusUpdate);
|
|
287
|
+
generationSubscriptions.set(generatorId, subscriptionId);
|
|
264
288
|
const registerMessage = {
|
|
265
289
|
command: "ai-register-handler",
|
|
266
290
|
messageId: generateMessageId(),
|
|
@@ -271,11 +295,16 @@
|
|
|
271
295
|
const response = await sendMessage(registerMessage);
|
|
272
296
|
if (!response.isOk) {
|
|
273
297
|
generationHandlers.delete(subscriptionId);
|
|
298
|
+
generationSubscriptions.delete(generatorId);
|
|
274
299
|
return response;
|
|
275
300
|
}
|
|
276
|
-
return {
|
|
301
|
+
return {
|
|
302
|
+
isOk: true,
|
|
303
|
+
result: () => unregisterGenerationHandler(generatorId)
|
|
304
|
+
};
|
|
277
305
|
} catch {
|
|
278
306
|
generationHandlers.delete(subscriptionId);
|
|
307
|
+
generationSubscriptions.delete(generatorId);
|
|
279
308
|
return {
|
|
280
309
|
isOk: false,
|
|
281
310
|
error: {
|
|
@@ -284,6 +313,10 @@
|
|
|
284
313
|
}
|
|
285
314
|
};
|
|
286
315
|
}
|
|
316
|
+
},
|
|
317
|
+
unregisterHandler: async (generatorId) => {
|
|
318
|
+
unregisterGenerationHandler(generatorId);
|
|
319
|
+
return { isOk: true, result: void 0 };
|
|
287
320
|
}
|
|
288
321
|
};
|
|
289
322
|
}
|
|
@@ -429,8 +462,7 @@
|
|
|
429
462
|
const message = {
|
|
430
463
|
command: "auth-refresh",
|
|
431
464
|
messageId: generateMessageId(),
|
|
432
|
-
provider: request.provider
|
|
433
|
-
refresh_token: request.refresh_token
|
|
465
|
+
provider: request.provider
|
|
434
466
|
};
|
|
435
467
|
return sendMessage(message);
|
|
436
468
|
},
|
|
@@ -441,6 +473,13 @@
|
|
|
441
473
|
provider: request.provider
|
|
442
474
|
};
|
|
443
475
|
return sendMessage(message);
|
|
476
|
+
},
|
|
477
|
+
getUserToken: () => {
|
|
478
|
+
const message = {
|
|
479
|
+
command: "auth-get-user-token",
|
|
480
|
+
messageId: generateMessageId()
|
|
481
|
+
};
|
|
482
|
+
return sendMessage(message);
|
|
444
483
|
}
|
|
445
484
|
};
|
|
446
485
|
};
|
|
@@ -700,6 +739,7 @@
|
|
|
700
739
|
var bridgeHandlers = {
|
|
701
740
|
ai: createAIApiProxy(),
|
|
702
741
|
context: contextApi,
|
|
742
|
+
data: createApiProxy("data"),
|
|
703
743
|
design: createApiProxy("design"),
|
|
704
744
|
designStore: designStateApi,
|
|
705
745
|
appStore: appStateApi,
|
package/dist/sdk.d.ts
CHANGED
|
@@ -14,6 +14,16 @@ declare abstract class KittlStateStore<T extends Record<string, unknown>> {
|
|
|
14
14
|
abstract internalPatch(args: InternalPatchArgs<T>): void;
|
|
15
15
|
abstract resetWithState(state: T): void;
|
|
16
16
|
}
|
|
17
|
+
declare class SdkBadInputError extends Error {
|
|
18
|
+
readonly name: "SdkBadInputError";
|
|
19
|
+
readonly cause?: Error;
|
|
20
|
+
constructor(message: string, cause?: Error);
|
|
21
|
+
}
|
|
22
|
+
declare class SdkInternalError extends Error {
|
|
23
|
+
readonly name: "SdkInternalError";
|
|
24
|
+
readonly cause?: Error;
|
|
25
|
+
constructor(message: string, cause?: Error);
|
|
26
|
+
}
|
|
17
27
|
declare const BASIC_SHAPE_DEFAULT_VALUES: {
|
|
18
28
|
defaultIcon: LayerIconType | undefined;
|
|
19
29
|
shadowOptions?: {
|
|
@@ -193,6 +203,9 @@ declare const GUIDE_DEFAULT_VALUES: {
|
|
|
193
203
|
version: string;
|
|
194
204
|
type: ObjectType.Guide;
|
|
195
205
|
};
|
|
206
|
+
declare const GenerationOperation: {
|
|
207
|
+
readonly INPAINT: "inpaint";
|
|
208
|
+
};
|
|
196
209
|
declare const GenerationStatus: {
|
|
197
210
|
readonly CREATED: "CREATED";
|
|
198
211
|
readonly STARTED: "STARTED";
|
|
@@ -501,8 +514,7 @@ declare enum ObjectType {
|
|
|
501
514
|
WarpControlRootPoint = "warpControlRootPoint",
|
|
502
515
|
Group = "group",
|
|
503
516
|
Circle = "circle",
|
|
504
|
-
Rect = "rect"
|
|
505
|
-
EditablePolygon = "editablePolygon"
|
|
517
|
+
Rect = "rect"
|
|
506
518
|
}
|
|
507
519
|
declare enum Orientation {
|
|
508
520
|
HORIZONTAL = "horizontal",
|
|
@@ -552,6 +564,11 @@ export interface AIGenerationOutputSettings {
|
|
|
552
564
|
height: number;
|
|
553
565
|
};
|
|
554
566
|
}
|
|
567
|
+
export interface AddFontStyleOptions {
|
|
568
|
+
fontFamilyId: string;
|
|
569
|
+
objectIds: string[];
|
|
570
|
+
styles: string[];
|
|
571
|
+
}
|
|
555
572
|
export interface AppStateAPI {
|
|
556
573
|
getSelectedObjectsIds(): string[];
|
|
557
574
|
setSelectedObjectsIds(ids: string[]): void;
|
|
@@ -577,6 +594,7 @@ export interface AsyncAIAPI {
|
|
|
577
594
|
spendCredits: (options: SpendCreditsOptions) => SdkResultAsync<SpendCreditsResult, Error>;
|
|
578
595
|
startGeneration: (generatorId: string, inputSettings: AIGenerationInputSettings, output: AIGenerationOutputSettings) => SdkResultAsync<StartGenerationResult, Error>;
|
|
579
596
|
registerHandler: (generatorId: string, onStatusUpdate: OnGenerationStatusUpdate) => SdkResultAsync<() => void, Error>;
|
|
597
|
+
unregisterHandler: (generatorId: string) => SdkResultAsync<void, Error>;
|
|
580
598
|
}
|
|
581
599
|
export interface AsyncAppStateAPI extends WithAsync<AppStateAPI> {
|
|
582
600
|
}
|
|
@@ -613,6 +631,7 @@ export interface AsyncAuthAPI {
|
|
|
613
631
|
exchangeCode: (request: AuthExchangeRequest) => Promise<SdkResult<AuthTokenResponse>>;
|
|
614
632
|
getAuthToken: (request: AuthGetTokenRequest) => Promise<SdkResult<AuthTokenResponse | null>>;
|
|
615
633
|
refreshToken: (request: AuthRefreshRequest) => Promise<SdkResult<AuthTokenResponse>>;
|
|
634
|
+
getUserToken: () => Promise<SdkResult<UserTokenResult>>;
|
|
616
635
|
logout: (request: AuthLogoutRequest) => Promise<SdkResult<void>>;
|
|
617
636
|
}
|
|
618
637
|
export interface AsyncBatchDesignAPI extends AsyncDesignAPI {
|
|
@@ -621,6 +640,8 @@ export interface AsyncBatchDesignAPI extends AsyncDesignAPI {
|
|
|
621
640
|
export interface AsyncContextAPI extends Omit<WithAsync<ContextAPI>, "subscribe"> {
|
|
622
641
|
subscribe(callback: ContextSubscriptionCallback): Promise<() => void>;
|
|
623
642
|
}
|
|
643
|
+
export interface AsyncDataAPI extends WithAsync<DataSDKApi> {
|
|
644
|
+
}
|
|
624
645
|
export interface AsyncDesignAPI extends WithAsync<WithOptsRemoved<DesignAPI>> {
|
|
625
646
|
}
|
|
626
647
|
export interface AsyncDesignStateAPI {
|
|
@@ -678,7 +699,6 @@ export interface AuthLogoutRequest {
|
|
|
678
699
|
}
|
|
679
700
|
export interface AuthRefreshRequest {
|
|
680
701
|
provider: string;
|
|
681
|
-
refresh_token: string;
|
|
682
702
|
}
|
|
683
703
|
export interface AuthStartRequest {
|
|
684
704
|
provider: string;
|
|
@@ -759,6 +779,11 @@ export interface CanvasAPI {
|
|
|
759
779
|
getPreviewImage: (id: string, options?: Partial<GetPreviewImageOptions>) => Promise<string | null>;
|
|
760
780
|
getExport: (options: GetExportOptions) => Promise<Blob | null>;
|
|
761
781
|
}
|
|
782
|
+
export interface CatalogItem {
|
|
783
|
+
id: string;
|
|
784
|
+
name: string;
|
|
785
|
+
previewImages: string[];
|
|
786
|
+
}
|
|
762
787
|
export interface ConfigAPI {
|
|
763
788
|
setConfig(config: Partial<DesignConfig>, opts?: DesignApiOptions): void;
|
|
764
789
|
}
|
|
@@ -769,6 +794,12 @@ export interface ContextAPI {
|
|
|
769
794
|
export interface ContextGetInput {
|
|
770
795
|
iframe?: Pick<HTMLIFrameElement, "getBoundingClientRect">;
|
|
771
796
|
}
|
|
797
|
+
export interface CreateFontOptions {
|
|
798
|
+
name: string;
|
|
799
|
+
files: Blob[];
|
|
800
|
+
styles: string[];
|
|
801
|
+
previewImage?: Blob;
|
|
802
|
+
}
|
|
772
803
|
export interface CreateLoadingCardInput extends CreateElementWithPositionAndSize {
|
|
773
804
|
imageGenerationId?: string;
|
|
774
805
|
startedAt?: number;
|
|
@@ -776,6 +807,10 @@ export interface CreateLoadingCardInput extends CreateElementWithPositionAndSize
|
|
|
776
807
|
generationAverageSpeed?: number;
|
|
777
808
|
name?: string;
|
|
778
809
|
}
|
|
810
|
+
export interface DataSDKApi {
|
|
811
|
+
mockups: MockupDataAPI;
|
|
812
|
+
fonts: FontDataAPI;
|
|
813
|
+
}
|
|
779
814
|
export interface DecorationOptions {
|
|
780
815
|
type: "horizontalLines" | "colorCut" | "obliqueLines" | "fadingColorCut";
|
|
781
816
|
color: string | null;
|
|
@@ -840,17 +875,42 @@ export interface DragAndDropStartDragImageEventInput {
|
|
|
840
875
|
export interface ErrorGenerationResult {
|
|
841
876
|
type: typeof ResultType.ERROR;
|
|
842
877
|
message: string;
|
|
843
|
-
|
|
878
|
+
subtitle: string;
|
|
879
|
+
status: "warning" | "error";
|
|
844
880
|
}
|
|
845
881
|
export interface FontAPI {
|
|
846
882
|
createFont: (params: {
|
|
847
883
|
name: string;
|
|
848
884
|
files: Blob[];
|
|
849
885
|
styles: string[];
|
|
850
|
-
extensionId?: string;
|
|
851
886
|
previewImage?: Blob;
|
|
852
887
|
}) => SdkResultAsync<UploadedFontFamily, Error>;
|
|
853
888
|
}
|
|
889
|
+
export interface FontDataAPI {
|
|
890
|
+
listUserFonts(options?: PaginationOptions): SdkResultAsync<FontListDto>;
|
|
891
|
+
listExtensionFonts(options?: PaginationOptions): SdkResultAsync<FontListDto>;
|
|
892
|
+
get(fontFamilyId: string): SdkResultAsync<FontFamilyDto>;
|
|
893
|
+
find(ids: string[]): SdkResultAsync<FontFamilyDto[]>;
|
|
894
|
+
create(options: CreateFontOptions): SdkResultAsync<FontFamilyDto>;
|
|
895
|
+
update(options: UpdateFontFamilyOptions): SdkResultAsync<FontFamilyDto>;
|
|
896
|
+
delete(ids: string[]): SdkResultAsync<void>;
|
|
897
|
+
destroy(ids: string[]): SdkResultAsync<void>;
|
|
898
|
+
addStyle(options: AddFontStyleOptions): SdkResultAsync<FontFamilyDto>;
|
|
899
|
+
updateStyle(options: UpdateFontStyleOptions): SdkResultAsync<void>;
|
|
900
|
+
}
|
|
901
|
+
export interface FontFamilyDto extends CatalogItem {
|
|
902
|
+
styles: FontStyleDto[];
|
|
903
|
+
deletedAt: string | null;
|
|
904
|
+
extension: {
|
|
905
|
+
id: string;
|
|
906
|
+
name?: string;
|
|
907
|
+
} | null;
|
|
908
|
+
}
|
|
909
|
+
export interface FontStyleDto {
|
|
910
|
+
id: string;
|
|
911
|
+
name: string;
|
|
912
|
+
style: string | null;
|
|
913
|
+
}
|
|
854
914
|
export interface FontVariation {
|
|
855
915
|
name: string;
|
|
856
916
|
min: number;
|
|
@@ -879,6 +939,7 @@ export interface GenerationInputData {
|
|
|
879
939
|
export interface GenerationMeta {
|
|
880
940
|
generationEndsAt?: number;
|
|
881
941
|
pendingGenerationId: string;
|
|
942
|
+
operation?: GenerationOperation;
|
|
882
943
|
}
|
|
883
944
|
export interface GenerationStartedResultCommonProps {
|
|
884
945
|
generationEndsAt?: number;
|
|
@@ -900,7 +961,16 @@ export interface GetExportOptions {
|
|
|
900
961
|
height: number;
|
|
901
962
|
};
|
|
902
963
|
};
|
|
964
|
+
size?: {
|
|
965
|
+
width: number;
|
|
966
|
+
height: number;
|
|
967
|
+
unit: Unit;
|
|
968
|
+
};
|
|
969
|
+
dpi?: number;
|
|
970
|
+
colorModel?: "rgb" | "cmyk";
|
|
903
971
|
removeArtboardBackground?: boolean;
|
|
972
|
+
optimizedQuality?: boolean;
|
|
973
|
+
renderingIntent?: "download" | "pdf";
|
|
904
974
|
}
|
|
905
975
|
export interface GetObjectParams {
|
|
906
976
|
id: string;
|
|
@@ -961,6 +1031,9 @@ export interface IllustrationAPI {
|
|
|
961
1031
|
export interface ImageAPI {
|
|
962
1032
|
addImage(params: AddImageParams, opts?: DesignApiOptions): SdkResultAsync<NormalizedIllustrationImageObject, SdkError>;
|
|
963
1033
|
updateImage(params: UpdateImageParams, opts?: DesignApiOptions): NormalizedIllustrationImageObject;
|
|
1034
|
+
updateImageSource(params: UpdateImageSourceParams, opts?: DesignApiOptions): SdkResultAsync<NormalizedIllustrationImageObject, SdkError>;
|
|
1035
|
+
resetImageCrop(params: ResetImageCropParams, opts?: DesignApiOptions): SdkResultAsync<NormalizedIllustrationImageObject, SdkError>;
|
|
1036
|
+
resetImageBackgroundRemoval(params: ResetImageBackgroundRemovalParams, opts?: DesignApiOptions): SdkResultAsync<NormalizedIllustrationImageObject, SdkError>;
|
|
964
1037
|
}
|
|
965
1038
|
export interface ImageGenerationResult {
|
|
966
1039
|
type: typeof ResultType.IMAGE;
|
|
@@ -980,6 +1053,7 @@ export interface KittlSDK {
|
|
|
980
1053
|
onLoadedCallback: (() => void) | null;
|
|
981
1054
|
onReady: (cb: () => void) => void;
|
|
982
1055
|
ai: AsyncAIAPI;
|
|
1056
|
+
data: AsyncDataAPI;
|
|
983
1057
|
design: AsyncDesignAPI;
|
|
984
1058
|
designStore: AsyncDesignStateAPI;
|
|
985
1059
|
appStore: AsyncAppStateSubscriptionAPI;
|
|
@@ -1008,6 +1082,33 @@ export interface LoadingCardAPI {
|
|
|
1008
1082
|
createLoadingCard(input: CreateLoadingCardInput, opts?: DesignApiOptions): NormalizedLoadingCardObject;
|
|
1009
1083
|
updateLoadingCard(input: UpdateLoadingCardInput, opts?: DesignApiOptions): NormalizedLoadingCardObject;
|
|
1010
1084
|
}
|
|
1085
|
+
export interface MockupDataAPI {
|
|
1086
|
+
get(id: number): SdkResultAsync<CatalogItem>;
|
|
1087
|
+
getOverview(options?: Pick<PaginationOptions, "sort">): SdkResultAsync<MockupOverviewDto>;
|
|
1088
|
+
getGroup(groupId: string, options?: PaginationOptions): SdkResultAsync<MockupGroupDto>;
|
|
1089
|
+
search(query: string, options?: PaginationOptions): SdkResultAsync<PaginatedResult<CatalogItem>>;
|
|
1090
|
+
getSuggestions(): SdkResultAsync<MockupSuggestions>;
|
|
1091
|
+
}
|
|
1092
|
+
export interface MockupGroupDto {
|
|
1093
|
+
group: {
|
|
1094
|
+
id: string;
|
|
1095
|
+
name: string;
|
|
1096
|
+
};
|
|
1097
|
+
data: PaginatedResult<CatalogItem>;
|
|
1098
|
+
}
|
|
1099
|
+
export interface MockupOverviewDto {
|
|
1100
|
+
overview: MockupOverviewGroupDto[];
|
|
1101
|
+
}
|
|
1102
|
+
export interface MockupOverviewGroupDto {
|
|
1103
|
+
id: string;
|
|
1104
|
+
name: string;
|
|
1105
|
+
mockups: CatalogItem[];
|
|
1106
|
+
total: number;
|
|
1107
|
+
}
|
|
1108
|
+
export interface MockupSuggestions {
|
|
1109
|
+
tags: string[];
|
|
1110
|
+
groups: string[];
|
|
1111
|
+
}
|
|
1011
1112
|
export interface MockupboardAPI {
|
|
1012
1113
|
addMockupBoard(params: AddMockupBoardParams, opts?: DesignApiOptions): NormalizedStandardBoard<MockupBoardOptions>;
|
|
1013
1114
|
addMockupDesignObject(params: AddMockupDesignObjectParams, opts?: DesignApiOptions): NormalizedMockupDesignObject;
|
|
@@ -1027,6 +1128,17 @@ export interface ObjectAPI {
|
|
|
1027
1128
|
id: string;
|
|
1028
1129
|
};
|
|
1029
1130
|
}
|
|
1131
|
+
export interface PaginatedResult<T> {
|
|
1132
|
+
items: T[];
|
|
1133
|
+
total?: number;
|
|
1134
|
+
hasMore: boolean;
|
|
1135
|
+
}
|
|
1136
|
+
export interface PaginationOptions {
|
|
1137
|
+
take?: number;
|
|
1138
|
+
skip?: number;
|
|
1139
|
+
sort?: string;
|
|
1140
|
+
cursor?: string;
|
|
1141
|
+
}
|
|
1030
1142
|
export interface PhotoFilterOptions {
|
|
1031
1143
|
[ImageFilterType.Saturation]: {
|
|
1032
1144
|
saturation: number;
|
|
@@ -1096,16 +1208,6 @@ export interface RotateObjectParams {
|
|
|
1096
1208
|
y: OriginY;
|
|
1097
1209
|
};
|
|
1098
1210
|
}
|
|
1099
|
-
export interface SdkBadInputError extends Error {
|
|
1100
|
-
name: "SdkBadInputError";
|
|
1101
|
-
message: string;
|
|
1102
|
-
cause?: Error;
|
|
1103
|
-
}
|
|
1104
|
-
export interface SdkInternalError extends Error {
|
|
1105
|
-
name: "SdkInternalError";
|
|
1106
|
-
message: string;
|
|
1107
|
-
cause?: Error;
|
|
1108
|
-
}
|
|
1109
1211
|
export interface SetHiddenParams {
|
|
1110
1212
|
id: string;
|
|
1111
1213
|
hidden: boolean;
|
|
@@ -1186,6 +1288,15 @@ export interface TransformOptions {
|
|
|
1186
1288
|
curve?: number;
|
|
1187
1289
|
isChanging?: boolean;
|
|
1188
1290
|
}
|
|
1291
|
+
export interface UpdateFontFamilyOptions {
|
|
1292
|
+
id: string;
|
|
1293
|
+
name: string;
|
|
1294
|
+
}
|
|
1295
|
+
export interface UpdateFontStyleOptions {
|
|
1296
|
+
fontFamilyId: string;
|
|
1297
|
+
id: string;
|
|
1298
|
+
style: string;
|
|
1299
|
+
}
|
|
1189
1300
|
export interface UpdateGuideInput {
|
|
1190
1301
|
id: string;
|
|
1191
1302
|
top?: number;
|
|
@@ -1205,14 +1316,17 @@ export interface UploadAPI {
|
|
|
1205
1316
|
image: UploadImageAPI;
|
|
1206
1317
|
}
|
|
1207
1318
|
export interface UploadImageAPI {
|
|
1208
|
-
upload: ({ blob,
|
|
1319
|
+
upload: ({ blob, }: {
|
|
1209
1320
|
blob: Blob;
|
|
1210
|
-
extensionId?: string;
|
|
1211
1321
|
}) => SdkResultAsync<UserImageUpload[], Error>;
|
|
1212
1322
|
uploadTemp: ({ blob, }: {
|
|
1213
1323
|
blob: Blob;
|
|
1214
1324
|
}) => SdkResultAsync<TempUserImageUpload[], Error>;
|
|
1215
1325
|
}
|
|
1326
|
+
export interface UserTokenResult {
|
|
1327
|
+
success: true;
|
|
1328
|
+
token: string;
|
|
1329
|
+
}
|
|
1216
1330
|
export interface VideoAPI {
|
|
1217
1331
|
addVideo(params: AddVideoParams, opts?: DesignApiOptions): Promise<NormalizedVideoObject>;
|
|
1218
1332
|
updateVideo(params: UpdateVideoParams, opts?: DesignApiOptions): NormalizedVideoObject;
|
|
@@ -1254,7 +1368,7 @@ export interface WithObjectLayout {
|
|
|
1254
1368
|
flipX: boolean;
|
|
1255
1369
|
flipY: boolean;
|
|
1256
1370
|
}
|
|
1257
|
-
export type AIGenerationActionOrigin = "COPILOT" | "RIGHT_PANEL" | "LEFT_PANEL" | "MICRO_APP" | "IMAGE_SETS" | "AI_CHAT" | "SMARTBOARD" | "AI_INPUT_GENERATE_IMAGE" | "AI_INPUT_REMIX_IMAGE" | "AI_INPUT_GENERATE_VIDEO" | "AI_HUB_GENERATE_IMAGE" | "AI_HUB_REMIX_IMAGE" | "AI_HUB_GENERATE_VIDEO" | "VIDEOBOARD";
|
|
1371
|
+
export type AIGenerationActionOrigin = "COPILOT" | "RIGHT_PANEL" | "LEFT_PANEL" | "MICRO_APP" | "IMAGE_SETS" | "AI_CHAT" | "SMARTBOARD" | "AI_INPUT_GENERATE_IMAGE" | "AI_INPUT_REMIX_IMAGE" | "AI_INPUT_GENERATE_VIDEO" | "AI_HUB_GENERATE_IMAGE" | "AI_HUB_REMIX_IMAGE" | "AI_HUB_GENERATE_VIDEO" | "VIDEOBOARD" | "AGENT" | "WORKFLOW";
|
|
1258
1372
|
export type AIGenerationContentType = "image" | "video";
|
|
1259
1373
|
export type AIGenerationModelTaskType = "IMAGE_TO_IMAGE" | "IMAGE_INPAINT" | "TEXT_TO_IMAGE" | "IMAGE_TO_VIDEO";
|
|
1260
1374
|
export type APIOptions<T extends Record<string, unknown>> = {
|
|
@@ -1494,8 +1608,8 @@ export type Expand<T> = T extends infer O ? {
|
|
|
1494
1608
|
} : never;
|
|
1495
1609
|
export type FillMetaTarget = "border" | "fill";
|
|
1496
1610
|
export type FlattenUnion<T> = UnionToIntersection<T extends unknown ? Partial<T> : never>;
|
|
1497
|
-
export type
|
|
1498
|
-
export type FontVariationSettings = Partial<Record<
|
|
1611
|
+
export type FontListDto = PaginatedResult<FontFamilyDto>;
|
|
1612
|
+
export type FontVariationSettings = Record<string, number> & Partial<Record<KnownFontVariationAxis, number>>;
|
|
1499
1613
|
export type FontWeight = OrAnyString<"Regular" | "Bold" | "Light" | "Medium" | "Black" | "SemiBold" | "Italic" | "ExtraLight" | "Thin" | "ExtraBold" | "LightItalic" | "MediumItalic" | "SemiBoldItalic" | "BlackItalic" | "ExtraBoldItalic" | "ThinItalic" | "ExtraLightItalic" | "BoldItalic">;
|
|
1500
1614
|
export type FullColor = {
|
|
1501
1615
|
key: "fill" | (Exclude<string, StringColorKeysType> & {});
|
|
@@ -1503,6 +1617,7 @@ export type FullColor = {
|
|
|
1503
1617
|
visible: boolean;
|
|
1504
1618
|
};
|
|
1505
1619
|
export type FunctionType = (...args: never) => unknown;
|
|
1620
|
+
export type GenerationOperation = (typeof GenerationOperation)[keyof typeof GenerationOperation];
|
|
1506
1621
|
export type GenerationStatus = (typeof GenerationStatus)[keyof typeof GenerationStatus];
|
|
1507
1622
|
export type GenerationStatusUpdate = {
|
|
1508
1623
|
generationId: string;
|
|
@@ -1538,7 +1653,8 @@ export type IllustrationImageSerializedObject = typeof DEFAULT_VALUES$1 & {
|
|
|
1538
1653
|
objectName: string | null;
|
|
1539
1654
|
fallbackObjectName?: string;
|
|
1540
1655
|
} | undefined;
|
|
1541
|
-
|
|
1656
|
+
eraseStrokeWidth?: number | undefined;
|
|
1657
|
+
inpaintingStrokeWidth?: number | undefined;
|
|
1542
1658
|
};
|
|
1543
1659
|
export type IllustrationProperties = {
|
|
1544
1660
|
angle?: IllustrationSerializedObject["angle"];
|
|
@@ -1551,6 +1667,7 @@ export type IllustrationProperties = {
|
|
|
1551
1667
|
strokeWidth?: IllustrationSerializedObject["strokeWidth"];
|
|
1552
1668
|
fill?: IllustrationSerializedObject["fill"];
|
|
1553
1669
|
gradients?: IllustrationSerializedObject["gradients"];
|
|
1670
|
+
generation?: IllustrationSerializedObject["generation"];
|
|
1554
1671
|
};
|
|
1555
1672
|
export type IllustrationSerializedObject = typeof ILLUSTRATION_DEFAULT_VALUES;
|
|
1556
1673
|
export type ImageProperties = {
|
|
@@ -1570,6 +1687,7 @@ export type InternalPatchArgs<T> = {
|
|
|
1570
1687
|
historyOrigin?: HistoryOrigins;
|
|
1571
1688
|
transactionMeta?: TransactionMeta;
|
|
1572
1689
|
};
|
|
1690
|
+
export type KnownFontVariationAxis = "wght" | "wdth" | "slnt" | "ital" | "opsz" | "GRAD";
|
|
1573
1691
|
export type LayerIconType = "drawIcon";
|
|
1574
1692
|
export type LayerType = Exclude<SerializableObjectType, ObjectType.Guide> | typeof structuralGroupType | typeof clippingMaskType | typeof backgroundType | typeof pathType;
|
|
1575
1693
|
export type LayersMovePosition = "before" | "after" | "into";
|
|
@@ -1780,6 +1898,12 @@ export type RenameParams = {
|
|
|
1780
1898
|
objectId: string;
|
|
1781
1899
|
newName: string;
|
|
1782
1900
|
};
|
|
1901
|
+
export type ResetImageBackgroundRemovalParams = {
|
|
1902
|
+
id: IllustrationImageSerializedObject["id"];
|
|
1903
|
+
};
|
|
1904
|
+
export type ResetImageCropParams = {
|
|
1905
|
+
id: IllustrationImageSerializedObject["id"];
|
|
1906
|
+
};
|
|
1783
1907
|
export type ResultType = (typeof ResultType)[keyof typeof ResultType];
|
|
1784
1908
|
export type RichTextBasePluginSerializedObject = {
|
|
1785
1909
|
id: string;
|
|
@@ -1994,8 +2118,9 @@ export type TextProperties = {
|
|
|
1994
2118
|
fontFamily?: string;
|
|
1995
2119
|
fontSize?: number;
|
|
1996
2120
|
fontWeight?: string;
|
|
2121
|
+
fontVariationSettings?: FontVariationSettings;
|
|
1997
2122
|
fill?: Color;
|
|
1998
|
-
textAlign?:
|
|
2123
|
+
textAlign?: TextAlign;
|
|
1999
2124
|
lineHeightValue?: LineHeight;
|
|
2000
2125
|
resizeBehavior?: "none" | "hug" | "hug-height";
|
|
2001
2126
|
charSpacing?: number;
|
|
@@ -2005,7 +2130,7 @@ export type TextProperties = {
|
|
|
2005
2130
|
angle?: number;
|
|
2006
2131
|
scaleX?: number;
|
|
2007
2132
|
scaleY?: number;
|
|
2008
|
-
stroke?: string;
|
|
2133
|
+
stroke?: string | null;
|
|
2009
2134
|
strokeWidth?: number;
|
|
2010
2135
|
};
|
|
2011
2136
|
export type TransactionMeta = {
|
|
@@ -2059,6 +2184,12 @@ export type UpdateImageParams = {
|
|
|
2059
2184
|
stroke?: IllustrationImageSerializedObject["stroke"];
|
|
2060
2185
|
strokeWidth?: IllustrationImageSerializedObject["strokeWidth"];
|
|
2061
2186
|
} & GeneratableObject;
|
|
2187
|
+
export type UpdateImageSourceParams = {
|
|
2188
|
+
id: IllustrationImageSerializedObject["id"];
|
|
2189
|
+
objectName: IllustrationImageSerializedObject["objectName"];
|
|
2190
|
+
keepObjectDimensions?: boolean;
|
|
2191
|
+
flatten?: boolean;
|
|
2192
|
+
};
|
|
2062
2193
|
export type UpdateMockupBoardParams = {
|
|
2063
2194
|
mockupBoardId: string;
|
|
2064
2195
|
size?: Dimensions;
|
|
@@ -2107,7 +2238,6 @@ export type UpdateVideoPlaylistItemParams = {
|
|
|
2107
2238
|
videoId: string;
|
|
2108
2239
|
playlistItemId: string;
|
|
2109
2240
|
playlistItem: Omit<VideoPlaylistItem, "id">;
|
|
2110
|
-
allowAspectRatioMismatch?: boolean;
|
|
2111
2241
|
};
|
|
2112
2242
|
export type UpdateVideoboardParams = {
|
|
2113
2243
|
videoBoardId: string;
|