@innovastudio/contentbuilder 1.5.53 → 1.5.55

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbuilder",
3
3
  "type": "module",
4
- "version": "1.5.53",
4
+ "version": "1.5.55",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "types": "index.d.ts",
@@ -80729,12 +80729,14 @@ ${answer}
80729
80729
  };
80730
80730
  try {
80731
80731
  /*
80732
+ let headers = {
80733
+ ...this.builder.headers,
80734
+ ...this.builder.defaultHeaders
80735
+ };
80732
80736
  const response = await fetch(this.builder.sendCommandUrl, {
80733
80737
  signal: this.signal, // Abort
80734
80738
  method: 'POST',
80735
- headers: {
80736
- 'Content-Type': 'application/json',
80737
- },
80739
+ headers,
80738
80740
  body: JSON.stringify(messages),
80739
80741
  });
80740
80742
  const data = await response.json();
@@ -80744,13 +80746,15 @@ ${answer}
80744
80746
  if (this.builder.sendCommand) {
80745
80747
  data = await this.builder.sendCommand(messages);
80746
80748
  } else {
80749
+ let headers = {
80750
+ ...this.builder.headers,
80751
+ ...this.builder.defaultHeaders
80752
+ };
80747
80753
  const response = await fetch(this.builder.sendCommandUrl, {
80748
80754
  signal: this.signal,
80749
80755
  // Abort
80750
80756
  method: 'POST',
80751
- headers: {
80752
- 'Content-Type': 'application/json'
80753
- },
80757
+ headers,
80754
80758
  body: JSON.stringify(messages)
80755
80759
  });
80756
80760
  data = await response.json();
@@ -80814,11 +80818,13 @@ ${answer}
80814
80818
  if (this.builder.consoleLog) {
80815
80819
  if (!(error + '').includes('Failed to fetch')) {
80816
80820
  // Only if not CORS error
80821
+ let headers = {
80822
+ ...this.builder.headers,
80823
+ ...this.builder.defaultHeaders
80824
+ };
80817
80825
  const response = await fetch(this.builder.sendCommandUrl, {
80818
80826
  method: 'POST',
80819
- headers: {
80820
- 'Content-Type': 'application/json'
80821
- },
80827
+ headers,
80822
80828
  body: JSON.stringify(messages)
80823
80829
  });
80824
80830
  const data = await response.text();
@@ -86861,6 +86867,11 @@ class ContentBuilder {
86861
86867
  enableDragResize: true,
86862
86868
  simpleTextSettings: false,
86863
86869
  enableColumnsPerLine: true,
86870
+ // For fetch
86871
+ defaultHeaders: {
86872
+ 'Content-Type': 'application/json'
86873
+ },
86874
+ headers: {},
86864
86875
  /* Prompt/Command Stuff for AI Assistant */
86865
86876
  startAIAssistant: false,
86866
86877
  isContentBox: false,
@@ -91195,13 +91206,15 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
91195
91206
  image: image,
91196
91207
  folder_path: ''
91197
91208
  };
91209
+ let headers = {
91210
+ ...this.headers,
91211
+ ...this.defaultHeaders
91212
+ };
91198
91213
  const response = await fetch(this.upscaleImageUrl, {
91199
91214
  signal: this.signal,
91200
91215
  // Abort
91201
91216
  method: 'POST',
91202
- headers: {
91203
- 'Content-Type': 'application/json'
91204
- },
91217
+ headers,
91205
91218
  body: JSON.stringify(messages)
91206
91219
  });
91207
91220
  const result = await response.json();
@@ -91231,13 +91244,15 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
91231
91244
  };
91232
91245
  try {
91233
91246
  let url = this.textToImageUrl;
91247
+ let headers = {
91248
+ ...this.headers,
91249
+ ...this.defaultHeaders
91250
+ };
91234
91251
  const response = await fetch(url, {
91235
91252
  signal: this.signal,
91236
91253
  // Abort
91237
91254
  method: 'POST',
91238
- headers: {
91239
- 'Content-Type': 'application/json'
91240
- },
91255
+ headers,
91241
91256
  body: JSON.stringify(messages)
91242
91257
  });
91243
91258
  const result = await response.json();
@@ -91272,12 +91287,14 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
91272
91287
  this.signal = this.controller.signal; // Get a new signal object
91273
91288
  const messages = { prompt, num };
91274
91289
  try {
91275
- const response = await fetch(this.generateImageUrl, {
91290
+ let headers = {
91291
+ ...this.headers,
91292
+ ...this.defaultHeaders
91293
+ };
91294
+ const response = await fetch(this.generateImageUrl, {
91276
91295
  signal: this.signal, // Abort
91277
91296
  method: 'POST',
91278
- headers: {
91279
- 'Content-Type': 'application/json',
91280
- },
91297
+ headers,
91281
91298
  body: JSON.stringify(messages),
91282
91299
  });
91283
91300
 
@@ -91316,13 +91333,15 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
91316
91333
  let image = resizedBase64;
91317
91334
  image = image.replace(/^data:image\/(png|jpeg);base64,/, '');
91318
91335
 
91319
- const reqBody = { image: image, filename: filename };
91336
+ let headers = {
91337
+ ...this.headers,
91338
+ ...this.defaultHeaders
91339
+ };
91340
+ const reqBody = { image: image, filename: filename };
91320
91341
  fetch(this.uploadBase64Url, {
91321
91342
  method:'POST',
91322
91343
  body: JSON.stringify(reqBody),
91323
- headers: {
91324
- 'Content-Type': 'application/json',
91325
- }
91344
+ headers
91326
91345
  })
91327
91346
  .then(response=>response.json())
91328
91347
  .then(response=>{