Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
NEXT-25020 - add user context information
Browse files Browse the repository at this point in the history
  • Loading branch information
jleifeld committed May 24, 2023
1 parent 696b3d3 commit 24e8308
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
26 changes: 26 additions & 0 deletions src/context/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const getLocale = createSender('contextLocale', {});
export const subscribeLocale = createSubscriber('contextLocale');
export const getCurrency = createSender('contextCurrency', {});
export const getShopwareVersion = createSender('contextShopwareVersion', {});
export const getUserInformation = createSender('contextUserInformation', {});
export const getAppInformation = createSender('contextAppInformation', {});
export const getModuleInformation = createSender('contextModuleInformation', {});

Expand Down Expand Up @@ -65,6 +66,31 @@ export type contextAppInformation = {
},
}

/**
* Get the current user information
*/
export type contextUserInformation = {
responseType: {
aclRoles: Array<{
name: string,
type: string,
id: string,
privileges: Array<string>,
}>,
active: boolean,
admin: boolean,
avatarId: string,
email: string,
firstName: string,
id: string,
lastName: string,
localeId: string,
title: string,
type: string,
username: string,
},
}

/**
* Get all registered module information for the extension
*/
Expand Down
3 changes: 2 additions & 1 deletion src/messages.types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { notificationDispatch } from './notification/index';
import type { windowRedirect, windowReload, windowRouterPush } from './window/index';
import type { contextLanguage, contextEnvironment, contextLocale, contextCurrency, contextShopwareVersion, contextAppInformation, contextModuleInformation } from './context/index';
import type { contextLanguage, contextEnvironment, contextLocale, contextCurrency, contextShopwareVersion, contextAppInformation, contextModuleInformation, contextUserInformation } from './context/index';
import type { uiComponentSectionRenderer } from './ui/componentSection/index';
import type { uiTabsAddTabItem } from './ui/tabs';
import type { uiModulePaymentOverviewCard } from './ui/module/payment/overviewCard';
Expand Down Expand Up @@ -42,6 +42,7 @@ export interface ShopwareMessageTypes {
contextLocale: contextLocale,
contextCurrency: contextCurrency,
contextShopwareVersion: contextShopwareVersion,
contextUserInformation: contextUserInformation,
contextAppInformation: contextAppInformation,
contextModuleInformation: contextModuleInformation,
getPageTitle: getPageTitle,
Expand Down

0 comments on commit 24e8308

Please sign in to comment.