@cube-nl/dmp-sdk 1.1.0-rc.2 → 1.1.0-rc.3
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 +27 -10
- package/dist/app.d.ts +2 -2
- package/dist/app.js +1 -1
- package/dist/cube-sdk.js +23 -20
- package/dist/cube-ui.manifest.json +10 -3
- package/dist/size.json +2 -2
- package/dist/ui/attributes.js +1 -1
- package/dist/ui/blocks/board.d.ts +1 -1
- package/dist/ui/blocks/board.js +75 -3
- package/dist/ui/manifest.js +9 -0
- package/dist/ui/trial-banner.d.ts +2 -0
- package/dist/ui/trial-banner.js +23 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,9 +50,9 @@ For an app without a build step, the single-file browser build is on the npm CDN
|
|
|
50
50
|
version:
|
|
51
51
|
|
|
52
52
|
```html
|
|
53
|
-
<script src="https://cdn.jsdelivr.net/npm/@cube-nl/dmp-sdk@1.1.0-rc.
|
|
53
|
+
<script src="https://cdn.jsdelivr.net/npm/@cube-nl/dmp-sdk@1.1.0-rc.3/dist/cube-sdk.js"></script>
|
|
54
54
|
<!-- or -->
|
|
55
|
-
<script src="https://unpkg.com/@cube-nl/dmp-sdk@1.1.0-rc.
|
|
55
|
+
<script src="https://unpkg.com/@cube-nl/dmp-sdk@1.1.0-rc.3/dist/cube-sdk.js"></script>
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
Fallback, for an unreleased commit: `npm install
|
|
@@ -616,16 +616,29 @@ apply to it):
|
|
|
616
616
|
keeps it out of storage, logs and an innocent `innerHTML` dump; it is no defence against hostile code in the page,
|
|
617
617
|
which the DMP bounds instead (read-only, bound to the maker's IP and `Origin: null`, at most 60 minutes).
|
|
618
618
|
- **The banner.** `cube-sdk.js` puts `<cube-trial-banner>` first in `<body>` (shadow DOM, constructable stylesheet,
|
|
619
|
-
house-style tokens): *"Proefversie · alleen jij · alleen lezen · verloopt om 15:42 · leest: orders, klanten ·
|
|
620
|
-
geen gegevens uit deze proefversie in je AI-gesprek."*
|
|
619
|
+
house-style tokens): *"Proefversie · alleen jij · alleen lezen · verloopt om 15:42 CEST · leest: orders, klanten ·
|
|
620
|
+
Plak geen gegevens uit deze proefversie in je AI-gesprek."*
|
|
621
|
+
- **Which clock.** The time shown is the DMP's expiry moment (`expiresAt` from the page's config), formatted in nl-NL
|
|
622
|
+
in the browser's time zone with that zone's short name (a browser in UTC shows "13:42 UTC"). A page in the DMP,
|
|
623
|
+
such as the app page, shows the time in the DMP's time zone; the zone name keeps the two from seeming to disagree.
|
|
624
|
+
The banner ends as expired without a request when the browser's clock passes `expiresAt`; a `401 trial_expired`
|
|
625
|
+
from the DMP ends it whatever the browser's clock says. The DMP's refusal is what ends the trial: a browser clock
|
|
626
|
+
that runs behind only shows the expired state later, and one that runs ahead shows "verlopen" early while the DMP
|
|
627
|
+
would still answer.
|
|
621
628
|
- **The poll.** It asks `GET statusUrl` (with the token, `cache: 'no-store'`, a 10 s timeout) every 5 s while the
|
|
622
629
|
page is visible and every 60 s while hidden, and right away when the page becomes visible again. When `expiresAt`
|
|
623
|
-
passes it shows the expired state without a request.
|
|
630
|
+
passes it shows the expired state without a request. A `429` with a `Retry-After` in whole seconds (digits only)
|
|
631
|
+
makes the next request wait that long, at least the normal interval and at most 60 s (`RETRY_AFTER_CAP_MS`), and
|
|
632
|
+
never past `expiresAt`; while that back-off holds, becoming visible again waits out its rest instead of asking at
|
|
633
|
+
once; it covers only the request it delays. Another `Retry-After` (absent, an HTTP date) keeps the normal rhythm.
|
|
634
|
+
The page can only read `Retry-After` when the DMP exposes it (`cube/apps` does by default for trial requests, via
|
|
635
|
+
`Access-Control-Expose-Headers`); without it the normal rhythm holds.
|
|
624
636
|
|
|
625
637
|
| Answer | Banner |
|
|
626
638
|
|---|---|
|
|
627
639
|
| `200` | Nothing changes, polling goes on |
|
|
628
|
-
| Network error, timeout, `
|
|
640
|
+
| Network error, timeout, `5xx` | Polling goes on |
|
|
641
|
+
| `429` | Polling goes on, after a numeric `Retry-After` (capped at 60 s) when it is longer than the interval |
|
|
629
642
|
| `401 trial_replaced`, `wider: false` | *"Nieuwe versie wordt geladen…"*, then `location.assign(newer)` |
|
|
630
643
|
| `401 trial_replaced`, otherwise | *"Er is een nieuwe versie die meer gegevens leest."* with **Laden**: only the maker's click navigates |
|
|
631
644
|
| `401 trial_elsewhere` | *"Laad de pagina opnieuw."* with **Opnieuw laden** |
|
|
@@ -674,7 +687,7 @@ Without them the preview is permissive: every field, every function; only a fiel
|
|
|
674
687
|
|---|---|
|
|
675
688
|
| `CubeApp.connect(options?)` | `Promise<CubeAppSession>`. Options: `mock`, `manifest` (an object, or `false` to check nothing), `pageUrl` (default the page's URL), `fetch`, `tokenStorage` (`'session'`, the default, or `'memory'`), `autoSignIn` (default `false`) |
|
|
676
689
|
| `CubeApp.mock(data)` | Registers preview data for the next `connect()`; `null` forgets it |
|
|
677
|
-
| `CubeApp.version` | This SDK's version, e.g. `'1.1.0-rc.
|
|
690
|
+
| `CubeApp.version` | This SDK's version, e.g. `'1.1.0-rc.3'` |
|
|
678
691
|
| `CubeApp.sdk` | The manifest `"sdk"` this build serves, `'1'` |
|
|
679
692
|
| `session.mode` | `'preview'`, `'live'` or `'trial'` (a proefversie the DMP serves: the maker's own data, read-only, with a token written into the page) |
|
|
680
693
|
| `session.user()` | `{ id, name, scopes }` or `null` |
|
|
@@ -702,8 +715,8 @@ app with a build (route A).
|
|
|
702
715
|
| | |
|
|
703
716
|
|---|---|
|
|
704
717
|
| File | `dist/cube-sdk.js` in the package, `@cube-nl/dmp-sdk/cube-sdk.js` as an export; on jsDelivr/unpkg as `@cube-nl/dmp-sdk@<version>/dist/cube-sdk.js`; the CI's `pack` job also keeps it as an artifact |
|
|
705
|
-
| Size |
|
|
706
|
-
| Version | The banner's first line, `/*! @cube-nl/dmp-sdk 1.1.0-rc.
|
|
718
|
+
| Size | 136.2 KiB minified, 45.9 KiB gzipped (17.7 KiB core + 28.1 KiB blocks and the trial banner) in 1.1.0-rc.3; `dist/size.json` has the exact numbers |
|
|
719
|
+
| Version | The banner's first line, `/*! @cube-nl/dmp-sdk 1.1.0-rc.3 cube-sdk.js … */`, and `CubeApp.version` |
|
|
707
720
|
|
|
708
721
|
Pin it by copying the built file of a known version into the host, rather than fetching it at
|
|
709
722
|
runtime: `npm pack @cube-nl/dmp-sdk@<version>` downloads the tarball, `package/dist/cube-sdk.js` is
|
|
@@ -847,7 +860,7 @@ blocks work from 320 px wide.
|
|
|
847
860
|
| `cube-calc` | `label`. A calculator that needs no data: an editor per `cube-input`, an output per `cube-result`, recalculated on every keystroke by the `formula` property. Read-only `values` and `results`, event `cube-change` (`{ values, results }`) |
|
|
848
861
|
| `cube-input` | `name`, `label` (required), `type` (`number`, `integer`, `currency`, `percent`, `text`, `select`, `checkbox`), `value`, `min`, `max`, `step`, `options` (a select needs it; `value=Label,...` as in `cube-field`). A configuration element, a direct child of `cube-calc`; it is never rendered. Numbers are typed the Dutch way (`7,5`) |
|
|
849
862
|
| `cube-result` | `name`, `label` (required), `format` (`number`, `integer`, `currency`, `percent`, `text`), `currency` (default `EUR`), `emphasis` (the large figure). A configuration element, a direct child of `cube-calc`; it is never rendered |
|
|
850
|
-
| `cube-board` | `resource`, `status-field`, `title-field` (required), `fields` (extra lines on a card), `sort`, `filter`, `page-size` (default 50, at most 200; a column with more says "en nog N"). `cube-field` children label and format the `fields` of a card. Cards in a column per status value. `status-field` must be filterable and `sort` a sortable field. Needs `list`; `update` is optional (without it the board is read-only). Event `cube-move` (`{ resource, id, from, to }`), followed by `cube-data-change` |
|
|
863
|
+
| `cube-board` | `resource`, `status-field`, `title-field` (required), `fields` (extra lines on a card), `sort`, `filter`, `page-size` (default 50, at most 200; a column with more says "en nog N"), `detail` (selector of a `cube-detail`). `cube-field` children label and format the `fields` of a card. Cards in a column per status value. `status-field` must be filterable and `sort` a sortable field. Needs `list`; `update` is optional (without it the board is read-only). Event `cube-move` (`{ resource, id, from, to }`), followed by `cube-data-change`; event `cube-select` (`{ resource, id, row }`) when a card is chosen |
|
|
851
864
|
| `cube-column` | `value` (required), `label`. A configuration element, a direct child of `cube-board`, in order; it is never rendered |
|
|
852
865
|
|
|
853
866
|
`cube-table`, `cube-detail` and `cube-form` need the matching actions in the app's `uses`
|
|
@@ -938,6 +951,10 @@ say so ("Te veel groepen…") and ask for a shorter period or a filter, without
|
|
|
938
951
|
gets the column value as a number.
|
|
939
952
|
- **Read-only**: without `update` in the app's `uses`, when the status field is read-only, or when the resource has no
|
|
940
953
|
`id` field (the board then does not request `id`), cards cannot move and show no buttons.
|
|
954
|
+
- **Choosing**: a click on a card, or Enter or Space while the card itself has focus, chooses it: `cube-select` with
|
|
955
|
+
`{ resource, id, row }` (as `cube-table`), and `detail` sets the `record-id` of that `cube-detail`. A move (a
|
|
956
|
+
button or a drop) is never a choice. The chosen card stays marked (`aria-current`) across a move and a reload until
|
|
957
|
+
another `resource` is shown; a card without `id` emits `id: null`, is not marked and fills no detail.
|
|
941
958
|
Columns stack on a narrow screen (from 320 px).
|
|
942
959
|
|
|
943
960
|
### Wireframe
|
package/dist/app.d.ts
CHANGED
|
@@ -115,8 +115,8 @@ export declare const CubeApp: Readonly<{
|
|
|
115
115
|
ready: typeof ready;
|
|
116
116
|
mock: typeof mock;
|
|
117
117
|
theme: typeof theme;
|
|
118
|
-
/** This SDK's version, e.g. `'1.1.0-rc.
|
|
119
|
-
version: "1.1.0-rc.
|
|
118
|
+
/** This SDK's version, e.g. `'1.1.0-rc.3'`. */
|
|
119
|
+
version: "1.1.0-rc.3";
|
|
120
120
|
/** The manifest `"sdk"` value this build serves. */
|
|
121
121
|
sdk: "1";
|
|
122
122
|
}>;
|
package/dist/app.js
CHANGED
|
@@ -476,7 +476,7 @@ export const CubeApp = Object.freeze({
|
|
|
476
476
|
ready,
|
|
477
477
|
mock,
|
|
478
478
|
theme,
|
|
479
|
-
/** This SDK's version, e.g. `'1.1.0-rc.
|
|
479
|
+
/** This SDK's version, e.g. `'1.1.0-rc.3'`. */
|
|
480
480
|
version: VERSION,
|
|
481
481
|
/** The manifest `"sdk"` value this build serves. */
|
|
482
482
|
sdk: MANIFEST_SDK,
|