@smarterplan/ngx-smarterplan-core 1.2.14 → 1.2.16

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.
@@ -1854,22 +1854,24 @@ class PoiService {
1854
1854
  }
1855
1855
  async createPOIForSpaceID(poi) {
1856
1856
  removeNullKeysFromObject(poi);
1857
- this.awsKinesisAnalytics.getInstance().record(
1858
- // @ts-ignore
1859
- {
1860
- data: {
1861
- eventType: 'Object Creation',
1862
- objectType: 'poi',
1863
- poi: poi,
1864
- user: this.userService.cu,
1865
- timestamp: new Date(),
1866
- floorId: this.selectedFloor?.id,
1867
- locationId: this.currentSpaceID,
1868
- zoneId: this.zoneIDFilter,
1869
- },
1870
- streamName: 'smarterplanKinesis-analytics',
1871
- // partitionKey: "",
1872
- }, 'AWSKinesis');
1857
+ if (!!this.awsKinesisAnalytics) {
1858
+ this.awsKinesisAnalytics.getInstance().record(
1859
+ // @ts-ignore
1860
+ {
1861
+ data: {
1862
+ eventType: 'Object Creation',
1863
+ objectType: 'poi',
1864
+ poi: poi,
1865
+ user: this.userService.cu,
1866
+ timestamp: new Date(),
1867
+ floorId: this.selectedFloor?.id,
1868
+ locationId: this.currentSpaceID,
1869
+ zoneId: this.zoneIDFilter,
1870
+ },
1871
+ streamName: 'smarterplanKinesis-analytics',
1872
+ // partitionKey: "",
1873
+ }, 'AWSKinesis');
1874
+ }
1873
1875
  return this.API.__proto__.CreatePOI(poi);
1874
1876
  }
