@datalabz_/dashboard-kit 6.0.14 → 6.0.16

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/README.md CHANGED
@@ -22,7 +22,7 @@ header filters, and the layout inside each panel; the kit owns the rest
22
22
  snapshot export).
23
23
 
24
24
  The LLM-facing authoring contract — what to write vs. what the kit provides —
25
- is [consumer_skill/dashboard-authoring-guide.md](../consumer_skill/dashboard-authoring-guide.md).
25
+ is each project's `reason-ops-dashboard` skill ([iGaming's](../projects/igaming/pack/skills/reason-ops-dashboard/SKILL.md)).
26
26
  It must always link the **current** major (see below). This file is the
27
27
  human-facing overview and the working rules for changing the kit; it is not an
28
28
  API reference. The SQL gateway the kit calls is
@@ -104,6 +104,21 @@ The list follows the fill, so it holds only what a filter can actually be given:
104
104
 
105
105
  The answer always goes to the dashboard's parent, whoever asked.
106
106
 
107
+ ## Gateway endpoint
108
+
109
+ `v6` has no default gateway (`v4` and `v5` still fall back to the iGaming one). The host sends `endpoint`
110
+ in `CUSTOM_DASHBOARDS_PARAMS`; without a valid one the dashboard shows an error and does not boot. The
111
+ token rides on every call to it, so the kit takes only a gateway on its own list (`GATEWAYS` in `v6.js`),
112
+ or http on localhost for development, from any sender; anything else is ignored with a console warning.
113
+
114
+ | Gateway | For |
115
+ | --- | --- |
116
+ | `https://aidqgateway.draftplaza.com/aidq` | iGaming |
117
+ | `https://aidqgateway.pokerplaza.com/aidq` | poker |
118
+ | `https://connector.invalid/aidq` | a Claude artifact, whose host script answers the call through the connector |
119
+
120
+ A new platform or gateway is a kit release.
121
+
107
122
  ## Drillthrough
108
123
 
109
124
  A click on a table column or a card opens another dashboard in a popup over this one, filtered to the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datalabz_/dashboard-kit",
3
- "version": "6.0.14",
3
+ "version": "6.0.16",
4
4
  "description": "DashboardKit runtime + styles, served from jsDelivr",
5
5
  "license": "UNLICENSED",
