@wetransform/vue
@wetransform/vue
Vue 3 wrapper around @wetransform/core with a composable API and a component.
SDK Guide — overview of the SDK packages and how to integrate them into your website
Installation
npm install @wetransform/vue
Component usage
<script setup lang="ts">
import { ref } from 'vue'
import { WeTransformSdk } from '@wetransform/vue'
import type { WeTransformConfig, WeTransformSdkProps, SupportedLocales } from '@wetransform/vue'
const isSdkOpen = ref(false)
const locale = ref<SupportedLocales>('en')
const config: WeTransformConfig = {
organizationHandle: 'your_organization_handle',
authentication: {
customerId: 'your_customer_id',
signature: 'your_signed_token',
},
// Optional theming (colors, font, border radius, dark mode). See @wetransform/core docs.
customization: {
colors: {
primary: '#7c3aed',
secondary: '#22d3ee',
background: '#faf5ff',
},
font: {
family: "'Inter', sans-serif",
url: 'https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap',
},
borderRadius: {
button: '8px',
base: '8px',
},
},
}
const onSuccessSubmit: WeTransformSdkProps['onSuccessSubmit'] = ({
customerId,
templateHandle,
fileUrl,
signature,
}) => {
// Handle post-submit
}
</script>
<template>
<button type="button" @click="isSdkOpen = true">Open Sender</button>
<button type="button" @click="locale = locale === 'en' ? 'fr' : 'en'">Toggle locale</button>
<WeTransformSdk
:config="config"
v-model:open="isSdkOpen"
:locale="locale"
@successSubmit="onSuccessSubmit"
/>
</template>
WeTransformSdk is renderless except for its internal mount container and does not expose slots.
Props:
config(required): SDK configuration (excludeslocale; use thelocaleprop instead)open(optional): controlled open state (forv-model:open)autoOpen(optional, defaultfalse): opens on mountlocale(optional): active locale ('en'|'fr'); reactive — changing this prop callssetLocaleon the SDK
Emits:
update:open→(value: boolean)openclosedestroyreadysuccessSubmit→(payload: { customerId: string; templateHandle: string; fileUrl: string; signature: string; userFileName: string })error→(payload: { code: string; message: string; stack?: string })
Composable usage
import { useWeTransform } from '@wetransform/vue'
const { open, close, destroy, setLocale, isOpen, weTransformInstance, on } = useWeTransform({
organizationHandle: 'acme',
authentication: {
customerId: 'customer-id',
signature: 'signed-token',
},
})
on('successSubmit', ({ customerId, templateHandle, fileUrl, signature, userFileName }) => {
// Handle post-submit
})
await open()
await setLocale('fr')
await close()
await destroy()
console.log(isOpen.value)
console.log(weTransformInstance.value)
useWeTransform(config) accepts a plain config object, a Ref<WeTransformConfig>, or a getter () => WeTransformConfig.
useWeTransform(config) returns:
weTransformInstance: readonlyRef<WeTransformInstance | null>isOpen: readonlyRef<boolean>open(): opens the SDKclose(): closes the SDKdestroy(): destroys the SDK instance (idempotent)setLocale(locale): switches the locale ('en'|'fr')on(event, handler): subscribes to SDK events and returns an unsubscribe function
Exports
@wetransform/vue also exports:
WeTransformSdkProps— props type for theWeTransformSdkcomponent
And re-exports these symbols from @wetransform/core:
createWeTransformWeTransformConfigWeTransformEventMapWeTransformInstanceWeTransformInitialLocationsWeTransformSDKCustomizationSupportedLocales
Notes
- Requires Vue
>= 3.5. - Relies on
Promise.withResolvers(ES2024): Chrome/Edge 119+, Firefox 121+, Safari 17.4+. Polyfill it to support older browsers. - Wrapper lifecycle behavior forwards to core and does not modify core semantics.
- The SDK instance is created on mount (never during setup), so the component and composable are SSR-safe: server rendering only produces the container markup. Subscriptions registered with
on()during setup attach automatically once the instance exists. - Component:
configis used at instantiation time. For structural config changes, remount with a Vue:key. - Composable:
config(plain object, ref, or getter) is read each time an instance is created — on mount and again on a recreation afterdestroy(). A live instance does not react to config changes; calldestroy()thenopen()to apply a new config. - The component forces the SDK
mountElementinternally; do not passmountElementinconfig. - The
localeprop (component) andsetLocale(composable) can be called at any time, including before or while the SDK is open.
Related Packages
@viostream/viostream-player-vue
Vue 3 SDK for the Viostream video player — embed, control, and listen to player...
1,617
@openai-lite/chatui
Official ChatUI host SDK. Drop an assistant onto existing Vue, React, or vanilla...
0
vue-lite-youtube-embed
A private by default, faster and cleaner YouTube embed component for Vue applica...
215,443
63
Version History
| Version | Released | License |
|---|---|---|
| 3.3.0 | ISC | |
| 3.2.0 | ISC | |
| 3.1.0 | ISC | |
| 3.0.0 | ISC | |
| 2.1.0 | ISC | |
| 2.0.1 | ISC | |
| 2.0.0 | ISC | |
| 1.7.0 | ISC | |
| 1.6.0 | ISC | |
| 1.5.5 | ISC | |
| 1.5.4 | ISC | |
| 1.5.3 | ISC | |
| 1.5.2 | ISC | |
| 1.5.1 | ISC | |
| 1.5.0 | ISC | |
| 1.4.0 | ISC | |
| 1.3.0 | ISC | |
| 1.2.3 | ISC | |
| 1.2.2 | ISC | |
| 1.2.1 | ISC | |
| 1.2.0 | ISC | |
| 1.1.2 | ISC | |
| 1.1.1 | ISC | |
| 1.1.0 | ISC | |
| 1.0.1 | ISC | |
| 1.0.0 | ISC |