1875
1877
  poiIsVirtual(poi) {
@@ -2807,79 +2809,80 @@ class MatterportService {
2807
2809
  // renderer.shadowMap.type = three.PCFSoftShadowMap;
2808
2810
  // });
2809
2811
  // Wait until Showcase is actually playing....
2810
- this.sdk.Tag.data.subscribe({
2811
- onAdded: async function (index, item, collection) {
2812
- let thisOpacity = 0.2;
2813
- this.sdk.Tag.editOpacity(index, thisOpacity);
2814
- let source = null;
2815
- try {
2816
- source = await Promise.all([
2817
- this.sdk.Sensor.createSource(this.sdk.Sensor.SourceType.SPHERE, {
2818
- origin: item.anchorPosition,
2819
- radius: Number(3),
2820
- userData: {
2821
- id: index + '-sphere-source',
2822
- },
2823
- })
2824
- ]);
2825
- }
2826
- catch (e) {
2827
- console.log('could not create Sphere sensor');
2828
- console.error(e);
2829
- }
2830
- if (!source) {
2831
- return;
2832
- }
2833
- let sensor = null;
2834
- try {
2835
- sensor = await this.sdk.Sensor.createSensor(this.sdk.Sensor.SensorType.CAMERA);
2836
- }
2837
- catch (e) {
2838
- console.log('could not create Camera sensor');
2839
- console.error(e);
2840
- }
2841
- if (!sensor) {
2842
- return;
2843
- }
2844
- sensor.addSource(...source);
2845
- sensor.readings.subscribe({
2846
- onUpdated(source, reading) {
2847
- console.log(thisOpacity);
2848
- let oldOpacity = thisOpacity;
2849
- if (reading.inRange) {
2850
- thisOpacity = 1;
2851
- console.log(index + ' is inRange');
2852
- }
2853
- else if (reading.inView) {
2854
- console.log(index + ' is inView but not inRange');
2855
- thisOpacity = 0.5;
2856
- }
2857
- else {
2858
- thisOpacity = 0.2;
2859
- console.log(index + ' is not inView or inRange');
2860
- }
2861
- this.sdk.Tag.editOpacity(index, thisOpacity);
2862
- /*
2863
- let inc = 0.01;
2864
- if (oldOpacity > thisOpacity) {
2865
- inc = -0.01;
2866
- }
2867
-
2868
- for(var i = oldOpacity; i != thisOpacity; i=i+inc) {
2869
- setTimeout(function() {
2870
- mpSdk.Tag.editOpacity(index, i);
2871
- console.log('Delay', i);
2872
- },10);
2873
- }
2874
- */
2875
- }
2876
- });
2877
- //sensor.showDebug(true);
2878
- }.bind(this),
2879
- onCollectionUpdated: function (collection) {
2880
- console.log('Collection received. There are ', Object.keys(collection).length, ' Tags in the collection', collection);
2881
- }
2882
- });
2812
+ // this.sdk.Tag.data.subscribe({
2813
+ // onAdded: async function (index, item, collection) {
2814
+ //
2815
+ // let thisOpacity = 0.2;
2816
+ // this.sdk.Tag.editOpacity(index, thisOpacity);
2817
+ //
2818
+ // let source = null;
2819
+ // try {
2820
+ // source = await Promise.all([
2821
+ // this.sdk.Sensor.createSource(this.sdk.Sensor.SourceType.SPHERE, {
2822
+ // origin: item.anchorPosition,
2823
+ // radius: Number(3),
2824
+ // userData: {
2825
+ // id: index + '-sphere-source',
2826
+ // },
2827
+ // })
2828
+ // ]);
2829
+ // } catch (e) {
2830
+ // console.log('could not create Sphere sensor')
2831
+ // console.error(e);
2832
+ // }
2833
+ // if (!source) {
2834
+ // return;
2835
+ // }
2836
+ //
2837
+ // let sensor = null;
2838
+ // try {
2839
+ // sensor = await this.sdk.Sensor.createSensor(this.sdk.Sensor.SensorType.CAMERA);
2840
+ // } catch (e) {
2841
+ // console.log('could not create Camera sensor')
2842
+ // console.error(e);
2843
+ // }
2844
+ // if (!sensor) {
2845
+ // return;
2846
+ // }
2847
+ //
2848
+ // sensor.addSource(...source);
2849
+ // sensor.readings.subscribe({
2850
+ // onUpdated(source, reading) {
2851
+ // console.log(thisOpacity);
2852
+ // let oldOpacity = thisOpacity;
2853
+ // if (reading.inRange) {
2854
+ // thisOpacity = 1;
2855
+ // console.log(index + ' is inRange');
2856
+ // } else if (reading.inView) {
2857
+ // console.log(index + ' is inView but not inRange');
2858
+ // thisOpacity = 0.5;
2859
+ // } else {
2860
+ // thisOpacity = 0.2;
2861
+ // console.log(index + ' is not inView or inRange');
2862
+ // }
2863
+ //
2864
+ // this.sdk.Tag.editOpacity(index, thisOpacity);
2865
+ // /*
2866
+ // let inc = 0.01;
2867
+ // if (oldOpacity > thisOpacity) {
2868
+ // inc = -0.01;
2869
+ // }
2870
+ //
2871
+ // for(var i = oldOpacity; i != thisOpacity; i=i+inc) {
2872
+ // setTimeout(function() {
2873
+ // mpSdk.Tag.editOpacity(index, i);
2874
+ // console.log('Delay', i);
2875
+ // },10);
2876
+ // }
2877
+ // */
2878
+ // }
2879
+ // });
2880
+ // //sensor.showDebug(true);
2881
+ // }.bind(this),
2882
+ // onCollectionUpdated: function (collection) {
2883
+ // console.log('Collection received. There are ', Object.keys(collection).length, ' Tags in the collection', collection);
2884
+ // }
2885
+ // });
2883
2886
  resolve(true);
2884
2887
  }.bind(this));
2885
2888
  });
