@entur-partner/app-shell-standalone 7.0.8 → 7.0.10

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.
package/dist/index.cjs ADDED
@@ -0,0 +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;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +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,kBAAoC,CACzD,EAAQ,EAAgB,YAAY,CACpC,EAAS,EAAgB,EAAS,CAExC,OACC,EAAA,EAAA,MAAC,EAAA,KAAD,CAAA,SAAA,EACC,EAAA,EAAA,KAAC,MAAD,CACC,MAAO,CACN,WAAY,EAAA,MAAM,YAClB,UAAW,EAAA,MAAM,MACjB,aAAc,EAAA,MAAM,WACpB,WAED,EAAA,EAAA,KAAC,EAAA,iBAAD,CACC,QAAS,qBACT,UAAU,uBACG,cACZ,CAAA,CACG,CAAA,EACN,EAAA,EAAA,KAAC,MAAD,CAAK,MAAO,CAAE,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BACA,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"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export { AppShellValues } from "@entur-partner/app-shell";
2
- export { AppShellStandalone, AppShellStandaloneProps, } from "./AppShellStandalone";
1
+ export type { AppShellValues } from "@entur-partner/app-shell";
2
+ export type { AppShellStandaloneProps } from "./AppShellStandalone";
3
+ export { AppShellStandalone } from "./AppShellStandalone";
package/dist/index.mjs ADDED
@@ -0,0 +1,104 @@
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
+ 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) => {
8
+ switch (e) {
9
+ case "nb":
10
+ case "nb-NO": return "nb-NO";
11
+ case "en":
12
+ case "en-GB": return "en-GB";
13
+ default: return "nb-NO";
14
+ }
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", {
19
+ style: {
20
+ marginLeft: y.extraLarge2,
21
+ marginTop: y.large,
22
+ marginBottom: y.extraLarge
23
+ },
24
+ children: /* @__PURE__ */ b(p, {
25
+ altText: "Entur partner logo",
26
+ className: "menu-space menu-logo",
27
+ environment: o
28
+ })
29
+ }),
30
+ /* @__PURE__ */ b("div", {
31
+ style: { margin: y.large },
32
+ children: /* @__PURE__ */ x(h, {
33
+ space: "small",
34
+ children: [/* @__PURE__ */ b(g, {
35
+ className: "ph-no-capture",
36
+ onLocaleChange: f,
37
+ onLogout: async () => {
38
+ await i();
39
+ },
40
+ locale: E,
41
+ userName: t.given_name ? `${t.given_name} ${t.family_name}` : t.name,
42
+ environment: o,
43
+ showVersionItem: !1,
44
+ showMyProfileItem: !1,
45
+ showCookieSettingsItem: !0,
46
+ onCookieSettingsOpen: () => {
47
+ window.UC_UI.showSecondLayer();
48
+ },
49
+ onNavigateToMyProfile: () => {}
50
+ }), /* @__PURE__ */ b(a, {
51
+ getOrganisations: e,
52
+ getToken: n,
53
+ selectedOrganisationId: w,
54
+ onChange: (e) => C(e)
55
+ })]
56
+ })
57
+ }),
58
+ /* @__PURE__ */ b(_, { children: T.map(({ to: e, title: t, disabled: n, navigate: i }) => /* @__PURE__ */ b(v, {
59
+ as: r,
60
+ href: e,
61
+ navigate: n ? null : () => i(e),
62
+ disabled: !!n,
63
+ children: t
64
+ }, e.toString())) })
65
+ ] });
66
+ }, w = ({ children: e, values: t }) => {
67
+ let { addItems: n, setMFNavigate: r } = l(), i = d(), { language: a } = c(), o = (e) => n(e, "app-shell");
68
+ return /* @__PURE__ */ b(f, { children: e({
69
+ ...t,
70
+ language: a,
71
+ navigate: () => {
72
+ 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.");
73
+ },
74
+ addMenuItems: o,
75
+ organisationId: i.toString(),
76
+ setMFNavigate: (e) => r("app-shell", e)
77
+ }) });
78
+ }, T = ({ children: r, audience: a, domain: c, clientId: l, decorateUser: u, getOrganisations: d, redirectUri: f, environment: p, navigate: m }) => /* @__PURE__ */ b(e, {
79
+ audience: a,
80
+ domain: c,
81
+ clientId: l,
82
+ decorateUser: u,
83
+ redirectUri: f,
84
+ environment: p,
85
+ navigate: m,
86
+ children: (e) => /* @__PURE__ */ b(t, {
87
+ 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, {
91
+ ...e,
92
+ getOrganisations: d,
93
+ environment: p
94
+ }), /* @__PURE__ */ b(w, {
95
+ values: e,
96
+ children: r
97
+ })] })
98
+ })
99
+ })
100
+ });
101
+ //#endregion
102
+ export { T as AppShellStandalone };
103
+
104
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +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\t\t</OrganisationProvider>\n\t\t\t\t</LanguageProvider>\n\t\t\t)}\n\t\t</AppShell>\n\t);\n};\n"],"mappings":";;;;;;AAiCA,IAAM,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;AAExC,QACC,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,gB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,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"}
package/package.json CHANGED
@@ -1,10 +1,15 @@
1
1
  {
2
2
  "name": "@entur-partner/app-shell-standalone",
3
- "version": "7.0.8",
3
+ "version": "7.0.10",
4
4
  "license": "EUPL-1.2",
5
- "main": "dist/index.js",
6
- "module": "dist/app-shell-standalone.esm.js",
7
- "typings": "dist/index.d.ts",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "require": "./dist/index.cjs",
10
+ "import": "./dist/index.mjs"
11
+ }
12
+ },
8
13
  "files": [
9
14
  "dist"
10
15
  ],
@@ -17,35 +22,39 @@
17
22
  "access": "public"
18
23
  },
19
24
  "scripts": {
20
- "watch": "dts watch --noClean --verbose",
21
- "build": "dts build",
22
- "test": "dts test --env=jsdom --passWithNoTests",
23
- "lint": "dts lint"
25
+ "build": "vite build && tsc -p tsconfig.build.json",
26
+ "test": "vitest run"
24
27
  },
