@progalaxyelabs/ngx-stonescriptphp-client 1.18.3 → 1.20.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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, makeEnvironmentProviders, Injectable, Inject, EventEmitter, Output, Input, Component, Optional } from '@angular/core';
2
+ import { InjectionToken, makeEnvironmentProviders, Injectable, Inject, Optional, EventEmitter, Output, Input, Component, input, output, signal, computed } from '@angular/core';
3
3
  import { BehaviorSubject } from 'rxjs';
4
4
  import * as i3 from '@angular/common';
5
5
  import { CommonModule } from '@angular/common';
@@ -8,6 +8,13 @@ import { FormsModule } from '@angular/forms';
8
8
 
9
9
  class MyEnvironmentModel {
10
10
  production = true;
11
+ /**
12
+ * Enable debug logging across the app.
13
+ * Set to true in development environments to see [DEBUG] logs in the browser console.
14
+ * Always false in production.
15
+ * @default false
16
+ */
17
+ debug = false;
11
18
  /**
12
19
  * Platform code identifier (e.g., 'progalaxy', 'hr', 'admin').
13
20
  * Used for multi-tenant authentication.
@@ -1448,6 +1455,61 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImpo
1448
1455
  }]
1449
1456
  }], ctorParameters: () => [] });
1450
1457
 
1458
+ /**
1459
+ * LogService — debug logger for ProgalaxyELabs Angular platforms.
1460
+ *
1461
+ * Reads environment.debug from MyEnvironmentModel (set via provideNgxStoneScriptPhpClient).
1462
+ * All output is silenced when debug = false (production default).
1463
+ *
1464
+ * Usage in components / services:
1465
+ * ```typescript
1466
+ * constructor(private log: LogService) {}
1467
+ *
1468
+ * this.log.debug('MyComponent', 'event fired', { data });
1469
+ * ```
1470
+ *
1471
+ * Configure in app:
1472
+ * ```typescript
1473
+ * // environment.ts
1474
+ * export const environment = { production: false, debug: true, ... };
1475
+ *
1476
+ * // app.config.ts
1477
+ * provideNgxStoneScriptPhpClient(environment) // LogService picks up environment.debug automatically
1478
+ * ```
1479
+ */
1480
+ class LogService {
1481
+ _debug = false;
1482
+ constructor(env) {
1483
+ this._debug = env?.debug ?? false;
1484
+ }
1485
+ /** Log a debug message. No-op when environment.debug = false. */
1486
+ debug(context, message, ...args) {
1487
+ if (this._debug) {
1488
+ console.log(`[DEBUG][${context}] ${message}`, ...args);
1489
+ }
1490
+ }
1491
+ /** Log a warning. Always visible regardless of debug flag. */
1492
+ warn(context, message, ...args) {
1493
+ console.warn(`[WARN][${context}] ${message}`, ...args);
1494
+ }
1495
+ /** Log an error. Always visible regardless of debug flag. */
1496
+ error(context, message, ...args) {
1497
+ console.error(`[ERROR][${context}] ${message}`, ...args);
1498
+ }
1499
+ /** Returns true if debug mode is on (useful for conditional expensive logging). */
1500
+ get isDebug() {
1501
+ return this._debug;
1502
+ }
1503
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: LogService, deps: [{ token: MyEnvironmentModel, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
1504
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: LogService, providedIn: 'root' });
1505
+ }
1506
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: LogService, decorators: [{
1507
+ type: Injectable,
1508
+ args: [{ providedIn: 'root' }]
1509
+ }], ctorParameters: () => [{ type: MyEnvironmentModel, decorators: [{
1510
+ type: Optional
1511
+ }] }] });
1512
+
1451
1513
  /**
1452
1514
  * CSRF Token Service
1453
1515
  *
@@ -3331,6 +3393,256 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImpo
3331
3393
  type: Input
3332
3394
  }] } });
3333
3395
 
3396
+ class MonthYearPickerComponent {
3397
+ label = input('Select date', ...(ngDevMode ? [{ debugName: "label" }] : []));
3398
+ value = input(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
3399
+ valueChange = output();
3400
+ MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
3401
+ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
3402
+ today = {
3403
+ month: new Date().getMonth(),
3404
+ year: new Date().getFullYear(),
3405
+ };
3406
+ isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
3407
+ tempMonth = signal(null, ...(ngDevMode ? [{ debugName: "tempMonth" }] : []));
3408
+ tempYear = signal(null, ...(ngDevMode ? [{ debugName: "tempYear" }] : []));
3409
+ yearStart = signal(this.today.year - 4, ...(ngDevMode ? [{ debugName: "yearStart" }] : []));
3410
+ years = computed(() => Array.from({ length: 12 }, (_, i) => this.yearStart() + i), ...(ngDevMode ? [{ debugName: "years" }] : []));
3411
+ displayValue = computed(() => {
3412
+ const v = this.value();
3413
+ return v ? `${this.MONTHS[v.month]} ${v.year}` : '— / —';
3414
+ }, ...(ngDevMode ? [{ debugName: "displayValue" }] : []));
3415
+ preview = computed(() => {
3416
+ const m = this.tempMonth();
3417
+ const y = this.tempYear();
3418
+ if (m !== null && y !== null)
3419
+ return `${this.MONTHS[m]} ${y}`;
3420
+ if (m !== null)
3421
+ return `${this.MONTHS[m]} —`;
3422
+ if (y !== null)
3423
+ return `— ${y}`;
3424
+ return '';
3425
+ }, ...(ngDevMode ? [{ debugName: "preview" }] : []));
3426
+ open() {
3427
+ const v = this.value();
3428
+ this.tempMonth.set(v?.month ?? null);
3429
+ this.tempYear.set(v?.year ?? null);
3430
+ this.isOpen.set(true);
3431
+ }
3432
+ selectMonth(m) { this.tempMonth.set(m); }
3433
+ selectYear(y) { this.tempYear.set(y); }
3434
+ shiftYears(delta) { this.yearStart.update(s => s + delta); }
3435
+ confirm() {
3436
+ const m = this.tempMonth();
3437
+ const y = this.tempYear();
3438
+ if (m === null || y === null)
3439
+ return;
3440
+ this.valueChange.emit({ month: m, year: y });
3441
+ this.isOpen.set(false);
3442
+ }
3443
+ cancel() { this.isOpen.set(false); }
3444
+ isSelectedMonth(m) { return this.tempMonth() === m; }
3445
+ isSelectedYear(y) { return this.tempYear() === y; }
3446
+ isCurrentMonth(m) { return m === this.today.month; }
3447
+ isCurrentYear(y) { return y === this.today.year; }
3448
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: MonthYearPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3449
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.17", type: MonthYearPickerComponent, isStandalone: true, selector: "nsx-month-year-picker", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: `
3450
+ <button
3451
+ type="button"
3452
+ class="btn btn-outline-secondary w-100 d-flex justify-content-between align-items-center"
3453
+ (click)="open()">
3454
+ <span class="font-monospace" [class.text-muted]="!value()">
3455
+ {{ displayValue() }}
3456
+ </span>
3457
+ <small class="text-muted">&#9662;</small>
3458
+ </button>
3459
+
3460
+ @if (isOpen()) {
3461
+ <div class="border rounded mt-1" style="overflow: hidden; position: relative; z-index: 10; background: white;">
3462
+
3463
+ <div class="d-flex justify-content-between align-items-center px-3 py-2 bg-body-tertiary border-bottom">
3464
+ <span class="text-uppercase text-muted fw-semibold" style="font-size: 10px; letter-spacing: .08em;">
3465
+ {{ label() }}
3466
+ </span>
3467
+ <span class="font-monospace fw-semibold">{{ preview() }}</span>
3468
+ </div>
3469
+
3470
+ <div class="px-2 pt-2 pb-1">
3471
+ <div class="text-uppercase text-muted px-1 mb-1" style="font-size: 10px; letter-spacing: .08em;">Month</div>
3472
+ <div class="row row-cols-4 g-1">
3473
+ @for (month of MONTHS; track $index) {
3474
+ <div class="col">
3475
+ <button
3476
+ type="button"
3477
+ class="btn btn-sm w-100"
3478
+ [class.btn-success]="isSelectedMonth($index)"
3479
+ [class.btn-outline-success]="isCurrentMonth($index) && !isSelectedMonth($index)"
3480
+ [class.btn-light]="!isSelectedMonth($index) && !isCurrentMonth($index)"
3481
+ (click)="selectMonth($index)">
3482
+ {{ month }}
3483
+ </button>
3484
+ </div>
3485
+ }
3486
+ </div>
3487
+ </div>
3488
+
3489
+ <div class="px-2 pt-1 pb-2">
3490
+ <div class="text-uppercase text-muted px-1 mb-1" style="font-size: 10px; letter-spacing: .08em;">Year</div>
3491
+ <div class="row row-cols-4 g-1">
3492
+ @for (year of years(); track year) {
3493
+ <div class="col">
3494
+ <button
3495
+ type="button"
3496
+ class="btn btn-sm w-100 font-monospace"
3497
+ [class.btn-success]="isSelectedYear(year)"
3498
+ [class.btn-outline-success]="isCurrentYear(year) && !isSelectedYear(year)"
3499
+ [class.btn-light]="!isSelectedYear(year) && !isCurrentYear(year)"
3500
+ (click)="selectYear(year)">
3501
+ {{ year }}
3502
+ </button>
3503
+ </div>
3504
+ }
3505
+ </div>
3506
+
3507
+ <div class="row g-1 mt-1">
3508
+ <div class="col">
3509
+ <button type="button" class="btn btn-sm btn-light w-100" (click)="shiftYears(-12)">
3510
+ &lsaquo; Earlier
3511
+ </button>
3512
+ </div>
3513
+ <div class="col">
3514
+ <button type="button" class="btn btn-sm btn-light w-100" (click)="shiftYears(12)">
3515
+ Later &rsaquo;
3516
+ </button>
3517
+ </div>
3518
+ </div>
3519
+ </div>
3520
+
3521
+ <div class="row g-0 border-top">
3522
+ <div class="col border-end">
3523
+ <button
3524
+ type="button"
3525
+ class="btn w-100 rounded-0 py-2 fw-semibold text-success"
3526
+ (click)="confirm()">
3527
+ OK
3528
+ </button>
3529
+ </div>
3530
+ <div class="col">
3531
+ <button
3532
+ type="button"
3533
+ class="btn btn-light w-100 rounded-0 py-2"
3534
+ (click)="cancel()">
3535
+ Cancel
3536
+ </button>
3537
+ </div>
3538
+ </div>
3539
+
3540
+ </div>
3541
+ }
3542
+ `, isInline: true });
3543
+ }
3544
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: MonthYearPickerComponent, decorators: [{
3545
+ type: Component,
3546
+ args: [{
3547
+ selector: 'nsx-month-year-picker',
3548
+ standalone: true,
3549
+ template: `
3550
+ <button
3551
+ type="button"
3552
+ class="btn btn-outline-secondary w-100 d-flex justify-content-between align-items-center"
3553
+ (click)="open()">
3554
+ <span class="font-monospace" [class.text-muted]="!value()">
3555
+ {{ displayValue() }}
3556
+ </span>
3557
+ <small class="text-muted">&#9662;</small>
3558
+ </button>
3559
+
3560
+ @if (isOpen()) {
3561
+ <div class="border rounded mt-1" style="overflow: hidden; position: relative; z-index: 10; background: white;">
3562
+
3563
+ <div class="d-flex justify-content-between align-items-center px-3 py-2 bg-body-tertiary border-bottom">
3564
+ <span class="text-uppercase text-muted fw-semibold" style="font-size: 10px; letter-spacing: .08em;">
3565
+ {{ label() }}
3566
+ </span>
3567
+ <span class="font-monospace fw-semibold">{{ preview() }}</span>
3568
+ </div>
3569
+
3570
+ <div class="px-2 pt-2 pb-1">
3571
+ <div class="text-uppercase text-muted px-1 mb-1" style="font-size: 10px; letter-spacing: .08em;">Month</div>
3572
+ <div class="row row-cols-4 g-1">
3573
+ @for (month of MONTHS; track $index) {
3574
+ <div class="col">
3575
+ <button
3576
+ type="button"
3577
+ class="btn btn-sm w-100"
3578
+ [class.btn-success]="isSelectedMonth($index)"
3579
+ [class.btn-outline-success]="isCurrentMonth($index) && !isSelectedMonth($index)"
3580
+ [class.btn-light]="!isSelectedMonth($index) && !isCurrentMonth($index)"
3581
+ (click)="selectMonth($index)">
3582
+ {{ month }}
3583
+ </button>
3584
+ </div>
3585
+ }
3586
+ </div>
3587
+ </div>
3588
+
3589
+ <div class="px-2 pt-1 pb-2">
3590
+ <div class="text-uppercase text-muted px-1 mb-1" style="font-size: 10px; letter-spacing: .08em;">Year</div>
3591
+ <div class="row row-cols-4 g-1">
3592
+ @for (year of years(); track year) {
3593
+ <div class="col">
3594
+ <button
3595
+ type="button"
3596
+ class="btn btn-sm w-100 font-monospace"
3597
+ [class.btn-success]="isSelectedYear(year)"
3598
+ [class.btn-outline-success]="isCurrentYear(year) && !isSelectedYear(year)"
3599
+ [class.btn-light]="!isSelectedYear(year) && !isCurrentYear(year)"
3600
+ (click)="selectYear(year)">
3601
+ {{ year }}
3602
+ </button>
3603
+ </div>
3604
+ }
3605
+ </div>
3606
+
3607
+ <div class="row g-1 mt-1">
3608
+ <div class="col">
3609
+ <button type="button" class="btn btn-sm btn-light w-100" (click)="shiftYears(-12)">
3610
+ &lsaquo; Earlier
3611
+ </button>
3612
+ </div>
3613
+ <div class="col">
3614
+ <button type="button" class="btn btn-sm btn-light w-100" (click)="shiftYears(12)">
3615
+ Later &rsaquo;
3616
+ </button>
3617
+ </div>
3618
+ </div>
3619
+ </div>
3620
+
3621
+ <div class="row g-0 border-top">
3622
+ <div class="col border-end">
3623
+ <button
3624
+ type="button"
3625
+ class="btn w-100 rounded-0 py-2 fw-semibold text-success"
3626
+ (click)="confirm()">
3627
+ OK
3628
+ </button>
3629
+ </div>
3630
+ <div class="col">
3631
+ <button
3632
+ type="button"
3633
+ class="btn btn-light w-100 rounded-0 py-2"
3634
+ (click)="cancel()">
3635
+ Cancel
3636
+ </button>
3637
+ </div>
3638
+ </div>
3639
+
3640
+ </div>
3641
+ }
3642
+ `,
3643
+ }]
3644
+ }], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }] } });
3645
+
3334
3646
  class TenantRegisterComponent {
3335
3647
  auth;
3336
3648
  providerRegistry;
@@ -4221,5 +4533,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImpo
4221
4533
  * Generated bundle index. Do not edit.
4222
4534
  */
4223
4535
 
4224
- export { AUTH_PLUGIN, ApiConnectionService, ApiResponse, AuthPageComponent, AuthService, CsrfService, DbService, FilesService, LoginDialogComponent, MyEnvironmentModel, ProgalaxyElabsAuth, ProviderRegistryService, RegisterComponent, SigninStatusService, StoneScriptPHPAuth, TenantLoginComponent, TenantLoginDialogComponent, TenantRegisterComponent, TenantRegisterDialogComponent, TokenService, VerifyStatus, provideNgxStoneScriptPhpClient };
4536
+ export { AUTH_PLUGIN, ApiConnectionService, ApiResponse, AuthPageComponent, AuthService, CsrfService, DbService, FilesService, LogService, LoginDialogComponent, MonthYearPickerComponent, MyEnvironmentModel, ProgalaxyElabsAuth, ProviderRegistryService, RegisterComponent, SigninStatusService, StoneScriptPHPAuth, TenantLoginComponent, TenantLoginDialogComponent, TenantRegisterComponent, TenantRegisterDialogComponent, TokenService, VerifyStatus, provideNgxStoneScriptPhpClient };
4225
4537
  //# sourceMappingURL=progalaxyelabs-ngx-stonescriptphp-client.mjs.map