Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@mineiros/vue-drift-widget
Advanced tools
Changelog
[0.0.7] - 2020-03-10
Readme
A cheap (~ 3kb) Vue 3 plugin for the drift.com widget.
To install the latest version:
npm install --save @mineirosio/vue-drift-widget
yarn add @mineirosio/vue-drift-widget
To load the drift widget in your app, load the plugin and set your widget id.
main.ts
:
import { createApp } from 'vue'
import App from './App.vue'
import { createDriftPlugin } from '@mineirosio/vue-drift-widget'
const driftID = 'XXXXXX'
createApp(App)
.use(
createDriftPlugin({
widgetId: driftId,
}),
)
.mount('#app')
The config is a reactive object that will be injected into the app in the plugins install method. This allows us to dynamically enable and disable the widget, which is helpful when you e.g., need to handle GDPR consents.
main.ts
:
import { createApp } from 'vue'
import App from './App.vue'
import { createDriftPlugin } from '@mineirosio/vue-drift-widget'
const driftID = 'XXXXXX'
createApp(App)
.use(
createDriftPlugin({
widgetId: driftId,
enabled: false, // Don't enable the widget per default
}),
)
.mount('#app')
App.vue
:
<template>
<div>
drift configuration {{ driftConfig }}
</div>
<button @click="initDrift()" :disabled="driftConfig.enabled">Initalize Drift</button>
</template>
<script lang="ts">
import { defineComponent, inject} from 'vue'
import { useDriftPluginConfig } from '/drift/index'
export default defineComponent({
name: 'App',
setup() {
const driftConfig = useDriftPluginConfig() // this is a wrapper around inject()
const initDrift = (): void => {
if(driftConfig) {
driftConfig.enabled = true
}
}
return { driftConfig, initDrift }
}
})
</script>
This plugin currently supports most of the API endpoints provided by the widget. For further information on how to interact with the widget, please read the https://devdocs.drift.com/docs/widget-start.
<template>
<p>drift.com example</p>
</template>
<script lang="ts">
import { useDrift } from '/drift/index'
import { defineComponent} from 'vue'
export default defineComponent({
setup() {
const drift = useDrift()
if(drift) {
// api and payload are stronly typed
drift.on('ready', (api, payload) => {
api.openChat();
console.log(api);
console.log(payload);
})
drift.on('message', (data) => {
console.log(data);
})
}
}
})
</script>
For a fully functional example please find example
FAQs
A Vue3 plugin for the drift.com widget
The npm package @mineiros/vue-drift-widget receives a total of 10 weekly downloads. As such, @mineiros/vue-drift-widget popularity was classified as not popular.
We found that @mineiros/vue-drift-widget demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.