@edsis/angular 22.0.70 → 22.0.72

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.
@@ -0,0 +1,308 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, inject, signal, computed, Injectable, makeEnvironmentProviders, provideAppInitializer } from '@angular/core';
3
+ import { DOCUMENT } from '@angular/common';
4
+
5
+ const EDSIS_RUNTIME_SCHEMA_VERSION = 1;
6
+ const EDSIS_RUNTIME_PLATFORMS = [
7
+ 'windows',
8
+ 'macos',
9
+ 'linux',
10
+ 'ios',
11
+ 'android',
12
+ 'web',
13
+ ];
14
+ const EDSIS_RUNTIME_CAPABILITIES = [
15
+ 'window-controls',
16
+ 'window-layout',
17
+ 'app-menu',
18
+ 'tray',
19
+ 'notification-badge',
20
+ 'native-notification',
21
+ 'dialog',
22
+ 'clipboard-text',
23
+ 'open-url',
24
+ 'network-diagnostics',
25
+ 'google-native-sign-in',
26
+ ];
27
+ const RUNTIME_HOSTS = new Set(['tauri', 'browser']);
28
+ const RUNTIME_ENVIRONMENTS = new Set([
29
+ 'production',
30
+ 'development',
31
+ 'local',
32
+ ]);
33
+ const RUNTIME_PLATFORMS = new Set(EDSIS_RUNTIME_PLATFORMS);
34
+ const DEVICE_FAMILIES = new Set(['desktop', 'tablet', 'responsive']);
35
+ const UI_PROFILES = new Set(['desktop', 'tablet', 'responsive']);
36
+ const RUNTIME_CAPABILITIES = new Set(EDSIS_RUNTIME_CAPABILITIES);
37
+ function isEdsisRuntimeContextV1(value) {
38
+ if (!isRecord(value) || value['schemaVersion'] !== EDSIS_RUNTIME_SCHEMA_VERSION) {
39
+ return false;
40
+ }
41
+ const app = value['app'];
42
+ const capabilities = value['capabilities'];
43
+ return (isSetMember(RUNTIME_HOSTS, value['host']) &&
44
+ isSetMember(RUNTIME_ENVIRONMENTS, value['environment']) &&
45
+ isSetMember(RUNTIME_PLATFORMS, value['platform']) &&
46
+ isSetMember(DEVICE_FAMILIES, value['deviceFamily']) &&
47
+ isSetMember(UI_PROFILES, value['uiProfile']) &&
48
+ isRecord(app) &&
49
+ isNonEmptyString(app['identifier']) &&
50
+ isNonEmptyString(app['name']) &&
51
+ typeof app['version'] === 'string' &&
52
+ isNonEmptyString(app['arch']) &&
53
+ typeof app['debug'] === 'boolean' &&
54
+ Array.isArray(capabilities) &&
55
+ capabilities.every((capability) => isSetMember(RUNTIME_CAPABILITIES, capability)));
56
+ }
57
+ function freezeEdsisRuntimeContext(context) {
58
+ const capabilities = Object.freeze([...new Set(context.capabilities)]);
59
+ const app = Object.freeze({ ...context.app });
60
+ return Object.freeze({ ...context, app, capabilities });
61
+ }
62
+ function createBrowserRuntimeContext(environment) {
63
+ return freezeEdsisRuntimeContext({
64
+ schemaVersion: EDSIS_RUNTIME_SCHEMA_VERSION,
65
+ host: 'browser',
66
+ environment,
67
+ platform: 'web',
68
+ deviceFamily: 'responsive',
69
+ uiProfile: 'responsive',
70
+ app: {
71
+ identifier: 'web',
72
+ name: 'EDSIS Web',
73
+ version: '',
74
+ arch: 'web',
75
+ debug: environment !== 'production',
76
+ },
77
+ capabilities: [],
78
+ });
79
+ }
80
+ function isRecord(value) {
81
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
82
+ }
83
+ function isNonEmptyString(value) {
84
+ return typeof value === 'string' && value.trim().length > 0;
85
+ }
86
+ function isSetMember(values, value) {
87
+ return typeof value === 'string' && values.has(value);
88
+ }
89
+
90
+ const EDSIS_RUNTIME_CONFIG = new InjectionToken('EDSIS_RUNTIME_CONFIG');
91
+
92
+ const EDSIS_RUNTIME_READY_EVENT = 'edsis:runtime-ready';
93
+ class RuntimeContextService {
94
+ documentRef = inject(DOCUMENT);
95
+ config = inject(EDSIS_RUNTIME_CONFIG);
96
+ contextState = signal(createBrowserRuntimeContext(this.config.browserEnvironment), /* @ts-ignore */
97
+ ...(ngDevMode ? [{ debugName: "contextState" }] : /* istanbul ignore next */ []));
98
+ initialization = null;
99
+ context = this.contextState.asReadonly();
100
+ isDesktopShell = computed(() => this.contextState().host === 'tauri' && this.contextState().uiProfile === 'desktop', /* @ts-ignore */
101
+ ...(ngDevMode ? [{ debugName: "isDesktopShell" }] : /* istanbul ignore next */ []));
102
+ isTabletShell = computed(() => this.contextState().host === 'tauri' && this.contextState().uiProfile === 'tablet', /* @ts-ignore */
103
+ ...(ngDevMode ? [{ debugName: "isTabletShell" }] : /* istanbul ignore next */ []));
104
+ isIPadOS = computed(() => this.isTabletShell() && this.contextState().platform === 'ios', /* @ts-ignore */
105
+ ...(ngDevMode ? [{ debugName: "isIPadOS" }] : /* istanbul ignore next */ []));
106
+ isAndroidTablet = computed(() => this.isTabletShell() && this.contextState().platform === 'android', /* @ts-ignore */
107
+ ...(ngDevMode ? [{ debugName: "isAndroidTablet" }] : /* istanbul ignore next */ []));
108
+ initialize() {
109
+ this.initialization ??= this.resolveContext();
110
+ return this.initialization;
111
+ }
112
+ supports(capability) {
113
+ return this.contextState().capabilities.includes(capability);
114
+ }
115
+ async resolveContext() {
116
+ const windowRef = this.documentRef.defaultView;
117
+ if (!windowRef) {
118
+ this.applyContext(createBrowserRuntimeContext(this.config.browserEnvironment));
119
+ return;
120
+ }
121
+ if (isEdsisRuntimeContextV1(windowRef.EDSIS_RUNTIME)) {
122
+ this.applyContext(windowRef.EDSIS_RUNTIME);
123
+ return;
124
+ }
125
+ if (!hasTauriInternals$1(windowRef)) {
126
+ this.applyContext(createBrowserRuntimeContext(this.config.browserEnvironment));
127
+ return;
128
+ }
129
+ const eventContext = waitForRuntimeReadyEvent(windowRef, this.config.eventTimeoutMs);
130
+ const commandContext = await invokeRuntimeContext();
131
+ if (commandContext)
132
+ eventContext.cancel();
133
+ const context = commandContext ?? (await eventContext.promise);
134
+ this.applyContext(context ?? createBrowserRuntimeContext(this.config.browserEnvironment));
135
+ }
136
+ applyContext(context) {
137
+ const frozenContext = freezeEdsisRuntimeContext(context);
138
+ this.contextState.set(frozenContext);
139
+ const root = this.documentRef.documentElement;
140
+ root.dataset['edsisHost'] = frozenContext.host;
141
+ root.dataset['edsisPlatform'] = frozenContext.platform;
142
+ root.dataset['edsisDevice'] = frozenContext.deviceFamily;
143
+ root.dataset['edsisUiProfile'] = frozenContext.uiProfile;
144
+ }
145
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: RuntimeContextService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
146
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: RuntimeContextService });
147
+ }
148
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: RuntimeContextService, decorators: [{
149
+ type: Injectable
150
+ }] });
151
+ async function invokeRuntimeContext() {
152
+ try {
153
+ const { invoke } = await import('@tauri-apps/api/core');
154
+ const value = await invoke('runtime_context');
155
+ return isEdsisRuntimeContextV1(value) ? value : null;
156
+ }
157
+ catch {
158
+ return null;
159
+ }
160
+ }
161
+ function hasTauriInternals$1(windowRef) {
162
+ const internals = Reflect.get(windowRef, '__TAURI_INTERNALS__');
163
+ return typeof internals === 'object' && internals !== null;
164
+ }
165
+ function waitForRuntimeReadyEvent(windowRef, timeoutMs) {
166
+ let cancel = () => undefined;
167
+ const promise = new Promise((resolve) => {
168
+ let settled = false;
169
+ const finish = (context) => {
170
+ if (settled)
171
+ return;
172
+ settled = true;
173
+ windowRef.removeEventListener(EDSIS_RUNTIME_READY_EVENT, onRuntimeReady);
174
+ windowRef.clearTimeout(timeoutId);
175
+ resolve(context);
176
+ };
177
+ const onRuntimeReady = (event) => {
178
+ const detail = 'detail' in event ? event.detail : null;
179
+ finish(isEdsisRuntimeContextV1(detail) ? detail : null);
180
+ };
181
+ const timeoutId = windowRef.setTimeout(() => finish(null), timeoutMs);
182
+ windowRef.addEventListener(EDSIS_RUNTIME_READY_EVENT, onRuntimeReady, { once: true });
183
+ cancel = () => finish(null);
184
+ });
185
+ return { promise, cancel };
186
+ }
187
+
188
+ class NativeHostService {
189
+ runtime = inject(RuntimeContextService);
190
+ supports(capability) {
191
+ return this.runtime.context().host === 'tauri' && this.runtime.supports(capability);
192
+ }
193
+ async emitWindowControl(action) {
194
+ if (!this.supports('window-controls'))
195
+ return;
196
+ const { emit } = await import('@tauri-apps/api/event');
197
+ await emit('edsis:window-control', action);
198
+ }
199
+ async startDragging() {
200
+ if (!this.supports('window-controls'))
201
+ return;
202
+ const { getCurrentWindow } = await import('@tauri-apps/api/window');
203
+ await getCurrentWindow().startDragging();
204
+ }
205
+ async setNotificationBadge(unreadCount) {
206
+ if (!this.supports('notification-badge'))
207
+ return;
208
+ await invokeNotificationBadge(unreadCount);
209
+ }
210
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: NativeHostService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
211
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: NativeHostService });
212
+ }
213
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: NativeHostService, decorators: [{
214
+ type: Injectable
215
+ }] });
216
+ /** Browser-safe compatibility helper for callers outside Angular injection. */
217
+ async function setNativeNotificationBadge(unreadCount) {
218
+ if (typeof window === 'undefined' || !hasTauriInternals(window))
219
+ return;
220
+ try {
221
+ await invokeNotificationBadge(unreadCount);
222
+ }
223
+ catch {
224
+ // Native integration is optional for browser consumers and older shells.
225
+ }
226
+ }
227
+ async function invokeNotificationBadge(unreadCount) {
228
+ const { invoke } = await import('@tauri-apps/api/core');
229
+ await invoke('set_notification_badge', { unreadCount });
230
+ }
231
+ function hasTauriInternals(windowRef) {
232
+ const internals = Reflect.get(windowRef, '__TAURI_INTERNALS__');
233
+ return typeof internals === 'object' && internals !== null;
234
+ }
235
+
236
+ const EDSIS_TABLET_MINIMUM_VIEWPORT_WIDTH = 600;
237
+ class TabletViewportService {
238
+ documentRef = inject(DOCUMENT);
239
+ widthState = signal(0, /* @ts-ignore */
240
+ ...(ngDevMode ? [{ debugName: "widthState" }] : /* istanbul ignore next */ []));
241
+ heightState = signal(0, /* @ts-ignore */
242
+ ...(ngDevMode ? [{ debugName: "heightState" }] : /* istanbul ignore next */ []));
243
+ initialized = false;
244
+ width = this.widthState.asReadonly();
245
+ height = this.heightState.asReadonly();
246
+ isLandscape = computed(() => this.widthState() >= this.heightState(), /* @ts-ignore */
247
+ ...(ngDevMode ? [{ debugName: "isLandscape" }] : /* istanbul ignore next */ []));
248
+ meetsMinimumWidth = computed(() => this.widthState() >= EDSIS_TABLET_MINIMUM_VIEWPORT_WIDTH, /* @ts-ignore */
249
+ ...(ngDevMode ? [{ debugName: "meetsMinimumWidth" }] : /* istanbul ignore next */ []));
250
+ blockReason = computed(() => {
251
+ if (!this.meetsMinimumWidth())
252
+ return 'too-narrow';
253
+ if (!this.isLandscape())
254
+ return 'portrait';
255
+ return null;
256
+ }, /* @ts-ignore */
257
+ ...(ngDevMode ? [{ debugName: "blockReason" }] : /* istanbul ignore next */ []));
258
+ isSupported = computed(() => this.blockReason() === null, /* @ts-ignore */
259
+ ...(ngDevMode ? [{ debugName: "isSupported" }] : /* istanbul ignore next */ []));
260
+ initialize() {
261
+ if (this.initialized)
262
+ return;
263
+ this.initialized = true;
264
+ const windowRef = this.documentRef.defaultView;
265
+ if (!windowRef)
266
+ return;
267
+ const update = () => {
268
+ this.widthState.set(windowRef.innerWidth);
269
+ this.heightState.set(windowRef.innerHeight);
270
+ this.documentRef.documentElement.dataset['edsisTabletViewport'] = this.isSupported()
271
+ ? 'supported'
272
+ : 'unsupported';
273
+ };
274
+ update();
275
+ windowRef.addEventListener('resize', update, { passive: true });
276
+ windowRef.addEventListener('orientationchange', update, { passive: true });
277
+ }
278
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: TabletViewportService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
279
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: TabletViewportService });
280
+ }
281
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: TabletViewportService, decorators: [{
282
+ type: Injectable
283
+ }] });
284
+
285
+ function provideEdsisRuntime(config = {}) {
286
+ const resolvedConfig = {
287
+ browserEnvironment: config.browserEnvironment ?? 'production',
288
+ eventTimeoutMs: Math.max(0, config.eventTimeoutMs ?? 750),
289
+ };
290
+ return makeEnvironmentProviders([
291
+ { provide: EDSIS_RUNTIME_CONFIG, useValue: resolvedConfig },
292
+ RuntimeContextService,
293
+ NativeHostService,
294
+ TabletViewportService,
295
+ provideAppInitializer(() => {
296
+ const runtime = inject(RuntimeContextService);
297
+ const viewport = inject(TabletViewportService);
298
+ return runtime.initialize().then(() => viewport.initialize());
299
+ }),
300
+ ]);
301
+ }
302
+
303
+ /**
304
+ * Generated bundle index. Do not edit.
305
+ */
306
+
307
+ export { EDSIS_RUNTIME_CAPABILITIES, EDSIS_RUNTIME_CONFIG, EDSIS_RUNTIME_PLATFORMS, EDSIS_RUNTIME_READY_EVENT, EDSIS_RUNTIME_SCHEMA_VERSION, EDSIS_TABLET_MINIMUM_VIEWPORT_WIDTH, NativeHostService, RuntimeContextService, TabletViewportService, createBrowserRuntimeContext, freezeEdsisRuntimeContext, isEdsisRuntimeContextV1, provideEdsisRuntime, setNativeNotificationBadge };
308
+ //# sourceMappingURL=edsis-angular-services-runtime.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edsis-angular-services-runtime.mjs","sources":["../../../library/angular/services/runtime/runtime-context.ts","../../../library/angular/services/runtime/runtime.config.ts","../../../library/angular/services/runtime/runtime-context.service.ts","../../../library/angular/services/runtime/native-host.service.ts","../../../library/angular/services/runtime/tablet-viewport.service.ts","../../../library/angular/services/runtime/runtime.providers.ts","../../../library/angular/services/runtime/edsis-angular-services-runtime.ts"],"sourcesContent":["export const EDSIS_RUNTIME_SCHEMA_VERSION = 1 as const;\n\nexport const EDSIS_RUNTIME_PLATFORMS = [\n 'windows',\n 'macos',\n 'linux',\n 'ios',\n 'android',\n 'web',\n] as const;\n\nexport const EDSIS_RUNTIME_CAPABILITIES = [\n 'window-controls',\n 'window-layout',\n 'app-menu',\n 'tray',\n 'notification-badge',\n 'native-notification',\n 'dialog',\n 'clipboard-text',\n 'open-url',\n 'network-diagnostics',\n 'google-native-sign-in',\n] as const;\n\nexport type EdsisRuntimePlatform = (typeof EDSIS_RUNTIME_PLATFORMS)[number];\nexport type EdsisRuntimeCapability = (typeof EDSIS_RUNTIME_CAPABILITIES)[number];\nexport type EdsisRuntimeEnvironment = 'production' | 'development' | 'local';\nexport type EdsisRuntimeHost = 'tauri' | 'browser';\nexport type EdsisDeviceFamily = 'desktop' | 'tablet' | 'responsive';\nexport type EdsisUiProfile = 'desktop' | 'tablet' | 'responsive';\n\nexport interface EdsisRuntimeContextV1 {\n readonly schemaVersion: 1;\n readonly host: EdsisRuntimeHost;\n readonly environment: EdsisRuntimeEnvironment;\n readonly platform: EdsisRuntimePlatform;\n readonly deviceFamily: EdsisDeviceFamily;\n readonly uiProfile: EdsisUiProfile;\n readonly app: {\n readonly identifier: string;\n readonly name: string;\n readonly version: string;\n readonly arch: string;\n readonly debug: boolean;\n };\n readonly capabilities: readonly EdsisRuntimeCapability[];\n}\n\nconst RUNTIME_HOSTS = new Set<EdsisRuntimeHost>(['tauri', 'browser']);\nconst RUNTIME_ENVIRONMENTS = new Set<EdsisRuntimeEnvironment>([\n 'production',\n 'development',\n 'local',\n]);\nconst RUNTIME_PLATFORMS = new Set<EdsisRuntimePlatform>(EDSIS_RUNTIME_PLATFORMS);\nconst DEVICE_FAMILIES = new Set<EdsisDeviceFamily>(['desktop', 'tablet', 'responsive']);\nconst UI_PROFILES = new Set<EdsisUiProfile>(['desktop', 'tablet', 'responsive']);\nconst RUNTIME_CAPABILITIES = new Set<EdsisRuntimeCapability>(EDSIS_RUNTIME_CAPABILITIES);\n\nexport function isEdsisRuntimeContextV1(value: unknown): value is EdsisRuntimeContextV1 {\n if (!isRecord(value) || value['schemaVersion'] !== EDSIS_RUNTIME_SCHEMA_VERSION) {\n return false;\n }\n\n const app = value['app'];\n const capabilities = value['capabilities'];\n\n return (\n isSetMember(RUNTIME_HOSTS, value['host']) &&\n isSetMember(RUNTIME_ENVIRONMENTS, value['environment']) &&\n isSetMember(RUNTIME_PLATFORMS, value['platform']) &&\n isSetMember(DEVICE_FAMILIES, value['deviceFamily']) &&\n isSetMember(UI_PROFILES, value['uiProfile']) &&\n isRecord(app) &&\n isNonEmptyString(app['identifier']) &&\n isNonEmptyString(app['name']) &&\n typeof app['version'] === 'string' &&\n isNonEmptyString(app['arch']) &&\n typeof app['debug'] === 'boolean' &&\n Array.isArray(capabilities) &&\n capabilities.every((capability) => isSetMember(RUNTIME_CAPABILITIES, capability))\n );\n}\n\nexport function freezeEdsisRuntimeContext(context: EdsisRuntimeContextV1): EdsisRuntimeContextV1 {\n const capabilities = Object.freeze([...new Set(context.capabilities)]);\n const app = Object.freeze({ ...context.app });\n\n return Object.freeze({ ...context, app, capabilities });\n}\n\nexport function createBrowserRuntimeContext(\n environment: EdsisRuntimeEnvironment,\n): EdsisRuntimeContextV1 {\n return freezeEdsisRuntimeContext({\n schemaVersion: EDSIS_RUNTIME_SCHEMA_VERSION,\n host: 'browser',\n environment,\n platform: 'web',\n deviceFamily: 'responsive',\n uiProfile: 'responsive',\n app: {\n identifier: 'web',\n name: 'EDSIS Web',\n version: '',\n arch: 'web',\n debug: environment !== 'production',\n },\n capabilities: [],\n });\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction isNonEmptyString(value: unknown): value is string {\n return typeof value === 'string' && value.trim().length > 0;\n}\n\nfunction isSetMember<T extends string>(values: ReadonlySet<T>, value: unknown): value is T {\n return typeof value === 'string' && values.has(value as T);\n}\n","import { InjectionToken } from '@angular/core';\n\nimport type { EdsisRuntimeEnvironment } from './runtime-context';\n\nexport interface EdsisRuntimeConfig {\n readonly browserEnvironment?: EdsisRuntimeEnvironment;\n readonly eventTimeoutMs?: number;\n}\n\nexport interface ResolvedEdsisRuntimeConfig {\n readonly browserEnvironment: EdsisRuntimeEnvironment;\n readonly eventTimeoutMs: number;\n}\n\nexport const EDSIS_RUNTIME_CONFIG = new InjectionToken<ResolvedEdsisRuntimeConfig>(\n 'EDSIS_RUNTIME_CONFIG',\n);\n","import { DOCUMENT } from '@angular/common';\nimport { Injectable, computed, inject, signal } from '@angular/core';\n\nimport {\n createBrowserRuntimeContext,\n freezeEdsisRuntimeContext,\n isEdsisRuntimeContextV1,\n type EdsisRuntimeCapability,\n type EdsisRuntimeContextV1,\n} from './runtime-context';\nimport { EDSIS_RUNTIME_CONFIG } from './runtime.config';\n\nexport const EDSIS_RUNTIME_READY_EVENT = 'edsis:runtime-ready' as const;\n\ndeclare global {\n interface Window {\n readonly EDSIS_RUNTIME?: unknown;\n }\n}\n\n@Injectable()\nexport class RuntimeContextService {\n private readonly documentRef = inject<Document>(DOCUMENT);\n private readonly config = inject(EDSIS_RUNTIME_CONFIG);\n private readonly contextState = signal<EdsisRuntimeContextV1>(\n createBrowserRuntimeContext(this.config.browserEnvironment),\n );\n private initialization: Promise<void> | null = null;\n\n readonly context = this.contextState.asReadonly();\n readonly isDesktopShell = computed(\n () => this.contextState().host === 'tauri' && this.contextState().uiProfile === 'desktop',\n );\n readonly isTabletShell = computed(\n () => this.contextState().host === 'tauri' && this.contextState().uiProfile === 'tablet',\n );\n readonly isIPadOS = computed(\n () => this.isTabletShell() && this.contextState().platform === 'ios',\n );\n readonly isAndroidTablet = computed(\n () => this.isTabletShell() && this.contextState().platform === 'android',\n );\n\n initialize(): Promise<void> {\n this.initialization ??= this.resolveContext();\n return this.initialization;\n }\n\n supports(capability: EdsisRuntimeCapability): boolean {\n return this.contextState().capabilities.includes(capability);\n }\n\n private async resolveContext(): Promise<void> {\n const windowRef = this.documentRef.defaultView;\n\n if (!windowRef) {\n this.applyContext(createBrowserRuntimeContext(this.config.browserEnvironment));\n return;\n }\n\n if (isEdsisRuntimeContextV1(windowRef.EDSIS_RUNTIME)) {\n this.applyContext(windowRef.EDSIS_RUNTIME);\n return;\n }\n\n if (!hasTauriInternals(windowRef)) {\n this.applyContext(createBrowserRuntimeContext(this.config.browserEnvironment));\n return;\n }\n\n const eventContext = waitForRuntimeReadyEvent(windowRef, this.config.eventTimeoutMs);\n const commandContext = await invokeRuntimeContext();\n if (commandContext) eventContext.cancel();\n const context = commandContext ?? (await eventContext.promise);\n\n this.applyContext(context ?? createBrowserRuntimeContext(this.config.browserEnvironment));\n }\n\n private applyContext(context: EdsisRuntimeContextV1): void {\n const frozenContext = freezeEdsisRuntimeContext(context);\n this.contextState.set(frozenContext);\n\n const root = this.documentRef.documentElement;\n root.dataset['edsisHost'] = frozenContext.host;\n root.dataset['edsisPlatform'] = frozenContext.platform;\n root.dataset['edsisDevice'] = frozenContext.deviceFamily;\n root.dataset['edsisUiProfile'] = frozenContext.uiProfile;\n }\n}\n\nasync function invokeRuntimeContext(): Promise<EdsisRuntimeContextV1 | null> {\n try {\n const { invoke } = await import('@tauri-apps/api/core');\n const value = await invoke<unknown>('runtime_context');\n return isEdsisRuntimeContextV1(value) ? value : null;\n } catch {\n return null;\n }\n}\n\nfunction hasTauriInternals(windowRef: Window): boolean {\n const internals = Reflect.get(windowRef, '__TAURI_INTERNALS__');\n return typeof internals === 'object' && internals !== null;\n}\n\nfunction waitForRuntimeReadyEvent(\n windowRef: Window,\n timeoutMs: number,\n): {\n readonly promise: Promise<EdsisRuntimeContextV1 | null>;\n readonly cancel: () => void;\n} {\n let cancel = (): void => undefined;\n const promise = new Promise<EdsisRuntimeContextV1 | null>((resolve) => {\n let settled = false;\n const finish = (context: EdsisRuntimeContextV1 | null): void => {\n if (settled) return;\n settled = true;\n windowRef.removeEventListener(EDSIS_RUNTIME_READY_EVENT, onRuntimeReady);\n windowRef.clearTimeout(timeoutId);\n resolve(context);\n };\n const onRuntimeReady = (event: Event): void => {\n const detail = 'detail' in event ? event.detail : null;\n finish(isEdsisRuntimeContextV1(detail) ? detail : null);\n };\n const timeoutId = windowRef.setTimeout(() => finish(null), timeoutMs);\n\n windowRef.addEventListener(EDSIS_RUNTIME_READY_EVENT, onRuntimeReady, { once: true });\n cancel = () => finish(null);\n });\n\n return { promise, cancel };\n}\n","import { Injectable, inject } from '@angular/core';\n\nimport type { EdsisRuntimeCapability } from './runtime-context';\nimport { RuntimeContextService } from './runtime-context.service';\n\nexport type EdsisWindowControlAction = 'close' | 'minimize' | 'toggle-maximize';\n\n@Injectable()\nexport class NativeHostService {\n private readonly runtime = inject(RuntimeContextService);\n\n supports(capability: EdsisRuntimeCapability): boolean {\n return this.runtime.context().host === 'tauri' && this.runtime.supports(capability);\n }\n\n async emitWindowControl(action: EdsisWindowControlAction): Promise<void> {\n if (!this.supports('window-controls')) return;\n const { emit } = await import('@tauri-apps/api/event');\n await emit('edsis:window-control', action);\n }\n\n async startDragging(): Promise<void> {\n if (!this.supports('window-controls')) return;\n const { getCurrentWindow } = await import('@tauri-apps/api/window');\n await getCurrentWindow().startDragging();\n }\n\n async setNotificationBadge(unreadCount: number): Promise<void> {\n if (!this.supports('notification-badge')) return;\n await invokeNotificationBadge(unreadCount);\n }\n}\n\n/** Browser-safe compatibility helper for callers outside Angular injection. */\nexport async function setNativeNotificationBadge(unreadCount: number): Promise<void> {\n if (typeof window === 'undefined' || !hasTauriInternals(window)) return;\n\n try {\n await invokeNotificationBadge(unreadCount);\n } catch {\n // Native integration is optional for browser consumers and older shells.\n }\n}\n\nasync function invokeNotificationBadge(unreadCount: number): Promise<void> {\n const { invoke } = await import('@tauri-apps/api/core');\n await invoke('set_notification_badge', { unreadCount });\n}\n\nfunction hasTauriInternals(windowRef: Window): boolean {\n const internals = Reflect.get(windowRef, '__TAURI_INTERNALS__');\n return typeof internals === 'object' && internals !== null;\n}\n","import { DOCUMENT } from '@angular/common';\nimport { Injectable, computed, inject, signal } from '@angular/core';\n\nexport const EDSIS_TABLET_MINIMUM_VIEWPORT_WIDTH = 600;\n\nexport type TabletViewportBlockReason = 'portrait' | 'too-narrow' | null;\n\n@Injectable()\nexport class TabletViewportService {\n private readonly documentRef = inject<Document>(DOCUMENT);\n private readonly widthState = signal(0);\n private readonly heightState = signal(0);\n private initialized = false;\n\n readonly width = this.widthState.asReadonly();\n readonly height = this.heightState.asReadonly();\n readonly isLandscape = computed(() => this.widthState() >= this.heightState());\n readonly meetsMinimumWidth = computed(\n () => this.widthState() >= EDSIS_TABLET_MINIMUM_VIEWPORT_WIDTH,\n );\n readonly blockReason = computed<TabletViewportBlockReason>(() => {\n if (!this.meetsMinimumWidth()) return 'too-narrow';\n if (!this.isLandscape()) return 'portrait';\n return null;\n });\n readonly isSupported = computed(() => this.blockReason() === null);\n\n initialize(): void {\n if (this.initialized) return;\n this.initialized = true;\n\n const windowRef = this.documentRef.defaultView;\n if (!windowRef) return;\n\n const update = (): void => {\n this.widthState.set(windowRef.innerWidth);\n this.heightState.set(windowRef.innerHeight);\n this.documentRef.documentElement.dataset['edsisTabletViewport'] = this.isSupported()\n ? 'supported'\n : 'unsupported';\n };\n\n update();\n windowRef.addEventListener('resize', update, { passive: true });\n windowRef.addEventListener('orientationchange', update, { passive: true });\n }\n}\n","import {\n inject,\n makeEnvironmentProviders,\n provideAppInitializer,\n type EnvironmentProviders,\n} from '@angular/core';\n\nimport {\n EDSIS_RUNTIME_CONFIG,\n type EdsisRuntimeConfig,\n type ResolvedEdsisRuntimeConfig,\n} from './runtime.config';\nimport { NativeHostService } from './native-host.service';\nimport { RuntimeContextService } from './runtime-context.service';\nimport { TabletViewportService } from './tablet-viewport.service';\n\nexport function provideEdsisRuntime(config: EdsisRuntimeConfig = {}): EnvironmentProviders {\n const resolvedConfig: ResolvedEdsisRuntimeConfig = {\n browserEnvironment: config.browserEnvironment ?? 'production',\n eventTimeoutMs: Math.max(0, config.eventTimeoutMs ?? 750),\n };\n\n return makeEnvironmentProviders([\n { provide: EDSIS_RUNTIME_CONFIG, useValue: resolvedConfig },\n RuntimeContextService,\n NativeHostService,\n TabletViewportService,\n provideAppInitializer(() => {\n const runtime = inject(RuntimeContextService);\n const viewport = inject(TabletViewportService);\n return runtime.initialize().then(() => viewport.initialize());\n }),\n ]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["hasTauriInternals"],"mappings":";;;;AAAO,MAAM,4BAA4B,GAAG;AAErC,MAAM,uBAAuB,GAAG;IACrC,SAAS;IACT,OAAO;IACP,OAAO;IACP,KAAK;IACL,SAAS;IACT,KAAK;;AAGA,MAAM,0BAA0B,GAAG;IACxC,iBAAiB;IACjB,eAAe;IACf,UAAU;IACV,MAAM;IACN,oBAAoB;IACpB,qBAAqB;IACrB,QAAQ;IACR,gBAAgB;IAChB,UAAU;IACV,qBAAqB;IACrB,uBAAuB;;AA2BzB,MAAM,aAAa,GAAG,IAAI,GAAG,CAAmB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AACrE,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAA0B;IAC5D,YAAY;IACZ,aAAa;IACb,OAAO;AACR,CAAA,CAAC;AACF,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAuB,uBAAuB,CAAC;AAChF,MAAM,eAAe,GAAG,IAAI,GAAG,CAAoB,CAAC,SAAS,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;AACvF,MAAM,WAAW,GAAG,IAAI,GAAG,CAAiB,CAAC,SAAS,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;AAChF,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAyB,0BAA0B,CAAC;AAElF,SAAU,uBAAuB,CAAC,KAAc,EAAA;AACpD,IAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,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;;2FAArB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBADjC;;;ACSK,SAAU,mBAAmB,CAAC,MAAA,GAA6B,EAAE,EAAA;AACjE,IAAA,MAAM,cAAc,GAA+B;AACjD,QAAA,kBAAkB,EAAE,MAAM,CAAC,kBAAkB,IAAI,YAAY;AAC7D,QAAA,cAAc,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,cAAc,IAAI,GAAG,CAAC;KAC1D;AAED,IAAA,OAAO,wBAAwB,CAAC;AAC9B,QAAA,EAAE,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,cAAc,EAAE;QAC3D,qBAAqB;QACrB,iBAAiB;QACjB,qBAAqB;QACrB,qBAAqB,CAAC,MAAK;AACzB,YAAA,MAAM,OAAO,GAAG,MAAM,CAAC,qBAAqB,CAAC;AAC7C,YAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,qBAAqB,CAAC;AAC9C,YAAA,OAAO,OAAO,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC;AAC/D,QAAA,CAAC,CAAC;AACH,KAAA,CAAC;AACJ;;ACjCA;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "@edsis/angular",
3
- "version": "22.0.70",
3
+ "version": "22.0.72",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=22.0.0",
6
6
  "@angular/core": ">=22.0.0",
