b5-api-client 0.0.26 → 0.0.28

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.
@@ -8,12 +8,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var _a;
11
12
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.FirebaseUnifiedService = exports.AuthResult = exports.UserData = exports.AuthState = exports.AuthProvider = void 0;
13
+ exports.FirebaseService = exports.AuthResult = exports.UserData = exports.AuthProvider = void 0;
13
14
  const app_1 = require("firebase/app");
14
15
  const auth_1 = require("firebase/auth");
15
16
  const messaging_1 = require("firebase/messaging");
16
17
  const UserContext_1 = require("./UserContext");
18
+ const DEFAULT_EMAIL_VERIFICATION_PAGE = (_a = process.env.NEXT_PUBLIC_EMAIL_VERIFICATION_URL) !== null && _a !== void 0 ? _a : "http://localhost:3000/auth/email-verified";
19
+ const trimTrailingSlash = (value) => value.replace(/\/+$/, "");
20
+ const appendQueryParams = (base, params) => {
21
+ const query = Object.entries(params)
22
+ .filter(([, value]) => value !== undefined && value !== null)
23
+ .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
24
+ .join("&");
25
+ if (!query) {
26
+ return base;
27
+ }
28
+ const separator = base.includes("?") ? "&" : "?";
29
+ return `${base}${separator}${query}`;
30
+ };
17
31
  // Auth provider type for better type safety
18
32
  var AuthProvider;
19
33
  (function (AuthProvider) {
@@ -22,22 +36,6 @@ var AuthProvider;
22
36
  AuthProvider["FACEBOOK"] = "FACEBOOK";
23
37
  AuthProvider["TWITTER"] = "TWITTER";
24
38
  })(AuthProvider = exports.AuthProvider || (exports.AuthProvider = {}));
25
- // Immutable auth state class
26
- class AuthState {
27
- constructor(isAuthenticated, user, provider) {
28
- this.isAuthenticated = isAuthenticated;
29
- this.user = user;
30
- this.provider = provider;
31
- }
32
- static authenticated(user, provider) {
33
- return new AuthState(true, user, provider);
34
- }
35
- static unauthenticated() {
36
- return new AuthState(false, null, null);
37
- }
38
- }
39
- exports.AuthState = AuthState;
40
- // Enhanced UserData class with additional safety
41
39
  class UserData {
42
40
  constructor(id, email, username, isEmailVerified, idToken, isAdmin) {
43
41
  this.id = id;
@@ -73,21 +71,33 @@ class AuthResult {
73
71
  }
74
72
  }
75
73
  exports.AuthResult = AuthResult;
76
- class FirebaseUnifiedService {
77
- constructor(client, config) {
78
- var _a;
74
+ class FirebaseService {
75
+ constructor(backendClient, firebaseLoginConfig) {
76
+ var _a, _b, _c, _d;
79
77
  this.app = null;
80
78
  this.messaging = null;
81
79
  this.auth = null;
82
- this.client = client;
83
- this.actionCodeSettings = (_a = config === null || config === void 0 ? void 0 : config.actionCodeSettings) !== null && _a !== void 0 ? _a : {
84
- url: 'http://localhost:3000/auth/verify-email',
85
- handleCodeInApp: true,
80
+ this.client = backendClient;
81
+ const fallbackVerificationPage = (_a = firebaseLoginConfig === null || firebaseLoginConfig === void 0 ? void 0 : firebaseLoginConfig.emailVerificationUrl) !== null && _a !== void 0 ? _a : DEFAULT_EMAIL_VERIFICATION_PAGE;
82
+ this.emailVerificationUrl = trimTrailingSlash(fallbackVerificationPage);
83
+ this.emailVerificationContinueUrl = firebaseLoginConfig === null || firebaseLoginConfig === void 0 ? void 0 : firebaseLoginConfig.emailVerificationContinueUrl;
84
+ const configuredActionSettings = firebaseLoginConfig === null || firebaseLoginConfig === void 0 ? void 0 : firebaseLoginConfig.actionCodeSettings;
85
+ const defaultActionUrl = (_c = (_b = configuredActionSettings === null || configuredActionSettings === void 0 ? void 0 : configuredActionSettings.url) !== null && _b !== void 0 ? _b : process.env.REACT_APP_EMAIL_LINK_URL) !== null && _c !== void 0 ? _c : process.env.NEXT_PUBLIC_EMAIL_LINK_URL;
86
+ this.actionCodeSettings = {
87
+ url: defaultActionUrl !== null && defaultActionUrl !== void 0 ? defaultActionUrl : "http://localhost:3000/auth/verify-email",
88
+ handleCodeInApp: (_d = configuredActionSettings === null || configuredActionSettings === void 0 ? void 0 : configuredActionSettings.handleCodeInApp) !== null && _d !== void 0 ? _d : true,
86
89
  };
87
- this.initializeFirebase();
90
+ // Set the auth token provider first (before initialization)
91
+ // It will gracefully return null until auth is ready
92
+ this.client.setAuthTokenProvider(this.buildAuthTokenProvider());
93
+ // Start initialization (this will fetch config, which needs to work without auth)
94
+ this.initializationPromise = this.initializeFirebase();
88
95
  }
89
96
  initializeFirebase() {
90
97
  return __awaiter(this, void 0, void 0, function* () {
98
+ if (this.app) {
99
+ return;
100
+ }
91
101
  try {
92
102
  const firebaseConfig = yield this.fetchFirebaseConfig();
93
103
  this.app = (0, app_1.initializeApp)(firebaseConfig);
@@ -98,6 +108,47 @@ class FirebaseUnifiedService {
98
108
  }
99
109
  });
100
110
  }
111
+ ensureAuthInstance() {
112
+ return __awaiter(this, void 0, void 0, function* () {
113
+ try {
114
+ yield this.initializationPromise;
115
+ }
116
+ catch (_error) {
117
+ return null;
118
+ }
119
+ return this.auth;
120
+ });
121
+ }
122
+ buildAuthTokenProvider() {
123
+ return {
124
+ getToken: () => __awaiter(this, void 0, void 0, function* () {
125
+ // Check if auth is available without waiting for initialization
126
+ // This prevents circular dependency during initial config fetch
127
+ if (!this.auth) {
128
+ return null;
129
+ }
130
+ const currentUser = this.auth.currentUser;
131
+ if (!currentUser) {
132
+ return null;
133
+ }
134
+ return currentUser.getIdToken();
135
+ }),
136
+ refreshToken: () => __awaiter(this, void 0, void 0, function* () {
137
+ // For token refresh, we need to ensure auth is initialized
138
+ const auth = yield this.ensureAuthInstance();
139
+ const currentUser = auth === null || auth === void 0 ? void 0 : auth.currentUser;
140
+ if (!currentUser) {
141
+ return null;
142
+ }
143
+ const refreshedToken = yield currentUser.getIdToken(true);
144
+ UserContext_1.userContext.updateUser({ idToken: refreshedToken });
145
+ return refreshedToken;
146
+ }),
147
+ onRefreshFailure: (error) => {
148
+ console.error("Failed to refresh Firebase ID token:", error);
149
+ }
150
+ };
151
+ }
101
152
  fetchFirebaseConfig() {
102
153
  return __awaiter(this, void 0, void 0, function* () {
103
154
  try {
@@ -110,6 +161,54 @@ class FirebaseUnifiedService {
110
161
  }
111
162
  });
112
163
  }
164
+ buildEmailVerificationSettings(loginId) {
165
+ return {
166
+ url: this.buildEmailVerificationUrl(loginId),
167
+ handleCodeInApp: false,
168
+ };
169
+ }
170
+ buildEmailVerificationUrl(loginId) {
171
+ return appendQueryParams(this.emailVerificationUrl, {
172
+ loginId,
173
+ continueUrl: this.emailVerificationContinueUrl,
174
+ });
175
+ }
176
+ ensureBackendVerification(firebaseUser, backendUser, idToken) {
177
+ var _a, _b, _c, _d, _e, _f, _g;
178
+ return __awaiter(this, void 0, void 0, function* () {
179
+ const firebaseVerified = firebaseUser.emailVerified;
180
+ const backendVerified = (_b = (_a = backendUser.settings) === null || _a === void 0 ? void 0 : _a.hasVerified) !== null && _b !== void 0 ? _b : false;
181
+ if (!firebaseVerified || backendVerified) {
182
+ return backendUser;
183
+ }
184
+ if (!backendUser.id) {
185
+ console.warn("Missing backend user id when attempting to mark verification status.");
186
+ return backendUser;
187
+ }
188
+ const settingsUpdate = {
189
+ paymentMethods: ((_d = (_c = backendUser.settings) === null || _c === void 0 ? void 0 : _c.paymentMethods) !== null && _d !== void 0 ? _d : []).map((method) => (Object.assign({}, method))),
190
+ hasVerified: true,
191
+ };
192
+ const preferredToken = (_e = backendUser.settings) === null || _e === void 0 ? void 0 : _e.preferredTokenCode;
193
+ if (preferredToken !== undefined && preferredToken !== null) {
194
+ settingsUpdate.preferredTokenCode = preferredToken;
195
+ }
196
+ const request = {
197
+ userId: backendUser.id,
198
+ settings: settingsUpdate,
199
+ };
200
+ try {
201
+ const response = yield this.client.updateUserSettings(request, {
202
+ Authorization: `Bearer ${idToken}`,
203
+ });
204
+ return (_g = (_f = response.users) === null || _f === void 0 ? void 0 : _f[0]) !== null && _g !== void 0 ? _g : backendUser;
205
+ }
206
+ catch (error) {
207
+ console.error("Failed to update backend verification status:", error);
208
+ return backendUser;
209
+ }
210
+ });
211
+ }
113
212
  // Messaging methods
114
213
  requestNotificationPermission() {
115
214
  return __awaiter(this, void 0, void 0, function* () {
@@ -169,22 +268,25 @@ class FirebaseUnifiedService {
169
268
  signInWithEmail(email, password) {
170
269
  return __awaiter(this, void 0, void 0, function* () {
171
270
  try {
172
- if (!this.auth) {
271
+ const auth = yield this.ensureAuthInstance();
272
+ if (!auth) {
173
273
  console.error("Firebase Auth not initialized");
174
274
  return AuthResult.failure("Firebase Auth not initialized");
175
275
  }
176
- const userCredential = yield (0, auth_1.signInWithEmailAndPassword)(this.auth, email, password);
276
+ const userCredential = yield (0, auth_1.signInWithEmailAndPassword)(auth, email, password);
177
277
  const idToken = yield userCredential.user.getIdToken();
178
278
  const backendUser = yield this.getUserFromBackend(userCredential.user.uid, idToken);
179
279
  if (backendUser) {
180
- const authResult = this._createSuccessAuthResult(userCredential.user, backendUser, AuthProvider.EMAIL, idToken);
280
+ const syncedBackendUser = yield this.ensureBackendVerification(userCredential.user, backendUser, idToken);
281
+ const authResult = this._createSuccessAuthResult(userCredential.user, syncedBackendUser, AuthProvider.EMAIL, idToken);
181
282
  // Update UserContext
182
283
  UserContext_1.userContext.setUser({
183
284
  id: userCredential.user.uid,
184
- username: backendUser.username || '',
285
+ username: syncedBackendUser.username || '',
185
286
  email: userCredential.user.email || '',
186
- idToken: idToken,
187
- isAdmin: backendUser.admin || false
287
+ idToken,
288
+ isAdmin: syncedBackendUser.admin || false,
289
+ isEmailVerified: userCredential.user.emailVerified
188
290
  });
189
291
  return authResult;
190
292
  }
@@ -205,15 +307,16 @@ class FirebaseUnifiedService {
205
307
  createUserWithEmail(email, password, username) {
206
308
  return __awaiter(this, void 0, void 0, function* () {
207
309
  try {
208
- if (!this.auth) {
310
+ const auth = yield this.ensureAuthInstance();
311
+ if (!auth) {
209
312
  return AuthResult.failure("Firebase Auth not initialized");
210
313
  }
211
314
  // First create the user in Firebase
212
- const userCredential = yield (0, auth_1.createUserWithEmailAndPassword)(this.auth, email, password);
315
+ const userCredential = yield (0, auth_1.createUserWithEmailAndPassword)(auth, email, password);
213
316
  const user = userCredential.user;
214
317
  const idToken = yield user.getIdToken();
215
318
  // Send email verification
216
- yield (0, auth_1.sendEmailVerification)(user);
319
+ yield (0, auth_1.sendEmailVerification)(user, this.buildEmailVerificationSettings(user.uid));
217
320
  const backendUser = yield this.createUserInBackend(user.uid, username, idToken);
218
321
  if (backendUser) {
219
322
  return this._createSuccessAuthResult(user, backendUser, AuthProvider.EMAIL, idToken);
@@ -231,18 +334,20 @@ class FirebaseUnifiedService {
231
334
  signInWithGoogle() {
232
335
  return __awaiter(this, void 0, void 0, function* () {
233
336
  try {
234
- if (!this.auth) {
337
+ const auth = yield this.ensureAuthInstance();
338
+ if (!auth) {
235
339
  return AuthResult.failure("Firebase Auth not initialized");
236
340
  }
237
341
  const provider = new auth_1.GoogleAuthProvider();
238
- const userCredential = yield (0, auth_1.signInWithPopup)(this.auth, provider);
342
+ const userCredential = yield (0, auth_1.signInWithPopup)(auth, provider);
239
343
  const user = userCredential.user;
240
- // Get or create user in your Kotlin backend
241
- const backendUser = yield this.getUserFromBackend(user.uid, user.displayName || '');
242
344
  const idToken = yield user.getIdToken();
345
+ // Get or create user in your Kotlin backend
346
+ const backendUser = yield this.getUserFromBackend(user.uid, idToken);
243
347
  if (backendUser) {
348
+ const syncedBackendUser = yield this.ensureBackendVerification(user, backendUser, idToken);
244
349
  // Use the new helper method
245
- return this._createSuccessAuthResult(user, backendUser, AuthProvider.GOOGLE, idToken);
350
+ return this._createSuccessAuthResult(user, syncedBackendUser, AuthProvider.GOOGLE, idToken);
246
351
  }
247
352
  else {
248
353
  return AuthResult.failure('Failed to get or create user in backend');
@@ -257,18 +362,20 @@ class FirebaseUnifiedService {
257
362
  signInWithFacebook() {
258
363
  return __awaiter(this, void 0, void 0, function* () {
259
364
  try {
260
- if (!this.auth) {
365
+ const auth = yield this.ensureAuthInstance();
366
+ if (!auth) {
261
367
  return AuthResult.failure("Firebase Auth not initialized");
262
368
  }
263
369
  const provider = new auth_1.FacebookAuthProvider();
264
- const userCredential = yield (0, auth_1.signInWithPopup)(this.auth, provider);
370
+ const userCredential = yield (0, auth_1.signInWithPopup)(auth, provider);
265
371
  const user = userCredential.user;
266
- // Get or create user in your Kotlin backend
267
- const backendUser = yield this.getUserFromBackend(user.uid, user.displayName || '');
268
372
  const idToken = yield user.getIdToken();
373
+ // Get or create user in your Kotlin backend
374
+ const backendUser = yield this.getUserFromBackend(user.uid, idToken);
269
375
  if (backendUser) {
376
+ const syncedBackendUser = yield this.ensureBackendVerification(user, backendUser, idToken);
270
377
  // Use the new helper method
271
- return this._createSuccessAuthResult(user, backendUser, AuthProvider.FACEBOOK, idToken);
378
+ return this._createSuccessAuthResult(user, syncedBackendUser, AuthProvider.FACEBOOK, idToken);
272
379
  }
273
380
  else {
274
381
  return AuthResult.failure('Failed to get or create user in backend');
@@ -283,18 +390,20 @@ class FirebaseUnifiedService {
283
390
  signInWithTwitter() {
284
391
  return __awaiter(this, void 0, void 0, function* () {
285
392
  try {
286
- if (!this.auth) {
393
+ const auth = yield this.ensureAuthInstance();
394
+ if (!auth) {
287
395
  return AuthResult.failure("Firebase Auth not initialized");
288
396
  }
289
397
  const provider = new auth_1.TwitterAuthProvider();
290
- const userCredential = yield (0, auth_1.signInWithPopup)(this.auth, provider);
398
+ const userCredential = yield (0, auth_1.signInWithPopup)(auth, provider);
291
399
  const user = userCredential.user;
292
- // Get or create user in your Kotlin backend
293
- const backendUser = yield this.getUserFromBackend(user.uid, user.displayName || '');
294
400
  const idToken = yield user.getIdToken();
401
+ // Get or create user in your Kotlin backend
402
+ const backendUser = yield this.getUserFromBackend(user.uid, idToken);
295
403
  if (backendUser) {
404
+ const syncedBackendUser = yield this.ensureBackendVerification(user, backendUser, idToken);
296
405
  // Use the new helper method
297
- return this._createSuccessAuthResult(user, backendUser, AuthProvider.TWITTER, idToken);
406
+ return this._createSuccessAuthResult(user, syncedBackendUser, AuthProvider.TWITTER, idToken);
298
407
  }
299
408
  else {
300
409
  return AuthResult.failure('Failed to get or create user in backend');
@@ -309,12 +418,13 @@ class FirebaseUnifiedService {
309
418
  sendEmailVerification() {
310
419
  return __awaiter(this, void 0, void 0, function* () {
311
420
  try {
312
- if (!this.auth) {
421
+ const auth = yield this.ensureAuthInstance();
422
+ if (!auth) {
313
423
  return false;
314
424
  }
315
- const user = this.auth.currentUser;
425
+ const user = auth.currentUser;
316
426
  if (user) {
317
- yield (0, auth_1.sendEmailVerification)(user);
427
+ yield (0, auth_1.sendEmailVerification)(user, this.buildEmailVerificationSettings(user.uid));
318
428
  return true;
319
429
  }
320
430
  return false;
@@ -328,10 +438,11 @@ class FirebaseUnifiedService {
328
438
  sendPasswordResetEmail(email) {
329
439
  return __awaiter(this, void 0, void 0, function* () {
330
440
  try {
331
- if (!this.auth) {
441
+ const auth = yield this.ensureAuthInstance();
442
+ if (!auth) {
332
443
  return false;
333
444
  }
334
- yield (0, auth_1.sendPasswordResetEmail)(this.auth, email);
445
+ yield (0, auth_1.sendPasswordResetEmail)(auth, email);
335
446
  return true;
336
447
  }
337
448
  catch (error) {
@@ -343,10 +454,12 @@ class FirebaseUnifiedService {
343
454
  signOut() {
344
455
  return __awaiter(this, void 0, void 0, function* () {
345
456
  try {
346
- if (!this.auth) {
457
+ const auth = yield this.ensureAuthInstance();
458
+ if (!auth) {
459
+ UserContext_1.userContext.clearUser();
347
460
  return;
348
461
  }
349
- yield (0, auth_1.signOut)(this.auth);
462
+ yield (0, auth_1.signOut)(auth);
350
463
  // Clear UserContext
351
464
  UserContext_1.userContext.clearUser();
352
465
  }
@@ -364,10 +477,11 @@ class FirebaseUnifiedService {
364
477
  sendSignInLinkToEmail(email) {
365
478
  return __awaiter(this, void 0, void 0, function* () {
366
479
  try {
367
- if (!this.auth) {
480
+ const auth = yield this.ensureAuthInstance();
481
+ if (!auth) {
368
482
  return false;
369
483
  }
370
- yield (0, auth_1.sendSignInLinkToEmail)(this.auth, email, this.actionCodeSettings);
484
+ yield (0, auth_1.sendSignInLinkToEmail)(auth, email, this.actionCodeSettings);
371
485
  // Save the email locally to use it later when the user clicks the link
372
486
  window.localStorage.setItem('emailForSignIn', email);
373
487
  return true;
@@ -387,22 +501,24 @@ class FirebaseUnifiedService {
387
501
  signInWithEmailLink(email) {
388
502
  return __awaiter(this, void 0, void 0, function* () {
389
503
  try {
390
- if (!this.auth) {
504
+ const auth = yield this.ensureAuthInstance();
505
+ if (!auth) {
391
506
  return AuthResult.failure("Firebase Auth not initialized");
392
507
  }
393
- if (!this.isSignInWithEmailLink()) {
508
+ if (!(0, auth_1.isSignInWithEmailLink)(auth, window.location.href)) {
394
509
  return AuthResult.failure("Invalid sign-in link");
395
510
  }
396
- const userCredential = yield (0, auth_1.signInWithEmailLink)(this.auth, email, window.location.href);
511
+ const userCredential = yield (0, auth_1.signInWithEmailLink)(auth, email, window.location.href);
397
512
  const user = userCredential.user;
398
513
  // Clear the email from localStorage
399
514
  window.localStorage.removeItem('emailForSignIn');
400
- // Get or create user in your Kotlin backend
401
- const backendUser = yield this.getUserFromBackend(user.uid, user.displayName || '');
402
515
  const idToken = yield user.getIdToken();
516
+ // Get or create user in your Kotlin backend
517
+ const backendUser = yield this.getUserFromBackend(user.uid, idToken);
403
518
  if (backendUser) {
519
+ const syncedBackendUser = yield this.ensureBackendVerification(user, backendUser, idToken);
404
520
  // Use the new helper method
405
- return this._createSuccessAuthResult(user, backendUser, AuthProvider.EMAIL, idToken);
521
+ return this._createSuccessAuthResult(user, syncedBackendUser, AuthProvider.EMAIL, idToken);
406
522
  }
407
523
  else {
408
524
  return AuthResult.failure('Failed to get or create user in backend');
@@ -417,17 +533,26 @@ class FirebaseUnifiedService {
417
533
  getEmailForSignIn() {
418
534
  return window.localStorage.getItem('emailForSignIn');
419
535
  }
536
+ applyEmailVerificationCode(oobCode) {
537
+ return __awaiter(this, void 0, void 0, function* () {
538
+ const auth = yield this.ensureAuthInstance();
539
+ if (!auth) {
540
+ throw new Error("Firebase Auth not initialized");
541
+ }
542
+ yield (0, auth_1.applyActionCode)(auth, oobCode);
543
+ });
544
+ }
420
545
  // Helper method to create success AuthResult
421
546
  _createSuccessAuthResult(user, backendUser, provider, idToken) {
422
547
  const userData = UserData.create(user.uid, user.email || '', backendUser.username || '', user.emailVerified, idToken, backendUser.admin || false);
423
548
  return AuthResult.success(backendUser, userData, provider);
424
549
  }
425
550
  // Backend integration methods
426
- getUserFromBackend(userId, loginId) {
551
+ getUserFromBackend(userId, authToken) {
427
552
  return __awaiter(this, void 0, void 0, function* () {
428
553
  try {
429
554
  const response = yield this.client.getUser(userId, {
430
- Authorization: `Bearer ${loginId}`,
555
+ Authorization: `Bearer ${authToken}`,
431
556
  });
432
557
  return response.users[0];
433
558
  }
@@ -456,4 +581,4 @@ class FirebaseUnifiedService {
456
581
  });
457
582
  }
458
583
  }
459
- exports.FirebaseUnifiedService = FirebaseUnifiedService;
584
+ exports.FirebaseService = FirebaseService;
@@ -17,5 +17,7 @@ export interface FirebaseLoginServiceConfig {
17
17
  url: string;
18
18
  handleCodeInApp: boolean;
19
19
  };
20
+ emailVerificationUrl?: string;
21
+ emailVerificationContinueUrl?: string;
20
22
  }
21
23
  export declare function createLoginService(config: LoginServiceConfig): LoginService;
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createLoginService = void 0;
4
+ const FirebaseLoginService_1 = require("./FirebaseLoginService");
4
5
  function createLoginService(config) {
5
6
  const { provider, apiClient } = config;
6
7
  if (provider === 'firebase') {
7
- const { FirebaseUnifiedService } = require('../FirebaseLoginService');
8
- return new FirebaseUnifiedService(apiClient, config.firebase);
8
+ return new FirebaseLoginService_1.FirebaseService(apiClient, config.firebase);
9
9
  }
10
10
  throw new Error(`Unsupported login provider: ${provider}`);
11
11
  }
@@ -4,6 +4,7 @@ export interface User {
4
4
  email: string;
5
5
  idToken: string;
6
6
  isAdmin: boolean;
7
+ isEmailVerified: boolean;
7
8
  }
8
9
  export interface UserContext {
9
10
  user: User | null;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { default as P2PMarketplaceAPIClient } from './P2PMarketplaceAPIClient';
2
2
  export { generateSecretAndHash } from './cryptoUtils';
3
3
  export * from './types';
4
- export { FirebaseUnifiedService } from './auth/FirebaseLoginService';
4
+ export { FirebaseService, AuthProvider, UserData, AuthResult } from './auth/FirebaseLoginService';
5
5
  export { createLoginService } from './auth/LoginService';
6
6
  export { userContext } from './auth/UserContext';
package/dist/index.js CHANGED
@@ -17,14 +17,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.userContext = exports.createLoginService = exports.FirebaseUnifiedService = exports.generateSecretAndHash = exports.P2PMarketplaceAPIClient = void 0;
20
+ exports.userContext = exports.createLoginService = exports.AuthResult = exports.UserData = exports.AuthProvider = exports.FirebaseService = exports.generateSecretAndHash = exports.P2PMarketplaceAPIClient = void 0;
21
21
  var P2PMarketplaceAPIClient_1 = require("./P2PMarketplaceAPIClient");
22
22
  Object.defineProperty(exports, "P2PMarketplaceAPIClient", { enumerable: true, get: function () { return __importDefault(P2PMarketplaceAPIClient_1).default; } });
23
23
  var cryptoUtils_1 = require("./cryptoUtils");
24
24
  Object.defineProperty(exports, "generateSecretAndHash", { enumerable: true, get: function () { return cryptoUtils_1.generateSecretAndHash; } });
25
25
  __exportStar(require("./types"), exports);
26
26
  var FirebaseLoginService_1 = require("./auth/FirebaseLoginService");
27
- Object.defineProperty(exports, "FirebaseUnifiedService", { enumerable: true, get: function () { return FirebaseLoginService_1.FirebaseUnifiedService; } });
27
+ Object.defineProperty(exports, "FirebaseService", { enumerable: true, get: function () { return FirebaseLoginService_1.FirebaseService; } });
28
+ Object.defineProperty(exports, "AuthProvider", { enumerable: true, get: function () { return FirebaseLoginService_1.AuthProvider; } });
29
+ Object.defineProperty(exports, "UserData", { enumerable: true, get: function () { return FirebaseLoginService_1.UserData; } });
30
+ Object.defineProperty(exports, "AuthResult", { enumerable: true, get: function () { return FirebaseLoginService_1.AuthResult; } });
28
31
  var LoginService_1 = require("./auth/LoginService");
29
32
  Object.defineProperty(exports, "createLoginService", { enumerable: true, get: function () { return LoginService_1.createLoginService; } });
30
33
  var UserContext_1 = require("./auth/UserContext");
package/dist/types.d.ts CHANGED
@@ -53,13 +53,17 @@ export interface UsersResponse {
53
53
  users: KioscoinUser[];
54
54
  }
55
55
  export interface UserSettings {
56
- preferredTokenCode?: string;
56
+ preferredTokenCode?: string | null;
57
57
  paymentMethods: PaymentMethod[];
58
+ hasVerified?: boolean;
58
59
  }
59
60
  export interface UpdateUserSettingsRequest {
60
61
  userId: string;
61
62
  settings: UserSettings;
62
63
  }
64
+ export interface VerifyEmailRequest {
65
+ loginId: string;
66
+ }
63
67
  export interface PaymentMethod {
64
68
  type: string;
65
69
  alias?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "b5-api-client",
3
- "version": "0.0.26",
3
+ "version": "0.0.28",
4
4
  "description": "Escrow Backend API client",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",