@amedia/user 1.2.0 → 1.2.2

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/CHANGELOG.md +12 -0
  2. package/index.d.ts +31 -17
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @amedia/user
2
2
 
3
+ ## 1.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1223](https://github.com/amedia/amedia-user-js/pull/1223) [`b6150f1`](https://github.com/amedia/amedia-user-js/commit/b6150f1fedbdc28b523eeb4bc9067e79d5416b81) Thanks [@csandven](https://github.com/csandven)! - FedCM clientId from Eris
8
+
9
+ ## 1.2.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#1217](https://github.com/amedia/amedia-user-js/pull/1217) [`470702b`](https://github.com/amedia/amedia-user-js/commit/470702b724b42a0f780701548289456ee81d80c1) Thanks [@csandven](https://github.com/csandven)! - Tests and classes refactor
14
+
3
15
  ## 1.2.0
4
16
 
5
17
  ### Minor Changes
package/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as v from 'valibot';
2
2
 
3
3
  type AccessFeatures = string[];
4
- type UserAttributes = {
4
+ interface UserAttributes {
5
5
  uuid: string | null;
6
6
  name: string | null;
7
7
  trackingKey: string | null;
@@ -14,19 +14,24 @@ type UserAttributes = {
14
14
  /** @deprecated Returns false for all keys. CMP data is now used. */
15
15
  privacyPreferences: PrivacyPreferences | null;
16
16
  sessionTrackingKey: string | null;
17
- };
18
- type State = {
17
+ }
18
+ interface State {
19
19
  isLoggedIn: boolean;
20
20
  isCircuitBreakerTripped?: boolean;
21
21
  emergencyMode?: string[];
22
- };
22
+ }
23
23
  /**
24
24
  * @deprecated This is set to false as default. CMP data is now used.
25
25
  */
26
- type PrivacyPreferences = {
27
- allowResearchUsage: boolean;
28
- personalizedContent: boolean;
29
- };
26
+ declare class PrivacyPreferences {
27
+ readonly allowResearchUsage: boolean;
28
+ readonly personalizedContent: boolean;
29
+ constructor(data: {
30
+ allowResearchUsage: boolean;
31
+ personalizedContent: boolean;
32
+ });
33
+ static default(): PrivacyPreferences;
34
+ }
30
35
 
31
36
  type ClientId = string;
32
37
 
@@ -89,12 +94,21 @@ declare const PrimarySiteSchema: v.ObjectSchema<{
89
94
  }, undefined>;
90
95
  type PrimarySite = v.InferOutput<typeof PrimarySiteSchema>;
91
96
 
92
- type SiteAccessResponse = {
93
- isLoggedIn: boolean;
94
- hasAccess: boolean;
95
- primarySite?: null | PrimarySite;
96
- accessFeatures: string[];
97
- };
97
+ declare class SiteAccessResponse {
98
+ readonly isLoggedIn: boolean;
99
+ readonly hasAccess: boolean;
100
+ readonly primarySite?: PrimarySite | null;
101
+ readonly accessFeatures: string[];
102
+ constructor(data: {
103
+ isLoggedIn: boolean;
104
+ hasAccess: boolean;
105
+ primarySite?: PrimarySite | null;
106
+ accessFeatures: string[];
107
+ });
108
+ static notLoggedIn(): SiteAccessResponse;
109
+ static granted(accessFeatures: string[]): SiteAccessResponse;
110
+ static denied(accessFeatures: string[], primarySite?: PrimarySite | null): SiteAccessResponse;
111
+ }
98
112
  declare class SiteAccessRequest {
99
113
  private requiredAccessFeatures;
100
114
  private siteDomain;
@@ -128,10 +142,10 @@ declare class FetchTimeoutError extends Error {
128
142
  }
129
143
 
130
144
  declare class PaywallError extends Error {
145
+ code: string;
131
146
  static ERROR_RELOADED_NO_ACCESS: string;
132
147
  static ERROR_ENABLING_ACCESS_FAILED: string;
133
148
  static ERROR_NO_ACCESS_AFTER_SUCCESSFUL_ACTIVATION_WITH_REQUESTED_ACCESS_FEATURES: string;
134
- code: string;
135
149
  constructor(message: string, code: string);
136
150
  }
137
151
 
@@ -182,5 +196,5 @@ declare const aidUrls: {
182
196
  sites: URL;
183
197
  };
184
198
 
185
- export { EmergencyModeError, FetchTimeoutError, PaywallError, PaywallUnlockRequest, SiteAccessRequest, TimeoutError, UserDataRequest, ValidationError, aidUrls, getLoginUrl, goToLoginPage, logout, pollForAccess, requestDataRefresh };
186
- export type { PaywallUnlockResponse, PrivacyPreferences, SiteAccessResponse, State, UserAttributes };
199
+ export { EmergencyModeError, FetchTimeoutError, PaywallError, PaywallUnlockRequest, PrivacyPreferences, SiteAccessRequest, SiteAccessResponse, TimeoutError, UserDataRequest, ValidationError, aidUrls, getLoginUrl, goToLoginPage, logout, pollForAccess, requestDataRefresh };
200
+ export type { PaywallUnlockResponse, State, UserAttributes };
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "url": "git+https://github.com/amedia/amedia-user-js.git"
7
7
  },
8
8
  "author": "Amedia Produkt og Teknologi AS (https://amedia.no)",
9
- "version": "1.2.0",
9
+ "version": "1.2.2",
10
10
  "type": "module",
11
11
  "types": "./index.d.ts",
12
12
  "publishConfig": {