7
7
  "@angular/forms": ">=22.0.0",
8
8
  "@angular/router": ">=22.0.0",
9
- "@edsis/navigation": "^22.0.70",
10
- "@edsis/sdk": "^22.0.70",
11
- "@edsis/theme": "^22.0.70",
12
- "@edsis/component": "^22.0.70",
9
+ "@tauri-apps/api": ">=2.0.0",
10
+ "@edsis/navigation": "^22.0.72",
11
+ "@edsis/sdk": "^22.0.72",
12
+ "@edsis/theme": "^22.0.72",
13
+ "@edsis/component": "^22.0.72",
13
14
  "rxjs": ">=7.8.0"
14
15
  },
15
16
  "peerDependenciesMeta": {
@@ -19,6 +20,9 @@
19
20
  "@angular/router": {
20
21
  "optional": true
21
22
  },
23
+ "@tauri-apps/api": {
24
+ "optional": true
25
+ },
22
26
  "@edsis/navigation": {
23
27
  "optional": true
24
28
  },
@@ -64,6 +68,10 @@
64
68
  "./module/auth": {
65
69
  "types": "./types/edsis-angular-module-auth.d.ts",
66
70
  "default": "./fesm2022/edsis-angular-module-auth.mjs"
71
+ },
72
+ "./services/runtime": {
73
+ "types": "./types/edsis-angular-services-runtime.d.ts",
74
+ "default": "./fesm2022/edsis-angular-services-runtime.mjs"
67
75
  }
68
76
  },