6
6
  "files": [
package/v4.js CHANGED
@@ -20,7 +20,7 @@
20
20
  let _activeTabId = '';
21
21
  let _sections = []; // { id, label, load, loaded, errors }
22
22
  let _title = '';
23
- let _gitVer = 'a5476b3'; // replaced at deploy: sed -i "s/a5476b3/$(git rev-parse --short HEAD)/g" v4.js
23
+ let _gitVer = 'eadd2b4'; // replaced at deploy: sed -i "s/eadd2b4/$(git rev-parse --short HEAD)/g" v4.js
24
24
  let _calls = []; // System Info call log
25
25
  let _sectionErrors = {}; // sectionId → error count
26
26
  let _generation = 0;
package/v5.js CHANGED
@@ -20,7 +20,7 @@
20
20
  let _activeTabId = '';
21
21
  let _sections = []; // { id, label, load, loaded, errors }
22
22
  let _title = '';
23
- let _gitVer = 'a5476b3'; // replaced at deploy: sed -i "s/a5476b3/$(git rev-parse --short HEAD)/g" v4.js
23
+ let _gitVer = 'eadd2b4'; // replaced at deploy: sed -i "s/eadd2b4/$(git rev-parse --short HEAD)/g" v4.js
24
24
  let _calls = []; // System Info call log
25
25
  let _sectionErrors = {}; // sectionId → error count
26
26
  let _generation = 0;
package/v6.js CHANGED
@@ -2,16 +2,25 @@
2
2
  (function (global) {
3
3
  'use strict';
4
4
 
5
- // Default gateway. The parent may name its own via `endpoint` in
6
- // CUSTOM_DASHBOARDS_PARAMS (each BackOffice has its own); omitted → this one.
7
- const DEFAULT_ENDPOINT = "https://aidqgateway.draftplaza.com/aidq";
5
+ // No default gateway: each BackOffice has its own, and a default would send one platform's
6
+ // token to another's gateway. The host names it via `endpoint` in CUSTOM_DASHBOARDS_PARAMS;
7
+ // without one the dashboard does not boot.
8
+ // The token rides on every call to the endpoint, so the host may name only one of these. Any
9
+ // sender may, which is how an artifact's host script (it shares the page, so it is not the
10
+ // parent) can; what stops a script in the page from redirecting the token is this list, not who
11
+ // sent the message. A new platform or gateway is a kit release.
12
+ const GATEWAYS = [
13
+ 'https://aidqgateway.draftplaza.com/aidq', // iGaming
14
+ 'https://aidqgateway.pokerplaza.com/aidq', // poker
15
+ 'https://connector.invalid/aidq', // a Claude artifact: its host answers the call through the connector
16
+ ];
8
17
  // Retry is off: 1 = a single attempt. Set to 2 to re-enable one retry for
9
18
  // whatever _isRetryable allows (no response, 5xx, 200 without rows).
10
19
  const MAX_ATTEMPTS = 1;
11
20
 
12
21
  // ── State ────────────────────────────────────────────────────────────────────
13
22
  let _authToken = '';
14
- let _endpoint = DEFAULT_ENDPOINT;
23
+ let _endpoint = '';
15
24
  let _dateFromIso = '';
16
25
  let _dateToIso = '';
17
26
  let _timezone = '';
@@ -20,7 +29,7 @@
20
29
  let _activeTabId = '';
21
30
  let _sections = []; // { id, label, load, loaded, errors }
22
31
  let _title = '';
23
- let _gitVer = 'a5476b3'; // replaced at deploy: sed -i "s/a5476b3/$(git rev-parse --short HEAD)/g" v6.js
32
+ let _gitVer = 'eadd2b4'; // replaced at deploy: sed -i "s/eadd2b4/$(git rev-parse --short HEAD)/g" v6.js
24
33
  let _calls = []; // System Info call log
25
34
  let _pageErrors = []; // System Info: errors no load() caught (a handler's, a timer's, the page script's)
26
35
  let _sectionErrors = {}; // sectionId → error count
@@ -1192,6 +1201,16 @@ html[data-dk-setup="true"] .dk-resp-toggle {
1192
1201
  } catch { return false; }
1193
1202
  }
1194
1203
 
1204
+ // One of GATEWAYS, or a local one for development (http on localhost).
1205
+ function _isKnownGateway(v) {
1206
+ if (typeof v !== 'string' || !v) return false;
1207
+ try {
1208
+ const u = new URL(v);
1209
+ if (u.protocol === 'http:' && (u.hostname === 'localhost' || u.hostname === '127.0.0.1')) return true;
1210
+ return GATEWAYS.some(function (g) { return new URL(g).href === u.href; });
1211
+ } catch { return false; }
1212
+ }
1213
+
1195
1214
  // ── Filters a parent can ask for ──────────────────────────────────────────────
1196
1215
  // DK_GET_FILTERS_INFO from the parent is answered with DK_FILTERS_INFO: the header controls a
1197
1216
  // dashboard can be opened with, which is what the kit can write into a header control at its first boot. So
@@ -1349,11 +1368,10 @@ html[data-dk-setup="true"] .dk-resp-toggle {
1349
1368
  _authToken = e.data.token;
1350
1369
  }
1351
1370
 
1352
- // The token rides on every call to the endpoint, so only the parent may set
1353
- // it, and only to an https URL (http for localhost dev). Anything else is
1354
- // ignored and the current endpoint stays.
1371
+ // Any sender, but only a known gateway (GATEWAYS). Anything else is ignored and the current
1372
+ // endpoint stays.
1355
1373
  if (e.data.endpoint !== undefined) {
1356
- if (e.source === window.parent && _isGatewayUrl(e.data.endpoint)) _endpoint = e.data.endpoint;
1374
+ if (_isKnownGateway(e.data.endpoint)) _endpoint = e.data.endpoint;
1357
1375
  else console.warn('[DashboardKit] endpoint ignored:', e.data.endpoint);
1358
1376
  }
1359
1377
 
@@ -1391,7 +1409,18 @@ html[data-dk-setup="true"] .dk-resp-toggle {
1391
1409
  // it closes. A theme or token change does not move what it shows.
1392
1410
  if (_popup && JSON.stringify(_contextSnapshot()) !== contextBefore) _closePopup();
1393
1411
 
1394
- if (!_hasBooted && _authToken && _dateFromIso && _dateToIso && _timezone) {
1412
+ if (!_hasBooted && _authToken && _dateFromIso && _dateToIso && _timezone && !_endpoint) {
1413
+ // Not permanent, unlike a filter refusal: the parent may send the endpoint in a later message.
1414
+ const msg = 'The host did not send a valid "endpoint" (the https gateway URL), so the dashboard cannot load data.';
1415
+ console.error('[DashboardKit] ' + msg);
1416
+ const wait = document.getElementById('dk-wait');
1417
+ if (wait) {
1418
+ wait.hidden = false;
1419
+ wait.textContent = msg;
1420
+ wait.style.color = 'var(--err)';
1421
+ wait.style.fontStyle = 'normal';
1422
+ }
1423
+ } else if (!_hasBooted && _authToken && _dateFromIso && _dateToIso && _timezone) {
1395
1424
  // Before the fill writes anything and before a section runs. A fault in describing the filters
1396
1425
  // must never keep the dashboard from booting, so it only costs the list.
1397
1426
  try { _bootFilters = _dashboardFilters(); }
package/wrapper.js CHANGED
@@ -23,6 +23,7 @@
23
23
  label: "Poker",
24
24
  apiBase: "https://pokerreporting.pokerplaza.com",
25
25
  gatewayEndpoint: "https://aidqgateway.pokerplaza.com/aidq",
26
+ dashboardsApi: "https://pokerreporting.pokerplaza.com/dashboards",
26
27
  storagePrefix: "iqg.harness.poker.",
27
28
  },
28
29
  };
@@ -224,7 +225,7 @@
224
225
  const hid = State.filters.hierarchyId;
225
226
  const msg = {
226
227
  type: "CUSTOM_DASHBOARDS_PARAMS", token: State.token, theme: State.theme,
227
- // The SQL gateway of this BackOffice; the kit would otherwise use its own default.
228
+ // The SQL gateway of this BackOffice; the kit has no default.
228
229
  endpoint: CFG.gatewayEndpoint,
229
230
  filters: {
230
231
  dateFrom: r.dateFromIso, dateTo: r.dateToIso, timezone: tz,