@nucleus-suite-pe/core 0.1.0 → 0.2.1
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.
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
2
|
import { InjectionToken, EnvironmentProviders, Signal } from '@angular/core';
|
|
3
3
|
import { HttpContextToken, HttpInterceptorFn } from '@angular/common/http';
|
|
4
|
-
import * as _nucleus_suite_pe_core from '@nucleus-suite-pe/core';
|
|
5
4
|
import * as _primeuix_themes from '@primeuix/themes';
|
|
6
5
|
import * as _primeuix_themes_types_base from '@primeuix/themes/types/base';
|
|
6
|
+
import * as _nucleus_suite_pe_core from '@nucleus-suite-pe/core';
|
|
7
7
|
|
|
8
8
|
interface NucleusConfig {
|
|
9
9
|
readonly appId: string;
|
|
@@ -37,6 +37,10 @@ declare const NUCLEUS_SKIP_AUTH: HttpContextToken<boolean>;
|
|
|
37
37
|
|
|
38
38
|
declare const nucleusAuthInterceptor: HttpInterceptorFn;
|
|
39
39
|
|
|
40
|
+
declare const NUCLEUS_LOGOUT_PARAM = "nucleus_logout";
|
|
41
|
+
declare function nucleusLogoutUrl(landingUrl: string): string;
|
|
42
|
+
declare function consumeNucleusLogout(): boolean;
|
|
43
|
+
|
|
40
44
|
interface SessionTicket {
|
|
41
45
|
readonly userId: string;
|
|
42
46
|
readonly expiresAtUtc: string;
|
|
@@ -125,8 +129,25 @@ interface UserProfile {
|
|
|
125
129
|
readonly language: string | null;
|
|
126
130
|
readonly timeZone: string | null;
|
|
127
131
|
readonly themePreference: string | null;
|
|
132
|
+
readonly lastCompanyId: string | null;
|
|
133
|
+
readonly lastSiteId: string | null;
|
|
128
134
|
readonly completedAtUtc: string | null;
|
|
129
135
|
}
|
|
136
|
+
interface Site {
|
|
137
|
+
readonly id: string;
|
|
138
|
+
readonly companyId: string;
|
|
139
|
+
readonly name: string;
|
|
140
|
+
readonly address: string | null;
|
|
141
|
+
readonly city: string | null;
|
|
142
|
+
readonly phone: string | null;
|
|
143
|
+
readonly isMain: boolean;
|
|
144
|
+
}
|
|
145
|
+
type CompanyRelation = 'owner' | 'collaborator';
|
|
146
|
+
interface CompanyOption {
|
|
147
|
+
readonly id: string;
|
|
148
|
+
readonly name: string;
|
|
149
|
+
readonly relation: CompanyRelation;
|
|
150
|
+
}
|
|
130
151
|
interface Subscription {
|
|
131
152
|
readonly planName: string;
|
|
132
153
|
readonly status: number;
|
|
@@ -159,9 +180,7 @@ interface AppSummary {
|
|
|
159
180
|
readonly status: number;
|
|
160
181
|
readonly sortOrder: number;
|
|
161
182
|
}
|
|
162
|
-
|
|
163
|
-
readonly hasAccess: boolean;
|
|
164
|
-
}
|
|
183
|
+
type LauncherApp = AppSummary;
|
|
165
184
|
|
|
166
185
|
declare class SessionService {
|
|
167
186
|
private readonly http;
|
|
@@ -174,22 +193,34 @@ declare class SessionService {
|
|
|
174
193
|
private readonly _access;
|
|
175
194
|
private readonly _scope;
|
|
176
195
|
private readonly _apps;
|
|
196
|
+
private readonly _siteId;
|
|
177
197
|
private readonly _loading;
|
|
198
|
+
private readonly _switching;
|
|
178
199
|
private readonly _error;
|
|
179
200
|
private inFlight;
|
|
180
201
|
private loadedKey;
|
|
202
|
+
private language;
|
|
181
203
|
readonly me: _angular_core.Signal<MeResponse | null>;
|
|
182
204
|
readonly menu: _angular_core.Signal<readonly MenuNode[]>;
|
|
183
205
|
readonly access: _angular_core.Signal<SiteAccess | null>;
|
|
184
206
|
readonly scope: _angular_core.Signal<AccessScope | null>;
|
|
185
|
-
readonly apps: _angular_core.Signal<readonly
|
|
207
|
+
readonly apps: _angular_core.Signal<readonly AppSummary[]>;
|
|
208
|
+
readonly siteId: _angular_core.Signal<string | null>;
|
|
186
209
|
readonly loading: _angular_core.Signal<boolean>;
|
|
210
|
+
readonly switching: _angular_core.Signal<boolean>;
|
|
187
211
|
readonly error: _angular_core.Signal<string | null>;
|
|
188
212
|
readonly roleName: _angular_core.Signal<string | null>;
|
|
189
213
|
readonly siteName: _angular_core.Signal<string | null>;
|
|
190
|
-
readonly companies: _angular_core.Signal<
|
|
214
|
+
readonly companies: _angular_core.Signal<readonly CompanySummary[]>;
|
|
215
|
+
readonly companyOptions: _angular_core.Signal<readonly CompanyOption[]>;
|
|
216
|
+
readonly companyId: _angular_core.Signal<string | null>;
|
|
217
|
+
readonly companyName: _angular_core.Signal<string | null>;
|
|
191
218
|
load(language: string, force?: boolean): Promise<void>;
|
|
192
219
|
reload(language: string): Promise<void>;
|
|
220
|
+
sites(companyId: string): Promise<Site[]>;
|
|
221
|
+
accessibleSites(companyId: string): Promise<Site[]>;
|
|
222
|
+
switchContext(companyId: string, siteId: string): Promise<void>;
|
|
223
|
+
private resolveMenu;
|
|
193
224
|
private buildLauncher;
|
|
194
225
|
private siteMenu;
|
|
195
226
|
private accountMenu;
|
|
@@ -294,9 +325,23 @@ interface ShellCopy {
|
|
|
294
325
|
readonly accessLoading: string;
|
|
295
326
|
readonly accessEmpty: string;
|
|
296
327
|
readonly accountScope: string;
|
|
297
|
-
readonly hintNoAccess: string;
|
|
298
328
|
readonly hintComingSoon: string;
|
|
299
329
|
readonly hintNotDeployed: string;
|
|
330
|
+
readonly switchSite: string;
|
|
331
|
+
readonly contextTitle: string;
|
|
332
|
+
readonly contextHint: string;
|
|
333
|
+
readonly companyLabel: string;
|
|
334
|
+
readonly companyPlaceholder: string;
|
|
335
|
+
readonly siteLabel: string;
|
|
336
|
+
readonly sitePlaceholder: string;
|
|
337
|
+
readonly sitesLoading: string;
|
|
338
|
+
readonly sitesEmpty: string;
|
|
339
|
+
readonly confirmSwitch: string;
|
|
340
|
+
readonly relationOwner: string;
|
|
341
|
+
readonly relationCollaborator: string;
|
|
342
|
+
readonly noContext: string;
|
|
343
|
+
readonly noCompanyTitle: string;
|
|
344
|
+
readonly noCompanyHint: string;
|
|
300
345
|
}
|
|
301
346
|
declare const SHELL_COPY: Readonly<Record<NucleusLang, ShellCopy>>;
|
|
302
347
|
|
|
@@ -310,6 +355,9 @@ interface ThemeOption {
|
|
|
310
355
|
readonly label: string;
|
|
311
356
|
readonly swatch: string | null;
|
|
312
357
|
}
|
|
358
|
+
interface CompanyChoice extends CompanyOption {
|
|
359
|
+
readonly tag: string;
|
|
360
|
+
}
|
|
313
361
|
interface ShellIdentity {
|
|
314
362
|
readonly name: string;
|
|
315
363
|
readonly email: string;
|
|
@@ -338,14 +386,24 @@ declare class NucleusShell {
|
|
|
338
386
|
protected readonly menu: _angular_core.Signal<readonly MenuNode[]>;
|
|
339
387
|
protected readonly menuLoading: _angular_core.Signal<boolean>;
|
|
340
388
|
protected readonly menuError: _angular_core.Signal<string | null>;
|
|
341
|
-
protected readonly launcherApps: _angular_core.Signal<readonly
|
|
389
|
+
protected readonly launcherApps: _angular_core.Signal<readonly _nucleus_suite_pe_core.AppSummary[]>;
|
|
390
|
+
protected readonly switching: _angular_core.Signal<boolean>;
|
|
342
391
|
protected readonly sidebarOpen: _angular_core.WritableSignal<boolean>;
|
|
343
392
|
protected readonly settingsOpen: _angular_core.WritableSignal<boolean>;
|
|
393
|
+
protected readonly contextOpen: _angular_core.WritableSignal<boolean>;
|
|
394
|
+
protected readonly companyChoice: _angular_core.WritableSignal<string | null>;
|
|
395
|
+
protected readonly siteChoice: _angular_core.WritableSignal<string | null>;
|
|
396
|
+
protected readonly siteOptions: _angular_core.WritableSignal<Site[]>;
|
|
397
|
+
protected readonly sitesLoading: _angular_core.WritableSignal<boolean>;
|
|
344
398
|
private readonly auth;
|
|
345
399
|
protected readonly identity: _angular_core.Signal<ShellIdentity | null>;
|
|
346
400
|
protected readonly initials: _angular_core.Signal<string>;
|
|
347
401
|
protected readonly canSwitchAccount: _angular_core.Signal<boolean>;
|
|
348
|
-
protected readonly
|
|
402
|
+
protected readonly hasCompany: _angular_core.Signal<boolean>;
|
|
403
|
+
protected readonly companyChoices: _angular_core.Signal<CompanyChoice[]>;
|
|
404
|
+
protected readonly contextCaption: _angular_core.Signal<string>;
|
|
405
|
+
protected readonly roleName: _angular_core.Signal<string | null>;
|
|
406
|
+
protected readonly canConfirm: _angular_core.Signal<boolean>;
|
|
349
407
|
protected readonly themeOptions: _angular_core.Signal<ThemeOption[]>;
|
|
350
408
|
private readonly loadSession;
|
|
351
409
|
protected setLang(lang: NucleusLang): void;
|
|
@@ -354,15 +412,19 @@ declare class NucleusShell {
|
|
|
354
412
|
protected selectNav(id: string): void;
|
|
355
413
|
protected selectMenu(node: MenuNode): void;
|
|
356
414
|
protected isSelected(node: MenuNode): boolean;
|
|
415
|
+
protected openContext(): Promise<void>;
|
|
416
|
+
protected onCompanyChange(companyId: string | null): Promise<void>;
|
|
417
|
+
protected confirmSwitch(): Promise<void>;
|
|
357
418
|
protected canOpen(app: LauncherApp): boolean;
|
|
358
419
|
protected launch(app: LauncherApp): void;
|
|
359
420
|
protected appInitials(app: LauncherApp): string;
|
|
360
421
|
protected launchHint(app: LauncherApp): string;
|
|
361
422
|
protected switchAccount(): Promise<void>;
|
|
362
423
|
protected signOut(): Promise<void>;
|
|
424
|
+
private loadSites;
|
|
363
425
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NucleusShell, never>;
|
|
364
426
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NucleusShell, "nucleus-shell", never, { "brand": { "alias": "brand"; "required": false; "isSignal": true; }; "heading": { "alias": "heading"; "required": false; "isSignal": true; }; "lead": { "alias": "lead"; "required": false; "isSignal": true; }; "navItems": { "alias": "navItems"; "required": false; "isSignal": true; }; "activeNavId": { "alias": "activeNavId"; "required": false; "isSignal": true; }; "selectedMenuId": { "alias": "selectedMenuId"; "required": false; "isSignal": true; }; }, { "navSelect": "navSelect"; "menuSelect": "menuSelect"; }, never, ["*"], true, never>;
|
|
365
427
|
}
|
|
366
428
|
|
|
367
|
-
export { DEFAULT_THEME, NUCLEUS_CONFIG, NUCLEUS_DARK_SELECTOR, NUCLEUS_FORCE_BEARER, NUCLEUS_LANGS, NUCLEUS_SKIP_AUTH, NucleusAuth, NucleusLanguage, NucleusMark, NucleusPreset, NucleusSessionAuth, NucleusShell, NucleusStarfield, SHELL_COPY, SessionService, THEMES, THEME_LABELS, ThemeService, UserSyncService, isNucleusConfigured, isThemePreference, loadNucleusConfig, nucleusAuthInterceptor, ownsUrl, provideNucleus, provideNucleusTheme, themeById };
|
|
368
|
-
export type { AccessScope, AppSummary, AppUser, AuthSyncRequest, CompanySummary, LauncherApp, MeResponse, MenuNode, NucleusConfig, NucleusIdentity, NucleusLang, SessionTicket, ShellCopy, ShellNavItem, SiteAccess, Subscription, Theme, ThemeId, ThemePreference, ThemeTokens, UserProfile };
|
|
429
|
+
export { DEFAULT_THEME, NUCLEUS_CONFIG, NUCLEUS_DARK_SELECTOR, NUCLEUS_FORCE_BEARER, NUCLEUS_LANGS, NUCLEUS_LOGOUT_PARAM, NUCLEUS_SKIP_AUTH, NucleusAuth, NucleusLanguage, NucleusMark, NucleusPreset, NucleusSessionAuth, NucleusShell, NucleusStarfield, SHELL_COPY, SessionService, THEMES, THEME_LABELS, ThemeService, UserSyncService, consumeNucleusLogout, isNucleusConfigured, isThemePreference, loadNucleusConfig, nucleusAuthInterceptor, nucleusLogoutUrl, ownsUrl, provideNucleus, provideNucleusTheme, themeById };
|
|
430
|
+
export type { AccessScope, AppSummary, AppUser, AuthSyncRequest, CompanyOption, CompanyRelation, CompanySummary, LauncherApp, MeResponse, MenuNode, NucleusConfig, NucleusIdentity, NucleusLang, SessionTicket, ShellCopy, ShellNavItem, Site, SiteAccess, Subscription, Theme, ThemeId, ThemePreference, ThemeTokens, UserProfile };
|