@colijnit/configurator 262.1.7 → 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;
@@ -833,6 +826,12 @@ class ConfiguratorConnectorService {
833
826
  get shouldShowLoader() {
834
827
  return this._shouldShowLoader;
835
828
  }
829
+ set instanceId(instanceId) {
830
+ this._instanceId = instanceId;
831
+ }
832
+ get instanceId() {
833
+ return this._instanceId;
834
+ }
836
835
  controllerInitialized = new BehaviorSubject(false);
837
836
  standAloneInstance = new BehaviorSubject(false);
838
837
  connectionReset = new Subject();
@@ -858,6 +857,7 @@ class ConfiguratorConnectorService {
858
857
  _initialized = false;
859
858
  _boFactory = new BusinessObjectFactory();
860
859
  _configuratorService;
860
+ _instanceId;
861
861
  constructor(_appEventService, _settingsService, _loaderService, _utilitiesConnectorService) {
862
862
  this._appEventService = _appEventService;
863
863
  this._settingsService = _settingsService;
@@ -1187,8 +1187,10 @@ class ConfiguratorConnectorService {
1187
1187
  console.error('error saving configurations');
1188
1188
  }
1189
1189
  }
1190
- async storePreset(instanceId, showLoader = true) {
1191
- return this._configuratorService.storePreset(instanceId, showLoader);
1190
+ async storePreset(showLoader = true) {
1191
+ if (this.instanceId) {
1192
+ return this._configuratorService.storePreset(this.instanceId, showLoader);
1193
+ }
1192
1194
  }
1193
1195
  async initForPreset(presetId, goodId, showLoader = true) {
1194
1196
  return this._configuratorService.initForPreset(presetId, goodId, showLoader);
@@ -1364,6 +1366,7 @@ class ConfiguratorConnectorService {
1364
1366
  _handleInstanceResponse(response) {
1365
1367
  if (response && response.validationResult && response.validationResult.success) {
1366
1368
  this._appEventService.instanceSet.next(response.resultObject);
1369
+ this.instanceId = response.resultObject;
1367
1370
  }
1368
1371
  return response;
1369
1372
  }
@@ -1783,7 +1786,7 @@ class ThreedselectorService {
1783
1786
  c.children = connectors.concat(meshes);
1784
1787
  });
1785
1788
  return resolve(object);
1786
- });
1789
+ }).catch((e) => reject(e));
1787
1790
  }
1788
1791
  catch (e) {
1789
1792
  reject(e);
@@ -1798,6 +1801,10 @@ class ThreedselectorService {
1798
1801
  resolve(obj);
1799
1802
  }).catch(async (e) => {
1800
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);
1801
1808
  });
1802
1809
  });
1803
1810
  }
@@ -3278,7 +3285,7 @@ class LoadFurnitureBaseService {
3278
3285
  return obj;
3279
3286
  }, err => {
3280
3287
  DebugUtils.log('Error: ' + err);
3281
- return err;
3288
+ return Promise.reject(new ConfiguratorErrorMessage('THREED_MODEL_NOT_FOUND', String(err)));
3282
3289
  });
3283
3290
  // }
3284
3291
  }
@@ -3319,7 +3326,7 @@ class LoadFurnitureBaseService {
3319
3326
  return Promise.reject(configurationResultObject);
3320
3327
  }
3321
3328
  });
3322
- if (obj === null) {
3329
+ if (!obj) { // no model url, or the download failed and onlyThreeD is off
3323
3330
  if (this.settingsService.settings.options.onlyThreeD && this.needs3DModel(configurationResultObject.placement)) {
3324
3331
  configurationResultObject.resultType = ResultType.No3DModel;
3325
3332
  return Promise.reject(configurationResultObject);
@@ -9631,7 +9638,7 @@ class ConfigurationPresetDialogComponent {
9631
9638
  handleOpenDialog(mode) {
9632
9639
  if (mode === PresetDialogMode.SAVE) {
9633
9640
  const instanceId = this._instanceId;
9634
- this._configuratorConnectorService.storePreset(instanceId).then((response) => {
9641
+ this._configuratorConnectorService.storePreset().then((response) => {
9635
9642
  if (response && response.validationResult && response.validationResult.success) {
9636
9643
  this.instanceIdInput = response.resultObject;
9637
9644
  this.dialogMode = mode;