@indigina/ui-kit 1.1.266 → 1.1.267

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.
@@ -9119,6 +9119,136 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImpor
9119
9119
  ], template: "<div class=\"kit-status-label\"\n [ngClass]=\"[color(), size()]\">\n <kit-truncate-text><ng-content></ng-content></kit-truncate-text>\n</div>\n", styles: [".kit-status-label{display:inline-flex;align-items:center;justify-content:center;padding:0 8px;font-weight:500;border-width:1px;border-style:solid;border-radius:4px;line-height:1}.kit-status-label.small{height:20px;font-size:12px}.kit-status-label.large{height:28px;font-size:16px}.kit-status-label.white{color:var(--ui-kit-color-grey-14);border-color:var(--ui-kit-color-grey-12);background:var(--ui-kit-color-white)}.kit-status-label.purple{color:var(--ui-kit-color-purple);border-color:var(--ui-kit-color-purple);background:var(--ui-kit-color-purple-1)}.kit-status-label.teal{color:var(--ui-kit-color-teal);border-color:var(--ui-kit-color-teal);background:var(--ui-kit-color-teal-1)}.kit-status-label.grey{color:var(--ui-kit-color-grey-10);border-color:var(--ui-kit-color-grey-14);background:var(--ui-kit-color-grey-16)}.kit-status-label.orange{color:var(--ui-kit-color-orange);border-color:var(--ui-kit-color-orange);background:var(--ui-kit-color-orange-3)}.kit-status-label.green{color:var(--ui-kit-color-green-1);border-color:var(--ui-kit-color-green-1);background-color:var(--ui-kit-color-green-4)}.kit-status-label.blue{color:var(--ui-kit-color-blue);border-color:var(--ui-kit-color-blue);background:var(--ui-kit-color-blue-1)}.kit-status-label.pink{color:var(--ui-kit-color-pink);border-color:var(--ui-kit-color-pink);background:var(--ui-kit-color-pink-1)}.kit-status-label.red{color:var(--ui-kit-color-red-4);border-color:var(--ui-kit-color-red-4);background:var(--ui-kit-color-red-3)}\n"] }]
9120
9120
  }] });
9121
9121
 