25
28
  "peerDependencies": {
26
29
  "@entur/icons": ">=7.12.0 <9.0.0",
27
- "@entur/menu": ">=4.0.0 <6.0.0",
30
+ "@entur/menu": ">=4.0.0 <7.0.0",
28
31
  "react": ">=18.0.0",
29
32
  "react-dom": ">=18.0.0"
30
33
  },
31
34
  "dependencies": {
32
- "@entur-partner/app-shell": "^6.4.0",
33
- "@entur-partner/common": "^11.2.3",
35
+ "@entur-partner/app-shell": "^6.4.2",
36
+ "@entur-partner/common": "^11.2.5",
34
37
  "posthog-js": "^1.360.2"
35
38
  },
36
- "jest": {
37
- "globalSetup": "../../global-jest-setup.js",
38
- "setupFilesAfterEnv": [
39
- "./jest-setup.js"
40
- ],
41
- "collectCoverageFrom": [
42
- "<rootDir>/src/**/*.{js,jsx,ts,tsx}"
43
- ]
44
- },
45
- "jestSonar": {
46
- "reportPath": "reports/jest/",
47
- "reportFile": "jest-sonar-report.xml",
48
- "indent": 4
39
+ "devDependencies": {
40
+ "@entur/alert": "0.18.9",
41
+ "@entur/button": "4.0.5",
42
+ "@entur/dropdown": "8.1.1",
43
+ "@entur/expand": "3.7.6",
44
+ "@entur/form": "9.3.1",
45
+ "@entur/icons": "8.4.5",
46
+ "@entur/layout": "3.6.0",
47
+ "@entur/loader": "0.6.6",
48
+ "@entur/menu": "6.1.4",
49
+ "@entur/modal": "1.8.9",
50
+ "@entur/tokens": "3.22.4",
51
+ "@entur/tooltip": "5.3.9",
52
+ "@entur/typography": "2.1.6",
53
+ "react": "19.2.4",
54
+ "react-dom": "19.2.4",
55
+ "typescript": "6.0.2",
56
+ "vite": "8.0.7",
57
+ "vitest": "4.1.3"
49
58
  },
50
- "gitHead": "f79b6300060fee0f71c7e73deeb452ac295a9f36"
59
+ "gitHead": "f22054074acf01a08074d239fa8e366e49cb42a0"
51
60
  }
