cloud-ide-shared 1.0.69 → 1.0.73

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 { Component, InjectionToken, inject, Injectable, input, output, signal, DestroyRef, computed, effect, ViewContainerRef, EventEmitter, Output, Input } from '@angular/core';
2
+ import { Component, InjectionToken, inject, Injector, runInInjectionContext, Injectable, input, output, signal, DestroyRef, computed, effect, ViewContainerRef, EventEmitter, Output, Input } from '@angular/core';
3
3
  import { Router } from '@angular/router';
4
4
  import { Observable, BehaviorSubject, throwError } from 'rxjs';
5
5
  import { CideEleFileManagerService, CideEleButtonComponent, CideIconComponent, CideSpinnerComponent, TooltipDirective, NotificationService, CideSelectComponent } from 'cloud-ide-element';
@@ -62,14 +62,17 @@ const authGuard = (route, state) => {
62
62
  const authService = inject(AUTH_SERVICE_TOKEN);
63
63
  const appState = inject(APP_STATE_SERVICE_TOKEN);
64
64
  const router = inject(Router);
65
+ const injector = inject(Injector);
65
66
  // Check if user is authenticated using current state (without refreshing first)
66
67
  const isAuthenticated = appState.isUserAuthenticated() && !authService.isTokenExpired();
67
68
  // Defer state refresh to next change detection cycle to avoid ExpressionChangedAfterItHasBeenCheckedError
68
69
  Promise.resolve().then(() => {
69
- // Refresh auth state to make sure it's current
70
- authService.refreshAuthState();
71
- // Refresh app state from localStorage to ensure synchronization
72
- appState.refreshFromLocalStorage();
70
+ runInInjectionContext(injector, () => {
71
+ // Refresh auth state to make sure it's current
72
+ authService.refreshAuthState();
73
+ // Refresh app state from localStorage to ensure synchronization
74
+ appState.refreshFromLocalStorage();
75
+ });
73
76
  });
74
77
  if (isAuthenticated) {
75
78
  return true;
@@ -650,6 +653,63 @@ const FEE_PAYMENT_SERVICE_TOKEN = new InjectionToken('CideFeeFeePaymentService')
650
653
  */
651
654
  const EDUCATION_BOARD_SERVICE_TOKEN = new InjectionToken('EducationBoardService');
652
655
 
656
+ /**
657
+ * Injection token for FeeDetailsViewerComponent
658
+ * This allows the component to be provided without direct import dependency
659
+ *
660
+ * @example
661
+ * ```typescript
662
+ * // In app.config.ts
663
+ * import { FeeDetailsViewerComponent } from 'cloud-ide-fees';
664
+ * import { FEE_DETAILS_VIEWER_COMPONENT_TOKEN } from 'cloud-ide-shared';
665
+ *
666
+ * providers: [
667
+ * { provide: FEE_DETAILS_VIEWER_COMPONENT_TOKEN, useValue: FeeDetailsViewerComponent }
668
+ * ]
669
+ *
670
+ * // In component template
671
+ * <cide-shared-fee-details-viewer-wrapper
672
+ * [isOpen]="viewingFeeDetails() !== null"
673
+ * [feeData]="getFeeDataForViewer()"
674
+ * [assignmentDate]="getAssignmentDate()"
675
+ * [discount]="getFeeDiscountForViewer()"
676
+ * (closed)="closeFeeDetails()">
677
+ * </cide-shared-fee-details-viewer-wrapper>
678
+ * ```
679
+ */
680
+ const FEE_DETAILS_VIEWER_COMPONENT_TOKEN = new InjectionToken('FeeDetailsViewerComponent');
681
+
682
+ /**
683
+ * Injection token for ProgramSectionSelectorComponent
684
+ * This allows the component to be provided without direct import dependency
685
+ *
686
+ * @example
687
+ * ```typescript
688
+ * // In app.config.ts
689
+ * import { CideLytProgramSectionSelectorComponent } from 'cloud-ide-academics';
690
+ * import { PROGRAM_SECTION_SELECTOR_COMPONENT_TOKEN } from 'cloud-ide-shared';
691
+ *
692
+ * providers: [
693
+ * { provide: PROGRAM_SECTION_SELECTOR_COMPONENT_TOKEN, useValue: CideLytProgramSectionSelectorComponent }
694
+ * ]
695
+ *
696
+ * // In component template
697
+ * <cide-shared-program-section-selector-wrapper
698
+ * [formGroup]="form"
699
+ * [classProgramControlName]="'class_program_id'"
700
+ * [academicYearId]="academicYearId()"
701
+ * (valuesChange)="onValuesChange($event)">
702
+ * </cide-shared-program-section-selector-wrapper>
703
+ * ```
704
+ */
705
+ const PROGRAM_SECTION_SELECTOR_COMPONENT_TOKEN = new InjectionToken('ProgramSectionSelectorComponent');
706
+
707
+ /**
708
+ * Injection token for FeeApplicableFeesComponent
709
+ * This allows the component to be provided without direct import dependency
710
+ */
711
+ const FEE_APPLICABLE_FEES_COMPONENT_TOKEN = new InjectionToken('FeeApplicableFeesComponent');
712
+
653
713
  class CideSharedOrgStructureComponent {
654
714
  // Input parameters for configuration
655
715
  allowSwitching = input(true, ...(ngDevMode ? [{ debugName: "allowSwitching" }] : [])); // Allow entity switching (default: true)
@@ -1708,32 +1768,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
1708
1768
  ], template: "<div class=\"program-section-selector\" [ngClass]=\"gridCols()\">\r\n <!-- Class/Program Dropdown -->\r\n <cide-ele-select \r\n [label]=\"showLabels() ? 'Program/Class' : ''\" \r\n [formControl]=\"getClassProgramControl()\"\r\n [options]=\"classProgramOptions()\"\r\n [loading]=\"classProgramMastersLoading()\"\r\n [searchable]=\"true\"\r\n (searchChange)=\"onClassProgramSearch($event)\"\r\n placeholder=\"Search and select class/program\"\r\n [disabled]=\"disabled()\"\r\n size=\"sm\">\r\n </cide-ele-select>\r\n\r\n <!-- Branch/Specialization Dropdown (conditional) -->\r\n @if (showBranchDropdown()) {\r\n <cide-ele-select \r\n [label]=\"showLabels() ? 'Branch (Specialization)' : ''\" \r\n [formControl]=\"getBranchControl()\"\r\n [options]=\"classProgramBranches()\"\r\n [loading]=\"classProgramBranchesLoading()\"\r\n placeholder=\"Select branch\"\r\n [disabled]=\"disabled() || !formGroup().get(classProgramControlName())?.value\"\r\n size=\"sm\">\r\n </cide-ele-select>\r\n }\r\n\r\n <!-- Program Term Dropdown (conditional) -->\r\n @if (showTermDropdown()) {\r\n <cide-ele-select \r\n [label]=\"showLabels() ? 'Program Term' : ''\" \r\n [formControl]=\"getTermControl()\"\r\n [options]=\"classProgramTerms()\"\r\n [loading]=\"classProgramTermsLoading()\"\r\n placeholder=\"Select term/semester\"\r\n [disabled]=\"disabled() || !formGroup().get(classProgramControlName())?.value\"\r\n size=\"sm\"\r\n valueKey=\"_id\"\r\n labelKey=\"label\"\r\n [treeView]=\"{ enabled: true, primaryKey: '_id', foreignKey: 'acapt_parent_class_prog_term_acapt' }\">\r\n </cide-ele-select>\r\n }\r\n\r\n <!-- Section Dropdown (conditional) -->\r\n @if (hasSections()) {\r\n <cide-ele-select \r\n [label]=\"showLabels() ? 'Section' : ''\" \r\n [formControl]=\"getSectionControl()\"\r\n [options]=\"programTermSections()\"\r\n [loading]=\"programTermSectionsLoading()\"\r\n placeholder=\"Select section\"\r\n [disabled]=\"disabled() || !formGroup().get(termControlName())?.value\"\r\n size=\"sm\">\r\n </cide-ele-select>\r\n }\r\n</div>\r\n\r\n", styles: [".program-section-selector{display:grid;gap:1rem;width:100%;border:none;padding:0;margin:0;background:transparent}\n"] }]
