@operato/board 1.4.83 → 1.4.84

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@operato/board",
3
- "version": "1.4.83",
3
+ "version": "1.4.84",
4
4
  "description": "Webcomponent for board following open-wc recommendations",
5
5
  "author": "heartyoh",
6
6
  "main": "dist/src/index.js",
@@ -148,5 +148,5 @@
148
148
  "prettier --write"
149
149
  ]
150
150
  },
151
- "gitHead": "e4a6c5bd4f8eee6c58cf487febf8a01bf349ab77"
151
+ "gitHead": "f31a3726a76fd0262935f9a3e8087910ef4dda87"
152
152
  }
@@ -16,6 +16,21 @@ import { runScenario, startScenario } from './graphql/scenario.js'
16
16
  import { BoardComponentInfo } from './ox-board-component-info.js'
17
17
  import { fetchPlayGroupByName } from './graphql/play-group.js'
18
18
 
19
+ function objectToQueryString(obj: any) {
20
+ const keyValuePairs = []
21
+ for (const key in obj) {
22
+ if (Object.hasOwnProperty.call(obj, key)) {
23
+ const value = obj[key]
24
+ if (typeof value === 'object') {
25
+ keyValuePairs.push(`${encodeURIComponent(key)}=${encodeURIComponent(JSON.stringify(value))}`)
26
+ } else {
27
+ keyValuePairs.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
28
+ }
29
+ }
30
+ }
31
+ return keyValuePairs.join('&')
32
+ }
33
+
19
34
  @customElement('ox-board-viewer')
20
35
  export class BoardViewer extends LitElement {
21
36
  static styles = [
@@ -354,7 +369,7 @@ export class BoardViewer extends LitElement {
354
369
 
355
370
  async gotoPlayer(playGroupName: string, bindingData?: any) {
356
371
  const id = (await fetchPlayGroupByName(playGroupName))?.id
357
- const queryString = bindingData ? new URLSearchParams(bindingData).toString() : ''
372
+ const queryString = bindingData ? objectToQueryString(bindingData) : ''
358
373
 
359
374
  if (document.querySelector('things-app')) {
360
375
  history.pushState({}, '', `board-player/${id}?${queryString}`)
@@ -507,7 +522,9 @@ export class BoardViewer extends LitElement {
507
522
  }
508
523
 
509
524
  onLinkMove(url: string, value: any, fromComponent: Component) {
510
- if (!url) return
525
+ if (!url) {
526
+ return
527
+ }
511
528
 
512
529
  location.href = url
513
530
  }