architwin 1.18.5 → 1.19.0

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/lib/graphql.js ADDED
@@ -0,0 +1,60 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ /**
11
+ * Sends a GraphQL query to the Matterport API to retrieve all mattertags and their associated data for a given model ID and application key.
12
+ * @param modelId - Id of the model space
13
+ * @param appKey - Matterport app key
14
+ * @returns
15
+ */
16
+ export function getTagAndTagData(modelId, appKey) {
17
+ return __awaiter(this, void 0, void 0, function* () {
18
+ var query = `{
19
+ model(id: "${modelId}") {
20
+ mattertags(includeDisabled: true) {
21
+ id
22
+ floor { id }
23
+ created
24
+ modified
25
+ enabled
26
+ color
27
+ icon
28
+ keywords
29
+ label
30
+ description
31
+ media
32
+ mediaType
33
+ position { x, y, z }
34
+ anchorPosition { x, y, z }
35
+ discPosition { x, y, z }
36
+ stemNormal { x, y, z }
37
+ stemLength
38
+ stemEnabled
39
+ stemDirection { x, y, z } # Deprecated, use stemNormal and stemLength
40
+
41
+ }
42
+ }
43
+ }`;
44
+ var headers = {
45
+ 'Content-Type': 'application/graphql',
46
+ 'x-matterport-application-key': appKey,
47
+ };
48
+ var options = {
49
+ method: 'POST',
50
+ mode: 'cors',
51
+ headers: headers,
52
+ body: query,
53
+ redirect: 'follow',
54
+ };
55
+ var url = 'https://my.matterport.com/api/mp/models/graph';
56
+ //@ts-ignore
57
+ const response = yield fetch(url, options);
58
+ return yield response.json();
59
+ });
60
+ }
package/lib/tag.d.ts CHANGED
@@ -24,6 +24,11 @@ declare function setTagIcon(payload: {
24
24
  iconUrl: string;
25
25
  color: MpSdk.Color | string;
26
26
  }): Promise<void>;
27
+ declare function attachTagMediaById(payload: {
28
+ sdk: MpSdk;
29
+ tagId: string;
30
+ attachmentId: string[];
31
+ }): Promise<void>;
27
32
  declare function attachTagMedia(payload: {
28
33
  sdk: MpSdk;
29
34
  tag: MpSdk.Tag.TagData;
@@ -100,4 +105,4 @@ declare function toggleTagVisibility(payload: {
100
105
  sdk: MpSdk;
101
106
  visibility: boolean;
102
107
  }): void;
103
- export { renderTag, disposeTag, moveTag, attachTagMedia, detachTagMedia, setTagIcon, editBillboard, editStem, editColor, saveTagDb, deleteTag, getTagColorCodeID, getEmbedlyData, cancelMoveTag, handleTagPlacerCreated, attachSandbox, registerSandbox, toggleTagVisibility };
108
+ export { renderTag, disposeTag, moveTag, attachTagMediaById, attachTagMedia, detachTagMedia, setTagIcon, editBillboard, editStem, editColor, saveTagDb, deleteTag, getTagColorCodeID, getEmbedlyData, cancelMoveTag, handleTagPlacerCreated, attachSandbox, registerSandbox, toggleTagVisibility };
package/lib/tag.js CHANGED
@@ -125,6 +125,15 @@ function setTagIcon(payload) {
125
125
  }
126
126
  });
127
127
  }
