
Security News
pnpm 10.16 Adds New Setting for Delayed Dependency Updates
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
@uniwebcms/module-sdk
Advanced tools
Uniweb Module SDK is an npm module that provides a set of React components and utility functions that can be used to make it easier to create and manage widgets.
Uniweb Module SDK is an npm module that provides a set of React components and utility functions that can be used to make it easier to create and manage widgets.
You can install Uniweb Module SDK via npm by running the following command:
npm install uniweb-module-sdk
Or via yarn:
yarn add uniweb-module-sdk
The DocumentImage
component is used to render an element based on the uploaded assets of the file
field in a profile
section. The asset can be either an image or a file. In the case of a regular file, this component renders an element with preview functionality if applicable. It accepts the following props:
contentType
- The content type of a profile (e.g., 'members', 'units')viewType
- The view type of a profile (e.g., 'profile')contentId
- The ID of a profilevalue
- The value of the file fieldactiveLang
- Specify the language of the value if it is a multi-lingual
fieldclassName
- The className
of the elementfilePreview
- A boolean indicate weather show file preview or notHere's an example of how to use the DocumentImage
component:
import { DocumentImage } from 'uniweb-module-sdk';
function MyComponent() {
return (
<div>
<DocumentImage contentType='docufolio' viewType='profile' contentId='1' value='_fieldValue' activeLang='en' className='xxx' filePreview={true} />
</div>
);
}
The PopoverMenu
component is used to create a quick open menu. It accepts the following props:
trigger
- The trigger element for the menuoptions
- An array of options for the menutriggerClassName
- The class name of the trigger elementposition
- The position property of the opened menuwidth
- The width of the opened menuzIndex
- The zIndex
property of the opened menuHere's an example of how to use the PopoverMenu
component:
import { PopoverMenu } from 'uniweb-module-sdk';
function MyComponent() {
const options = [<div>Option 1</div>, <div>Option 2</div>, <div>Option 2</div>];
return (
<div>
<PopoverMenu trigger={<button>Open Menu</button>} options={options} triggerClassName='px-2 py-1 text-blue-600 text-sm border rounded' position='top-0 left-4' width='200px' zIndex='10' />
</div>
);
}
The SmartLink
component is used to create link element. It accepts the following props:
to
- The href of the linkexternal
- Optional. A boolean explicitly indicating whether this link points outside of uniweb
ariaLabel
- The aria-label
property of the linktitle
- The title
property of the linkIt also accepts the standard properties of React element (e.g., 'className', 'target', 'children', 'onClick')
Here's an example of how to use the PopoverMenu
component:
import { SmartLink } from 'uniweb-module-sdk';
function MyComponent() {
return (
<div>
<SmartLink to='https:...' className='xxx'>
<span>A link</span>
</SmartLink>
</div>
);
}
The ProfileImage
component is used to display a banner or avatar image of a profile
element based on the provided parameters. It accepts the following props:
contentType
- The content type of a profile (e.g., 'members', 'units')viewType
- The view type of a profile (e.g., 'profile')contentId
- the ID of a profileversion
- the version of the imagetype
- the type of the image (e.g., 'banner', 'avatar')Here's an example of how to use the ProfileImage
component:
import { ProfileImage } from 'uniweb-module-sdk';
function MyComponent() {
return (
<div>
<ProfileImage contentType='members' viewType='profile' contentId='1' version='123' type='banner' />
</div>
);
}
The Blogs
component is used to render a page that displays a list of articles and views the content of an individual article. It accepts all the props came from parent element and the following extra props:
recommenderMode
- The mode that indicates the display of either latest blogs
or relative blogs
under the content of a single blog (e.g., 'latest', 'relative')Here's an example of how to use the Blogs
component:
import { Blogs } from 'uniweb-module-sdk';
function MyComponent(props) {
return (
<div>
<Blogs {...props} recommenderMode='relative' />
</div>
);
}
Uniweb SDK also provides several utility functions that can be used to perform common tasks. These functions include:
client
- A function for making AJAX get requestspostClient
- A function for making AJAX post requestslocalize
- A function return the localized string; params: map, defaultValue, language, return_the_first_non_empty_value_if_lang_value_is_empty
getProfiles
- A function for fetching profilesgetProfile
- A function for fetching a single profilegetProfileSection
- A function for fetching a single profile's section datagetListProfileItems
- A function for fetching profiles in a listgetProfileTypes
- A function for fetching the information of a profileHere's examples of how to use these functions:
import{ client, postClient, localize } from 'uniweb-module-sdk';
client
.get('/api/data', {
params: {}
})
.then((response) => console.log(response))
.catch((error) => console.error(error));
postClient
.post('/api', formData)
.then((response) => console.log(response))
.catch((error) => console.error(error));
localize({en: 'Title', fr:'Titre', 'Title', true});
getProfiles('_contentType', '_viewType');
getProfile('_contentType', '_contentId');
getProfileSection('_contentType', '_contentId', '_sectionId');
getListProfileItems('_listId');
getProfileTypes('_contentType', '_viewType');
Uniweb SDK is licensed under the MIT license. See LICENSE for more information.
FAQs
[Uniweb CMS](https://uniwebcms.com) is a **web engine** with advanced built-in intelligence to manage rich data and build websites from templates. The logic that is necessary for creating the user interface of a website exists at the level of **web compon
The npm package @uniwebcms/module-sdk receives a total of 5 weekly downloads. As such, @uniwebcms/module-sdk popularity was classified as not popular.
We found that @uniwebcms/module-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 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
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.