@entur-partner/app-shell-standalone 7.0.11 → 7.1.0-alpha.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.
@@ -1,5 +1,5 @@
1
1
  import { type AppShellProps, type GetOrganisationsFn } from "@entur-partner/app-shell";
2
- import { type Environment } from "@entur-partner/common";
2
+ import { Environment } from "@entur-partner/common";
3
3
  import type { MicroFrontendPayload } from "@entur-partner/micro-frontend";
4
4
  import { type ReactNode } from "react";
5
5
  export interface AppShellStandaloneProps extends Omit<AppShellProps, "children"> {
@@ -0,0 +1,11 @@
1
+ import "./BetaTopNavigation.scss";
2
+ import { Environment } from "@entur-partner/common";
3
+ import type { User } from "@entur-partner/micro-frontend";
4
+ interface TopMenuProps {
5
+ environment?: Environment;
6
+ user?: User;
7
+ onLogin: () => void;
8
+ onLogout: () => void;
9
+ }
10
+ export declare const BetaTopNavigation: ({ environment, user, onLogin, onLogout, }: TopMenuProps) => import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,14 @@
1
+ import { type AppShellProps } from "@entur-partner/app-shell";
2
+ import { type Environment } from "@entur-partner/common";
3
+ import type { PublicMicroFrontendPayload } from "@entur-partner/micro-frontend";
4
+ import { type ReactNode } from "react";
5
+ export interface PublicAppShellStandaloneProps extends Omit<AppShellProps, "children" | "getOrganisations"> {
6
+ children: (options: PublicMicroFrontendPayload) => ReactNode;
7
+ /**
8
+ * Either a function for fetching organisations or an url where organisations
9
+ * can be fetched. Url will be called with access token in header.
10
+ */
11
+ environment?: Environment;
12
+ postHogApiKey?: string;
13
+ }
14
+ export declare const PublicAppShellStandalone: ({ children, audience, domain, clientId, decorateUser, redirectUri, environment, navigate, }: PublicAppShellStandaloneProps) => import("react/jsx-runtime").JSX.Element;
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`@entur-partner/app-shell`),t=require(`@entur-partner/common`),n=require(`@entur/menu`),r=require(`@entur/tokens`),i=require(`react/jsx-runtime`);var a=e=>{switch(e){case`nb`:case`nb-NO`:return`nb-NO`;case`en`:case`en-GB`:return`en-GB`;default:return`nb-NO`}},o=({getOrganisations:o,user:s,getToken:c,logout:l,environment:u})=>{let{getItemsForPath:d}=(0,e.useMenu)(),{language:f,setLanguage:p}=(0,e.useLanguage)(),{setOrganisationId:m,organisationId:h}=(0,e.useOrganisation)(),g=d(`app-shell`),_=a(f);return(0,i.jsxs)(t.Menu,{children:[(0,i.jsx)(`div`,{style:{marginLeft:r.space.extraLarge2,marginTop:r.space.large,marginBottom:r.space.extraLarge},children:(0,i.jsx)(t.EnturPartnerLogo,{altText:`Entur partner logo`,className:`menu-space menu-logo`,environment:u})}),(0,i.jsx)(`div`,{style:{margin:r.space.large},children:(0,i.jsxs)(t.Stack,{space:`small`,children:[(0,i.jsx)(t.UserMenu,{className:`ph-no-capture`,onLocaleChange:p,onLogout:async()=>{await l()},locale:_,userName:s.given_name?`${s.given_name} ${s.family_name}`:s.name,environment:u,showVersionItem:!1,showMyProfileItem:!1,showCookieSettingsItem:!0,onCookieSettingsOpen:()=>{window.UC_UI.showSecondLayer()},onNavigateToMyProfile:()=>{}}),(0,i.jsx)(e.OrganisationSelector,{getOrganisations:o,getToken:c,selectedOrganisationId:h,onChange:e=>m(e)})]})}),(0,i.jsx)(n.SideNavigation,{children:g.map(({to:t,title:r,disabled:a,navigate:o})=>(0,i.jsx)(n.SideNavigationItem,{as:e.MicroFrontendLink,href:t,navigate:a?null:()=>o(t),disabled:!!a,children:r},t.toString()))})]})},s=({children:n,values:r})=>{let{addItems:a,setMFNavigate:o}=(0,e.useMenu)(),s=(0,e.useOrganisationId)(),{language:c}=(0,e.useLanguage)(),l=e=>a(e,`app-shell`);return(0,i.jsx)(t.Content,{children:n({...r,language:c,navigate:()=>{process.env.NODE_ENV!==`production`&&console.warn(`Calling navigate() from app shell has no effect. It is only provided so that the app shell values are equal to MicroFrontendPayload.`)},addMenuItems:l,organisationId:s.toString(),setMFNavigate:e=>o(`app-shell`,e)})})},c=({children:t,audience:n,domain:r,clientId:a,decorateUser:c,getOrganisations:l,redirectUri:u,environment:d,navigate:f})=>(0,i.jsx)(e.AppShell,{audience:n,domain:r,clientId:a,decorateUser:c,redirectUri:u,environment:d,navigate:f,children:n=>(0,i.jsx)(e.LanguageProvider,{language:e.languageStorage.get()??`nb-NO`,children:(0,i.jsx)(e.OrganisationProvider,{organisationId:e.organisationStorage.get()??n.user[`https://entur.io/organisationID`].toString(),children:(0,i.jsxs)(e.MenuProvider,{children:[(0,i.jsx)(o,{...n,getOrganisations:l,environment:d}),(0,i.jsx)(s,{values:n,children:t})]})})})});exports.AppShellStandalone=c;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let l=require(`@entur-partner/app-shell`),u=require(`@entur-partner/common`),d=require(`@entur-partner/util`),f=require(`@entur/menu`),p=require(`@entur/tokens`),m=require(`react/jsx-runtime`),h=require(`@entur/button`);require(`react`);var g=e=>{switch(e){case`nb`:case`nb-NO`:return`nb-NO`;case`en`:case`en-GB`:return`en-GB`;default:return`nb-NO`}},_=({getOrganisations:e,user:t,getToken:n,logout:r,environment:i})=>{let{getItemsForPath:a}=(0,l.useMenu)(),{language:o,setLanguage:s}=(0,l.useLanguage)(),{setOrganisationId:c,organisationId:h}=(0,l.useOrganisation)(),_=a(`app-shell`),v=g(o);return(0,d.assertIsDefined)(t,`User must be defined to render Menu`),(0,d.assertIsDefined)(h,`Organisation ID must be defined to render Menu`),(0,m.jsxs)(u.Menu,{children:[(0,m.jsx)(`div`,{style:{marginLeft:p.space.extraLarge2,marginTop:p.space.large,marginBottom:p.space.extraLarge},children:(0,m.jsx)(u.EnturPartnerLogo,{altText:`Entur partner logo`,className:`menu-space menu-logo`,environment:i})}),(0,m.jsx)(`div`,{style:{margin:p.space.large},children:(0,m.jsxs)(u.Stack,{space:`small`,children:[(0,m.jsx)(u.UserMenu,{className:`ph-no-capture`,onLocaleChange:s,onLogout:async()=>{await r()},locale:v,userName:t.given_name?`${t.given_name} ${t.family_name}`:t.name,environment:i,showVersionItem:!1,showMyProfileItem:!1,showCookieSettingsItem:!0,onCookieSettingsOpen:()=>{window.UC_UI.showSecondLayer()},onNavigateToMyProfile:()=>{}}),(0,m.jsx)(l.OrganisationSelector,{getOrganisations:e,getToken:n,selectedOrganisationId:h,onChange:e=>c(e)})]})}),(0,m.jsx)(f.SideNavigation,{children:_.map(({to:e,title:t,disabled:n,navigate:r})=>(0,m.jsx)(f.SideNavigationItem,{as:l.MicroFrontendLink,href:e,navigate:n?null:()=>r(e),disabled:!!n,children:t},e.toString()))})]})},v=({children:e,values:t})=>{let{addItems:n,setMFNavigate:r}=(0,l.useMenu)(),i=(0,l.useOrganisationId)(),{language:a}=(0,l.useLanguage)(),o=e=>n(e,`app-shell`);return(0,d.assertIsDefined)(t.user,`User must be defined in AppShell`),(0,d.assertIsDefined)(i,`Organisation ID must be defined in AppShell`),(0,m.jsx)(u.Content,{children:e({...t,user:t.user,language:a,navigate:()=>{process.env.NODE_ENV!==`production`&&console.warn(`Calling navigate() from app shell has no effect. It is only provided so that the app shell values are equal to MicroFrontendPayload.`)},addMenuItems:o,organisationId:i.toString(),setMFNavigate:e=>r(`app-shell`,e)})})},y=({children:e,audience:t,domain:n,clientId:r,decorateUser:i,getOrganisations:a,redirectUri:o,environment:s,navigate:c})=>(0,m.jsx)(l.AppShell,{audience:t,domain:n,clientId:r,decorateUser:i,redirectUri:o,environment:s,navigate:c,isPublicView:!1,children:t=>(0,m.jsx)(l.LanguageProvider,{language:l.languageStorage.get()??`nb-NO`,children:(0,m.jsx)(l.OrganisationProvider,{organisationId:l.organisationStorage.get()??t.user?.[`https://entur.io/organisationID`].toString()??``,children:(0,m.jsxs)(l.MenuProvider,{children:[(0,m.jsx)(_,{...t,getOrganisations:a,environment:s}),(0,m.jsx)(v,{values:t,children:e})]})})})}),b=c(o(((e,t)=>{(function(){"use strict";var e={}.hasOwnProperty;function n(){for(var e=``,t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,r(n)))}return e}function r(t){if(typeof t==`string`||typeof t==`number`)return t;if(typeof t!=`object`)return``;if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes(`[native code]`))return t.toString();var r=``;for(var a in t)e.call(t,a)&&t[a]&&(r=i(r,a));return r}function i(e,t){return t?e?e+` `+t:e+t:e}t!==void 0&&t.exports?(n.default=n,t.exports=n):typeof define==`function`&&typeof define.amd==`object`&&define.amd?define(`classnames`,[],function(){return n}):window.classNames=n})()}))(),1),x=({environment:e,user:t,onLogin:n,onLogout:r})=>{let i=!!t,{language:a,setLanguage:o}=(0,l.useLanguage)(),s=window.location.pathname===`/`,{getItemsForPath:c}=(0,l.useMenu)(),d=c(`app-shell`);return(0,m.jsxs)(`nav`,{className:(0,b.default)(`top-navigation`,`eds-contrast`,{"top-navigation--frontpage":s}),"aria-label":`Navigasjon, hovedseksjoner`,children:[(0,m.jsx)(`a`,{href:`/`,className:`top-navigation__logo`,children:(0,m.jsx)(u.EnturPartnerLogo,{altText:`Entur partner logo`,className:`menu-space menu-logo`,environment:e})}),d.filter(({isPublic:e,disabled:t})=>!t&&(e||i)).map(({to:e,title:t,navigate:n})=>(0,m.jsx)(S,{to:e,navigate:()=>n(e),children:t},e.toString())),(0,m.jsx)(`div`,{className:`top-navigation__actions`,children:i?(0,m.jsx)(u.UserMenu,{className:`ph-no-capture`,onLocaleChange:o,onLogout:r,locale:a,userName:t?.name??``,environment:e,showVersionItem:!1,showMyProfileItem:!1,showCookieSettingsItem:!0,onCookieSettingsOpen:()=>{window.UC_UI.showSecondLayer()},onNavigateToMyProfile:()=>{}}):(0,m.jsx)(h.SecondaryButton,{onClick:n,className:`top-navigation__button`,children:a===`nb-NO`?`Logg inn`:`Log In`})})]})},S=({to:e,navigate:t,children:n})=>(0,m.jsx)(f.TopNavigationItem,{as:l.MicroFrontendLink,href:e,navigate:t,active:window.location.pathname.startsWith(e),children:n}),C=({children:e,values:t})=>{let{addItems:n,setMFNavigate:r}=(0,l.useMenu)(),{language:i}=(0,l.useLanguage)(),a=e=>n(e,`app-shell`);return(0,m.jsx)(u.Content,{className:`eps-public-content`,children:e({...t,language:i,navigate:()=>{process.env.NODE_ENV!==`production`&&console.warn(`Calling navigate() from app shell has no effect. It is only provided so that the app shell values are equal to MicroFrontendPayload.`)},addMenuItems:a,setMFNavigate:e=>r(`app-shell`,e)})})},w=({children:e,audience:t,domain:n,clientId:r,decorateUser:i,redirectUri:a,environment:o,navigate:s})=>(0,m.jsx)(l.AppShell,{audience:t,domain:n,clientId:r,decorateUser:i,redirectUri:a,navigate:s,isPublicView:!0,children:t=>(0,m.jsx)(l.LanguageProvider,{language:l.languageStorage.get()??`nb-NO`,children:(0,m.jsxs)(l.MenuProvider,{children:[(0,m.jsx)(x,{environment:o,user:t.user,onLogin:()=>t.loginWithRedirect(),onLogout:t.logout}),(0,m.jsx)(C,{values:t,children:e})]})})});exports.AppShellStandalone=y,exports.PublicAppShellStandalone=w;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../src/Menu.tsx","../src/AppShellStandalone.tsx"],"sourcesContent":["import { SideNavigation, SideNavigationItem } from \"@entur/menu\";\nimport { space } from \"@entur/tokens\";\nimport {\n\ttype AppShellValues,\n\ttype GetOrganisationsFn,\n\tMicroFrontendLink,\n\tOrganisationSelector,\n\tuseLanguage,\n\tuseMenu,\n\tuseOrganisation,\n} from \"@entur-partner/app-shell\";\nimport {\n\tEnturPartnerLogo,\n\ttype Environment,\n\tMenu as MenuContainer,\n\tStack,\n\tUserMenu,\n} from \"@entur-partner/common\";\n\ndeclare global {\n\tinterface Window {\n\t\tUC_UI: {\n\t\t\tshowFirstLayer: () => void;\n\t\t\tshowSecondLayer: () => void;\n\t\t};\n\t}\n}\n\ninterface MenuProps extends AppShellValues {\n\tgetOrganisations: GetOrganisationsFn | string;\n\tenvironment?: Environment;\n}\n\nconst convertToLocale = (language: string): \"nb-NO\" | \"en-GB\" => {\n\tswitch (language) {\n\t\tcase \"nb\":\n\t\tcase \"nb-NO\":\n\t\t\treturn \"nb-NO\";\n\t\tcase \"en\":\n\t\tcase \"en-GB\":\n\t\t\treturn \"en-GB\";\n\t\tdefault:\n\t\t\treturn \"nb-NO\";\n\t}\n};\n\nexport const Menu = ({\n\tgetOrganisations,\n\tuser,\n\tgetToken,\n\tlogout,\n\tenvironment,\n}: MenuProps) => {\n\tconst { getItemsForPath } = useMenu();\n\tconst { language, setLanguage } = useLanguage();\n\tconst { setOrganisationId, organisationId } = useOrganisation();\n\tconst items = getItemsForPath(\"app-shell\");\n\tconst locale = convertToLocale(language);\n\n\treturn (\n\t\t<MenuContainer>\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tmarginLeft: space.extraLarge2,\n\t\t\t\t\tmarginTop: space.large,\n\t\t\t\t\tmarginBottom: space.extraLarge,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<EnturPartnerLogo\n\t\t\t\t\taltText={\"Entur partner logo\"}\n\t\t\t\t\tclassName=\"menu-space menu-logo\"\n\t\t\t\t\tenvironment={environment}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div style={{ margin: space.large }}>\n\t\t\t\t<Stack space=\"small\">\n\t\t\t\t\t<UserMenu\n\t\t\t\t\t\tclassName=\"ph-no-capture\"\n\t\t\t\t\t\tonLocaleChange={setLanguage}\n\t\t\t\t\t\tonLogout={async () => {\n\t\t\t\t\t\t\tawait logout();\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tlocale={locale}\n\t\t\t\t\t\tuserName={\n\t\t\t\t\t\t\tuser.given_name\n\t\t\t\t\t\t\t\t? `${user.given_name} ${user.family_name}`\n\t\t\t\t\t\t\t\t: user.name\n\t\t\t\t\t\t}\n\t\t\t\t\t\tenvironment={environment}\n\t\t\t\t\t\tshowVersionItem={false}\n\t\t\t\t\t\tshowMyProfileItem={false}\n\t\t\t\t\t\tshowCookieSettingsItem={true}\n\t\t\t\t\t\tonCookieSettingsOpen={() => {\n\t\t\t\t\t\t\twindow.UC_UI.showSecondLayer();\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonNavigateToMyProfile={() => {}}\n\t\t\t\t\t/>\n\t\t\t\t\t<OrganisationSelector\n\t\t\t\t\t\tgetOrganisations={getOrganisations}\n\t\t\t\t\t\tgetToken={getToken}\n\t\t\t\t\t\tselectedOrganisationId={organisationId}\n\t\t\t\t\t\tonChange={(organisationId: number) =>\n\t\t\t\t\t\t\tsetOrganisationId(organisationId)\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Stack>\n\t\t\t</div>\n\t\t\t<SideNavigation>\n\t\t\t\t{items.map(({ to, title, disabled, navigate }) => {\n\t\t\t\t\tconst itemProps = {\n\t\t\t\t\t\tas: MicroFrontendLink,\n\t\t\t\t\t\thref: to,\n\t\t\t\t\t\tnavigate: disabled ? null : () => navigate(to),\n\t\t\t\t\t\tdisabled: !!disabled,\n\t\t\t\t\t};\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<SideNavigationItem key={to.toString()} {...itemProps}>\n\t\t\t\t\t\t\t{title}\n\t\t\t\t\t\t</SideNavigationItem>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</SideNavigation>\n\t\t</MenuContainer>\n\t);\n};\n","import {\n\tAppShell,\n\ttype AppShellProps,\n\ttype AppShellValues,\n\ttype GetOrganisationsFn,\n\tLanguageProvider,\n\tlanguageStorage,\n\tMenuProvider,\n\tOrganisationProvider,\n\torganisationStorage,\n\tuseLanguage,\n\tuseMenu,\n\tuseOrganisationId,\n} from \"@entur-partner/app-shell\";\nimport {\n\tContent as ContentWrapper,\n\ttype Environment,\n} from \"@entur-partner/common\";\nimport type {\n\tMenuItem,\n\tMicroFrontendPayload,\n} from \"@entur-partner/micro-frontend\";\nimport { type ReactNode } from \"react\";\n\nimport { Menu } from \"./Menu\";\n\ntype ContentProps = {\n\tvalues: AppShellValues;\n\tchildren: (options: MicroFrontendPayload) => ReactNode;\n};\n\nconst Content = ({ children, values }: ContentProps) => {\n\tconst { addItems, setMFNavigate } = useMenu();\n\tconst organisationId = useOrganisationId();\n\tconst { language } = useLanguage();\n\n\tconst addMenuItems = (items: MenuItem[]) => addItems(items, \"app-shell\");\n\n\treturn (\n\t\t<ContentWrapper>\n\t\t\t{children({\n\t\t\t\t...values,\n\t\t\t\tlanguage,\n\t\t\t\tnavigate: () => {\n\t\t\t\t\tif (process.env.NODE_ENV !== \"production\") {\n\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t\"Calling navigate() from app shell has no effect. It is only provided so that the app shell values are equal to MicroFrontendPayload.\",\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\taddMenuItems,\n\t\t\t\torganisationId: organisationId.toString(),\n\t\t\t\tsetMFNavigate: (navigate) => setMFNavigate(\"app-shell\", navigate),\n\t\t\t})}\n\t\t</ContentWrapper>\n\t);\n};\n\nexport interface AppShellStandaloneProps\n\textends Omit<AppShellProps, \"children\"> {\n\tchildren: (options: MicroFrontendPayload) => ReactNode;\n\t/**\n\t * Either a function for fetching organisations or an url where organisations\n\t * can be fetched. Url will be called with access token in header.\n\t */\n\tgetOrganisations: GetOrganisationsFn | string;\n\tenvironment?: Environment;\n\tpostHogApiKey?: string;\n}\n\nexport const AppShellStandalone = ({\n\tchildren,\n\taudience,\n\tdomain,\n\tclientId,\n\tdecorateUser,\n\tgetOrganisations,\n\tredirectUri,\n\tenvironment,\n\tnavigate,\n}: AppShellStandaloneProps) => {\n\treturn (\n\t\t<AppShell\n\t\t\taudience={audience}\n\t\t\tdomain={domain}\n\t\t\tclientId={clientId}\n\t\t\tdecorateUser={decorateUser}\n\t\t\tredirectUri={redirectUri}\n\t\t\tenvironment={environment}\n\t\t\tnavigate={navigate}\n\t\t>\n\t\t\t{(values) => (\n\t\t\t\t<LanguageProvider language={languageStorage.get() ?? \"nb-NO\"}>\n\t\t\t\t\t<OrganisationProvider\n\t\t\t\t\t\torganisationId={\n\t\t\t\t\t\t\torganisationStorage.get() ??\n\t\t\t\t\t\t\tvalues.user[\"https://entur.io/organisationID\"].toString()\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<MenuProvider>\n\t\t\t\t\t\t\t<Menu\n\t\t\t\t\t\t\t\t{...values}\n\t\t\t\t\t\t\t\tgetOrganisations={getOrganisations}\n\t\t\t\t\t\t\t\tenvironment={environment}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Content values={values}>{children}</Content>\n\t\t\t\t\t\t</MenuProvider>\n\t\t\t\t\t</OrganisationProvider>\n\t\t\t\t</LanguageProvider>\n\t\t\t)}\n\t\t</AppShell>\n\t);\n};\n"],"mappings":"mOAiCA,IAAM,EAAmB,GAAwC,CAChE,OAAQ,EAAR,CACC,IAAK,KACL,IAAK,QACJ,MAAO,QACR,IAAK,KACL,IAAK,QACJ,MAAO,QACR,QACC,MAAO,UAIG,GAAQ,CACpB,mBACA,OACA,WACA,SACA,iBACgB,CAChB,GAAM,CAAE,oBAAA,EAAA,EAAA,UAA6B,CAC/B,CAAE,WAAU,gBAAA,EAAA,EAAA,cAA6B,CACzC,CAAE,oBAAmB,mBAAA,EAAA,EAAA,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A,EAAA,oBAAoC,CACpC,CAAE,aAAA,EAAA,EAAA,cAA0B,CAE5B,EAAgB,GAAsB,EAAS,EAAO,YAAY,CAExE,OACC,EAAA,EAAA,KAAC,EAAA,QAAD,CAAA,SACE,EAAS,CACT,GAAG,EACH,WACA,aAAgB,CACf,QAAA,IAAA,WAA6B,cAC5B,QAAQ,KACP,uIACA,EAGH,eACA,eAAgB,EAAe,UAAU,CACzC,cAAgB,GAAa,EAAc,YAAa,EAAS,CACjE,CAAC,CACc,CAAA,EAgBN,GAAsB,CAClC,WACA,WACA,SACA,WACA,eACA,mBACA,cACA,cACA,eAGC,EAAA,EAAA,KAAC,EAAA,SAAD,CACW,WACF,SACE,WACI,eACD,cACA,cACH,oBAER,IACD,EAAA,EAAA,KAAC,EAAA,iBAAD,CAAkB,SAAU,EAAA,gBAAgB,KAAK,EAAI,kBACpD,EAAA,EAAA,KAAC,EAAA,qBAAD,CACC,eACC,EAAA,oBAAoB,KAAK,EACzB,EAAO,KAAK,mCAAmC,UAAU,WAG1D,EAAA,EAAA,MAAC,EAAA,aAAD,CAAA,SAAA,EACC,EAAA,EAAA,KAAC,EAAD,CACC,GAAI,EACc,mBACL,cACZ,CAAA,EACF,EAAA,EAAA,KAAC,EAAD,CAAiB,SAAS,WAAmB,CAAA,CAC/B,CAAA,CAAA,CACO,CAAA,CACL,CAAA,CAEV,CAAA"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/Menu.tsx","../src/AppShellStandalone.tsx","../../../node_modules/classnames/index.js","../src/BetaTopNavigation.tsx","../src/PublicAppShellStandalone.tsx"],"sourcesContent":["import { SideNavigation, SideNavigationItem } from \"@entur/menu\";\nimport { space } from \"@entur/tokens\";\nimport {\n\ttype AppShellValues,\n\ttype GetOrganisationsFn,\n\tMicroFrontendLink,\n\tOrganisationSelector,\n\tuseLanguage,\n\tuseMenu,\n\tuseOrganisation,\n} from \"@entur-partner/app-shell\";\nimport {\n\tEnturPartnerLogo,\n\ttype Environment,\n\tMenu as MenuContainer,\n\tStack,\n\tUserMenu,\n} from \"@entur-partner/common\";\nimport { assertIsDefined } from \"@entur-partner/util\";\n\ndeclare global {\n\tinterface Window {\n\t\tUC_UI: {\n\t\t\tshowFirstLayer: () => void;\n\t\t\tshowSecondLayer: () => void;\n\t\t};\n\t}\n}\n\ninterface MenuProps extends AppShellValues {\n\tgetOrganisations: GetOrganisationsFn | string;\n\tenvironment?: Environment;\n}\n\nconst convertToLocale = (language: string): \"nb-NO\" | \"en-GB\" => {\n\tswitch (language) {\n\t\tcase \"nb\":\n\t\tcase \"nb-NO\":\n\t\t\treturn \"nb-NO\";\n\t\tcase \"en\":\n\t\tcase \"en-GB\":\n\t\t\treturn \"en-GB\";\n\t\tdefault:\n\t\t\treturn \"nb-NO\";\n\t}\n};\n\nexport const Menu = ({\n\tgetOrganisations,\n\tuser,\n\tgetToken,\n\tlogout,\n\tenvironment,\n}: MenuProps) => {\n\tconst { getItemsForPath } = useMenu();\n\tconst { language, setLanguage } = useLanguage();\n\tconst { setOrganisationId, organisationId } = useOrganisation();\n\tconst items = getItemsForPath(\"app-shell\");\n\tconst locale = convertToLocale(language);\n\n\tassertIsDefined(user, \"User must be defined to render Menu\");\n\tassertIsDefined(\n\t\torganisationId,\n\t\t\"Organisation ID must be defined to render Menu\",\n\t);\n\n\treturn (\n\t\t<MenuContainer>\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tmarginLeft: space.extraLarge2,\n\t\t\t\t\tmarginTop: space.large,\n\t\t\t\t\tmarginBottom: space.extraLarge,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<EnturPartnerLogo\n\t\t\t\t\taltText={\"Entur partner logo\"}\n\t\t\t\t\tclassName=\"menu-space menu-logo\"\n\t\t\t\t\tenvironment={environment}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div style={{ margin: space.large }}>\n\t\t\t\t<Stack space=\"small\">\n\t\t\t\t\t<UserMenu\n\t\t\t\t\t\tclassName=\"ph-no-capture\"\n\t\t\t\t\t\tonLocaleChange={setLanguage}\n\t\t\t\t\t\tonLogout={async () => {\n\t\t\t\t\t\t\tawait logout();\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tlocale={locale}\n\t\t\t\t\t\tuserName={\n\t\t\t\t\t\t\tuser.given_name\n\t\t\t\t\t\t\t\t? `${user.given_name} ${user.family_name}`\n\t\t\t\t\t\t\t\t: user.name\n\t\t\t\t\t\t}\n\t\t\t\t\t\tenvironment={environment}\n\t\t\t\t\t\tshowVersionItem={false}\n\t\t\t\t\t\tshowMyProfileItem={false}\n\t\t\t\t\t\tshowCookieSettingsItem={true}\n\t\t\t\t\t\tonCookieSettingsOpen={() => {\n\t\t\t\t\t\t\twindow.UC_UI.showSecondLayer();\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonNavigateToMyProfile={() => {}}\n\t\t\t\t\t/>\n\t\t\t\t\t<OrganisationSelector\n\t\t\t\t\t\tgetOrganisations={getOrganisations}\n\t\t\t\t\t\tgetToken={getToken}\n\t\t\t\t\t\tselectedOrganisationId={organisationId}\n\t\t\t\t\t\tonChange={(organisationId: number) =>\n\t\t\t\t\t\t\tsetOrganisationId(organisationId)\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Stack>\n\t\t\t</div>\n\t\t\t<SideNavigation>\n\t\t\t\t{items.map(({ to, title, disabled, navigate }) => {\n\t\t\t\t\tconst itemProps = {\n\t\t\t\t\t\tas: MicroFrontendLink,\n\t\t\t\t\t\thref: to,\n\t\t\t\t\t\tnavigate: disabled ? null : () => navigate(to),\n\t\t\t\t\t\tdisabled: !!disabled,\n\t\t\t\t\t};\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<SideNavigationItem key={to.toString()} {...itemProps}>\n\t\t\t\t\t\t\t{title}\n\t\t\t\t\t\t</SideNavigationItem>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</SideNavigation>\n\t\t</MenuContainer>\n\t);\n};\n","import {\n\tAppShell,\n\ttype AppShellProps,\n\ttype AppShellValues,\n\ttype GetOrganisationsFn,\n\tLanguageProvider,\n\tlanguageStorage,\n\tMenuProvider,\n\tOrganisationProvider,\n\torganisationStorage,\n\tuseLanguage,\n\tuseMenu,\n\tuseOrganisationId,\n} from \"@entur-partner/app-shell\";\nimport { Content as ContentWrapper, Environment } from \"@entur-partner/common\";\nimport type {\n\tMenuItem,\n\tMicroFrontendPayload,\n} from \"@entur-partner/micro-frontend\";\nimport { assertIsDefined } from \"@entur-partner/util\";\nimport { type ReactNode } from \"react\";\nimport { Menu } from \"./Menu\";\n\ntype ContentProps = {\n\tvalues: AppShellValues;\n\tchildren: (options: MicroFrontendPayload) => ReactNode;\n};\n\nconst Content = ({ children, values }: ContentProps) => {\n\tconst { addItems, setMFNavigate } = useMenu();\n\tconst organisationId = useOrganisationId();\n\tconst { language } = useLanguage();\n\n\tconst addMenuItems = (items: MenuItem[]) => addItems(items, \"app-shell\");\n\n\tassertIsDefined(values.user, \"User must be defined in AppShell\");\n\tassertIsDefined(\n\t\torganisationId,\n\t\t\"Organisation ID must be defined in AppShell\",\n\t);\n\n\treturn (\n\t\t<ContentWrapper>\n\t\t\t{children({\n\t\t\t\t...values,\n\t\t\t\tuser: values.user,\n\t\t\t\tlanguage,\n\t\t\t\tnavigate: () => {\n\t\t\t\t\tif (process.env.NODE_ENV !== \"production\") {\n\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t\"Calling navigate() from app shell has no effect. It is only provided so that the app shell values are equal to MicroFrontendPayload.\",\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\taddMenuItems,\n\t\t\t\torganisationId: organisationId.toString(),\n\t\t\t\tsetMFNavigate: (navigate) => setMFNavigate(\"app-shell\", navigate),\n\t\t\t})}\n\t\t</ContentWrapper>\n\t);\n};\n\nexport interface AppShellStandaloneProps\n\textends Omit<AppShellProps, \"children\"> {\n\tchildren: (options: MicroFrontendPayload) => ReactNode;\n\t/**\n\t * Either a function for fetching organisations or an url where organisations\n\t * can be fetched. Url will be called with access token in header.\n\t */\n\tgetOrganisations: GetOrganisationsFn | string;\n\tenvironment?: Environment;\n\tpostHogApiKey?: string;\n}\n\nexport const AppShellStandalone = ({\n\tchildren,\n\taudience,\n\tdomain,\n\tclientId,\n\tdecorateUser,\n\tgetOrganisations,\n\tredirectUri,\n\tenvironment,\n\tnavigate,\n}: AppShellStandaloneProps) => {\n\treturn (\n\t\t<AppShell\n\t\t\taudience={audience}\n\t\t\tdomain={domain}\n\t\t\tclientId={clientId}\n\t\t\tdecorateUser={decorateUser}\n\t\t\tredirectUri={redirectUri}\n\t\t\tenvironment={environment}\n\t\t\tnavigate={navigate}\n\t\t\tisPublicView={false}\n\t\t>\n\t\t\t{(values) => (\n\t\t\t\t<LanguageProvider language={languageStorage.get() ?? \"nb-NO\"}>\n\t\t\t\t\t<OrganisationProvider\n\t\t\t\t\t\torganisationId={\n\t\t\t\t\t\t\torganisationStorage.get() ??\n\t\t\t\t\t\t\tvalues.user?.[\"https://entur.io/organisationID\"].toString() ??\n\t\t\t\t\t\t\t\"\"\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<MenuProvider>\n\t\t\t\t\t\t\t<Menu\n\t\t\t\t\t\t\t\t{...values}\n\t\t\t\t\t\t\t\tgetOrganisations={getOrganisations}\n\t\t\t\t\t\t\t\tenvironment={environment}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Content values={values}>{children}</Content>\n\t\t\t\t\t\t</MenuProvider>\n\t\t\t\t\t</OrganisationProvider>\n\t\t\t\t</LanguageProvider>\n\t\t\t)}\n\t\t</AppShell>\n\t);\n};\n","/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue(arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(null, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import \"./BetaTopNavigation.scss\";\nimport { SecondaryButton } from \"@entur/button\";\nimport { TopNavigationItem } from \"@entur/menu\";\nimport {\n\tMicroFrontendLink,\n\tuseLanguage,\n\tuseMenu,\n} from \"@entur-partner/app-shell\";\nimport { EnturPartnerLogo, Environment, UserMenu } from \"@entur-partner/common\";\nimport type { User } from \"@entur-partner/micro-frontend\";\nimport classNames from \"classnames\";\nimport React from \"react\";\n\ninterface TopMenuProps {\n\tenvironment?: Environment;\n\tuser?: User;\n\tonLogin: () => void;\n\tonLogout: () => void;\n}\n\nexport const BetaTopNavigation = ({\n\tenvironment,\n\tuser,\n\tonLogin,\n\tonLogout,\n}: TopMenuProps) => {\n\tconst isAuthenticated = !!user;\n\tconst { language, setLanguage } = useLanguage();\n\tconst isFrontpage = window.location.pathname === \"/\";\n\n\tconst { getItemsForPath } = useMenu();\n\tconst items = getItemsForPath(\"app-shell\");\n\n\treturn (\n\t\t<nav\n\t\t\tclassName={classNames(\"top-navigation\", \"eds-contrast\", {\n\t\t\t\t\"top-navigation--frontpage\": isFrontpage,\n\t\t\t})}\n\t\t\taria-label=\"Navigasjon, hovedseksjoner\"\n\t\t>\n\t\t\t<a href=\"/\" className=\"top-navigation__logo\">\n\t\t\t\t<EnturPartnerLogo\n\t\t\t\t\taltText={\"Entur partner logo\"}\n\t\t\t\t\tclassName=\"menu-space menu-logo\"\n\t\t\t\t\tenvironment={environment}\n\t\t\t\t/>\n\t\t\t</a>\n\n\t\t\t{items\n\t\t\t\t.filter(({ isPublic, disabled }) => {\n\t\t\t\t\treturn !disabled && (isPublic || isAuthenticated);\n\t\t\t\t})\n\t\t\t\t.map(({ to, title, navigate }) => (\n\t\t\t\t\t<NavItem key={to.toString()} to={to} navigate={() => navigate(to)}>\n\t\t\t\t\t\t{title}\n\t\t\t\t\t</NavItem>\n\t\t\t\t))}\n\n\t\t\t<div className=\"top-navigation__actions\">\n\t\t\t\t{isAuthenticated ? (\n\t\t\t\t\t<UserMenu\n\t\t\t\t\t\tclassName=\"ph-no-capture\"\n\t\t\t\t\t\tonLocaleChange={setLanguage}\n\t\t\t\t\t\tonLogout={onLogout}\n\t\t\t\t\t\tlocale={language as \"nb-NO\" | \"en-GB\"}\n\t\t\t\t\t\tuserName={user?.name ?? \"\"}\n\t\t\t\t\t\tenvironment={environment}\n\t\t\t\t\t\tshowVersionItem={false}\n\t\t\t\t\t\tshowMyProfileItem={false}\n\t\t\t\t\t\tshowCookieSettingsItem={true}\n\t\t\t\t\t\tonCookieSettingsOpen={() => {\n\t\t\t\t\t\t\twindow.UC_UI.showSecondLayer();\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonNavigateToMyProfile={() => {}}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<SecondaryButton onClick={onLogin} className=\"top-navigation__button\">\n\t\t\t\t\t\t{language === \"nb-NO\" ? \"Logg inn\" : \"Log In\"}\n\t\t\t\t\t</SecondaryButton>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</nav>\n\t);\n};\n\ntype NavItemProps = {\n\tto: string;\n\tnavigate: () => void;\n\tchildren: React.ReactNode;\n};\n\nconst NavItem: React.FC<NavItemProps> = ({ to, navigate, children }) => {\n\tconst isActive = window.location.pathname.startsWith(to);\n\n\treturn (\n\t\t<TopNavigationItem\n\t\t\tas={MicroFrontendLink}\n\t\t\thref={to}\n\t\t\tnavigate={navigate}\n\t\t\tactive={isActive}\n\t\t>\n\t\t\t{children}\n\t\t</TopNavigationItem>\n\t);\n};\n","import {\n\tAppShell,\n\ttype AppShellProps,\n\ttype AppShellValues,\n\tLanguageProvider,\n\tlanguageStorage,\n\tMenuProvider,\n\tuseLanguage,\n\tuseMenu,\n} from \"@entur-partner/app-shell\";\nimport {\n\ttype Environment,\n\tContent as PublicContentWrapper,\n} from \"@entur-partner/common\";\nimport type {\n\tMenuItem,\n\tNavigationFunction,\n\tPublicMicroFrontendPayload,\n} from \"@entur-partner/micro-frontend\";\nimport { type ReactNode } from \"react\";\nimport { BetaTopNavigation } from \"./BetaTopNavigation\";\n\ntype ContentProps = {\n\tvalues: AppShellValues;\n\tchildren: (options: PublicMicroFrontendPayload) => ReactNode;\n};\n\nconst Content = ({ children, values }: ContentProps) => {\n\tconst { addItems, setMFNavigate } = useMenu();\n\tconst { language } = useLanguage();\n\n\tconst addMenuItems = (items: MenuItem[]) => addItems(items, \"app-shell\");\n\n\treturn (\n\t\t<PublicContentWrapper className=\"eps-public-content\">\n\t\t\t{children({\n\t\t\t\t...values,\n\t\t\t\tlanguage,\n\t\t\t\tnavigate: () => {\n\t\t\t\t\tif (process.env.NODE_ENV !== \"production\") {\n\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t\"Calling navigate() from app shell has no effect. It is only provided so that the app shell values are equal to MicroFrontendPayload.\",\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\taddMenuItems,\n\t\t\t\tsetMFNavigate: (navigate: NavigationFunction) =>\n\t\t\t\t\tsetMFNavigate(\"app-shell\", navigate),\n\t\t\t})}\n\t\t</PublicContentWrapper>\n\t);\n};\n\nexport interface PublicAppShellStandaloneProps\n\textends Omit<AppShellProps, \"children\" | \"getOrganisations\"> {\n\tchildren: (options: PublicMicroFrontendPayload) => ReactNode;\n\t/**\n\t * Either a function for fetching organisations or an url where organisations\n\t * can be fetched. Url will be called with access token in header.\n\t */\n\tenvironment?: Environment;\n\tpostHogApiKey?: string;\n}\n\nexport const PublicAppShellStandalone = ({\n\tchildren,\n\taudience,\n\tdomain,\n\tclientId,\n\tdecorateUser,\n\tredirectUri,\n\tenvironment,\n\tnavigate,\n}: PublicAppShellStandaloneProps) => {\n\treturn (\n\t\t<AppShell\n\t\t\taudience={audience}\n\t\t\tdomain={domain}\n\t\t\tclientId={clientId}\n\t\t\tdecorateUser={decorateUser}\n\t\t\tredirectUri={redirectUri}\n\t\t\tnavigate={navigate}\n\t\t\tisPublicView={true}\n\t\t>\n\t\t\t{(values) => (\n\t\t\t\t<LanguageProvider language={languageStorage.get() ?? \"nb-NO\"}>\n\t\t\t\t\t<MenuProvider>\n\t\t\t\t\t\t<BetaTopNavigation\n\t\t\t\t\t\t\tenvironment={environment}\n\t\t\t\t\t\t\tuser={values.user}\n\t\t\t\t\t\t\tonLogin={() => values.loginWithRedirect()}\n\t\t\t\t\t\t\tonLogout={values.logout}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Content values={values}>{children}</Content>\n\t\t\t\t\t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CACvC,CAAE,aAAA,EAAA,EAAA,cAA0B,CAE5B,EAAgB,GAAsB,EAAS,EAAO,YAAY,CAExE,OACC,EAAA,EAAA,KAAC,EAAA,QAAD,CAAsB,UAAU,8BAC9B,EAAS,CACT,GAAG,EACH,WACA,aAAgB,CACf,QAAA,IAAA,WAA6B,cAC5B,QAAQ,KACP,uIACA,EAGH,eACA,cAAgB,GACf,EAAc,YAAa,EAAS,CACrC,CAAC,CACoB,CAAA,EAeZ,GAA4B,CACxC,WACA,WACA,SACA,WACA,eACA,cACA,cACA,eAGC,EAAA,EAAA,KAAC,EAAA,SAAD,CACW,WACF,SACE,WACI,eACD,cACH,WACV,aAAc,YAEZ,IACD,EAAA,EAAA,KAAC,EAAA,iBAAD,CAAkB,SAAU,EAAA,gBAAgB,KAAK,EAAI,kBACpD,EAAA,EAAA,MAAC,EAAA,aAAD,CAAA,SAAA,EACC,EAAA,EAAA,KAAC,EAAD,CACc,cACb,KAAM,EAAO,KACb,YAAe,EAAO,mBAAmB,CACzC,SAAU,EAAO,OAChB,CAAA,EACF,EAAA,EAAA,KAAC,EAAD,CAAiB,SAAS,WAAmB,CAAA,CAC/B,CAAA,CAAA,CACG,CAAA,CAEV,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export type { AppShellValues } from "@entur-partner/app-shell";
2
2
  export type { AppShellStandaloneProps } from "./AppShellStandalone";
