@softheon/armature 19.18.1 → 19.19.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.
@@ -72,6 +72,7 @@ import * as i4$1 from '@angular/cdk/drag-drop';
72
72
  import { moveItemInArray, CdkDropList, CdkDrag, CdkDragPlaceholder, CdkDragHandle } from '@angular/cdk/drag-drop';
73
73
  import { MatPaginator } from '@angular/material/paginator';
74
74
  import { trigger, state, transition, style, animate } from '@angular/animations';
75
+ import * as i1$a from 'ngx-cookie-service';
75
76
  import { MAT_BOTTOM_SHEET_DATA, MatBottomSheetRef, MatBottomSheetModule } from '@angular/material/bottom-sheet';
76
77
  import moment from 'moment';
77
78
  import { LiveAnnouncer } from '@angular/cdk/a11y';
@@ -6603,6 +6604,331 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImpor
6603
6604
  }]
6604
6605
  }], ctorParameters: () => [{ type: UserEntityService }] });
6605
6606
 
6607
+ /** Selected Market Context */
6608
+ class SelectedMarketContext {
6609
+ constructor() {
6610
+ /* Selected Market Subject */
6611
+ this.selectedMarketSubject = new BehaviorSubject(null);
6612
+ /* Selected Market Observable */
6613
+ this.selectedMarket$ = this.selectedMarketSubject.asObservable();
6614
+ /** Ephemeral Market Subject */
6615
+ this.ephemeralMarketSubject = new BehaviorSubject(null);
6616
+ /** Ephemeral Market Observable */
6617
+ this.ephemeralMarket$ = this.ephemeralMarketSubject.asObservable();
6618
+ /* Selected Market */
6619
+ this.selectedMarket = null;
6620
+ }
6621
+ /** Set the selected market */
6622
+ setMarket(marketSelection) {
6623
+ this.selectedMarket = marketSelection;
6624
+ this.selectedMarketSubject.next(marketSelection);
6625
+ }
6626
+ /** Get the selected market */
6627
+ getSelectedMarket() {
6628
+ return this.selectedMarket;
6629
+ }
6630
+ /** Set the ephemeral market */
6631
+ setEphemeralMarket(marketSelection) {
6632
+ this.ephemeralMarketSubject.next(marketSelection);
6633
+ }
6634
+ /** Get the ephemeral market */
6635
+ getEphemeralMarket() {
6636
+ return this.ephemeralMarketSubject.value;
6637
+ }
6638
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: SelectedMarketContext, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
6639
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: SelectedMarketContext, providedIn: 'root' }); }
6640
+ }
6641
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: SelectedMarketContext, decorators: [{
6642
+ type: Injectable,
6643
+ args: [{
6644
+ providedIn: 'root'
6645
+ }]
6646
+ }] });
6647
+
6648
+ /** Market Selection Service */
6649
+ class MarketSelectionService {
6650
+ /** Whether or not if market selection is enabled */
6651
+ get isEnabled() {
6652
+ return !!this.config?.config?.marketSelectionConfig;
6653
+ }
6654
+ /**
6655
+ * Constructor
6656
+ * @param cookieService cookie service
6657
+ * @param router router
6658
+ * @param config config
6659
+ * @param selectedMarketContext selected market context
6660
+ * @param translateService translate service
6661
+ */
6662
+ constructor(cookieService, router, config, selectedMarketContext, translateService) {
6663
+ this.cookieService = cookieService;
6664
+ this.router = router;
6665
+ this.config = config;
6666
+ this.selectedMarketContext = selectedMarketContext;
6667
+ this.translateService = translateService;
6668
+ /** The MFE Queue Lookup Constant Key for Cookie Storage */
6669
+ this.MFE_QUEUE_LOOKUP = 'mfe.graphql-domain';
6670
+ /* Open Modal Subject */
6671
+ this.modalOpenSubject = new BehaviorSubject(false);
6672
+ /* Disabled Dropdown Subject */
6673
+ this.disabledDropdownSubject = new BehaviorSubject(false);
6674
+ /* Modal Open Observable */
6675
+ this.modalOpen$ = this.modalOpenSubject.asObservable();
6676
+ /* Selected Market Observable */
6677
+ this.selectedMarket$ = of(null);
6678
+ /** Ephemeral Market Observable */
6679
+ this.ephemeralMarket$ = of(null);
6680
+ /* Disabled Dropdown Observable */
6681
+ this.disabledDropdown$ = this.disabledDropdownSubject.asObservable();
6682
+ /* Favorite Market */
6683
+ this.favoriteMarket = [];
6684
+ /** Disabled URLs */
6685
+ this.disabledUrls = [];
6686
+ /** Markets With API URL */
6687
+ this.markets = [];
6688
+ this.selectedMarket$ = this.selectedMarketContext.selectedMarket$;
6689
+ this.ephemeralMarket$ = this.selectedMarketContext.ephemeralMarket$;
6690
+ this.router.events.subscribe((event) => {
6691
+ if (event instanceof NavigationEnd) {
6692
+ this.disabledDropdownSubject.next(this.isUrlDisabled(event.urlAfterRedirects));
6693
+ }
6694
+ });
6695
+ this.config?.config$?.subscribe((config) => {
6696
+ if (config && this.isEnabled) {
6697
+ this.initializeConfig();
6698
+ this.disabledDropdownSubject.next(this.isUrlDisabled(router.url));
6699
+ }
6700
+ });
6701
+ }
6702
+ /** Get Member Market */
6703
+ getMemberMarket(marketName) {
6704
+ return this.markets.find(m => m.name == marketName);
6705
+ }
6706
+ /** get selected market translated */
6707
+ getMarketTranslated(market) {
6708
+ return this.translateService.instant(`market-selection.markets.${this.textToKebabCase(market)}`);
6709
+ }
6710
+ /**
6711
+ * Update Market Selection
6712
+ * @param selection
6713
+ */
6714
+ updateSelectedMarket(selection) {
6715
+ this.cookieService.deleteAll('/');
6716
+ this.cookieService.set('selectedMarket', JSON.stringify({
6717
+ name: selection.name
6718
+ }));
6719
+ const domainUrl = this.resolveOrigin(selection?.apiUrl);
6720
+ if (!!domainUrl) {
6721
+ window.sessionStorage.setItem(this.MFE_QUEUE_LOOKUP, domainUrl);
6722
+ }
6723
+ else {
6724
+ window.sessionStorage.removeItem(this.MFE_QUEUE_LOOKUP);
6725
+ }
6726
+ document.dispatchEvent(new CustomEvent('close-entity-view', {
6727
+ detail: {
6728
+ guid: 'all'
6729
+ }
6730
+ }));
6731
+ document.dispatchEvent(new CustomEvent('refresh-queues'));
6732
+ document.dispatchEvent(new CustomEvent('refresh-table'));
6733
+ this.selectedMarketContext.setMarket(selection);
6734
+ }
6735
+ /**
6736
+ * Set Ephemeral Market
6737
+ * For setting the market on a single page so that it won't apply to the entire website
6738
+ * @param market
6739
+ */
6740
+ setEphemeralMarket(market) {
6741
+ this.selectedMarketContext.setEphemeralMarket(market);
6742
+ }
6743
+ /**
6744
+ * Get Ephemeral Market
6745
+ * @returns
6746
+ */
6747
+ getEphemeralMarket() {
6748
+ return this.selectedMarketContext.getEphemeralMarket();
6749
+ }
6750
+ /**
6751
+ * Initialize Config
6752
+ */
6753
+ initializeConfig() {
6754
+ const configMarkets = this.config?.config?.marketSelectionConfig?.marketSelections || [];
6755
+ this.markets = configMarkets;
6756
+ this.disabledUrls = this.config?.config?.marketSelectionConfig?.disabledUrls || [];
6757
+ this.loadFavoriteMarketsFromCookies();
6758
+ this.loadMarketFromCookies();
6759
+ }
6760
+ /**
6761
+ * Get API URL For Market
6762
+ * @param marketName
6763
+ * @returns
6764
+ */
6765
+ getApiUrlForMarket(marketName) {
6766
+ const found = this.markets.find(m => m.name === marketName);
6767
+ return found?.apiUrl;
6768
+ }
6769
+ /**
6770
+ * Get Markets
6771
+ * @returns
6772
+ */
6773
+ getMarkets() {
6774
+ return this.markets;
6775
+ }
6776
+ /**
6777
+ * Get Favorite Markets
6778
+ * @returns
6779
+ */
6780
+ getFavoriteMarkets() {
6781
+ return this.favoriteMarket;
6782
+ }
6783
+ /**
6784
+ * Toggle Favorite Market
6785
+ * @param market
6786
+ */
6787
+ toggleFavoriteMarket(market) {
6788
+ const index = this.favoriteMarket.findIndex((s) => s.name === market.name);
6789
+ if (index >= 0) {
6790
+ this.favoriteMarket.splice(index, 1);
6791
+ }
6792
+ else {
6793
+ this.favoriteMarket.push(market);
6794
+ }
6795
+ this.saveFavoriteMarketsToCookies();
6796
+ }
6797
+ /**
6798
+ * Is favorite market
6799
+ * @param market
6800
+ * @returns
6801
+ */
6802
+ isFavoriteMarket(market) {
6803
+ return this.favoriteMarket.some((s) => s.name === market.name);
6804
+ }
6805
+ /**
6806
+ * Get Selected Market
6807
+ * @returns
6808
+ */
6809
+ getSelectedMarket() {
6810
+ return this.selectedMarketContext.getSelectedMarket();
6811
+ }
6812
+ /**
6813
+ * Open Modal
6814
+ */
6815
+ openModal() {
6816
+ this.modalOpenSubject.next(true);
6817
+ }
6818
+ /**
6819
+ * Close Modal
6820
+ */
6821
+ closeModal() {
6822
+ this.modalOpenSubject.next(false);
6823
+ }
6824
+ /**
6825
+ * Load Favorite Markets from Cookies
6826
+ */
6827
+ loadFavoriteMarketsFromCookies() {
6828
+ const favoritesJson = this.cookieService.get('favoriteMarket');
6829
+ if (favoritesJson) {
6830
+ this.favoriteMarket = JSON.parse(favoritesJson);
6831
+ }
6832
+ }
6833
+ /**
6834
+ * Load Market from Cookies
6835
+ */
6836
+ loadMarketFromCookies() {
6837
+ const selectedJson = this.cookieService.get('selectedMarket');
6838
+ if (selectedJson) {
6839
+ const selectedMarket = JSON.parse(selectedJson);
6840
+ const market = this.markets.find(m => m.name == selectedMarket.name) || selectedMarket;
6841
+ this.updateSelectedMarket(market);
6842
+ }
6843
+ else {
6844
+ // if no currently selected market, select the first market available in the config
6845
+ const firstMarket = this.markets[0];
6846
+ this.updateSelectedMarket(firstMarket);
6847
+ }
6848
+ }
6849
+ /**
6850
+ * Is URL Disabled
6851
+ * @param currentUrl
6852
+ * @returns
6853
+ */
6854
+ isUrlDisabled(currentUrl) {
6855
+ const parser = document.createElement('a');
6856
+ parser.href = currentUrl;
6857
+ const path = parser.pathname;
6858
+ for (const disabled of this.disabledUrls) {
6859
+ if (path.startsWith(disabled)) {
6860
+ return true;
6861
+ }
6862
+ }
6863
+ return false;
6864
+ }
6865
+ /**
6866
+ * Save Favorite Market Selections to Cookies
6867
+ */
6868
+ saveFavoriteMarketsToCookies() {
6869
+ const favoriteMarkets = this.favoriteMarket.map(m => ({ name: m.name }));
6870
+ this.cookieService.set('favoriteMarket', JSON.stringify(favoriteMarkets));
6871
+ }
6872
+ /**
6873
+ * Get the base site URL using ephemeral or selected market, or default if none
6874
+ */
6875
+ getBaseUrl() {
6876
+ const ephemeral = this.getEphemeralMarket();
6877
+ const market = ephemeral?.name ? ephemeral : this.getSelectedMarket();
6878
+ if (market?.name) {
6879
+ const apiUrl = market.apiUrl ?? this.getApiUrlForMarket(market.name);
6880
+ if (apiUrl) {
6881
+ return apiUrl;
6882
+ }
6883
+ }
6884
+ return '';
6885
+ }
6886
+ /** Text To Kebab-case */
6887
+ textToKebabCase(textString) {
6888
+ if (!textString) {
6889
+ return textString;
6890
+ }
6891
+ textString = textString.toString();
6892
+ return textString.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g).join('-').toLowerCase();
6893
+ }
6894
+ /**
6895
+ * Resolve domain url
6896
+ * @param link link
6897
+ * @returns domain url
6898
+ */
6899
+ resolveOrigin(link) {
6900
+ if (!link) {
6901
+ return link;
6902
+ }
6903
+ try {
6904
+ const url = new URL(link);
6905
+ return url.origin;
6906
+ }
6907
+ catch (ex) {
6908
+ console.error(`Error in setting api url into session: ${ex}`);
6909
+ return undefined;
6910
+ }
6911
+ }
6912
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: MarketSelectionService, deps: [{ token: i1$a.CookieService }, { token: i1$4.Router }, { token: BaseConfigService }, { token: SelectedMarketContext }, { token: i2$1.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
6913
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: MarketSelectionService, providedIn: 'root' }); }
6914
+ }
6915
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: MarketSelectionService, decorators: [{
6916
+ type: Injectable,
6917
+ args: [{
6918
+ providedIn: 'root'
6919
+ }]
6920
+ }], ctorParameters: () => [{ type: i1$a.CookieService }, { type: i1$4.Router }, { type: BaseConfigService }, { type: SelectedMarketContext }, { type: i2$1.TranslateService }] });
6921
+
6922
+ /* Market Selection Config */
6923
+ class MarketSelectionConfig {
6924
+ constructor() {
6925
+ /* Market Selections */
6926
+ this.marketSelections = [];
6927
+ /* Disabled URLs, if the selector should be disabled */
6928
+ this.disabledUrls = [];
6929
+ }
6930
+ }
6931
+
6606
6932
  /** The data store configurations */