69
77
  "type": "module"
@@ -50,6 +50,7 @@ declare function workspaceNavbarId(workspace: string): `${string}-navbar`;
50
50
  declare class BlockShellTopNavigationComponent {
51
51
  private readonly layout;
52
52
  private readonly navigationService;
53
+ private readonly runtime;
53
54
  private readonly themeStyle;
54
55
  readonly navigation: _angular_core.InputSignal<readonly NavigationItem[]>;
55
56
  readonly shellName: _angular_core.InputSignal<string>;
@@ -70,6 +71,7 @@ declare class BlockShellTopNavigationComponent {
70
71
  protected readonly navTypeStyle: _angular_core.Signal<"default" | "border-rail" | "desktop">;
71
72
  /** Tema desktop memakai trigger dashboard tanpa label visual; tema lain mempertahankan label. */
72
73
  protected readonly isDesktopTheme: _angular_core.Signal<boolean>;
74
+ protected readonly showDesktopWindowControls: _angular_core.Signal<boolean>;
73
75
  protected readonly desktopFlyoutIcon: _angular_core.Signal<"dashboard" | null>;
74
76
  protected readonly desktopFlyoutTriggerRadiusClass: _angular_core.Signal<"" | "rounded-base">;
75
77
  protected readonly desktopFlyoutTriggerSizeClass: _angular_core.Signal<"" | "size-11">;
@@ -113,6 +115,7 @@ declare class BlockShellSidebarNavigationComponent {
113
115
 
114
116
  declare class BlockShellNavigationHeaderComponent implements AfterViewInit, OnDestroy {
115
117
  private readonly documentRef;
118
+ private readonly nativeHost;
116
119
  readonly name: _angular_core.InputSignal<string>;
117
120
  readonly subtitle: _angular_core.InputSignal<string>;
118
121
  readonly logoText: _angular_core.InputSignal<string>;
@@ -129,7 +132,6 @@ declare class BlockShellNavigationHeaderComponent implements AfterViewInit, OnDe
129
132
  private readonly handleWindowDragStart;
130
133
  private readonly handleWindowDragAreaDoubleClick;
131
134
  private isWindowControlAction;
132
- private tauri;
133
135
  private emitWindowControl;
134
136
  private startDragging;
135
137
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<BlockShellNavigationHeaderComponent, never>;
@@ -1,7 +1,7 @@
1
1
  import { HttpInterceptorFn, HttpContextToken } from '@angular/common/http';
2
2
  import * as _angular_core from '@angular/core';
3
3
  import { InjectionToken, EnvironmentProviders, OnInit } from '@angular/core';
4
- import { PersistentAuthLoginRequest, PersistentAuthUser } from '@edsis/sdk/auth';
4
+ import { PersistentAuthUser } from '@edsis/sdk/auth';
5
5
  import { CanActivateFn, Routes } from '@angular/router';
6
6
  import * as _edsis_angular_module_auth from '@edsis/angular/module/auth';
7
7
  import * as _angular_forms from '@angular/forms';
@@ -44,6 +44,9 @@ interface EdsisAuthMessages {
44
44
  readonly signInAria: string;
45
45
  /** Status di halaman login selama full-page redirect ke Google berlangsung. */
46
46
  readonly googleRedirecting: string;
47
+ readonly nativeSignInInProgress: string;
48
+ readonly nativeSignInUnavailable: string;
49
+ readonly nativeSignInFailed: string;
47
50
  readonly googleExchangeInProgress: string;
48
51
  readonly exchangeInProgressAria: string;
49
52
  readonly googleStateMismatch: string;
@@ -120,8 +123,15 @@ interface EdsisAuthGoogleOauthConfig {
120
123
  */
121
124
  clientId: string;
122
125
  }
126
+ interface EdsisAuthNativeGoogleConfig {
127
+ /** Default `true` saat blok konfigurasi ini diberikan. */
128
+ enabled?: boolean;
129
+ /** Harus path same-origin. Default `/api`. */
130
+ apiUrl?: `/${string}`;
131
+ }
123
132
  interface EdsisAuthOauthConfig {
124
133
  google?: EdsisAuthGoogleOauthConfig;
134
+ nativeGoogle?: EdsisAuthNativeGoogleConfig;
125
135
  }
126
136
  interface EdsisAuthConfig {
127
137
  apiUrl: string;
@@ -159,6 +169,10 @@ interface ResolvedEdsisAuthGoogleOauth {
159
169
  interface ResolvedEdsisAuthOauth {
160
170
  /** `null` saat Google Sign-In tidak dikonfigurasi (perilaku placeholder lama). */
161
171
  google: ResolvedEdsisAuthGoogleOauth | null;
172
+ /** Flow native tablet; selalu memakai endpoint same-origin. */
173
+ nativeGoogle: {
174
+ readonly apiUrl: `/${string}`;
175
+ } | null;
162
176
  }
163
177
  interface ResolvedEdsisAuthConfig {
164
178
  apiUrl: string;
@@ -176,23 +190,9 @@ declare function resolveEdsisAuthConfig(config: EdsisAuthConfig): ResolvedEdsisA
176
190
 
177
191
  declare function provideEdsisAuth(config: EdsisAuthConfig): EnvironmentProviders;
178
192
 
179
- interface AuthCredentials extends PersistentAuthLoginRequest {
180
- /** Send exactly one of `email` or `username`. */
181
- email?: string;
182
- /** Send exactly one of `email` or `username`. */
183
- username?: string;
184
- }
185
193
  interface AuthUser extends PersistentAuthUser {
186
194
  readonly role?: string;
187
195
  }
188
- interface EdsisDesktopBridge {
189
- setNotificationBadge(unreadCount: number): Promise<void>;
190
- }
191
- declare global {
192
- interface Window {
193
- EDSIS_DESKTOP?: EdsisDesktopBridge;
194
- }
195
- }
196
196
  /** Native desktop features are optional; browser consumers have no bridge. */
197
197
  declare function setAuthNotificationBadge(unreadCount: number): Promise<void>;
198
198
  /**
@@ -204,17 +204,20 @@ declare class AuthService {
204
204
  private readonly http;
205
205
  private readonly config;
206
206
  private readonly router;
207
+ private readonly runtime;
208
+ private readonly nativeGoogleAdapter;
207
209
  private readonly accessTokenState;
208
210
  private readonly userState;
209
211
  private refreshInFlight;
210
- private initialized;
212
+ private initialization;
211
213
  readonly accessToken: _angular_core.Signal<string>;
212
214
  readonly user: _angular_core.Signal<AuthUser | null>;
213
215
  readonly isAuthenticated: _angular_core.Signal<boolean>;
214
216
  get apiUrl(): string;
215
- login(credentials: AuthCredentials): Promise<AuthUser | null>;
217
+ get sessionApiUrl(): string;
216
218
  /** Restores an existing cookie session. A missing/expired cookie is normal. */
217
219
  initialize(): Promise<void>;
220
+ private restoreSession;
218
221
  /** One shared refresh operation for initializer and concurrent 401 retries. */
219
222
  refresh(): Promise<boolean>;
220
223
  loadCurrentUser(): Promise<AuthUser | null>;
@@ -224,6 +227,7 @@ declare class AuthService {
224
227
  acceptTokenResponse(response: unknown): void;
225
228
  redirectToLogin(): void;
226
229
  private applyTokenResponse;
230
+ private clearNativeGoogleSession;
227
231
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthService, never>;
228
232
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<AuthService>;
229
233
  }
@@ -235,6 +239,43 @@ declare const guestOnlyGuard: CanActivateFn;
235
239
  declare const EDSIS_SKIP_AUTH: HttpContextToken<boolean>;
236
240
  declare const edsisAuthInterceptor: HttpInterceptorFn;
237
241
 
242
+ type NativeGooglePlatform = 'ios' | 'android';
243
+ interface NativeGoogleSignInResult {
244
+ readonly platform: NativeGooglePlatform;
245
+ readonly idToken: string;
246
+ readonly clientInstanceId: string;
247
+ }
248
+ interface EdsisNativeGoogleAuthAdapter {
249
+ signInWithGoogle(input: {
250
+ readonly nonce: string;
251
+ }): Promise<NativeGoogleSignInResult>;
252
+ signOutFromGoogle(): Promise<void>;
253
+ }
254
+ declare const EDSIS_NATIVE_GOOGLE_AUTH_ADAPTER: InjectionToken<EdsisNativeGoogleAuthAdapter>;
255
+ declare class TauriNativeGoogleAuthAdapter implements EdsisNativeGoogleAuthAdapter {
256
+ signInWithGoogle(input: {
257
+ readonly nonce: string;
258
+ }): Promise<NativeGoogleSignInResult>;
259
+ signOutFromGoogle(): Promise<void>;
260
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<TauriNativeGoogleAuthAdapter, never>;
261
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<TauriNativeGoogleAuthAdapter>;
262
+ }
263
+ declare function isNativeGoogleSignInResult(value: unknown): value is NativeGoogleSignInResult;
264
+
265
+ declare class NativeGoogleAuthService {
266
+ private readonly http;
267
+ private readonly auth;
268
+ private readonly config;
269
+ private readonly runtime;
270
+ private readonly adapter;
271
+ readonly requiresNativeGoogle: _angular_core.Signal<boolean>;
272
+ readonly isAvailable: _angular_core.Signal<boolean>;
273
+ signIn(): Promise<void>;
274
+ private exchangeNativeToken;
275
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NativeGoogleAuthService, never>;
276
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<NativeGoogleAuthService>;
277
+ }
278
+
238
279
  declare const GOOGLE_OAUTH_STATE_STORAGE_KEY = "auth-google-state";
239
280
  declare const GOOGLE_OAUTH_AUTHORIZE_URL = "https://accounts.google.com/o/oauth2/v2/auth";
240
281
  interface GoogleAuthorizeUrlOptions {
@@ -311,10 +352,18 @@ declare class AuthLoginPage {
311
352
  private readonly injector;
312
353
  private readonly authMagicLinkService;
313
354
  private readonly authConfig;
355
+ private readonly nativeGoogle;
356
+ private readonly router;
314
357
  protected readonly messages: _edsis_angular_module_auth.EdsisAuthMessages;
315
358
  protected readonly health: AuthHealthService;
316
359
  protected readonly googleOauth: _edsis_angular_module_auth.ResolvedEdsisAuthGoogleOauth | null;
317
360
  protected readonly isGoogleRedirecting: _angular_core.WritableSignal<boolean>;
361
+ protected readonly googleErrorMessage: _angular_core.WritableSignal<string | null>;
362
+ protected readonly requiresNativeGoogle: _angular_core.Signal<boolean>;
363
+ protected readonly isNativeGoogle: _angular_core.Signal<boolean>;
364
+ protected readonly googleSignInAvailable: _angular_core.Signal<boolean>;
365
+ protected readonly googleFeedbackMessage: _angular_core.Signal<string | null>;
366
+ protected readonly googleProgressMessage: _angular_core.Signal<string>;
318
367
  protected readonly form: _angular_forms.FormGroup<{
319
368
  email: _angular_forms.FormControl<string>;
320
369
  }>;
@@ -335,6 +384,7 @@ declare class AuthLoginPage {
335
384
  protected readonly emailFieldClasses: _angular_core.Signal<"flex-nowrap bg-background/70 shadow-sm [&>[data-slot=input-group-control]]:h-12! [&>[data-slot=input-group-control]]:px-4! [&>[data-slot=input-group-control]]:text-base!" | "flex-nowrap bg-background/70 shadow-sm [&>[data-slot=input-group-control]]:h-12! [&>[data-slot=input-group-control]]:px-4! [&>[data-slot=input-group-control]]:text-base! border-destructive focus-within:border-destructive focus-within:ring-destructive/20" | "flex-nowrap bg-background/70 shadow-sm [&>[data-slot=input-group-control]]:h-12! [&>[data-slot=input-group-control]]:px-4! [&>[data-slot=input-group-control]]:text-base! border-emerald-500 focus-within:border-emerald-500 focus-within:ring-emerald-500/20">;
336
385
  protected retryHealth(): void;
337
386
  protected signInWithGoogle(): void;
387
+ private signInWithNativeGoogle;
338
388
  protected redirectTo(url: string): void;
339
389
  protected submit(): Promise<void>;
340
390
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthLoginPage, never>;
@@ -382,5 +432,5 @@ declare class AuthVerifyPage {
382
432
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<AuthVerifyPage, "edsis-auth-verify-page", never, { "token": { "alias": "token"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
383
433
  }
384
434
 
385
- export { AuthGoogleCallbackPage, AuthLoginPage, AuthLogoutPage, AuthService, AuthShellPage, AuthVerifyPage, DEFAULT_EDSIS_AUTH_MESSAGES, EDSIS_AUTH_CONFIG, EDSIS_AUTH_MESSAGES, EDSIS_SKIP_AUTH, GOOGLE_OAUTH_AUTHORIZE_URL, GOOGLE_OAUTH_CALLBACK_ROUTE_PATH, GOOGLE_OAUTH_STATE_STORAGE_KEY, authRoutes, authenticatedGuard, buildGoogleAuthorizeUrl, consumeGoogleOauthState, createGoogleOauthState, edsisAuthInterceptor, guestOnlyGuard, homeRedirectGuard, mergeEdsisAuthMessages, provideEdsisAuth, resolveEdsisAuthConfig, setAuthNotificationBadge, storeGoogleOauthState };
386
- export type { AuthCredentials, AuthUser, EdsisAuthConfig, EdsisAuthGoogleOauthConfig, EdsisAuthHealthCheckConfig, EdsisAuthMessages, EdsisAuthMessagesOverride, EdsisAuthOauthConfig, GoogleAuthorizeUrlOptions, ResolvedEdsisAuthConfig, ResolvedEdsisAuthGoogleOauth, ResolvedEdsisAuthHealthCheck, ResolvedEdsisAuthOauth };
435
+ export { AuthGoogleCallbackPage, AuthLoginPage, AuthLogoutPage, AuthService, AuthShellPage, AuthVerifyPage, DEFAULT_EDSIS_AUTH_MESSAGES, EDSIS_AUTH_CONFIG, EDSIS_AUTH_MESSAGES, EDSIS_NATIVE_GOOGLE_AUTH_ADAPTER, EDSIS_SKIP_AUTH, GOOGLE_OAUTH_AUTHORIZE_URL, GOOGLE_OAUTH_CALLBACK_ROUTE_PATH, GOOGLE_OAUTH_STATE_STORAGE_KEY, NativeGoogleAuthService, TauriNativeGoogleAuthAdapter, authRoutes, authenticatedGuard, buildGoogleAuthorizeUrl, consumeGoogleOauthState, createGoogleOauthState, edsisAuthInterceptor, guestOnlyGuard, homeRedirectGuard, isNativeGoogleSignInResult, mergeEdsisAuthMessages, provideEdsisAuth, resolveEdsisAuthConfig, setAuthNotificationBadge, storeGoogleOauthState };
436
+ export type { AuthUser, EdsisAuthConfig, EdsisAuthGoogleOauthConfig, EdsisAuthHealthCheckConfig, EdsisAuthMessages, EdsisAuthMessagesOverride, EdsisAuthNativeGoogleConfig, EdsisAuthOauthConfig, EdsisNativeGoogleAuthAdapter, GoogleAuthorizeUrlOptions, NativeGooglePlatform, NativeGoogleSignInResult, ResolvedEdsisAuthConfig, ResolvedEdsisAuthGoogleOauth, ResolvedEdsisAuthHealthCheck, ResolvedEdsisAuthOauth };