@honuware/ui 0.1.0

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,287 @@
1
+ import { Observable } from 'rxjs';
2
+ import { DatabaseSchema, CrudAccess, TableSchema, TableBinding, FilterPair, ColumnDataInfo, ForeignKeyInfo, PhotoUrlBuilder, CrudFormAssist, ComputedDateRule } from '@honuware/ui/access';
3
+ import { AuthService } from '@honuware/ui/auth';
4
+ import * as i0 from '@angular/core';
5
+ import { InjectionToken, OnInit, OnChanges, SimpleChanges, QueryList, OnDestroy } from '@angular/core';
6
+ import { Router, ActivatedRoute } from '@angular/router';
7
+ import { MatDialog } from '@angular/material/dialog';
8
+ import { CompositeControlComponent } from '@honuware/ui/controls';
9
+ import { PhotoUploadComponent } from '@honuware/ui/photos';
10
+
11
+ declare class DatabaseSchemaService {
12
+ private crudAccess;
13
+ private authService;
14
+ private _schema?;
15
+ private _schemaSubject;
16
+ private _refreshSub?;
17
+ private _fetchInProgress;
18
+ private _retryTimeoutMs;
19
+ private readonly destroyRef;
20
+ readonly schema$: Observable<DatabaseSchema | undefined>;
21
+ constructor(crudAccess: CrudAccess, authService: AuthService);
22
+ private startSchemaPolling;
23
+ refreshSchema(): void;
24
+ private tryFetchSchema;
25
+ /**
26
+ * Returns the cached DatabaseSchema if present, otherwise waits for a successful fetch.
27
+ */
28
+ GetDBSchema(): Observable<DatabaseSchema>;
29
+ static ɵfac: i0.ɵɵFactoryDeclaration<DatabaseSchemaService, never>;
30
+ static ɵprov: i0.ɵɵInjectableDeclaration<DatabaseSchemaService>;
31
+ }
32
+
33
+ /**
34
+ * Serialize a binding stack to a ctx query param string.
35
+ * Format: "table:pkColumn:pkValue,table:pkColumn:pkValue"
36
+ */
37
+ declare function serializeBindingStack(stack: TableBinding[]): string;
38
+ /**
39
+ * Deserialize a ctx query param string into a TableBinding array.
40
+ * Returns empty array for null/empty input.
41
+ */
42
+ declare function parseBindingStack(ctx: string | null | undefined): TableBinding[];
43
+ /**
44
+ * Derive filter pairs from the binding stack for the current table.
45
+ * Looks at the current table's foreign keys and matches them against
46
+ * the binding stack to build WHERE clause filters.
47
+ *
48
+ * For example, if viewing purchases with ctx=people:person_id:42,
49
+ * and purchases has FK column payer_person_id -> people.person_id,
50
+ * this returns [{ column_name: 'payer_person_id', column_value: '42' }].
51
+ */
52
+ declare function deriveFilterPairs(currentTableSchema: TableSchema, bindingStack: TableBinding[]): FilterPair[];
53
+
54
+ interface CrudEditorRoutes {
55
+ /**
56
+ * Base path for the generic table editor routes. Navigation is built as
57
+ * `[basePath, tableName, 'view'|'edit'|'new', ...]`, so this must be the
58
+ * absolute prefix the editor routes are mounted at.
59
+ */
60
+ basePath: string;
61
+ /** The admin portal home the "back" links point at. */
62
+ adminHome: string;
63
+ }
64
+ declare const DEFAULT_CRUD_EDITOR_ROUTES: CrudEditorRoutes;
65
+ declare const CRUD_EDITOR_ROUTES: InjectionToken<CrudEditorRoutes>;
66
+
67
+ interface ChildTableReference$1 {
68
+ childTableName: string;
69
+ childTableFriendlyName: string;
70
+ foreignKey: ForeignKeyInfo;
71
+ }
72
+ declare class TableViewControlComponent implements OnInit, OnChanges {
73
+ private dbSchemaService;
74
+ private crudAccess;
75
+ private photoUrlBuilder;
76
+ private editorRoutes;
77
+ private router;
78
+ private dialog;
79
+ tableName: string;
80
+ pageSize: number;
81
+ pageOffset: number;
82
+ sortColumn?: string;
83
+ sortAscending: boolean;
84
+ bindingStack: TableBinding[];
85
+ databaseSchema?: DatabaseSchema;
86
+ tableSchema?: TableSchema;
87
+ columns: ColumnDataInfo[];
88
+ displayedColumns: string[];
89
+ dataSource: Record<string, string>[];
90
+ totalCount: number;
91
+ loading: boolean;
92
+ error?: string;
93
+ childTableReferences: ChildTableReference$1[];
94
+ /** Maps column_name → pk_value → display_text for FK columns. */
95
+ fkDisplayMap: Record<string, Record<string, string>>;
96
+ pageSizeOptions: number[];
97
+ constructor(dbSchemaService: DatabaseSchemaService, crudAccess: CrudAccess, photoUrlBuilder: PhotoUrlBuilder, editorRoutes: CrudEditorRoutes, router: Router, dialog: MatDialog);
98
+ ngOnInit(): void;
99
+ ngOnChanges(changes: SimpleChanges): void;
100
+ private loadData;
101
+ private getChildTableReferences;
102
+ private resolveFkDisplayValues;
103
+ onNavigateToChild(ref: ChildTableReference$1, row: Record<string, string>): void;
104
+ private isTrueValue;
105
+ formatCellValue(column: ColumnDataInfo, value: string): string;
106
+ isBoolColumn(column: ColumnDataInfo): boolean;
107
+ getBoolValue(value: string): boolean;
108
+ getColumnHeader(column: ColumnDataInfo): string;
109
+ get hasPhotoSupport(): boolean;
110
+ getPhotoUrl(row: Record<string, string>): string;
111
+ getPrimaryKeyValue(row: Record<string, string>): string;
112
+ get currentPage(): number;
113
+ get totalPages(): number;
114
+ get startRow(): number;
115
+ get endRow(): number;
116
+ get canGoPrevious(): boolean;
117
+ get canGoNext(): boolean;
118
+ goToFirstPage(): void;
119
+ goToPreviousPage(): void;
120
+ goToNextPage(): void;
121
+ goToLastPage(): void;
122
+ /** Build query params preserving ctx for nested navigation. */
123
+ private buildCtxQueryParams;
124
+ private navigateToPage;
125
+ onPageSizeChange(newPageSize: number): void;
126
+ onNewItem(): void;
127
+ onEditRow(row: Record<string, string>): void;
128
+ /** Navigate back to the parent table's edit page by popping the binding stack. */
129
+ onNavigateToParent(): void;
130
+ get hasParent(): boolean;
131
+ get parentFriendlyName(): string;
132
+ onDeleteRow(row: Record<string, string>): void;
133
+ static ɵfac: i0.ɵɵFactoryDeclaration<TableViewControlComponent, never>;
134
+ static ɵcmp: i0.ɵɵComponentDeclaration<TableViewControlComponent, "hw-table-view-control", never, { "tableName": { "alias": "tableName"; "required": false; }; "pageSize": { "alias": "pageSize"; "required": false; }; "pageOffset": { "alias": "pageOffset"; "required": false; }; "sortColumn": { "alias": "sortColumn"; "required": false; }; "sortAscending": { "alias": "sortAscending"; "required": false; }; "bindingStack": { "alias": "bindingStack"; "required": false; }; }, {}, never, never, true, never>;
135
+ }
136
+
137
+ /**
138
+ * A child table reference discovered from the schema.
139
+ * Represents a nested table that has an FK pointing back to the current table.
140
+ */
141
+ interface ChildTableReference {
142
+ childTableName: string;
143
+ childTableFriendlyName: string;
144
+ foreignKey: ForeignKeyInfo;
145
+ }
146
+ declare class CompositeRowControlComponent implements OnInit {
147
+ private dbSchemaService;
148
+ private crudAccess;
149
+ private editorRoutes;
150
+ private router;
151
+ tableName: string;
152
+ columnNames: string[];
153
+ primaryKeyName?: string;
154
+ primaryKeyValue?: string;
155
+ isCreateMode: boolean;
156
+ returnUrl?: string;
157
+ bindingStack: TableBinding[];
158
+ formAssist?: CrudFormAssist;
159
+ controls: QueryList<CompositeControlComponent>;
160
+ photoUpload?: PhotoUploadComponent;
161
+ columnInfos: ColumnDataInfo[];
162
+ loading: boolean;
163
+ columnValues: (string | undefined)[];
164
+ hasPhotoSupport: boolean;
165
+ childTableReferences: ChildTableReference[];
166
+ /** Set of FK column names from navigation context (readonly + pre-filled in create mode). */
167
+ private contextFkColumnNames;
168
+ private databaseSchema?;
169
+ private tableSchema?;
170
+ /** Tracks whether each computed date dest column is in auto-compute mode. */
171
+ computedDateAutoState: Record<string, boolean>;
172
+ constructor(dbSchemaService: DatabaseSchemaService, crudAccess: CrudAccess, editorRoutes: CrudEditorRoutes, router: Router);
173
+ ngOnInit(): void;
174
+ private loadColumnInfos;
175
+ /**
176
+ * Compute the set of FK column names that come from navigation context.
177
+ * These should be readonly in both edit and create mode.
178
+ */
179
+ private computeContextFkColumns;
180
+ /**
181
+ * Get the pre-fill value for an FK column from the binding stack.
182
+ * Returns null if the column is not an FK from context.
183
+ */
184
+ private getContextFkValue;
185
+ /**
186
+ * Find nested tables that have FK references to the current table.
187
+ * Only includes tables listed in schema.nested_tables.
188
+ */
189
+ private getChildTableReferences;
190
+ get visibleColumns(): {
191
+ col: ColumnDataInfo;
192
+ index: number;
193
+ }[];
194
+ /** Check if a column should be readonly. Includes context FK columns. */
195
+ isReadonlyColumn(col: ColumnDataInfo): boolean;
196
+ /** Whether the column is an FK from navigation context. */
197
+ isContextFkColumn(col: ColumnDataInfo): boolean;
198
+ onValueChanged(index: number, value: string): void;
199
+ getControlValues(): Record<string, string | undefined>;
200
+ private isTextColumnType;
201
+ onSubmit(): void;
202
+ onCancel(): void;
203
+ private isTrueValue;
204
+ get showPhotoUpload(): boolean;
205
+ get photoItemId(): number;
206
+ getForeignKeyInfo(col: ColumnDataInfo): ForeignKeyInfo | undefined;
207
+ isPrimaryKeyColumn(col: ColumnDataInfo): boolean;
208
+ get hasParent(): boolean;
209
+ get parentFriendlyName(): string;
210
+ /** Navigate back to the parent table's edit page by popping the binding stack. */
211
+ onNavigateToParent(): void;
212
+ /** Navigate to a child (nested) table filtered by the current row. */
213
+ onNavigateToChild(ref: ChildTableReference): void;
214
+ private initComputedDateState;
215
+ /** When a source field changes, update any auto-computed dest fields. */
216
+ private applyComputedDates;
217
+ private computeAndSetDate;
218
+ /** Toggle auto-compute for a computed date dest column. */
219
+ onToggleComputedDate(destColumn: string): void;
220
+ /** Check if a column is a computed date dest in auto mode. */
221
+ isComputedDateAuto(columnName: string): boolean;
222
+ /** Get the computed date rule for a column, if any. */
223
+ getComputedDateRule(columnName: string): ComputedDateRule | undefined;
224
+ private navigateBack;
225
+ static ɵfac: i0.ɵɵFactoryDeclaration<CompositeRowControlComponent, never>;
226
+ static ɵcmp: i0.ɵɵComponentDeclaration<CompositeRowControlComponent, "hw-composite-row-control", never, { "tableName": { "alias": "tableName"; "required": false; }; "columnNames": { "alias": "columnNames"; "required": false; }; "primaryKeyName": { "alias": "primaryKeyName"; "required": false; }; "primaryKeyValue": { "alias": "primaryKeyValue"; "required": false; }; "isCreateMode": { "alias": "isCreateMode"; "required": false; }; "returnUrl": { "alias": "returnUrl"; "required": false; }; "bindingStack": { "alias": "bindingStack"; "required": false; }; "formAssist": { "alias": "formAssist"; "required": false; }; }, {}, never, never, true, never>;
227
+ }
228
+
229
+ declare class TableViewPageComponent implements OnInit, OnDestroy {
230
+ private route;
231
+ tableName: string;
232
+ pageSize: number;
233
+ pageOffset: number;
234
+ bindingStack: TableBinding[];
235
+ readonly adminHome: string;
236
+ private destroy$;
237
+ constructor(route: ActivatedRoute, editorRoutes: CrudEditorRoutes);
238
+ ngOnInit(): void;
239
+ ngOnDestroy(): void;
240
+ static ɵfac: i0.ɵɵFactoryDeclaration<TableViewPageComponent, never>;
241
+ static ɵcmp: i0.ɵɵComponentDeclaration<TableViewPageComponent, "hw-table-view-page", never, {}, {}, never, never, true, never>;
242
+ }
243
+
244
+ declare class TableEditPageComponent implements OnInit, OnDestroy {
245
+ private route;
246
+ private dbSchemaService;
247
+ tableName: string;
248
+ primaryKeyName: string;
249
+ primaryKeyValue: string;
250
+ columnNames: string[];
251
+ tableFriendlyName: string;
252
+ returnUrl: string;
253
+ bindingStack: TableBinding[];
254
+ loading: boolean;
255
+ error?: string;
256
+ readonly adminHome: string;
257
+ private destroy$;
258
+ constructor(route: ActivatedRoute, dbSchemaService: DatabaseSchemaService, editorRoutes: CrudEditorRoutes);
259
+ ngOnInit(): void;
260
+ ngOnDestroy(): void;
261
+ static ɵfac: i0.ɵɵFactoryDeclaration<TableEditPageComponent, never>;
262
+ static ɵcmp: i0.ɵɵComponentDeclaration<TableEditPageComponent, "hw-table-edit-page", never, {}, {}, never, never, true, never>;
263
+ }
264
+
265
+ declare class TableNewPageComponent implements OnInit, OnDestroy {
266
+ private route;
267
+ private router;
268
+ private dbSchemaService;
269
+ tableName: string;
270
+ columnNames: string[];
271
+ tableFriendlyName: string;
272
+ returnUrl: string;
273
+ bindingStack: TableBinding[];
274
+ formAssist?: CrudFormAssist;
275
+ loading: boolean;
276
+ error?: string;
277
+ readonly adminHome: string;
278
+ private destroy$;
279
+ constructor(route: ActivatedRoute, router: Router, dbSchemaService: DatabaseSchemaService, editorRoutes: CrudEditorRoutes);
280
+ ngOnInit(): void;
281
+ ngOnDestroy(): void;
282
+ static ɵfac: i0.ɵɵFactoryDeclaration<TableNewPageComponent, never>;
283
+ static ɵcmp: i0.ɵɵComponentDeclaration<TableNewPageComponent, "hw-table-new-page", never, {}, {}, never, never, true, never>;
284
+ }
285
+
286
+ export { CRUD_EDITOR_ROUTES, CompositeRowControlComponent, DEFAULT_CRUD_EDITOR_ROUTES, DatabaseSchemaService, TableEditPageComponent, TableNewPageComponent, TableViewControlComponent, TableViewPageComponent, deriveFilterPairs, parseBindingStack, serializeBindingStack };
287
+ export type { ChildTableReference, CrudEditorRoutes };
@@ -0,0 +1,89 @@
1
+ import { MatSnackBar } from '@angular/material/snack-bar';
2
+ import * as i0 from '@angular/core';
3
+ import { MatDialogRef } from '@angular/material/dialog';
4
+ import * as _angular_animations from '@angular/animations';
5
+
6
+ type ToastType = 'success' | 'error' | 'warning' | 'info';
7
+ declare class ToastService {
8
+ private snackBar;
9
+ private readonly defaultDuration;
10
+ constructor(snackBar: MatSnackBar);
11
+ /**
12
+ * Show a success toast notification
13
+ */
14
+ success(message: string, duration?: number): void;
15
+ /**
16
+ * Show an error toast notification
17
+ */
18
+ error(message: string, duration?: number): void;
19
+ /**
20
+ * Show a warning toast notification
21
+ */
22
+ warning(message: string, duration?: number): void;
23
+ /**
24
+ * Show an info toast notification
25
+ */
26
+ info(message: string, duration?: number): void;
27
+ /**
28
+ * Show a toast notification with the specified type
29
+ */
30
+ show(message: string, type?: ToastType, duration?: number): void;
31
+ /**
32
+ * Dismiss any currently visible toast
33
+ */
34
+ dismiss(): void;
35
+ static ɵfac: i0.ɵɵFactoryDeclaration<ToastService, never>;
36
+ static ɵprov: i0.ɵɵInjectableDeclaration<ToastService>;
37
+ }
38
+
39
+ interface ConfirmDialogData {
40
+ title: string;
41
+ description?: string;
42
+ buttonText?: string;
43
+ }
44
+ declare class ConfirmDialogComponent {
45
+ readonly dialogRef: MatDialogRef<ConfirmDialogComponent, boolean>;
46
+ readonly data: ConfirmDialogData;
47
+ clickConfirm(): void;
48
+ static ɵfac: i0.ɵɵFactoryDeclaration<ConfirmDialogComponent, never>;
49
+ static ɵcmp: i0.ɵɵComponentDeclaration<ConfirmDialogComponent, "hw-confirm-dialog", never, {}, {}, never, never, true, never>;
50
+ }
51
+
52
+ declare const fuseAnimations: _angular_animations.AnimationTriggerMetadata[];
53
+
54
+ declare function sanitizeReturnUrl(raw: string | null | undefined, allowlist: ReadonlyArray<string>): string;
55
+
56
+ declare function isMicrosecondTimestamp(value: string): boolean;
57
+ declare function microsToDate(value: string): Date;
58
+ declare function dateToMicros(date: Date): string;
59
+ /**
60
+ * Format a microsecond timestamp as a UTC calendar date.
61
+ * Use for dates that represent calendar days stored as UTC midnight
62
+ * (e.g., period_start_us, valid_from_us, next_billing_us).
63
+ */
64
+ declare function formatCalendarDate(value: string | number, long?: boolean): string;
65
+ /**
66
+ * Format an exclusive-end microsecond timestamp as an inclusive UTC date.
67
+ * Subtracts 1 day to convert from "first moment of next period" to "last day of period".
68
+ * Use for period_end_us, valid_to_us where the stored value is the start of the next period.
69
+ */
70
+ declare function formatPeriodEndDate(value: string | number, long?: boolean): string;
71
+ /** Get the UTC year from a microsecond timestamp string. */
72
+ declare function getUtcYear(value: string): number;
73
+ /** Get the UTC month (0-indexed) from a microsecond timestamp string. */
74
+ declare function getUtcMonth(value: string): number;
75
+ declare function areSameDates(date1: Date, date2: Date): boolean;
76
+ /** The Sunday starting the week containing `date` (local time). */
77
+ declare function firstDayOfWeek(date: Date): Date;
78
+ /** The Saturday ending the week containing `date` (local time). */
79
+ declare function lastDayOfWeek(date: Date): Date;
80
+ declare function firstDayOfMonth(date: Date): Date;
81
+ /** Expects the first day of a month; returns that month's last day. */
82
+ declare function lastDayOfMonth(date: Date): Date;
83
+ declare function addDaysToDate(date: Date, days: number): Date;
84
+ declare function addWeeksToDate(date: Date, weeks: number): Date;
85
+ declare function addMonthsToDate(date: Date, months: number): Date;
86
+ declare function formatMicroseconds(value: string): string;
87
+
88
+ export { ConfirmDialogComponent, ToastService, addDaysToDate, addMonthsToDate, addWeeksToDate, areSameDates, dateToMicros, firstDayOfMonth, firstDayOfWeek, formatCalendarDate, formatMicroseconds, formatPeriodEndDate, fuseAnimations, getUtcMonth, getUtcYear, isMicrosecondTimestamp, lastDayOfMonth, lastDayOfWeek, microsToDate, sanitizeReturnUrl };
89
+ export type { ConfirmDialogData, ToastType };
@@ -0,0 +1,46 @@
1
+ import * as i0 from '@angular/core';
2
+ import { OnInit, OnChanges, OnDestroy, SimpleChanges } from '@angular/core';
3
+ import { Observable } from 'rxjs';
4
+ import { PhotoAccess, PhotoUrlBuilder } from '@honuware/ui/access';
5
+
6
+ declare class PhotoUploadComponent implements OnInit, OnChanges, OnDestroy {
7
+ private photoAccess;
8
+ private photoUrlBuilder;
9
+ tableName: string;
10
+ tableItemId: number;
11
+ userMode: boolean;
12
+ deferUpload: boolean;
13
+ private static readonly MAX_IMAGE_DIMENSION;
14
+ photoUrl: string;
15
+ hasPhoto: boolean;
16
+ loading: boolean;
17
+ uploading: boolean;
18
+ error?: string;
19
+ pendingFile: File | null;
20
+ pendingPreviewUrl: string;
21
+ constructor(photoAccess: PhotoAccess, photoUrlBuilder: PhotoUrlBuilder);
22
+ ngOnInit(): void;
23
+ ngOnChanges(changes: SimpleChanges): void;
24
+ ngOnDestroy(): void;
25
+ private checkPhoto;
26
+ private buildPhotoUrl;
27
+ onFileSelected(event: Event): void;
28
+ onDragOver(event: DragEvent): void;
29
+ onDrop(event: DragEvent): void;
30
+ private uploadFile;
31
+ get hasPendingFile(): boolean;
32
+ clearPendingFile(): void;
33
+ uploadPendingPhoto(tableName: string, tableItemId: number): Observable<void>;
34
+ /**
35
+ * Re-encode the image as JPEG and resize if it exceeds the max dimensions.
36
+ * Converting to JPEG dramatically reduces file size for photographic content
37
+ * (a 25 MB PNG becomes ~1-2 MB JPEG) and keeps uploads under the server's
38
+ * image_max_upload_bytes limit.
39
+ */
40
+ private prepareImageForUpload;
41
+ onDeletePhoto(): void;
42
+ static ɵfac: i0.ɵɵFactoryDeclaration<PhotoUploadComponent, never>;
43
+ static ɵcmp: i0.ɵɵComponentDeclaration<PhotoUploadComponent, "hw-photo-upload", never, { "tableName": { "alias": "tableName"; "required": false; }; "tableItemId": { "alias": "tableItemId"; "required": false; }; "userMode": { "alias": "userMode"; "required": false; }; "deferUpload": { "alias": "deferUpload"; "required": false; }; }, {}, never, never, true, never>;
44
+ }
45
+
46
+ export { PhotoUploadComponent };
@@ -0,0 +1,65 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken } from '@angular/core';
3
+
4
+ interface SquareConfig {
5
+ applicationId: string;
6
+ locationId: string;
7
+ scriptUrl: string;
8
+ }
9
+ declare const SQUARE_CONFIG: InjectionToken<SquareConfig>;
10
+
11
+ /**
12
+ * Service for handling Square Web Payments SDK integration.
13
+ * Dynamically loads the Square SDK script based on the injected SQUARE_CONFIG.
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * // In a component
18
+ * async ngAfterViewInit() {
19
+ * await this.squarePayment.attachCard('#card-container');
20
+ * }
21
+ *
22
+ * async onSubmit() {
23
+ * const token = await this.squarePayment.tokenizeCard();
24
+ * // Send token to server
25
+ * }
26
+ * ```
27
+ */
28
+ declare class SquarePaymentService {
29
+ private squareConfig;
30
+ private payments;
31
+ private card;
32
+ private scriptLoaded;
33
+ constructor(squareConfig: SquareConfig);
34
+ /**
35
+ * Dynamically loads the Square SDK script based on the injected config.
36
+ * Only loads once; subsequent calls return immediately.
37
+ */
38
+ private loadScript;
39
+ /**
40
+ * Initializes the Square Payments SDK.
41
+ * Automatically loads the script if not already loaded.
42
+ */
43
+ initialize(): Promise<void>;
44
+ /**
45
+ * Attaches the Square card input form to a DOM element.
46
+ * @param containerId CSS selector for the container element (e.g., '#card-container')
47
+ */
48
+ attachCard(containerId: string): Promise<void>;
49
+ /**
50
+ * Tokenizes the card data entered by the user.
51
+ * @returns The payment token to send to the server
52
+ * @throws Error if tokenization fails
53
+ */
54
+ tokenizeCard(): Promise<string>;
55
+ /**
56
+ * Destroys the card form and resets state.
57
+ * Call this when navigating away from the payment page.
58
+ */
59
+ destroy(): void;
60
+ static ɵfac: i0.ɵɵFactoryDeclaration<SquarePaymentService, never>;
61
+ static ɵprov: i0.ɵɵInjectableDeclaration<SquarePaymentService>;
62
+ }
63
+
64
+ export { SQUARE_CONFIG, SquarePaymentService };
65
+ export type { SquareConfig };
@@ -0,0 +1,126 @@
1
+ import { Observable } from 'rxjs';
2
+ import { CrudAccess, DatabaseSchema, DataResults, DataResultsWithCount, FilterPair, AddItemBody, UpdateItemBody, FkOptionsResponse, FkDisplayResponse, AuthAccess, UserInfo, LoginInfo, SetUserInfo, UpdateUserPasswordInfo, PhotoAccess, SourcePhotoInfo } from '@honuware/ui/access';
3
+ import { Provider } from '@angular/core';
4
+
5
+ /** A stored row: a column-name → string-value map. */
6
+ type MockRow = Record<string, string>;
7
+ interface MockCrudAccessOptions {
8
+ /** The schema this store honors (columns, primary keys, FK display templates). */
9
+ schema?: DatabaseSchema;
10
+ /** Seed rows keyed by table name. */
11
+ seedRows?: Record<string, MockRow[]>;
12
+ }
13
+ /**
14
+ * In-memory, schema-driven {@link CrudAccess} for library/consumer tests. Honors
15
+ * a supplied {@link DatabaseSchema} (columns, primary keys, FK display
16
+ * templates) and keeps rows per table. Deterministic and dependency-free — the
17
+ * framework counterpart to the app's ServerAccessMock, but only the 12 generic
18
+ * CRUD methods.
19
+ */
20
+ declare class MockCrudAccess implements CrudAccess {
21
+ private readonly schema;
22
+ private readonly rows;
23
+ private readonly pkCounters;
24
+ constructor(options?: MockCrudAccessOptions);
25
+ getDbSchema(): Observable<DatabaseSchema>;
26
+ getTableRows(tableName: string): Observable<DataResults>;
27
+ getRowsByColumn(tableName: string, columnName: string, ascending: boolean, pageSize: number, pageNumber: number): Observable<DataResultsWithCount>;
28
+ getFilteredTableRows(tableName: string, columnName: string, ascending: boolean, pageSize: number, page: number, filterPairs: FilterPair[]): Observable<DataResultsWithCount>;
29
+ getRow(tableName: string, columnName: string, columnValue: string): Observable<DataResults>;
30
+ getRowByValues(tableName: string, filterPairs: FilterPair[]): Observable<DataResults>;
31
+ addItem(body: AddItemBody): Observable<void>;
32
+ addItemFetchPrimaryKey(body: AddItemBody): Observable<string>;
33
+ updateItem(body: UpdateItemBody): Observable<void>;
34
+ deleteItem(tableName: string, columnName: string, columnValue: string): Observable<void>;
35
+ getFkOptions(tableName: string, searchText: string, pageSize: number): Observable<FkOptionsResponse>;
36
+ resolveFkDisplay(parentTableName: string, values: string[]): Observable<FkDisplayResponse>;
37
+ private tableSchema;
38
+ private columnNames;
39
+ private tableRows;
40
+ private toDataResults;
41
+ private insert;
42
+ private nextPrimaryKey;
43
+ private applyFilters;
44
+ private sorted;
45
+ private paginate;
46
+ private renderTemplate;
47
+ }
48
+
49
+ interface StoredUser {
50
+ user: UserInfo;
51
+ password: string;
52
+ }
53
+ interface MockAuthAccessOptions {
54
+ /** Seed users the store knows about (with their login password). */
55
+ users?: StoredUser[];
56
+ }
57
+ /**
58
+ * In-memory {@link AuthAccess} session simulator for tests. Tracks registered
59
+ * users, a current session, and a "remember me" token. `me()`/`getUserInfo()`
60
+ * reject with a 401-shaped error when no session is active — enough to exercise
61
+ * AuthService's login / silent-reauth (me → remember → me) flows.
62
+ */
63
+ declare class MockAuthAccess implements AuthAccess {
64
+ private readonly users;
65
+ private currentEmail;
66
+ private rememberedEmail;
67
+ private personIdCounter;
68
+ constructor(options?: MockAuthAccessOptions);
69
+ register(firstName: string, lastName: string, email: string, password: string): Observable<void>;
70
+ verify(): Observable<void>;
71
+ login(loginInfo: LoginInfo): Observable<void>;
72
+ logout(): Observable<void>;
73
+ me(): Observable<void>;
74
+ remember(): Observable<void>;
75
+ getUserInfo(): Observable<UserInfo>;
76
+ setUserInfo(userInfo: SetUserInfo): Observable<void>;
77
+ updateUserPassword(passwordInfo: UpdateUserPasswordInfo): Observable<void>;
78
+ /**
79
+ * Test helper (not part of AuthAccess): drop the active session but keep the
80
+ * "remember me" token — so a subsequent `me()` rejects and `remember()` can
81
+ * restore the session, exercising the silent-reauth path (me → remember → me).
82
+ */
83
+ expireSession(): void;
84
+ }
85
+
86
+ /**
87
+ * In-memory {@link PhotoAccess} simulator for tests. Remembers which table rows
88
+ * have a photo so `hasPhoto()` reflects prior `uploadPhoto()`/`deletePhoto()`
89
+ * calls. Ignores the image bytes (mocks the server's re-encode + store).
90
+ */
91
+ declare class MockPhotoAccess implements PhotoAccess {
92
+ private readonly photos;
93
+ private nextId;
94
+ uploadPhoto(tableName: string, tableItemId: number, imageData: ArrayBuffer, imageType: string): Observable<SourcePhotoInfo>;
95
+ uploadUserPhoto(imageData: ArrayBuffer, imageType: string): Observable<SourcePhotoInfo>;
96
+ deletePhoto(tableName: string, tableItemId: number): Observable<void>;
97
+ hasPhoto(tableName: string, tableItemId: number): Observable<{
98
+ has_photo: boolean;
99
+ }>;
100
+ private key;
101
+ }
102
+
103
+ interface HonuwareAccessMocks {
104
+ crud: MockCrudAccess;
105
+ auth: MockAuthAccess;
106
+ photo: MockPhotoAccess;
107
+ }
108
+ interface ProvideHonuwareAccessMockOptions {
109
+ crud?: MockCrudAccessOptions;
110
+ auth?: MockAuthAccessOptions;
111
+ }
112
+ /**
113
+ * Test wiring: creates the three in-memory framework mocks and provides them for
114
+ * the `HONUWARE_*_ACCESS` tokens (mock mode of `provideHonuwareAccess`). Pass a
115
+ * `capture` callback to grab the mock instances for seeding/assertions.
116
+ *
117
+ * @example
118
+ * let mocks: HonuwareAccessMocks;
119
+ * TestBed.configureTestingModule({
120
+ * providers: [provideHonuwareAccessMock({ crud: { schema } }, (m) => (mocks = m))],
121
+ * });
122
+ */
123
+ declare function provideHonuwareAccessMock(options?: ProvideHonuwareAccessMockOptions, capture?: (mocks: HonuwareAccessMocks) => void): Provider[];
124
+
125
+ export { MockAuthAccess, MockCrudAccess, MockPhotoAccess, provideHonuwareAccessMock };
126
+ export type { HonuwareAccessMocks, MockAuthAccessOptions, MockCrudAccessOptions, MockRow, ProvideHonuwareAccessMockOptions, StoredUser };
@@ -0,0 +1,3 @@
1
+ declare const HONUWARE_UI_VERSION = "0.1.0";
2
+
3
+ export { HONUWARE_UI_VERSION };