admins-components 5.0.20 → 5.2.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.
@@ -12,8 +12,7 @@ interface ExternalArticleOfferModel {
12
12
  type __VLS_Props = {
13
13
  modelValue?: ExternalArticleOfferModel;
14
14
  onArticleUrlChanged: (url: string, callback: (article: Article) => void) => void;
15
- articleEditorUrl: string;
16
- environment: string;
15
+ searchImageApiUrl: string;
17
16
  searchImageWidgetUrl: string;
18
17
  imageBaseUrl: string;
19
18
  imageViewId: string;
@@ -10,8 +10,7 @@ type __VLS_Props = {
10
10
  details?: boolean;
11
11
  editable?: boolean;
12
12
  direction?: "horizontal" | "vertical";
13
- articleEditorUrl: string;
14
- environment: string;
13
+ searchImageApiUrl: string;
15
14
  searchImageWidgetUrl: string;
16
15
  imageBaseUrl: string;
17
16
  imageViewId: string;
@@ -13,8 +13,7 @@ type __VLS_Props = {
13
13
  modelValue?: InternalArticleOfferModel;
14
14
  searchArticleApiUrl: string;
15
15
  searchArticleWidgetUrl: string;
16
- articleEditorUrl: string;
17
- environment: string;
16
+ searchImageApiUrl: string;
18
17
  searchImageWidgetUrl: string;
19
18
  imageBaseUrl: string;
20
19
  imageViewId: string;
@@ -51,7 +51,7 @@ export * from './modells/Partners';
51
51
  export * from './modells/SearchPosts';
52
52
  export * from './utils/services';
53
53
  export * from './utils/dateManipulation';
54
- export * from './utils/configService';
55
54
  export * from './utils/debounce';
56
55
  export * from './utils/articleEditorService';
57
- export * from './utils/useAdminKeycloak';
56
+ export * from './utils/currentUserInfo';
57
+ export * from './utils/multisiteMixingHelper';
@@ -0,0 +1,6 @@
1
+ export interface UserInfoModel {
2
+ displayName: string;
3
+ roles: string[];
4
+ email: string;
5
+ id: string;
6
+ }
@@ -1,11 +1,73 @@
1
1
  import { PartnerDetails, PartnerDetailsByIdsPayload } from '../modells/Partners';
2
2
  import { SearchPostsPayload, SearchPostsResponse } from '../modells/SearchPosts';
3
+ import { UserInfoModel } from '../modells/User';
3
4
  import { HttpRequest } from './services';
4
5
  export declare function useArticleEditorService(url: string): ArticleEditorService;
6
+ export interface GetWidgetDetailsRouteParams {
7
+ name: string;
8
+ }
9
+ export interface GetSearchPostsWidgetDetailsResponse {
10
+ name: string;
11
+ environments: SearchPostWidgetConfig[];
12
+ }
13
+ export interface GetSearchImagesWidgetDetailsResponse {
14
+ name: string;
15
+ environments: SearchImagesWidgetConfig[];
16
+ }
17
+ export interface GetPresenceWidgetDetailsResponse {
18
+ name: string;
19
+ environments: PresenceWidgetConfig[];
20
+ }
21
+ export interface PresenceWidgetConfig {
22
+ name: string;
23
+ apiUrl: string;
24
+ }
25
+ export interface SearchPostWidgetConfig {
26
+ name: string;
27
+ apiUrl: string;
28
+ wpUrl: string;
29
+ widgetUrl: string;
30
+ }
31
+ export interface SearchImagesWidgetConfig {
32
+ name: string;
33
+ apiUrl: string;
34
+ imageBaseUrl: string;
35
+ widgetUrl: string;
36
+ viewId: string;
37
+ }
38
+ export interface Rank {
39
+ value: number;
40
+ label: string;
41
+ }
42
+ export interface Other {
43
+ value: string;
44
+ label: string;
45
+ }
46
+ export interface Site {
47
+ name: string;
48
+ id: string;
49
+ partnerBaseUrl: string;
50
+ articleSeriesBaseUrl: string;
51
+ digitalSupplementBaseUrl: string;
52
+ url: string;
53
+ defaultAuthor: string;
54
+ ranks: Rank[];
55
+ others: Other[];
56
+ entities: Entity[];
57
+ }
58
+ export interface Entity {
59
+ type: string;
60
+ allowedSiteIds: string[];
61
+ }
5
62
  export declare class ArticleEditorService {
6
63
  articleEditorBackendUrl: string;
7
64
  baseUrl: string;
8
65
  searchPosts: HttpRequest<SearchPostsPayload, undefined, undefined, SearchPostsResponse>;
9
66
  partnersDetailsByIds: HttpRequest<PartnerDetailsByIdsPayload, undefined, undefined, PartnerDetails[]>;
67
+ whoAmI: HttpRequest<void, undefined, undefined, UserInfoModel>;
68
+ getPostsConfig: HttpRequest<undefined, GetWidgetDetailsRouteParams, undefined, GetSearchPostsWidgetDetailsResponse>;
69
+ getImagesConfig: HttpRequest<undefined, GetWidgetDetailsRouteParams, undefined, GetSearchImagesWidgetDetailsResponse>;
70
+ getPresenceConfig: HttpRequest<undefined, GetWidgetDetailsRouteParams, undefined, GetPresenceWidgetDetailsResponse>;
71
+ sites: HttpRequest<undefined, undefined, undefined, Site[]>;
10
72
  constructor(articleEditorBackendUrl: string);
11
73
  }
@@ -0,0 +1,107 @@
1
+ import { UserInfoModel } from '../modells/User';
2
+ export type UserState = "loading" | "authenticated" | "error";
3
+ export declare const useCurrentUser: import('pinia').StoreDefinition<"currentUser", {
4
+ user: UserInfoModel | null;
5
+ state: UserState;
6
+ error: string | null;
7
+ _backendUrl: string | null;
8
+ _isInitialized: boolean;
9
+ }, {
10
+ isLoading: (state: {
11
+ user: {
12
+ displayName: string;
13
+ roles: string[];
14
+ email: string;
15
+ id: string;
16
+ } | null;
17
+ state: UserState;
18
+ error: string | null;
19
+ _backendUrl: string | null;
20
+ _isInitialized: boolean;
21
+ } & import('pinia').PiniaCustomStateProperties<{
22
+ user: UserInfoModel | null;
23
+ state: UserState;
24
+ error: string | null;
25
+ _backendUrl: string | null;
26
+ _isInitialized: boolean;
27
+ }>) => boolean;
28
+ isAuthenticated: (state: {
29
+ user: {
30
+ displayName: string;
31
+ roles: string[];
32
+ email: string;
33
+ id: string;
34
+ } | null;
35
+ state: UserState;
36
+ error: string | null;
37
+ _backendUrl: string | null;
38
+ _isInitialized: boolean;
39
+ } & import('pinia').PiniaCustomStateProperties<{
40
+ user: UserInfoModel | null;
41
+ state: UserState;
42
+ error: string | null;
43
+ _backendUrl: string | null;
44
+ _isInitialized: boolean;
45
+ }>) => boolean;
46
+ displayName: (state: {
47
+ user: {
48
+ displayName: string;
49
+ roles: string[];
50
+ email: string;
51
+ id: string;
52
+ } | null;
53
+ state: UserState;
54
+ error: string | null;
55
+ _backendUrl: string | null;
56
+ _isInitialized: boolean;
57
+ } & import('pinia').PiniaCustomStateProperties<{
58
+ user: UserInfoModel | null;
59
+ state: UserState;
60
+ error: string | null;
61
+ _backendUrl: string | null;
62
+ _isInitialized: boolean;
63
+ }>) => string;
64
+ email: (state: {
65
+ user: {
66
+ displayName: string;
67
+ roles: string[];
68
+ email: string;
69
+ id: string;
70
+ } | null;
71
+ state: UserState;
72
+ error: string | null;
73
+ _backendUrl: string | null;
74
+ _isInitialized: boolean;
75
+ } & import('pinia').PiniaCustomStateProperties<{
76
+ user: UserInfoModel | null;
77
+ state: UserState;
78
+ error: string | null;
79
+ _backendUrl: string | null;
80
+ _isInitialized: boolean;
81
+ }>) => string;
82
+ roles: (state: {
83
+ user: {
84
+ displayName: string;
85
+ roles: string[];
86
+ email: string;
87
+ id: string;
88
+ } | null;
89
+ state: UserState;
90
+ error: string | null;
91
+ _backendUrl: string | null;
92
+ _isInitialized: boolean;
93
+ } & import('pinia').PiniaCustomStateProperties<{
94
+ user: UserInfoModel | null;
95
+ state: UserState;
96
+ error: string | null;
97
+ _backendUrl: string | null;
98
+ _isInitialized: boolean;
99
+ }>) => string[];
100
+ }, {
101
+ initialize(backendUrl: string): Promise<void>;
102
+ refresh(): Promise<void>;
103
+ hasRole(role: string): boolean;
104
+ hasAnyRole(...roles: string[]): boolean;
105
+ hasAllRoles(...roles: string[]): boolean;
106
+ hasPermission(siteId: string, entityName: string | "all", accessLevel: "reader" | "admin"): boolean;
107
+ }>;
@@ -2,6 +2,7 @@ export * from '../modells/Partners';
2
2
  export * from '../modells/SearchPosts';
3
3
  export * from './services';
4
4
  export * from './dateManipulation';
5
- export * from './configService';
6
5
  export * from './debounce';
7
6
  export * from './articleEditorService';
7
+ export * from './currentUserInfo';
8
+ export * from './multisiteMixingHelper';
@@ -0,0 +1 @@
1
+ export declare function getMixableSiteIdsForResource(availableSiteIds: string[], entityName: string | "all"): string[];
@@ -16,7 +16,6 @@ export interface HttpRequest<TPayload, TRouteParams, TQueryParams, TResponse> {
16
16
  queryParams: Ref<TQueryParams>;
17
17
  routeParams: Ref<TRouteParams>;
18
18
  payload: Ref<TPayload>;
19
- sendKeycloakBearer?: Ref<boolean>;
20
19
  }
21
20
  export declare enum Methods {
22
21
  GET = 0,
@@ -33,6 +32,6 @@ export declare class FetchDetails {
33
32
  method: Methods;
34
33
  fetchMethode: typeof useFetch;
35
34
  isIpInUrl: (url: string) => boolean;
36
- constructor(baseUrl: string, relativeUrl: string, method: Methods, errorMessages: Map<number, string>, contentType?: string | null, defaultRequestHeaders?: Record<string, string>, sendKeycloakBearer?: boolean);
35
+ constructor(baseUrl: string, relativeUrl: string, method: Methods, errorMessages: Map<number, string>, contentType?: string | null, defaultRequestHeaders?: Record<string, string>);
37
36
  }
38
37
  export declare function initRequest<TPayload, TRouteParams, TQueryParams, TResponse>(fetchDetails: FetchDetails, payload: TPayload, routeParams: TRouteParams, queryParams: TQueryParams): HttpRequest<TPayload, TRouteParams, TQueryParams, TResponse>;
@@ -1,6 +1,5 @@
1
1
  export interface ImagePickerElementConfig {
2
- articleEditorUrl: string;
3
- environment: string;
2
+ searchImageApiUrl: string;
4
3
  searchImageWidgetUrl: string;
5
4
  imageBaseUrl: string;
6
5
  imageViewId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "admins-components",
3
- "version": "5.0.20",
3
+ "version": "5.2.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -22,10 +22,10 @@
22
22
  "preview": "vite preview"
23
23
  },
24
24
  "dependencies": {
25
- "@dsb-norge/vue-keycloak-js": "^3.0.3",
26
25
  "@vueform/vueform": "^1.13.2",
27
26
  "@vueuse/core": "^13.9.0",
28
27
  "bootstrap": "^5.3.7",
28
+ "pinia": "^2.3.1",
29
29
  "rollup-plugin-typescript2": "^0.36.0",
30
30
  "vite-plugin-dts": "^4.5.3",
31
31
  "vue": "^3.5.13"
@@ -1,72 +0,0 @@
1
- import { HttpRequest } from './services';
2
- export declare function useConfigService(url: string): ConfigService;
3
- export interface GetWidgetDetailsRouteParams {
4
- name: string;
5
- }
6
- export interface GetSearchPostsWidgetDetailsResponse {
7
- name: string;
8
- environments: SearchPostWidgetConfig[];
9
- }
10
- export interface GetSearchImagesWidgetDetailsResponse {
11
- name: string;
12
- environments: SearchImagesWidgetConfig[];
13
- }
14
- export interface GetPresenceWidgetDetailsResponse {
15
- name: string;
16
- environments: PresenceWidgetConfig[];
17
- }
18
- export interface PresenceWidgetConfig {
19
- name: string;
20
- apiUrl: string;
21
- }
22
- export interface SearchPostWidgetConfig {
23
- name: string;
24
- apiUrl: string;
25
- wpUrl: string;
26
- widgetUrl: string;
27
- }
28
- export interface SearchImagesWidgetConfig {
29
- name: string;
30
- apiUrl: string;
31
- imageBaseUrl: string;
32
- widgetUrl: string;
33
- viewId: string;
34
- }
35
- export interface KeycloakConfigResponse {
36
- name: string;
37
- environments: KeycloakConfig[];
38
- }
39
- export interface KeycloakConfig {
40
- name: string;
41
- url: string;
42
- realm: string;
43
- silentSsoCheckUrl?: string;
44
- }
45
- export interface Rank {
46
- value: number;
47
- label: string;
48
- }
49
- export interface Other {
50
- value: string;
51
- label: string;
52
- }
53
- export interface Site {
54
- name: string;
55
- id: string;
56
- partnerBaseUrl: string;
57
- articleSeriesBaseUrl: string;
58
- digitalSupplementBaseUrl: string;
59
- url: string;
60
- defaultAuthor: string;
61
- ranks: Rank[];
62
- others: Other[];
63
- }
64
- export declare class ConfigService {
65
- apiurl: string;
66
- getPostsConfig: HttpRequest<undefined, GetWidgetDetailsRouteParams, undefined, GetSearchPostsWidgetDetailsResponse>;
67
- getImagesConfig: HttpRequest<undefined, GetWidgetDetailsRouteParams, undefined, GetSearchImagesWidgetDetailsResponse>;
68
- getPresenceConfig: HttpRequest<undefined, GetWidgetDetailsRouteParams, undefined, GetPresenceWidgetDetailsResponse>;
69
- getKeycloakConfig: HttpRequest<undefined, GetWidgetDetailsRouteParams, undefined, KeycloakConfigResponse>;
70
- sites: HttpRequest<undefined, undefined, undefined, Site[]>;
71
- constructor(apiurl: string);
72
- }
@@ -1,3 +0,0 @@
1
- import { App } from 'vue';
2
- export declare function useAdminKeycloak(app: App, configUrl: string, configEnvironment: string, clientId: string): void;
3
- export declare function loginWithPopup(keycloak: any): void;