@amedia/user 0.14.142 → 0.14.143

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
@@ -282,6 +282,11 @@ If you need to ensure the latest data is available, you may request a data refre
282
282
 
283
283
  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
284
 
285
+ ### `pollForAccess(requredAccessFeatures = ['pluss'], timeout_millis = 3000): Promise<true>`
286
+
287
+ Polling for expected access. Will either return true when required access
288
+ features are attained, or TimeoutError.
289
+
285
290
  ### `aidUrls: Record<string, URL>`
286
291
 
287
292
  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/user.d.ts CHANGED
@@ -140,6 +140,20 @@ declare class ValidationError extends Error {
140
140
  constructor(code: string, message: string);
141
141
  }
142
142
 
143
+ declare class TimeoutError extends Error {
144
+ }
145
+ /**
146
+ * Poll for access on current site.
147
+ * Use this when you expect the reader to have gained access, but need to
148
+ * be sure before telling the reader that everything's good.
149
+ *
150
+ * @throws EmergencyModeError if in emergency mode
151
+ * @throws TimeoutError if access cannot be attained within given timeout
152
+ * @throws Error if unknown error
153
+ * @returns true
154
+ */
155
+ declare function pollForAccess(requiredAccessFeatures?: string[], timeout_millis?: number): Promise<true>;
156
+
143
157
  type LoginPageParams = {
144
158
  requestedUrl?: string;
145
159
  context?: string;
@@ -162,5 +176,5 @@ declare const aidUrls: {
162
176
  sites: URL;
163
177
  };
164
178
 
165
- export { EmergencyModeError, FetchTimeoutError, PaywallError, PaywallUnlockRequest, SiteAccessRequest, UserDataRequest, ValidationError, aidUrls, getLoginUrl, goToLoginPage, logout, requestDataRefresh };
179
+ export { EmergencyModeError, FetchTimeoutError, PaywallError, PaywallUnlockRequest, SiteAccessRequest, TimeoutError, UserDataRequest, ValidationError, aidUrls, getLoginUrl, goToLoginPage, logout, pollForAccess, requestDataRefresh };
166
180
  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.143",
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",
56
+ "@changesets/cli": "2.29.4",
57
57
  "@eik/esbuild-plugin": "1.1.54",
58
58
  "@types/jest": "29.5.14",
59
- "@types/node": "22.15.17",
59
+ "@types/node": "22.15.19",
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.0",
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
  }