9122
+ class FetchUserIdentities {
9123
+ static { this.type = '[UserIdentities] Fetch'; }
9124
+ }
9125
+ class SetUserIdentity extends AbstractPayloadAction {
9126
+ static { this.type = '[UserIdentity] Set'; }
9127
+ }
9128
+
9129
+ class KitUserIdentitiesApiService {
9130
+ constructor() {
9131
+ this.httpClient = inject(HttpClient);
9132
+ this.basePath = inject(KIT_BASE_PATH);
9133
+ }
9134
+ getUserIdentities() {
9135
+ const url = `${this.basePath}/users/me/identities`;
9136
+ return this.httpClient.get(url);
9137
+ }
9138
+ setCurrentIdentity(id) {
9139
+ const url = `${this.basePath}/users/me/identities/current`;
9140
+ return this.httpClient.put(url, { id });
9141
+ }
9142
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: KitUserIdentitiesApiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
9143
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: KitUserIdentitiesApiService, providedIn: 'root' }); }
9144
+ }
9145
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: KitUserIdentitiesApiService, decorators: [{
9146
+ type: Injectable,
9147
+ args: [{
9148
+ providedIn: 'root',
9149
+ }]
9150
+ }] });
9151
+
9152
+ const KIT_USER_IDENTITIES_STATE_TOKEN = new StateToken('userIdentities');
9153
+ let KitUserIdentitiesState = class KitUserIdentitiesState {
9154
+ constructor() {
9155
+ this.kitUserIdentitiesApiService = inject(KitUserIdentitiesApiService);
9156
+ }
9157
+ fetchUserApplications(ctx) {
9158
+ return this.kitUserIdentitiesApiService.getUserIdentities().pipe(tap(userIdentities => ctx.setState(userIdentities)));
9159
+ }
9160
+ setUserIdentity(ctx, action) {
9161
+ return this.kitUserIdentitiesApiService.setCurrentIdentity(action.payload);
9162
+ }
9163
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: KitUserIdentitiesState, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
9164
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: KitUserIdentitiesState }); }
9165
+ };
9166
+ __decorate([
9167
+ Action(FetchUserIdentities)
9168
+ ], KitUserIdentitiesState.prototype, "fetchUserApplications", null);
9169
+ __decorate([
9170
+ Action(SetUserIdentity)
9171
+ ], KitUserIdentitiesState.prototype, "setUserIdentity", null);
9172
+ KitUserIdentitiesState = __decorate([
9173
+ State({
9174
+ name: KIT_USER_IDENTITIES_STATE_TOKEN,
9175
+ defaults: {
9176
+ data: [],
9177
+ total: 0,
9178
+ },
9179
+ })
9180
+ ], KitUserIdentitiesState);
9181
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: KitUserIdentitiesState, decorators: [{
9182
+ type: Injectable
9183
+ }], propDecorators: { fetchUserApplications: [], setUserIdentity: [] } });
9184
+
9185
+ const WINDOW = new InjectionToken('A global window object', {
9186
+ factory: () => window,
9187
+ });
9188
+
9189
+ class KitUserIdentitiesSelector {
9190
+ constructor() {
9191
+ this.store = inject(Store);
9192
+ this.router = inject(Router);
9193
+ this.window = inject(WINDOW);
9194
+ this.userIdentities = this.store.selectSignal(KIT_USER_IDENTITIES_STATE_TOKEN);
9195
+ this.userIdentitiesDropdownItems = computed(() => this.userIdentities().data.map(item => ({
9196
+ text: item.alias,
9197
+ value: item.id,
9198
+ data: item,
9199
+ })), ...(ngDevMode ? [{ debugName: "userIdentitiesDropdownItems" }] : []));
9200
+ this.user = this.store.selectSignal(KIT_USER_STATE_TOKEN);
9201
+ this.currentIdentity = computed(() => this.userIdentities().data.find(item => item.id === this.user().data?.identityId) ?? null, ...(ngDevMode ? [{ debugName: "currentIdentity" }] : []));
9202
+ this.currentIdentityDropdownItem = computed(() => this.userIdentitiesDropdownItems()?.find(item => item.value === this.currentIdentity()?.id) ?? null, ...(ngDevMode ? [{ debugName: "currentIdentityDropdownItem" }] : []));
9203
+ }
9204
+ ngOnInit() {
9205
+ this.fetchUserIdentities();
9206
+ }
9207
+ onIdentitySelect(item) {
9208
+ const currentIdentityId = this.currentIdentity()?.id;
9209
+ if (!currentIdentityId) {
9210
+ return;
9211
+ }
9212
+ this.store.dispatch(new SetUserIdentity(item.value)).subscribe(() => {
9213
+ if (this.user().data?.type !== item.data?.type) {
9214
+ this.window.location.href = '/';
9215
+ return;
9216
+ }
9217
+ this.router.navigate([], { fragment: '' }).then(() => {
9218
+ this.window.location.reload();
9219
+ });
9220
+ });
9221
+ }
9222
+ fetchUserIdentities() {
9223
+ this.store.dispatch(new FetchUserIdentities());
9224
+ }
9225
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: KitUserIdentitiesSelector, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9226
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: KitUserIdentitiesSelector, isStandalone: true, selector: "kit-user-identities-selector", ngImport: i0, template: "@if (userIdentities().data.length > 1) {\n <div class=\"kit-user-identities-selector\">\n <kit-dropdown [items]=\"userIdentitiesDropdownItems()\"\n [selectedItem]=\"currentIdentityDropdownItem()?.value\"\n (selected)=\"onIdentitySelect($event)\"\n ></kit-dropdown>\n </div>\n}\n", styles: [".kit-user-identities-selector{width:250px}\n"], dependencies: [{ kind: "component", type: KitDropdownComponent, selector: "kit-dropdown", inputs: ["items", "selectedItem", "label", "disabled", "messageIcon", "messageText", "invalid", "defaultItem", "listHeight", "hideDefaultItem", "toggleIcon", "popupSettings", "isValuePrimitive", "footerTemplate", "noDataTemplate", "size"], outputs: ["selected"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
9227
+ }
9228
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: KitUserIdentitiesSelector, decorators: [{
9229
+ type: Component,
9230
+ args: [{ selector: 'kit-user-identities-selector', imports: [
9231
+ KitDropdownComponent,
9232
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (userIdentities().data.length > 1) {\n <div class=\"kit-user-identities-selector\">\n <kit-dropdown [items]=\"userIdentitiesDropdownItems()\"\n [selectedItem]=\"currentIdentityDropdownItem()?.value\"\n (selected)=\"onIdentitySelect($event)\"\n ></kit-dropdown>\n </div>\n}\n", styles: [".kit-user-identities-selector{width:250px}\n"] }]
9233
+ }] });
9234
+
9235
+ class KitUserIdentitiesInterceptor {
9236
+ constructor() {
9237
+ this.store = inject(Store);
9238
+ }
9239
+ intercept(req, next) {
9240
+ const user = this.store.selectSignal(KIT_USER_STATE_TOKEN);
9241
+ if (!user().data?.identityId) {
9242
+ return next.handle(req);
9243
+ }
9244
+ return next.handle(req.clone({
9245
+ setHeaders: {
9246
+ 'X-Identity-Id': `${user().data?.identityId}`,
9247
+ },
9248
+ }));
9249
+ }
9250
+ }
9251
+
9122
9252
  class KitCardDetailsComponent {
9123
9253
  constructor() {
9124
9254
  this.router = inject(Router);
@@ -9266,5 +9396,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImpor
9266
9396
  * Generated bundle index. Do not edit.
9267
9397
  */
9268
9398
 
9269
- export { AbstractKitCtaPanelConfirmationComponent, AddGridFilter, FetchUser, FetchUserPermissions, FetchUserSettings, HighlightPipe, KIT_BASE_PATH, KIT_DATETIME_FORMAT_LONG, KIT_DATE_FORMAT, KIT_GRID_CELL_DATE_FORMAT_CONFIG, KIT_GRID_STATE_TOKEN, KIT_USER_APPLICATIONS_PATH, KIT_USER_PATH, KIT_USER_PERMISSIONS_PATH, KIT_USER_PERMISSIONS_STATE_TOKEN, KIT_USER_STATE_TOKEN, KitAutocompleteComponent, KitAutocompleteDirective, KitAvatarComponent, KitAvatarSize, KitBadgeDirective, KitBadgeTheme, KitBreadcrumbsComponent, KitBreadcrumbsService, KitButtonComponent, KitButtonIconPosition, KitButtonKind, KitButtonState, KitButtonType, KitCardComponent, KitCardDetailsComponent, KitCardTheme, KitCheckboxComponent, KitCheckboxState, KitCollapsedListComponent, KitCollapsedListDropdownAlign, KitCopyTextComponent, KitCtaPanelAbstractConfirmationComponent, KitCtaPanelActionComponent, KitCtaPanelConfirmationComponent, KitCtaPanelItemComponent, KitCtaPanelItemType, KitDataFieldComponent, KitDataFieldState, KitDatepickerComponent, KitDatepickerSize, KitDaterangeComponent, KitDaterangeType, KitDatetimepickerComponent, KitDialogActionsComponent, KitDialogComponent, KitDialogService, KitDialogTitlebarComponent, KitDialogType, KitDropdownComponent, KitDropdownItemTemplateDirective, KitDropdownSize, KitEmptySectionComponent, KitEntityGridComponent, KitEntitySectionComponent, KitEntitySectionContainerComponent, KitEntityTitleComponent, KitFileCardComponent, KitFileCardMessagesComponent, KitFileUploadComponent, KitFilterCheckboxComponent, KitFilterLogic, KitFilterOperator, KitFilterType, KitGlobalSearchComponent, KitGridCellComponent, KitGridCellService, KitGridCellTemplateDirective, KitGridColumnComponent, KitGridColumnManagerComponent, KitGridComponent, KitGridDetailTemplateDirective, KitGridDetailsButtonComponent, KitGridExportComponent, KitGridFiltersComponent, KitGridSearchComponent, KitGridSortSettingsMode, KitGridState, KitGridUrlStateService, KitGridViewType, KitGridViewsComponent, KitGridViewsState, KitInputLabelComponent, KitInputMessageComponent, KitLoaderComponent, KitLocationStepperComponent, KitMobileHeaderComponent, KitMobileMenuComponent, KitMobileMenuState, KitMultiselectComponent, KitNavigationMenuComponent, KitNavigationMenuService, KitNavigationMenuSubmenuComponent, KitNavigationTabsComponent, KitNavigationTabsType, KitNoteComponent, KitNotificationComponent, KitNotificationService, KitNotificationType, KitNumericTextboxComponent, KitNumericTextboxSize, KitNumericTextboxState, KitOptionToggleComponent, KitPageLayoutComponent, KitPermissionDirective, KitPillComponent, KitPillTheme, KitPillType, KitPopupAlignHorizontal, KitPopupAlignVertical, KitPopupComponent, KitPopupPositionMode, KitProfileMenuComponent, KitQueryParamsName, KitQueryParamsService, KitRadioButtonComponent, KitRadioButtonType, KitRoutePathComponent, KitSchedulerComponent, KitSchedulerMonthEventTemplateDirective, KitSchedulerWeekEventTemplateDirective, KitScrollNavigationComponent, KitScrollNavigationSectionComponent, KitSearchBarComponent, KitSidebarComponent, KitSkeletonAnimation, KitSkeletonComponent, KitSkeletonShape, KitSortDirection, KitSortableComponent, KitStatusLabelColor, KitStatusLabelComponent, KitStatusLabelSize, KitSvgIcon, KitSvgIconComponent, KitSvgIconType, KitSvgSpriteComponent, KitSwitchComponent, KitSwitchMode, KitSwitchState, KitTabComponent, KitTabContentDirective, KitTabsComponent, KitTabsSize, KitTabsType, KitTextLabelComponent, KitTextLabelState, KitTextareaAutoresizeDirective, KitTextareaComponent, KitTextareaState, KitTextboxComponent, KitTextboxSize, KitTextboxState, KitThemeService, KitThemes, KitTileLayoutComponent, KitTileLayoutItemComponent, KitTimelineCardComponent, KitTimelineComponent, KitTimelineTheme, KitTimelineType, KitTimepickerComponent, KitTitleTemplateDirective, KitToastrModule, KitToastrPosition, KitToastrService, KitToastrType, KitToggleComponent, KitToggleSize, KitTooltipDirective, KitTooltipPosition, KitTopBarComponent, KitTrackingCardComponent, KitTrackingTimelineComponent, KitTranslateLoader, KitTranslateService, KitTruncateTextComponent, KitUnitsTextboxComponent, KitUnitsTextboxDropdownPosition, KitUnitsTextboxType, KitUserApplicationsState, KitUserPermissionsState, KitUserSettingsComponent, KitUserSettingsKeys, KitUserSettingsState, KitUserState, KitUserType, RemoveGridFilter, SetGridColumns, SetGridFilters, SetGridSearch, SetGridSkip, SetGridSort, SetGridTake, UpdateGridFilter, buildRandomUUID, changeFilterField, createDataFetcherFactory, findMatches, kitBuildFilterBooleanOptions, kitBuildFilterListOptions, kitBuildFilters, kitBuildGridColumn, kitBuildGridDataResults, kitBuildOdataFilter, kitBuildSortString, kitDataStateToODataString, kitEncodeViewNameToUrl, kitGetPermissionTypesByCategory, kitHasPermission, kitUserPermissionsGuard, mapGlobalSearchResult, trimTrailingSlash };
9399
+ export { AbstractKitCtaPanelConfirmationComponent, AddGridFilter, FetchUser, FetchUserIdentities, FetchUserPermissions, FetchUserSettings, HighlightPipe, KIT_BASE_PATH, KIT_DATETIME_FORMAT_LONG, KIT_DATE_FORMAT, KIT_GRID_CELL_DATE_FORMAT_CONFIG, KIT_GRID_STATE_TOKEN, KIT_USER_APPLICATIONS_PATH, KIT_USER_IDENTITIES_STATE_TOKEN, KIT_USER_PATH, KIT_USER_PERMISSIONS_PATH, KIT_USER_PERMISSIONS_STATE_TOKEN, KIT_USER_STATE_TOKEN, KitAutocompleteComponent, KitAutocompleteDirective, KitAvatarComponent, KitAvatarSize, KitBadgeDirective, KitBadgeTheme, KitBreadcrumbsComponent, KitBreadcrumbsService, KitButtonComponent, KitButtonIconPosition, KitButtonKind, KitButtonState, KitButtonType, KitCardComponent, KitCardDetailsComponent, KitCardTheme, KitCheckboxComponent, KitCheckboxState, KitCollapsedListComponent, KitCollapsedListDropdownAlign, KitCopyTextComponent, KitCtaPanelAbstractConfirmationComponent, KitCtaPanelActionComponent, KitCtaPanelConfirmationComponent, KitCtaPanelItemComponent, KitCtaPanelItemType, KitDataFieldComponent, KitDataFieldState, KitDatepickerComponent, KitDatepickerSize, KitDaterangeComponent, KitDaterangeType, KitDatetimepickerComponent, KitDialogActionsComponent, KitDialogComponent, KitDialogService, KitDialogTitlebarComponent, KitDialogType, KitDropdownComponent, KitDropdownItemTemplateDirective, KitDropdownSize, KitEmptySectionComponent, KitEntityGridComponent, KitEntitySectionComponent, KitEntitySectionContainerComponent, KitEntityTitleComponent, KitFileCardComponent, KitFileCardMessagesComponent, KitFileUploadComponent, KitFilterCheckboxComponent, KitFilterLogic, KitFilterOperator, KitFilterType, KitGlobalSearchComponent, KitGridCellComponent, KitGridCellService, KitGridCellTemplateDirective, KitGridColumnComponent, KitGridColumnManagerComponent, KitGridComponent, KitGridDetailTemplateDirective, KitGridDetailsButtonComponent, KitGridExportComponent, KitGridFiltersComponent, KitGridSearchComponent, KitGridSortSettingsMode, KitGridState, KitGridUrlStateService, KitGridViewType, KitGridViewsComponent, KitGridViewsState, KitInputLabelComponent, KitInputMessageComponent, KitLoaderComponent, KitLocationStepperComponent, KitMobileHeaderComponent, KitMobileMenuComponent, KitMobileMenuState, KitMultiselectComponent, KitNavigationMenuComponent, KitNavigationMenuService, KitNavigationMenuSubmenuComponent, KitNavigationTabsComponent, KitNavigationTabsType, KitNoteComponent, KitNotificationComponent, KitNotificationService, KitNotificationType, KitNumericTextboxComponent, KitNumericTextboxSize, KitNumericTextboxState, KitOptionToggleComponent, KitPageLayoutComponent, KitPermissionDirective, KitPillComponent, KitPillTheme, KitPillType, KitPopupAlignHorizontal, KitPopupAlignVertical, KitPopupComponent, KitPopupPositionMode, KitProfileMenuComponent, KitQueryParamsName, KitQueryParamsService, KitRadioButtonComponent, KitRadioButtonType, KitRoutePathComponent, KitSchedulerComponent, KitSchedulerMonthEventTemplateDirective, KitSchedulerWeekEventTemplateDirective, KitScrollNavigationComponent, KitScrollNavigationSectionComponent, KitSearchBarComponent, KitSidebarComponent, KitSkeletonAnimation, KitSkeletonComponent, KitSkeletonShape, KitSortDirection, KitSortableComponent, KitStatusLabelColor, KitStatusLabelComponent, KitStatusLabelSize, KitSvgIcon, KitSvgIconComponent, KitSvgIconType, KitSvgSpriteComponent, KitSwitchComponent, KitSwitchMode, KitSwitchState, KitTabComponent, KitTabContentDirective, KitTabsComponent, KitTabsSize, KitTabsType, KitTextLabelComponent, KitTextLabelState, KitTextareaAutoresizeDirective, KitTextareaComponent, KitTextareaState, KitTextboxComponent, KitTextboxSize, KitTextboxState, KitThemeService, KitThemes, KitTileLayoutComponent, KitTileLayoutItemComponent, KitTimelineCardComponent, KitTimelineComponent, KitTimelineTheme, KitTimelineType, KitTimepickerComponent, KitTitleTemplateDirective, KitToastrModule, KitToastrPosition, KitToastrService, KitToastrType, KitToggleComponent, KitToggleSize, KitTooltipDirective, KitTooltipPosition, KitTopBarComponent, KitTrackingCardComponent, KitTrackingTimelineComponent, KitTranslateLoader, KitTranslateService, KitTruncateTextComponent, KitUnitsTextboxComponent, KitUnitsTextboxDropdownPosition, KitUnitsTextboxType, KitUserApplicationsState, KitUserIdentitiesInterceptor, KitUserIdentitiesSelector, KitUserIdentitiesState, KitUserPermissionsState, KitUserSettingsComponent, KitUserSettingsKeys, KitUserSettingsState, KitUserState, KitUserType, RemoveGridFilter, SetGridColumns, SetGridFilters, SetGridSearch, SetGridSkip, SetGridSort, SetGridTake, SetUserIdentity, UpdateGridFilter, buildRandomUUID, changeFilterField, createDataFetcherFactory, findMatches, kitBuildFilterBooleanOptions, kitBuildFilterListOptions, kitBuildFilters, kitBuildGridColumn, kitBuildGridDataResults, kitBuildOdataFilter, kitBuildSortString, kitDataStateToODataString, kitEncodeViewNameToUrl, kitGetPermissionTypesByCategory, kitHasPermission, kitUserPermissionsGuard, mapGlobalSearchResult, trimTrailingSlash };
9270
9400
  //# sourceMappingURL=indigina-ui-kit.mjs.map