1709
1769
  }], ctorParameters: () => [], propDecorators: { formGroup: [{ type: i0.Input, args: [{ isSignal: true, alias: "formGroup", required: true }] }], classProgramControlName: [{ type: i0.Input, args: [{ isSignal: true, alias: "classProgramControlName", required: false }] }], branchControlName: [{ type: i0.Input, args: [{ isSignal: true, alias: "branchControlName", required: false }] }], termControlName: [{ type: i0.Input, args: [{ isSignal: true, alias: "termControlName", required: false }] }], sectionControlName: [{ type: i0.Input, args: [{ isSignal: true, alias: "sectionControlName", required: false }] }], academicYearId: [{ type: i0.Input, args: [{ isSignal: true, alias: "academicYearId", required: false }] }], entityId: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityId", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], showLabels: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLabels", required: false }] }], gridCols: [{ type: i0.Input, args: [{ isSignal: true, alias: "gridCols", required: false }] }], showAllPrograms: [{ type: i0.Input, args: [{ isSignal: true, alias: "showAllPrograms", required: false }] }], includeInactive: [{ type: i0.Input, args: [{ isSignal: true, alias: "includeInactive", required: false }] }], valuesChange: [{ type: i0.Output, args: ["valuesChange"] }] } });
1710
1770
 