3
3
  export { AppShellStandalone } from "./AppShellStandalone";
4
+ export type { PublicAppShellStandaloneProps } from "./PublicAppShellStandalone";
5
+ export { PublicAppShellStandalone } from "./PublicAppShellStandalone";
package/dist/index.mjs CHANGED
@@ -1,10 +1,22 @@
1
1
  import { AppShell as e, LanguageProvider as t, MenuProvider as n, MicroFrontendLink as r, OrganisationProvider as i, OrganisationSelector as a, languageStorage as o, organisationStorage as s, useLanguage as c, useMenu as l, useOrganisation as u, useOrganisationId as d } from "@entur-partner/app-shell";
2
2
  import { Content as f, EnturPartnerLogo as p, Menu as m, Stack as h, UserMenu as g } from "@entur-partner/common";
3
- import { SideNavigation as _, SideNavigationItem as v } from "@entur/menu";
4
- import { space as y } from "@entur/tokens";
5
- import { jsx as b, jsxs as x } from "react/jsx-runtime";
6
- //#region src/Menu.tsx
7
- var S = (e) => {
3
+ import { assertIsDefined as _ } from "@entur-partner/util";
4
+ import { SideNavigation as v, SideNavigationItem as y, TopNavigationItem as b } from "@entur/menu";
5
+ import { space as x } from "@entur/tokens";
6
+ import { jsx as S, jsxs as C } from "react/jsx-runtime";
7
+ import { SecondaryButton as w } from "@entur/button";
8
+ import "react";
9
+ //#region \0rolldown/runtime.js
10
+ var T = Object.create, E = Object.defineProperty, D = Object.getOwnPropertyDescriptor, O = Object.getOwnPropertyNames, k = Object.getPrototypeOf, A = Object.prototype.hasOwnProperty, j = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), M = (e, t, n, r) => {
11
+ if (t && typeof t == "object" || typeof t == "function") for (var i = O(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !A.call(e, s) && s !== n && E(e, s, {
12
+ get: ((e) => t[e]).bind(null, s),
13
+ enumerable: !(r = D(t, s)) || r.enumerable
14
+ });
15
+ return e;
16
+ }, N = (e, t, n) => (n = e == null ? {} : T(k(e)), M(t || !e || !e.__esModule ? E(n, "default", {
17
+ value: e,
18
+ enumerable: !0
19
+ }) : n, e)), P = (e) => {
8
20
  switch (e) {
9
21
  case "nb":
10
22
  case "nb-NO": return "nb-NO";
@@ -12,26 +24,26 @@ var S = (e) => {
12
24
  case "en-GB": return "en-GB";
13
25
  default: return "nb-NO";
14
26
  }
15
- }, C = ({ getOrganisations: e, user: t, getToken: n, logout: i, environment: o }) => {
16
- let { getItemsForPath: s } = l(), { language: d, setLanguage: f } = c(), { setOrganisationId: C, organisationId: w } = u(), T = s("app-shell"), E = S(d);
17
- return /* @__PURE__ */ x(m, { children: [
18
- /* @__PURE__ */ b("div", {
27
+ }, F = ({ getOrganisations: e, user: t, getToken: n, logout: i, environment: o }) => {
28
+ let { getItemsForPath: s } = l(), { language: d, setLanguage: f } = c(), { setOrganisationId: b, organisationId: w } = u(), T = s("app-shell"), E = P(d);
29
+ return _(t, "User must be defined to render Menu"), _(w, "Organisation ID must be defined to render Menu"), /* @__PURE__ */ C(m, { children: [
30
+ /* @__PURE__ */ S("div", {
19
31
  style: {
20
- marginLeft: y.extraLarge2,
21
- marginTop: y.large,
22
- marginBottom: y.extraLarge
32
+ marginLeft: x.extraLarge2,
33
+ marginTop: x.large,
34
+ marginBottom: x.extraLarge
23
35
  },
24
- children: /* @__PURE__ */ b(p, {
36
+ children: /* @__PURE__ */ S(p, {
25
37
  altText: "Entur partner logo",
26
38
  className: "menu-space menu-logo",
27
39
  environment: o
28
40
  })
29
41
  }),
30
- /* @__PURE__ */ b("div", {
31
- style: { margin: y.large },
32
- children: /* @__PURE__ */ x(h, {
42
+ /* @__PURE__ */ S("div", {
43
+ style: { margin: x.large },
44
+ children: /* @__PURE__ */ C(h, {
33
45
  space: "small",
34
- children: [/* @__PURE__ */ b(g, {
46
+ children: [/* @__PURE__ */ S(g, {
35
47
  className: "ph-no-capture",
36
48
  onLocaleChange: f,
37
49
  onLogout: async () => {
@@ -47,15 +59,15 @@ var S = (e) => {
47
59
  window.UC_UI.showSecondLayer();
48
60
  },
49
61
  onNavigateToMyProfile: () => {}
50
- }), /* @__PURE__ */ b(a, {
62
+ }), /* @__PURE__ */ S(a, {
51
63
  getOrganisations: e,
52
64
  getToken: n,
53
65
  selectedOrganisationId: w,
54
- onChange: (e) => C(e)
66
+ onChange: (e) => b(e)
55
67
  })]
56
68
  })
57
69
  }),
58
- /* @__PURE__ */ b(_, { children: T.map(({ to: e, title: t, disabled: n, navigate: i }) => /* @__PURE__ */ b(v, {
70
+ /* @__PURE__ */ S(v, { children: T.map(({ to: e, title: t, disabled: n, navigate: i }) => /* @__PURE__ */ S(y, {
59
71
  as: r,
60
72
  href: e,
61
73
  navigate: n ? null : () => i(e),
@@ -63,10 +75,11 @@ var S = (e) => {
63
75
  children: t
64
76
  }, e.toString())) })
65
77
  ] });
66
- }, w = ({ children: e, values: t }) => {
78
+ }, I = ({ children: e, values: t }) => {
67
79
  let { addItems: n, setMFNavigate: r } = l(), i = d(), { language: a } = c(), o = (e) => n(e, "app-shell");
68
- return /* @__PURE__ */ b(f, { children: e({
80
+ return _(t.user, "User must be defined in AppShell"), _(i, "Organisation ID must be defined in AppShell"), /* @__PURE__ */ S(f, { children: e({
69
81
  ...t,
82
+ user: t.user,
70
83
  language: a,
71
84
  navigate: () => {
72
85
  process.env.NODE_ENV !== "production" && console.warn("Calling navigate() from app shell has no effect. It is only provided so that the app shell values are equal to MicroFrontendPayload.");
@@ -75,7 +88,7 @@ var S = (e) => {
75
88
  organisationId: i.toString(),
76
89
  setMFNavigate: (e) => r("app-shell", e)
77
90
  }) });
78
- }, T = ({ children: r, audience: a, domain: c, clientId: l, decorateUser: u, getOrganisations: d, redirectUri: f, environment: p, navigate: m }) => /* @__PURE__ */ b(e, {
91
+ }, L = ({ children: r, audience: a, domain: c, clientId: l, decorateUser: u, getOrganisations: d, redirectUri: f, environment: p, navigate: m }) => /* @__PURE__ */ S(e, {
79
92
  audience: a,
80
93
  domain: c,
81
94
  clientId: l,
@@ -83,22 +96,133 @@ var S = (e) => {
83
96
  redirectUri: f,
84
97
  environment: p,
85
98
  navigate: m,
86
- children: (e) => /* @__PURE__ */ b(t, {
99
+ isPublicView: !1,
100
+ children: (e) => /* @__PURE__ */ S(t, {
87
101
  language: o.get() ?? "nb-NO",
88
- children: /* @__PURE__ */ b(i, {
89
- organisationId: s.get() ?? e.user["https://entur.io/organisationID"].toString(),
90
- children: /* @__PURE__ */ x(n, { children: [/* @__PURE__ */ b(C, {
102
+ children: /* @__PURE__ */ S(i, {
103
+ organisationId: s.get() ?? e.user?.["https://entur.io/organisationID"].toString() ?? "",
104
+ children: /* @__PURE__ */ C(n, { children: [/* @__PURE__ */ S(F, {
91
105
  ...e,
92
106
  getOrganisations: d,
93
107
  environment: p
94
- }), /* @__PURE__ */ b(w, {
108
+ }), /* @__PURE__ */ S(I, {
95
109
  values: e,
96
110
  children: r
97
111
  })] })
98
112
  })
99
113
  })
114
+ }), R = /* @__PURE__ */ N((/* @__PURE__ */ j(((e, t) => {
115
+ (function() {
116
+ var e = {}.hasOwnProperty;
117
+ function n() {
118
+ for (var e = "", t = 0; t < arguments.length; t++) {
119
+ var n = arguments[t];
120
+ n && (e = i(e, r(n)));
121
+ }
122
+ return e;
123
+ }
124
+ function r(t) {
125
+ if (typeof t == "string" || typeof t == "number") return t;
126
+ if (typeof t != "object") return "";
127
+ if (Array.isArray(t)) return n.apply(null, t);
128
+ if (t.toString !== Object.prototype.toString && !t.toString.toString().includes("[native code]")) return t.toString();
129
+ var r = "";
130
+ for (var a in t) e.call(t, a) && t[a] && (r = i(r, a));
131
+ return r;
132
+ }
133
+ function i(e, t) {
134
+ return t ? e ? e + " " + t : e + t : e;
135
+ }
136
+ t !== void 0 && t.exports ? (n.default = n, t.exports = n) : typeof define == "function" && typeof define.amd == "object" && define.amd ? define("classnames", [], function() {
137
+ return n;
138
+ }) : window.classNames = n;
139
+ })();
140
+ })))(), 1), z = ({ environment: e, user: t, onLogin: n, onLogout: r }) => {
141
+ let i = !!t, { language: a, setLanguage: o } = c(), s = window.location.pathname === "/", { getItemsForPath: u } = l(), d = u("app-shell");
142
+ return /* @__PURE__ */ C("nav", {
143
+ className: (0, R.default)("top-navigation", "eds-contrast", { "top-navigation--frontpage": s }),
144
+ "aria-label": "Navigasjon, hovedseksjoner",
145
+ children: [
146
+ /* @__PURE__ */ S("a", {
147
+ href: "/",
148
+ className: "top-navigation__logo",
149
+ children: /* @__PURE__ */ S(p, {
150
+ altText: "Entur partner logo",
151
+ className: "menu-space menu-logo",
152
+ environment: e
153
+ })
154
+ }),
155
+ d.filter(({ isPublic: e, disabled: t }) => !t && (e || i)).map(({ to: e, title: t, navigate: n }) => /* @__PURE__ */ S(B, {
156
+ to: e,
157
+ navigate: () => n(e),
158
+ children: t
159
+ }, e.toString())),
160
+ /* @__PURE__ */ S("div", {
161
+ className: "top-navigation__actions",
162
+ children: i ? /* @__PURE__ */ S(g, {
163
+ className: "ph-no-capture",
164
+ onLocaleChange: o,
165
+ onLogout: r,
166
+ locale: a,
167
+ userName: t?.name ?? "",
168
+ environment: e,
169
+ showVersionItem: !1,
170
+ showMyProfileItem: !1,
171
+ showCookieSettingsItem: !0,
172
+ onCookieSettingsOpen: () => {
173
+ window.UC_UI.showSecondLayer();
174
+ },
175
+ onNavigateToMyProfile: () => {}
176
+ }) : /* @__PURE__ */ S(w, {
177
+ onClick: n,
178
+ className: "top-navigation__button",
179
+ children: a === "nb-NO" ? "Logg inn" : "Log In"
180
+ })
181
+ })
182
+ ]
183
+ });
184
+ }, B = ({ to: e, navigate: t, children: n }) => /* @__PURE__ */ S(b, {
185
+ as: r,
186
+ href: e,
187
+ navigate: t,
188
+ active: window.location.pathname.startsWith(e),
189
+ children: n
190
+ }), V = ({ children: e, values: t }) => {
191
+ let { addItems: n, setMFNavigate: r } = l(), { language: i } = c(), a = (e) => n(e, "app-shell");
192
+ return /* @__PURE__ */ S(f, {
193
+ className: "eps-public-content",
194
+ children: e({
195
+ ...t,
196
+ language: i,
197
+ navigate: () => {
198
+ process.env.NODE_ENV !== "production" && console.warn("Calling navigate() from app shell has no effect. It is only provided so that the app shell values are equal to MicroFrontendPayload.");
199
+ },
200
+ addMenuItems: a,
201
+ setMFNavigate: (e) => r("app-shell", e)
202
+ })
203
+ });
204
+ }, H = ({ children: r, audience: i, domain: a, clientId: s, decorateUser: c, redirectUri: l, environment: u, navigate: d }) => /* @__PURE__ */ S(e, {
205
+ audience: i,
206
+ domain: a,
207
+ clientId: s,
208
+ decorateUser: c,
209
+ redirectUri: l,
210
+ navigate: d,
211
+ isPublicView: !0,
212
+ children: (e) => /* @__PURE__ */ S(t, {
213
+ language: o.get() ?? "nb-NO",
214
+ children: /* @__PURE__ */ C(n, { children: [/* @__PURE__ */ S(z, {
215
+ environment: u,
216
+ user: e.user,
217
+ onLogin: () => e.loginWithRedirect(),
218
+ onLogout: e.logout
219
+ }), /* @__PURE__ */ S(V, {
220
+ values: e,
221
+ children: r
222
+ })] })
223
+ })
100
224
  });
101
225
  //#endregion
102
- export { T as AppShellStandalone };
226
+ export { L as AppShellStandalone, H as PublicAppShellStandalone };
103
227
 
104
228
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/Menu.tsx","../src/AppShellStandalone.tsx"],"sourcesContent":["import { SideNavigation, SideNavigationItem } from \"@entur/menu\";\nimport { space } from \"@entur/tokens\";\nimport {\n\ttype AppShellValues,\n\ttype GetOrganisationsFn,\n\tMicroFrontendLink,\n\tOrganisationSelector,\n\tuseLanguage,\n\tuseMenu,\n\tuseOrganisation,\n} from \"@entur-partner/app-shell\";\nimport {\n\tEnturPartnerLogo,\n\ttype Environment,\n\tMenu as MenuContainer,\n\tStack,\n\tUserMenu,\n} from \"@entur-partner/common\";\n\ndeclare global {\n\tinterface Window {\n\t\tUC_UI: {\n\t\t\tshowFirstLayer: () => void;\n\t\t\tshowSecondLayer: () => void;\n\t\t};\n\t}\n}\n\ninterface MenuProps extends AppShellValues {\n\tgetOrganisations: GetOrganisationsFn | string;\n\tenvironment?: Environment;\n}\n\nconst convertToLocale = (language: string): \"nb-NO\" | \"en-GB\" => {\n\tswitch (language) {\n\t\tcase \"nb\":\n\t\tcase \"nb-NO\":\n\t\t\treturn \"nb-NO\";\n\t\tcase \"en\":\n\t\tcase \"en-GB\":\n\t\t\treturn \"en-GB\";\n\t\tdefault:\n\t\t\treturn \"nb-NO\";\n\t}\n};\n\nexport const Menu = ({\n\tgetOrganisations,\n\tuser,\n\tgetToken,\n\tlogout,\n\tenvironment,\n}: MenuProps) => {\n\tconst { getItemsForPath } = useMenu();\n\tconst { language, setLanguage } = useLanguage();\n\tconst { setOrganisationId, organisationId } = useOrganisation();\n\tconst items = getItemsForPath(\"app-shell\");\n\tconst locale = convertToLocale(language);\n\n\treturn (\n\t\t<MenuContainer>\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tmarginLeft: space.extraLarge2,\n\t\t\t\t\tmarginTop: space.large,\n\t\t\t\t\tmarginBottom: space.extraLarge,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<EnturPartnerLogo\n\t\t\t\t\taltText={\"Entur partner logo\"}\n\t\t\t\t\tclassName=\"menu-space menu-logo\"\n\t\t\t\t\tenvironment={environment}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div style={{ margin: space.large }}>\n\t\t\t\t<Stack space=\"small\">\n\t\t\t\t\t<UserMenu\n\t\t\t\t\t\tclassName=\"ph-no-capture\"\n\t\t\t\t\t\tonLocaleChange={setLanguage}\n\t\t\t\t\t\tonLogout={async () => {\n\t\t\t\t\t\t\tawait logout();\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tlocale={locale}\n\t\t\t\t\t\tuserName={\n\t\t\t\t\t\t\tuser.given_name\n\t\t\t\t\t\t\t\t? `${user.given_name} ${user.family_name}`\n\t\t\t\t\t\t\t\t: user.name\n\t\t\t\t\t\t}\n\t\t\t\t\t\tenvironment={environment}\n\t\t\t\t\t\tshowVersionItem={false}\n\t\t\t\t\t\tshowMyProfileItem={false}\n\t\t\t\t\t\tshowCookieSettingsItem={true}\n\t\t\t\t\t\tonCookieSettingsOpen={() => {\n\t\t\t\t\t\t\twindow.UC_UI.showSecondLayer();\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonNavigateToMyProfile={() => {}}\n\t\t\t\t\t/>\n\t\t\t\t\t<OrganisationSelector\n\t\t\t\t\t\tgetOrganisations={getOrganisations}\n\t\t\t\t\t\tgetToken={getToken}\n\t\t\t\t\t\tselectedOrganisationId={organisationId}\n\t\t\t\t\t\tonChange={(organisationId: number) =>\n\t\t\t\t\t\t\tsetOrganisationId(organisationId)\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Stack>\n\t\t\t</div>\n\t\t\t<SideNavigation>\n\t\t\t\t{items.map(({ to, title, disabled, navigate }) => {\n\t\t\t\t\tconst itemProps = {\n\t\t\t\t\t\tas: MicroFrontendLink,\n\t\t\t\t\t\thref: to,\n\t\t\t\t\t\tnavigate: disabled ? null : () => navigate(to),\n\t\t\t\t\t\tdisabled: !!disabled,\n\t\t\t\t\t};\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<SideNavigationItem key={to.toString()} {...itemProps}>\n\t\t\t\t\t\t\t{title}\n\t\t\t\t\t\t</SideNavigationItem>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</SideNavigation>\n\t\t</MenuContainer>\n\t);\n};\n","import {\n\tAppShell,\n\ttype AppShellProps,\n\ttype AppShellValues,\n\ttype GetOrganisationsFn,\n\tLanguageProvider,\n\tlanguageStorage,\n\tMenuProvider,\n\tOrganisationProvider,\n\torganisationStorage,\n\tuseLanguage,\n\tuseMenu,\n\tuseOrganisationId,\n} from \"@entur-partner/app-shell\";\nimport {\n\tContent as ContentWrapper,\n\ttype Environment,\n} from \"@entur-partner/common\";\nimport type {\n\tMenuItem,\n\tMicroFrontendPayload,\n} from \"@entur-partner/micro-frontend\";\nimport { type ReactNode } from \"react\";\n\nimport { Menu } from \"./Menu\";\n\ntype ContentProps = {\n\tvalues: AppShellValues;\n\tchildren: (options: MicroFrontendPayload) => ReactNode;\n};\n\nconst Content = ({ children, values }: ContentProps) => {\n\tconst { addItems, setMFNavigate } = useMenu();\n\tconst organisationId = useOrganisationId();\n\tconst { language } = useLanguage();\n\n\tconst addMenuItems = (items: MenuItem[]) => addItems(items, \"app-shell\");\n\n\treturn (\n\t\t<ContentWrapper>\n\t\t\t{children({\n\t\t\t\t...values,\n\t\t\t\tlanguage,\n\t\t\t\tnavigate: () => {\n\t\t\t\t\tif (process.env.NODE_ENV !== \"production\") {\n\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t\"Calling navigate() from app shell has no effect. It is only provided so that the app shell values are equal to MicroFrontendPayload.\",\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\taddMenuItems,\n\t\t\t\torganisationId: organisationId.toString(),\n\t\t\t\tsetMFNavigate: (navigate) => setMFNavigate(\"app-shell\", navigate),\n\t\t\t})}\n\t\t</ContentWrapper>\n\t);\n};\n\nexport interface AppShellStandaloneProps\n\textends Omit<AppShellProps, \"children\"> {\n\tchildren: (options: MicroFrontendPayload) => ReactNode;\n\t/**\n\t * Either a function for fetching organisations or an url where organisations\n\t * can be fetched. Url will be called with access token in header.\n\t */\n\tgetOrganisations: GetOrganisationsFn | string;\n\tenvironment?: Environment;\n\tpostHogApiKey?: string;\n}\n\nexport const AppShellStandalone = ({\n\tchildren,\n\taudience,\n\tdomain,\n\tclientId,\n\tdecorateUser,\n\tgetOrganisations,\n\tredirectUri,\n\tenvironment,\n\tnavigate,\n}: AppShellStandaloneProps) => {\n\treturn (\n\t\t<AppShell\n\t\t\taudience={audience}\n\t\t\tdomain={domain}\n\t\t\tclientId={clientId}\n\t\t\tdecorateUser={decorateUser}\n\t\t\tredirectUri={redirectUri}\n\t\t\tenvironment={environment}\n\t\t\tnavigate={navigate}\n\t\t>\n\t\t\t{(values) => (\n\t\t\t\t<LanguageProvider language={languageStorage.get() ?? \"nb-NO\"}>\n\t\t\t\t\t<OrganisationProvider\n\t\t\t\t\t\torganisationId={\n\t\t\t\t\t\t\torganisationStorage.get() ??\n\t\t\t\t\t\t\tvalues.user[\"https://entur.io/organisationID\"].toString()\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<MenuProvider>\n\t\t\t\t\t\t\t<Menu\n\t\t\t\t\t\t\t\t{...values}\n\t\t\t\t\t\t\t\tgetOrganisations={getOrganisations}\n\t\t\t\t\t\t\t\tenvironment={environment}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Content values={values}>{children}</Content>\n\t\t\t\t\t\t</MenuProvider>\n\t\t\t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9C,UAAU,CAAC,CAAC;aAIV;GACmB,EAFI,EAAG,UAAU,CAEjB,CAErB,EACc,CAAA;EACF,EAAA,CAAA;GC3FZ,KAAW,EAAE,aAAU,gBAA2B;CACvD,IAAM,EAAE,aAAU,qBAAkB,GAAS,EACvC,IAAiB,GAAmB,EACpC,EAAE,gBAAa,GAAa,EAE5B,KAAgB,MAAsB,EAAS,GAAO,YAAY;AAExE,QACC,kBAAC,GAAD,EAAA,UACE,EAAS;EACT,GAAG;EACH;EACA,gBAAgB;AACf,GAAA,QAAA,IAAA,aAA6B,gBAC5B,QAAQ,KACP,uIACA;;EAGH;EACA,gBAAgB,EAAe,UAAU;EACzC,gBAAgB,MAAa,EAAc,aAAa,EAAS;EACjE,CAAC,EACc,CAAA;GAgBN,KAAsB,EAClC,aACA,aACA,WACA,aACA,iBACA,qBACA,gBACA,gBACA,kBAGC,kBAAC,GAAD;CACW;CACF;CACE;CACI;CACD;CACA;CACH;YAER,MACD,kBAAC,GAAD;EAAkB,UAAU,EAAgB,KAAK,IAAI;YACpD,kBAAC,GAAD;GACC,gBACC,EAAoB,KAAK,IACzB,EAAO,KAAK,mCAAmC,UAAU;aAG1D,kBAAC,GAAD,EAAA,UAAA,CACC,kBAAC,GAAD;IACC,GAAI;IACc;IACL;IACZ,CAAA,EACF,kBAAC,GAAD;IAAiB;IAAS;IAAmB,CAAA,CAC/B,EAAA,CAAA;GACO,CAAA;EACL,CAAA;CAEV,CAAA"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/Menu.tsx","../src/AppShellStandalone.tsx","../../../node_modules/classnames/index.js","../src/BetaTopNavigation.tsx","../src/PublicAppShellStandalone.tsx"],"sourcesContent":["import { SideNavigation, SideNavigationItem } from \"@entur/menu\";\nimport { space } from \"@entur/tokens\";\nimport {\n\ttype AppShellValues,\n\ttype GetOrganisationsFn,\n\tMicroFrontendLink,\n\tOrganisationSelector,\n\tuseLanguage,\n\tuseMenu,\n\tuseOrganisation,\n} from \"@entur-partner/app-shell\";\nimport {\n\tEnturPartnerLogo,\n\ttype Environment,\n\tMenu as MenuContainer,\n\tStack,\n\tUserMenu,\n} from \"@entur-partner/common\";\nimport { assertIsDefined } from \"@entur-partner/util\";\n\ndeclare global {\n\tinterface Window {\n\t\tUC_UI: {\n\t\t\tshowFirstLayer: () => void;\n\t\t\tshowSecondLayer: () => void;\n\t\t};\n\t}\n}\n\ninterface MenuProps extends AppShellValues {\n\tgetOrganisations: GetOrganisationsFn | string;\n\tenvironment?: Environment;\n}\n\nconst convertToLocale = (language: string): \"nb-NO\" | \"en-GB\" => {\n\tswitch (language) {\n\t\tcase \"nb\":\n\t\tcase \"nb-NO\":\n\t\t\treturn \"nb-NO\";\n\t\tcase \"en\":\n\t\tcase \"en-GB\":\n\t\t\treturn \"en-GB\";\n\t\tdefault:\n\t\t\treturn \"nb-NO\";\n\t}\n};\n\nexport const Menu = ({\n\tgetOrganisations,\n\tuser,\n\tgetToken,\n\tlogout,\n\tenvironment,\n}: MenuProps) => {\n\tconst { getItemsForPath } = useMenu();\n\tconst { language, setLanguage } = useLanguage();\n\tconst { setOrganisationId, organisationId } = useOrganisation();\n\tconst items = getItemsForPath(\"app-shell\");\n\tconst locale = convertToLocale(language);\n\n\tassertIsDefined(user, \"User must be defined to render Menu\");\n\tassertIsDefined(\n\t\torganisationId,\n\t\t\"Organisation ID must be defined to render Menu\",\n\t);\n\n\treturn (\n\t\t<MenuContainer>\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tmarginLeft: space.extraLarge2,\n\t\t\t\t\tmarginTop: space.large,\n\t\t\t\t\tmarginBottom: space.extraLarge,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<EnturPartnerLogo\n\t\t\t\t\taltText={\"Entur partner logo\"}\n\t\t\t\t\tclassName=\"menu-space menu-logo\"\n\t\t\t\t\tenvironment={environment}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div style={{ margin: space.large }}>\n\t\t\t\t<Stack space=\"small\">\n\t\t\t\t\t<UserMenu\n\t\t\t\t\t\tclassName=\"ph-no-capture\"\n\t\t\t\t\t\tonLocaleChange={setLanguage}\n\t\t\t\t\t\tonLogout={async () => {\n\t\t\t\t\t\t\tawait logout();\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tlocale={locale}\n\t\t\t\t\t\tuserName={\n\t\t\t\t\t\t\tuser.given_name\n\t\t\t\t\t\t\t\t? `${user.given_name} ${user.family_name}`\n\t\t\t\t\t\t\t\t: user.name\n\t\t\t\t\t\t}\n\t\t\t\t\t\tenvironment={environment}\n\t\t\t\t\t\tshowVersionItem={false}\n\t\t\t\t\t\tshowMyProfileItem={false}\n\t\t\t\t\t\tshowCookieSettingsItem={true}\n\t\t\t\t\t\tonCookieSettingsOpen={() => {\n\t\t\t\t\t\t\twindow.UC_UI.showSecondLayer();\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonNavigateToMyProfile={() => {}}\n\t\t\t\t\t/>\n\t\t\t\t\t<OrganisationSelector\n\t\t\t\t\t\tgetOrganisations={getOrganisations}\n\t\t\t\t\t\tgetToken={getToken}\n\t\t\t\t\t\tselectedOrganisationId={organisationId}\n\t\t\t\t\t\tonChange={(organisationId: number) =>\n\t\t\t\t\t\t\tsetOrganisationId(organisationId)\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Stack>\n\t\t\t</div>\n\t\t\t<SideNavigation>\n\t\t\t\t{items.map(({ to, title, disabled, navigate }) => {\n\t\t\t\t\tconst itemProps = {\n\t\t\t\t\t\tas: MicroFrontendLink,\n\t\t\t\t\t\thref: to,\n\t\t\t\t\t\tnavigate: disabled ? null : () => navigate(to),\n\t\t\t\t\t\tdisabled: !!disabled,\n\t\t\t\t\t};\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<SideNavigationItem key={to.toString()} {...itemProps}>\n\t\t\t\t\t\t\t{title}\n\t\t\t\t\t\t</SideNavigationItem>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</SideNavigation>\n\t\t</MenuContainer>\n\t);\n};\n","import {\n\tAppShell,\n\ttype AppShellProps,\n\ttype AppShellValues,\n\ttype GetOrganisationsFn,\n\tLanguageProvider,\n\tlanguageStorage,\n\tMenuProvider,\n\tOrganisationProvider,\n\torganisationStorage,\n\tuseLanguage,\n\tuseMenu,\n\tuseOrganisationId,\n} from \"@entur-partner/app-shell\";\nimport { Content as ContentWrapper, Environment } from \"@entur-partner/common\";\nimport type {\n\tMenuItem,\n\tMicroFrontendPayload,\n} from \"@entur-partner/micro-frontend\";\nimport { assertIsDefined } from \"@entur-partner/util\";\nimport { type ReactNode } from \"react\";\nimport { Menu } from \"./Menu\";\n\ntype ContentProps = {\n\tvalues: AppShellValues;\n\tchildren: (options: MicroFrontendPayload) => ReactNode;\n};\n\nconst Content = ({ children, values }: ContentProps) => {\n\tconst { addItems, setMFNavigate } = useMenu();\n\tconst organisationId = useOrganisationId();\n\tconst { language } = useLanguage();\n\n\tconst addMenuItems = (items: MenuItem[]) => addItems(items, \"app-shell\");\n\n\tassertIsDefined(values.user, \"User must be defined in AppShell\");\n\tassertIsDefined(\n\t\torganisationId,\n\t\t\"Organisation ID must be defined in AppShell\",\n\t);\n\n\treturn (\n\t\t<ContentWrapper>\n\t\t\t{children({\n\t\t\t\t...values,\n\t\t\t\tuser: values.user,\n\t\t\t\tlanguage,\n\t\t\t\tnavigate: () => {\n\t\t\t\t\tif (process.env.NODE_ENV !== \"production\") {\n\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t\"Calling navigate() from app shell has no effect. It is only provided so that the app shell values are equal to MicroFrontendPayload.\",\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\taddMenuItems,\n\t\t\t\torganisationId: organisationId.toString(),\n\t\t\t\tsetMFNavigate: (navigate) => setMFNavigate(\"app-shell\", navigate),\n\t\t\t})}\n\t\t</ContentWrapper>\n\t);\n};\n\nexport interface AppShellStandaloneProps\n\textends Omit<AppShellProps, \"children\"> {\n\tchildren: (options: MicroFrontendPayload) => ReactNode;\n\t/**\n\t * Either a function for fetching organisations or an url where organisations\n\t * can be fetched. Url will be called with access token in header.\n\t */\n\tgetOrganisations: GetOrganisationsFn | string;\n\tenvironment?: Environment;\n\tpostHogApiKey?: string;\n}\n\nexport const AppShellStandalone = ({\n\tchildren,\n\taudience,\n\tdomain,\n\tclientId,\n\tdecorateUser,\n\tgetOrganisations,\n\tredirectUri,\n\tenvironment,\n\tnavigate,\n}: AppShellStandaloneProps) => {\n\treturn (\n\t\t<AppShell\n\t\t\taudience={audience}\n\t\t\tdomain={domain}\n\t\t\tclientId={clientId}\n\t\t\tdecorateUser={decorateUser}\n\t\t\tredirectUri={redirectUri}\n\t\t\tenvironment={environment}\n\t\t\tnavigate={navigate}\n\t\t\tisPublicView={false}\n\t\t>\n\t\t\t{(values) => (\n\t\t\t\t<LanguageProvider language={languageStorage.get() ?? \"nb-NO\"}>\n\t\t\t\t\t<OrganisationProvider\n\t\t\t\t\t\torganisationId={\n\t\t\t\t\t\t\torganisationStorage.get() ??\n\t\t\t\t\t\t\tvalues.user?.[\"https://entur.io/organisationID\"].toString() ??\n\t\t\t\t\t\t\t\"\"\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<MenuProvider>\n\t\t\t\t\t\t\t<Menu\n\t\t\t\t\t\t\t\t{...values}\n\t\t\t\t\t\t\t\tgetOrganisations={getOrganisations}\n\t\t\t\t\t\t\t\tenvironment={environment}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Content values={values}>{children}</Content>\n\t\t\t\t\t\t</MenuProvider>\n\t\t\t\t\t</OrganisationProvider>\n\t\t\t\t</LanguageProvider>\n\t\t\t)}\n\t\t</AppShell>\n\t);\n};\n","/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue(arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(null, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import \"./BetaTopNavigation.scss\";\nimport { SecondaryButton } from \"@entur/button\";\nimport { TopNavigationItem } from \"@entur/menu\";\nimport {\n\tMicroFrontendLink,\n\tuseLanguage,\n\tuseMenu,\n} from \"@entur-partner/app-shell\";\nimport { EnturPartnerLogo, Environment, UserMenu } from \"@entur-partner/common\";\nimport type { User } from \"@entur-partner/micro-frontend\";\nimport classNames from \"classnames\";\nimport React from \"react\";\n\ninterface TopMenuProps {\n\tenvironment?: Environment;\n\tuser?: User;\n\tonLogin: () => void;\n\tonLogout: () => void;\n}\n\nexport const BetaTopNavigation = ({\n\tenvironment,\n\tuser,\n\tonLogin,\n\tonLogout,\n}: TopMenuProps) => {\n\tconst isAuthenticated = !!user;\n\tconst { language, setLanguage } = useLanguage();\n\tconst isFrontpage = window.location.pathname === \"/\";\n\n\tconst { getItemsForPath } = useMenu();\n\tconst items = getItemsForPath(\"app-shell\");\n\n\treturn (\n\t\t<nav\n\t\t\tclassName={classNames(\"top-navigation\", \"eds-contrast\", {\n\t\t\t\t\"top-navigation--frontpage\": isFrontpage,\n\t\t\t})}\n\t\t\taria-label=\"Navigasjon, hovedseksjoner\"\n\t\t>\n\t\t\t<a href=\"/\" className=\"top-navigation__logo\">\n\t\t\t\t<EnturPartnerLogo\n\t\t\t\t\taltText={\"Entur partner logo\"}\n\t\t\t\t\tclassName=\"menu-space menu-logo\"\n\t\t\t\t\tenvironment={environment}\n\t\t\t\t/>\n\t\t\t</a>\n\n\t\t\t{items\n\t\t\t\t.filter(({ isPublic, disabled }) => {\n\t\t\t\t\treturn !disabled && (isPublic || isAuthenticated);\n\t\t\t\t})\n\t\t\t\t.map(({ to, title, navigate }) => (\n\t\t\t\t\t<NavItem key={to.toString()} to={to} navigate={() => navigate(to)}>\n\t\t\t\t\t\t{title}\n\t\t\t\t\t</NavItem>\n\t\t\t\t))}\n\n\t\t\t<div className=\"top-navigation__actions\">\n\t\t\t\t{isAuthenticated ? (\n\t\t\t\t\t<UserMenu\n\t\t\t\t\t\tclassName=\"ph-no-capture\"\n\t\t\t\t\t\tonLocaleChange={setLanguage}\n\t\t\t\t\t\tonLogout={onLogout}\n\t\t\t\t\t\tlocale={language as \"nb-NO\" | \"en-GB\"}\n\t\t\t\t\t\tuserName={user?.name ?? \"\"}\n\t\t\t\t\t\tenvironment={environment}\n\t\t\t\t\t\tshowVersionItem={false}\n\t\t\t\t\t\tshowMyProfileItem={false}\n\t\t\t\t\t\tshowCookieSettingsItem={true}\n\t\t\t\t\t\tonCookieSettingsOpen={() => {\n\t\t\t\t\t\t\twindow.UC_UI.showSecondLayer();\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonNavigateToMyProfile={() => {}}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<SecondaryButton onClick={onLogin} className=\"top-navigation__button\">\n\t\t\t\t\t\t{language === \"nb-NO\" ? \"Logg inn\" : \"Log In\"}\n\t\t\t\t\t</SecondaryButton>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</nav>\n\t);\n};\n\ntype NavItemProps = {\n\tto: string;\n\tnavigate: () => void;\n\tchildren: React.ReactNode;\n};\n\nconst NavItem: React.FC<NavItemProps> = ({ to, navigate, children }) => {\n\tconst isActive = window.location.pathname.startsWith(to);\n\n\treturn (\n\t\t<TopNavigationItem\n\t\t\tas={MicroFrontendLink}\n\t\t\thref={to}\n\t\t\tnavigate={navigate}\n\t\t\tactive={isActive}\n\t\t>\n\t\t\t{children}\n\t\t</TopNavigationItem>\n\t);\n};\n","import {\n\tAppShell,\n\ttype AppShellProps,\n\ttype AppShellValues,\n\tLanguageProvider,\n\tlanguageStorage,\n\tMenuProvider,\n\tuseLanguage,\n\tuseMenu,\n} from \"@entur-partner/app-shell\";\nimport {\n\ttype Environment,\n\tContent as PublicContentWrapper,\n} from \"@entur-partner/common\";\nimport type {\n\tMenuItem,\n\tNavigationFunction,\n\tPublicMicroFrontendPayload,\n} from \"@entur-partner/micro-frontend\";\nimport { type ReactNode } from \"react\";\nimport { BetaTopNavigation } from \"./BetaTopNavigation\";\n\ntype ContentProps = {\n\tvalues: AppShellValues;\n\tchildren: (options: PublicMicroFrontendPayload) => ReactNode;\n};\n\nconst Content = ({ children, values }: ContentProps) => {\n\tconst { addItems, setMFNavigate } = useMenu();\n\tconst { language } = useLanguage();\n\n\tconst addMenuItems = (items: MenuItem[]) => addItems(items, \"app-shell\");\n\n\treturn (\n\t\t<PublicContentWrapper className=\"eps-public-content\">\n\t\t\t{children({\n\t\t\t\t...values,\n\t\t\t\tlanguage,\n\t\t\t\tnavigate: () => {\n\t\t\t\t\tif (process.env.NODE_ENV !== \"production\") {\n\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t\"Calling navigate() from app shell has no effect. It is only provided so that the app shell values are equal to MicroFrontendPayload.\",\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\taddMenuItems,\n\t\t\t\tsetMFNavigate: (navigate: NavigationFunction) =>\n\t\t\t\t\tsetMFNavigate(\"app-shell\", navigate),\n\t\t\t})}\n\t\t</PublicContentWrapper>\n\t);\n};\n\nexport interface PublicAppShellStandaloneProps\n\textends Omit<AppShellProps, \"children\" | \"getOrganisations\"> {\n\tchildren: (options: PublicMicroFrontendPayload) => ReactNode;\n\t/**\n\t * Either a function for fetching organisations or an url where organisations\n\t * can be fetched. Url will be called with access token in header.\n\t */\n\tenvironment?: Environment;\n\tpostHogApiKey?: string;\n}\n\nexport const PublicAppShellStandalone = ({\n\tchildren,\n\taudience,\n\tdomain,\n\tclientId,\n\tdecorateUser,\n\tredirectUri,\n\tenvironment,\n\tnavigate,\n}: PublicAppShellStandaloneProps) => {\n\treturn (\n\t\t<AppShell\n\t\t\taudience={audience}\n\t\t\tdomain={domain}\n\t\t\tclientId={clientId}\n\t\t\tdecorateUser={decorateUser}\n\t\t\tredirectUri={redirectUri}\n\t\t\tnavigate={navigate}\n\t\t\tisPublicView={true}\n\t\t>\n\t\t\t{(values) => (\n\t\t\t\t<LanguageProvider language={languageStorage.get() ?? \"nb-NO\"}>\n\t\t\t\t\t<MenuProvider>\n\t\t\t\t\t\t<BetaTopNavigation\n\t\t\t\t\t\t\tenvironment={environment}\n\t\t\t\t\t\t\tuser={values.user}\n\t\t\t\t\t\t\tonLogin={() => values.loginWithRedirect()}\n\t\t\t\t\t\t\tonLogout={values.logout}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Content values={values}>{children}</Content>\n\t\t\t\t\t</MenuProvider>\n\t\t\t\t</LanguageProvider>\n\t\t\t)}\n\t\t</AppShell>\n\t);\n};\n"],"x_google_ignoreList":[2],"mappings":";;;;;;;;;;;;;;;;;;aAkCM,KAAmB,MAAwC;AAChE,SAAQ,GAAR;EACC,KAAK;EACL,KAAK,QACJ,QAAO;EACR,KAAK;EACL,KAAK,QACJ,QAAO;EACR,QACC,QAAO;;GAIG,KAAQ,EACpB,qBACA,SACA,aACA,WACA,qBACgB;CAChB,IAAM,EAAE,uBAAoB,GAAS,EAC/B,EAAE,aAAU,mBAAgB,GAAa,EACzC,EAAE,sBAAmB,sBAAmB,GAAiB,EACzD,IAAQ,EAAgB,YAAY,EACpC,IAAS,EAAgB,EAAS;AAQxC,QANA,EAAgB,GAAM,sCAAsC,EAC5D,EACC,GACA,iDACA,EAGA,kBAAC,GAAD,EAAA,UAAA;EACC,kBAAC,OAAD;GACC,OAAO;IACN,YAAY,EAAM;IAClB,WAAW,EAAM;IACjB,cAAc,EAAM;IACpB;aAED,kBAAC,GAAD;IACC,SAAS;IACT,WAAU;IACG;IACZ,CAAA;GACG,CAAA;EACN,kBAAC,OAAD;GAAK,OAAO,EAAE,QAAQ,EAAM,OAAO;aAClC,kBAAC,GAAD;IAAO,OAAM;cAAb,CACC,kBAAC,GAAD;KACC,WAAU;KACV,gBAAgB;KAChB,UAAU,YAAY;AACrB,YAAM,GAAQ;;KAEP;KACR,UACC,EAAK,aACF,GAAG,EAAK,WAAW,GAAG,EAAK,gBAC3B,EAAK;KAEI;KACb,iBAAiB;KACjB,mBAAmB;KACnB,wBAAwB;KACxB,4BAA4B;AAC3B,aAAO,MAAM,iBAAiB;;KAE/B,6BAA6B;KAC5B,CAAA,EACF,kBAAC,GAAD;KACmB;KACR;KACV,wBAAwB;KACxB,WAAW,MACV,EAAkB,EAAe;KAEjC,CAAA,CACK;;GACH,CAAA;EACN,kBAAC,GAAD,EAAA,UACE,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AA,CACC,kBAAC,GAAD;GACc;GACb,MAAM,EAAO;GACb,eAAe,EAAO,mBAAmB;GACzC,UAAU,EAAO;GAChB,CAAA,EACF,kBAAC,GAAD;GAAiB;GAAS;GAAmB,CAAA,CAC/B,EAAA,CAAA;EACG,CAAA;CAEV,CAAA"}
@@ -0,0 +1,2 @@
1
+ .top-navigation{border-bottom:.125rem solid var(--designentur-header-default-divider);z-index:20;background:#292b6a;justify-content:flex-start;align-items:center;gap:1.5rem;width:100%;height:5rem;padding-inline:2.5rem;transition:margin-left .1s ease-out;display:flex;position:fixed;top:0;left:0}.top-navigation .eds-top-navigation-item,.top-navigation .eds-top-navigation-item:hover{color:#fff}.top-navigation .eds-top-navigation-item--active{color:#fff;font-weight:700}.top-navigation--frontpage{border-bottom:none}.top-navigation__logo{margin-right:1.5rem}.top-navigation__logo:focus-visible{outline-offset:.125rem;outline:none;box-shadow:0 0 0 .125rem #fff,0 0 0 .25rem #181c56}.top-navigation__actions{align-items:center;margin-left:auto;display:flex}.top-navigation__button{color:#fff}.top-navigation__button:hover{color:#292b6a}.top-navigation #eps-user-menu .eps-user-menu__trigger-button{background:0 0;width:100%}.top-navigation #eps-user-menu .eps-user-menu__trigger-button:hover{background:0 0}@media screen and (width<=1108px){.top-navigation{padding-inline:1.5rem}.top-navigation .eds-top-navigation-item{padding:.75rem;font-size:14px}.top-navigation__logo{margin-right:1.5rem}}
2
+ /*$vite$:1*/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entur-partner/app-shell-standalone",
3
- "version": "7.0.11",
3
+ "version": "7.1.0-alpha.0",
4
4
  "license": "EUPL-1.2",
5
5
  "type": "module",
6
6
  "exports": {
@@ -8,7 +8,8 @@
8
8
  "types": "./dist/index.d.ts",
9
9
  "require": "./dist/index.cjs",
10
10
  "import": "./dist/index.mjs"
11
- }
11
+ },
12
+ "./styles.css": "./dist/styles.css"
12
13
  },
13
14
  "files": [
14
15
  "dist"
@@ -32,8 +33,8 @@
32
33
  "react-dom": ">=18.0.0"
33
34
  },
34
35
  "dependencies": {
35
- "@entur-partner/app-shell": "^6.4.3",
36
- "@entur-partner/common": "^11.2.6",
36
+ "@entur-partner/app-shell": "^6.5.0-alpha.0",
37
+ "@entur-partner/common": "^11.3.0-alpha.0",
37
38
  "posthog-js": "^1.365.5"
38
39
  },
39
40
  "devDependencies": {
@@ -56,5 +57,5 @@
56
57
  "vite": "8.0.8",
57
58
  "vitest": "4.1.3"
58
59
  },
59
- "gitHead": "aeb4721e2f957e3c2df93ce3a5b76838f05a588a"
60
+ "gitHead": "80555bc6012ccbf5221cea5e1199b4b72bd090ae"
60
61
  }