cloud-ide-auth 1.0.0 → 1.0.2
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/README.md +35 -189
- package/fesm2022/cloud-ide-auth-reset-password.component-BZiK83P_.mjs +61 -0
- package/fesm2022/{cloud-ide-auth-reset-password.component-s7NMNjch.mjs.map → cloud-ide-auth-reset-password.component-BZiK83P_.mjs.map} +1 -1
- package/fesm2022/{cloud-ide-auth-sign-in.component-Cu4z1fIE.mjs → cloud-ide-auth-sign-in.component-CoF5MNMX.mjs} +17 -15
- package/fesm2022/cloud-ide-auth-sign-in.component-CoF5MNMX.mjs.map +1 -0
- package/fesm2022/cloud-ide-auth.mjs +45 -24
- package/fesm2022/cloud-ide-auth.mjs.map +1 -1
- package/index.d.ts +61 -5
- package/package.json +3 -5
- package/esm2022/cloud-ide-auth.mjs +0 -5
- package/esm2022/lib/auth/forgot-password/forgot-password.component.mjs +0 -62
- package/esm2022/lib/auth/reset-password/reset-password.component.mjs +0 -57
- package/esm2022/lib/auth/sign-in/sign-in.component.mjs +0 -78
- package/esm2022/lib/cloud-ide-auth.component.mjs +0 -16
- package/esm2022/lib/cloud-ide-auth.routes.mjs +0 -24
- package/esm2022/lib/cloud-ide-auth.service.mjs +0 -165
- package/esm2022/public-api.mjs +0 -8
- package/fesm2022/cloud-ide-auth-reset-password.component-s7NMNjch.mjs +0 -60
- package/fesm2022/cloud-ide-auth-sign-in.component-Cu4z1fIE.mjs.map +0 -1
- package/lib/auth/forgot-password/forgot-password.component.d.ts +0 -16
- package/lib/auth/reset-password/reset-password.component.d.ts +0 -18
- package/lib/auth/sign-in/sign-in.component.d.ts +0 -26
- package/lib/cloud-ide-auth.component.d.ts +0 -5
- package/lib/cloud-ide-auth.routes.d.ts +0 -2
- package/lib/cloud-ide-auth.service.d.ts +0 -29
- package/public-api.d.ts +0 -4
package/README.md
CHANGED
|
@@ -1,217 +1,63 @@
|
|
|
1
|
-
#
|
|
1
|
+
# CloudIdeAuth
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 20.1.0.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Code scaffolding
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- Sign-in Form
|
|
9
|
-
- Registration Form
|
|
10
|
-
- Forgot Password Flow
|
|
11
|
-
- Reset Password Flow
|
|
12
|
-
- **Authentication Service**
|
|
13
|
-
- Token-based Authentication
|
|
14
|
-
- Session Management
|
|
15
|
-
- Automatic Token Refresh
|
|
16
|
-
- Auth Guards for Route Protection
|
|
17
|
-
- **Integration with Backend**
|
|
18
|
-
- HTTP Interceptors for Auth Headers
|
|
19
|
-
- Error Handling for Auth Failures
|
|
20
|
-
|
|
21
|
-
## Installation
|
|
7
|
+
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
|
|
22
8
|
|
|
23
9
|
```bash
|
|
24
|
-
|
|
10
|
+
ng generate component component-name
|
|
25
11
|
```
|
|
26
12
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Setup
|
|
30
|
-
|
|
31
|
-
Import the authentication module in your app module:
|
|
13
|
+
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
|
32
14
|
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
@NgModule({
|
|
37
|
-
imports: [
|
|
38
|
-
CloudIdeAuthModule.forRoot({
|
|
39
|
-
apiUrl: 'https://api.example.com/auth',
|
|
40
|
-
tokenStorageKey: 'auth_token',
|
|
41
|
-
refreshTokenStorageKey: 'refresh_token'
|
|
42
|
-
})
|
|
43
|
-
],
|
|
44
|
-
// ...
|
|
45
|
-
})
|
|
46
|
-
export class AppModule { }
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### Authentication Service
|
|
50
|
-
|
|
51
|
-
```typescript
|
|
52
|
-
import { Component } from '@angular/core';
|
|
53
|
-
import { CloudIdeAuthService } from '@cide-lms/cloud-ide-auth';
|
|
54
|
-
|
|
55
|
-
@Component({
|
|
56
|
-
selector: 'app-login',
|
|
57
|
-
template: `
|
|
58
|
-
<form (ngSubmit)="login()">
|
|
59
|
-
<input type="email" [(ngModel)]="email" name="email" required>
|
|
60
|
-
<input type="password" [(ngModel)]="password" name="password" required>
|
|
61
|
-
<button type="submit" [disabled]="isLoading">Login</button>
|
|
62
|
-
<div *ngIf="error">{{ error }}</div>
|
|
63
|
-
</form>
|
|
64
|
-
`
|
|
65
|
-
})
|
|
66
|
-
export class LoginComponent {
|
|
67
|
-
email = '';
|
|
68
|
-
password = '';
|
|
69
|
-
error = '';
|
|
70
|
-
isLoading = false;
|
|
71
|
-
|
|
72
|
-
constructor(private authService: CloudIdeAuthService) {}
|
|
73
|
-
|
|
74
|
-
login() {
|
|
75
|
-
this.isLoading = true;
|
|
76
|
-
this.error = '';
|
|
77
|
-
|
|
78
|
-
this.authService.login(this.email, this.password)
|
|
79
|
-
.subscribe({
|
|
80
|
-
next: () => {
|
|
81
|
-
// Redirect to dashboard
|
|
82
|
-
},
|
|
83
|
-
error: (err) => {
|
|
84
|
-
this.error = err.message || 'Login failed';
|
|
85
|
-
this.isLoading = false;
|
|
86
|
-
},
|
|
87
|
-
complete: () => {
|
|
88
|
-
this.isLoading = false;
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
}
|
|
15
|
+
```bash
|
|
16
|
+
ng generate --help
|
|
93
17
|
```
|
|
94
18
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
```typescript
|
|
98
|
-
import { inject } from '@angular/core';
|
|
99
|
-
import { Router, CanActivateFn } from '@angular/router';
|
|
100
|
-
import { map, take } from 'rxjs/operators';
|
|
101
|
-
import { CloudIdeAuthService } from '@cide-lms/cloud-ide-auth';
|
|
102
|
-
|
|
103
|
-
export const authGuard: CanActivateFn = (route, state) => {
|
|
104
|
-
const router = inject(Router);
|
|
105
|
-
const authService = inject(CloudIdeAuthService);
|
|
106
|
-
|
|
107
|
-
return authService.isAuthenticated$.pipe(
|
|
108
|
-
take(1),
|
|
109
|
-
map(isAuthenticated => {
|
|
110
|
-
if (isAuthenticated) {
|
|
111
|
-
return true;
|
|
112
|
-
} else {
|
|
113
|
-
router.navigate(['/auth/login'], { queryParams: { returnUrl: state.url } });
|
|
114
|
-
return false;
|
|
115
|
-
}
|
|
116
|
-
})
|
|
117
|
-
);
|
|
118
|
-
};
|
|
119
|
-
```
|
|
19
|
+
## Building
|
|
120
20
|
|
|
121
|
-
|
|
21
|
+
To build the library, run:
|
|
122
22
|
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
[redirectUrl]="'/dashboard'"
|
|
127
|
-
[rememberMe]="true"
|
|
128
|
-
></cloud-ide-sign-in>
|
|
23
|
+
```bash
|
|
24
|
+
ng build cloud-ide-auth
|
|
25
|
+
```
|
|
129
26
|
|
|
130
|
-
|
|
131
|
-
<cloud-ide-forgot-password></cloud-ide-forgot-password>
|
|
27
|
+
This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
|
|
132
28
|
|
|
133
|
-
|
|
134
|
-
<cloud-ide-reset-password [token]="resetToken"></cloud-ide-reset-password>
|
|
135
|
-
```
|
|
29
|
+
### Publishing the Library
|
|
136
30
|
|
|
137
|
-
|
|
31
|
+
Once the project is built, you can publish your library by following these steps:
|
|
138
32
|
|
|
139
|
-
|
|
33
|
+
1. Navigate to the `dist` directory:
|
|
34
|
+
```bash
|
|
35
|
+
cd dist/cloud-ide-auth
|
|
36
|
+
```
|
|
140
37
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
38
|
+
2. Run the `npm publish` command to publish your library to the npm registry:
|
|
39
|
+
```bash
|
|
40
|
+
npm publish
|
|
41
|
+
```
|
|
145
42
|
|
|
146
|
-
|
|
43
|
+
## Running unit tests
|
|
147
44
|
|
|
148
|
-
|
|
149
|
-
import { Routes } from '@angular/router';
|
|
150
|
-
import { cloudIdeAuthRoutes } from '@cide-lms/cloud-ide-auth';
|
|
45
|
+
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
|
|
151
46
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
{
|
|
155
|
-
path: 'auth',
|
|
156
|
-
children: cloudIdeAuthRoutes
|
|
157
|
-
}
|
|
158
|
-
];
|
|
47
|
+
```bash
|
|
48
|
+
ng test
|
|
159
49
|
```
|
|
160
50
|
|
|
161
|
-
##
|
|
162
|
-
|
|
163
|
-
The library includes an HTTP interceptor for automatically adding authentication tokens to requests:
|
|
51
|
+
## Running end-to-end tests
|
|
164
52
|
|
|
165
|
-
|
|
166
|
-
import { HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
167
|
-
import { AuthInterceptor } from '@cide-lms/cloud-ide-auth';
|
|
53
|
+
For end-to-end (e2e) testing, run:
|
|
168
54
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
{
|
|
172
|
-
provide: HTTP_INTERCEPTORS,
|
|
173
|
-
useClass: AuthInterceptor,
|
|
174
|
-
multi: true
|
|
175
|
-
}
|
|
176
|
-
]
|
|
177
|
-
})
|
|
178
|
-
export class AppModule { }
|
|
55
|
+
```bash
|
|
56
|
+
ng e2e
|
|
179
57
|
```
|
|
180
58
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
You can customize the appearance of authentication components by overriding the CSS variables:
|
|
59
|
+
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
|
184
60
|
|
|
185
|
-
|
|
186
|
-
:root {
|
|
187
|
-
--cide-auth-primary-color: #3b82f6;
|
|
188
|
-
--cide-auth-error-color: #ef4444;
|
|
189
|
-
--cide-auth-background: #f8fafc;
|
|
190
|
-
--cide-auth-card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
|
191
|
-
}
|
|
192
|
-
```
|
|
61
|
+
## Additional Resources
|
|
193
62
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
The auth service provides standardized error messages:
|
|
197
|
-
|
|
198
|
-
```typescript
|
|
199
|
-
import { AuthErrorType, CloudIdeAuthService } from '@cide-lms/cloud-ide-auth';
|
|
200
|
-
|
|
201
|
-
@Component({/* ... */})
|
|
202
|
-
export class LoginComponent {
|
|
203
|
-
constructor(private authService: CloudIdeAuthService) {
|
|
204
|
-
this.authService.loginError$.subscribe(error => {
|
|
205
|
-
switch(error.type) {
|
|
206
|
-
case AuthErrorType.INVALID_CREDENTIALS:
|
|
207
|
-
this.errorMessage = 'Invalid username or password';
|
|
208
|
-
break;
|
|
209
|
-
case AuthErrorType.ACCOUNT_LOCKED:
|
|
210
|
-
this.errorMessage = 'Your account has been locked';
|
|
211
|
-
break;
|
|
212
|
-
// Handle other error types
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
```
|
|
63
|
+
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, Component } from '@angular/core';
|
|
3
|
+
import { CideInputComponent, CideEleButtonComponent } from 'cloud-ide-element';
|
|
4
|
+
import * as i1 from '@angular/forms';
|
|
5
|
+
import { FormGroup, FormControl, ReactiveFormsModule } from '@angular/forms';
|
|
6
|
+
import { CommonModule } from '@angular/common';
|
|
7
|
+
import { Router } from '@angular/router';
|
|
8
|
+
import { CloudIdeAuthService } from './cloud-ide-auth.mjs';
|
|
9
|
+
|
|
10
|
+
class CideAuthResetPasswordComponent {
|
|
11
|
+
setup_param = { form_loading: false };
|
|
12
|
+
resetPassswordForm;
|
|
13
|
+
erro_message = "";
|
|
14
|
+
authService = inject(CloudIdeAuthService);
|
|
15
|
+
route = inject(Router);
|
|
16
|
+
constructor() {
|
|
17
|
+
this.resetPassswordForm = new FormGroup({
|
|
18
|
+
user_new_password: new FormControl(''),
|
|
19
|
+
user_confirm_password: new FormControl('')
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
onForgotPasssword() {
|
|
23
|
+
if (this.resetPassswordForm.valid) {
|
|
24
|
+
this.setup_param.form_loading = true;
|
|
25
|
+
const resetPasssword = {
|
|
26
|
+
user_password: this.resetPassswordForm?.get('user_password')?.value || '',
|
|
27
|
+
user_username: "",
|
|
28
|
+
sylog_config_data: {
|
|
29
|
+
reset_password_link: "",
|
|
30
|
+
reset_password_secret: "",
|
|
31
|
+
request_timestamp: new Date()
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
this.authService.resetPassword(resetPasssword)?.subscribe({
|
|
35
|
+
next: (response) => {
|
|
36
|
+
if (response?.success === true) {
|
|
37
|
+
this.setup_param.form_loading = false;
|
|
38
|
+
this.route.navigate(['auth', 'sign-in']);
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
error: (error) => {
|
|
42
|
+
this.setup_param.form_loading = false;
|
|
43
|
+
this.erro_message = error?.error?.message;
|
|
44
|
+
console.log(error);
|
|
45
|
+
setTimeout(() => {
|
|
46
|
+
this.erro_message = "";
|
|
47
|
+
}, 3000);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: CideAuthResetPasswordComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
53
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.7", type: CideAuthResetPasswordComponent, isStandalone: true, selector: "cide-auth-reset-password", ngImport: i0, template: "<!-- https://play.tailwindcss.com/lfO85drpUy -->\n<!-- Main Div Outer Div-->\n<div class=\"cide-font-poppins tw-flex tw-min-h-screen tw-w-full tw-bg-gray-50 tw-py-3\">\n <!-- Forrm Wrapper -->\n <div class=\"tw-m-auto tw-w-96 tw-rounded-2xl tw-bg-white tw-py-6 tw-shadow-xl\">\n <!-- Logo Wrapper -->\n <div class=\"tw-m-auto tw-h-32 tw-w-64 tw-text-center\">\n <img src=\"https://console.cloudidesys.com/assets/Cloud%20IDE%20Logo%20Dark.png\" class=\"tw-m-auto tw-h-full\"\n alt=\"Cloud IDE Logo\" />\n </div> <!-- Entity name here -->\n <div class=\"tw-my-2 tw-text-center tw-text-xl tw-font-semibold\">Reset Password</div>\n <!-- Error Logger -->\n <div class=\"tw-w-full tw-select-none tw-py-1 tw-text-center tw-text-red-500 tw-h-4 tw-text-sm\">{{erro_message}}</div>\n \n <!-- section for controls -->\n <form [formGroup]=\"resetPassswordForm\" (ngSubmit)=\"onForgotPasssword()\" novalidate>\n <div class=\"tw-m-auto tw-pb-3 tw-pt-3\">\n <!-- New Password -->\n <div class=\"tw-m-auto tw-w-80\">\n <cide-ele-input id=\"new_password\" formControlName=\"new_password\"></cide-ele-input>\n </div>\n <!-- Confirm Password -->\n <div class=\"tw-m-auto tw-w-80\">\n <cide-ele-input id=\"confirm_password\" formControlName=\"confirm_password\"></cide-ele-input>\n </div> <!-- Forgot Password button -->\n <div class=\"tw-w-80 tw-m-auto tw-mt-3\">\n <button cideEleButton id=\"reset_password_button\" [loading]=\"setup_param.form_loading\" [disabled]=\"!resetPassswordForm.valid\">Reset Password</button>\n </div>\n </div>\n </form>\n </div>\n </div>", styles: [""], dependencies: [{ kind: "component", type: CideInputComponent, selector: "cide-ele-input", inputs: ["fill", "label", "labelHide", "disabled", "clearInput", "labelPlacement", "labelDir", "placeholder", "leadingIcon", "trailingIcon", "helperText", "helperTextCollapse", "hideHelperAndErrorText", "errorText", "maxlength", "minlength", "required", "autocapitalize", "autocomplete", "type", "width", "id", "ngModel", "option", "min", "max", "size"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: CommonModule }, { kind: "component", type: CideEleButtonComponent, selector: "button[cideEleButton], a[cideEleButton]", inputs: ["label", "variant", "size", "type", "shape", "elevation", "disabled", "id", "loading", "fullWidth", "leftIcon", "rightIcon", "customClass", "tooltip", "ariaLabel", "testId", "routerLink", "routerExtras", "preventDoubleClick", "animated"], outputs: ["btnClick", "doubleClick"] }] });
|
|
54
|
+
}
|
|
55
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: CideAuthResetPasswordComponent, decorators: [{
|
|
56
|
+
type: Component,
|
|
57
|
+
args: [{ selector: 'cide-auth-reset-password', standalone: true, imports: [CideInputComponent, ReactiveFormsModule, CommonModule, CideEleButtonComponent], template: "<!-- https://play.tailwindcss.com/lfO85drpUy -->\n<!-- Main Div Outer Div-->\n<div class=\"cide-font-poppins tw-flex tw-min-h-screen tw-w-full tw-bg-gray-50 tw-py-3\">\n <!-- Forrm Wrapper -->\n <div class=\"tw-m-auto tw-w-96 tw-rounded-2xl tw-bg-white tw-py-6 tw-shadow-xl\">\n <!-- Logo Wrapper -->\n <div class=\"tw-m-auto tw-h-32 tw-w-64 tw-text-center\">\n <img src=\"https://console.cloudidesys.com/assets/Cloud%20IDE%20Logo%20Dark.png\" class=\"tw-m-auto tw-h-full\"\n alt=\"Cloud IDE Logo\" />\n </div> <!-- Entity name here -->\n <div class=\"tw-my-2 tw-text-center tw-text-xl tw-font-semibold\">Reset Password</div>\n <!-- Error Logger -->\n <div class=\"tw-w-full tw-select-none tw-py-1 tw-text-center tw-text-red-500 tw-h-4 tw-text-sm\">{{erro_message}}</div>\n \n <!-- section for controls -->\n <form [formGroup]=\"resetPassswordForm\" (ngSubmit)=\"onForgotPasssword()\" novalidate>\n <div class=\"tw-m-auto tw-pb-3 tw-pt-3\">\n <!-- New Password -->\n <div class=\"tw-m-auto tw-w-80\">\n <cide-ele-input id=\"new_password\" formControlName=\"new_password\"></cide-ele-input>\n </div>\n <!-- Confirm Password -->\n <div class=\"tw-m-auto tw-w-80\">\n <cide-ele-input id=\"confirm_password\" formControlName=\"confirm_password\"></cide-ele-input>\n </div> <!-- Forgot Password button -->\n <div class=\"tw-w-80 tw-m-auto tw-mt-3\">\n <button cideEleButton id=\"reset_password_button\" [loading]=\"setup_param.form_loading\" [disabled]=\"!resetPassswordForm.valid\">Reset Password</button>\n </div>\n </div>\n </form>\n </div>\n </div>" }]
|
|
58
|
+
}], ctorParameters: () => [] });
|
|
59
|
+
|
|
60
|
+
export { CideAuthResetPasswordComponent };
|
|
61
|
+
//# sourceMappingURL=cloud-ide-auth-reset-password.component-BZiK83P_.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-ide-auth-reset-password.component-
|
|
1
|
+
{"version":3,"file":"cloud-ide-auth-reset-password.component-BZiK83P_.mjs","sources":["../../../projects/cloud-ide-auth/src/lib/auth/reset-password/reset-password.component.ts","../../../projects/cloud-ide-auth/src/lib/auth/reset-password/reset-password.component.html"],"sourcesContent":["import { Component, inject } from '@angular/core';\nimport { CideEleButtonComponent, CideInputComponent } from 'cloud-ide-element';\nimport { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';\nimport { CommonModule } from '@angular/common';\nimport { Router } from '@angular/router';\nimport { FormGroupModel } from '../sign-in/sign-in.component';\nimport { CloudIdeAuthService } from '../../cloud-ide-auth.service';\nimport { MResetPassword } from 'cloud-ide-lms-model';\n\n@Component({\n selector: 'cide-auth-reset-password',\n standalone: true,\n imports: [CideInputComponent, ReactiveFormsModule, CommonModule, CideEleButtonComponent],\n templateUrl: './reset-password.component.html',\n styleUrl: './reset-password.component.css'\n})\nexport class CideAuthResetPasswordComponent {\n public setup_param = { form_loading: false };\n public resetPassswordForm: FormGroupModel<{user_new_password: string, user_confirm_password: string}>;\n public erro_message = \"\";\n\n private authService = inject(CloudIdeAuthService);\n private route = inject(Router);\n\n constructor() {\n\n this.resetPassswordForm = new FormGroup({\n user_new_password: new FormControl(''),\n user_confirm_password: new FormControl('')\n }) as unknown as FormGroupModel<{user_new_password: string, user_confirm_password: string}>;\n }\n\n onForgotPasssword() {\n if (this.resetPassswordForm.valid) {\n this.setup_param.form_loading = true;\n const resetPasssword : MResetPassword= {\n user_password: this.resetPassswordForm?.get('user_password')?.value || '',\n user_username: \"\",\n sylog_config_data: {\n reset_password_link: \"\",\n reset_password_secret: \"\",\n request_timestamp: new Date()\n }\n }\n this.authService.resetPassword(resetPasssword)?.subscribe({\n next: (response) => {\n if (response?.success === true) {\n this.setup_param.form_loading = false;\n this.route.navigate(['auth', 'sign-in'])\n }\n },\n error: (error) => {\n this.setup_param.form_loading = false;\n this.erro_message = error?.error?.message;\n console.log(error)\n setTimeout(() => {\n this.erro_message = \"\"\n }, 3000)\n }\n });\n }\n }\n}\n\n","<!-- https://play.tailwindcss.com/lfO85drpUy -->\n<!-- Main Div Outer Div-->\n<div class=\"cide-font-poppins tw-flex tw-min-h-screen tw-w-full tw-bg-gray-50 tw-py-3\">\n <!-- Forrm Wrapper -->\n <div class=\"tw-m-auto tw-w-96 tw-rounded-2xl tw-bg-white tw-py-6 tw-shadow-xl\">\n <!-- Logo Wrapper -->\n <div class=\"tw-m-auto tw-h-32 tw-w-64 tw-text-center\">\n <img src=\"https://console.cloudidesys.com/assets/Cloud%20IDE%20Logo%20Dark.png\" class=\"tw-m-auto tw-h-full\"\n alt=\"Cloud IDE Logo\" />\n </div> <!-- Entity name here -->\n <div class=\"tw-my-2 tw-text-center tw-text-xl tw-font-semibold\">Reset Password</div>\n <!-- Error Logger -->\n <div class=\"tw-w-full tw-select-none tw-py-1 tw-text-center tw-text-red-500 tw-h-4 tw-text-sm\">{{erro_message}}</div>\n \n <!-- section for controls -->\n <form [formGroup]=\"resetPassswordForm\" (ngSubmit)=\"onForgotPasssword()\" novalidate>\n <div class=\"tw-m-auto tw-pb-3 tw-pt-3\">\n <!-- New Password -->\n <div class=\"tw-m-auto tw-w-80\">\n <cide-ele-input id=\"new_password\" formControlName=\"new_password\"></cide-ele-input>\n </div>\n <!-- Confirm Password -->\n <div class=\"tw-m-auto tw-w-80\">\n <cide-ele-input id=\"confirm_password\" formControlName=\"confirm_password\"></cide-ele-input>\n </div> <!-- Forgot Password button -->\n <div class=\"tw-w-80 tw-m-auto tw-mt-3\">\n <button cideEleButton id=\"reset_password_button\" [loading]=\"setup_param.form_loading\" [disabled]=\"!resetPassswordForm.valid\">Reset Password</button>\n </div>\n </div>\n </form>\n </div>\n </div>"],"names":[],"mappings":";;;;;;;;;MAgBa,8BAA8B,CAAA;AAClC,IAAA,WAAW,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE;AACrC,IAAA,kBAAkB;IAClB,YAAY,GAAG,EAAE;AAEhB,IAAA,WAAW,GAAG,MAAM,CAAC,mBAAmB,CAAC;AACzC,IAAA,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;AAE9B,IAAA,WAAA,GAAA;AAEE,QAAA,IAAI,CAAC,kBAAkB,GAAG,IAAI,SAAS,CAAC;AACtC,YAAA,iBAAiB,EAAE,IAAI,WAAW,CAAC,EAAE,CAAC;AACtC,YAAA,qBAAqB,EAAE,IAAI,WAAW,CAAC,EAAE;AAC1C,SAAA,CAA0F;;IAG7F,iBAAiB,GAAA;AACf,QAAA,IAAI,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE;AACjC,YAAA,IAAI,CAAC,WAAW,CAAC,YAAY,GAAG,IAAI;AACpC,YAAA,MAAM,cAAc,GAAmB;AACrC,gBAAA,aAAa,EAAE,IAAI,CAAC,kBAAkB,EAAE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AA,UAAA,EACxB,IAAI,EAAA,OAAA,EACP,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,YAAY,EAAE,sBAAsB,CAAC,EAAA,QAAA,EAAA,+tDAAA,EAAA;;;;;"}
|
|
@@ -9,18 +9,19 @@ import { CideInputComponent, CideEleButtonComponent } from 'cloud-ide-element';
|
|
|
9
9
|
import { CideLytSharedWrapperComponent, AppStateHelperService } from 'cloud-ide-layout';
|
|
10
10
|
|
|
11
11
|
class CideAuthSignInComponent extends CideLytSharedWrapperComponent {
|
|
12
|
+
shared_wrapper_setup_param = {
|
|
13
|
+
sypg_page_code: "auth_sign_in"
|
|
14
|
+
};
|
|
15
|
+
setup_param = { form_loading: false };
|
|
16
|
+
loginForm;
|
|
17
|
+
erro_message = "";
|
|
18
|
+
returnUrl = '/control-panel'; // Default return URL
|
|
19
|
+
router = inject(Router);
|
|
20
|
+
activatedRoute = inject(ActivatedRoute);
|
|
21
|
+
authService = inject(CloudIdeAuthService);
|
|
22
|
+
appStateService = inject(AppStateHelperService);
|
|
12
23
|
constructor() {
|
|
13
24
|
super();
|
|
14
|
-
this.shared_wrapper_setup_param = {
|
|
15
|
-
sypg_page_code: "auth_sign_in"
|
|
16
|
-
};
|
|
17
|
-
this.setup_param = { form_loading: false };
|
|
18
|
-
this.erro_message = "";
|
|
19
|
-
this.returnUrl = '/control-panel'; // Default return URL
|
|
20
|
-
this.router = inject(Router);
|
|
21
|
-
this.activatedRoute = inject(ActivatedRoute);
|
|
22
|
-
this.authService = inject(CloudIdeAuthService);
|
|
23
|
-
this.appStateService = inject(AppStateHelperService);
|
|
24
25
|
this.loginForm = new FormGroup({
|
|
25
26
|
custom_login_method: new FormControl('pass'),
|
|
26
27
|
user_username: new FormControl(''),
|
|
@@ -42,7 +43,7 @@ class CideAuthSignInComponent extends CideLytSharedWrapperComponent {
|
|
|
42
43
|
if (this.loginForm.valid) {
|
|
43
44
|
this.setup_param.form_loading = true;
|
|
44
45
|
this.authService.signIn(this.loginForm?.value)?.subscribe({
|
|
45
|
-
next: (response) => {
|
|
46
|
+
next: async (response) => {
|
|
46
47
|
if (response?.success === true) {
|
|
47
48
|
// Store user data in auth service
|
|
48
49
|
this.authService.storeUserData(response?.data?.auth_user_mst || {});
|
|
@@ -53,6 +54,7 @@ class CideAuthSignInComponent extends CideLytSharedWrapperComponent {
|
|
|
53
54
|
// Store token through the service setter which saves to localStorage
|
|
54
55
|
this.authService.auth_token = (response?.token || '');
|
|
55
56
|
// Navigate to the return URL or control panel
|
|
57
|
+
await new Promise(resolve => setTimeout(resolve, 200));
|
|
56
58
|
this.router.navigateByUrl(this.returnUrl);
|
|
57
59
|
}
|
|
58
60
|
},
|
|
@@ -69,13 +71,13 @@ class CideAuthSignInComponent extends CideLytSharedWrapperComponent {
|
|
|
69
71
|
});
|
|
70
72
|
}
|
|
71
73
|
}
|
|
72
|
-
static
|
|
73
|
-
static
|
|
74
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: CideAuthSignInComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
75
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.7", type: CideAuthSignInComponent, isStandalone: true, selector: "cide-auth-sign-in", usesInheritance: true, ngImport: i0, template: "<!-- https://play.tailwindcss.com/lfO85drpUy -->\r\n<!-- Main Div Outer Div-->\r\n<div class=\"cide-font-poppins tw-flex tw-min-h-screen tw-w-full tw-bg-gray-50 tw-py-3\">\r\n <!-- Login Forrm Wrapper -->\r\n <div class=\"tw-m-auto tw-w-96 tw-rounded-2xl tw-bg-white tw-py-6 tw-shadow-xl\">\r\n <!-- Logo Wrapper -->\r\n <div class=\"tw-m-auto tw-h-32 tw-w-64 tw-text-center\">\r\n <img src=\"https://console.cloudidesys.com/assets/Cloud%20IDE%20Logo%20Dark.png\" class=\"tw-m-auto tw-h-full\"\r\n alt=\"Cloud IDE Logo\" />\r\n </div> <!-- Entity name here -->\r\n <div class=\"tw-my-2 tw-text-center tw-text-xl tw-font-semibold\">SignIn to CloudIDE sys</div>\r\n <!-- Error Logger -->\r\n <div class=\"tw-w-full tw-select-none tw-py-1 tw-text-center tw-text-red-500 tw-h-4 tw-text-sm\">{{erro_message}}</div>\r\n \r\n <!-- section for controls -->\r\n <form [formGroup]=\"loginForm\" (ngSubmit)=\"onSignIn()\" novalidate>\r\n <div class=\"tw-m-auto tw-pb-3 tw-pt-3\">\r\n <!-- Username -->\r\n <div class=\"tw-m-auto tw-w-80\">\r\n <cide-ele-input id=\"user_username\" formControlName=\"user_username\"></cide-ele-input>\r\n </div>\r\n <!-- Password -->\r\n <div class=\"tw-m-auto tw-mt-4 tw-w-80\">\r\n <cide-ele-input id=\"user_password_mpin\" formControlName=\"user_password\"></cide-ele-input>\r\n </div>\r\n <!-- Forgot password -->\r\n <div class=\"tw-m-auto tw-mt-3 tw-flex tw-w-80 tw-justify-between\">\r\n <div>\r\n <cide-ele-input id=\"stay_sign_in\" formControlName=\"stay_sign_in\"></cide-ele-input>\r\n </div>\r\n <div>\r\n <a routerLink=\"/auth/forgot-password\" class=\"tw-text-blue-700\">Forgot Password?</a>\r\n </div>\r\n </div> <!-- Sign in button -->\r\n <div class=\"tw-w-80 tw-m-auto tw-mt-3\">\r\n <button type=\"submit\" class=\"tw-w-full\" cideEleButton id=\"stay_sin_button\" [loading]=\"setup_param.form_loading\" [disabled]=\"!loginForm.valid\">a</button>\r\n </div>\r\n </div>\r\n </form>\r\n </div>\r\n</div>", styles: [""], dependencies: [{ kind: "component", type: CideInputComponent, selector: "cide-ele-input", inputs: ["fill", "label", "labelHide", "disabled", "clearInput", "labelPlacement", "labelDir", "placeholder", "leadingIcon", "trailingIcon", "helperText", "helperTextCollapse", "hideHelperAndErrorText", "errorText", "maxlength", "minlength", "required", "autocapitalize", "autocomplete", "type", "width", "id", "ngModel", "option", "min", "max", "size"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: CommonModule }, { kind: "component", type: CideEleButtonComponent, selector: "button[cideEleButton], a[cideEleButton]", inputs: ["label", "variant", "size", "type", "shape", "elevation", "disabled", "id", "loading", "fullWidth", "leftIcon", "rightIcon", "customClass", "tooltip", "ariaLabel", "testId", "routerLink", "routerExtras", "preventDoubleClick", "animated"], outputs: ["btnClick", "doubleClick"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }] });
|
|
74
76
|
}
|
|
75
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
77
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: CideAuthSignInComponent, decorators: [{
|
|
76
78
|
type: Component,
|
|
77
79
|
args: [{ selector: 'cide-auth-sign-in', standalone: true, imports: [CideInputComponent, ReactiveFormsModule, CommonModule, CideEleButtonComponent, RouterLink], template: "<!-- https://play.tailwindcss.com/lfO85drpUy -->\r\n<!-- Main Div Outer Div-->\r\n<div class=\"cide-font-poppins tw-flex tw-min-h-screen tw-w-full tw-bg-gray-50 tw-py-3\">\r\n <!-- Login Forrm Wrapper -->\r\n <div class=\"tw-m-auto tw-w-96 tw-rounded-2xl tw-bg-white tw-py-6 tw-shadow-xl\">\r\n <!-- Logo Wrapper -->\r\n <div class=\"tw-m-auto tw-h-32 tw-w-64 tw-text-center\">\r\n <img src=\"https://console.cloudidesys.com/assets/Cloud%20IDE%20Logo%20Dark.png\" class=\"tw-m-auto tw-h-full\"\r\n alt=\"Cloud IDE Logo\" />\r\n </div> <!-- Entity name here -->\r\n <div class=\"tw-my-2 tw-text-center tw-text-xl tw-font-semibold\">SignIn to CloudIDE sys</div>\r\n <!-- Error Logger -->\r\n <div class=\"tw-w-full tw-select-none tw-py-1 tw-text-center tw-text-red-500 tw-h-4 tw-text-sm\">{{erro_message}}</div>\r\n \r\n <!-- section for controls -->\r\n <form [formGroup]=\"loginForm\" (ngSubmit)=\"onSignIn()\" novalidate>\r\n <div class=\"tw-m-auto tw-pb-3 tw-pt-3\">\r\n <!-- Username -->\r\n <div class=\"tw-m-auto tw-w-80\">\r\n <cide-ele-input id=\"user_username\" formControlName=\"user_username\"></cide-ele-input>\r\n </div>\r\n <!-- Password -->\r\n <div class=\"tw-m-auto tw-mt-4 tw-w-80\">\r\n <cide-ele-input id=\"user_password_mpin\" formControlName=\"user_password\"></cide-ele-input>\r\n </div>\r\n <!-- Forgot password -->\r\n <div class=\"tw-m-auto tw-mt-3 tw-flex tw-w-80 tw-justify-between\">\r\n <div>\r\n <cide-ele-input id=\"stay_sign_in\" formControlName=\"stay_sign_in\"></cide-ele-input>\r\n </div>\r\n <div>\r\n <a routerLink=\"/auth/forgot-password\" class=\"tw-text-blue-700\">Forgot Password?</a>\r\n </div>\r\n </div> <!-- Sign in button -->\r\n <div class=\"tw-w-80 tw-m-auto tw-mt-3\">\r\n <button type=\"submit\" class=\"tw-w-full\" cideEleButton id=\"stay_sin_button\" [loading]=\"setup_param.form_loading\" [disabled]=\"!loginForm.valid\">a</button>\r\n </div>\r\n </div>\r\n </form>\r\n </div>\r\n</div>" }]
|
|
78
80
|
}], ctorParameters: () => [] });
|
|
79
81
|
|
|
80
82
|
export { CideAuthSignInComponent };
|
|
81
|
-
//# sourceMappingURL=cloud-ide-auth-sign-in.component-
|
|
83
|
+
//# sourceMappingURL=cloud-ide-auth-sign-in.component-CoF5MNMX.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-ide-auth-sign-in.component-CoF5MNMX.mjs","sources":["../../../projects/cloud-ide-auth/src/lib/auth/sign-in/sign-in.component.ts","../../../projects/cloud-ide-auth/src/lib/auth/sign-in/sign-in.component.html"],"sourcesContent":["import { Component, inject, OnInit } from '@angular/core';\nimport { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';\nimport { CommonModule } from '@angular/common';\nimport { loginMethod, MLogin } from 'cloud-ide-lms-model';\nimport { Router, RouterLink, ActivatedRoute } from '@angular/router';\nimport { CloudIdeAuthService } from '../../cloud-ide-auth.service';\nimport { CideEleButtonComponent, CideInputComponent } from 'cloud-ide-element';\nimport { CideLytSharedWrapperComponent, CideLytSharedWrapperSetupParam, AppStateHelperService } from 'cloud-ide-layout';\n\nexport type FormGroupModel<T> = FormGroup<{\n [K in keyof T]: FormControl<T[K]>\n}>\n\n@Component({\n selector: 'cide-auth-sign-in',\n standalone: true,\n imports: [CideInputComponent, ReactiveFormsModule, CommonModule, CideEleButtonComponent, RouterLink],\n templateUrl: './sign-in.component.html',\n styleUrl: './sign-in.component.css'\n})\nexport class CideAuthSignInComponent extends CideLytSharedWrapperComponent implements OnInit {\n public override shared_wrapper_setup_param: Partial<CideLytSharedWrapperSetupParam> = {\n sypg_page_code: \"auth_sign_in\"\n }\n public setup_param = { form_loading: false };\n public loginForm: FormGroupModel<MLogin>;\n public erro_message = \"\";\n private returnUrl: string = '/control-panel'; // Default return URL\n private router = inject(Router);\n private activatedRoute = inject(ActivatedRoute);\n private authService = inject(CloudIdeAuthService);\n private appStateService = inject(AppStateHelperService);\n constructor(\n ) {\n super();\n\n this.loginForm = new FormGroup({\n custom_login_method: new FormControl<loginMethod>('pass'),\n user_username: new FormControl(''),\n user_password: new FormControl(''),\n mpin_pin: new FormControl(''),\n stay_sign_in: new FormControl(true)\n }) as unknown as FormGroupModel<MLogin>;\n }\n\n override ngOnInit(): void {\n super.ngOnInit();\n\n // Get return URL from route parameters or default to '/control-panel'\n this.returnUrl = this.activatedRoute.snapshot.queryParams['returnUrl'] || 'control-panel';\n\n // If user is already authenticated, redirect to the return URL\n if (this.authService.isAuthenticated() && !this.authService.isTokenExpired()) {\n this.router.navigateByUrl(this.returnUrl);\n }\n }\n\n onSignIn(): void {\n if (this.loginForm.valid) {\n this.setup_param.form_loading = true;\n this.authService.signIn(this.loginForm?.value as MLogin)?.subscribe({\n next: async (response) => {\n if (response?.success === true) {\n // Store user data in auth service\n this.authService.storeUserData(response?.data?.auth_user_mst || {});\n\n // Synchronize AppStateService with the same user data \n this.appStateService.setUser(response?.data?.auth_user_mst || null);\n\n // Store active entity data\n this.appStateService.setActiveEntity(response?.data?.core_system_entity || null);\n\n // Store token through the service setter which saves to localStorage\n this.authService.auth_token = (response?.token || '');\n\n // Navigate to the return URL or control panel\n await new Promise(resolve => setTimeout(resolve, 200));\n this.router.navigateByUrl(this.returnUrl);\n }\n },\n error: (error) => {\n this.setup_param.form_loading = false;\n this.erro_message = error?.error?.message;\n console.log(error);\n // Modern ES2022+ pattern: Use Promise-based delay\n const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));\n delay(3000).then(() => {\n this.erro_message = \"\";\n });\n }\n });\n }\n }\n}","<!-- https://play.tailwindcss.com/lfO85drpUy -->\r\n<!-- Main Div Outer Div-->\r\n<div class=\"cide-font-poppins tw-flex tw-min-h-screen tw-w-full tw-bg-gray-50 tw-py-3\">\r\n <!-- Login Forrm Wrapper -->\r\n <div class=\"tw-m-auto tw-w-96 tw-rounded-2xl tw-bg-white tw-py-6 tw-shadow-xl\">\r\n <!-- Logo Wrapper -->\r\n <div class=\"tw-m-auto tw-h-32 tw-w-64 tw-text-center\">\r\n <img src=\"https://console.cloudidesys.com/assets/Cloud%20IDE%20Logo%20Dark.png\" class=\"tw-m-auto tw-h-full\"\r\n alt=\"Cloud IDE Logo\" />\r\n </div> <!-- Entity name here -->\r\n <div class=\"tw-my-2 tw-text-center tw-text-xl tw-font-semibold\">SignIn to CloudIDE sys</div>\r\n <!-- Error Logger -->\r\n <div class=\"tw-w-full tw-select-none tw-py-1 tw-text-center tw-text-red-500 tw-h-4 tw-text-sm\">{{erro_message}}</div>\r\n \r\n <!-- section for controls -->\r\n <form [formGroup]=\"loginForm\" (ngSubmit)=\"onSignIn()\" novalidate>\r\n <div class=\"tw-m-auto tw-pb-3 tw-pt-3\">\r\n <!-- Username -->\r\n <div class=\"tw-m-auto tw-w-80\">\r\n <cide-ele-input id=\"user_username\" formControlName=\"user_username\"></cide-ele-input>\r\n </div>\r\n <!-- Password -->\r\n <div class=\"tw-m-auto tw-mt-4 tw-w-80\">\r\n <cide-ele-input id=\"user_password_mpin\" formControlName=\"user_password\"></cide-ele-input>\r\n </div>\r\n <!-- Forgot password -->\r\n <div class=\"tw-m-auto tw-mt-3 tw-flex tw-w-80 tw-justify-between\">\r\n <div>\r\n <cide-ele-input id=\"stay_sign_in\" formControlName=\"stay_sign_in\"></cide-ele-input>\r\n </div>\r\n <div>\r\n <a routerLink=\"/auth/forgot-password\" class=\"tw-text-blue-700\">Forgot Password?</a>\r\n </div>\r\n </div> <!-- Sign in button -->\r\n <div class=\"tw-w-80 tw-m-auto tw-mt-3\">\r\n <button type=\"submit\" class=\"tw-w-full\" cideEleButton id=\"stay_sin_button\" [loading]=\"setup_param.form_loading\" [disabled]=\"!loginForm.valid\">a</button>\r\n </div>\r\n </div>\r\n </form>\r\n </div>\r\n</div>"],"names":[],"mappings":";;;;;;;;;;AAoBM,MAAO,uBAAwB,SAAQ,6BAA6B,CAAA;AACxD,IAAA,0BAA0B,GAA4C;AACpF,QAAA,cAAc,EAAE;KACjB;AACM,IAAA,WAAW,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE;AACrC,IAAA,SAAS;IACT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