![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
@tawasal/vue
Advanced tools
check our Documentation 👉 platform.tawasal.ae
This library provides a set of vue hooks to integrate with the Tawasal SuperApp API, allowing you to interact with various functionalities such as fetching user data, handling clipboard operations, scanning QR codes, and more.
The Tawasal Vue SDK provides hooks for integrating Tawasal SuperApp functionalities into your Vue.js application. These hooks allow you to access various features like user information, contact selection, clipboard reading, haptic feedback, and more.
Install the SDK using npm or yarn:
npm install @tawasal/vue
or
yarn add @tawasal/vue
Below are examples of how to use the different hooks provided by the Tawasal Vue SDK.
useTawasal
This hook fetches the current user's information, photo, and user link.
Example:
<template>
<div>
<div v-if="isLoading">Loading...</div>
<div v-if="error">Error: {{ error.message }}</div>
<div v-if="user">
<h2>User Info</h2>
<p>Name: {{ user.name }}</p>
<p>ID: {{ user.id }}</p>
</div>
<div v-if="avatar">
<img :src="avatar" alt="User Photo" />
</div>
<div v-if="userLink">
<p>User Link: {{ userLink }}</p>
</div>
</div>
</template>
<script setup>
import { useTawasal } from '@tawasal/vue';
const { user, avatar, userLink, error, isLoading } = useTawasal();
</script>
useContacts
This hook allows you to select contacts and fetch their details.
Example:
<template>
<div>
<button @click="triggerSelect('Select a contact')">Select Contacts</button>
<div v-if="isLoading">Loading...</div>
<div v-if="error">Error: {{ error.message }}</div>
<ul v-if="contacts">
<li v-for="contact in contacts" :key="contact.userId">
{{ contact.name }} - <img v-if="contact.photoUrl" :src="contact.photoUrl" alt="Avatar" />
</li>
</ul>
</div>
</template>
<script setup>
import { useContacts } from '@tawasal/vue';
const { contacts, isLoading, error, triggerSelect } = useContacts();
</script>
useClipboard
This hook reads the content of the clipboard.
Example:
<template>
<div>
<button @click="updateClipboard">Read Clipboard</button>
<div v-if="isLoading">Loading...</div>
<div v-if="error">Error: {{ error.message }}</div>
<div v-if="clipboard">Clipboard Content: {{ clipboard }}</div>
</div>
</template>
<script setup>
import { useClipboard } from '@tawasal/vue';
const { clipboard, isLoading, error, updateClipboard } = useClipboard();
</script>
usePhoneNumber
This hook prompts the user to share their phone number for a specified reason.
Example:
<template>
<div>
<button @click="triggerPhonePrompt('Please share your phone number')">Get Phone Number</button>
<div v-if="isLoading">Loading...</div>
<div v-if="error">Error: {{ error.message }}</div>
<div v-if="phone">Phone Number: {{ phone }}</div>
</div>
</template>
<script setup>
import { usePhoneNumber } from '@tawasal/vue';
const { phone, isLoading, error, triggerPhonePrompt } = usePhoneNumber();
</script>
useQR
This hook shows a QR code scanner and retrieves the scanned code.
Example:
<template>
<div>
<button @click="triggerScan">Scan QR Code</button>
<button @click="closeScan">Close QR Scanner</button>
<div v-if="isLoading">Loading...</div>
<div v-if="error">Error: {{ error.message }}</div>
<div v-if="qr">Scanned QR Code: {{ qr }}</div>
</div>
</template>
<script setup>
import { useQR } from '@tawasal/vue';
const { qr, isLoading, error, triggerScan, closeScan } = useQR();
</script>
useTawasalSDK
This hook provides access to general Tawasal SuperApp functionalities like haptic feedback, opening URLs, closing the app, and sharing content.
Example:
<template>
<div>
<button @click="haptic">Haptic Feedback</button>
<button @click="closeApp">Close App</button>
<button @click="shareContent">Share Content</button>
</div>
</template>
<script setup>
import { useTawasalSDK } from '@tawasal/vue';
const { haptic, open, closeApp, share } = useTawasalSDK();
function shareContent() {
share({
text: 'Check this out!',
url: 'https://example.com',
});
}
</script>
useTawasal
Fetches the current user's information, photo, and user link.
user
: The user's contact information.avatar
: The user's photo in base64 format.userLink
: A link to the user's profile.error
: Any error that occurred during the fetch.isLoading
: A boolean indicating whether the data is currently being loaded.useContacts
Allows you to select contacts and fetch their details.
contacts
: An array of selected contacts with extended information.isLoading
: A boolean indicating whether the data is currently being loaded.error
: Any error that occurred during the fetch.triggerSelect(title: string)
: Triggers the contact selection with the specified title.useClipboard
Reads the content of the clipboard.
clipboard
: The content of the clipboard.isLoading
: A boolean indicating whether the data is currently being loaded.error
: Any error that occurred during the fetch.updateClipboard()
: Updates the clipboard content.usePhoneNumber
Prompts the user to share their phone number for a specified reason.
phone
: The user's phone number.isLoading
: A boolean indicating whether the data is currently being loaded.error
: Any error that occurred during the fetch.triggerPhonePrompt(title: string)
: Prompts the user to share their phone number with the specified title.useQR
Shows a QR code scanner and retrieves the scanned code.
qr
: The scanned QR code.isLoading
: A boolean indicating whether the data is currently being loaded.error
: Any error that occurred during the fetch.triggerScan()
: Triggers the QR code scanner.closeScan()
: Closes the QR code scanner.useTawasalSDK
Provides access to general Tawasal SuperApp functionalities.
haptic()
: Triggers haptic feedback.open(url: string)
: Opens the specified URL.closeApp()
: Closes the app.share({ text: string, url: string, imgUrl?: string, isCustomIos?: boolean })
: Shares the specified content.Distributed under the MIT License. See LICENSE for more information.
FAQs
tawasal sdk for vue development
The npm package @tawasal/vue receives a total of 1 weekly downloads. As such, @tawasal/vue popularity was classified as not popular.
We found that @tawasal/vue demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.