@@ -1,329 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var jsxRuntime = require('react/jsx-runtime');
6
- var appShell = require('@entur-partner/app-shell');
7
- var common = require('@entur-partner/common');
8
- var menu = require('@entur/menu');
9
- var tokens = require('@entur/tokens');
10
-
11
- function asyncGeneratorStep(n, t, e, r, o, a, c) {
12
- try {
13
- var i = n[a](c),
14
- u = i.value;
15
- } catch (n) {
16
- return void e(n);
17
- }
18
- i.done ? t(u) : Promise.resolve(u).then(r, o);
19
- }
20
- function _asyncToGenerator(n) {
21
- return function () {
22
- var t = this,
23
- e = arguments;
24
- return new Promise(function (r, o) {
25
- var a = n.apply(t, e);
26
- function _next(n) {
27
- asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
28
- }
29
- function _throw(n) {
30
- asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
31
- }
32
- _next(void 0);
33
- });
34
- };
35
- }
36
- function _extends() {
37
- return _extends = Object.assign ? Object.assign.bind() : function (n) {
38
- for (var e = 1; e < arguments.length; e++) {
39
- var t = arguments[e];
40
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
41
- }
42
- return n;
43
- }, _extends.apply(null, arguments);
44
- }
45
- function _regenerator() {
46
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
47
- var e,
48
- t,
49
- r = "function" == typeof Symbol ? Symbol : {},
50
- n = r.iterator || "@@iterator",
51
- o = r.toStringTag || "@@toStringTag";
52
- function i(r, n, o, i) {
53
- var c = n && n.prototype instanceof Generator ? n : Generator,
54
- u = Object.create(c.prototype);
55
- return _regeneratorDefine(u, "_invoke", function (r, n, o) {
56
- var i,
57
- c,
58
- u,
59
- f = 0,
60
- p = o || [],
61
- y = !1,
62
- G = {
63
- p: 0,
64
- n: 0,
65
- v: e,
66
- a: d,
67
- f: d.bind(e, 4),
68
- d: function (t, r) {
69
- return i = t, c = 0, u = e, G.n = r, a;
70
- }
71
- };
72
- function d(r, n) {
73
- for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
74
- var o,
75
- i = p[t],
76
- d = G.p,
77
- l = i[2];
78
- r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
79
- }
80
- if (o || r > 1) return a;
81
- throw y = !0, n;
82
- }
83
- return function (o, p, l) {
84
- if (f > 1) throw TypeError("Generator is already running");
85
- for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
86
- i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
87
- try {
88
- if (f = 2, i) {
89
- if (c || (o = "next"), t = i[o]) {
90
- if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
91
- if (!t.done) return t;
92
- u = t.value, c < 2 && (c = 0);
93
- } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
94
- i = e;
95
- } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
96
- } catch (t) {
97
- i = e, c = 1, u = t;
98
- } finally {
99
- f = 1;
100
- }
101
- }
102
- return {
103
- value: t,
104
- done: y
105
- };
106
- };
107
- }(r, o, i), !0), u;
108
- }
109
- var a = {};
110
- function Generator() {}
111
- function GeneratorFunction() {}
112
- function GeneratorFunctionPrototype() {}
113
- t = Object.getPrototypeOf;
114
- var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
115
- return this;
116
- }), t),
117
- u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
118
- function f(e) {
119
- return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
120
- }
121
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
122
- return this;
123
- }), _regeneratorDefine(u, "toString", function () {
124
- return "[object Generator]";
125
- }), (_regenerator = function () {
126
- return {
127
- w: i,
128
- m: f
129
- };
130
- })();
131
- }
132
- function _regeneratorDefine(e, r, n, t) {
133
- var i = Object.defineProperty;
134
- try {
135
- i({}, "", {});
136
- } catch (e) {
137
- i = 0;
138
- }
139
- _regeneratorDefine = function (e, r, n, t) {
140
- function o(r, n) {
141
- _regeneratorDefine(e, r, function (e) {
142
- return this._invoke(r, n, e);
143
- });
144
- }
145
- r ? i ? i(e, r, {
146
- value: n,
147
- enumerable: !t,
148
- configurable: !t,
149
- writable: !t
150
- }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
151
- }, _regeneratorDefine(e, r, n, t);
152
- }
153
-
154
- var convertToLocale = function convertToLocale(language) {
155
- switch (language) {
156
- case "nb":
157
- case "nb-NO":
158
- return "nb-NO";
159
- case "en":
160
- case "en-GB":
161
- return "en-GB";
162
- default:
163
- return "nb-NO";
164
- }
165
- };
166
- var Menu = function Menu(_ref) {
167
- var getOrganisations = _ref.getOrganisations,
168
- user = _ref.user,
169
- getToken = _ref.getToken,
170
- logout = _ref.logout,
171
- environment = _ref.environment;
172
- var _useMenu = appShell.useMenu(),
173
- getItemsForPath = _useMenu.getItemsForPath;
174
- var _useLanguage = appShell.useLanguage(),
175
- language = _useLanguage.language,
176
- setLanguage = _useLanguage.setLanguage;
177
- var _useOrganisation = appShell.useOrganisation(),
178
- setOrganisationId = _useOrganisation.setOrganisationId,
179
- organisationId = _useOrganisation.organisationId;
180
- var items = getItemsForPath("app-shell");
181
- var locale = convertToLocale(language);
182
- return jsxRuntime.jsxs(common.Menu, {
183
- children: [jsxRuntime.jsx("div", {
184
- style: {
185
- marginLeft: tokens.space.extraLarge2,
186
- marginTop: tokens.space.large,
187
- marginBottom: tokens.space.extraLarge
188
- },
189
- children: jsxRuntime.jsx(common.EnturPartnerLogo, {
190
- altText: "Entur partner logo",
191
- className: "menu-space menu-logo",
192
- environment: environment
193
- })
194
- }), jsxRuntime.jsx("div", {
195
- style: {
196
- margin: tokens.space.large
197
- },
198
- children: jsxRuntime.jsxs(common.Stack, {
199
- space: "small",
200
- children: [jsxRuntime.jsx(common.UserMenu, {
201
- className: "ph-no-capture",
202
- onLocaleChange: setLanguage,
203
- onLogout: function () {
204
- var _onLogout = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
205
- return _regenerator().w(function (_context) {
206
- while (1) switch (_context.n) {
207
- case 0:
208
- _context.n = 1;
209
- return logout();
210
- case 1:
211
- return _context.a(2);
212
- }
213
- }, _callee);
214
- }));
215
- function onLogout() {
216
- return _onLogout.apply(this, arguments);
217
- }
218
- return onLogout;
219
- }(),
220
- locale: locale,
221
- userName: user.given_name ? user.given_name + " " + user.family_name : user.name,
222
- environment: environment,
223
- showVersionItem: false,
224
- showMyProfileItem: false,
225
- showCookieSettingsItem: true,
226
- onCookieSettingsOpen: function onCookieSettingsOpen() {
227
- window.UC_UI.showSecondLayer();
228
- },
229
- onNavigateToMyProfile: function onNavigateToMyProfile() {}
230
- }), jsxRuntime.jsx(appShell.OrganisationSelector, {
231
- getOrganisations: getOrganisations,
232
- getToken: getToken,
233
- selectedOrganisationId: organisationId,
234
- onChange: function onChange(organisationId) {
235
- return setOrganisationId(organisationId);
236
- }
237
- })]
238
- })
239
- }), jsxRuntime.jsx(menu.SideNavigation, {
240
- children: items.map(function (_ref2) {
241
- var to = _ref2.to,
242
- title = _ref2.title,
243
- disabled = _ref2.disabled,
244
- navigate = _ref2.navigate;
245
- var itemProps = {
246
- as: appShell.MicroFrontendLink,
247
- href: to,
248
- navigate: disabled ? null : function () {
249
- return navigate(to);
250
- },
251
- disabled: !!disabled
252
- };
253
- return jsxRuntime.jsx(menu.SideNavigationItem, _extends({}, itemProps, {
254
- children: title
255
- }), to.toString());
256
- })
257
- })]
258
- });
259
- };
260
-
261
- var Content = function Content(_ref) {
262
- var children = _ref.children,
263
- values = _ref.values;
264
- var _useMenu = appShell.useMenu(),
265
- addItems = _useMenu.addItems,
266
- _setMFNavigate = _useMenu.setMFNavigate;
267
- var organisationId = appShell.useOrganisationId();
268
- var _useLanguage = appShell.useLanguage(),
269
- language = _useLanguage.language;
270
- var addMenuItems = function addMenuItems(items) {
271
- return addItems(items, "app-shell");
272
- };
273
- return jsxRuntime.jsx(common.Content, {
274
- children: children(_extends({}, values, {
275
- language: language,
276
- navigate: function navigate() {
277
- {
278
- console.warn("Calling navigate() from app shell has no effect. It is only provided so that the app shell values are equal to MicroFrontendPayload.");
279
- }
280
- },
281
- addMenuItems: addMenuItems,
282
- organisationId: organisationId.toString(),
283
- setMFNavigate: function setMFNavigate(navigate) {
284
- return _setMFNavigate("app-shell", navigate);
285
- }
286
- }))
287
- });
288
- };
289
- var AppShellStandalone = function AppShellStandalone(_ref2) {
290
- var _children = _ref2.children,
291
- audience = _ref2.audience,
292
- domain = _ref2.domain,
293
- clientId = _ref2.clientId,
294
- decorateUser = _ref2.decorateUser,
295
- getOrganisations = _ref2.getOrganisations,
296
- redirectUri = _ref2.redirectUri,
297
- environment = _ref2.environment,
298
- navigate = _ref2.navigate;
299
- return jsxRuntime.jsx(appShell.AppShell, {
300
- audience: audience,
301
- domain: domain,
302
- clientId: clientId,
303
- decorateUser: decorateUser,
304
- redirectUri: redirectUri,
305
- environment: environment,
306
- navigate: navigate,
307
- children: function children(values) {
308
- var _languageStorage$get, _organisationStorage$;
309
- return jsxRuntime.jsx(appShell.LanguageProvider, {
310
- language: (_languageStorage$get = appShell.languageStorage.get()) != null ? _languageStorage$get : "nb-NO",
311
- children: jsxRuntime.jsx(appShell.OrganisationProvider, {
312
- organisationId: (_organisationStorage$ = appShell.organisationStorage.get()) != null ? _organisationStorage$ : values.user["https://entur.io/organisationID"].toString(),
313
- children: jsxRuntime.jsxs(appShell.MenuProvider, {
314
- children: [jsxRuntime.jsx(Menu, _extends({}, values, {
315
- getOrganisations: getOrganisations,
316
- environment: environment
317
- })), jsxRuntime.jsx(Content, {
318
- values: values,
319
- children: _children
320
- })]
321
- })
322
- })
323
- });
324
- }
325
- });
326
- };
327
-
328
- exports.AppShellStandalone = AppShellStandalone;
329
- //# sourceMappingURL=app-shell-standalone.cjs.development.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app-shell-standalone.cjs.development.js","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"],"names":["convertToLocale","language","Menu","_ref","getOrganisations","user","getToken","logout","environment","_useMenu","useMenu","getItemsForPath","_useLanguage","useLanguage","setLanguage","_useOrganisation","useOrganisation","setOrganisationId","organisationId","items","locale","_jsxs","MenuContainer","children","_jsx","style","marginLeft","space","extraLarge2","marginTop","large","marginBottom","extraLarge","EnturPartnerLogo","altText","className","margin","Stack","UserMenu","onLocaleChange","onLogout","_onLogout","_asyncToGenerator","_regenerator","m","_callee","w","_context","n","a","apply","arguments","userName","given_name","family_name","name","showVersionItem","showMyProfileItem","showCookieSettingsItem","onCookieSettingsOpen","window","UC_UI","showSecondLayer","onNavigateToMyProfile","OrganisationSelector","selectedOrganisationId","onChange","SideNavigation","map","_ref2","to","title","disabled","navigate","itemProps","as","MicroFrontendLink","href","SideNavigationItem","_extends","toString","Content","values","addItems","setMFNavigate","useOrganisationId","addMenuItems","ContentWrapper","console","warn","AppShellStandalone","audience","domain","clientId","decorateUser","redirectUri","AppShell","_languageStorage$get","_organisationStorage$","LanguageProvider","languageStorage","get","OrganisationProvider","organisationStorage","MenuProvider"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,IAAMA,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,QAAgB,EAAuB;AAC/D,EAAA,QAAQA,QAAQ;AACf,IAAA,KAAK,IAAI,CAAA;AACT,IAAA,KAAK,OAAO;AACX,MAAA,OAAO,OAAO,CAAA;AACf,IAAA,KAAK,IAAI,CAAA;AACT,IAAA,KAAK,OAAO;AACX,MAAA,OAAO,OAAO,CAAA;AACf,IAAA;AACC,MAAA,OAAO,OAAO,CAAA;AAChB,GAAA;AACD,CAAC,CAAA;AAEM,IAAMC,IAAI,GAAG,SAAPA,IAAIA,CAAAC,IAAA,EAMD;AAAA,EAAA,IALfC,gBAAgB,GAAAD,IAAA,CAAhBC,gBAAgB;IAChBC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IACJC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IACRC,MAAM,GAAAJ,IAAA,CAANI,MAAM;IACNC,WAAW,GAAAL,IAAA,CAAXK,WAAW,CAAA;AAEX,EAAA,IAAAC,QAAA,GAA4BC,gBAAO,EAAE;IAA7BC,eAAe,GAAAF,QAAA,CAAfE,eA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,MAAM;AAAG3D,cAAAA,QAAA,EAAAA,SAAAA;cAAmB,CAAA;WAC/B,CAAA;SAAA,CAAA;QAEE,CAAA;AAAA,KAAA;AACnB,GAAA,CACS,CAAA;AAEb;;;;"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("@entur-partner/app-shell"),t=require("@entur-partner/common"),r=require("@entur/menu"),o=require("@entur/tokens");function a(e,n,t,r,o,a,i){try{var u=e[a](i),s=u.value}catch(e){return void t(e)}u.done?n(s):Promise.resolve(s).then(r,o)}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)({}).hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},i.apply(null,arguments)}function u(){var e,n,t="function"==typeof Symbol?Symbol:{},r=t.iterator||"@@iterator",o=t.toStringTag||"@@toStringTag";function a(t,r,o,a){var u=Object.create((r&&r.prototype instanceof c?r:c).prototype);return s(u,"_invoke",function(t,r,o){var a,u,s,c=0,l=o||[],g=!1,f={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(n,t){return a=n,u=0,s=e,f.n=t,i}};function d(t,r){for(u=t,s=r,n=0;!g&&c&&!o&&n<l.length;n++){var o,a=l[n],d=f.p,p=a[2];t>3?(o=p===r)&&(s=a[(u=a[4])?5:(u=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=t<2&&d<a[1])?(u=0,f.v=r,f.n=a[1]):d<p&&(o=t<3||a[0]>r||r>p)&&(a[4]=t,a[5]=r,f.n=p,u=0))}if(o||t>1)return i;throw g=!0,r}return function(o,l,p){if(c>1)throw TypeError("Generator is already running");for(g&&1===l&&d(l,p),u=l,s=p;(n=u<2?e:s)||!g;){a||(u?u<3?(u>1&&(f.n=-1),d(u,s)):f.n=s:f.v=s);try{if(c=2,a){if(u||(o="next"),n=a[o]){if(!(n=n.call(a,s)))throw TypeError("iterator result is not an object");if(!n.done)return n;s=n.value,u<2&&(u=0)}else 1===u&&(n=a.return)&&n.call(a),u<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),u=1);a=e}else if((n=(g=f.n<0)?s:t.call(r,f))!==i)break}catch(n){a=e,u=1,s=n}finally{c=1}}return{value:n,done:g}}}(t,o,a),!0),u}var i={};function c(){}function l(){}function g(){}n=Object.getPrototypeOf;var f=[][r]?n(n([][r]())):(s(n={},r,function(){return this}),n),d=g.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,s(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=g,s(d,"constructor",g),s(g,"constructor",l),l.displayName="GeneratorFunction",s(g,o,"GeneratorFunction"),s(d),s(d,o,"Generator"),s(d,r,function(){return this}),s(d,"toString",function(){return"[object Generator]"}),(u=function(){return{w:a,m:p}})()}function s(e,n,t,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}s=function(e,n,t,r){function a(n,t){s(e,n,function(e){return this._invoke(n,t,e)})}n?o?o(e,n,{value:t,enumerable:!r,configurable:!r,writable:!r}):e[n]=t:(a("next",0),a("throw",1),a("return",2))},s(e,n,t,r)}var c=function(s){var c,l,g=s.getOrganisations,f=s.user,d=s.getToken,p=s.logout,v=s.environment,h=n.useMenu().getItemsForPath,m=n.useLanguage(),y=m.language,j=m.setLanguage,O=n.useOrganisation(),b=O.setOrganisationId,x=O.organisationId,S=h("app-shell"),w=function(e){switch(e){case"nb":case"nb-NO":default:return"nb-NO";case"en":case"en-GB":return"en-GB"}}(y);return e.jsxs(t.Menu,{children:[e.jsx("div",{style:{marginLeft:o.space.extraLarge2,marginTop:o.space.large,marginBottom:o.space.extraLarge},children:e.jsx(t.EnturPartnerLogo,{altText:"Entur partner logo",className:"menu-space menu-logo",environment:v})}),e.jsx("div",{style:{margin:o.space.large},children:e.jsxs(t.Stack,{space:"small",children:[e.jsx(t.UserMenu,{className:"ph-no-capture",onLocaleChange:j,onLogout:(c=u().m(function e(){return u().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,p();case 1:return e.a(2)}},e)}),l=function(){var e=this,n=arguments;return new Promise(function(t,r){var o=c.apply(e,n);function i(e){a(o,t,r,i,u,"next",e)}function u(e){a(o,t,r,i,u,"throw",e)}i(void 0)})},function(){return l.apply(this,arguments)}),locale:w,userName:f.given_name?f.given_name+" "+f.family_name:f.name,environment:v,showVersionItem:!1,showMyProfileItem:!1,showCookieSettingsItem:!0,onCookieSettingsOpen:function(){window.UC_UI.showSecondLayer()},onNavigateToMyProfile:function(){}}),e.jsx(n.OrganisationSelector,{getOrganisations:g,getToken:d,selectedOrganisationId:x,onChange:function(e){return b(e)}})]})}),e.jsx(r.SideNavigation,{children:S.map(function(t){var o=t.to,a=t.disabled,u=t.navigate;return e.jsx(r.SideNavigationItem,i({},{as:n.MicroFrontendLink,href:o,navigate:a?null:function(){return u(o)},disabled:!!a},{children:t.title}),o.toString())})})]})},l=function(r){var o=r.children,a=r.values,u=n.useMenu(),s=u.addItems,c=u.setMFNavigate,l=n.useOrganisationId(),g=n.useLanguage();return e.jsx(t.Content,{children:o(i({},a,{language:g.language,navigate:function(){},addMenuItems:function(e){return s(e,"app-shell")},organisationId:l.toString(),setMFNavigate:function(e){return c("app-shell",e)}}))})};exports.AppShellStandalone=function(t){var r=t.children,o=t.getOrganisations,a=t.environment;return e.jsx(n.AppShell,{audience:t.audience,domain:t.domain,clientId:t.clientId,decorateUser:t.decorateUser,redirectUri:t.redirectUri,environment:a,navigate:t.navigate,children:function(t){var u,s;return e.jsx(n.LanguageProvider,{language:null!=(u=n.languageStorage.get())?u:"nb-NO",children:e.jsx(n.OrganisationProvider,{organisationId:null!=(s=n.organisationStorage.get())?s:t.user["https://entur.io/organisationID"].toString(),children:e.jsxs(n.MenuProvider,{children:[e.jsx(c,i({},t,{getOrganisations:o,environment:a})),e.jsx(l,{values:t,children:r})]})})})}})};
2
- //# sourceMappingURL=app-shell-standalone.cjs.production.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app-shell-standalone.cjs.production.min.js","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"],"names":["Menu","_ref","_onLogout","getOrganisations","user","getToken","logout","environment","getItemsForPath","useMenu","_useLanguage","useLanguage","language","setLanguage","_useOrganisation","useOrganisation","setOrganisationId","organisationId","items","locale","convertToLocale","_jsxs","MenuContainer","children","_jsx","jsx","style","marginLeft","space","extraLarge2","marginTop","large","marginBottom","extraLarge","EnturPartnerLogo","altText","className","margin","Stack","UserMenu","onLocaleChange","onLogout","_regenerator","m","_callee","w","_context","n","a","apply","this","arguments","userName","given_name","family_name","name","showVersionItem","showMyProfileItem","showCookieSettingsItem","onCookieSettingsOpen","window","UC_UI","showSecondLayer","onNavigateToMyProfile","OrganisationSelector","selectedOrganisationId","onChange","SideNavigation","map","_ref2","to","disabled","navigate","SideNavigationItem","_extends","as","MicroFrontendLink","href","title","toString","Content","values","_useMenu","addItems","setMFNavigate","useOrganisationId","ContentWrapper","addMenuItems","AppShell","audience","domain","clientId","decorateUser","redirectUri","_languageStorage$get","_organisationStorage$","LanguageProvider","languageStorage","get","OrganisationProvider","organisationStorage","jsxs","MenuProvider"],"mappings":"qjFAiCA,IAaaA,EAAO,SAAHC,GAMD,MA2BFC,EAhCbC,EAAgBF,EAAhBE,iBACAC,EAAIH,EAAJG,KACAC,EAAQJ,EAARI,SACAC,EAAML,EAANK,OACAC,EAAWN,EAAXM,YAEQC,EAAoBC,EAAAA,UAApBD,gBACRE,EAAkCC,EAAAA,cAA1BC,EAAQF,EAARE,SAAUC,EAAWH,EAAXG,YAClBC,EAA8CC,EAAAA,kBAAtCC,EAAiBF,EAAjBE,kBAAmBC,EAAcH,EAAdG,eACrBC,EAAQV,EAAgB,aACxBW,EAxBiB,SAACP,GACxB,OAAQA,GACP,IAAK,KACL,IAAK,QAKL,QACC,MAAO,QAJR,IAAK,KACL,IAAK,QACJ,MAAO,QAIV,CAagBQ,CAAgBR,GAE/B,OACCS,EAAAA,KAACC,EAAAA,KACA,CAAAC,SAAA,CAAAC,EAAAC,IAAA,MAAA,CACCC,MAAO,CACNC,WAAYC,EAAKA,MAACC,YAClBC,UAAWF,EAAKA,MAACG,MACjBC,aAAcJ,EAAKA,MAACK,YAGrBV,SAAAC,EAAAC,IAACS,mBACA,CAAAC,QAAS,qBACTC,UAAU,uBACV7B,YAAaA,MAGfiB,EAAAC,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ARC,SAAUC,EAAaF,EAAbE,cACZnE,EAAiBoE,EAAAA,oBACvB3E,EAAqBC,EAAAA,cAIrB,OACCa,EAAAA,IAAC8D,EAAAA,QAAc,CAAA/D,SACbA,EAAQmD,KACLO,EAAM,CACTrE,SARaF,EAARE,SASL4D,SAAU,WAMT,EACDe,aAdkB,SAACrE,GAAiB,OAAKiE,EAASjE,EAAO,YAAY,EAerED,eAAgBA,EAAe8D,WAC/BK,cAAe,SAACZ,GAAQ,OAAKY,EAAc,YAAaZ,EAAS,MAIrE,6BAckC,SAAHH,GAUD,IAT7B9C,EAAQ8C,EAAR9C,SAKApB,EAAgBkE,EAAhBlE,iBAEAI,EAAW8D,EAAX9D,YAGA,OACCiB,EAAAA,IAACgE,EAAAA,SACA,CAAAC,SAXMpB,EAARoB,SAYEC,OAXIrB,EAANqB,OAYEC,SAXMtB,EAARsB,SAYEC,aAXUvB,EAAZuB,aAYEC,YAVSxB,EAAXwB,YAWEtF,YAAaA,EACbiE,SAVMH,EAARG,SAUoBjD,SAEjB,SAAC0D,GAAM,IAAAa,EAAAC,EAAA,OACPvE,EAAAA,IAACwE,EAAAA,iBAAiB,CAAApF,SAA+B,OAAvBkF,EAAEG,EAAeA,gBAACC,OAAKJ,EAAI,QAAOvE,SAC3DC,EAACC,IAAA0E,uBACA,CAAAlF,eAC0B8E,OADZA,EACbK,EAAmBA,oBAACF,OAAKH,EACzBd,EAAO7E,KAAK,mCAAmC2E,WAAUxD,SAG1DF,EAACgF,KAAAC,0BACA9E,EAAAA,IAACxB,EAAI0E,KACAO,EAAM,CACV9E,iBAAkBA,EAClBI,YAAaA,KAEdiB,EAACC,IAAAuD,GAAQC,OAAQA,EAAS1D,SAAAA,UAGV,GAIvB"}
@@ -1,325 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { useMenu, useLanguage, useOrganisation, OrganisationSelector, MicroFrontendLink, AppShell, LanguageProvider, languageStorage, OrganisationProvider, organisationStorage, MenuProvider, useOrganisationId } from '@entur-partner/app-shell';
3
- import { Menu as Menu$1, EnturPartnerLogo, Stack, UserMenu, Content as Content$1 } from '@entur-partner/common';
4
- import { SideNavigation, SideNavigationItem } from '@entur/menu';
5
- import { space } from '@entur/tokens';
6
-
7
- function asyncGeneratorStep(n, t, e, r, o, a, c) {
8
- try {
9
- var i = n[a](c),
10
- u = i.value;
11
- } catch (n) {
12
- return void e(n);
13
- }
14
- i.done ? t(u) : Promise.resolve(u).then(r, o);
15
- }
16
- function _asyncToGenerator(n) {
17
- return function () {
18
- var t = this,
19
- e = arguments;
20
- return new Promise(function (r, o) {
21
- var a = n.apply(t, e);
22
- function _next(n) {
23
- asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
24
- }
25
- function _throw(n) {
26
- asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
27
- }
28
- _next(void 0);
29
- });
30
- };
31
- }
32
- function _extends() {
33
- return _extends = Object.assign ? Object.assign.bind() : function (n) {
34
- for (var e = 1; e < arguments.length; e++) {
35
- var t = arguments[e];
36
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
37
- }
38
- return n;
39
- }, _extends.apply(null, arguments);
40
- }
41
- function _regenerator() {
42
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
43
- var e,
44
- t,
45
- r = "function" == typeof Symbol ? Symbol : {},
46
- n = r.iterator || "@@iterator",
47
- o = r.toStringTag || "@@toStringTag";
48
- function i(r, n, o, i) {
49
- var c = n && n.prototype instanceof Generator ? n : Generator,
50
- u = Object.create(c.prototype);
51
- return _regeneratorDefine(u, "_invoke", function (r, n, o) {
52
- var i,
53
- c,
54
- u,
55
- f = 0,
56
- p = o || [],
57
- y = !1,
58
- G = {
59
- p: 0,
60
- n: 0,
61
- v: e,
62
- a: d,
63
- f: d.bind(e, 4),
64
- d: function (t, r) {
65
- return i = t, c = 0, u = e, G.n = r, a;
66
- }
67
- };
68
- function d(r, n) {
69
- for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
70
- var o,
71
- i = p[t],
72
- d = G.p,
73
- l = i[2];
74
- r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
75
- }
76
- if (o || r > 1) return a;
77
- throw y = !0, n;
78
- }
79
- return function (o, p, l) {
80
- if (f > 1) throw TypeError("Generator is already running");
81
- for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
82
- i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
83
- try {
84
- if (f = 2, i) {
85
- if (c || (o = "next"), t = i[o]) {
86
- if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
87
- if (!t.done) return t;
88
- u = t.value, c < 2 && (c = 0);
89
- } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
90
- i = e;
91
- } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
92
- } catch (t) {
93
- i = e, c = 1, u = t;
94
- } finally {
95
- f = 1;
96
- }
97
- }
98
- return {
99
- value: t,
100
- done: y
101
- };
102
- };
103
- }(r, o, i), !0), u;
104
- }
105
- var a = {};
106
- function Generator() {}
107
- function GeneratorFunction() {}
108
- function GeneratorFunctionPrototype() {}
109
- t = Object.getPrototypeOf;
110
- var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
111
- return this;
112
- }), t),
113
- u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
114
- function f(e) {
115
- return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
116
- }
117
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
118
- return this;
119
- }), _regeneratorDefine(u, "toString", function () {
120
- return "[object Generator]";
121
- }), (_regenerator = function () {
122
- return {
123
- w: i,
124
- m: f
125
- };
126
- })();
127
- }
128
- function _regeneratorDefine(e, r, n, t) {
129
- var i = Object.defineProperty;
130
- try {
131
- i({}, "", {});
132
- } catch (e) {
133
- i = 0;
134
- }
135
- _regeneratorDefine = function (e, r, n, t) {
136
- function o(r, n) {
137
- _regeneratorDefine(e, r, function (e) {
138
- return this._invoke(r, n, e);
139
- });
140
- }
141
- r ? i ? i(e, r, {
142
- value: n,
143
- enumerable: !t,
144
- configurable: !t,
145
- writable: !t
146
- }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
147
- }, _regeneratorDefine(e, r, n, t);
148
- }
149
-
150
- var convertToLocale = function convertToLocale(language) {
151
- switch (language) {
152
- case "nb":
153
- case "nb-NO":
154
- return "nb-NO";
155
- case "en":
156
- case "en-GB":
157
- return "en-GB";
158
- default:
159
- return "nb-NO";
160
- }
161
- };
162
- var Menu = function Menu(_ref) {
163
- var getOrganisations = _ref.getOrganisations,
164
- user = _ref.user,
165
- getToken = _ref.getToken,
166
- logout = _ref.logout,
167
- environment = _ref.environment;
168
- var _useMenu = useMenu(),
169
- getItemsForPath = _useMenu.getItemsForPath;
170
- var _useLanguage = useLanguage(),
171
- language = _useLanguage.language,
172
- setLanguage = _useLanguage.setLanguage;
173
- var _useOrganisation = useOrganisation(),
174
- setOrganisationId = _useOrganisation.setOrganisationId,
175
- organisationId = _useOrganisation.organisationId;
176
- var items = getItemsForPath("app-shell");
177
- var locale = convertToLocale(language);
178
- return jsxs(Menu$1, {
179
- children: [jsx("div", {
180
- style: {
181
- marginLeft: space.extraLarge2,
182
- marginTop: space.large,
183
- marginBottom: space.extraLarge
184
- },
185
- children: jsx(EnturPartnerLogo, {
186
- altText: "Entur partner logo",
187
- className: "menu-space menu-logo",
188
- environment: environment
189
- })
190
- }), jsx("div", {
191
- style: {
192
- margin: space.large
193
- },
194
- children: jsxs(Stack, {
195
- space: "small",
196
- children: [jsx(UserMenu, {
197
- className: "ph-no-capture",
198
- onLocaleChange: setLanguage,
199
- onLogout: function () {
200
- var _onLogout = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
201
- return _regenerator().w(function (_context) {
202
- while (1) switch (_context.n) {
203
- case 0:
204
- _context.n = 1;
205
- return logout();
206
- case 1:
207
- return _context.a(2);
208
- }
209
- }, _callee);
210
- }));
211
- function onLogout() {
212
- return _onLogout.apply(this, arguments);
213
- }
214
- return onLogout;
215
- }(),
216
- locale: locale,
217
- userName: user.given_name ? user.given_name + " " + user.family_name : user.name,
218
- environment: environment,
219
- showVersionItem: false,
220
- showMyProfileItem: false,
221
- showCookieSettingsItem: true,
222
- onCookieSettingsOpen: function onCookieSettingsOpen() {
223
- window.UC_UI.showSecondLayer();
224
- },
225
- onNavigateToMyProfile: function onNavigateToMyProfile() {}
226
- }), jsx(OrganisationSelector, {
227
- getOrganisations: getOrganisations,
228
- getToken: getToken,
229
- selectedOrganisationId: organisationId,
230
- onChange: function onChange(organisationId) {
231
- return setOrganisationId(organisationId);
232
- }
233
- })]
234
- })
235
- }), jsx(SideNavigation, {
236
- children: items.map(function (_ref2) {
237
- var to = _ref2.to,
238
- title = _ref2.title,
239
- disabled = _ref2.disabled,
240
- navigate = _ref2.navigate;
241
- var itemProps = {
242
- as: MicroFrontendLink,
243
- href: to,
244
- navigate: disabled ? null : function () {
245
- return navigate(to);
246
- },
247
- disabled: !!disabled
248
- };
249
- return jsx(SideNavigationItem, _extends({}, itemProps, {
250
- children: title
251
- }), to.toString());
252
- })
253
- })]
254
- });
255
- };
256
-
257
- var Content = function Content(_ref) {
258
- var children = _ref.children,
259
- values = _ref.values;
260
- var _useMenu = useMenu(),
261
- addItems = _useMenu.addItems,
262
- _setMFNavigate = _useMenu.setMFNavigate;
263
- var organisationId = useOrganisationId();
264
- var _useLanguage = useLanguage(),
265
- language = _useLanguage.language;
266
- var addMenuItems = function addMenuItems(items) {
267
- return addItems(items, "app-shell");
268
- };
269
- return jsx(Content$1, {
270
- children: children(_extends({}, values, {
271
- language: language,
272
- navigate: function navigate() {
273
- if (process.env.NODE_ENV !== "production") {
274
- console.warn("Calling navigate() from app shell has no effect. It is only provided so that the app shell values are equal to MicroFrontendPayload.");
275
- }
276
- },
277
- addMenuItems: addMenuItems,
278
- organisationId: organisationId.toString(),
279
- setMFNavigate: function setMFNavigate(navigate) {
280
- return _setMFNavigate("app-shell", navigate);
281
- }
282
- }))
283
- });
284
- };
285
- var AppShellStandalone = function AppShellStandalone(_ref2) {
286
- var _children = _ref2.children,
287
- audience = _ref2.audience,
288
- domain = _ref2.domain,
289
- clientId = _ref2.clientId,
290
- decorateUser = _ref2.decorateUser,
291
- getOrganisations = _ref2.getOrganisations,
292
- redirectUri = _ref2.redirectUri,
293
- environment = _ref2.environment,
294
- navigate = _ref2.navigate;
295
- return jsx(AppShell, {
296
- audience: audience,
297
- domain: domain,
298
- clientId: clientId,
299
- decorateUser: decorateUser,
300
- redirectUri: redirectUri,
301
- environment: environment,
302
- navigate: navigate,
303
- children: function children(values) {
304
- var _languageStorage$get, _organisationStorage$;
305
- return jsx(LanguageProvider, {
306
- language: (_languageStorage$get = languageStorage.get()) != null ? _languageStorage$get : "nb-NO",
307
- children: jsx(OrganisationProvider, {
308
- organisationId: (_organisationStorage$ = organisationStorage.get()) != null ? _organisationStorage$ : values.user["https://entur.io/organisationID"].toString(),
309
- children: jsxs(MenuProvider, {
310
- children: [jsx(Menu, _extends({}, values, {
311
- getOrganisations: getOrganisations,
312
- environment: environment
313
- })), jsx(Content, {
314
- values: values,
315
- children: _children
316
- })]
317
- })
318
- })
319
- });
320
- }
321
- });
322
- };
323
-
324
- export { AppShellStandalone };
325
- //# sourceMappingURL=app-shell-standalone.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app-shell-standalone.esm.js","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"],"names":["convertToLocale","language","Menu","_ref","getOrganisations","user","getToken","logout","environment","_useMenu","useMenu","getItemsForPath","_useLanguage","useLanguage","setLanguage","_useOrganisation","useOrganisation","setOrganisationId","organisationId","items","locale","_jsxs","MenuContainer","children","_jsx","style","marginLeft","space","extraLarge2","marginTop","large","marginBottom","extraLarge","EnturPartnerLogo","altText","className","margin","Stack","UserMenu","onLocaleChange","onLogout","_onLogout","_asyncToGenerator","_regenerator","m","_callee","w","_context","n","a","apply","arguments","userName","given_name","family_name","name","showVersionItem","showMyProfileItem","showCookieSettingsItem","onCookieSettingsOpen","window","UC_UI","showSecondLayer","onNavigateToMyProfile","OrganisationSelector","selectedOrganisationId","onChange","SideNavigation","map","_ref2","to","title","disabled","navigate","itemProps","as","MicroFrontendLink","href","SideNavigationItem","_extends","toString","Content","values","addItems","setMFNavigate","useOrganisationId","addMenuItems","ContentWrapper","process","env","NODE_ENV","console","warn","AppShellStandalone","audience","domain","clientId","decorateUser","redirectUri","AppShell","_languageStorage$get","_organisationStorage$","LanguageProvider","languageStorage","get","OrganisationProvider","organisationStorage","MenuProvider"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,IAAMA,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,QAAgB,EAAuB;AAC/D,EAAA,QAAQA,QAAQ;AACf,IAAA,KAAK,IAAI,CAAA;AACT,IAAA,KAAK,OAAO;AACX,MAAA,OAAO,OAAO,CAAA;AACf,IAAA,KAAK,IAAI,CAAA;AACT,IAAA,KAAK,OAAO;AACX,MAAA,OAAO,OAAO,CAAA;AACf,IAAA;AACC,MAAA,OAAO,OAAO,CAAA;AAChB,GAAA;AACD,CAAC,CAAA;AAEM,IAAMC,IAAI,GAA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BAAmB,CAACF,GAAG,EAAE,KAAAH,IAAAA,GAAAA,qBAAA,GACzBnB,MAAM,CAAC7E,IAAI,CAAC,iCAAiC,CAAC,CAAC2E,QAAQ,EAAE;AAAAzD,UAAAA,QAAA,EAG1DF,IAAC,CAAAsF,YAAY;uBACZnF,GAAC,CAAAtB,IAAI,EAAA6E,QAAA,KACAG,MAAM,EAAA;AACV9E,cAAAA,gBAAgB,EAAEA,gBAAgB;AAClCI,cAAAA,WAAW,EAAEA,WAAAA;AAAW,aAAA,CAAA,CACvB,EACFgB,GAAC,CAAAyD,OAAO;AAACC,cAAAA,MAAM,EAAEA,MAAM;AAAG3D,cAAAA,QAAA,EAAAA,SAAAA;cAAmB,CAAA;WAC/B,CAAA;SAAA,CAAA;QAEE,CAAA;AAAA,KAAA;AACnB,GAAA,CACS,CAAA;AAEb;;;;"}
package/dist/index.js DELETED
@@ -1,8 +0,0 @@
1
-
2
- 'use strict'
3
-
4
- if (process.env.NODE_ENV === 'production') {
5
- module.exports = require('./app-shell-standalone.cjs.production.min.js')
6
- } else {
7
- module.exports = require('./app-shell-standalone.cjs.development.js')
8
- }