architwin 1.0.90 → 1.0.92

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.
@@ -34,7 +34,7 @@ export function renderTagListPane() {
34
34
  <div class="at_panel_header">
35
35
  <span>${i18n.t('Tags')}</span>
36
36
  </div>
37
- <div class="at_form_container at_h-min-65">
37
+ <div class="at_form_container at_h-min-65 at_tag_list_pane">
38
38
  <div class="at_field at_flex_column" style="${_tagCategories ? '' : 'display: none;'}">
39
39
  <label for="">${i18n.t('Category')}</label>
40
40
  <div class="at_dropdown" id="at-custom-category-filter-dropdown" data-cy="at-custom-category-filter-dropdown">
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { actionBar, renderObjectCards, renderLibraryCards, renderTags, renderTagRow, getTagFormData, addClickEventToTagRow, setActiveCard, setActiveMenu, setActiveActionBtn, removeObjectCard, setTagCategoriesOption, toggleDropdown, tagFormMode, selectedTag, renderRecepientOptions, renderTagMessages, createTagMessage, setTagLink, setTagMessagingDetails, renderCategoryDropdownOptions, clearTagFormDropdown } from "./components/toolbar";
11
- import { getTargetPosition, addMediaScreen, _3DXObjects, selectedObject, setTransformControls, copyObject, revertTransform, clearSelectedObject, removeTransformControls, getLibrary, getMpTags, renderTag, captureSpaceScreenshot, moveTag, subscribeSpaceEvent, setModelVisibility, disposeModel, disposeTag, _tags, _tagCategories, dispatchSpaceEvent, editTagLabel, editTagDescription, setTagMessageRecepients, setTagMessages, setSelectedTagUuid, renderMeetingSidebar, setTagIcon, setObjectTransformation, getSelectedObject, } from "../architwin";
11
+ import { getTargetPosition, addMediaScreen, _3DXObjects, selectedObject, setTransformControls, copyObject, revertTransform, clearSelectedObject, removeTransformControls, getLibrary, getMpTags, renderTag, captureSpaceScreenshot, moveTag, subscribeSpaceEvent, setModelVisibility, disposeModel, disposeTag, _tags, _tagCategories, dispatchSpaceEvent, editTagLabel, editTagDescription, setTagMessageRecepients, setTagMessages, setSelectedTagUuid, renderMeetingSidebar, setObjectTransformation, getSelectedObject, _atwin } from "../architwin";
12
12
  import { Notyf } from 'notyf';
13
13
  import 'notyf/notyf.min.css';
14
14
  import { SPACE_EVENTS } from "../types";
@@ -17,6 +17,7 @@ import { renderObjectList } from "./components/toolbar/objectListPane";
17
17
  import { renderLibraryList } from "./components/toolbar/libraryPane";
18
18
  import { renderObjectCard } from "./components/toolbar/card";
19
19
  import { toggleModelControl, getCoordinateValues } from "./components/toolbar/modelControlsPane";
20
+ import { attachTagMedia } from "../tag";
20
21
  import i18n from './components/toolbar/i18n';
21
22
  let activeToolbarItem, activeActionItem, activePane, activeActionPane;
22
23
  let notyf = new Notyf({ position: { x: 'left', y: 'bottom' }, duration: 4500 });
@@ -252,7 +253,6 @@ function handlePlaceTag() {
252
253
  stemVisible: true,
253
254
  };
254
255
  moveTagBtn.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
255
- var _a;
256
256
  const tag = Object.assign({}, initTagData);
257
257
  const payload = getTagFormData();
258
258
  if (tagFormMode == "ADD" /* FORM_MODE.ADD */) {
@@ -262,7 +262,10 @@ function handlePlaceTag() {
262
262
  if (payload && payload.tagName && payload.tagCategoryId && payload.tagSubcategoryId) {
263
263
  tag.label = payload.tagName;
264
264
  tag.description = payload.tagDescription;
265
- //tag.attachments.push(payload.tagEmbed)
265
+ if (payload.tagEmbed && !tag.attachments) {
266
+ tag.attachments = [];
267
+ }
268
+ tag.attachments.push(payload.tagEmbed);
266
269
  if (targetCategory) {
267
270
  console.log("targetCategory is", targetCategory);
268
271
  tag.color = targetCategory.json_data.color.rgb;
@@ -277,23 +280,26 @@ function handlePlaceTag() {
277
280
  const targetSubCat = targetCategory.subcategories.find(subcat => subcat.uuid === payload.tagSubcategoryId);
278
281
  console.log('__@ JOTEST: icon: ', targetSubCat.json_data.iconUrl);
279
282
  console.log('__@ JOTEST: Setting tag icon...');
280
- yield setTagIcon({ tag: iTag, icon: (_a = targetSubCat.json_data.iconUrl) !== null && _a !== void 0 ? _a : '', color: iTag.color });
283
+ //await setTagIcon({tag: iTag, icon: targetSubCat.json_data.iconUrl ?? '', color: iTag.color})
281
284
  console.log('__@ JOTEST: Tag icon set!');
282
285
  moveTag(iTag.id, onTagPlaced);
283
286
  function onTagPlaced() {
284
- console.log("tag placed");
285
- const tagContainer = document.getElementById('at-tag-list-container');
286
- const row = renderTagRow(iTag);
287
- tagContainer.appendChild(row);
288
- addClickEventToTagRow(iTag);
289
- // toggleDisplayPane('at-cancel-tag-form-btn')
290
- notyf.success(`${i18n.t('SuccessAddTagToSpace')}`);
291
- const tags = getMpTags();
292
- _tags[tags.length - 1].category_uuid = payload.tagSubcategoryId;
293
- currentTag = _tags[_tags.length - 1];
294
- console.log('_tags', _tags);
295
- console.log("Last Tag Pushed", currentTag);
296
- clearTagFormDropdown();
287
+ return __awaiter(this, void 0, void 0, function* () {
288
+ console.log("tag placed");
289
+ const tagContainer = document.getElementById('at-tag-list-container');
290
+ const row = renderTagRow(iTag);
291
+ tagContainer.appendChild(row);
292
+ addClickEventToTagRow(iTag);
293
+ yield attachTagMedia({ sdk: _atwin, tag: iTag, attachments: iTag.attachments });
294
+ // toggleDisplayPane('at-cancel-tag-form-btn')
295
+ notyf.success(`${i18n.t('SuccessAddTagToSpace')}`);
296
+ const tags = getMpTags();
297
+ _tags[tags.length - 1].category_uuid = payload.tagSubcategoryId;
298
+ currentTag = _tags[_tags.length - 1];
299
+ console.log('_tags', _tags);
300
+ console.log("Last Tag Pushed", currentTag);
301
+ clearTagFormDropdown();
302
+ });
297
303
  }
298
304
  }
299
305
  else {
@@ -308,16 +314,19 @@ function handlePlaceTag() {
308
314
  console.log('iTag', iTag);
309
315
  moveTag(iTag.id, onTagPlaced);
310
316
  function onTagPlaced() {
311
- console.log("tag placed");
312
- const tagContainer = document.getElementById('at-tag-list-container');
313
- const row = renderTagRow(iTag);
314
- tagContainer.appendChild(row);
315
- addClickEventToTagRow(iTag);
316
- // toggleDisplayPane('at-cancel-tag-form-btn')
317
- notyf.success(`${i18n.t('SuccessAddTagToSpace')}`);
318
- const tags = getMpTags();
319
- currentTag = tags[tags.length - 1];
320
- console.log("Last Tag Pushed", tags[tags.length - 1]);
317
+ return __awaiter(this, void 0, void 0, function* () {
318
+ console.log("tag placed");
319
+ const tagContainer = document.getElementById('at-tag-list-container');
320
+ const row = renderTagRow(iTag);
321
+ tagContainer.appendChild(row);
322
+ addClickEventToTagRow(iTag);
323
+ yield attachTagMedia({ sdk: _atwin, tag: iTag, attachments: iTag.attachments });
324
+ // toggleDisplayPane('at-cancel-tag-form-btn')
325
+ notyf.success(`${i18n.t('SuccessAddTagToSpace')}`);
326
+ const tags = getMpTags();
327
+ currentTag = tags[tags.length - 1];
328
+ console.log("Last Tag Pushed", tags[tags.length - 1]);
329
+ });
321
330
  }
322
331
  }
323
332
  else {
@@ -336,24 +345,27 @@ function handlePlaceTag() {
336
345
  console.log('iTag', iTag);
337
346
  moveTag(iTag.json_data.id, onTagPlaced);
338
347
  function onTagPlaced() {
339
- console.log("tag placed");
340
- const tagContainer = document.getElementById('at-tag-list-container');
341
- const row = renderTagRow(iTag);
342
- tagContainer.appendChild(row);
343
- addClickEventToTagRow(iTag);
344
- // toggleDisplayPane('at-cancel-tag-form-btn')
345
- notyf.success(`${i18n.t('SuccessAddTagToSpace')}`);
346
- const tags = getMpTags();
347
- console.log("tags", tags);
348
- console.log("_tags", _tags);
349
- const index = _tags.findIndex(tag => tag.id == iTag.id);
350
- if (index !== -1) {
351
- console.log("tag found");
352
- _tags[index].category_uuid = payload.tagSubcategoryId;
353
- }
354
- else {
355
- console.log("tag not found");
356
- }
348
+ return __awaiter(this, void 0, void 0, function* () {
349
+ console.log("tag placed");
350
+ const tagContainer = document.getElementById('at-tag-list-container');
351
+ const row = renderTagRow(iTag);
352
+ tagContainer.appendChild(row);
353
+ addClickEventToTagRow(iTag);
354
+ yield attachTagMedia({ sdk: _atwin, tag: iTag, attachments: iTag.attachments });
355
+ // toggleDisplayPane('at-cancel-tag-form-btn')
356
+ notyf.success(`${i18n.t('SuccessAddTagToSpace')}`);
357
+ const tags = getMpTags();
358
+ console.log("tags", tags);
359
+ console.log("_tags", _tags);
360
+ const index = _tags.findIndex(tag => tag.id == iTag.id);
361
+ if (index !== -1) {
362
+ console.log("tag found");
363
+ _tags[index].category_uuid = payload.tagSubcategoryId;
364
+ }
365
+ else {
366
+ console.log("tag not found");
367
+ }
368
+ });
357
369
  }
358
370
  }
359
371
  else {
@@ -368,24 +380,27 @@ function handlePlaceTag() {
368
380
  const iTag = selectedTag;
369
381
  moveTag(iTag.json_data.id, onTagPlaced);
370
382
  function onTagPlaced() {
371
- console.log("tag placed");
372
- const tagContainer = document.getElementById('at-tag-list-container');
373
- const row = renderTagRow(iTag);
374
- tagContainer.appendChild(row);
375
- addClickEventToTagRow(iTag);
376
- // toggleDisplayPane('at-cancel-tag-form-btn')
377
- notyf.success(`${i18n.t('SuccessAddTagToSpace')}`);
378
- const tags = getMpTags();
379
- console.log("tags", tags);
380
- console.log("_tags", _tags);
381
- const index = _tags.findIndex(tag => tag.id == iTag.id);
382
- if (index !== -1) {
383
- console.log("tag found");
384
- _tags[index].category_uuid = payload.tagSubcategoryId;
385
- }
386
- else {
387
- console.log("tag not found");
388
- }
383
+ return __awaiter(this, void 0, void 0, function* () {
384
+ console.log("tag placed");
385
+ const tagContainer = document.getElementById('at-tag-list-container');
386
+ const row = renderTagRow(iTag);
387
+ tagContainer.appendChild(row);
388
+ addClickEventToTagRow(iTag);
389
+ yield attachTagMedia({ sdk: _atwin, tag: iTag, attachments: iTag.attachments });
390
+ // toggleDisplayPane('at-cancel-tag-form-btn')
391
+ notyf.success(`${i18n.t('SuccessAddTagToSpace')}`);
392
+ const tags = getMpTags();
393
+ console.log("tags", tags);
394
+ console.log("_tags", _tags);
395
+ const index = _tags.findIndex(tag => tag.id == iTag.id);
396
+ if (index !== -1) {
397
+ console.log("tag found");
398
+ _tags[index].category_uuid = payload.tagSubcategoryId;
399
+ }
400
+ else {
401
+ console.log("tag not found");
402
+ }
403
+ });
389
404
  }
390
405
  }
391
406
  else {
package/lib/tag.js CHANGED
@@ -30,9 +30,9 @@ function renderTag({ tag, sdk }) {
30
30
  console.error('Stem Vector is required');
31
31
  return;
32
32
  }
33
- if (tag.attachments) {
34
- delete tag.attachments;
35
- }
33
+ // if(tag.attachments){
34
+ // delete tag.attachments
35
+ // }
36
36
  const tagData = {};
37
37
  // remove tag.id if tag.id is falsy; else set tagData.id
38
38
  if (!tag.id || tag.id === '') {
@@ -49,6 +49,10 @@ function renderTag({ tag, sdk }) {
49
49
  tagData.color = tag.color;
50
50
  tagData.anchorPosition = tag.anchorPosition;
51
51
  tagData.stemVector = tag.stemVector;
52
+ if (tag.attachments) {
53
+ tagData.attachments = tag.attachments;
54
+ delete tag.attachments;
55
+ }
52
56
  console.log('__@ tagData', tagData);
53
57
  console.log('tag to be rendered', tag);
54
58
  const tagIds = yield sdk.Tag.add(tag);
@@ -58,11 +62,11 @@ function renderTag({ tag, sdk }) {
58
62
  // if(tag. && payload.icon.trim() !== ''){
59
63
  // await setTagIcon({sdk: sdk, tag: tag, icon: payload.icon,color:payload.tag.color})
60
64
  // }
61
- return tagData;
62
65
  // //attach media to tag (Video / Image / PDF); There are still more attachment types pls refer https://matterport.github.io/showcase-sdk/docs/reference/current/enums/tag.attachmenttype.html
63
- // if(payload.attachments && payload.attachments.length > 0){
64
- // await attachTagMedia({sdk: payload.sdk, tag: tag, attachments: payload.attachments})
66
+ // if(tagData.attachments && tagData.attachments.length > 0){
67
+ // await attachTagMedia({sdk: sdk, tag: tagData, attachments: tagData.attachments})
65
68
  // }
69
+ return tagData;
66
70
  // // set tag icon
67
71
  // if(payload.icon && payload.icon.trim() !== ''){
68
72
  // await setTagIcon({sdk: payload.sdk, tag: tag, icon: payload.icon,color:payload.tag.color})
@@ -174,7 +178,7 @@ function moveTag(payload, callback) {
174
178
  }
175
179
  if (callback) {
176
180
  console.log('__@ onCallback()');
177
- callback(placer);
181
+ yield callback(placer);
178
182
  }
179
183
  });
180
184
  yield placer.moveTag(onClick);
package/lib/types.d.ts CHANGED
@@ -839,6 +839,22 @@ export interface ModalContent {
839
839
  content: HTMLElement | undefined;
840
840
  action: HTMLElement | undefined;
841
841
  }
842
+ export interface EmbedlyData {
843
+ author_name: string;
844
+ author_url: string;
845
+ height: number;
846
+ html: string;
847
+ provider_name: string;
848
+ provider_url: string;
849
+ thumbnail_height: number;
850
+ thumbnail_url: string;
851
+ thumbnail_width: number;
852
+ title: string;
853
+ type: string;
854
+ url: string;
855
+ version: string;
856
+ width: number;
857
+ }
842
858
  export declare const enum IO_PARTICIPANT_COLORS {
843
859
  GREEN = "GREEN",
844
860
  BLUE = "BLUE",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "architwin",
3
- "version": "1.0.90",
3
+ "version": "1.0.92",
4
4
  "description": "ArchiTwin Library for Matterport",
5
5
  "main": "./lib/architwin.js",
6
6
  "types": "./lib/architwin.d.ts",
@@ -321,7 +321,7 @@
321
321
  color: var(--text-color-light);
322
322
  border-radius: var(--container-border-radius);
323
323
  padding: var(--container-padding);
324
- justify-content: var(--container-justify-content);
324
+ justify-content: var(--container-justify-content);
325
325
  flex-wrap: var(--container-wrap);
326
326
  gap: 16px;
327
327
  flex-direction: column;
@@ -925,4 +925,12 @@
925
925
  padding: 0rem 1rem;
926
926
  }
927
927
 
928
- }
928
+ }
929
+
930
+
931
+ /* CUSTOM CLASSES */
932
+ .at_tag_list_pane {
933
+ margin: 6px 6px 0px 6px !important;
934
+ gap: 0px !important;
935
+ padding: 10px 10px 5px 10px !important;
936
+ }