@@ -18,6 +18,9 @@ import {
1818 IconDeny ,
1919 ModalDialog ,
2020 Progress ,
21+ Tooltip ,
22+ Tag ,
23+ IconWarning
2124} from 'vtex.styleguide'
2225import { useRuntime } from 'vtex.render-runtime'
2326import sessionQuery from 'vtex.store-resources/QuerySession'
@@ -30,6 +33,8 @@ import History from './components/History'
3033import saveMutation from './mutations/saveConfiguration.gql'
3134import GET_LAST from './queries/getLast.gql'
3235import GET_CONFIG from './queries/getConfig.gql'
36+ import getUserPermissions from './queries/getPermissions.gql'
37+
3338
3439const messages = defineMessages ( {
3540 title : {
@@ -93,6 +98,9 @@ const Admin: FC<any & WrappedComponentProps> = ({
9398} : any ) => {
9499 const { workspace, production } = useRuntime ( )
95100
101+
102+ const { data : permission } = useQuery ( getUserPermissions )
103+
96104 const [ state , setState ] = useState < any > ( {
97105 ...defaultConfiguration ,
98106 currentTab : 0 ,
@@ -284,7 +292,9 @@ const Admin: FC<any & WrappedComponentProps> = ({
284292 < div className = "ma3" >
285293 < Button
286294 variation = "primary"
287- disabled = { loadingLast }
295+ disabled = {
296+ permission ?. getPermissions ?. access ? loadingLast : true
297+ }
288298 onClick = { ( ) => {
289299 handlePublish ( )
290300 } }
@@ -293,6 +303,22 @@ const Admin: FC<any & WrappedComponentProps> = ({
293303 </ Button >
294304 </ div >
295305 </ div >
306+
307+ { permission && ! permission ?. getPermissions ?. access && (
308+
309+ < div className = "cb ma3" >
310+ < Tag type = "warning" variation = "low" >
311+ < FormattedMessage id = "admin/checkout-ui.permission-warning" />
312+ < Tooltip label = { < FormattedMessage id = "admin/checkout-ui.permission-tooltip" /> } >
313+ < span className = "ml3 pointer" >
314+ < IconWarning />
315+ </ span >
316+ </ Tooltip >
317+ </ Tag >
318+ </ div >
319+
320+ ) }
321+
296322 </ span >
297323 </ PageHeader >
298324 }
0 commit comments