@fonderie/client 0.21.0 → 0.23.0

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.
@@ -142,6 +142,8 @@ interface IUpdateProfileInput {
142
142
  new AuthClient(http: HttpClient, tokens: TokenStore): AuthClient
143
143
  .mfa: MfaClient
144
144
  .setAccessToken(token: string | undefined): void
145
+ .providers(): Promise<IApiResponse<IAuthProvidersResult>>
146
+ .unlinkOauth(provider: string): Promise<IApiResponse<null>>
145
147
  .register(input: IRegisterInput): Promise<IApiResponse<IRegisterResult>>
146
148
  .login(input: ILoginInput): Promise<IApiResponse<ILoginResult | IMfaRequiredResult>>
147
149
  .appleNative(input: IAppleNativeInput): Promise<IApiResponse<ILoginResult>>
@@ -1054,6 +1056,8 @@ interface IUserDTO {
1054
1056
  isEmailVerified: boolean;
1055
1057
  isPhoneVerified: boolean;
1056
1058
  mfaEnabled: boolean;
1059
+ provider: string;
1060
+ hasPassword: boolean;
1057
1061
  suspended: boolean;
1058
1062
  whitelist: boolean;
1059
1063
  ipWhitelist: string[];
package/dist/index.cjs CHANGED
@@ -280,6 +280,35 @@ var AuthClient = class {
280
280
  if (!token) this.http.clearCache();
281
281
  }
282
282
  // ── Public ─────────────────────────────────────────────────────────────────
283
+ /**
284
+ * Which sign-in methods this deployment can actually honour.
285
+ *
286
+ * Public — the login screen needs it before anyone has signed in. Ask the
287
+ * server rather than shipping a build-time flag: the flag stores the same
288
+ * fact twice and lets the two disagree, and the symptom is a user clicking
289
+ * a provider the server cannot complete and landing on the provider's own
290
+ * error page, which the app cannot explain.
291
+ */
292
+ providers() {
293
+ return this.http.request({
294
+ method: "GET",
295
+ path: "/auth/providers"
296
+ });
297
+ }
298
+ /**
299
+ * Disconnect the OAuth provider linked to the signed-in account.
300
+ *
301
+ * Refused with 409 PASSWORD_REQUIRED when the account has no password:
302
+ * removing the only credential is account deletion, not a settings toggle.
303
+ * Check `user.hasPassword` before offering the control so the user is asked
304
+ * to set a password first rather than shown an error they can't act on.
305
+ */
306
+ unlinkOauth(provider) {
307
+ return this.http.request({
308
+ method: "DELETE",
309
+ path: `/auth/oauth/${encodeURIComponent(provider)}`
310
+ });
311
+ }
283
312
  register(input) {
284
313
  return this.http.request({
285
314
  method: "POST",