@twintag/twintag-core 0.2.279-fix-ocr-scanner-update-ec42ca951c4f16b77ca0afa9f41095303b05aeea → 0.2.280-fix-viewId-invalid-28ad22be11e07adb732bc1ec319b070e707b0f6a

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.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const auth = require('./auth-b8eb975c.js');
6
- const view = require('./view-5688de88.js');
6
+ const view = require('./view-b991bc58.js');
7
7
  require('./utils-c573638e.js');
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-2c25b2e9.js');
6
- const view = require('./view-5688de88.js');
6
+ const view = require('./view-b991bc58.js');
7
7
  const _commonjsHelpers = require('./_commonjsHelpers-206db00d.js');
8
8
  require('./utils-c573638e.js');
9
9
 
@@ -206,7 +206,7 @@ class IndexedDbService {
206
206
  /**
207
207
  * The SDK version.
208
208
  */
209
- const VERSION = '0.2.279-fix-ocr-scanner-update-ec42ca951c4f16b77ca0afa9f41095303b05aeea';
209
+ const VERSION = '0.0.0-VERSION';
210
210
 
211
211
  class TwintagErrorValue {
212
212
  }
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ const utils = require('./utils-c573638e.js');
4
+
5
+ /**
6
+ * The view object represents the current active view.
7
+ * A common use is to figure out the QID of the active view, E.g:
8
+ * ```js
9
+ * let viewId = View.getId()
10
+ * ```
11
+ */
12
+ class View {
13
+ /**
14
+ * Get view id for current twintag
15
+ * @returns string view id
16
+ */
17
+ static getId() {
18
+ const url = new URL(window.location.href);
19
+ const path_segments = url.pathname.split('/').filter((x) => x.length > 0);
20
+ const views_segment_idx = path_segments.indexOf('views');
21
+ return path_segments.length > 0
22
+ ? utils.inIframe() && views_segment_idx > -1
23
+ ? path_segments[views_segment_idx + 1]
24
+ // Assuming the `id` is the first segment and there could be
25
+ // additional segments available. Example: `<base_url>/<view_id>/onboard`
26
+ : path_segments[0]
27
+ : '';
28
+ }
29
+ }
30
+
31
+ exports.View = View;
@@ -12,11 +12,15 @@ export class View {
12
12
  * @returns string view id
13
13
  */
14
14
  static getId() {
15
- let sp = window.location.pathname.split('/');
16
- return sp && sp.length > 0
17
- ? inIframe() && sp.indexOf('views') != -1
18
- ? sp[sp.indexOf('views') + 1]
19
- : sp[sp.length - 1]
15
+ const url = new URL(window.location.href);
16
+ const path_segments = url.pathname.split('/').filter((x) => x.length > 0);
17
+ const views_segment_idx = path_segments.indexOf('views');
18
+ return path_segments.length > 0
19
+ ? inIframe() && views_segment_idx > -1
20
+ ? path_segments[views_segment_idx + 1]
21
+ // Assuming the `id` is the first segment and there could be
22
+ // additional segments available. Example: `<base_url>/<view_id>/onboard`
23
+ : path_segments[0]
20
24
  : '';
21
25
  }
22
26
  }
@@ -2,4 +2,4 @@
2
2
  /**
3
3
  * The library version.
4
4
  */
5
- export const VERSION = '0.2.279-fix-ocr-scanner-update-ec42ca951c4f16b77ca0afa9f41095303b05aeea';
5
+ export const VERSION = '0.2.280-fix-viewId-invalid-28ad22be11e07adb732bc1ec319b070e707b0f6a';
@@ -15,11 +15,15 @@ class View$1 {
15
15
  * @returns string view id
16
16
  */
17
17
  static getId() {
18
- let sp = window.location.pathname.split('/');
19
- return sp && sp.length > 0
20
- ? inIframe() && sp.indexOf('views') != -1
21
- ? sp[sp.indexOf('views') + 1]
22
- : sp[sp.length - 1]
18
+ const url = new URL(window.location.href);
19
+ const path_segments = url.pathname.split('/').filter((x) => x.length > 0);
20
+ const views_segment_idx = path_segments.indexOf('views');
21
+ return path_segments.length > 0
22
+ ? inIframe() && views_segment_idx > -1
23
+ ? path_segments[views_segment_idx + 1]
24
+ // Assuming the `id` is the first segment and there could be
25
+ // additional segments available. Example: `<base_url>/<view_id>/onboard`
26
+ : path_segments[0]
23
27
  : '';
24
28
  }
25
29
  }
@@ -223,7 +227,7 @@ class IndexedDbService {
223
227
  /**
224
228
  * The SDK version.
225
229
  */
226
- const VERSION = '0.2.279-fix-ocr-scanner-update-ec42ca951c4f16b77ca0afa9f41095303b05aeea';
230
+ const VERSION = '0.0.0-VERSION';
227
231
 
228
232
  class TwintagErrorValue {
229
233
  }
package/dist/esm/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export { A as Auth, a as AuthConfigTemplate } from './auth-c2a87e33.js';
2
- export { V as View } from './view-3c7635c8.js';
2
+ export { V as View } from './view-a251c1a9.js';
3
3
  import './utils-c73229be.js';
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent } from './index-174285a2.js';
2
- import { V as View$1 } from './view-3c7635c8.js';
2
+ import { V as View$1 } from './view-a251c1a9.js';
3
3
  import { c as createCommonjsModule, g as getAugmentedNamespace } from './_commonjsHelpers-27f122dd.js';
4
4
  import './utils-c73229be.js';
5
5
 
@@ -202,7 +202,7 @@ class IndexedDbService {
202
202
  /**
203
203
  * The SDK version.
204
204
  */
205
- const VERSION = '0.2.279-fix-ocr-scanner-update-ec42ca951c4f16b77ca0afa9f41095303b05aeea';
205
+ const VERSION = '0.0.0-VERSION';
206
206
 
207
207
  class TwintagErrorValue {
208
208
  }
@@ -0,0 +1,29 @@
1
+ import { i as inIframe } from './utils-c73229be.js';
2
+
3
+ /**
4
+ * The view object represents the current active view.
5
+ * A common use is to figure out the QID of the active view, E.g:
6
+ * ```js
7
+ * let viewId = View.getId()
8
+ * ```
9
+ */
10
+ class View {
11
+ /**
12
+ * Get view id for current twintag
13
+ * @returns string view id
14
+ */
15
+ static getId() {
16
+ const url = new URL(window.location.href);
17
+ const path_segments = url.pathname.split('/').filter((x) => x.length > 0);
18
+ const views_segment_idx = path_segments.indexOf('views');
19
+ return path_segments.length > 0
20
+ ? inIframe() && views_segment_idx > -1
21
+ ? path_segments[views_segment_idx + 1]
22
+ // Assuming the `id` is the first segment and there could be
23
+ // additional segments available. Example: `<base_url>/<view_id>/onboard`
24
+ : path_segments[0]
25
+ : '';
26
+ }
27
+ }
28
+
29
+ export { View as V };
@@ -1 +1 @@
1
- export{A as Auth,a as AuthConfigTemplate}from"./p-2c603989.js";export{V as View}from"./p-e6fa1a51.js";import"./p-2e4c78ca.js";
1
+ export{A as Auth,a as AuthConfigTemplate}from"./p-2c603989.js";export{V as View}from"./p-6d5b977c.js";import"./p-2e4c78ca.js";
@@ -0,0 +1 @@
1
+ import{i as s}from"./p-2e4c78ca.js";class t{static getId(){const t=new URL(window.location.href).pathname.split("/").filter((s=>s.length>0)),e=t.indexOf("views");return t.length>0?s()&&e>-1?t[e+1]:t[0]:""}}export{t as V}