@snokam/auth 1.0.8 → 1.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/CHANGELOG.md +19 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.0.10](https://github.com/snokam/components/compare/@snokam/auth@1.0.9...@snokam/auth@1.0.10) (2024-08-28)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @snokam/auth
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.0.9](https://github.com/snokam/components/compare/@snokam/auth@1.0.8...@snokam/auth@1.0.9) (2024-08-28)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* export authenticate on top level ([5ff50dc](https://github.com/snokam/components/commit/5ff50dc99cb11daeb34aecf37a86e5cae8ba5d62))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [1.0.8](https://github.com/snokam/components/compare/@snokam/auth@1.0.7...@snokam/auth@1.0.8) (2024-08-28)
|
|
7
26
|
|
|
8
27
|
|
package/lib/index.d.ts
CHANGED
|
@@ -7,5 +7,6 @@ declare const _default: {
|
|
|
7
7
|
Callback: () => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
Authenticate: (props: Auth.Provider.Props) => import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
};
|
|
10
|
+
Authenticate: (props: Auth.Provider.Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
};
|
|
11
12
|
export default _default;
|
package/lib/index.js
CHANGED
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
flex: 1;
|
|
81
81
|
`,Link:lt().a`
|
|
82
82
|
text-decoration: "underline";
|
|
83
|
-
`},dt=()=>{const{instance:r}=(0,t.useMsal)(),{account:n}=st(),[o,i]=(0,f.useState)();return o?(0,e.jsxs)(ut.Container,{children:[(0,e.jsxs)("p",{children:["En feil oppstod: ",o.errorCode]}),(0,e.jsxs)("span",{children:["Prøv å gå direkte til ",(0,e.jsx)(ut.Link,{target:"_blank",href:"https://skjer.snokam.no/?enforceLogin=true",rel:"noopener noreferrer",children:"skjer.snokam.no"}),"."]})]}):(0,e.jsxs)(ut.Container,{children:["Du må logge inn på nytt for å vise siden",(0,e.jsx)(at,{sx:{marginTop:"1rem"},onClick:()=>{l(),r.loginPopup(Object.assign(Object.assign(Object.assign({},s),n&&{account:n}),{redirectUri:"/blank.html"})).then((()=>i(void 0))).catch((e=>i(e)))},children:"Fortsett"})]})},pt=r=>{const{children:n}=r,{query:a}=(0,i.useRouter)(),c=a.username,d=(null==a?void 0:a.enforceLogin)&&(null==a?void 0:a.username)?o.InteractionType.Silent:o.InteractionType.Redirect,p=Object.assign(Object.assign(Object.assign({},s),c&&{loginHint:c}),{onRedirectNavigate:e=>{l()}});return(0,e.jsx)(t.MsalAuthenticationTemplate,{interactionType:d,authenticationRequest:p,errorComponent:dt,loadingComponent:()=>(0,e.jsx)(u.PageLoader,{color:"inherit"}),children:n})},ft=new o.PublicClientApplication(a);ft.initialize();const ht=r=>{const{children:n,enforceLogin:o}=r,{query:a}=(0,i.useRouter)();if(!process.env.NEXT_PUBLIC_AZURE_AD_CLIENT_ID)throw new Error("NEXT_PUBLIC_AZURE_AD_CLIENT_ID must be set in the environment variables");if(!process.env.NEXT_PUBLIC_AZURE_AD_TENANT_ID)throw new Error("NEXT_PUBLIC_AZURE_AD_TENANT_ID must be set in the environment variables");return a.enforceLogin||o?(0,e.jsx)(t.MsalProvider,{instance:ft,children:(0,e.jsx)(pt,Object.assign({},r,{children:n}))}):(0,e.jsx)(t.MsalProvider,{instance:ft,children:n})};ht.Callback=()=>{const t=(0,i.useRouter)();return(0,f.useEffect)((()=>{const e=window.sessionStorage.getItem(c);e?(window.sessionStorage.removeItem(c),console.log(`Redirecting to ${e} ...`),t.replace(e)):t.replace("/")}),[t]),(0,e.jsx)(u.PageLoader,{color:"inherit"})},ht.Authenticate=pt;const mt={Provider:ht}})(),n})()));
|
|
83
|
+
`},dt=()=>{const{instance:r}=(0,t.useMsal)(),{account:n}=st(),[o,i]=(0,f.useState)();return o?(0,e.jsxs)(ut.Container,{children:[(0,e.jsxs)("p",{children:["En feil oppstod: ",o.errorCode]}),(0,e.jsxs)("span",{children:["Prøv å gå direkte til ",(0,e.jsx)(ut.Link,{target:"_blank",href:"https://skjer.snokam.no/?enforceLogin=true",rel:"noopener noreferrer",children:"skjer.snokam.no"}),"."]})]}):(0,e.jsxs)(ut.Container,{children:["Du må logge inn på nytt for å vise siden",(0,e.jsx)(at,{sx:{marginTop:"1rem"},onClick:()=>{l(),r.loginPopup(Object.assign(Object.assign(Object.assign({},s),n&&{account:n}),{redirectUri:"/blank.html"})).then((()=>i(void 0))).catch((e=>i(e)))},children:"Fortsett"})]})},pt=r=>{const{children:n}=r,{query:a}=(0,i.useRouter)(),c=a.username,d=(null==a?void 0:a.enforceLogin)&&(null==a?void 0:a.username)?o.InteractionType.Silent:o.InteractionType.Redirect,p=Object.assign(Object.assign(Object.assign({},s),c&&{loginHint:c}),{onRedirectNavigate:e=>{l()}});return(0,e.jsx)(t.MsalAuthenticationTemplate,{interactionType:d,authenticationRequest:p,errorComponent:dt,loadingComponent:()=>(0,e.jsx)(u.PageLoader,{color:"inherit"}),children:n})},ft=new o.PublicClientApplication(a);ft.initialize();const ht=r=>{const{children:n,enforceLogin:o}=r,{query:a}=(0,i.useRouter)();if(!process.env.NEXT_PUBLIC_AZURE_AD_CLIENT_ID)throw new Error("NEXT_PUBLIC_AZURE_AD_CLIENT_ID must be set in the environment variables");if(!process.env.NEXT_PUBLIC_AZURE_AD_TENANT_ID)throw new Error("NEXT_PUBLIC_AZURE_AD_TENANT_ID must be set in the environment variables");return a.enforceLogin||o?(0,e.jsx)(t.MsalProvider,{instance:ft,children:(0,e.jsx)(pt,Object.assign({},r,{children:n}))}):(0,e.jsx)(t.MsalProvider,{instance:ft,children:n})};ht.Callback=()=>{const t=(0,i.useRouter)();return(0,f.useEffect)((()=>{const e=window.sessionStorage.getItem(c);e?(window.sessionStorage.removeItem(c),console.log(`Redirecting to ${e} ...`),t.replace(e)):t.replace("/")}),[t]),(0,e.jsx)(u.PageLoader,{color:"inherit"})},ht.Authenticate=pt;const mt={Provider:ht,Authenticate:pt}})(),n})()));
|
|
84
84
|
//# sourceMappingURL=index.js.map
|