@smartbit4all/ng-client 1.1.24 → 1.1.26
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/esm2020/lib/session/smart-session.service.mjs +31 -17
- package/esm2020/lib/view-context/smart-view-context-error-dialog/smart-view-context-error-dialog.component.mjs +11 -6
- package/esm2020/lib/view-context/smart-view-context-error-dialog/smart-view-context-error-dialog.service.mjs +26 -6
- package/esm2020/lib/view-context/smart-view-context.service.mjs +51 -25
- package/fesm2015/smartbit4all-ng-client.mjs +135 -67
- package/fesm2015/smartbit4all-ng-client.mjs.map +1 -1
- package/fesm2020/smartbit4all-ng-client.mjs +113 -50
- package/fesm2020/smartbit4all-ng-client.mjs.map +1 -1
- package/lib/session/smart-session.service.d.ts +1 -0
- package/lib/view-context/smart-view-context-error-dialog/smart-view-context-error-dialog.component.d.ts +4 -4
- package/lib/view-context/smart-view-context-error-dialog/smart-view-context-error-dialog.service.d.ts +1 -1
- package/lib/view-context/smart-view-context.service.d.ts +6 -2
- package/package.json +1 -1
- package/smartbit4all-ng-client-1.1.26.tgz +0 -0
- package/smartbit4all-ng-client-1.1.24.tgz +0 -0
|
@@ -811,26 +811,40 @@ class SmartSessionService {
|
|
|
811
811
|
}
|
|
812
812
|
}
|
|
813
813
|
async initialize() {
|
|
814
|
-
this.
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
this.
|
|
819
|
-
this.setUpTokenForSessionService();
|
|
814
|
+
if (this.initializeRunning) {
|
|
815
|
+
return this.initializeRunning.toPromise();
|
|
816
|
+
}
|
|
817
|
+
else {
|
|
818
|
+
this.initializeRunning = new Subject();
|
|
820
819
|
try {
|
|
821
|
-
|
|
820
|
+
this.checkStatements();
|
|
821
|
+
let tokenFromLocalStorage = localStorage.getItem('token');
|
|
822
|
+
let tokenFromCookies = this.cookieService.get(this.cookieName);
|
|
823
|
+
if (tokenFromLocalStorage &&
|
|
824
|
+
tokenFromCookies &&
|
|
825
|
+
tokenFromLocalStorage === tokenFromCookies) {
|
|
826
|
+
this.token = tokenFromLocalStorage;
|
|
827
|
+
this.setUpTokenForSessionService();
|
|
828
|
+
try {
|
|
829
|
+
await this.getSession();
|
|
830
|
+
}
|
|
831
|
+
catch (err) {
|
|
832
|
+
await this.startSession();
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
else {
|
|
836
|
+
await this.clearAndStartNewSession();
|
|
837
|
+
}
|
|
838
|
+
if (this.sessionInfoData && this.sessionInfoData.locale) {
|
|
839
|
+
localStorage.setItem(this.localStorageLocaleName, this.sessionInfoData.locale);
|
|
840
|
+
this.localeChanged.next();
|
|
841
|
+
}
|
|
822
842
|
}
|
|
823
|
-
|
|
824
|
-
|
|
843
|
+
finally {
|
|
844
|
+
this.initializeRunning.next();
|
|
845
|
+
this.initializeRunning = undefined;
|
|
825
846
|
}
|
|
826
847
|
}
|
|
827
|
-
else {
|
|
828
|
-
await this.clearAndStartNewSession();
|
|
829
|
-
}
|
|
830
|
-
if (this.sessionInfoData && this.sessionInfoData.locale) {
|
|
831
|
-
localStorage.setItem(this.localStorageLocaleName, this.sessionInfoData.locale);
|
|
832
|
-
this.localeChanged.next();
|
|
833
|
-
}
|
|
834
848
|
}
|
|
835
849
|
async startSession() {
|
|
836
850
|
let sessionInfo = await this.apiService.startSession().toPromise();
|
|
@@ -2075,6 +2089,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
2075
2089
|
args: [{ selector: "app-message-dialog", template: "<div class=\"taskDialogContainer\" *ngIf=\"messageData\">\r\n\t<h2>\r\n\t\t{{ messageData.header }}\r\n\t</h2>\r\n\t<p>{{ messageData.text }}</p>\r\n\t<div class=\"buttonsContainer\">\r\n\t\t<button\r\n\t\t\t*ngFor=\"let option of messageData.options\"\r\n\t\t\tmat-button\r\n\t\t\tclass=\"taskDialogButton\"\r\n\t\t\t[ngClass]=\"getType(option)\"\r\n\t\t\tcolor=\"{{ getColor(option) }}\"\r\n\t\t\t(click)=\"onClick(option)\"\r\n\t\t>\r\n\t\t\t<mat-icon *ngIf=\"option.icon\">\r\n\t\t\t\t{{ option.icon }}\r\n\t\t\t</mat-icon>\r\n\t\t\t{{ option.label }}\r\n\t\t</button>\r\n\t</div>\r\n</div>\r\n", styles: [".taskDialogContainer{width:400px;display:flex;flex-direction:column;gap:.5rem}.spacer{flex:1}.buttonsContainer{display:flex;flex-direction:row;gap:.5rem;justify-content:flex-end}.taskDialogButton{min-width:100px}h2,p{margin:0!important}\n"] }]
|
|
2076
2090
|
}], ctorParameters: function () { return [{ type: SmartViewContextService }]; } });
|
|
2077
2091
|
|
|
2092
|
+
const SmartViewContextErrorDialogButtonLabel = 'SmartViewContextErrorDialogButtonLabel';
|
|
2093
|
+
const SmartViewContextErrorDialogTitle = 'SmartViewContextErrorDialogTitle';
|
|
2094
|
+
const SmartViewContextErrorDialogMessage = 'SmartViewContextErrorDialogMessage';
|
|
2078
2095
|
class SmartViewContextService {
|
|
2079
2096
|
constructor(view, session, navigation, dialog, apiQueueService) {
|
|
2080
2097
|
this.view = view;
|
|
@@ -2200,29 +2217,37 @@ class SmartViewContextService {
|
|
|
2200
2217
|
return this.viewContext;
|
|
2201
2218
|
}
|
|
2202
2219
|
async initialize(uuid) {
|
|
2203
|
-
if (this.
|
|
2204
|
-
|
|
2205
|
-
}
|
|
2206
|
-
if (!this.messageDialogname) {
|
|
2207
|
-
throw new Error('The messageDialogName provided by the backend has not been set.');
|
|
2220
|
+
if (this.initializeRunning) {
|
|
2221
|
+
return this.initializeRunning.toPromise();
|
|
2208
2222
|
}
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2223
|
+
else {
|
|
2224
|
+
this.initializeRunning = new Subject();
|
|
2225
|
+
try {
|
|
2226
|
+
if (this.viewHandlers.length === 0) {
|
|
2227
|
+
throw new Error("There aren't any viewHandlers in SmartViewContextService! Provide some to use its functions.");
|
|
2228
|
+
}
|
|
2229
|
+
if (!this.messageDialogname) {
|
|
2230
|
+
throw new Error('The messageDialogName provided by the backend has not been set.');
|
|
2231
|
+
}
|
|
2232
|
+
if (uuid) {
|
|
2214
2233
|
this.setTabId(uuid);
|
|
2234
|
+
try {
|
|
2235
|
+
await this.getViewContext(uuid);
|
|
2236
|
+
}
|
|
2237
|
+
catch (err) {
|
|
2238
|
+
await this.startViewContext();
|
|
2239
|
+
}
|
|
2215
2240
|
}
|
|
2216
|
-
|
|
2241
|
+
else {
|
|
2217
2242
|
await this.startViewContext();
|
|
2218
2243
|
}
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2244
|
+
return this.viewContext;
|
|
2245
|
+
}
|
|
2246
|
+
finally {
|
|
2247
|
+
this.initializeRunning.next(this.viewContext);
|
|
2248
|
+
this.initializeRunning = undefined;
|
|
2249
|
+
}
|
|
2224
2250
|
}
|
|
2225
|
-
return this.viewContext;
|
|
2226
2251
|
}
|
|
2227
2252
|
openView(view) {
|
|
2228
2253
|
let viewHandler = this.viewHandlers.find((handler) => handler.name === view.viewName);
|
|
@@ -2350,13 +2375,28 @@ class SmartViewContextService {
|
|
|
2350
2375
|
.toPromise();
|
|
2351
2376
|
await this.getAndSyncViewContext();
|
|
2352
2377
|
}
|
|
2353
|
-
getSmartViewContextApiErrorByCode(code) {
|
|
2378
|
+
async getSmartViewContextApiErrorByCode(code) {
|
|
2379
|
+
let buttonLabel;
|
|
2380
|
+
let dialogTitle;
|
|
2381
|
+
let message;
|
|
2382
|
+
if (this.translateService) {
|
|
2383
|
+
buttonLabel = await this.translateService
|
|
2384
|
+
.get(SmartViewContextErrorDialogButtonLabel)
|
|
2385
|
+
.toPromise();
|
|
2386
|
+
dialogTitle = await this.translateService.get(SmartViewContextErrorDialogTitle).toPromise();
|
|
2387
|
+
message = await this.translateService.get(SmartViewContextErrorDialogMessage).toPromise();
|
|
2388
|
+
}
|
|
2389
|
+
else {
|
|
2390
|
+
buttonLabel = 'Ok';
|
|
2391
|
+
dialogTitle = 'Hiba';
|
|
2392
|
+
message = 'An error has occured.';
|
|
2393
|
+
}
|
|
2354
2394
|
if (!this.smartViewContextApiErrors) {
|
|
2355
2395
|
return {
|
|
2356
2396
|
code,
|
|
2357
|
-
message
|
|
2358
|
-
buttonLabel
|
|
2359
|
-
dialogTitle
|
|
2397
|
+
message,
|
|
2398
|
+
buttonLabel,
|
|
2399
|
+
dialogTitle,
|
|
2360
2400
|
};
|
|
2361
2401
|
}
|
|
2362
2402
|
let apiErrorsWithCode = this.smartViewContextApiErrors.viewContextApiErrors.filter((apiError) => {
|
|
@@ -2366,9 +2406,9 @@ class SmartViewContextService {
|
|
|
2366
2406
|
console.error(`SmartViewContextApiError with code ${code} could not be found.`);
|
|
2367
2407
|
return {
|
|
2368
2408
|
code,
|
|
2369
|
-
message
|
|
2370
|
-
buttonLabel
|
|
2371
|
-
dialogTitle
|
|
2409
|
+
message,
|
|
2410
|
+
buttonLabel,
|
|
2411
|
+
dialogTitle,
|
|
2372
2412
|
};
|
|
2373
2413
|
}
|
|
2374
2414
|
return apiErrorsWithCode[0];
|
|
@@ -3172,15 +3212,34 @@ class SmartViewContextErrorDialogService extends SmartdialogService {
|
|
|
3172
3212
|
let dialogRef = this.dialogRefs.pop();
|
|
3173
3213
|
dialogRef?.close();
|
|
3174
3214
|
}
|
|
3175
|
-
getSmartViewContextApiError() {
|
|
3215
|
+
async getSmartViewContextApiError() {
|
|
3176
3216
|
if (this.viewApiError?.code) {
|
|
3177
|
-
return this.viewContext.getSmartViewContextApiErrorByCode(this.viewApiError.code);
|
|
3217
|
+
return await this.viewContext.getSmartViewContextApiErrorByCode(this.viewApiError.code);
|
|
3218
|
+
}
|
|
3219
|
+
let dialogTitle;
|
|
3220
|
+
let buttonLabel;
|
|
3221
|
+
let message;
|
|
3222
|
+
if (this.viewContext.translateService) {
|
|
3223
|
+
dialogTitle = await this.viewContext.translateService
|
|
3224
|
+
.get(SmartViewContextErrorDialogTitle)
|
|
3225
|
+
.toPromise();
|
|
3226
|
+
buttonLabel = await this.viewContext.translateService
|
|
3227
|
+
.get(SmartViewContextErrorDialogButtonLabel)
|
|
3228
|
+
.toPromise();
|
|
3229
|
+
message = await this.viewContext.translateService
|
|
3230
|
+
.get(SmartViewContextErrorDialogMessage)
|
|
3231
|
+
.toPromise();
|
|
3232
|
+
}
|
|
3233
|
+
else {
|
|
3234
|
+
buttonLabel = 'Ok';
|
|
3235
|
+
dialogTitle = 'Hiba';
|
|
3236
|
+
message = 'An error has occured.';
|
|
3178
3237
|
}
|
|
3179
3238
|
return {
|
|
3180
3239
|
code: this.viewApiError?.code ?? '',
|
|
3181
|
-
message: this.viewApiError?.message ??
|
|
3182
|
-
buttonLabel
|
|
3183
|
-
dialogTitle
|
|
3240
|
+
message: this.viewApiError?.message ?? message,
|
|
3241
|
+
buttonLabel,
|
|
3242
|
+
dialogTitle,
|
|
3184
3243
|
};
|
|
3185
3244
|
}
|
|
3186
3245
|
}
|
|
@@ -3196,21 +3255,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
3196
3255
|
class SmartViewContextErrorDialogComponent {
|
|
3197
3256
|
constructor(service) {
|
|
3198
3257
|
this.service = service;
|
|
3199
|
-
this.
|
|
3258
|
+
this.service
|
|
3259
|
+
.getSmartViewContextApiError()
|
|
3260
|
+
.then((smartViewContextApiError) => {
|
|
3261
|
+
this.smartViewContextApiError = smartViewContextApiError;
|
|
3262
|
+
});
|
|
3200
3263
|
}
|
|
3201
3264
|
ngOnInit() { }
|
|
3202
3265
|
onActionClick() {
|
|
3203
|
-
if (this.smartViewContextApiError
|
|
3266
|
+
if (this.smartViewContextApiError?.customAction) {
|
|
3204
3267
|
this.smartViewContextApiError.customAction();
|
|
3205
3268
|
}
|
|
3206
3269
|
this.service.closeDialog();
|
|
3207
3270
|
}
|
|
3208
3271
|
}
|
|
3209
3272
|
SmartViewContextErrorDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextErrorDialogComponent, deps: [{ token: SmartViewContextErrorDialogService }], target: i0.ɵɵFactoryTarget.Component });
|
|
3210
|
-
SmartViewContextErrorDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: SmartViewContextErrorDialogComponent, selector: "lib-smart-view-context-error-dialog", ngImport: i0, template: "<div class=\"container\">\r\n
|
|
3273
|
+
SmartViewContextErrorDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: SmartViewContextErrorDialogComponent, selector: "lib-smart-view-context-error-dialog", ngImport: i0, template: "<div *ngIf=\"smartViewContextApiError\" class=\"container\">\r\n <h3 class=\"color-accent-700\">\r\n {{ smartViewContextApiError.dialogTitle }}\r\n </h3>\r\n <div class=\"content\">\r\n <p>\r\n {{ smartViewContextApiError.message }}\r\n </p>\r\n </div>\r\n <div class=\"buttonContainer\">\r\n <button mat-raised-button color=\"primary\" (click)=\"onActionClick()\">\r\n {{ smartViewContextApiError.buttonLabel }}\r\n </button>\r\n </div>\r\n</div>\r\n", styles: [".container{display:flex;flex-direction:column;gap:1em;min-width:25rem;max-width:50vw;height:auto;max-height:75vh}.content{flex:1;overflow:auto}.buttonContainer{display:flex;flex-direction:row;justify-content:flex-end}\n"], components: [{ type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
3211
3274
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextErrorDialogComponent, decorators: [{
|
|
3212
3275
|
type: Component,
|
|
3213
|
-
args: [{ selector:
|
|
3276
|
+
args: [{ selector: 'lib-smart-view-context-error-dialog', template: "<div *ngIf=\"smartViewContextApiError\" class=\"container\">\r\n <h3 class=\"color-accent-700\">\r\n {{ smartViewContextApiError.dialogTitle }}\r\n </h3>\r\n <div class=\"content\">\r\n <p>\r\n {{ smartViewContextApiError.message }}\r\n </p>\r\n </div>\r\n <div class=\"buttonContainer\">\r\n <button mat-raised-button color=\"primary\" (click)=\"onActionClick()\">\r\n {{ smartViewContextApiError.buttonLabel }}\r\n </button>\r\n </div>\r\n</div>\r\n", styles: [".container{display:flex;flex-direction:column;gap:1em;min-width:25rem;max-width:50vw;height:auto;max-height:75vh}.content{flex:1;overflow:auto}.buttonContainer{display:flex;flex-direction:row;justify-content:flex-end}\n"] }]
|
|
3214
3277
|
}], ctorParameters: function () { return [{ type: SmartViewContextErrorDialogService }]; } });
|
|
3215
3278
|
|
|
3216
3279
|
class SmartViewContextInterceptor {
|
|
@@ -4386,5 +4449,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
4386
4449
|
* Generated bundle index. Do not edit.
|
|
4387
4450
|
*/
|
|
4388
4451
|
|
|
4389
|
-
export { APIS, ApiModule, ApiQueueService, BASE_PATH, COLLECTION_FORMATS, CloseResult, Configuration, DataChangeKind, IS_ASYNC_PARAM_NAME, MessageOptionType, MessageType, SessionAPIS, SessionErrorBehaviour, SessionService, SmartAuthService, SmartComponent, SmartComponentApiClient, SmartDevToolDatePipe, SmartDevToolFloatingButtonComponent, SmartDevToolService, SmartLinkChannelVariableInPath, SmartLinkUuidVariableInPath, SmartNgClientModule, SmartNgClientService, SmartService, SmartSessionModule, SmartSessionService, SmartSessionTimerComponent, SmartSessionTimerService, SmartSubject, SmartViewContextModule, SmartViewContextService, SmartViewRedirect, UiActionButtonIconPos, UiActionButtonType, UiActionConfirmDialogComponent, UiActionConfirmDialogService, UiActionDescriptorService, UiActionDialogType, UiActionFeedbackType, UiActionInputDialogComponent, UiActionInputDialogService, UiActionInputType, UiActionService, UiActionToolbarComponent, ViewEventHandler, ViewService, ViewState, ViewType, WidgetMap };
|
|
4452
|
+
export { APIS, ApiModule, ApiQueueService, BASE_PATH, COLLECTION_FORMATS, CloseResult, Configuration, DataChangeKind, IS_ASYNC_PARAM_NAME, MessageOptionType, MessageType, SessionAPIS, SessionErrorBehaviour, SessionService, SmartAuthService, SmartComponent, SmartComponentApiClient, SmartDevToolDatePipe, SmartDevToolFloatingButtonComponent, SmartDevToolService, SmartLinkChannelVariableInPath, SmartLinkUuidVariableInPath, SmartNgClientModule, SmartNgClientService, SmartService, SmartSessionModule, SmartSessionService, SmartSessionTimerComponent, SmartSessionTimerService, SmartSubject, SmartViewContextErrorDialogButtonLabel, SmartViewContextErrorDialogMessage, SmartViewContextErrorDialogTitle, SmartViewContextModule, SmartViewContextService, SmartViewRedirect, UiActionButtonIconPos, UiActionButtonType, UiActionConfirmDialogComponent, UiActionConfirmDialogService, UiActionDescriptorService, UiActionDialogType, UiActionFeedbackType, UiActionInputDialogComponent, UiActionInputDialogService, UiActionInputType, UiActionService, UiActionToolbarComponent, ViewEventHandler, ViewService, ViewState, ViewType, WidgetMap };
|
|
4390
4453
|
//# sourceMappingURL=smartbit4all-ng-client.mjs.map
|