128
+ function attachTagMediaById(payload) {
129
+ return __awaiter(this, void 0, void 0, function* () {
130
+ if (!payload.attachmentId || payload.attachmentId.length === 0) {
131
+ log.error('__@ No Attachments IDs');
132
+ return;
133
+ }
134
+ yield payload.sdk.Tag.attach(payload.tagId, ...payload.attachmentId);
135
+ });
136
+ }
128
137
  function attachTagMedia(payload) {
129
138
  return __awaiter(this, void 0, void 0, function* () {
130
139
  log.info('__@ attachTagContent()', payload);
@@ -439,7 +448,7 @@ function toggleTagVisibility(payload) {
439
448
  navigating: true
440
449
  });
441
450
  }
442
- export { renderTag, disposeTag, moveTag, attachTagMedia, detachTagMedia, setTagIcon, editBillboard, editStem, editColor, saveTagDb, deleteTag, getTagColorCodeID, getEmbedlyData, cancelMoveTag, handleTagPlacerCreated, attachSandbox, registerSandbox, toggleTagVisibility };
451
+ export { renderTag, disposeTag, moveTag, attachTagMediaById, attachTagMedia, detachTagMedia, setTagIcon, editBillboard, editStem, editColor, saveTagDb, deleteTag, getTagColorCodeID, getEmbedlyData, cancelMoveTag, handleTagPlacerCreated, attachSandbox, registerSandbox, toggleTagVisibility };
443
452
  // # -------------------------------------------------------------------------
444
453
  // # tag
445
454
  // # -------------------------------------------------------------------------
package/lib/types.d.ts CHANGED
@@ -34,6 +34,8 @@ export interface ITag {
34
34
  iot_tag?: IoTTagDetails;
35
35
  created_on?: string;
36
36
  notion_page_url: string;
37
+ iconId?: string;
38
+ fontId?: string;
37
39
  }
38
40
  export interface IoTTagDetails {
39
41
  linked_system?: string;
@@ -71,6 +73,42 @@ export interface IotCategoryType {
71
73
  iconBase64: string;
72
74
  };
73
75
  }
76
+ export interface IMattertagVector3 {
77
+ x: number;
78
+ y: number;
79
+ z: number;
80
+ }
81
+ export interface IMattertagFloor {
82
+ id: string;
83
+ }
84
+ export interface IMattertag {
85
+ id: string;
86
+ floor: IMattertagFloor;
87
+ created: string;
88
+ modified: string;
89
+ enabled: boolean;
90
+ color: string;
91
+ icon?: string;
92
+ keywords: string[];
93
+ label: string;
94
+ description: string;
95
+ media?: string | string[];
96
+ mediaType?: string;
97
+ position: IMattertagVector3;
98
+ anchorPosition: IMattertagVector3;
99
+ discPosition: IMattertagVector3;
100
+ stemNormal: IMattertagVector3;
101
+ stemLength: number;
102
+ stemEnabled: boolean;
103
+ stemDirection: IMattertagVector3;
104
+ }
105
+ export interface IMattertagsResponse {
106
+ data: {
107
+ model: {
108
+ mattertags: IMattertag[];
109
+ };
110
+ };
111
+ }
74
112
  export interface ITagColor {
75
113
  name: COLOR;
76
114
  rgb: {
@@ -815,7 +853,9 @@ export declare enum SPACE_EVENTS {
815
853
  DRAW_PIPE_UNDO = "DRAW_PIPE_UNDO",
816
854
  DRAW_PIPE_REDO = "DRAW_PIPE_REDO",
817
855
  PIPE_VERTEX_REMOVED = "PIPE_VERTEX_REMOVED",
818
- PATH_UPDATED = "PATH_UPDATED"
856
+ PATH_UPDATED = "PATH_UPDATED",
857
+ IMPORT_MTAGS = "IMPORT_MTAGS",
858
+ PROCEED_IMPORT_MTAGS = "PROCEED_IMPORT_MTAGS"
819
859
  }
820
860
  export declare const enum TAG_COLOR {
821
861
  MAROON = "MAROON",
package/lib/types.js CHANGED
@@ -151,6 +151,8 @@ export var SPACE_EVENTS;
151
151
  SPACE_EVENTS["DRAW_PIPE_REDO"] = "DRAW_PIPE_REDO";
152
152
  SPACE_EVENTS["PIPE_VERTEX_REMOVED"] = "PIPE_VERTEX_REMOVED";
153
153
  SPACE_EVENTS["PATH_UPDATED"] = "PATH_UPDATED";
154
+ SPACE_EVENTS["IMPORT_MTAGS"] = "IMPORT_MTAGS";
155
+ SPACE_EVENTS["PROCEED_IMPORT_MTAGS"] = "PROCEED_IMPORT_MTAGS";
154
156
  })(SPACE_EVENTS || (SPACE_EVENTS = {}));
155
157
  export var MEETING_SIDEBAR;
156
158
  (function (MEETING_SIDEBAR) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "architwin",
3
- "version": "1.18.5",
3
+ "version": "1.19.0",
4
4
  "description": "ArchiTwin Library for Matterport",
5
5
  "main": "./lib/architwin.js",
6
6
  "types": "./lib/architwin.d.ts",
@@ -720,3 +720,6 @@
720
720
  background-color: #222222 !important;
721
721
  }
722
722
 
723
+ .at_import_matterport_btn{
724
+ width: calc(100% - 8px);
725
+ }