@colijnit/configurator 262.1.8 → 262.1.9

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.
@@ -5,6 +5,7 @@ import { CommonModule, AsyncPipe } from '@angular/common';
5
5
  import { BehaviorSubject, Subject, combineLatest, debounceTime } from 'rxjs';
6
6
  import * as THREE from 'three';
7
7
  import { Color, WebGLRenderer, Box3, Vector3, Scene, PerspectiveCamera, MathUtils, AmbientLight, DirectionalLight, Group, Euler, Object3D, EventDispatcher, MeshBasicMaterial, Mesh, PlaneGeometry, DoubleSide, MeshStandardMaterial, CylinderGeometry, RingGeometry, Matrix4, Raycaster, BufferGeometry, Line, DataTexture, RGFormat, UnsignedByteType, LinearFilter, Shape, Vector2, SphereGeometry, SRGBColorSpace, PCFSoftShadowMap, ShadowMaterial, LightProbe, Texture as Texture$1, MeshPhongMaterial, NoToneMapping, TextureLoader, RGBAFormat, Quaternion, PointLight, BoxGeometry, BackSide, FrontSide, ShapeGeometry } from 'three';
8
+ import { Options } from '@colijnit/ioneconnector/build/model/options';
8
9
  import { HdecoPlacement } from '@colijnit/configuratorapi/build/enum/hdeco-placement.enum';
9
10
  import * as i6 from '@colijnit/utilities';
10
11
  import { ObjectUtils, MaterialUtils, DeviceUtils as DeviceUtils$1, DeviceTier as DeviceTier$1, TranslationModule, UtilitiesPipesModule } from '@colijnit/utilities';
@@ -18,7 +19,6 @@ import { BusinessObjectFactory } from '@colijnit/ioneconnector/build/service/bus
18
19
  import { Configurator } from '@colijnit/configuratorapi';
19
20
  import { NodeType } from '@colijnit/configuratorapi/build/enum/node-type.enum';
20
21
  import { Articles } from '@colijnit/articleapi/build/articles';
21
- import { Options } from '@colijnit/ioneconnector/build/model/options';
22
22
  import { Article } from '@colijnit/configuratorapi/build/model/article';
23
23
  import { Selection } from '@colijnit/configuratorapi/build/model/selection';
24
24
  import { SelectorWithOptions } from '@colijnit/configuratorapi/build/model/selector-with-options';
@@ -159,20 +159,10 @@ class SceneSettings {
159
159
  scenes;
160
160
  }
161
161
 
162
- class ConfiguratorSettings {
163
- url;
164
- schema;
165
- version;
166
- branch;
162
+ class ConfiguratorSettings extends Options {
167
163
  currency;
168
164
  currencySymbol = '€';
169
- username;
170
- password;
171
165
  session = undefined;
172
- useGroups = true;
173
- useRenders = false;
174
- useLoginEncryption = true;
175
- logoutWhenRefresh = true;
176
166
  useMatch = false;
177
167
  assetPath;
178
168
  threeDAssetPath;
@@ -181,10 +171,7 @@ class ConfiguratorSettings {
181
171
  additionalTranslationFile;
182
172
  apiUrl;
183
173
  client;
184
- timeoutInMs;
185
- languageCode;
186
174
  secondaryLogo;
187
- jwtEnabled;
188
175
  gtm;
189
176
  dracoPath = 'https?://cdn1.colijn-it.nl/draco/';
190
177
  mainUrl;
@@ -262,6 +249,12 @@ class ConfiguratorSettingsService {
262
249
  const ownOptions = Object.assign({}, this.settings.options);
263
250
  const ownRenderParameters = Object.assign({}, this.settings.renderParameters);
264
251
  const blenderSceneSettings = Object.assign({}, this.settings.blenderSceneSettings);
252
+ if (this.settings.url !== obj.url) { // other backend, clear some stuff
253
+ this.settings.password = undefined;
254
+ this.settings.dataSessionId = undefined;
255
+ this.settings.sessionId = undefined;
256
+ this.settings.getAccessTokenFunction = undefined;
257
+ }
265
258
  this.settings = Object.assign({}, this.settings, obj);
266
259
  if (obj.renderParameters) {
267
260
  this.settings.renderParameters = Object.assign({}, ownRenderParameters, obj.renderParameters);
@@ -561,6 +554,19 @@ class RotationHelper {
561
554
  }
562
555
  }
563
556
 
557
+ class ConfiguratorErrorMessage {
558
+ message;
559
+ safeMessage;
560
+ description;
561
+ safeDescription;
562
+ constructor(message, description) {
563
+ this.message = message;
564
+ if (description) {
565
+ this.description = description;
566
+ }
567
+ }
568
+ }
569
+
564
570
  class ConfiguratorService {
565
571
  showLoader = new Subject();
566
572
  connectionReset = new Subject();
@@ -766,19 +772,6 @@ function notNill(questionPublicationCode) {
766
772
  throw new Error('Function not implemented.');
767
773
  }
768
774
 
769
- class ConfiguratorErrorMessage {
770
- message;
771
- safeMessage;
772
- description;
773
- safeDescription;
774
- constructor(message, description) {
775
- this.message = message;
776
- if (description) {
777
- this.description = description;
778
- }
779
- }
780
- }
781
-
782
775
  class ConfiguratorConnectorService {
783
776
  _appEventService;
784
777
  _settingsService;
@@ -1793,7 +1786,7 @@ class ThreedselectorService {
1793
1786
  c.children = connectors.concat(meshes);
1794
1787
  });
1795
1788
  return resolve(object);
1796
- });
1789
+ }).catch((e) => reject(e));
1797
1790
  }
1798
1791
  catch (e) {
1799
1792
  reject(e);
@@ -1808,6 +1801,10 @@ class ThreedselectorService {
1808
1801
  resolve(obj);
1809
1802
  }).catch(async (e) => {
1810
1803
  DebugUtils.log('downloadAssetsAndReturn: ' + e);
1804
+ // GLB failed, fall back to the legacy JSON model format. The XMLHttpRequest
1805
+ // handlers above settle the promise: onloadend parses the response, onerror rejects.
1806
+ oReq.open('GET', FileUtils.FixUrl(assetPath.replace('.glb.gz', '').replace('.glb', '')), true);
1807
+ oReq.send(null);
1811
1808
  });
1812
1809
  });
1813
1810
  }
@@ -3288,7 +3285,7 @@ class LoadFurnitureBaseService {
3288
3285
  return obj;
3289
3286
  }, err => {
3290
3287
  DebugUtils.log('Error: ' + err);
3291
- return err;
3288
+ return Promise.reject(new ConfiguratorErrorMessage('THREED_MODEL_NOT_FOUND', String(err)));
3292
3289
  });
3293
3290
  // }
3294
3291
  }
@@ -3329,7 +3326,7 @@ class LoadFurnitureBaseService {
3329
3326
  return Promise.reject(configurationResultObject);
3330
3327
  }
3331
3328
  });
3332
- if (obj === null) {
3329
+ if (!obj) { // no model url, or the download failed and onlyThreeD is off
3333
3330
  if (this.settingsService.settings.options.onlyThreeD && this.needs3DModel(configurationResultObject.placement)) {
3334
3331
  configurationResultObject.resultType = ResultType.No3DModel;
3335
3332
  return Promise.reject(configurationResultObject);