@datawheel/bespoke 0.8.0-rc.9 → 0.8.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.
- package/README.md +9 -3
- package/dist/auth.js +2 -2
- package/dist/cms.js +96 -67
- package/dist/explore.js +5 -4
- package/dist/index.js +2 -2
- package/dist/redux-store.js +17 -16
- package/dist/report.js +40 -35
- package/dist/server.js +46 -36
- package/package.json +10 -9
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Reports
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
## EnvVars
|
|
4
|
+
|
|
5
5
|
```
|
|
6
6
|
# Bespoke
|
|
7
7
|
REPORTS_DB_CONNECTION="postgres://user:@localhost:5432/database"
|
|
@@ -9,6 +9,7 @@ REPORTS_LOGGING=true
|
|
|
9
9
|
NEXT_PUBLIC_REPORTS_LOCALE_DEFAULT="en"
|
|
10
10
|
NEXT_PUBLIC_REPORTS_LOCALES="en,es"
|
|
11
11
|
REPORTS_BASE_URL="http://localhost:3000"
|
|
12
|
+
NEXT_PUBLIC_REPORTS_DEBUG=true
|
|
12
13
|
|
|
13
14
|
# Images
|
|
14
15
|
NEXT_PUBLIC_IMAGE_SPLASH_WIDTH=1400
|
|
@@ -30,8 +31,13 @@ AUTH0_ISSUER_BASE_URL="https://xxxxxxx.auth0.com"
|
|
|
30
31
|
AUTH0_CLIENT_ID="xxxxxxxxxxx"
|
|
31
32
|
AUTH0_CLIENT_SECRET="xxxxxxxxxxx"
|
|
32
33
|
|
|
33
|
-
#
|
|
34
|
+
# Requests
|
|
34
35
|
NEXT_PUBLIC_REPORTS_API_FETCH_TIMEOUT=100000
|
|
36
|
+
NEXT_PUBLIC_REPORTS_AXIOS_RETRIES=1
|
|
37
|
+
NEXT_PUBLIC_REPORTS_MAX_CONCURRENT_QUERIES_PER_REPORT=5 (zero means no max).
|
|
38
|
+
|
|
39
|
+
# PDF Service
|
|
40
|
+
NEXT_PUBLIC_PDF_API_URL=[https://screenshots.datawheel.us/rest](https://screenshot-service-dev.datawheel.us/)
|
|
35
41
|
```
|
|
36
42
|
|
|
37
43
|
### Environmental variables into Bespoke Report scope
|
|
@@ -49,4 +55,4 @@ publicRuntimeConfig: {
|
|
|
49
55
|
},
|
|
50
56
|
```
|
|
51
57
|
|
|
52
|
-
And is gonna be offered as ENV_API and ENV_WHATEVER in the list of variables in the profile.
|
|
58
|
+
And is gonna be offered as ENV_API and ENV_WHATEVER in the list of variables in the profile.
|
package/dist/auth.js
CHANGED
|
@@ -6,6 +6,6 @@ import { Menu, Button, Avatar, Text } from '@mantine/core';
|
|
|
6
6
|
import { IconUserCircle, IconLogout, IconEdit } from '@tabler/icons-react';
|
|
7
7
|
import H from 'next/link';
|
|
8
8
|
|
|
9
|
-
function v(){let{update:
|
|
9
|
+
function v(o={required:!1}){let{update:i,data:s,status:a}=useSession(o);return {update:i,user:s?.user,status:a,isLoading:a==="loading"}}var f=v;function w(o){let{SuccessComponent:i,FailureComponent:s}=o,a=new Set(o.allowedRoles);return function(n){let{user:m,status:r}=f(),l=useRouter();if(useEffect(()=>{r==="unauthenticated"&&signIn();},[r,l]),r==="loading")return jsx("div",{children:"Loading..."});if(!m)return jsx(s,{...n});let P=m.bespoke_roles||[];return a.size===0||P.some(t=>a.has(t))?jsx(i,{user:m,...n}):jsx(s,{...n})}}var N=SessionProvider;var p={ADMIN:"Admin",EDITOR:"Editor",WRITER:"Writer"},b={APP:"App",USER:"User"},z=o=>{let i=Object.values(p);return o?o.map(s=>({...s,type:i.includes(s.name)?b.APP:b.USER})):[]};function $({buttonProps:o={},editorMenuItemProps:i={},editorMenuItemRoute:s="/cms",logoutButtonProps:a={},menuProps:U={},options:n="",optionsPosition:m="bottom",translations:r={},withEditorMenuItem:l=!0,withSession:P=!0}){let{user:t,isLoading:x}=f(),S=useMemo(()=>t?.bespoke_roles||[],[t]),k=useMemo(()=>p&&Object.keys(p).length>0&&Object.keys(p).some(y=>S.includes(p[y])),[S]),h={leftIcon:jsx(IconUserCircle,{}),...o};if(t&&!x){let y={...i},M={color:"red",fullWidth:!0,leftIcon:jsx(IconLogout,{size:14}),size:"xs",variant:"subtle",...a},T={shadow:"md",width:"auto",position:"bottom",...U},I=jsx(H,{href:s,passHref:!0,children:jsx(Menu.Item,{icon:jsx(IconEdit,{size:14}),...y,children:r["Go to editor"]||"Go to editor"})});return jsxs(Menu,{...T,children:[jsx(Menu.Target,{children:jsx(Button,{...h,children:`${r["Welcome message"]||`Hi, ${t.name||t.email}`}`})}),jsxs(Menu.Dropdown,{children:[m==="top"&&jsxs(Fragment,{children:[l&&k&&I,n,(n||l&&k)&&jsx(Menu.Divider,{})]}),P&&jsxs(Menu.Item,{component:"span",style:{pointerEvents:"none"},icon:jsx(Avatar,{src:t.picture,radius:"md"}),children:[jsx(Text,{size:"sm",weight:500,children:t.name}),jsx(Text,{color:"dimmed",size:"xs",children:t.email})]}),jsx(Button,{onClick:()=>signOut({callbackUrl:process.env.NEXT_PUBLIC_REPORTS_BASE_URL||"/"}),...M,children:r.Disconnect||"Disconnect"}),m==="bottom"&&jsxs(Fragment,{children:[(n||l&&k)&&jsx(Menu.Divider,{}),l&&k&&I,n]})]})]})}return jsx(Button,{onClick:()=>signIn(),loading:x,...h,children:x?r["Signing in"]||"Signing in...":r["Sign in"]||"Sign in"})}var X=$;
|
|
10
10
|
|
|
11
|
-
export { X as BespokeLoginBtn, N as BespokeUserProvider, w as BespokeWithPageRoleAuthRequired,
|
|
11
|
+
export { X as BespokeLoginBtn, N as BespokeUserProvider, w as BespokeWithPageRoleAuthRequired, p as CMS_ROLES, z as addRoleTypes, f as useBespokeUser };
|