@panelwave/player 1.0.1 → 1.1.0
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 +31 -5
- package/fesm2022/panelwave-player.mjs +465 -139
- package/fesm2022/panelwave-player.mjs.map +1 -1
- package/index.d.ts +181 -22
- package/package.json +1 -1
- package/src/assets/i18n/de.json +26 -1
- package/src/assets/i18n/en.json +26 -1
package/README.md
CHANGED
|
@@ -53,8 +53,10 @@ it into a complete reading experience:
|
|
|
53
53
|
|
|
54
54
|
Stories are authored in the PanelWave CMS or written by hand against the
|
|
55
55
|
[open JSON Schema](https://github.com/panelwave/schema). The player supports
|
|
56
|
-
|
|
57
|
-
typography style presets
|
|
56
|
+
manifests up to format 1.6 (video panels, edge-transition inheritance,
|
|
57
|
+
typography style presets, the infinite canvas, paywall rules unlocked by any
|
|
58
|
+
of several products, each Buy option named and priced from `paywall.products`; 1.5's asset folders and localization blocks are
|
|
59
|
+
authoring metadata the player doesn't need).
|
|
58
60
|
|
|
59
61
|
## Installation
|
|
60
62
|
|
|
@@ -153,12 +155,19 @@ You can also pass a manifest object instead of a URL: `[manifest]="manifest"`
|
|
|
153
155
|
| `initialChapterId` / `initialPanelId` | `string` | | Start at a specific position (otherwise: bookmark, then chapter entry) |
|
|
154
156
|
| `initialVariables` | `Record<string, unknown>` | | Seed story variables once at start. May set `readOnly` variables, e.g. a verified `user.age` from your account system |
|
|
155
157
|
| `showToolbar` | `boolean` | `false` | Show the reader toolbar |
|
|
156
|
-
| `autoplay`
|
|
158
|
+
| `autoplay` | `boolean` | `false` | Start auto-advancing; the reader's toolbar toggle takes over afterwards |
|
|
159
|
+
| `secondsPerPanel` | `number` | `5` | Autoplay interval |
|
|
157
160
|
| `reducedMotion` | `boolean` | `false` | Force reduced motion (the OS setting and the reader's preference also apply) |
|
|
158
161
|
| `viewModeOverride` | `'auto' \| 'panel' \| 'canvas'` | `'auto'` | Force panel or infinite-canvas view |
|
|
159
162
|
| `entitlementSnapshot` | `EntitlementSnapshot` | anonymous | What the reader owns; turns the manifest's `paywall.rules` on |
|
|
160
163
|
| `entitlementEndpoint` / `readerToken` | `string` | | Let the player fetch the snapshot itself (`{workId}` is substituted) |
|
|
161
164
|
|
|
165
|
+
Inputs may change after init: a new `manifest` / `manifestUrl` reloads the
|
|
166
|
+
work (position, non-persistent variables, open overlays and autoplay reset),
|
|
167
|
+
a new `entitlementSnapshot` re-evaluates the gates, and `locale`,
|
|
168
|
+
`viewModeOverride`, `showToolbar`, `reducedMotion`, `secondsPerPanel` and
|
|
169
|
+
`autoplay` apply live.
|
|
170
|
+
|
|
162
171
|
### Outputs
|
|
163
172
|
|
|
164
173
|
| Output | Payload | Fires when |
|
|
@@ -170,7 +179,7 @@ You can also pass a manifest object instead of a URL: `[manifest]="manifest"`
|
|
|
170
179
|
| `localeChange` | `LocaleCode` | The language is switched |
|
|
171
180
|
| `navigationAttempt` | `{ direction, target? }` | Any navigation attempt, allowed or not |
|
|
172
181
|
| `cameraChange` | `CameraState` | The canvas-view camera moves |
|
|
173
|
-
| `paywallAction` | `{ action, gate }` | The reader clicks purchase
|
|
182
|
+
| `paywallAction` | `{ action, gate, productId? }` | The reader clicks Buy (`purchase`), Subscribe (`subscribe`), Sign in (`login`) or Maybe later (`dismiss`) on a paywall; `productId` is the chosen product id or tier |
|
|
174
183
|
| `ageVerified` | `AgeVerificationResult` | The reader answers an age gate |
|
|
175
184
|
| `likeChange` / `bookmarkChange` | `{ workId, … }` | Like or bookmark toggled (also stored locally) |
|
|
176
185
|
| `error` | `Error` | A loading or runtime error happens |
|
|
@@ -184,12 +193,29 @@ reader owns, and handle checkout yourself:
|
|
|
184
193
|
<pw-player-shell
|
|
185
194
|
[manifestUrl]="url"
|
|
186
195
|
[entitlementSnapshot]="{ subscriptionTier: null, purchasedProductIds: ['chapter-2'], ageVerified: false }"
|
|
187
|
-
(paywallAction)="
|
|
196
|
+
(paywallAction)="onPaywall($event)" />
|
|
188
197
|
```
|
|
189
198
|
|
|
190
199
|
Readers without access see the free preview and a paywall overlay, and
|
|
191
200
|
navigation stops at the gate. Works without paywall rules aren't affected.
|
|
192
201
|
|
|
202
|
+
- **Scopes:** `work` rules gate everything after their free preview;
|
|
203
|
+
`chapter` rules gate only the chapter named by `refId`, with the preview
|
|
204
|
+
counted within that chapter; `panel` rules gate exactly their panels;
|
|
205
|
+
`extras` rules lock an extras block, never panels.
|
|
206
|
+
- **Age:** `ageGate` / `minimumAge` is checked on top of the rule's
|
|
207
|
+
entitlement. The reader answers the age gate first, then gets the paywall
|
|
208
|
+
if the purchase or subscription is still missing.
|
|
209
|
+
- **Buy / Subscribe:** the overlay offers a Buy option per product of a
|
|
210
|
+
purchase rule and a Subscribe option per tier of a subscription rule (name,
|
|
211
|
+
description and price from the rule), next to Sign in and Maybe later.
|
|
212
|
+
`paywallAction` emits `{ action: 'purchase' | 'subscribe' | 'login' |
|
|
213
|
+
'dismiss', gate, productId? }`; the options are also on `gate.options`.
|
|
214
|
+
- **After checkout:** call `refreshEntitlements(snapshot)` on the shell or
|
|
215
|
+
pass a new `entitlementSnapshot`; the overlay closes once the reader is
|
|
216
|
+
through. Story keys and swipes do nothing while the paywall or the age
|
|
217
|
+
gate is open.
|
|
218
|
+
|
|
193
219
|
### Going further
|
|
194
220
|
|
|
195
221
|
The package also exports the services and building blocks behind the shell:
|