@magiclabs.ai/magicbook-client 0.6.12 → 0.6.13
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/index.cjs +16 -11
- package/index.cjs.map +1 -1
- package/index.d.cts +9 -3
- package/index.d.ts +9 -3
- package/index.js +14 -9
- package/index.js.map +1 -1
- package/package.json +8 -8
package/index.d.cts
CHANGED
|
@@ -575,8 +575,8 @@ declare const imageDensities: readonly ["low", "medium", "high"];
|
|
|
575
575
|
declare const imageFilteringLevels: readonly ["best", "most", "all"];
|
|
576
576
|
declare const embellishmentLevels: readonly ["none", "few", "lots"];
|
|
577
577
|
declare const textStickerLevels: readonly ["none", "few", "lots"];
|
|
578
|
-
declare const
|
|
579
|
-
declare const
|
|
578
|
+
declare const timeoutEventDetail: DesignRequestEventDetail;
|
|
579
|
+
declare const cancelledEventDetail: DesignRequestEventDetail;
|
|
580
580
|
|
|
581
581
|
type Occasion = typeof occasions[number];
|
|
582
582
|
type Style = keyof typeof styles;
|
|
@@ -600,6 +600,7 @@ declare const DesignRequestOptions: {
|
|
|
600
600
|
};
|
|
601
601
|
type DesignRequestProps = {
|
|
602
602
|
title?: string;
|
|
603
|
+
subtitle?: string;
|
|
603
604
|
state?: State;
|
|
604
605
|
occasion?: Occasion;
|
|
605
606
|
style?: Style;
|
|
@@ -625,6 +626,7 @@ declare class DesignRequest {
|
|
|
625
626
|
state: State;
|
|
626
627
|
parentId: string;
|
|
627
628
|
title: string;
|
|
629
|
+
subtitle?: string;
|
|
628
630
|
occasion: Occasion;
|
|
629
631
|
style: Style;
|
|
630
632
|
bookSize: BookSize;
|
|
@@ -769,6 +771,7 @@ declare class BookDesignRequest {
|
|
|
769
771
|
declare const BookPropsSchema: z.ZodObject<{
|
|
770
772
|
id: z.ZodOptional<z.ZodString>;
|
|
771
773
|
title: z.ZodString;
|
|
774
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
772
775
|
design_request: z.ZodObject<{
|
|
773
776
|
occasion: z.ZodEnum<["baby", "birthday", "default", "everyday", "family", "kids", "life-stories", "portfolio", "school-memories", "seasonal-holidays", "special-celebrations", "sports-and-hobbies", "travel", "wedding", "year-in-review"]>;
|
|
774
777
|
style: z.ZodString;
|
|
@@ -817,6 +820,7 @@ declare const BookPropsSchema: z.ZodObject<{
|
|
|
817
820
|
text_sticker_level: "none" | "few" | "lots";
|
|
818
821
|
};
|
|
819
822
|
id?: string | undefined;
|
|
823
|
+
subtitle?: string | undefined;
|
|
820
824
|
state?: "new" | "ingesting" | "submitted" | "storyboarding" | "deduplication" | "image-selection" | "designing" | "layouting" | "embellishing" | "polishing" | "ready" | "timeout" | "error" | "cancelled" | undefined;
|
|
821
825
|
guid?: string | undefined;
|
|
822
826
|
cancelled_at?: string | undefined;
|
|
@@ -834,6 +838,7 @@ declare const BookPropsSchema: z.ZodObject<{
|
|
|
834
838
|
text_sticker_level: "none" | "few" | "lots";
|
|
835
839
|
};
|
|
836
840
|
id?: string | undefined;
|
|
841
|
+
subtitle?: string | undefined;
|
|
837
842
|
state?: "new" | "ingesting" | "submitted" | "storyboarding" | "deduplication" | "image-selection" | "designing" | "layouting" | "embellishing" | "polishing" | "ready" | "timeout" | "error" | "cancelled" | undefined;
|
|
838
843
|
guid?: string | undefined;
|
|
839
844
|
cancelled_at?: string | undefined;
|
|
@@ -842,6 +847,7 @@ type BookProps = z.infer<typeof BookPropsSchema>;
|
|
|
842
847
|
declare class Book {
|
|
843
848
|
id: string;
|
|
844
849
|
title: string;
|
|
850
|
+
subtitle?: string;
|
|
845
851
|
design_request: BookDesignRequest;
|
|
846
852
|
state?: State;
|
|
847
853
|
guid?: string;
|
|
@@ -3380,4 +3386,4 @@ declare const bookCreationRequestSchema: z.ZodObject<{
|
|
|
3380
3386
|
}>;
|
|
3381
3387
|
type BookCreationRequest = z.infer<typeof bookCreationRequestSchema>;
|
|
3382
3388
|
|
|
3383
|
-
export { Asset, BookCreationRequest, 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, bookSizes,
|
|
3389
|
+
export { Asset, BookCreationRequest, 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, 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 };
|
package/index.d.ts
CHANGED
|
@@ -575,8 +575,8 @@ declare const imageDensities: readonly ["low", "medium", "high"];
|
|
|
575
575
|
declare const imageFilteringLevels: readonly ["best", "most", "all"];
|
|
576
576
|
declare const embellishmentLevels: readonly ["none", "few", "lots"];
|
|
577
577
|
declare const textStickerLevels: readonly ["none", "few", "lots"];
|
|
578
|
-
declare const
|
|
579
|
-
declare const
|
|
578
|
+
declare const timeoutEventDetail: DesignRequestEventDetail;
|
|
579
|
+
declare const cancelledEventDetail: DesignRequestEventDetail;
|
|
580
580
|
|
|
581
581
|
type Occasion = typeof occasions[number];
|
|
582
582
|
type Style = keyof typeof styles;
|
|
@@ -600,6 +600,7 @@ declare const DesignRequestOptions: {
|
|
|
600
600
|
};
|
|
601
601
|
type DesignRequestProps = {
|
|
602
602
|
title?: string;
|
|
603
|
+
subtitle?: string;
|
|
603
604
|
state?: State;
|
|
604
605
|
occasion?: Occasion;
|
|
605
606
|
style?: Style;
|
|
@@ -625,6 +626,7 @@ declare class DesignRequest {
|
|
|
625
626
|
state: State;
|
|
626
627
|
parentId: string;
|
|
627
628
|
title: string;
|
|
629
|
+
subtitle?: string;
|
|
628
630
|
occasion: Occasion;
|
|
629
631
|
style: Style;
|
|
630
632
|
bookSize: BookSize;
|
|
@@ -769,6 +771,7 @@ declare class BookDesignRequest {
|
|
|
769
771
|
declare const BookPropsSchema: z.ZodObject<{
|
|
770
772
|
id: z.ZodOptional<z.ZodString>;
|
|
771
773
|
title: z.ZodString;
|
|
774
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
772
775
|
design_request: z.ZodObject<{
|
|
773
776
|
occasion: z.ZodEnum<["baby", "birthday", "default", "everyday", "family", "kids", "life-stories", "portfolio", "school-memories", "seasonal-holidays", "special-celebrations", "sports-and-hobbies", "travel", "wedding", "year-in-review"]>;
|
|
774
777
|
style: z.ZodString;
|
|
@@ -817,6 +820,7 @@ declare const BookPropsSchema: z.ZodObject<{
|
|
|
817
820
|
text_sticker_level: "none" | "few" | "lots";
|
|
818
821
|
};
|
|
819
822
|
id?: string | undefined;
|
|
823
|
+
subtitle?: string | undefined;
|
|
820
824
|
state?: "new" | "ingesting" | "submitted" | "storyboarding" | "deduplication" | "image-selection" | "designing" | "layouting" | "embellishing" | "polishing" | "ready" | "timeout" | "error" | "cancelled" | undefined;
|
|
821
825
|
guid?: string | undefined;
|
|
822
826
|
cancelled_at?: string | undefined;
|
|
@@ -834,6 +838,7 @@ declare const BookPropsSchema: z.ZodObject<{
|
|
|
834
838
|
text_sticker_level: "none" | "few" | "lots";
|
|
835
839
|
};
|
|
836
840
|
id?: string | undefined;
|
|
841
|
+
subtitle?: string | undefined;
|
|
837
842
|
state?: "new" | "ingesting" | "submitted" | "storyboarding" | "deduplication" | "image-selection" | "designing" | "layouting" | "embellishing" | "polishing" | "ready" | "timeout" | "error" | "cancelled" | undefined;
|
|
838
843
|
guid?: string | undefined;
|
|
839
844
|
cancelled_at?: string | undefined;
|
|
@@ -842,6 +847,7 @@ type BookProps = z.infer<typeof BookPropsSchema>;
|
|
|
842
847
|
declare class Book {
|
|
843
848
|
id: string;
|
|
844
849
|
title: string;
|
|
850
|
+
subtitle?: string;
|
|
845
851
|
design_request: BookDesignRequest;
|
|
846
852
|
state?: State;
|
|
847
853
|
guid?: string;
|
|
@@ -3380,4 +3386,4 @@ declare const bookCreationRequestSchema: z.ZodObject<{
|
|
|
3380
3386
|
}>;
|
|
3381
3387
|
type BookCreationRequest = z.infer<typeof bookCreationRequestSchema>;
|
|
3382
3388
|
|
|
3383
|
-
export { Asset, BookCreationRequest, 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, bookSizes,
|
|
3389
|
+
export { Asset, BookCreationRequest, 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, 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 };
|
package/index.js
CHANGED
|
@@ -209,13 +209,13 @@ var imageDensities = ["low", "medium", "high"];
|
|
|
209
209
|
var imageFilteringLevels = ["best", "most", "all"];
|
|
210
210
|
var embellishmentLevels = ["none", "few", "lots"];
|
|
211
211
|
var textStickerLevels = ["none", "few", "lots"];
|
|
212
|
-
var
|
|
212
|
+
var timeoutEventDetail = {
|
|
213
213
|
state: "timeout",
|
|
214
214
|
slug: "timeout",
|
|
215
215
|
progress: 100,
|
|
216
216
|
message: "Design timed out"
|
|
217
217
|
};
|
|
218
|
-
var
|
|
218
|
+
var cancelledEventDetail = {
|
|
219
219
|
state: "cancelled",
|
|
220
220
|
slug: "cancelled",
|
|
221
221
|
progress: 100,
|
|
@@ -4013,6 +4013,7 @@ var bookDesignRequestSchema = z.object({
|
|
|
4013
4013
|
var BookPropsSchema = z.object({
|
|
4014
4014
|
id: z.string().optional(),
|
|
4015
4015
|
title: z.string(),
|
|
4016
|
+
subtitle: z.string().optional(),
|
|
4016
4017
|
design_request: bookDesignRequestSchema,
|
|
4017
4018
|
state: z.enum(states).optional(),
|
|
4018
4019
|
guid: z.string().optional(),
|
|
@@ -4021,6 +4022,7 @@ var BookPropsSchema = z.object({
|
|
|
4021
4022
|
var Book = class {
|
|
4022
4023
|
id;
|
|
4023
4024
|
title;
|
|
4025
|
+
subtitle;
|
|
4024
4026
|
design_request;
|
|
4025
4027
|
state;
|
|
4026
4028
|
guid;
|
|
@@ -4028,6 +4030,7 @@ var Book = class {
|
|
|
4028
4030
|
constructor(props) {
|
|
4029
4031
|
this.id = props.id || "";
|
|
4030
4032
|
this.title = props.title;
|
|
4033
|
+
this.subtitle = props.subtitle;
|
|
4031
4034
|
this.design_request = new BookDesignRequest(props.design_request);
|
|
4032
4035
|
this.state = props.state;
|
|
4033
4036
|
this.guid = props.guid;
|
|
@@ -4130,8 +4133,8 @@ var designOptionsServerSchema = z.object({
|
|
|
4130
4133
|
});
|
|
4131
4134
|
|
|
4132
4135
|
// ../../core/config.ts
|
|
4133
|
-
var defaultApiHost = "https://api.
|
|
4134
|
-
var defaultWebSocketHost = "wss://socket.
|
|
4136
|
+
var defaultApiHost = "https://api.sfly-sls.magicbook.io";
|
|
4137
|
+
var defaultWebSocketHost = "wss://socket.sfly-sls.magicbook.io";
|
|
4135
4138
|
var designRequestTimeout = parseInt("30000"?.toString() || "3000");
|
|
4136
4139
|
|
|
4137
4140
|
// ../../core/models/design-request/index.ts
|
|
@@ -4154,6 +4157,7 @@ var DesignRequest = class {
|
|
|
4154
4157
|
this.webSocket = new WebSocket(`${this.client.webSocketHost}/?book_id=${this.parentId}`);
|
|
4155
4158
|
this.state = designRequestProps?.state || states[0];
|
|
4156
4159
|
this.title = designRequestProps?.title || "";
|
|
4160
|
+
this.subtitle = designRequestProps?.subtitle;
|
|
4157
4161
|
this.occasion = designRequestProps?.occasion || occasions[0];
|
|
4158
4162
|
this.style = designRequestProps?.style || parseInt(Object.keys(styles)[0]);
|
|
4159
4163
|
this.bookSize = designRequestProps?.bookSize || bookSizes[0];
|
|
@@ -4166,10 +4170,10 @@ var DesignRequest = class {
|
|
|
4166
4170
|
this.images = new Images(this.client, this.parentId);
|
|
4167
4171
|
}
|
|
4168
4172
|
webSocket;
|
|
4169
|
-
// private events: DesignRequestEvent[]
|
|
4170
4173
|
state;
|
|
4171
4174
|
parentId;
|
|
4172
4175
|
title;
|
|
4176
|
+
subtitle;
|
|
4173
4177
|
occasion;
|
|
4174
4178
|
style;
|
|
4175
4179
|
bookSize;
|
|
@@ -4230,7 +4234,7 @@ var DesignRequest = class {
|
|
|
4230
4234
|
(await this.client.engineAPI.books.cancel(this.parentId)).toDesignRequestProps()
|
|
4231
4235
|
);
|
|
4232
4236
|
this.state = "cancelled";
|
|
4233
|
-
await this.eventHandler(
|
|
4237
|
+
await this.eventHandler(cancelledEventDetail);
|
|
4234
4238
|
return this;
|
|
4235
4239
|
}
|
|
4236
4240
|
}
|
|
@@ -4257,7 +4261,7 @@ var DesignRequest = class {
|
|
|
4257
4261
|
}
|
|
4258
4262
|
timeoutHandler() {
|
|
4259
4263
|
return setTimeout(async () => {
|
|
4260
|
-
await this.eventHandler(
|
|
4264
|
+
await this.eventHandler(timeoutEventDetail);
|
|
4261
4265
|
}, designRequestTimeout);
|
|
4262
4266
|
}
|
|
4263
4267
|
async getProgress() {
|
|
@@ -4284,6 +4288,7 @@ var DesignRequest = class {
|
|
|
4284
4288
|
id: designRequest.parentId,
|
|
4285
4289
|
guid: designRequest.guid,
|
|
4286
4290
|
title: designRequest.title,
|
|
4291
|
+
subtitle: designRequest.subtitle,
|
|
4287
4292
|
design_request: bookDesignRequest,
|
|
4288
4293
|
state: designRequest.state
|
|
4289
4294
|
});
|
|
@@ -4814,7 +4819,7 @@ export {
|
|
|
4814
4819
|
assetSchema,
|
|
4815
4820
|
bookCreationRequestSchema,
|
|
4816
4821
|
bookSizes,
|
|
4817
|
-
|
|
4822
|
+
cancelledEventDetail,
|
|
4818
4823
|
canvasSchema,
|
|
4819
4824
|
coverTypes,
|
|
4820
4825
|
designOptionsSchema,
|
|
@@ -4843,6 +4848,6 @@ export {
|
|
|
4843
4848
|
statesToReport,
|
|
4844
4849
|
styles,
|
|
4845
4850
|
textStickerLevels,
|
|
4846
|
-
|
|
4851
|
+
timeoutEventDetail
|
|
4847
4852
|
};
|
|
4848
4853
|
//# sourceMappingURL=index.js.map
|