@amedia/user 0.14.142 → 0.14.144

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 CHANGED
@@ -65,6 +65,7 @@ Attributes are data directly related to the user, with the exception of access.
65
65
  | access | Array<string> | Users access on current site (list of access features) |
66
66
  | extraData | Record<string,unknown> | Data that has been modelled about the user (gender, ad segments etc. from Nebula) |
67
67
  | privacyPreferences | [PrivacyPreferences](https://github.com/amedia/amedia-user-js/blob/master/src/types.ts#L16) | Privacy preferences set on Min aID. |
68
+ | sessionTrackingKey | string | Tracking key for the user session |
68
69
 
69
70
  Attributes are requested by calling `.withAttributes(attributes: Array<string>)` on a `UserDataRequest` with a list of the attributes you need.
70
71
 
@@ -282,6 +283,11 @@ If you need to ensure the latest data is available, you may request a data refre
282
283
 
283
284
  This action will log the user out of aID. The logout is global, meaning it will log the session out of all sites and aid.no. After logout has completed the promise will resolve, giving your app the opportunity to reset state / reload the page etc.
284
285
 
286
+ ### `pollForAccess(requredAccessFeatures = ['pluss'], timeout_millis = 3000): Promise<true>`
287
+
288
+ Polling for expected access. Will either return true when required access
289
+ features are attained, or TimeoutError.
290
+
285
291
  ### `aidUrls: Record<string, URL>`
286
292
 
287
293
  Get various, environment aware, URLs to pages often linked to from other apps. This includes pages like the aID profile page, Terms of Service, Privacy Statement, Privacy Preferences, Family Sharing and the like.
package/dist/personas.js CHANGED
@@ -74,6 +74,7 @@ export default {
74
74
  personalizedAds: true,
75
75
  personalizedContent: true,
76
76
  },
77
+ sessionTrackingKey: 'session-tracking-key',
77
78
  },
78
79
  state: {
79
80
  isLoggedIn: true,
package/dist/user.d.ts CHANGED
@@ -11,6 +11,7 @@ type UserAttributes = {
11
11
  };
12
12
  access: AccessFeatures;
13
13
  privacyPreferences: PrivacyPreferences | null;
14
+ sessionTrackingKey: string | null;
14
15
  };
15
16
  type State = {
16
17
  isLoggedIn: boolean;
@@ -140,6 +141,20 @@ declare class ValidationError extends Error {
140
141
  constructor(code: string, message: string);
141
142
  }
142
143
 
144
+ declare class TimeoutError extends Error {
145
+ }
146
+ /**
147
+ * Poll for access on current site.
148
+ * Use this when you expect the reader to have gained access, but need to
149
+ * be sure before telling the reader that everything's good.
150
+ *
151
+ * @throws EmergencyModeError if in emergency mode
152
+ * @throws TimeoutError if access cannot be attained within given timeout
153
+ * @throws Error if unknown error
154
+ * @returns true
155
+ */
156
+ declare function pollForAccess(requiredAccessFeatures?: string[], timeout_millis?: number): Promise<true>;
157
+
143
158
  type LoginPageParams = {
144
159
  requestedUrl?: string;
145
160
  context?: string;
@@ -162,5 +177,5 @@ declare const aidUrls: {
162
177
  sites: URL;
163
178
  };
164
179
 
165
- export { EmergencyModeError, FetchTimeoutError, PaywallError, PaywallUnlockRequest, SiteAccessRequest, UserDataRequest, ValidationError, aidUrls, getLoginUrl, goToLoginPage, logout, requestDataRefresh };
180
+ export { EmergencyModeError, FetchTimeoutError, PaywallError, PaywallUnlockRequest, SiteAccessRequest, TimeoutError, UserDataRequest, ValidationError, aidUrls, getLoginUrl, goToLoginPage, logout, pollForAccess, requestDataRefresh };
166
181
  export type { PaywallUnlockResponse, PrivacyPreferences, SiteAccessResponse, State, UserAttributes };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amedia/user",
3
- "version": "0.14.142",
3
+ "version": "0.14.144",
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)",
@@ -53,10 +53,10 @@
53
53
  "@amedia/kragl": "5.0.6",
54
54
  "@amedia/prettier-config": "2.0.1",
55
55
  "@changesets/changelog-github": "0.5.1",
56
- "@changesets/cli": "2.29.3",
57
- "@eik/esbuild-plugin": "1.1.54",
56
+ "@changesets/cli": "2.29.4",
57
+ "@eik/esbuild-plugin": "2.0.1",
58
58
  "@types/jest": "29.5.14",
59
- "@types/node": "22.15.17",
59
+ "@types/node": "22.15.21",
60
60
  "concurrently": "9.1.2",
61
61
  "cors": "2.8.5",
62
62
  "esbuild": "0.25.4",
@@ -67,9 +67,9 @@
67
67
  "jest-fetch-mock": "3.0.3",
68
68
  "mockdate": "3.0.5",
69
69
  "npm-run-all": "4.1.5",
70
- "rollup": "4.40.2",
70
+ "rollup": "4.41.1",
71
71
  "rollup-plugin-dts": "6.2.1",
72
- "ts-jest": "29.3.2",
72
+ "ts-jest": "29.3.4",
73
73
  "tslib": "2.8.1",
74
74
  "typescript": "5.8.3"
75
75
  }