@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.
package/dist/index.d.cts CHANGED
@@ -95,6 +95,8 @@ interface IUserDTO {
95
95
  isEmailVerified: boolean;
96
96
  isPhoneVerified: boolean;
97
97
  mfaEnabled: boolean;
98
+ provider: string;
99
+ hasPassword: boolean;
98
100
  suspended: boolean;
99
101
  whitelist: boolean;
100
102
  ipWhitelist: string[];
@@ -105,6 +107,10 @@ interface ITokens {
105
107
  access: string;
106
108
  refresh: string;
107
109
  }
110
+ /** What GET /auth/providers answers: the sign-in methods this API can honour. */
111
+ interface IAuthProvidersResult {
112
+ providers: string[];
113
+ }
108
114
  interface IRegisterResult {
109
115
  tokens: ITokens;
110
116
  user: IUserDTO;
@@ -745,6 +751,25 @@ declare class AuthClient {
745
751
  readonly mfa: MfaClient;
746
752
  constructor(http: HttpClient, tokens: TokenStore);
747
753
  setAccessToken(token: string | undefined): void;
754
+ /**
755
+ * Which sign-in methods this deployment can actually honour.
756
+ *
757
+ * Public — the login screen needs it before anyone has signed in. Ask the
758
+ * server rather than shipping a build-time flag: the flag stores the same
759
+ * fact twice and lets the two disagree, and the symptom is a user clicking
760
+ * a provider the server cannot complete and landing on the provider's own
761
+ * error page, which the app cannot explain.
762
+ */
763
+ providers(): Promise<IApiResponse<IAuthProvidersResult>>;
764
+ /**
765
+ * Disconnect the OAuth provider linked to the signed-in account.
766
+ *
767
+ * Refused with 409 PASSWORD_REQUIRED when the account has no password:
768
+ * removing the only credential is account deletion, not a settings toggle.
769
+ * Check `user.hasPassword` before offering the control so the user is asked
770
+ * to set a password first rather than shown an error they can't act on.
771
+ */
772
+ unlinkOauth(provider: string): Promise<IApiResponse<null>>;
748
773
  register(input: IRegisterInput): Promise<IApiResponse<IRegisterResult>>;
749
774
  login(input: ILoginInput): Promise<IApiResponse<ILoginResult | IMfaRequiredResult>>;
750
775
  appleNative(input: IAppleNativeInput): Promise<IApiResponse<ILoginResult>>;
package/dist/index.d.ts CHANGED
@@ -95,6 +95,8 @@ interface IUserDTO {
95
95
  isEmailVerified: boolean;
96
96
  isPhoneVerified: boolean;
97
97
  mfaEnabled: boolean;
98
+ provider: string;
99
+ hasPassword: boolean;
98
100
  suspended: boolean;
99
101
  whitelist: boolean;
100
102
  ipWhitelist: string[];
@@ -105,6 +107,10 @@ interface ITokens {
105
107
  access: string;
106
108
  refresh: string;
107
109
  }
110
+ /** What GET /auth/providers answers: the sign-in methods this API can honour. */
111
+ interface IAuthProvidersResult {
112
+ providers: string[];
113
+ }
108
114
  interface IRegisterResult {
109
115
  tokens: ITokens;
110
116
  user: IUserDTO;
@@ -745,6 +751,25 @@ declare class AuthClient {
745
751
  readonly mfa: MfaClient;
746
752
  constructor(http: HttpClient, tokens: TokenStore);
747
753
  setAccessToken(token: string | undefined): void;
754
+ /**
755
+ * Which sign-in methods this deployment can actually honour.
756
+ *
757
+ * Public — the login screen needs it before anyone has signed in. Ask the
758
+ * server rather than shipping a build-time flag: the flag stores the same
759
+ * fact twice and lets the two disagree, and the symptom is a user clicking
760
+ * a provider the server cannot complete and landing on the provider's own
761
+ * error page, which the app cannot explain.
762
+ */
763
+ providers(): Promise<IApiResponse<IAuthProvidersResult>>;
764
+ /**
765
+ * Disconnect the OAuth provider linked to the signed-in account.
766
+ *
767
+ * Refused with 409 PASSWORD_REQUIRED when the account has no password:
768
+ * removing the only credential is account deletion, not a settings toggle.
769
+ * Check `user.hasPassword` before offering the control so the user is asked
770
+ * to set a password first rather than shown an error they can't act on.
771
+ */
772
+ unlinkOauth(provider: string): Promise<IApiResponse<null>>;
748
773
  register(input: IRegisterInput): Promise<IApiResponse<IRegisterResult>>;
749
774
  login(input: ILoginInput): Promise<IApiResponse<ILoginResult | IMfaRequiredResult>>;
750
775
  appleNative(input: IAppleNativeInput): Promise<IApiResponse<ILoginResult>>;
package/dist/index.js CHANGED
@@ -242,6 +242,35 @@ var AuthClient = class {
242
242
  if (!token) this.http.clearCache();
243
243
  }
244
244
  // ── Public ─────────────────────────────────────────────────────────────────
245
+ /**
246
+ * Which sign-in methods this deployment can actually honour.
247
+ *
248
+ * Public — the login screen needs it before anyone has signed in. Ask the
249
+ * server rather than shipping a build-time flag: the flag stores the same
250
+ * fact twice and lets the two disagree, and the symptom is a user clicking
251
+ * a provider the server cannot complete and landing on the provider's own
252
+ * error page, which the app cannot explain.
253
+ */
254
+ providers() {
255
+ return this.http.request({
256
+ method: "GET",
257
+ path: "/auth/providers"
258
+ });
259
+ }
260
+ /**
261
+ * Disconnect the OAuth provider linked to the signed-in account.
262
+ *
263
+ * Refused with 409 PASSWORD_REQUIRED when the account has no password:
264
+ * removing the only credential is account deletion, not a settings toggle.
265
+ * Check `user.hasPassword` before offering the control so the user is asked
266
+ * to set a password first rather than shown an error they can't act on.
267
+ */
268
+ unlinkOauth(provider) {
269
+ return this.http.request({
270
+ method: "DELETE",
271
+ path: `/auth/oauth/${encodeURIComponent(provider)}`
272
+ });
273
+ }
245
274
  register(input) {
246
275
  return this.http.request({
247
276
  method: "POST",