fas-admin 0.0.116 → 0.0.118

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,15 @@
1
+ export interface BadgePriceMismatch {
2
+ /** The amount as it is written in the badge, e.g. "9,99". */
3
+ written: string;
4
+ /** The price of the plan in the badge's own notation, e.g. "12,99". */
5
+ expected: string;
6
+ /** The badge with only its amount replaced by the price. */
7
+ correctedBadge: string;
8
+ }
9
+ /**
10
+ * The offer tile of the application shows the amount written in the badge
11
+ * ("9,99 / jednorazowo"), while the customer is charged the plan's price.
12
+ * Returns what differs when the two do not agree, or null when they do or
13
+ * when the badge carries no amount at all.
14
+ */
15
+ export declare function badgePriceMismatch(badgeText: string | null | undefined, value: number | null | undefined): BadgePriceMismatch | null;
@@ -1,6 +1,7 @@
1
1
  import { FormControl, FormGroup } from '@angular/forms';
2
2
  import { IPlatformSubscriptionPlanVm } from '../../../../../api/platform-subscription-plan-vm.model';
3
3
  import { IDynamicForm } from '../../../../shared/models/form';
4
+ import { BadgePriceMismatch } from './badge-price';
4
5
  import * as i0 from "@angular/core";
5
6
  export declare class SubscriptionFormComponent {
6
7
  subscriptionDetailsFormGroup: FormGroup;
@@ -9,11 +10,22 @@ export declare class SubscriptionFormComponent {
9
10
  get fc(): {
10
11
  [key: string]: FormControl;
11
12
  };
13
+ private priceKind;
12
14
  formFields: IDynamicForm[];
15
+ private patchingForm;
13
16
  editMode: import("@angular/core").ModelSignal<boolean>;
14
17
  currentSubscriptionData: import("@angular/core").ModelSignal<IPlatformSubscriptionPlanVm | null>;
15
18
  constructor();
16
19
  ngOnInit(): void;
20
+ /** Set while the amount in the badge differs from the price of the plan. */
21
+ get badgePriceWarning(): BadgePriceMismatch | null;
22
+ fixBadgeText(): void;
23
+ /**
24
+ * While the operator edits the price, a badge that agreed with the old
25
+ * price follows the new one; a badge that already differed is left alone
26
+ * and stays flagged by the warning.
27
+ */
28
+ private keepBadgeInStepWithPrice;
17
29
  trimInput(controlName: string): void;
18
30
  private buildForm;
19
31
  patchFormValues(): void;
@@ -9,6 +9,7 @@ export declare class SubscriptionsListComponent implements OnInit {
9
9
  private _platformAvailableSubscriptionPlansService;
10
10
  private _platformSubscriptionUsageService;
11
11
  private _messageService;
12
+ private priceKind;
12
13
  subscriptionPlansLoading: boolean;
13
14
  showUserTable: boolean;
14
15
  resetUserTableTrigger: Subject<void>;
@@ -1,9 +1,10 @@
1
1
  import { IPlatformUserAccountVm } from '../../../../../api/platform-user-account-vm.model';
2
2
  import { FASDynamicTableColumnConfig } from 'fas-services';
3
- import { OnDestroy, OnInit } from '@angular/core';
3
+ import { AfterViewInit, OnDestroy, OnInit, TemplateRef } from '@angular/core';
4
4
  import { Observable, Subject } from 'rxjs';
5
+ import { FasUsersListCell, FasUsersListExtraColumn } from '../../../../shared/tokens/users-list-extra-columns.token';
5
6
  import * as i0 from "@angular/core";
6
- export declare class UsersListComponent implements OnInit, OnDestroy {
7
+ export declare class UsersListComponent implements OnInit, AfterViewInit, OnDestroy {
7
8
  /** The list opens on the newest accounts. */
8
9
  private readonly defaultSortField;
9
10
  private usersTable?;
@@ -12,10 +13,25 @@ export declare class UsersListComponent implements OnInit, OnDestroy {
12
13
  private _primengDialogService;
13
14
  private _confirmationService;
14
15
  private _messageService;
16
+ private _cdr;
17
+ /** Kolumny aplikacji (FAS_USERS_LIST_EXTRA_COLUMNS), np. "Źródło" konta w Kilometrówce. */
18
+ readonly extraColumns: FasUsersListExtraColumn[];
19
+ /** Komórki kolumn aplikacji dla bieżącej strony: klucz kolumny -> guid konta (małymi literami) -> komórka. */
20
+ private _extraCells;
21
+ private _pageLoaded;
22
+ private _subscriptionPlanTemp?;
23
+ private _subscriptionTagTemp?;
24
+ private _phoneTemp?;
25
+ private _extraColumnTemps?;
26
+ columnTemplates: Record<string, TemplateRef<unknown>>;
15
27
  private ref;
16
28
  readonly deleteUserDialogKey = "deleteUserConfirmation";
17
29
  refreshList: Subject<void>;
18
30
  columns: FASDynamicTableColumnConfig<IPlatformUserAccountVm>[];
31
+ constructor();
32
+ ngAfterViewInit(): void;
33
+ extraCell(extra: FasUsersListExtraColumn, user: IPlatformUserAccountVm): FasUsersListCell | null | undefined;
34
+ private extraTemplateKey;
19
35
  fetchUsers: (params: {
20
36
  page: number;
21
37
  pageSize: number;
@@ -0,0 +1,11 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ /** Czym jest cena abonamentu (`value`) w danej aplikacji: kwotą netto czy brutto. */
3
+ export type FasSubscriptionPriceKind = 'net' | 'gross';
4
+ /**
5
+ * Podpis ceny abonamentu w widoku Abonamenty. Bez ustawienia cena jest opisana jako netto.
6
+ * Aplikacja, która pobiera od klienta dokładnie `value` (bez doliczania VAT), ustawia brutto:
7
+ * `{ provide: FAS_SUBSCRIPTION_PRICE_KIND, useValue: 'gross' }` w providers aplikacji.
8
+ */
9
+ export declare const FAS_SUBSCRIPTION_PRICE_KIND: InjectionToken<FasSubscriptionPriceKind>;
10
+ /** "netto" albo "brutto" - do podpisów pól i kolumn z ceną abonamentu. */
11
+ export declare function subscriptionPriceKindLabel(kind: FasSubscriptionPriceKind | null | undefined): string;
@@ -0,0 +1,33 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { Observable } from 'rxjs';
3
+ import { IPlatformUserAccountVm } from '../../../api/platform-user-account-vm.model';
4
+ /** Komórka dodatkowej kolumny listy użytkowników: plakietka z dymkiem. */
5
+ export interface FasUsersListCell {
6
+ text: string;
7
+ /** Dymek po najechaniu - nowe linie (\n) są zachowane. */
8
+ tooltip?: string;
9
+ /** Kolor tekstu plakietki (CSS). */
10
+ color?: string;
11
+ /** Tło plakietki (CSS); bez tła - zwykły tekst. */
12
+ background?: string;
13
+ }
14
+ /**
15
+ * Kolumna listy Użytkownicy dostarczona przez aplikację (np. "Źródło" pozyskania konta w Kilometrówce), gdy dane
16
+ * pochodzą z API aplikacji, a nie z ITBees.UserManager. Lista wywołuje `load` raz dla każdej wczytanej strony
17
+ * (wszystkie konta strony naraz) i pokazuje komórki po guidzie konta; konto bez komórki ma pustą kolumnę.
18
+ */
19
+ export interface FasUsersListExtraColumn {
20
+ /** Unikalny klucz kolumny. */
21
+ key: string;
22
+ columnHeader: string;
23
+ /** Minimalna szerokość kolumny (CSS), domyślnie 200px. */
24
+ minWidth?: string;
25
+ /** Pole listy, za którym kolumna stanie (domyślnie za "Data utworzenia" - `created`). */
26
+ after?: keyof IPlatformUserAccountVm;
27
+ load(users: IPlatformUserAccountVm[]): Observable<Record<string, FasUsersListCell | null | undefined>>;
28
+ }
29
+ /**
30
+ * Dodatkowe kolumny listy użytkowników (multi):
31
+ * `{ provide: FAS_USERS_LIST_EXTRA_COLUMNS, useClass: MojaKolumna, multi: true }` w providers aplikacji.
32
+ */
33
+ export declare const FAS_USERS_LIST_EXTRA_COLUMNS: InjectionToken<FasUsersListExtraColumn[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fas-admin",
3
- "version": "0.0.116",
3
+ "version": "0.0.118",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^17.2.0",
6
6
  "@angular/core": "^17.2.0",
package/public-api.d.ts CHANGED
@@ -2,5 +2,8 @@ export * from './lib/shared/models/fas-admin-models';
2
2
  export * from './lib/shared/tokens/fas-lib-config.token';
3
3
  export * from './lib/shared/const/fas-default-config';
4
4
  export * from './api/models/api-url.token';
5
+ export * from './api/platform-user-account-vm.model';
6
+ export * from './lib/shared/tokens/users-list-extra-columns.token';
7
+ export * from './lib/shared/tokens/subscription-price-kind.token';
5
8
  export * from './lib/fas-admin.service';
6
9
  export * from './lib/fas-admin.module';