6607
6933
  class DataStoreConfig {
6608
6934
  }
@@ -10574,5 +10900,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImpor
10574
10900
  * Generated bundle index. Do not edit.
10575
10901
  */
10576
10902
 
10577
- export { ALERT_BANNER_CONFIG, AbstractSamlEntryService, AbstractSamlService, AbstractStartupService, AccessTokenClaims, AlertBannerComponent, AlertBannerModule, AlertBannerService, AlertService, AlphaNumericDirective, AppTemplateComponent, ApplicationUserModel, ArRoleNavService, ArmError, ArmatureFooterComponent, ArmatureFooterModule, ArmatureHeaderComponent, ArmatureHeaderModule, ArmatureModule, ArmatureNavigationComponent, ArmatureResizePanelsModule, Attribute, AuthorizationService, B2bNavComponent, BannerService, BannerType, BaseComponentModule, BaseConfigService, CacheExpirationType, ComponentSavePrintComponent, ComponentSavePrintService, Configuration, ConfirmAddressData, CoverageDetail, CssOverride, CssOverrideDirective, CustomAuthConfigService, DISABLE_ACCESS_FOR_NO_PAGES_ROLE, DISTRIBUTED_CACHE_BASE_PATH, DataStoreConfig, DateInputFilterDirective, DecodedAccessToken, DefaultConfigService, DialogResult, DistributedCacheModule, ENTITY_SESSION_STORAGE_PREFIX, ENTITY_SS_CONFIG_PREFIX, EntityBaseComponent, EntityHelperService, EntityInjectWrapperComponent, FAQ, FAQConfig, FEDERATED_MODULE_ID, FaqComponent, FaqModule, FeedbackToolComponent, FeedbackToolModule, FooterConfig, FormsModule, HYBRID_SAML_OAUTH_CONFIG, HeaderAuthSettings, HybridSamlOAuthConfig, HybridSamlOauthService, InputTrimDirective, LINE_OF_COVERAGE, LettersCharactersDirective, LettersOnlyDirective, MfeModule, MobileHeaderMenuComponent, ModalData, NavigationModule, NumbersOnlyDirective, Oauth2RoleService, OauthModule, PhoneFormatPipe, PolicyPerson, RBAC_CONFIG, RbacActionDirective, RbacConfig, RbacModule, RedirectSamlComponent, RedirectSamlRequest, RedirectSessionConfigs, ResizePanelsComponent, RoleAccess, RoleNavService, RoutePath, RumConfig, RumModule, RumService, SESSION_CONFIG, SOF_BLANK_LANGUAGE_OVERRIDE, SOF_DATE_PIPE_FORMATS, STATUS, SamlModule, SamlService, ServerCacheService, SessionConfig, SessionService, SharedErrorService, SiteMapComponent, SiteMapDirection, SnackbarService, SofAddressComponent, SofAlertComponent, SofArComponentSavePrintModule, SofBadgeComponent, SofBannerComponent, SofBlankPipe, SofBottomSheetComponent, SofBreadcrumbsHierarchyComponent, SofBreadcrumbsHistoryComponent, SofButtonToggleGroupComponent, SofCalloutComponent, SofChipComponent, SofCompareAddressPipe, SofConfirmAddressComponent, SofConfirmAddressCountyChangeComponent, SofContextComponent, SofDatePipe, SofDropdownButtonComponent, SofErrorCommonComponent, SofHandleComponent, SofHeaderComponent, SofImageCheckboxComponent, SofInputStepperComponent, SofModalComponent, SofNavPanelComponent, SofPipeModule, SofProgressBarComponent, SofRadioCardComponent, SofSegmentedControlComponent, SofSelectComponent, SofSimpleAlertComponent, SofSnackbarComponent, SofSsnPipe, SofStarRatingComponent, SofSubNavigationComponent, SofTabsComponent, SofUtilityButtonComponent, SoftheonErrorHandlerService, SsoGatewayEntryService, SsoGatewayModel, States, TextOverflowEllipsisTooltipDirective, ThemeModule, ThemeService, TypedSession, USER_ENTITY_SERVICE_CONFIG, UserEntityService, UserEntityServiceConfig, ValidationKeys, WINDOW, httpVerb, initializerFactory, keyPathPrefix, languageStorageKey, newGuid, pascalToCamel, preSignInRouteStorageKey, removeMenuRole, routeToPreLoginRoute, sessionBasePathFactory, userInitialsPipe };
10903
+ export { ALERT_BANNER_CONFIG, AbstractSamlEntryService, AbstractSamlService, AbstractStartupService, AccessTokenClaims, AlertBannerComponent, AlertBannerModule, AlertBannerService, AlertService, AlphaNumericDirective, AppTemplateComponent, ApplicationUserModel, ArRoleNavService, ArmError, ArmatureFooterComponent, ArmatureFooterModule, ArmatureHeaderComponent, ArmatureHeaderModule, ArmatureModule, ArmatureNavigationComponent, ArmatureResizePanelsModule, Attribute, AuthorizationService, B2bNavComponent, BannerService, BannerType, BaseComponentModule, BaseConfigService, CacheExpirationType, ComponentSavePrintComponent, ComponentSavePrintService, Configuration, ConfirmAddressData, CoverageDetail, CssOverride, CssOverrideDirective, CustomAuthConfigService, DISABLE_ACCESS_FOR_NO_PAGES_ROLE, DISTRIBUTED_CACHE_BASE_PATH, DataStoreConfig, DateInputFilterDirective, DecodedAccessToken, DefaultConfigService, DialogResult, DistributedCacheModule, ENTITY_SESSION_STORAGE_PREFIX, ENTITY_SS_CONFIG_PREFIX, EntityBaseComponent, EntityHelperService, EntityInjectWrapperComponent, FAQ, FAQConfig, FEDERATED_MODULE_ID, FaqComponent, FaqModule, FeedbackToolComponent, FeedbackToolModule, FooterConfig, FormsModule, HYBRID_SAML_OAUTH_CONFIG, HeaderAuthSettings, HybridSamlOAuthConfig, HybridSamlOauthService, InputTrimDirective, LINE_OF_COVERAGE, LettersCharactersDirective, LettersOnlyDirective, MarketSelectionConfig, MarketSelectionService, MfeModule, MobileHeaderMenuComponent, ModalData, NavigationModule, NumbersOnlyDirective, Oauth2RoleService, OauthModule, PhoneFormatPipe, PolicyPerson, RBAC_CONFIG, RbacActionDirective, RbacConfig, RbacModule, RedirectSamlComponent, RedirectSamlRequest, RedirectSessionConfigs, ResizePanelsComponent, RoleAccess, RoleNavService, RoutePath, RumConfig, RumModule, RumService, SESSION_CONFIG, SOF_BLANK_LANGUAGE_OVERRIDE, SOF_DATE_PIPE_FORMATS, STATUS, SamlModule, SamlService, SelectedMarketContext, ServerCacheService, SessionConfig, SessionService, SharedErrorService, SiteMapComponent, SiteMapDirection, SnackbarService, SofAddressComponent, SofAlertComponent, SofArComponentSavePrintModule, SofBadgeComponent, SofBannerComponent, SofBlankPipe, SofBottomSheetComponent, SofBreadcrumbsHierarchyComponent, SofBreadcrumbsHistoryComponent, SofButtonToggleGroupComponent, SofCalloutComponent, SofChipComponent, SofCompareAddressPipe, SofConfirmAddressComponent, SofConfirmAddressCountyChangeComponent, SofContextComponent, SofDatePipe, SofDropdownButtonComponent, SofErrorCommonComponent, SofHandleComponent, SofHeaderComponent, SofImageCheckboxComponent, SofInputStepperComponent, SofModalComponent, SofNavPanelComponent, SofPipeModule, SofProgressBarComponent, SofRadioCardComponent, SofSegmentedControlComponent, SofSelectComponent, SofSimpleAlertComponent, SofSnackbarComponent, SofSsnPipe, SofStarRatingComponent, SofSubNavigationComponent, SofTabsComponent, SofUtilityButtonComponent, SoftheonErrorHandlerService, SsoGatewayEntryService, SsoGatewayModel, States, TextOverflowEllipsisTooltipDirective, ThemeModule, ThemeService, TypedSession, USER_ENTITY_SERVICE_CONFIG, UserEntityService, UserEntityServiceConfig, ValidationKeys, WINDOW, httpVerb, initializerFactory, keyPathPrefix, languageStorageKey, newGuid, pascalToCamel, preSignInRouteStorageKey, removeMenuRole, routeToPreLoginRoute, sessionBasePathFactory, userInitialsPipe };
10578
10904
  //# sourceMappingURL=softheon-armature.mjs.map