@amedia/user 0.14.121 → 0.14.123

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.
Files changed (3) hide show
  1. package/README.md +5 -5
  2. package/dist/user.d.ts +10 -3
  3. package/package.json +27 -27
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> | ["newspaper"] |
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
- The default is [`newspaper`].
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 'newspaper' to 'plussalt' for instance. You might want to give a different user experience to users with some access than users with no access.
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 newspaper access.',
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
@@ -22,8 +22,7 @@ type PrivacyPreferences = {
22
22
  personalizedContent: boolean;
23
23
  };
24
24
 
25
- declare const DEFAULT_CLIENT_ID = "default";
26
- type ClientId = string | typeof DEFAULT_CLIENT_ID;
25
+ type ClientId = string;
27
26
 
28
27
  type NamespaceList = Array<string>;
29
28
 
@@ -92,9 +91,13 @@ type SiteAccessResponse = {
92
91
  accessFeatures: string[];
93
92
  };
94
93
  declare class SiteAccessRequest {
95
- private siteDomain;
96
94
  private requiredAccessFeatures;
95
+ private siteDomain;
96
+ constructor(requiredAccessFeatures?: Array<string>);
97
97
  withSiteDomain(siteDomain: string): this;
98
+ /**
99
+ * @deprecated Required now. Set in constructor
100
+ */
98
101
  withAccessFeatures(accessFeatures: Array<string>): this;
99
102
  requestAccess(): Promise<SiteAccessResponse>;
100
103
  }
@@ -105,7 +108,11 @@ declare class PaywallUnlockRequest {
105
108
  private reload;
106
109
  private requestedUrl;
107
110
  private siteDomain;
111
+ constructor(requestedAccessFeatures?: string[]);
108
112
  withSiteDomain(domain: string): this;
113
+ /**
114
+ * @deprecated Required now. Set in constructor
115
+ */
109
116
  withAccessFeatures(accessFeatures: string[]): this;
110
117
  reloadOnAccess(): this;
111
118
  redirectOnAccess(requestedUrl: string): this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amedia/user",
3
- "version": "0.14.121",
3
+ "version": "0.14.123",
4
4
  "description": "Client lib for working with aID user and associated data",
5
5
  "repository": "https://github.com/amedia/amedia-user-js",
6
6
  "author": "Amedia Utvikling (ID og data)",
@@ -43,33 +43,33 @@
43
43
  "postpublish": "npm run build && npx @eik/cli publish"
44
44
  },
45
45
  "dependencies": {
46
- "@amedia/browserid": "^1.0.17",
47
- "@amedia/frontend-rpc": "^0.0.12",
48
- "runtypes": "^6.7.0",
49
- "ts-deepmerge": "^6.2.0"
46
+ "@amedia/browserid": "1.0.17",
47
+ "@amedia/frontend-rpc": "0.0.12",
48
+ "runtypes": "6.7.0",
49
+ "ts-deepmerge": "6.2.0"
50
50
  },
51
51
  "devDependencies": {
52
- "@amedia/kragl": "^3.0.0",
53
- "@amedia/prettier-config": "^1.0.5",
54
- "@changesets/changelog-github": "^0.5.0",
55
- "@changesets/cli": "^2.27.1",
56
- "@eik/esbuild-plugin": "^1.1.47",
57
- "@types/jest": "^29.5.12",
58
- "@types/node": "^20.12.10",
59
- "concurrently": "^8.2.2",
60
- "cors": "^2.8.5",
61
- "esbuild": "0.21.1",
62
- "express": "^4.19.2",
63
- "jest": "^29.7.0",
64
- "jest-environment-jsdom": "^29.7.0",
65
- "jest-extended": "^4.0.2",
66
- "jest-fetch-mock": "^3.0.3",
67
- "mockdate": "^3.0.5",
68
- "npm-run-all": "^4.1.5",
69
- "rollup": "4.17.2",
70
- "rollup-plugin-dts": "6.1.0",
71
- "ts-jest": "^29.1.2",
72
- "tslib": "^2.6.2",
73
- "typescript": "^5.4.5"
52
+ "@amedia/kragl": "3.0.0",
53
+ "@amedia/prettier-config": "1.0.6",
54
+ "@changesets/changelog-github": "0.5.0",
55
+ "@changesets/cli": "2.27.5",
56
+ "@eik/esbuild-plugin": "1.1.47",
57
+ "@types/jest": "29.5.12",
58
+ "@types/node": "20.14.2",
59
+ "concurrently": "8.2.2",
60
+ "cors": "2.8.5",
61
+ "esbuild": "0.21.5",
62
+ "express": "4.19.2",
63
+ "jest": "29.7.0",
64
+ "jest-environment-jsdom": "29.7.0",
65
+ "jest-extended": "4.0.2",
66
+ "jest-fetch-mock": "3.0.3",
67
+ "mockdate": "3.0.5",
68
+ "npm-run-all": "4.1.5",
69
+ "rollup": "4.18.0",
70
+ "rollup-plugin-dts": "6.1.1",
71
+ "ts-jest": "29.1.4",
72
+ "tslib": "2.6.3",
73
+ "typescript": "5.4.5"
74
74
  }
75
75
  }