architwin 1.18.6 → 1.18.7

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.
@@ -168,7 +168,8 @@ export function getTagFormData() {
168
168
  }
169
169
  if (tagNameInput) {
170
170
  const tagName = tagNameInput.value;
171
- const tagDescription = tagDescriptionInput.value.split('\n')[0];
171
+ const tagDescription = tagDescriptionInput.value;
172
+ //const tagDescription = tagDescriptionInput.value.split('\n')[0]
172
173
  const tagEmbed = tagEmbedInput.value;
173
174
  const formData = {
174
175
  tagName: tagName,
@@ -0,0 +1,8 @@
1
+ import { IMattertagsResponse } from "./types";
2
+ /**
3
+ * Sends a GraphQL query to the Matterport API to retrieve all mattertags and their associated data for a given model ID and application key.
4
+ * @param modelId - Id of the model space
5
+ * @param appKey - Matterport app key
6
+ * @returns
7
+ */
8
+ export declare function getTagAndTagData(modelId: string, appKey: string): Promise<IMattertagsResponse>;
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "architwin",
3
- "version": "1.18.6",
3
+ "version": "1.18.7",
4
4
  "description": "ArchiTwin Library for Matterport",
5
5
  "main": "./lib/architwin.js",
6
6
  "types": "./lib/architwin.d.ts",