@magiclabs.ai/magicbook-client 0.7.3 → 0.7.4-canary
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 +1 -0
- package/index.cjs +54 -24
- package/index.cjs.map +1 -1
- package/index.d.cts +10 -3
- package/index.d.ts +10 -3
- package/index.js +53 -24
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.cts
CHANGED
|
@@ -9,6 +9,7 @@ declare class BooksEndpoints {
|
|
|
9
9
|
create(book: Partial<Book>): Promise<Book>;
|
|
10
10
|
retrieve(bookId: string): Promise<Book>;
|
|
11
11
|
update(bookId: string, book: Partial<Book>): Promise<Book>;
|
|
12
|
+
design(bookId: string): Promise<Book>;
|
|
12
13
|
cancel(bookId: string): Promise<Book>;
|
|
13
14
|
report(bookId: string, report: BookReport): Promise<void>;
|
|
14
15
|
delete(bookId: string): Promise<void>;
|
|
@@ -390,7 +391,8 @@ declare class Images {
|
|
|
390
391
|
private parentId;
|
|
391
392
|
private images;
|
|
392
393
|
length: number;
|
|
393
|
-
|
|
394
|
+
designRequestState: State;
|
|
395
|
+
constructor(client: MagicBookClient, parentId: string, designRequestState: State);
|
|
394
396
|
add(image: Image): Promise<number>;
|
|
395
397
|
}
|
|
396
398
|
declare const imageServerSchema: z.ZodObject<{
|
|
@@ -444,6 +446,7 @@ declare const states: readonly ["new", "ingesting", "submitted", "storyboarding"
|
|
|
444
446
|
declare const statesToCloseWS: ReadonlyArray<typeof states[number]>;
|
|
445
447
|
declare const statesToReport: ReadonlyArray<typeof states[number]>;
|
|
446
448
|
declare const isDesignRequestSubmitted: (state: string) => boolean;
|
|
449
|
+
declare const canResubmitDesignRequest: (state: string) => boolean;
|
|
447
450
|
declare const occasions: readonly ["baby", "birthday", "default", "everyday", "family", "kids", "life-stories", "portfolio", "school-memories", "seasonal-holidays", "special-celebrations", "sports-and-hobbies", "travel", "wedding", "year-in-review"];
|
|
448
451
|
declare const styles: {
|
|
449
452
|
1005: {
|
|
@@ -1008,7 +1011,7 @@ type DesignRequestEventDetail = {
|
|
|
1008
1011
|
};
|
|
1009
1012
|
type DesignRequestEvent = CustomEvent<DesignRequestEventDetail>;
|
|
1010
1013
|
declare class DesignRequest {
|
|
1011
|
-
|
|
1014
|
+
readonly parentId: string;
|
|
1012
1015
|
private readonly client;
|
|
1013
1016
|
state: State;
|
|
1014
1017
|
title: string;
|
|
@@ -1232,6 +1235,7 @@ declare const bookPropsSchema: z.ZodObject<{
|
|
|
1232
1235
|
cancelled_at: z.ZodOptional<z.ZodString>;
|
|
1233
1236
|
mb_client_timeout: z.ZodOptional<z.ZodNumber>;
|
|
1234
1237
|
user_id: z.ZodOptional<z.ZodString>;
|
|
1238
|
+
revision: z.ZodOptional<z.ZodNumber>;
|
|
1235
1239
|
}, "strip", z.ZodTypeAny, {
|
|
1236
1240
|
title: string;
|
|
1237
1241
|
design_request: {
|
|
@@ -1252,6 +1256,7 @@ declare const bookPropsSchema: z.ZodObject<{
|
|
|
1252
1256
|
cancelled_at?: string | undefined;
|
|
1253
1257
|
mb_client_timeout?: number | undefined;
|
|
1254
1258
|
user_id?: string | undefined;
|
|
1259
|
+
revision?: number | undefined;
|
|
1255
1260
|
}, {
|
|
1256
1261
|
title: string;
|
|
1257
1262
|
design_request: {
|
|
@@ -1272,11 +1277,13 @@ declare const bookPropsSchema: z.ZodObject<{
|
|
|
1272
1277
|
cancelled_at?: string | undefined;
|
|
1273
1278
|
mb_client_timeout?: number | undefined;
|
|
1274
1279
|
user_id?: string | undefined;
|
|
1280
|
+
revision?: number | undefined;
|
|
1275
1281
|
}>;
|
|
1276
1282
|
type BookProps = z.infer<typeof bookPropsSchema>;
|
|
1277
1283
|
declare class Book {
|
|
1278
1284
|
id: string;
|
|
1279
1285
|
title: string;
|
|
1286
|
+
revision?: number;
|
|
1280
1287
|
subtitle?: string;
|
|
1281
1288
|
design_request: BookDesignRequest;
|
|
1282
1289
|
state?: State;
|
|
@@ -3458,4 +3465,4 @@ declare const bookCreationRequestSchema: z.ZodObject<{
|
|
|
3458
3465
|
}>;
|
|
3459
3466
|
type BookCreationRequest = z.infer<typeof bookCreationRequestSchema>;
|
|
3460
3467
|
|
|
3461
|
-
export { Asset, Book, BookCreationRequest, BookDesignRequest, BookDesignRequestProps, BookProps, BookReport, BookSize, Canvas, CoverType, DesignOptions, DesignOptionsServer, DesignRequest, DesignRequestEvent, DesignRequestEventDetail, DesignRequestOptions, DesignRequestProps, EmbellishmentLevel, Image, ImageAssignment, ImageDensity, ImageDensityOption, ImageDensityOptionServer, ImageDensityOptions, ImageDensityOptionsServer, ImageFilteringLevel, ImageServer, Images, MagicBookClient, MagicShopBook, Occasion, Page, PageType, PhotoMetadata, PhotoStrip, Position, Property, ReportingData, State, Style, TextStickerLevel, assetSchema, bookCreationRequestSchema, bookDesignRequestSchema, bookPropsSchema, bookSizes, cancelledEventDetail, canvasSchema, coverTypes, designOptionsSchema, designOptionsServerSchema, embellishmentLevels, imageAssignmentSchema, imageDensities, imageDensityOptionSchema, imageDensityOptionServerSchema, imageDensityOptionsSchema, imageDensityOptionsServerSchema, imageFilteringLevels, imageServerSchema, isDesignRequestSubmitted, magicShopBookSchema, occasions, pageSchema, pageTypes, photoMetadataSchema, photoStripSchema, positionSchema, propertySchema, reportingDataSchema, states, statesToCloseWS, statesToReport, styles, textStickerLevels, timeoutEventDetail };
|
|
3468
|
+
export { Asset, Book, BookCreationRequest, BookDesignRequest, BookDesignRequestProps, BookProps, BookReport, BookSize, Canvas, CoverType, DesignOptions, DesignOptionsServer, DesignRequest, DesignRequestEvent, DesignRequestEventDetail, DesignRequestOptions, DesignRequestProps, EmbellishmentLevel, Image, ImageAssignment, ImageDensity, ImageDensityOption, ImageDensityOptionServer, ImageDensityOptions, ImageDensityOptionsServer, ImageFilteringLevel, ImageServer, Images, MagicBookClient, MagicShopBook, Occasion, Page, PageType, PhotoMetadata, PhotoStrip, Position, Property, ReportingData, State, Style, TextStickerLevel, assetSchema, bookCreationRequestSchema, bookDesignRequestSchema, bookPropsSchema, bookSizes, canResubmitDesignRequest, cancelledEventDetail, canvasSchema, coverTypes, designOptionsSchema, designOptionsServerSchema, embellishmentLevels, imageAssignmentSchema, imageDensities, imageDensityOptionSchema, imageDensityOptionServerSchema, imageDensityOptionsSchema, imageDensityOptionsServerSchema, imageFilteringLevels, imageServerSchema, isDesignRequestSubmitted, magicShopBookSchema, occasions, pageSchema, pageTypes, photoMetadataSchema, photoStripSchema, positionSchema, propertySchema, reportingDataSchema, states, statesToCloseWS, statesToReport, styles, textStickerLevels, timeoutEventDetail };
|
package/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ declare class BooksEndpoints {
|
|
|
9
9
|
create(book: Partial<Book>): Promise<Book>;
|
|
10
10
|
retrieve(bookId: string): Promise<Book>;
|
|
11
11
|
update(bookId: string, book: Partial<Book>): Promise<Book>;
|
|
12
|
+
design(bookId: string): Promise<Book>;
|
|
12
13
|
cancel(bookId: string): Promise<Book>;
|
|
13
14
|
report(bookId: string, report: BookReport): Promise<void>;
|
|
14
15
|
delete(bookId: string): Promise<void>;
|
|
@@ -390,7 +391,8 @@ declare class Images {
|
|
|
390
391
|
private parentId;
|
|
391
392
|
private images;
|
|
392
393
|
length: number;
|
|
393
|
-
|
|
394
|
+
designRequestState: State;
|
|
395
|
+
constructor(client: MagicBookClient, parentId: string, designRequestState: State);
|
|
394
396
|
add(image: Image): Promise<number>;
|
|
395
397
|
}
|
|
396
398
|
declare const imageServerSchema: z.ZodObject<{
|
|
@@ -444,6 +446,7 @@ declare const states: readonly ["new", "ingesting", "submitted", "storyboarding"
|
|
|
444
446
|
declare const statesToCloseWS: ReadonlyArray<typeof states[number]>;
|
|
445
447
|
declare const statesToReport: ReadonlyArray<typeof states[number]>;
|
|
446
448
|
declare const isDesignRequestSubmitted: (state: string) => boolean;
|
|
449
|
+
declare const canResubmitDesignRequest: (state: string) => boolean;
|
|
447
450
|
declare const occasions: readonly ["baby", "birthday", "default", "everyday", "family", "kids", "life-stories", "portfolio", "school-memories", "seasonal-holidays", "special-celebrations", "sports-and-hobbies", "travel", "wedding", "year-in-review"];
|
|
448
451
|
declare const styles: {
|
|
449
452
|
1005: {
|
|
@@ -1008,7 +1011,7 @@ type DesignRequestEventDetail = {
|
|
|
1008
1011
|
};
|
|
1009
1012
|
type DesignRequestEvent = CustomEvent<DesignRequestEventDetail>;
|
|
1010
1013
|
declare class DesignRequest {
|
|
1011
|
-
|
|
1014
|
+
readonly parentId: string;
|
|
1012
1015
|
private readonly client;
|
|
1013
1016
|
state: State;
|
|
1014
1017
|
title: string;
|
|
@@ -1232,6 +1235,7 @@ declare const bookPropsSchema: z.ZodObject<{
|
|
|
1232
1235
|
cancelled_at: z.ZodOptional<z.ZodString>;
|
|
1233
1236
|
mb_client_timeout: z.ZodOptional<z.ZodNumber>;
|
|
1234
1237
|
user_id: z.ZodOptional<z.ZodString>;
|
|
1238
|
+
revision: z.ZodOptional<z.ZodNumber>;
|
|
1235
1239
|
}, "strip", z.ZodTypeAny, {
|
|
1236
1240
|
title: string;
|
|
1237
1241
|
design_request: {
|
|
@@ -1252,6 +1256,7 @@ declare const bookPropsSchema: z.ZodObject<{
|
|
|
1252
1256
|
cancelled_at?: string | undefined;
|
|
1253
1257
|
mb_client_timeout?: number | undefined;
|
|
1254
1258
|
user_id?: string | undefined;
|
|
1259
|
+
revision?: number | undefined;
|
|
1255
1260
|
}, {
|
|
1256
1261
|
title: string;
|
|
1257
1262
|
design_request: {
|
|
@@ -1272,11 +1277,13 @@ declare const bookPropsSchema: z.ZodObject<{
|
|
|
1272
1277
|
cancelled_at?: string | undefined;
|
|
1273
1278
|
mb_client_timeout?: number | undefined;
|
|
1274
1279
|
user_id?: string | undefined;
|
|
1280
|
+
revision?: number | undefined;
|
|
1275
1281
|
}>;
|
|
1276
1282
|
type BookProps = z.infer<typeof bookPropsSchema>;
|
|
1277
1283
|
declare class Book {
|
|
1278
1284
|
id: string;
|
|
1279
1285
|
title: string;
|
|
1286
|
+
revision?: number;
|
|
1280
1287
|
subtitle?: string;
|
|
1281
1288
|
design_request: BookDesignRequest;
|
|
1282
1289
|
state?: State;
|
|
@@ -3458,4 +3465,4 @@ declare const bookCreationRequestSchema: z.ZodObject<{
|
|
|
3458
3465
|
}>;
|
|
3459
3466
|
type BookCreationRequest = z.infer<typeof bookCreationRequestSchema>;
|
|
3460
3467
|
|
|
3461
|
-
export { Asset, Book, BookCreationRequest, BookDesignRequest, BookDesignRequestProps, BookProps, BookReport, BookSize, Canvas, CoverType, DesignOptions, DesignOptionsServer, DesignRequest, DesignRequestEvent, DesignRequestEventDetail, DesignRequestOptions, DesignRequestProps, EmbellishmentLevel, Image, ImageAssignment, ImageDensity, ImageDensityOption, ImageDensityOptionServer, ImageDensityOptions, ImageDensityOptionsServer, ImageFilteringLevel, ImageServer, Images, MagicBookClient, MagicShopBook, Occasion, Page, PageType, PhotoMetadata, PhotoStrip, Position, Property, ReportingData, State, Style, TextStickerLevel, assetSchema, bookCreationRequestSchema, bookDesignRequestSchema, bookPropsSchema, bookSizes, cancelledEventDetail, canvasSchema, coverTypes, designOptionsSchema, designOptionsServerSchema, embellishmentLevels, imageAssignmentSchema, imageDensities, imageDensityOptionSchema, imageDensityOptionServerSchema, imageDensityOptionsSchema, imageDensityOptionsServerSchema, imageFilteringLevels, imageServerSchema, isDesignRequestSubmitted, magicShopBookSchema, occasions, pageSchema, pageTypes, photoMetadataSchema, photoStripSchema, positionSchema, propertySchema, reportingDataSchema, states, statesToCloseWS, statesToReport, styles, textStickerLevels, timeoutEventDetail };
|
|
3468
|
+
export { Asset, Book, BookCreationRequest, BookDesignRequest, BookDesignRequestProps, BookProps, BookReport, BookSize, Canvas, CoverType, DesignOptions, DesignOptionsServer, DesignRequest, DesignRequestEvent, DesignRequestEventDetail, DesignRequestOptions, DesignRequestProps, EmbellishmentLevel, Image, ImageAssignment, ImageDensity, ImageDensityOption, ImageDensityOptionServer, ImageDensityOptions, ImageDensityOptionsServer, ImageFilteringLevel, ImageServer, Images, MagicBookClient, MagicShopBook, Occasion, Page, PageType, PhotoMetadata, PhotoStrip, Position, Property, ReportingData, State, Style, TextStickerLevel, assetSchema, bookCreationRequestSchema, bookDesignRequestSchema, bookPropsSchema, bookSizes, canResubmitDesignRequest, cancelledEventDetail, canvasSchema, coverTypes, designOptionsSchema, designOptionsServerSchema, embellishmentLevels, imageAssignmentSchema, imageDensities, imageDensityOptionSchema, imageDensityOptionServerSchema, imageDensityOptionsSchema, imageDensityOptionsServerSchema, imageFilteringLevels, imageServerSchema, isDesignRequestSubmitted, magicShopBookSchema, occasions, pageSchema, pageTypes, photoMetadataSchema, photoStripSchema, positionSchema, propertySchema, reportingDataSchema, states, statesToCloseWS, statesToReport, styles, textStickerLevels, timeoutEventDetail };
|
package/index.js
CHANGED
|
@@ -18,6 +18,7 @@ var states = [
|
|
|
18
18
|
var statesToCloseWS = ["error", "timeout", "ready", "cancelled"];
|
|
19
19
|
var statesToReport = ["error", "timeout"];
|
|
20
20
|
var isDesignRequestSubmitted = (state) => !["new", "ingesting"].includes(state);
|
|
21
|
+
var canResubmitDesignRequest = (state) => ["new", "ingesting", "ready"].includes(state);
|
|
21
22
|
var occasions = [
|
|
22
23
|
"baby",
|
|
23
24
|
"birthday",
|
|
@@ -181,7 +182,7 @@ var styles = {
|
|
|
181
182
|
6116: { slug: "boho-baby-sfly" },
|
|
182
183
|
6117: { slug: "simply-gallery-sfly" },
|
|
183
184
|
6118: { slug: "this-is-love-sfly" },
|
|
184
|
-
6120: { slug: "wedding-
|
|
185
|
+
6120: { slug: "wedding-photo-album-sfly" },
|
|
185
186
|
6121: { slug: "watercolorwashes-sfly" },
|
|
186
187
|
6124: { slug: "graduation-photo-album-sfly" },
|
|
187
188
|
6125: { slug: "modern-year-in-review-photo-album-sfly" },
|
|
@@ -4023,11 +4024,13 @@ var bookPropsSchema = z.object({
|
|
|
4023
4024
|
guid: z.string().optional(),
|
|
4024
4025
|
cancelled_at: z.string().optional(),
|
|
4025
4026
|
mb_client_timeout: z.number().optional(),
|
|
4026
|
-
user_id: z.string().optional()
|
|
4027
|
+
user_id: z.string().optional(),
|
|
4028
|
+
revision: z.number().optional()
|
|
4027
4029
|
});
|
|
4028
4030
|
var Book = class {
|
|
4029
4031
|
id;
|
|
4030
4032
|
title;
|
|
4033
|
+
revision;
|
|
4031
4034
|
subtitle;
|
|
4032
4035
|
design_request;
|
|
4033
4036
|
state;
|
|
@@ -4045,11 +4048,13 @@ var Book = class {
|
|
|
4045
4048
|
this.cancelled_at = props.cancelled_at;
|
|
4046
4049
|
this.timeout = props.mb_client_timeout ? props.mb_client_timeout * 1e3 : void 0;
|
|
4047
4050
|
this.user_id = props.user_id;
|
|
4051
|
+
this.revision = props.revision;
|
|
4048
4052
|
}
|
|
4049
4053
|
toDesignRequestProps() {
|
|
4050
4054
|
const props = { ...this, ...this.design_request };
|
|
4051
4055
|
props.style = getStyleIdBySlug(props.style);
|
|
4052
4056
|
delete props.design_request;
|
|
4057
|
+
delete props.revision;
|
|
4053
4058
|
return snakeCaseObjectKeysToCamelCase(props);
|
|
4054
4059
|
}
|
|
4055
4060
|
toBookProps() {
|
|
@@ -4063,22 +4068,28 @@ var Book = class {
|
|
|
4063
4068
|
// ../../core/models/design-request/image.ts
|
|
4064
4069
|
var Images = class {
|
|
4065
4070
|
// eslint-disable-next-line no-unused-vars
|
|
4066
|
-
constructor(client, parentId) {
|
|
4071
|
+
constructor(client, parentId, designRequestState) {
|
|
4067
4072
|
this.client = client;
|
|
4068
4073
|
this.parentId = parentId;
|
|
4069
4074
|
this.images = [];
|
|
4070
4075
|
this.length = this.images.length;
|
|
4076
|
+
this.designRequestState = designRequestState;
|
|
4071
4077
|
}
|
|
4072
4078
|
parentId;
|
|
4073
4079
|
images;
|
|
4074
4080
|
length;
|
|
4081
|
+
designRequestState;
|
|
4075
4082
|
async add(image) {
|
|
4076
|
-
this.
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4083
|
+
if (!canResubmitDesignRequest(this.designRequestState)) {
|
|
4084
|
+
throw new Error("You need to wait for the current design request to be ready before adding new images.");
|
|
4085
|
+
} else {
|
|
4086
|
+
this.images.push(image);
|
|
4087
|
+
this.length = this.images.length;
|
|
4088
|
+
await this.client.engineAPI.images.addToBook(this.parentId, new ImageServer(image));
|
|
4089
|
+
return new Promise((resolve) => {
|
|
4090
|
+
resolve(this.length);
|
|
4091
|
+
});
|
|
4092
|
+
}
|
|
4082
4093
|
}
|
|
4083
4094
|
};
|
|
4084
4095
|
var imageServerSchema = z.object({
|
|
@@ -4176,7 +4187,7 @@ var DesignRequest = class {
|
|
|
4176
4187
|
this.imageFilteringLevel = designRequestProps?.imageFilteringLevel || imageFilteringLevels[0];
|
|
4177
4188
|
this.embellishmentLevel = designRequestProps?.embellishmentLevel || embellishmentLevels[0];
|
|
4178
4189
|
this.textStickerLevel = designRequestProps?.textStickerLevel || textStickerLevels[0];
|
|
4179
|
-
this.images = new Images(this.client, this.parentId);
|
|
4190
|
+
this.images = new Images(this.client, this.parentId, this.state);
|
|
4180
4191
|
this.userId = designRequestProps?.userId;
|
|
4181
4192
|
}
|
|
4182
4193
|
state;
|
|
@@ -4198,6 +4209,9 @@ var DesignRequest = class {
|
|
|
4198
4209
|
timeout;
|
|
4199
4210
|
updateDesignRequest(designRequestProps) {
|
|
4200
4211
|
Object.assign(this, designRequestProps);
|
|
4212
|
+
if (designRequestProps.state) {
|
|
4213
|
+
this.images.designRequestState = designRequestProps.state;
|
|
4214
|
+
}
|
|
4201
4215
|
}
|
|
4202
4216
|
async getOptions(imageCount) {
|
|
4203
4217
|
const options = designOptionsSchema.parse(snakeCaseObjectKeysToCamelCase(
|
|
@@ -4210,16 +4224,17 @@ var DesignRequest = class {
|
|
|
4210
4224
|
return options;
|
|
4211
4225
|
}
|
|
4212
4226
|
async submit(submitDesignRequestProps) {
|
|
4213
|
-
if (
|
|
4214
|
-
throw new Error("
|
|
4227
|
+
if (!canResubmitDesignRequest(this.state)) {
|
|
4228
|
+
throw new Error("You need to wait for the current design request to be ready before submitting a new one");
|
|
4215
4229
|
} else {
|
|
4216
|
-
submitDesignRequestProps &&
|
|
4230
|
+
submitDesignRequestProps && this.updateDesignRequest(submitDesignRequestProps);
|
|
4217
4231
|
this.webSocket = new WebSocket(`${this.client.webSocketHost}/?book_id=${this.parentId}`);
|
|
4232
|
+
await this.client.engineAPI.books.update(this.parentId, this.toBook());
|
|
4218
4233
|
this.updateDesignRequest(
|
|
4219
|
-
(await this.client.engineAPI.books.
|
|
4234
|
+
(await this.client.engineAPI.books.design(this.parentId)).toDesignRequestProps()
|
|
4220
4235
|
);
|
|
4221
4236
|
this.getProgress();
|
|
4222
|
-
this.state
|
|
4237
|
+
this.updateDesignRequest({ state: states[1] });
|
|
4223
4238
|
return this;
|
|
4224
4239
|
}
|
|
4225
4240
|
}
|
|
@@ -4242,10 +4257,10 @@ var DesignRequest = class {
|
|
|
4242
4257
|
} else if (!isDesignRequestSubmitted(this.state)) {
|
|
4243
4258
|
throw new Error("Design request not submitted");
|
|
4244
4259
|
} else {
|
|
4245
|
-
this.updateDesignRequest(
|
|
4246
|
-
(await this.client.engineAPI.books.cancel(this.parentId)).toDesignRequestProps()
|
|
4247
|
-
|
|
4248
|
-
|
|
4260
|
+
this.updateDesignRequest({
|
|
4261
|
+
...(await this.client.engineAPI.books.cancel(this.parentId)).toDesignRequestProps(),
|
|
4262
|
+
state: "cancelled"
|
|
4263
|
+
});
|
|
4249
4264
|
await this.eventHandler(cancelledEventDetail);
|
|
4250
4265
|
return this;
|
|
4251
4266
|
}
|
|
@@ -4271,7 +4286,7 @@ var DesignRequest = class {
|
|
|
4271
4286
|
});
|
|
4272
4287
|
}
|
|
4273
4288
|
}
|
|
4274
|
-
this.state
|
|
4289
|
+
this.updateDesignRequest({ state: detail.slug });
|
|
4275
4290
|
window.dispatchEvent(customEvent);
|
|
4276
4291
|
}
|
|
4277
4292
|
timeoutHandler() {
|
|
@@ -4298,10 +4313,13 @@ var DesignRequest = class {
|
|
|
4298
4313
|
}
|
|
4299
4314
|
}
|
|
4300
4315
|
toBook() {
|
|
4301
|
-
const designRequest = {
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4316
|
+
const designRequest = {
|
|
4317
|
+
...this,
|
|
4318
|
+
images: this.images["images"]
|
|
4319
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4320
|
+
};
|
|
4321
|
+
delete designRequest.client;
|
|
4322
|
+
delete designRequest.webSocket;
|
|
4305
4323
|
const styleSlug = styles[this.style].slug;
|
|
4306
4324
|
const bookDesignRequest = camelCaseObjectKeysToSnakeCase(cleanJSON(designRequest));
|
|
4307
4325
|
bookDesignRequest.style = styleSlug;
|
|
@@ -4436,6 +4454,16 @@ var BooksEndpoints = class {
|
|
|
4436
4454
|
return new Book(res);
|
|
4437
4455
|
});
|
|
4438
4456
|
}
|
|
4457
|
+
design(bookId) {
|
|
4458
|
+
return handleAsyncFunction(async () => {
|
|
4459
|
+
const res = await this.engineAPI.fetcher.call({
|
|
4460
|
+
path: `/v1/books/${bookId}/design`,
|
|
4461
|
+
options: { method: "POST" }
|
|
4462
|
+
});
|
|
4463
|
+
bookPropsSchema.safeParse(res);
|
|
4464
|
+
return new Book(res);
|
|
4465
|
+
});
|
|
4466
|
+
}
|
|
4439
4467
|
cancel(bookId) {
|
|
4440
4468
|
return handleAsyncFunction(async () => {
|
|
4441
4469
|
const res = await this.engineAPI.fetcher.call({
|
|
@@ -4887,6 +4915,7 @@ export {
|
|
|
4887
4915
|
bookDesignRequestSchema,
|
|
4888
4916
|
bookPropsSchema,
|
|
4889
4917
|
bookSizes,
|
|
4918
|
+
canResubmitDesignRequest,
|
|
4890
4919
|
cancelledEventDetail,
|
|
4891
4920
|
canvasSchema,
|
|
4892
4921
|
coverTypes,
|