@baken667/share-kit
v1.0.1
Published
A simple share utility kit with native and social media share options
Downloads
202
Maintainers
Readme
@baken667/share-kit
@baken667/share-kit
- is a universal sharing package for various platforms such as WhatsApp, Telegram, and native Web Share API. It supports appending UTM parameters to URLs and link formatting.
Installation
Install via npm:
npm install @baken667/share-kit
Or use via CDN:
<script src="https://unpkg.com/@baken667/[email protected]/dist/index.min.js"></script>
Usage
In a typescript/javascript project:
import { share } from '@baken667/share-kit';
share({
url: 'https://example.com',
title: 'Check this out!',
desc: 'Amazing content you will love',
platform: 'whatsapp', // 'telegram', 'native'
utmParams: {
utm_source: 'newsletter',
utm_medium: 'email',
utm_campaign: 'launch'
},
});
Using via CDN:
<script>
ShareKit.share({
url: 'https://example.com',
title: 'Check this out!',
desc: 'Amazing content you will love',
platform: 'telegram', // 'whatsapp', 'native'
})
</script>
Parameters
url
(optional): The URL to share. Defaults to the current page URL.title
(optional): The title of the message.desc
(optional): The description of the message.platform
: The platform for sharing (whatsapp
,telegram
,native
).utmParams
(optional): An object with UTM parameters (utm_source
,utm_medium
,utm_campaign
, etc.).
Supported Platforms
- Telegram
- Native Web Share API (if supported by the browser)
License
This project is licensed under the MIT License. See the MIT License file for more details.
Author
- Github: baken667