@magiclabs.ai/magicbook-client 0.7.16-canary → 0.7.18-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/index.cjs +5 -5
- package/index.cjs.map +1 -1
- package/index.iife.js +5 -5
- package/index.js +5 -5
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -95,7 +95,7 @@ var statesToCloseWS = [
|
|
|
95
95
|
];
|
|
96
96
|
var statesToReport = ["error", "timeout"];
|
|
97
97
|
var isDesignRequestSubmitted = (state) => !["new", "ingesting"].includes(state);
|
|
98
|
-
var canSubmitDesignRequest = (state) => ["new", "ingesting", "ready"].includes(state);
|
|
98
|
+
var canSubmitDesignRequest = (state) => ["new", "ingesting", "ready", "error"].includes(state);
|
|
99
99
|
var occasions = [
|
|
100
100
|
"baby",
|
|
101
101
|
"birthday",
|
|
@@ -5667,7 +5667,7 @@ var Images = class {
|
|
|
5667
5667
|
designRequestState;
|
|
5668
5668
|
async add(image) {
|
|
5669
5669
|
if (!canSubmitDesignRequest(this.designRequestState)) {
|
|
5670
|
-
throw new Error("You need to wait for the current design request to be
|
|
5670
|
+
throw new Error("You need to wait for the current design request to be completed before adding new images.");
|
|
5671
5671
|
} else {
|
|
5672
5672
|
const serverImage = await this.client.engineAPI.images.addToBook(this.parentId, new ImageServer(image));
|
|
5673
5673
|
const img = imageServerToImage(serverImage);
|
|
@@ -5680,7 +5680,7 @@ var Images = class {
|
|
|
5680
5680
|
}
|
|
5681
5681
|
async delete(imageId) {
|
|
5682
5682
|
if (!canSubmitDesignRequest(this.designRequestState)) {
|
|
5683
|
-
throw new Error("You need to wait for the current design request to be
|
|
5683
|
+
throw new Error("You need to wait for the current design request to be completed before deleting images.");
|
|
5684
5684
|
} else {
|
|
5685
5685
|
await this.client.engineAPI.images.delete(imageId, this.parentId);
|
|
5686
5686
|
this.list.splice(this.list.findIndex((image) => image.handle === imageId), 1);
|
|
@@ -5856,7 +5856,7 @@ var DesignRequest = class {
|
|
|
5856
5856
|
}
|
|
5857
5857
|
async submit(submitDesignRequestProps) {
|
|
5858
5858
|
if (!canSubmitDesignRequest(this.state)) {
|
|
5859
|
-
throw new Error("You need to wait for the current design request to be
|
|
5859
|
+
throw new Error("You need to wait for the current design request to be completed before submitting a new one.");
|
|
5860
5860
|
} else {
|
|
5861
5861
|
submitDesignRequestProps && this.updateDesignRequest(submitDesignRequestProps);
|
|
5862
5862
|
this.webSocket = new WebSocket(`${this.client.webSocketHost}/?book_id=${this.parentId}`);
|
|
@@ -5948,7 +5948,7 @@ var DesignRequest = class {
|
|
|
5948
5948
|
};
|
|
5949
5949
|
delete designRequest.client;
|
|
5950
5950
|
delete designRequest.webSocket;
|
|
5951
|
-
const styleSlug = styles[this.style].
|
|
5951
|
+
const styleSlug = styles[this.style]?.slug || this.style;
|
|
5952
5952
|
const bookDesignRequest = camelCaseObjectKeysToSnakeCase(cleanJSON(designRequest));
|
|
5953
5953
|
bookDesignRequest.style = styleSlug;
|
|
5954
5954
|
return new Book({
|