1711
- /**
1712
- * Injection token for FeeDetailsViewerComponent
1713
- * This allows the component to be provided without direct import dependency
1714
- *
1715
- * @example
1716
- * ```typescript
1717
- * // In app.config.ts
1718
- * import { FeeDetailsViewerComponent } from 'cloud-ide-fees';
1719
- * import { FEE_DETAILS_VIEWER_COMPONENT_TOKEN } from 'cloud-ide-shared';
1720
- *
1721
- * providers: [
1722
- * { provide: FEE_DETAILS_VIEWER_COMPONENT_TOKEN, useValue: FeeDetailsViewerComponent }
1723
- * ]
1724
- *
1725
- * // In component template
1726
- * <cide-shared-fee-details-viewer-wrapper
1727
- * [isOpen]="viewingFeeDetails() !== null"
1728
- * [feeData]="getFeeDataForViewer()"
1729
- * [assignmentDate]="getAssignmentDate()"
1730
- * [discount]="getFeeDiscountForViewer()"
1731
- * (closed)="closeFeeDetails()">
1732
- * </cide-shared-fee-details-viewer-wrapper>
1733
- * ```
1734
- */
1735
- const FEE_DETAILS_VIEWER_COMPONENT_TOKEN = new InjectionToken('FeeDetailsViewerComponent');
1736
-
1737
1771
  /**
1738
1772
  * Wrapper component that dynamically loads the FeeDetailsViewerComponent
1739
1773
  * This allows front-desk to use the component without directly importing cloud-ide-fees
@@ -1853,31 +1887,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
1853
1887
  type: Output
1854
1888
  }] } });
1855
1889
 
1856
- /**
1857
- * Injection token for ProgramSectionSelectorComponent
1858
- * This allows the component to be provided without direct import dependency
1859
- *
1860
- * @example
1861
- * ```typescript
1862
- * // In app.config.ts
1863
- * import { CideLytProgramSectionSelectorComponent } from 'cloud-ide-academics';
1864
- * import { PROGRAM_SECTION_SELECTOR_COMPONENT_TOKEN } from 'cloud-ide-shared';
1865
- *
1866
- * providers: [
1867
- * { provide: PROGRAM_SECTION_SELECTOR_COMPONENT_TOKEN, useValue: CideLytProgramSectionSelectorComponent }
1868
- * ]
1869
- *
1870
- * // In component template
1871
- * <cide-shared-program-section-selector-wrapper
1872
- * [formGroup]="form"
1873
- * [classProgramControlName]="'class_program_id'"
1874
- * [academicYearId]="academicYearId()"
1875
- * (valuesChange)="onValuesChange($event)">
1876
- * </cide-shared-program-section-selector-wrapper>
1877
- * ```
1878
- */
1879
- const PROGRAM_SECTION_SELECTOR_COMPONENT_TOKEN = new InjectionToken('ProgramSectionSelectorComponent');
1880
-
1881
1890
  /**
1882
1891
  * Wrapper component that dynamically loads the ProgramSectionSelectorComponent
1883
1892
  * This allows front-desk to use the component without directly importing cloud-ide-academics
@@ -2042,6 +2051,113 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
2042
2051
  type: Output
2043
2052
  }] } });
2044
2053
 
2054
+ /**
2055
+ * Wrapper component that dynamically loads the FeeApplicableFeesComponent
2056
+ * This allows front-desk to use the component without directly importing cloud-ide-fees
2057
+ */
2058
+ class FeeApplicableFeesWrapperComponent {
2059
+ viewContainerRef = inject(ViewContainerRef);
2060
+ destroyRef = inject(DestroyRef);
2061
+ componentToken = inject(FEE_APPLICABLE_FEES_COMPONENT_TOKEN, { optional: true });
2062
+ componentRef = null;
2063
+ // Inputs
2064
+ entityId = null;
2065
+ academicYearId = '';
2066
+ classProgramId = '';
2067
+ termId = '';
2068
+ branchId = null;
2069
+ sectionId = null;
2070
+ studentId = null;
2071
+ // Outputs
2072
+ feesCalculated = new EventEmitter();
2073
+ ngOnInit() {
2074
+ if (this.componentToken) {
2075
+ this.loadComponent();
2076
+ }
2077
+ }
2078
+ ngOnChanges(changes) {
2079
+ if (this.componentRef) {
2080
+ this.updateComponentInputs();
2081
+ }
2082
+ else if (this.componentToken) {
2083
+ this.loadComponent();
2084
+ }
2085
+ }
2086
+ ngOnDestroy() {
2087
+ this.destroyComponent();
2088
+ }
2089
+ loadComponent() {
2090
+ if (!this.componentToken) {
2091
+ console.warn('FEE_APPLICABLE_FEES_COMPONENT_TOKEN not provided.');
2092
+ return;
2093
+ }
2094
+ if (this.componentRef) {
2095
+ this.updateComponentInputs();
2096
+ return;
2097
+ }
2098
+ try {
2099
+ this.componentRef = this.viewContainerRef.createComponent(this.componentToken);
2100
+ this.updateComponentInputs();
2101
+ // Subscribe to outputs
2102
+ if (this.componentRef.instance.feesCalculated) {
2103
+ const output = this.componentRef.instance.feesCalculated;
2104
+ if (output && typeof output.subscribe === 'function') {
2105
+ output.subscribe((val) => this.feesCalculated.emit(val));
2106
+ }
2107
+ }
2108
+ }
2109
+ catch (error) {
2110
+ console.error('Error loading FeeApplicableFeesComponent:', error);
2111
+ }
2112
+ }
2113
+ updateComponentInputs() {
2114
+ if (!this.componentRef)
2115
+ return;
2116
+ // Use setInput for signal inputs
2117
+ this.componentRef.setInput('entityId', this.entityId);
2118
+ this.componentRef.setInput('academicYearId', this.academicYearId);
2119
+ this.componentRef.setInput('classProgramId', this.classProgramId);
2120
+ this.componentRef.setInput('termId', this.termId);
2121
+ this.componentRef.setInput('branchId', this.branchId);
2122
+ this.componentRef.setInput('sectionId', this.sectionId);
2123
+ this.componentRef.setInput('studentId', this.studentId);
2124
+ this.componentRef.changeDetectorRef.detectChanges();
2125
+ }
2126
+ destroyComponent() {
2127
+ if (this.componentRef) {
2128
+ this.componentRef.destroy();
2129
+ this.componentRef = null;
2130
+ this.viewContainerRef.clear();
2131
+ }
2132
+ }
2133
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: FeeApplicableFeesWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2134
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.15", type: FeeApplicableFeesWrapperComponent, isStandalone: true, selector: "cide-shared-fee-applicable-fees-wrapper", inputs: { entityId: "entityId", academicYearId: "academicYearId", classProgramId: "classProgramId", termId: "termId", branchId: "branchId", sectionId: "sectionId", studentId: "studentId" }, outputs: { feesCalculated: "feesCalculated" }, usesOnChanges: true, ngImport: i0, template: `<!-- Component will be dynamically loaded here -->`, isInline: true });
2135
+ }
2136
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: FeeApplicableFeesWrapperComponent, decorators: [{
2137
+ type: Component,
2138
+ args: [{
2139
+ selector: 'cide-shared-fee-applicable-fees-wrapper',
2140
+ standalone: true,
2141
+ template: `<!-- Component will be dynamically loaded here -->`
2142
+ }]
2143
+ }], propDecorators: { entityId: [{
2144
+ type: Input
2145
+ }], academicYearId: [{
2146
+ type: Input
2147
+ }], classProgramId: [{
2148
+ type: Input
2149
+ }], termId: [{
2150
+ type: Input
2151
+ }], branchId: [{
2152
+ type: Input
2153
+ }], sectionId: [{
2154
+ type: Input
2155
+ }], studentId: [{
2156
+ type: Input
2157
+ }], feesCalculated: [{
2158
+ type: Output
2159
+ }] } });
2160
+
2045
2161
  /*
2046
2162
  * Public API Surface of cloud-ide-shared
2047
2163
  */
