3dviewer-sdk 1.0.14 → 1.0.15

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/index.d.mts CHANGED
@@ -270,6 +270,7 @@ declare class NodeModule {
270
270
 
271
271
  type FilesConfig = {
272
272
  baseUrl?: string;
273
+ conversionUrl?: string;
273
274
  viewerPath?: string;
274
275
  uploadPath?: string;
275
276
  };
@@ -358,7 +359,7 @@ declare class FilesModule {
358
359
  render(file?: File, options?: ConvertOptions): Promise<PreparedViewerData>;
359
360
  private resolveFile;
360
361
  private normalizeBaseUrl;
361
- private resolveBaseUrl;
362
+ private resolveConversionUrl;
362
363
  private resolveViewerPath;
363
364
  private normalizeSdkViewerPath;
364
365
  private resolveViewerOrigin;
@@ -524,6 +525,7 @@ type Viewer3DOptions = {
524
525
  container: HTMLElement | string;
525
526
  url?: string;
526
527
  baseUrl?: string;
528
+ conversionUrl?: string;
527
529
  viewerPath?: string;
528
530
  uploadPath?: string;
529
531
  file?: File;
package/dist/index.d.ts CHANGED
@@ -270,6 +270,7 @@ declare class NodeModule {
270
270
 
271
271
  type FilesConfig = {
272
272
  baseUrl?: string;
273
+ conversionUrl?: string;
273
274
  viewerPath?: string;
274
275
  uploadPath?: string;
275
276
  };
@@ -358,7 +359,7 @@ declare class FilesModule {
358
359
  render(file?: File, options?: ConvertOptions): Promise<PreparedViewerData>;
359
360
  private resolveFile;
360
361
  private normalizeBaseUrl;
361
- private resolveBaseUrl;
362
+ private resolveConversionUrl;
362
363
  private resolveViewerPath;
363
364
  private normalizeSdkViewerPath;
364
365
  private resolveViewerOrigin;
@@ -524,6 +525,7 @@ type Viewer3DOptions = {
524
525
  container: HTMLElement | string;
525
526
  url?: string;
526
527
  baseUrl?: string;
528
+ conversionUrl?: string;
527
529
  viewerPath?: string;
528
530
  uploadPath?: string;
529
531
  file?: File;
package/dist/index.js CHANGED
@@ -145,8 +145,8 @@ var NodeModule = class {
145
145
  };
146
146
 
147
147
  // src/modules/files.module.ts
148
- var DEFAULT_API_BASE_URL = "https://dev.3dviewer.anybim.vn/service/conversion";
149
- var DEFAULT_VIEWER_ORIGIN = "http://localhost:3000";
148
+ var DEFAULT_CONVERSION_URL = "https://dev.3dviewer.anybim.vn/service/conversion";
149
+ var DEFAULT_VIEWER_BASE_URL = "https://dev.3dviewer.anybim.vn";
150
150
  var SDK_VIEWER_PATH = "/mainviewer-sdk";
151
151
  var LEGACY_VIEWER_PATH = "/mainviewer";
152
152
  var FilesModule = class {
@@ -293,9 +293,9 @@ var FilesModule = class {
293
293
  normalizeBaseUrl(input) {
294
294
  return input.trim().replace(/\/+$/, "");
295
295
  }
296
- // Resolve API base URL with default fallback.
297
- resolveBaseUrl() {
298
- const raw = this.config.baseUrl || this.viewer.getOptions().baseUrl || DEFAULT_API_BASE_URL;
296
+ // Resolve conversion API URL with default fallback.
297
+ resolveConversionUrl() {
298
+ const raw = this.config.conversionUrl || this.viewer.getOptions().conversionUrl || DEFAULT_CONVERSION_URL;
299
299
  return this.normalizeBaseUrl(raw);
300
300
  }
301
301
  // Resolve viewer route path for all SDK flows.
@@ -321,26 +321,26 @@ var FilesModule = class {
321
321
  }
322
322
  // Viewer host used to open iframe after conversion completes.
323
323
  resolveViewerOrigin() {
324
- const viewerUrl = this.viewer.getOptions().url;
325
- if (viewerUrl) {
324
+ const configuredViewerBaseUrl = this.config.baseUrl || this.viewer.getOptions().baseUrl;
325
+ if (configuredViewerBaseUrl) {
326
326
  try {
327
- return this.normalizeBaseUrl(new URL(viewerUrl, window.location.href).origin);
327
+ return this.normalizeBaseUrl(new URL(configuredViewerBaseUrl, window.location.href).origin);
328
328
  } catch {
329
329
  }
330
330
  }
331
- const configuredBaseUrl = this.config.baseUrl || this.viewer.getOptions().baseUrl;
332
- if (configuredBaseUrl) {
331
+ const viewerUrl = this.viewer.getOptions().url;
332
+ if (viewerUrl) {
333
333
  try {
334
- return this.normalizeBaseUrl(new URL(configuredBaseUrl, window.location.href).origin);
334
+ return this.normalizeBaseUrl(new URL(viewerUrl, window.location.href).origin);
335
335
  } catch {
336
336
  }
337
337
  }
338
- return this.normalizeBaseUrl(DEFAULT_VIEWER_ORIGIN);
338
+ return this.normalizeBaseUrl(DEFAULT_VIEWER_BASE_URL);
339
339
  }
340
- // Resolve conversion service root from configured API base URL.
340
+ // Resolve conversion service root from configured conversion URL.
341
341
  // Do not auto-append path segments (e.g. "/service/conversion").
342
342
  resolveHostConversion() {
343
- return this.resolveBaseUrl();
343
+ return this.resolveConversionUrl();
344
344
  }
345
345
  // Resolve upload path sent to conversion APIs.
346
346
  getUploadPath() {
package/dist/index.mjs CHANGED
@@ -119,8 +119,8 @@ var NodeModule = class {
119
119
  };
120
120
 
121
121
  // src/modules/files.module.ts
122
- var DEFAULT_API_BASE_URL = "https://dev.3dviewer.anybim.vn/service/conversion";
123
- var DEFAULT_VIEWER_ORIGIN = "http://localhost:3000";
122
+ var DEFAULT_CONVERSION_URL = "https://dev.3dviewer.anybim.vn/service/conversion";
123
+ var DEFAULT_VIEWER_BASE_URL = "https://dev.3dviewer.anybim.vn";
124
124
  var SDK_VIEWER_PATH = "/mainviewer-sdk";
125
125
  var LEGACY_VIEWER_PATH = "/mainviewer";
126
126
  var FilesModule = class {
@@ -267,9 +267,9 @@ var FilesModule = class {
267
267
  normalizeBaseUrl(input) {
268
268
  return input.trim().replace(/\/+$/, "");
269
269
  }
270
- // Resolve API base URL with default fallback.
271
- resolveBaseUrl() {
272
- const raw = this.config.baseUrl || this.viewer.getOptions().baseUrl || DEFAULT_API_BASE_URL;
270
+ // Resolve conversion API URL with default fallback.
271
+ resolveConversionUrl() {
272
+ const raw = this.config.conversionUrl || this.viewer.getOptions().conversionUrl || DEFAULT_CONVERSION_URL;
273
273
  return this.normalizeBaseUrl(raw);
274
274
  }
275
275
  // Resolve viewer route path for all SDK flows.
@@ -295,26 +295,26 @@ var FilesModule = class {
295
295
  }
296
296
  // Viewer host used to open iframe after conversion completes.
297
297
  resolveViewerOrigin() {
298
- const viewerUrl = this.viewer.getOptions().url;
299
- if (viewerUrl) {
298
+ const configuredViewerBaseUrl = this.config.baseUrl || this.viewer.getOptions().baseUrl;
299
+ if (configuredViewerBaseUrl) {
300
300
  try {
301
- return this.normalizeBaseUrl(new URL(viewerUrl, window.location.href).origin);
301
+ return this.normalizeBaseUrl(new URL(configuredViewerBaseUrl, window.location.href).origin);
302
302
  } catch {
303
303
  }
304
304
  }
305
- const configuredBaseUrl = this.config.baseUrl || this.viewer.getOptions().baseUrl;
306
- if (configuredBaseUrl) {
305
+ const viewerUrl = this.viewer.getOptions().url;
306
+ if (viewerUrl) {
307
307
  try {
308
- return this.normalizeBaseUrl(new URL(configuredBaseUrl, window.location.href).origin);
308
+ return this.normalizeBaseUrl(new URL(viewerUrl, window.location.href).origin);
309
309
  } catch {
310
310
  }
311
311
  }
312
- return this.normalizeBaseUrl(DEFAULT_VIEWER_ORIGIN);
312
+ return this.normalizeBaseUrl(DEFAULT_VIEWER_BASE_URL);
313
313
  }
314
- // Resolve conversion service root from configured API base URL.
314
+ // Resolve conversion service root from configured conversion URL.
315
315
  // Do not auto-append path segments (e.g. "/service/conversion").
316
316
  resolveHostConversion() {
317
- return this.resolveBaseUrl();
317
+ return this.resolveConversionUrl();
318
318
  }
319
319
  // Resolve upload path sent to conversion APIs.
320
320
  getUploadPath() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "3dviewer-sdk",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [