@infrab4a/connect 0.11.0-beta.0 → 0.11.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/bundles/infrab4a-connect.umd.js +4 -114
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/esm2015/lib/domain/catalog/models/product.js +1 -1
- package/esm2015/lib/domain/catalog/models/types/product-review.type.js +1 -1
- package/esm2015/lib/domain/users/errors/index.js +1 -3
- package/esm2015/lib/domain/users/services/authentication.service.js +1 -1
- package/esm2015/lib/domain/users/services/index.js +1 -3
- package/esm2015/lib/domain/users/use-cases/index.js +1 -2
- package/esm2015/lib/infra/firebase/auth/authentication-firebase-auth.service.js +4 -18
- package/esm2015/lib/infra/firebase/auth/index.js +1 -2
- package/fesm2015/infrab4a-connect.js +4 -83
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/lib/domain/catalog/models/product.d.ts +1 -0
- package/lib/domain/catalog/models/types/product-review.type.d.ts +1 -1
- package/lib/domain/users/errors/index.d.ts +0 -2
- package/lib/domain/users/services/authentication.service.d.ts +5 -4
- package/lib/domain/users/services/index.d.ts +0 -2
- package/lib/domain/users/use-cases/index.d.ts +0 -1
- package/lib/infra/firebase/auth/authentication-firebase-auth.service.d.ts +4 -5
- package/lib/infra/firebase/auth/index.d.ts +0 -1
- package/package.json +1 -1
- package/esm2015/lib/domain/users/errors/user-already-registered.error.js +0 -7
- package/esm2015/lib/domain/users/errors/weak-password.error.js +0 -7
- package/esm2015/lib/domain/users/services/register.service.js +0 -2
- package/esm2015/lib/domain/users/services/types/basic-user-data.type.js +0 -2
- package/esm2015/lib/domain/users/services/types/index.js +0 -2
- package/esm2015/lib/domain/users/use-cases/register.js +0 -28
- package/esm2015/lib/infra/firebase/auth/register-firebase-auth.service.js +0 -26
- package/esm2015/lib/infra/firebase/auth/types/firebase-user-with-id.type.js +0 -2
- package/lib/domain/users/errors/user-already-registered.error.d.ts +0 -4
- package/lib/domain/users/errors/weak-password.error.d.ts +0 -4
- package/lib/domain/users/services/register.service.d.ts +0 -7
- package/lib/domain/users/services/types/basic-user-data.type.d.ts +0 -4
- package/lib/domain/users/services/types/index.d.ts +0 -1
- package/lib/domain/users/use-cases/register.d.ts +0 -13
- package/lib/infra/firebase/auth/register-firebase-auth.service.d.ts +0 -8
- package/lib/infra/firebase/auth/types/firebase-user-with-id.type.d.ts +0 -3
|
@@ -1004,44 +1004,6 @@
|
|
|
1004
1004
|
return Authentication;
|
|
1005
1005
|
}());
|
|
1006
1006
|
|
|
1007
|
-
var Register = /** @class */ (function () {
|
|
1008
|
-
function Register(registerService, userRepository) {
|
|
1009
|
-
this.registerService = registerService;
|
|
1010
|
-
this.userRepository = userRepository;
|
|
1011
|
-
}
|
|
1012
|
-
Register.prototype.register = function (params) {
|
|
1013
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1014
|
-
var email, displayName, auth, user;
|
|
1015
|
-
return __generator(this, function (_a) {
|
|
1016
|
-
switch (_a.label) {
|
|
1017
|
-
case 0:
|
|
1018
|
-
email = params.email.toLocaleLowerCase();
|
|
1019
|
-
displayName = params.firstName + " " + params.lastName;
|
|
1020
|
-
return [4 /*yield*/, this.registerService.register({
|
|
1021
|
-
birthday: params.birthday,
|
|
1022
|
-
email: email,
|
|
1023
|
-
firstName: params.firstName,
|
|
1024
|
-
lastName: params.lastName,
|
|
1025
|
-
cpf: params.cpf,
|
|
1026
|
-
displayName: displayName,
|
|
1027
|
-
phone: params.phone,
|
|
1028
|
-
password: params.password,
|
|
1029
|
-
})];
|
|
1030
|
-
case 1:
|
|
1031
|
-
auth = _a.sent();
|
|
1032
|
-
delete params.password;
|
|
1033
|
-
return [4 /*yield*/, this.userRepository.create(Object.assign(Object.assign({}, params), { id: auth.id, email: email,
|
|
1034
|
-
displayName: displayName, dateCreated: new Date(), dateModified: new Date() }))];
|
|
1035
|
-
case 2:
|
|
1036
|
-
user = _a.sent();
|
|
1037
|
-
return [2 /*return*/, user];
|
|
1038
|
-
}
|
|
1039
|
-
});
|
|
1040
|
-
});
|
|
1041
|
-
};
|
|
1042
|
-
return Register;
|
|
1043
|
-
}());
|
|
1044
|
-
|
|
1045
1007
|
var SignOut = /** @class */ (function () {
|
|
1046
1008
|
function SignOut(authService) {
|
|
1047
1009
|
this.authService = authService;
|
|
@@ -1061,27 +1023,6 @@
|
|
|
1061
1023
|
return SignOut;
|
|
1062
1024
|
}());
|
|
1063
1025
|
|
|
1064
|
-
var UserAlreadyRegisteredError = /** @class */ (function (_super) {
|
|
1065
|
-
__extends(UserAlreadyRegisteredError, _super);
|
|
1066
|
-
function UserAlreadyRegisteredError(message) {
|
|
1067
|
-
var _this = _super.call(this, message) || this;
|
|
1068
|
-
_this.message = message;
|
|
1069
|
-
return _this;
|
|
1070
|
-
}
|
|
1071
|
-
return UserAlreadyRegisteredError;
|
|
1072
|
-
}(Error));
|
|
1073
|
-
|
|
1074
|
-
var WeakPasswordError = /** @class */ (function (_super) {
|
|
1075
|
-
__extends(WeakPasswordError, _super);
|
|
1076
|
-
function WeakPasswordError(message) {
|
|
1077
|
-
if (message === void 0) { message = 'Weak password'; }
|
|
1078
|
-
var _this = _super.call(this, message) || this;
|
|
1079
|
-
_this.message = message;
|
|
1080
|
-
return _this;
|
|
1081
|
-
}
|
|
1082
|
-
return WeakPasswordError;
|
|
1083
|
-
}(Error));
|
|
1084
|
-
|
|
1085
1026
|
exports.Shops = void 0;
|
|
1086
1027
|
(function (Shops) {
|
|
1087
1028
|
Shops["MENSMARKET"] = "mensmarket";
|
|
@@ -2313,13 +2254,7 @@
|
|
|
2313
2254
|
case 1:
|
|
2314
2255
|
credentials = _a.sent();
|
|
2315
2256
|
user = credentials.user;
|
|
2316
|
-
return [2 /*return*/, {
|
|
2317
|
-
id: user.uid,
|
|
2318
|
-
displayName: user.displayName,
|
|
2319
|
-
email: user.email,
|
|
2320
|
-
phone: user.phoneNumber,
|
|
2321
|
-
isAnonymous: false,
|
|
2322
|
-
}];
|
|
2257
|
+
return [2 /*return*/, { id: user.uid, displayName: user.displayName, email: user.email, phone: user.phoneNumber }];
|
|
2323
2258
|
}
|
|
2324
2259
|
});
|
|
2325
2260
|
});
|
|
@@ -2333,13 +2268,7 @@
|
|
|
2333
2268
|
case 1:
|
|
2334
2269
|
credentials = _a.sent();
|
|
2335
2270
|
user = credentials.user;
|
|
2336
|
-
return [2 /*return*/, {
|
|
2337
|
-
id: user.uid,
|
|
2338
|
-
displayName: user.displayName,
|
|
2339
|
-
email: user.email,
|
|
2340
|
-
phone: user.phoneNumber,
|
|
2341
|
-
isAnonymous: false,
|
|
2342
|
-
}];
|
|
2271
|
+
return [2 /*return*/, { id: user.uid, displayName: user.displayName, email: user.email, phone: user.phoneNumber }];
|
|
2343
2272
|
}
|
|
2344
2273
|
});
|
|
2345
2274
|
});
|
|
@@ -2354,15 +2283,13 @@
|
|
|
2354
2283
|
};
|
|
2355
2284
|
AuthenticationFirebaseAuthService.prototype.signInAnonymously = function () {
|
|
2356
2285
|
return __awaiter(this, void 0, void 0, function () {
|
|
2357
|
-
var auth
|
|
2286
|
+
var auth;
|
|
2358
2287
|
return __generator(this, function (_a) {
|
|
2359
2288
|
switch (_a.label) {
|
|
2360
2289
|
case 0: return [4 /*yield*/, this.firebaseAuth.signInAnonymously()];
|
|
2361
2290
|
case 1:
|
|
2362
2291
|
auth = _a.sent();
|
|
2363
|
-
|
|
2364
|
-
user.id = auth.user.uid;
|
|
2365
|
-
return [2 /*return*/, user];
|
|
2292
|
+
return [2 /*return*/, auth.user];
|
|
2366
2293
|
}
|
|
2367
2294
|
});
|
|
2368
2295
|
});
|
|
@@ -2370,39 +2297,6 @@
|
|
|
2370
2297
|
return AuthenticationFirebaseAuthService;
|
|
2371
2298
|
}());
|
|
2372
2299
|
|
|
2373
|
-
var RegisterFirebaseAuthService = /** @class */ (function () {
|
|
2374
|
-
function RegisterFirebaseAuthService(firebaseAuth) {
|
|
2375
|
-
this.firebaseAuth = firebaseAuth;
|
|
2376
|
-
}
|
|
2377
|
-
RegisterFirebaseAuthService.prototype.register = function (params) {
|
|
2378
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2379
|
-
var auth, user, error_1;
|
|
2380
|
-
return __generator(this, function (_a) {
|
|
2381
|
-
switch (_a.label) {
|
|
2382
|
-
case 0:
|
|
2383
|
-
_a.trys.push([0, 2, , 3]);
|
|
2384
|
-
return [4 /*yield*/, this.firebaseAuth.createUserWithEmailAndPassword(params.email, params.password)];
|
|
2385
|
-
case 1:
|
|
2386
|
-
auth = _a.sent();
|
|
2387
|
-
user = auth.user;
|
|
2388
|
-
user.sendEmailVerification();
|
|
2389
|
-
user.id = auth.user.uid;
|
|
2390
|
-
return [2 /*return*/, user];
|
|
2391
|
-
case 2:
|
|
2392
|
-
error_1 = _a.sent();
|
|
2393
|
-
if (error_1.code === 'auth/email-already-in-use')
|
|
2394
|
-
throw new UserAlreadyRegisteredError('Email already registered');
|
|
2395
|
-
if (error_1.code === 'auth/weak-password')
|
|
2396
|
-
throw new WeakPasswordError();
|
|
2397
|
-
throw error_1;
|
|
2398
|
-
case 3: return [2 /*return*/];
|
|
2399
|
-
}
|
|
2400
|
-
});
|
|
2401
|
-
});
|
|
2402
|
-
};
|
|
2403
|
-
return RegisterFirebaseAuthService;
|
|
2404
|
-
}());
|
|
2405
|
-
|
|
2406
2300
|
/**
|
|
2407
2301
|
* Generated bundle index. Do not edit.
|
|
2408
2302
|
*/
|
|
@@ -2470,8 +2364,6 @@
|
|
|
2470
2364
|
exports.Product = Product;
|
|
2471
2365
|
exports.ProductFirestoreRepository = ProductFirestoreRepository;
|
|
2472
2366
|
exports.ProductVariantFirestoreRepository = ProductVariantFirestoreRepository;
|
|
2473
|
-
exports.Register = Register;
|
|
2474
|
-
exports.RegisterFirebaseAuthService = RegisterFirebaseAuthService;
|
|
2475
2367
|
exports.RequiredArgumentError = RequiredArgumentError;
|
|
2476
2368
|
exports.ShippingMethod = ShippingMethod;
|
|
2477
2369
|
exports.ShopMenu = ShopMenu;
|
|
@@ -2489,13 +2381,11 @@
|
|
|
2489
2381
|
exports.User = User;
|
|
2490
2382
|
exports.UserAddress = UserAddress;
|
|
2491
2383
|
exports.UserAddressFirestoreRepository = UserAddressFirestoreRepository;
|
|
2492
|
-
exports.UserAlreadyRegisteredError = UserAlreadyRegisteredError;
|
|
2493
2384
|
exports.UserBeautyProfileFirestoreRepository = UserBeautyProfileFirestoreRepository;
|
|
2494
2385
|
exports.UserFirestoreRepository = UserFirestoreRepository;
|
|
2495
2386
|
exports.UserPaymentMethod = UserPaymentMethod;
|
|
2496
2387
|
exports.UserPaymentMethodFirestoreRepository = UserPaymentMethodFirestoreRepository;
|
|
2497
2388
|
exports.Variant = Variant;
|
|
2498
|
-
exports.WeakPasswordError = WeakPasswordError;
|
|
2499
2389
|
exports.withCreateFirestore = withCreateFirestore;
|
|
2500
2390
|
exports.withCrudFirestore = withCrudFirestore;
|
|
2501
2391
|
exports.withDeleteFirestore = withDeleteFirestore;
|