Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@r2u/react-ar-components
Advanced tools
React components for Augmented Reality on the web.
activateAR
as a fallbackAttention: This component needs the importing of @google/model-viewer
. We suggest it by adding the script to the page HTML, but it's also possible to add via NPM. Please refer to the model-viewer documentation
param | description | default |
---|---|---|
model-viewer default params | Please refer to model-viewer documentation | '' |
ref * | React RefObject to get/set properties of ModelViewer | undefined |
className | React ClassName, same as HTML class | undefined |
style | object containing custom CSS classes to customize this component | undefined |
children | React component to nest inside model-viewer | undefined |
componentDidMount | function to handle mount event | () => undefined |
onClick | function to handle click event | () => undefined |
pan | determines if the model will have pan interaction | true |
*: Prop required to make this wrapper work. Can be passed as follows:
<ModelViewer ref={React.createRef()} {...props} />
param | description | type | default | App |
---|---|---|---|---|
glb | url of the GLB file for Android devices | string | '' | SceneViewer |
usdz | url of the USDZ file for iOS devices | string | '' | QuickLook |
title | Display title of object on model card | string | undefined | SceneViewer |
shareText | String to display when sharing AR experience | string | undefined | Both |
sound | URL to play as sound when model is placed | string | undefined | SceneViewer |
link | Link to show on model card | string | undefined | SceneViewer |
scale | determines if model allows rescale | 'fixed' | 'resizable' | 'fixed' | Both |
placement | determines the plane to render the model | 'floor' | 'wall' | floor | SceneViewer |
disableOcclusion | SceneViewer object blending disabling | boolean | false | SceneViewer |
hashFallback | New window.location.hash when AR cannot load | string | #no-ar-fallback | SceneViewer |
param | description | type | default |
---|---|---|---|
model.glb | Url of the model's GLB file | string | undefined |
model.name | Display title of object on model card | string | undefined |
model.description | Display text of object on model card | string | '' |
model.url | Link to show on model card | string | '' |
model.placement | Determines plane on which the model will be rendered | 'floor' | 'wall' | undefined |
model.resizable | Determines if model allows rescale | boolean | undefined |
beforeClose | Function called before ending the experience* | (container: HTMLElement) => void | defaultBeforeClose |
callToAction | Enable CTA on AR experience | CallToAction | undefined |
*: If provided, beforeClose
function MUST eventually dispatch the event r2u-webxr-close
for the WebXR session to end properly.
import React, { createRef } from 'react'
import ReactDOM from 'react-dom'
import '@google/model-viewer'
import { ModelViewer, activateAR } from '@r2u/react-ar-components'
import type { ModelViewerElement } from '@r2u/react-ar-components'
import style from './style.module.css'
const App: React.FC = () => {
const usdz = 'http://localhost:8080/mesh_01000.usdz'
const glb = 'http://localhost:8080/mesh_01000.glb'
const imageUrl = 'https://via.placeholder.com/150'
const viewerRef = createRef<ModelViewerElement>()
return (
<div>
<div>
<h1>AR</h1>
<button type="button" onClick={() => activateAR({ glb, usdz })}>
View in 3D
</button>
</div>
<div>
<h1>ModelViewer</h1>
<ModelViewer
ref={viewerRef}
src={glb}
alt="3D model"
style={style}
poster={imageUrl}
/>
</div>
</div>
)
}
ReactDOM.render(<App />, document.getElementById('root'))
import React from 'react'
import { activateWebXR } from '@r2u/react-ar-components'
const App: React.FC = () => {
const model = {
resizable: true,
name: 'Chair',
description: 'Comfy chair',
glb:
'http://localhost:8080/mesh_01000.glb',
url: 'https://google.com',
placement: 'floor',
}
return (
<div>
<h1>WebXR</h1>
<button type="button" onClick={() => activateWebXR({ model })}>
Floor
</button>
</div>
)
}
ReactDOM.render(<App />, document.getElementById('root'))
make start
http://localhost:8080
npx localtunnel --port 8080
yarn install
yarn build:app --analyze
Visit http://localhost:8888
yarn install
yarn build:sdk --analyze
Visit http://localhost:8888
FAQs
React components for Augmented Reality on the web.
We found that @r2u/react-ar-components demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.