mailsentry-auth 0.2.4 → 0.2.5
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.mts +6 -7
- package/dist/index.d.ts +6 -7
- package/dist/index.js +32 -37
- package/dist/index.mjs +32 -37
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -358,7 +358,7 @@ declare class CrossTabBehaviorHandler {
|
|
|
358
358
|
* Get the action configuration for current route and event
|
|
359
359
|
*/
|
|
360
360
|
static getAction(currentPageType: PageType, eventType: AuthEventType): {
|
|
361
|
-
readonly action: NavigationAction.
|
|
361
|
+
readonly action: NavigationAction.RELOAD;
|
|
362
362
|
} | {
|
|
363
363
|
readonly action: NavigationAction.NONE;
|
|
364
364
|
} | {
|
|
@@ -370,7 +370,7 @@ declare class CrossTabBehaviorHandler {
|
|
|
370
370
|
} | {
|
|
371
371
|
readonly action: NavigationAction.RELOAD;
|
|
372
372
|
} | {
|
|
373
|
-
readonly action: NavigationAction.
|
|
373
|
+
readonly action: NavigationAction.NONE;
|
|
374
374
|
} | {
|
|
375
375
|
readonly action: NavigationAction.NONE;
|
|
376
376
|
} | {
|
|
@@ -781,12 +781,11 @@ declare class LoggerFactory {
|
|
|
781
781
|
*/
|
|
782
782
|
declare class AuthOrchestrator implements IAuthOrchestrator {
|
|
783
783
|
private authService;
|
|
784
|
-
private eventBus;
|
|
785
784
|
private tokenManager;
|
|
786
785
|
private userStorageManager;
|
|
787
786
|
private errorHandler;
|
|
788
787
|
private logger;
|
|
789
|
-
constructor(authService: AuthService,
|
|
788
|
+
constructor(authService: AuthService, tokenManager?: ITokenManager);
|
|
790
789
|
/**
|
|
791
790
|
* Setup Chain of Responsibility for error handling
|
|
792
791
|
*/
|
|
@@ -863,7 +862,7 @@ declare class AuthOrchestratorFactory {
|
|
|
863
862
|
/**
|
|
864
863
|
* Create AuthOrchestrator with custom dependencies
|
|
865
864
|
*/
|
|
866
|
-
static createWithDependencies(authService: AuthService,
|
|
865
|
+
static createWithDependencies(authService: AuthService, tokenManager?: ITokenManager): AuthOrchestrator;
|
|
867
866
|
}
|
|
868
867
|
|
|
869
868
|
/**
|
|
@@ -1274,7 +1273,7 @@ declare const PageTypePatterns: {
|
|
|
1274
1273
|
declare const CrossTabBehaviorConfig: {
|
|
1275
1274
|
readonly "/login": {
|
|
1276
1275
|
readonly "auth.logged_in": {
|
|
1277
|
-
readonly action: NavigationAction.
|
|
1276
|
+
readonly action: NavigationAction.RELOAD;
|
|
1278
1277
|
};
|
|
1279
1278
|
readonly "auth.logged_out": {
|
|
1280
1279
|
readonly action: NavigationAction.NONE;
|
|
@@ -1294,7 +1293,7 @@ declare const CrossTabBehaviorConfig: {
|
|
|
1294
1293
|
readonly action: NavigationAction.RELOAD;
|
|
1295
1294
|
};
|
|
1296
1295
|
readonly "auth.email_verified": {
|
|
1297
|
-
readonly action: NavigationAction.
|
|
1296
|
+
readonly action: NavigationAction.NONE;
|
|
1298
1297
|
};
|
|
1299
1298
|
readonly "auth.signin_required_modal": {
|
|
1300
1299
|
readonly action: NavigationAction.NONE;
|
package/dist/index.d.ts
CHANGED
|
@@ -358,7 +358,7 @@ declare class CrossTabBehaviorHandler {
|
|
|
358
358
|
* Get the action configuration for current route and event
|
|
359
359
|
*/
|
|
360
360
|
static getAction(currentPageType: PageType, eventType: AuthEventType): {
|
|
361
|
-
readonly action: NavigationAction.
|
|
361
|
+
readonly action: NavigationAction.RELOAD;
|
|
362
362
|
} | {
|
|
363
363
|
readonly action: NavigationAction.NONE;
|
|
364
364
|
} | {
|
|
@@ -370,7 +370,7 @@ declare class CrossTabBehaviorHandler {
|
|
|
370
370
|
} | {
|
|
371
371
|
readonly action: NavigationAction.RELOAD;
|
|
372
372
|
} | {
|
|
373
|
-
readonly action: NavigationAction.
|
|
373
|
+
readonly action: NavigationAction.NONE;
|
|
374
374
|
} | {
|
|
375
375
|
readonly action: NavigationAction.NONE;
|
|
376
376
|
} | {
|
|
@@ -781,12 +781,11 @@ declare class LoggerFactory {
|
|
|
781
781
|
*/
|
|
782
782
|
declare class AuthOrchestrator implements IAuthOrchestrator {
|
|
783
783
|
private authService;
|
|
784
|
-
private eventBus;
|
|
785
784
|
private tokenManager;
|
|
786
785
|
private userStorageManager;
|
|
787
786
|
private errorHandler;
|
|
788
787
|
private logger;
|
|
789
|
-
constructor(authService: AuthService,
|
|
788
|
+
constructor(authService: AuthService, tokenManager?: ITokenManager);
|
|
790
789
|
/**
|
|
791
790
|
* Setup Chain of Responsibility for error handling
|
|
792
791
|
*/
|
|
@@ -863,7 +862,7 @@ declare class AuthOrchestratorFactory {
|
|
|
863
862
|
/**
|
|
864
863
|
* Create AuthOrchestrator with custom dependencies
|
|
865
864
|
*/
|
|
866
|
-
static createWithDependencies(authService: AuthService,
|
|
865
|
+
static createWithDependencies(authService: AuthService, tokenManager?: ITokenManager): AuthOrchestrator;
|
|
867
866
|
}
|
|
868
867
|
|
|
869
868
|
/**
|
|
@@ -1274,7 +1273,7 @@ declare const PageTypePatterns: {
|
|
|
1274
1273
|
declare const CrossTabBehaviorConfig: {
|
|
1275
1274
|
readonly "/login": {
|
|
1276
1275
|
readonly "auth.logged_in": {
|
|
1277
|
-
readonly action: NavigationAction.
|
|
1276
|
+
readonly action: NavigationAction.RELOAD;
|
|
1278
1277
|
};
|
|
1279
1278
|
readonly "auth.logged_out": {
|
|
1280
1279
|
readonly action: NavigationAction.NONE;
|
|
@@ -1294,7 +1293,7 @@ declare const CrossTabBehaviorConfig: {
|
|
|
1294
1293
|
readonly action: NavigationAction.RELOAD;
|
|
1295
1294
|
};
|
|
1296
1295
|
readonly "auth.email_verified": {
|
|
1297
|
-
readonly action: NavigationAction.
|
|
1296
|
+
readonly action: NavigationAction.NONE;
|
|
1298
1297
|
};
|
|
1299
1298
|
readonly "auth.signin_required_modal": {
|
|
1300
1299
|
readonly action: NavigationAction.NONE;
|
package/dist/index.js
CHANGED
|
@@ -91,11 +91,11 @@ var AuthEventType = /* @__PURE__ */ ((AuthEventType3) => {
|
|
|
91
91
|
AuthEventType3["SignInRequiredModal"] = "auth.signin_required_modal";
|
|
92
92
|
return AuthEventType3;
|
|
93
93
|
})(AuthEventType || {});
|
|
94
|
-
var PageType = /* @__PURE__ */ ((
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return
|
|
94
|
+
var PageType = /* @__PURE__ */ ((PageType4) => {
|
|
95
|
+
PageType4["LOGIN"] = "/login";
|
|
96
|
+
PageType4["DASHBOARD"] = "dashboard";
|
|
97
|
+
PageType4["HOME"] = "/";
|
|
98
|
+
return PageType4;
|
|
99
99
|
})(PageType || {});
|
|
100
100
|
var NavigationAction = /* @__PURE__ */ ((NavigationAction2) => {
|
|
101
101
|
NavigationAction2["NONE"] = "none";
|
|
@@ -109,7 +109,7 @@ var PageTypePatterns = {
|
|
|
109
109
|
};
|
|
110
110
|
var CrossTabBehaviorConfig = {
|
|
111
111
|
["/login" /* LOGIN */]: {
|
|
112
|
-
["auth.logged_in" /* LoggedIn */]: { action: "
|
|
112
|
+
["auth.logged_in" /* LoggedIn */]: { action: "reload" /* RELOAD */ },
|
|
113
113
|
["auth.logged_out" /* LoggedOut */]: { action: "none" /* NONE */ },
|
|
114
114
|
["auth.email_verified" /* EmailVerified */]: { action: "none" /* NONE */ },
|
|
115
115
|
["auth.signin_required_modal" /* SignInRequiredModal */]: { action: "none" /* NONE */ }
|
|
@@ -117,7 +117,7 @@ var CrossTabBehaviorConfig = {
|
|
|
117
117
|
["dashboard" /* DASHBOARD */]: {
|
|
118
118
|
["auth.logged_in" /* LoggedIn */]: { action: "reload" /* RELOAD */ },
|
|
119
119
|
["auth.logged_out" /* LoggedOut */]: { action: "reload" /* RELOAD */ },
|
|
120
|
-
["auth.email_verified" /* EmailVerified */]: { action: "
|
|
120
|
+
["auth.email_verified" /* EmailVerified */]: { action: "none" /* NONE */ },
|
|
121
121
|
["auth.signin_required_modal" /* SignInRequiredModal */]: { action: "none" /* NONE */ }
|
|
122
122
|
},
|
|
123
123
|
["/" /* HOME */]: {
|
|
@@ -2428,9 +2428,8 @@ var GenericErrorHandler = class extends BaseErrorHandler {
|
|
|
2428
2428
|
|
|
2429
2429
|
// src/services/auth/auth-orchestrator.ts
|
|
2430
2430
|
var AuthOrchestrator = class {
|
|
2431
|
-
constructor(authService,
|
|
2431
|
+
constructor(authService, tokenManager) {
|
|
2432
2432
|
this.authService = authService;
|
|
2433
|
-
this.eventBus = eventBus;
|
|
2434
2433
|
this.tokenManager = tokenManager || new TokenManager(CookieUtils);
|
|
2435
2434
|
this.userStorageManager = new UserStorageManager(LocalStorageUtils);
|
|
2436
2435
|
this.logger = LoggerFactory.create();
|
|
@@ -2516,14 +2515,6 @@ var AuthOrchestrator = class {
|
|
|
2516
2515
|
this.tokenManager
|
|
2517
2516
|
);
|
|
2518
2517
|
const result = await strategy.execute(credentials);
|
|
2519
|
-
if (result.success && result.data.isVerifiedEmail) {
|
|
2520
|
-
const currentPageType = CrossTabBehaviorHandler.getCurrentPageType();
|
|
2521
|
-
this.eventBus.publish({
|
|
2522
|
-
type: "auth.logged_in" /* LoggedIn */,
|
|
2523
|
-
userId: String(result.data.profile.user._id),
|
|
2524
|
-
sourcePageType: currentPageType
|
|
2525
|
-
});
|
|
2526
|
-
}
|
|
2527
2518
|
return result;
|
|
2528
2519
|
} catch (error) {
|
|
2529
2520
|
return this.errorHandler.handle(error, "Login flow");
|
|
@@ -2545,12 +2536,6 @@ var AuthOrchestrator = class {
|
|
|
2545
2536
|
domain: this.tokenManager.getDomainInfo().domain
|
|
2546
2537
|
}
|
|
2547
2538
|
});
|
|
2548
|
-
const currentPageType = CrossTabBehaviorHandler.getCurrentPageType();
|
|
2549
|
-
this.eventBus.publish({
|
|
2550
|
-
type: "auth.logged_in" /* LoggedIn */,
|
|
2551
|
-
userId: String(completeLoginData.profile.user._id),
|
|
2552
|
-
sourcePageType: currentPageType
|
|
2553
|
-
});
|
|
2554
2539
|
return AuthResultFactory.createSuccess(completeLoginData);
|
|
2555
2540
|
} catch (error) {
|
|
2556
2541
|
return this.errorHandler.handle(error, "Google Login");
|
|
@@ -2566,7 +2551,6 @@ var AuthOrchestrator = class {
|
|
|
2566
2551
|
const verificationResult = await this.authService.verifyEmail(verificationRequest);
|
|
2567
2552
|
const isVerified = verificationResult === true || ((_a = verificationResult == null ? void 0 : verificationResult.data) == null ? void 0 : _a.isVerified);
|
|
2568
2553
|
if (isVerified) {
|
|
2569
|
-
this.eventBus.publish({ type: "auth.email_verified" /* EmailVerified */, email });
|
|
2570
2554
|
return AuthResultFactory.createSuccess({ isVerified: true });
|
|
2571
2555
|
}
|
|
2572
2556
|
return AuthResultFactory.createFailure("Email verification failed");
|
|
@@ -2590,11 +2574,6 @@ var AuthOrchestrator = class {
|
|
|
2590
2574
|
} finally {
|
|
2591
2575
|
this.tokenManager.clearTokens();
|
|
2592
2576
|
this.userStorageManager.clearUserProfile();
|
|
2593
|
-
const currentPageType = CrossTabBehaviorHandler.getCurrentPageType();
|
|
2594
|
-
this.eventBus.publish({
|
|
2595
|
-
type: "auth.logged_out" /* LoggedOut */,
|
|
2596
|
-
sourcePageType: currentPageType
|
|
2597
|
-
});
|
|
2598
2577
|
this.logger.log("Logout cleanup completed:", {
|
|
2599
2578
|
clearedTokens: Object.keys(tokenInfo).filter((key) => tokenInfo[key]),
|
|
2600
2579
|
domainInfo: this.tokenManager.getDomainInfo()
|
|
@@ -2701,14 +2680,13 @@ var AuthOrchestratorFactory = class {
|
|
|
2701
2680
|
*/
|
|
2702
2681
|
static create() {
|
|
2703
2682
|
const authService = new AuthService();
|
|
2704
|
-
|
|
2705
|
-
return new AuthOrchestrator(authService, eventBus);
|
|
2683
|
+
return new AuthOrchestrator(authService);
|
|
2706
2684
|
}
|
|
2707
2685
|
/**
|
|
2708
2686
|
* Create AuthOrchestrator with custom dependencies
|
|
2709
2687
|
*/
|
|
2710
|
-
static createWithDependencies(authService,
|
|
2711
|
-
return new AuthOrchestrator(authService,
|
|
2688
|
+
static createWithDependencies(authService, tokenManager) {
|
|
2689
|
+
return new AuthOrchestrator(authService, tokenManager);
|
|
2712
2690
|
}
|
|
2713
2691
|
};
|
|
2714
2692
|
|
|
@@ -2787,6 +2765,12 @@ var useUserStore = _zustand.create.call(void 0, )(
|
|
|
2787
2765
|
});
|
|
2788
2766
|
try {
|
|
2789
2767
|
await _authOrchestrator.handleLogout();
|
|
2768
|
+
const eventBus = BroadcastChannelEventBus.getInstance("auth-event-channel" /* AUTH */);
|
|
2769
|
+
const currentPageType = CrossTabBehaviorHandler.getCurrentPageType();
|
|
2770
|
+
eventBus.publish({
|
|
2771
|
+
type: "auth.logged_out" /* LoggedOut */,
|
|
2772
|
+
sourcePageType: currentPageType
|
|
2773
|
+
});
|
|
2790
2774
|
} catch (error) {
|
|
2791
2775
|
console.error("Error during logout cleanup:", error);
|
|
2792
2776
|
} finally {
|
|
@@ -3151,6 +3135,7 @@ function AuthFlowContainer({
|
|
|
3151
3135
|
}) {
|
|
3152
3136
|
const showRightSideImage = variant === "with_image" /* WITH_IMAGE */ && !!backgroundImage;
|
|
3153
3137
|
const authOrchestrator = AuthOrchestratorFactory.create();
|
|
3138
|
+
const eventBus = useSharedEventBus();
|
|
3154
3139
|
const { state: actionState, executeAction, clearAll } = useAuthActionHandler();
|
|
3155
3140
|
const { getStepComponent } = useStepRenderer();
|
|
3156
3141
|
const [email, setEmail] = _react.useState.call(void 0, "");
|
|
@@ -3217,7 +3202,10 @@ function AuthFlowContainer({
|
|
|
3217
3202
|
},
|
|
3218
3203
|
{
|
|
3219
3204
|
condition: () => true,
|
|
3220
|
-
execute: () =>
|
|
3205
|
+
execute: () => {
|
|
3206
|
+
publishLoggedInEvent(String(data.profile.user._id));
|
|
3207
|
+
handleSuccess();
|
|
3208
|
+
}
|
|
3221
3209
|
}
|
|
3222
3210
|
];
|
|
3223
3211
|
(_a = actionPipeline.find((action) => action.condition())) == null ? void 0 : _a.execute();
|
|
@@ -3254,6 +3242,7 @@ function AuthFlowContainer({
|
|
|
3254
3242
|
{
|
|
3255
3243
|
onSuccess: (data) => {
|
|
3256
3244
|
setAuthData(data);
|
|
3245
|
+
publishLoggedInEvent(String(data.profile.user._id));
|
|
3257
3246
|
handleSuccess();
|
|
3258
3247
|
},
|
|
3259
3248
|
onError: (error) => {
|
|
@@ -3270,6 +3259,7 @@ function AuthFlowContainer({
|
|
|
3270
3259
|
{
|
|
3271
3260
|
onSuccess: (data) => {
|
|
3272
3261
|
setAuthData(data);
|
|
3262
|
+
publishLoggedInEvent(String(data.profile.user._id));
|
|
3273
3263
|
handleSuccess();
|
|
3274
3264
|
},
|
|
3275
3265
|
onError: (error) => {
|
|
@@ -3292,11 +3282,16 @@ function AuthFlowContainer({
|
|
|
3292
3282
|
}
|
|
3293
3283
|
);
|
|
3294
3284
|
};
|
|
3285
|
+
const publishLoggedInEvent = (userId) => {
|
|
3286
|
+
const currentPageType = CrossTabBehaviorHandler.getCurrentPageType();
|
|
3287
|
+
eventBus.publish({
|
|
3288
|
+
type: "auth.logged_in" /* LoggedIn */,
|
|
3289
|
+
userId,
|
|
3290
|
+
sourcePageType: currentPageType
|
|
3291
|
+
});
|
|
3292
|
+
};
|
|
3295
3293
|
const handleSuccess = () => {
|
|
3296
3294
|
stepperActions.goToStep("finish" /* FINISH */);
|
|
3297
|
-
setTimeout(() => {
|
|
3298
|
-
window.location.href = UrlUtils.getDashboardUrl(window.location);
|
|
3299
|
-
}, 1e3);
|
|
3300
3295
|
};
|
|
3301
3296
|
const goBackToEmail = () => {
|
|
3302
3297
|
stepperActions.goToStep("email" /* EMAIL */);
|
package/dist/index.mjs
CHANGED
|
@@ -91,11 +91,11 @@ var AuthEventType = /* @__PURE__ */ ((AuthEventType3) => {
|
|
|
91
91
|
AuthEventType3["SignInRequiredModal"] = "auth.signin_required_modal";
|
|
92
92
|
return AuthEventType3;
|
|
93
93
|
})(AuthEventType || {});
|
|
94
|
-
var PageType = /* @__PURE__ */ ((
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return
|
|
94
|
+
var PageType = /* @__PURE__ */ ((PageType4) => {
|
|
95
|
+
PageType4["LOGIN"] = "/login";
|
|
96
|
+
PageType4["DASHBOARD"] = "dashboard";
|
|
97
|
+
PageType4["HOME"] = "/";
|
|
98
|
+
return PageType4;
|
|
99
99
|
})(PageType || {});
|
|
100
100
|
var NavigationAction = /* @__PURE__ */ ((NavigationAction2) => {
|
|
101
101
|
NavigationAction2["NONE"] = "none";
|
|
@@ -109,7 +109,7 @@ var PageTypePatterns = {
|
|
|
109
109
|
};
|
|
110
110
|
var CrossTabBehaviorConfig = {
|
|
111
111
|
["/login" /* LOGIN */]: {
|
|
112
|
-
["auth.logged_in" /* LoggedIn */]: { action: "
|
|
112
|
+
["auth.logged_in" /* LoggedIn */]: { action: "reload" /* RELOAD */ },
|
|
113
113
|
["auth.logged_out" /* LoggedOut */]: { action: "none" /* NONE */ },
|
|
114
114
|
["auth.email_verified" /* EmailVerified */]: { action: "none" /* NONE */ },
|
|
115
115
|
["auth.signin_required_modal" /* SignInRequiredModal */]: { action: "none" /* NONE */ }
|
|
@@ -117,7 +117,7 @@ var CrossTabBehaviorConfig = {
|
|
|
117
117
|
["dashboard" /* DASHBOARD */]: {
|
|
118
118
|
["auth.logged_in" /* LoggedIn */]: { action: "reload" /* RELOAD */ },
|
|
119
119
|
["auth.logged_out" /* LoggedOut */]: { action: "reload" /* RELOAD */ },
|
|
120
|
-
["auth.email_verified" /* EmailVerified */]: { action: "
|
|
120
|
+
["auth.email_verified" /* EmailVerified */]: { action: "none" /* NONE */ },
|
|
121
121
|
["auth.signin_required_modal" /* SignInRequiredModal */]: { action: "none" /* NONE */ }
|
|
122
122
|
},
|
|
123
123
|
["/" /* HOME */]: {
|
|
@@ -2428,9 +2428,8 @@ var GenericErrorHandler = class extends BaseErrorHandler {
|
|
|
2428
2428
|
|
|
2429
2429
|
// src/services/auth/auth-orchestrator.ts
|
|
2430
2430
|
var AuthOrchestrator = class {
|
|
2431
|
-
constructor(authService,
|
|
2431
|
+
constructor(authService, tokenManager) {
|
|
2432
2432
|
this.authService = authService;
|
|
2433
|
-
this.eventBus = eventBus;
|
|
2434
2433
|
this.tokenManager = tokenManager || new TokenManager(CookieUtils);
|
|
2435
2434
|
this.userStorageManager = new UserStorageManager(LocalStorageUtils);
|
|
2436
2435
|
this.logger = LoggerFactory.create();
|
|
@@ -2516,14 +2515,6 @@ var AuthOrchestrator = class {
|
|
|
2516
2515
|
this.tokenManager
|
|
2517
2516
|
);
|
|
2518
2517
|
const result = await strategy.execute(credentials);
|
|
2519
|
-
if (result.success && result.data.isVerifiedEmail) {
|
|
2520
|
-
const currentPageType = CrossTabBehaviorHandler.getCurrentPageType();
|
|
2521
|
-
this.eventBus.publish({
|
|
2522
|
-
type: "auth.logged_in" /* LoggedIn */,
|
|
2523
|
-
userId: String(result.data.profile.user._id),
|
|
2524
|
-
sourcePageType: currentPageType
|
|
2525
|
-
});
|
|
2526
|
-
}
|
|
2527
2518
|
return result;
|
|
2528
2519
|
} catch (error) {
|
|
2529
2520
|
return this.errorHandler.handle(error, "Login flow");
|
|
@@ -2545,12 +2536,6 @@ var AuthOrchestrator = class {
|
|
|
2545
2536
|
domain: this.tokenManager.getDomainInfo().domain
|
|
2546
2537
|
}
|
|
2547
2538
|
});
|
|
2548
|
-
const currentPageType = CrossTabBehaviorHandler.getCurrentPageType();
|
|
2549
|
-
this.eventBus.publish({
|
|
2550
|
-
type: "auth.logged_in" /* LoggedIn */,
|
|
2551
|
-
userId: String(completeLoginData.profile.user._id),
|
|
2552
|
-
sourcePageType: currentPageType
|
|
2553
|
-
});
|
|
2554
2539
|
return AuthResultFactory.createSuccess(completeLoginData);
|
|
2555
2540
|
} catch (error) {
|
|
2556
2541
|
return this.errorHandler.handle(error, "Google Login");
|
|
@@ -2566,7 +2551,6 @@ var AuthOrchestrator = class {
|
|
|
2566
2551
|
const verificationResult = await this.authService.verifyEmail(verificationRequest);
|
|
2567
2552
|
const isVerified = verificationResult === true || ((_a = verificationResult == null ? void 0 : verificationResult.data) == null ? void 0 : _a.isVerified);
|
|
2568
2553
|
if (isVerified) {
|
|
2569
|
-
this.eventBus.publish({ type: "auth.email_verified" /* EmailVerified */, email });
|
|
2570
2554
|
return AuthResultFactory.createSuccess({ isVerified: true });
|
|
2571
2555
|
}
|
|
2572
2556
|
return AuthResultFactory.createFailure("Email verification failed");
|
|
@@ -2590,11 +2574,6 @@ var AuthOrchestrator = class {
|
|
|
2590
2574
|
} finally {
|
|
2591
2575
|
this.tokenManager.clearTokens();
|
|
2592
2576
|
this.userStorageManager.clearUserProfile();
|
|
2593
|
-
const currentPageType = CrossTabBehaviorHandler.getCurrentPageType();
|
|
2594
|
-
this.eventBus.publish({
|
|
2595
|
-
type: "auth.logged_out" /* LoggedOut */,
|
|
2596
|
-
sourcePageType: currentPageType
|
|
2597
|
-
});
|
|
2598
2577
|
this.logger.log("Logout cleanup completed:", {
|
|
2599
2578
|
clearedTokens: Object.keys(tokenInfo).filter((key) => tokenInfo[key]),
|
|
2600
2579
|
domainInfo: this.tokenManager.getDomainInfo()
|
|
@@ -2701,14 +2680,13 @@ var AuthOrchestratorFactory = class {
|
|
|
2701
2680
|
*/
|
|
2702
2681
|
static create() {
|
|
2703
2682
|
const authService = new AuthService();
|
|
2704
|
-
|
|
2705
|
-
return new AuthOrchestrator(authService, eventBus);
|
|
2683
|
+
return new AuthOrchestrator(authService);
|
|
2706
2684
|
}
|
|
2707
2685
|
/**
|
|
2708
2686
|
* Create AuthOrchestrator with custom dependencies
|
|
2709
2687
|
*/
|
|
2710
|
-
static createWithDependencies(authService,
|
|
2711
|
-
return new AuthOrchestrator(authService,
|
|
2688
|
+
static createWithDependencies(authService, tokenManager) {
|
|
2689
|
+
return new AuthOrchestrator(authService, tokenManager);
|
|
2712
2690
|
}
|
|
2713
2691
|
};
|
|
2714
2692
|
|
|
@@ -2787,6 +2765,12 @@ var useUserStore = create()(
|
|
|
2787
2765
|
});
|
|
2788
2766
|
try {
|
|
2789
2767
|
await _authOrchestrator.handleLogout();
|
|
2768
|
+
const eventBus = BroadcastChannelEventBus.getInstance("auth-event-channel" /* AUTH */);
|
|
2769
|
+
const currentPageType = CrossTabBehaviorHandler.getCurrentPageType();
|
|
2770
|
+
eventBus.publish({
|
|
2771
|
+
type: "auth.logged_out" /* LoggedOut */,
|
|
2772
|
+
sourcePageType: currentPageType
|
|
2773
|
+
});
|
|
2790
2774
|
} catch (error) {
|
|
2791
2775
|
console.error("Error during logout cleanup:", error);
|
|
2792
2776
|
} finally {
|
|
@@ -3151,6 +3135,7 @@ function AuthFlowContainer({
|
|
|
3151
3135
|
}) {
|
|
3152
3136
|
const showRightSideImage = variant === "with_image" /* WITH_IMAGE */ && !!backgroundImage;
|
|
3153
3137
|
const authOrchestrator = AuthOrchestratorFactory.create();
|
|
3138
|
+
const eventBus = useSharedEventBus();
|
|
3154
3139
|
const { state: actionState, executeAction, clearAll } = useAuthActionHandler();
|
|
3155
3140
|
const { getStepComponent } = useStepRenderer();
|
|
3156
3141
|
const [email, setEmail] = useState7("");
|
|
@@ -3217,7 +3202,10 @@ function AuthFlowContainer({
|
|
|
3217
3202
|
},
|
|
3218
3203
|
{
|
|
3219
3204
|
condition: () => true,
|
|
3220
|
-
execute: () =>
|
|
3205
|
+
execute: () => {
|
|
3206
|
+
publishLoggedInEvent(String(data.profile.user._id));
|
|
3207
|
+
handleSuccess();
|
|
3208
|
+
}
|
|
3221
3209
|
}
|
|
3222
3210
|
];
|
|
3223
3211
|
(_a = actionPipeline.find((action) => action.condition())) == null ? void 0 : _a.execute();
|
|
@@ -3254,6 +3242,7 @@ function AuthFlowContainer({
|
|
|
3254
3242
|
{
|
|
3255
3243
|
onSuccess: (data) => {
|
|
3256
3244
|
setAuthData(data);
|
|
3245
|
+
publishLoggedInEvent(String(data.profile.user._id));
|
|
3257
3246
|
handleSuccess();
|
|
3258
3247
|
},
|
|
3259
3248
|
onError: (error) => {
|
|
@@ -3270,6 +3259,7 @@ function AuthFlowContainer({
|
|
|
3270
3259
|
{
|
|
3271
3260
|
onSuccess: (data) => {
|
|
3272
3261
|
setAuthData(data);
|
|
3262
|
+
publishLoggedInEvent(String(data.profile.user._id));
|
|
3273
3263
|
handleSuccess();
|
|
3274
3264
|
},
|
|
3275
3265
|
onError: (error) => {
|
|
@@ -3292,11 +3282,16 @@ function AuthFlowContainer({
|
|
|
3292
3282
|
}
|
|
3293
3283
|
);
|
|
3294
3284
|
};
|
|
3285
|
+
const publishLoggedInEvent = (userId) => {
|
|
3286
|
+
const currentPageType = CrossTabBehaviorHandler.getCurrentPageType();
|
|
3287
|
+
eventBus.publish({
|
|
3288
|
+
type: "auth.logged_in" /* LoggedIn */,
|
|
3289
|
+
userId,
|
|
3290
|
+
sourcePageType: currentPageType
|
|
3291
|
+
});
|
|
3292
|
+
};
|
|
3295
3293
|
const handleSuccess = () => {
|
|
3296
3294
|
stepperActions.goToStep("finish" /* FINISH */);
|
|
3297
|
-
setTimeout(() => {
|
|
3298
|
-
window.location.href = UrlUtils.getDashboardUrl(window.location);
|
|
3299
|
-
}, 1e3);
|
|
3300
3295
|
};
|
|
3301
3296
|
const goBackToEmail = () => {
|
|
3302
3297
|
stepperActions.goToStep("email" /* EMAIL */);
|
package/package.json
CHANGED