@@ -6745,24 +6748,26 @@ class TicketsService extends BaseObjectService {
6745
6748
  event.ownerID = event.ownerID ? event.ownerID : currentMission.id;
6746
6749
  try {
6747
6750
  const receivedEvent = await this.eventService.createEvent(event);
6748
- this.awsKinesisAnalytics.getInstance().record(
6749
- // @ts-ignore
6750
- {
6751
- data: {
6752
- eventType: 'Ticket Change',
6753
- ticketId: event.ticketID,
6754
- ticket: ticket,
6755
- status: event.status,
6756
- event: event,
6757
- user: this.userService.cu,
6758
- locationId: this.currentSpaceID,
6759
- timestamp: new Date(),
6760
- zoneId: this.zoneIDFilter,
6761
- floorId: this.selectedFloor?.id,
6762
- },
6763
- streamName: 'smarterplanKinesis-analytics',
6764
- // partitionKey: "",
6765
- }, 'AWSKinesis');
6751
+ if (!!this.awsKinesisAnalytics) {
6752
+ this.awsKinesisAnalytics.getInstance().record(
6753
+ // @ts-ignore
6754
+ {
6755
+ data: {
6756
+ eventType: 'Ticket Change',
6757
+ ticketId: event.ticketID,
6758
+ ticket: ticket,
6759
+ status: event.status,
6760
+ event: event,
6761
+ user: this.userService.cu,
6762
+ locationId: this.currentSpaceID,
6763
+ timestamp: new Date(),
6764
+ zoneId: this.zoneIDFilter,
6765
+ floorId: this.selectedFloor?.id,
6766
+ },
6767
+ streamName: 'smarterplanKinesis-analytics',
6768
+ // partitionKey: "",
6769
+ }, 'AWSKinesis');
6770
+ }
6766
6771
  // console.log('Event successfully created !');
6767
6772
  return receivedEvent;
6768
6773
  }
@@ -6867,23 +6872,25 @@ class TicketsService extends BaseObjectService {
6867
6872
  return this.API.__proto__.GetTicket(id);
6868
6873
  }
6869
6874
  async createTicket(input) {
6870
- this.awsKinesisAnalytics.getInstance().record(
6871
- // @ts-ignore
6872
- {
6873
- data: {
6874
- eventType: 'Object Creation',
6875
- objectType: 'ticket',
6876
- //zoneId: input.spaceID, // TODO: check if spaceId == zoneId
6877
- domain: input.domain,
6878
- user: this.userService.cu,
6879
- locationId: this.currentSpaceID,
6880
- timestamp: new Date(),
6881
- zoneId: this.zoneIDFilter,
6882
- floorId: this.selectedFloor?.id,
6883
- },
6884
- streamName: 'smarterplanKinesis-analytics',
6885
- // partitionKey: "",
6886
- }, 'AWSKinesis');
6875
+ if (!!this.awsKinesisAnalytics) {
6876
+ this.awsKinesisAnalytics.getInstance().record(
6877
+ // @ts-ignore
6878
+ {
6879
+ data: {
6880
+ eventType: 'Object Creation',
6881
+ objectType: 'ticket',
6882
+ //zoneId: input.spaceID, // TODO: check if spaceId == zoneId
6883
+ domain: input.domain,
6884
+ user: this.userService.cu,
6885
+ locationId: this.currentSpaceID,
6886
+ timestamp: new Date(),
6887
+ zoneId: this.zoneIDFilter,
6888
+ floorId: this.selectedFloor?.id,
6889
+ },
6890
+ streamName: 'smarterplanKinesis-analytics',
6891
+ // partitionKey: "",
6892
+ }, 'AWSKinesis');
6893
+ }
6887
6894
  return this.API.__proto__.CreateTicket(input);
6888
6895
  }
6889
6896
  async updateTicket(input) {
@@ -7119,22 +7126,24 @@ class EquipmentService extends BaseObjectService {
7119
7126
  }
7120
7127
  async createEquipment(equip, imageFile, documentFile) {
7121
7128
  removeNullKeysFromObject(equip);
7122
- this.awsKinesisAnalytics.getInstance().record(
7123
- // @ts-ignore
7124
- {
7125
- data: {
7126
- eventType: 'Object Creation',
7127
- objectType: 'equipment',
7128
- poi: equip,
7129
- user: this.userService.cu,
7130
- locationId: this.currentSpaceID,
7131
- timestamp: new Date(),
7132
- zoneId: this.currentZone.id,
7133
- floorId: this.selectedFloor?.id,
7134
- },
7135
- streamName: 'smarterplanKinesis-analytics',
7136
- // partitionKey: "",
7137
- }, 'AWSKinesis');
7129
+ if (!!this.awsKinesisAnalytics) {
7130
+ this.awsKinesisAnalytics.getInstance().record(
7131
+ // @ts-ignore
7132
+ {
7133
+ data: {
7134
+ eventType: 'Object Creation',
7135
+ objectType: 'equipment',
7136
+ poi: equip,
7137
+ user: this.userService.cu,
7138
+ locationId: this.currentSpaceID,
7139
+ timestamp: new Date(),
7140
+ zoneId: this.currentZone.id,
7141
+ floorId: this.selectedFloor?.id,
7142
+ },
7143
+ streamName: 'smarterplanKinesis-analytics',
7144
+ // partitionKey: "",
7145
+ }, 'AWSKinesis');
7146
+ }
7138
7147
  return this.API.CreateEquipment(equip).then(async (receivedEquipment) => {
7139
7148
  let equipment = receivedEquipment;
7140
7149
  if (equipment) {
@@ -10412,23 +10421,25 @@ class MeasurementService {
10412
10421
  comment,
10413
10422
  poi,
10414
10423
  };
10415
- this.awsKinesisAnalytics.getInstance().record(
10416
- // @ts-ignore
10417
- {
10418
- data: {
10419
- eventType: 'Object Creation',
10420
- objectType: 'measurement',
10421
- measurement: measurement,
10422
- //zoneId: spaceID,
10423
- user: this.userService.cu,
10424
- locationId: this.currentSpaceID,
10425
- timestamp: new Date(),
10426
- zoneId: this.zoneIDFilter,
10427
- floorId: this.selectedFloor?.id,
10428
- },
10429
- streamName: 'smarterplanKinesis-analytics',
10430
- // partitionKey: "",
10431
- }, 'AWSKinesis');
10424
+ if (!!this.awsKinesisAnalytics) {
10425
+ this.awsKinesisAnalytics.getInstance().record(
10426
+ // @ts-ignore
10427
+ {
10428
+ data: {
10429
+ eventType: 'Object Creation',
10430
+ objectType: 'measurement',
10431
+ measurement: measurement,
10432
+ //zoneId: spaceID,
10433
+ user: this.userService.cu,
10434
+ locationId: this.currentSpaceID,
10435
+ timestamp: new Date(),
10436
+ zoneId: this.zoneIDFilter,
10437
+ floorId: this.selectedFloor?.id,
10438
+ },
10439
+ streamName: 'smarterplanKinesis-analytics',
10440
+ // partitionKey: "",
10441
+ }, 'AWSKinesis');
10442
+ }
10432
10443
  return measurement;
10433
10444
  }
10434
10445
  async getModel3DForMeasurement(measurement) {
@@ -10927,23 +10938,25 @@ class NavigationBarComponent {
10927
10938
  }
10928
10939
  }
10929
10940
  async sendKinesisAnalyticsEventForZone(zoneId, zoneName) {
10930
- this.awsKinesisAnalytics.getInstance().record(
10931
- // @ts-ignore
10932
- {
10933
- data: {
10934
- eventType: 'Zone Change',
10935
- zoneId: zoneId,
10936
- zoneName: zoneName,
10937
- locationId: this.selectedLocation?.id,
10938
- locationName: this.selectedLocation?.name,
10939
- user: this.userService?.cu,
10940
- timestamp: new Date(),
10941
- floorId: this.selectedFloor?.id,
10942
- childZoneId: this.selectedChildZone?.id,
10943
- },
10944
- streamName: 'smarterplanKinesis-analytics',
10945
- // partitionKey: "",
10946
- }, 'AWSKinesis');
10941
+ if (!!this.awsKinesisAnalytics) {
10942
+ this.awsKinesisAnalytics.getInstance().record(
10943
+ // @ts-ignore
10944
+ {
10945
+ data: {
10946
+ eventType: 'Zone Change',
10947
+ zoneId: zoneId,
10948
+ zoneName: zoneName,
10949
+ locationId: this.selectedLocation?.id,
10950
+ locationName: this.selectedLocation?.name,
10951
+ user: this.userService?.cu,
10952
+ timestamp: new Date(),
10953
+ floorId: this.selectedFloor?.id,
10954
+ childZoneId: this.selectedChildZone?.id,
10955
+ },
10956
+ streamName: 'smarterplanKinesis-analytics',
10957
+ // partitionKey: "",
10958
+ }, 'AWSKinesis');
10959
+ }
10947
10960
  }
10948
10961
  async onVisitClick(event) {
10949
10962
  this.clearData(false);
@@ -11378,7 +11391,7 @@ class MatterportImportService {
11378
11391
  this.importingImages = new Subject();
11379
11392
  this.sweepProcessedCount = new Subject();
11380
11393
  this.totalSweepsCount = new Subject();
11381
- this.MAX_SCANS_RELOAD = 500;
11394
+ this.MAX_SCANS_RELOAD = 10;
11382
11395
  }
11383
11396
  get spaceID() {
11384
11397
  return this._spaceID;
@@ -11559,7 +11572,6 @@ class MatterportImportService {
11559
11572
  nmbScans < this.MAX_SCANS_RELOAD
11560
11573
  ? (maxScan = nmbScans)
11561
11574
  : (maxScan = this.MAX_SCANS_RELOAD);
11562
- maxScan;
11563
11575
  }
11564
11576
  for (let index = indexScan; index < maxScan; index += 1) {
11565
11577
  if (!this.stop) {