@@ -2050,5 +2166,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
2050
2166
  * Generated bundle index. Do not edit.
2051
2167
  */
2052
2168
 
2053
- export { ACADEMIC_YEAR_SERVICE_TOKEN, APP_STATE_SERVICE_TOKEN, AUTH_SERVICE_TOKEN, CLASS_PROGRAM_MASTER_SERVICE_TOKEN, COUNTRY_SERVICE_TOKEN, CURRENCY_SERVICE_TOKEN, CideCoreGeneralMasterTypeService, CideSharedOrgStructureComponent, CideSharedProgramSectionSelectorComponent, CloudIdeShared, EDUCATION_BOARD_SERVICE_TOKEN, ENTITY_SERVICE_TOKEN, FEE_DETAILS_VIEWER_COMPONENT_TOKEN, FEE_PAYMENT_SERVICE_TOKEN, FEE_STRUCTURE_SERVICE_TOKEN, FINANCIAL_YEAR_SERVICE_TOKEN, FeeDetailsViewerWrapperComponent, GENERAL_MASTER_SERVICE_TOKEN, NATIONALITY_SERVICE_TOKEN, PIN_CODE_SERVICE_TOKEN, PROGRAM_SECTION_SELECTOR_COMPONENT_TOKEN, PROGRAM_TERM_SECTION_SERVICE_TOKEN, ProgramSectionSelectorWrapperComponent, SharedObjectIdService, USER_SERVICE_TOKEN, authGuard };
2169
+ export { ACADEMIC_YEAR_SERVICE_TOKEN, APP_STATE_SERVICE_TOKEN, AUTH_SERVICE_TOKEN, CLASS_PROGRAM_MASTER_SERVICE_TOKEN, COUNTRY_SERVICE_TOKEN, CURRENCY_SERVICE_TOKEN, CideCoreGeneralMasterTypeService, CideSharedOrgStructureComponent, CideSharedProgramSectionSelectorComponent, CloudIdeShared, EDUCATION_BOARD_SERVICE_TOKEN, ENTITY_SERVICE_TOKEN, FEE_APPLICABLE_FEES_COMPONENT_TOKEN, FEE_DETAILS_VIEWER_COMPONENT_TOKEN, FEE_PAYMENT_SERVICE_TOKEN, FEE_STRUCTURE_SERVICE_TOKEN, FINANCIAL_YEAR_SERVICE_TOKEN, FeeApplicableFeesWrapperComponent, FeeDetailsViewerWrapperComponent, GENERAL_MASTER_SERVICE_TOKEN, NATIONALITY_SERVICE_TOKEN, PIN_CODE_SERVICE_TOKEN, PROGRAM_SECTION_SELECTOR_COMPONENT_TOKEN, PROGRAM_TERM_SECTION_SERVICE_TOKEN, ProgramSectionSelectorWrapperComponent, SharedObjectIdService, USER_SERVICE_TOKEN, authGuard };
2054
2170
  //# sourceMappingURL=cloud-ide-shared.mjs.map