@amedia/user 0.14.121 → 0.14.122
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 +5 -5
- package/dist/user.d.ts +9 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -138,7 +138,7 @@ Current elements in the array `nonUserAccess`:
|
|
|
138
138
|
| name | type | descriptions |
|
|
139
139
|
| -------------- | ------------- | -------------------- |
|
|
140
140
|
| customer | string | "conocophillips" etc |
|
|
141
|
-
| accessFeatures | Array<string> | ["
|
|
141
|
+
| accessFeatures | Array<string> | ["pluss"] |
|
|
142
142
|
|
|
143
143
|
### Executing the request
|
|
144
144
|
|
|
@@ -332,8 +332,7 @@ To unlock the paywall, you first need to create a new `PaywallUnlockRequest`. On
|
|
|
332
332
|
- `redirectOnAccess(requestedUrl: string)`: If the paywall unlocker finds sufficient access for the user, it will send the user
|
|
333
333
|
to `requestedUrl`. (Provides more flexibility than `reloadOnAccess()`)
|
|
334
334
|
- `withAccessFeatures(accessFeatures: string[])`: Specify what access features will give access to the current content.
|
|
335
|
-
|
|
336
|
-
- `withSiteDomain(domain: string)`: Specify which site we to attempt activation against. The default is the current domain. This is mostly useful for direktesport.no which often knows what domain the user came from.
|
|
335
|
+
- `withSiteDomain(domain: string)`: Specify which site we to attempt activation against. The default is the current domain. This is mostly useful for alt.no which often knows what domain the user came from.
|
|
337
336
|
- **DEPRECATED**: This will fail if you attempt to unlock a paywall on a page without a paywall or its own access features. Feature will be removed in the next major release. Use [SiteAccessRequest](#activating-subscriptions--finding-upgrade-path) instead.
|
|
338
337
|
|
|
339
338
|
More details about the access model can be found here: [Access model](https://amedia.slite.com/app/channels/hOlqx3Miez/notes/nhG2Ok39BN)
|
|
@@ -344,7 +343,7 @@ The resolution to the promise contains an object with attributes you can use to
|
|
|
344
343
|
|
|
345
344
|
- isLoggedIn: True if the user is logged in, false otherwise. Useful if you want to show a login button, which makes no sense for logged in users.
|
|
346
345
|
- hasAccess: True if the user has access. Always false if you called `reloadOnAccess()` or `redirectOnAccess()`.
|
|
347
|
-
- accessFeatures: List of access features the user has access to. Empty list if user is logged out or has no access. This list is useful if you want to upgrade from '
|
|
346
|
+
- accessFeatures: List of access features the user has access to. Empty list if user is logged out or has no access. This list is useful if you want to upgrade from 'pluss' to 'plussalt' for instance. You might want to give a different user experience to users with some access than users with no access.
|
|
348
347
|
|
|
349
348
|
Full usage example:
|
|
350
349
|
|
|
@@ -352,6 +351,7 @@ Full usage example:
|
|
|
352
351
|
import { PaywallUnlockRequest } from '...';
|
|
353
352
|
|
|
354
353
|
new PaywallUnlockRequest()
|
|
354
|
+
.withAccessFeatures(['pluss'])
|
|
355
355
|
.redirectOnAccess('https://my.neat/place') // Optional
|
|
356
356
|
.reloadOnAccess() // Optional
|
|
357
357
|
.tryUnlock()
|
|
@@ -371,7 +371,7 @@ new PaywallUnlockRequest()
|
|
|
371
371
|
|
|
372
372
|
// Internal error. Access should have been granted at this time.
|
|
373
373
|
PaywallError(
|
|
374
|
-
'New subscription was attached and checked successfully, but internal systems disagree about current
|
|
374
|
+
'New subscription was attached and checked successfully, but internal systems disagree about current site access.',
|
|
375
375
|
PaywallError.ERROR_NO_ACCESS_AFTER_SUCCESSFUL_ACTIVATION_WITH_REQUESTED_ACCESS_FEATURES
|
|
376
376
|
);
|
|
377
377
|
|
package/dist/user.d.ts
CHANGED
|
@@ -92,9 +92,13 @@ type SiteAccessResponse = {
|
|
|
92
92
|
accessFeatures: string[];
|
|
93
93
|
};
|
|
94
94
|
declare class SiteAccessRequest {
|
|
95
|
-
private siteDomain;
|
|
96
95
|
private requiredAccessFeatures;
|
|
96
|
+
private siteDomain;
|
|
97
|
+
constructor(requiredAccessFeatures?: Array<string>);
|
|
97
98
|
withSiteDomain(siteDomain: string): this;
|
|
99
|
+
/**
|
|
100
|
+
* @deprecated Required now. Set in constructor
|
|
101
|
+
*/
|
|
98
102
|
withAccessFeatures(accessFeatures: Array<string>): this;
|
|
99
103
|
requestAccess(): Promise<SiteAccessResponse>;
|
|
100
104
|
}
|
|
@@ -105,7 +109,11 @@ declare class PaywallUnlockRequest {
|
|
|
105
109
|
private reload;
|
|
106
110
|
private requestedUrl;
|
|
107
111
|
private siteDomain;
|
|
112
|
+
constructor(requestedAccessFeatures?: string[]);
|
|
108
113
|
withSiteDomain(domain: string): this;
|
|
114
|
+
/**
|
|
115
|
+
* @deprecated Required now. Set in constructor
|
|
116
|
+
*/
|
|
109
117
|
withAccessFeatures(accessFeatures: string[]): this;
|
|
110
118
|
reloadOnAccess(): this;
|
|
111
119
|
redirectOnAccess(requestedUrl: string): this;
|
package/package.json
CHANGED