@enquio/vue-popup 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,107 @@
1
+ # @enquio/vue
2
+
3
+ Vue 3 wrapper component for the Enquio popup Web Component. Provides a Vue-idiomatic interface to integrate Enquio popups into your Vue applications.
4
+
5
+ ## 📦 Installation
6
+
7
+ ```bash
8
+ npm install @enquio/vue
9
+ ```
10
+
11
+ ## ✅ Requirements
12
+
13
+ - **Vue**: ^3.2.0
14
+
15
+ ## 🚀 Quick Start
16
+
17
+ ### Basic Usage
18
+
19
+ ```vue
20
+ <script setup>
21
+ import { EnquioPopup } from '@enquio/vue';
22
+
23
+ const projectId = 'your-project-id';
24
+ </script>
25
+
26
+ <template>
27
+ <div>
28
+ <h1>My App</h1>
29
+ <EnquioPopup :projectId="projectId" />
30
+ </div>
31
+ </template>
32
+ ```
33
+
34
+ ### With Composition API
35
+
36
+ ```vue
37
+ <script setup>
38
+ import { ref } from 'vue';
39
+ import { EnquioPopup } from '@enquio/vue';
40
+
41
+ const projectId = ref('your-project-id');
42
+
43
+ const handleSwitch = () => {
44
+ projectId.value = 'different-project-id';
45
+ };
46
+ </script>
47
+
48
+ <template>
49
+ <div>
50
+ <button @click="handleSwitch">Switch Project</button>
51
+ <EnquioPopup :projectId="projectId" />
52
+ </div>
53
+ </template>
54
+ ```
55
+
56
+ ### With Options API
57
+
58
+ ```vue
59
+ <script>
60
+ import { EnquioPopup } from '@enquio/vue';
61
+
62
+ export default {
63
+ components: {
64
+ EnquioPopup,
65
+ },
66
+ data() {
67
+ return {
68
+ projectId: 'your-project-id',
69
+ };
70
+ },
71
+ };
72
+ </script>
73
+
74
+ <template>
75
+ <div>
76
+ <h1>My App</h1>
77
+ <EnquioPopup :projectId="projectId" />
78
+ </div>
79
+ </template>
80
+ ```
81
+
82
+ ## 📖 API
83
+
84
+ ### `EnquioPopup`
85
+
86
+ A Vue component that renders the Enquio popup Web Component.
87
+
88
+ #### Props
89
+
90
+ | Prop | Type | Required | Description |
91
+ |------|------|----------|-------------|
92
+ | `projectId` | `string` | Yes | Your Enquio project ID |
93
+
94
+ #### Example
95
+
96
+ ```vue
97
+ <EnquioPopup projectId="abc-123-def-456" />
98
+ ```
99
+
100
+ ## 🔗 Dependencies
101
+
102
+ - `@enquio/core`: Core script loader
103
+ - `vue`: Peer dependency (must be installed separately)
104
+
105
+ ## 📝 License
106
+
107
+ MIT © Enquio Team
@@ -0,0 +1,31 @@
1
+ import { defineComponent as e, h as t, onMounted as n } from "vue";
2
+ //#region ../core/dist/loader.js
3
+ var r = "https://public.newapp.enquio.eu/popup.js";
4
+ function i() {
5
+ return typeof window > "u" ? Promise.resolve() : (window.__ENQUIO_SCRIPT_PROMISE__ || (window.__ENQUIO_SCRIPT_PROMISE__ = new Promise((e, t) => {
6
+ if (document.getElementById("enquio-popup-script")) {
7
+ e();
8
+ return;
9
+ }
10
+ let n = document.createElement("script");
11
+ n.src = r, n.async = !0, n.id = "enquio-popup-script", n.onload = () => e(), n.onerror = () => t(/* @__PURE__ */ Error("Failed to load Enquio popup")), document.body.appendChild(n);
12
+ })), window.__ENQUIO_SCRIPT_PROMISE__);
13
+ }
14
+ //#endregion
15
+ //#region src/EnquioPopup.vue
16
+ var a = e({
17
+ name: "EnquioPopup",
18
+ props: { projectId: {
19
+ type: String,
20
+ required: !0
21
+ } },
22
+ setup(e) {
23
+ return n(() => {
24
+ i().then(() => customElements.whenDefined("enquio-popup")).catch((e) => console.error("Enquio: script failed to load", e));
25
+ }), () => t("enquio-popup", { "project-id": e.projectId });
26
+ }
27
+ }), o = { install(e) {
28
+ e.component("EnquioPopup", a);
29
+ } };
30
+ //#endregion
31
+ export { a as EnquioPopup, o as default };
@@ -0,0 +1 @@
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`)):typeof define==`function`&&define.amd?define([`exports`,`vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.EnquioVue={},e.Vue))})(this,function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var n=`https://public.newapp.enquio.eu/popup.js`;function r(){return typeof window>`u`?Promise.resolve():(window.__ENQUIO_SCRIPT_PROMISE__||(window.__ENQUIO_SCRIPT_PROMISE__=new Promise((e,t)=>{if(document.getElementById(`enquio-popup-script`)){e();return}let r=document.createElement(`script`);r.src=n,r.async=!0,r.id=`enquio-popup-script`,r.onload=()=>e(),r.onerror=()=>t(Error(`Failed to load Enquio popup`)),document.body.appendChild(r)})),window.__ENQUIO_SCRIPT_PROMISE__)}var i=(0,t.defineComponent)({name:`EnquioPopup`,props:{projectId:{type:String,required:!0}},setup(e){return(0,t.onMounted)(()=>{r().then(()=>customElements.whenDefined(`enquio-popup`)).catch(e=>console.error(`Enquio: script failed to load`,e))}),()=>(0,t.h)(`enquio-popup`,{"project-id":e.projectId})}});e.EnquioPopup=i,e.default={install(e){e.component(`EnquioPopup`,i)}}});
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@enquio/vue-popup",
3
+ "version": "1.0.1",
4
+ "description": "Vue 3 popup component for Enquio Web Component",
5
+ "main": "dist/index.umd.js",
6
+ "module": "dist/index.es.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "sideEffects": false,
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/skutam/EnquioWrappers.git",
15
+ "directory": "packages/vue"
16
+ },
17
+ "homepage": "https://github.com/skutam/EnquioWrappers#readme",
18
+ "bugs": {
19
+ "url": "https://github.com/skutam/EnquioWrappers/issues"
20
+ },
21
+ "keywords": [
22
+ "enquio",
23
+ "popup",
24
+ "vue",
25
+ "vue3",
26
+ "web-component",
27
+ "component"
28
+ ],
29
+ "license": "MIT",
30
+ "author": "Enquio Team",
31
+ "peerDependencies": {
32
+ "vue": "^3.2.0"
33
+ },
34
+ "devDependencies": {
35
+ "vue": "^3.2.0",
36
+ "vite": "8.0.5",
37
+ "typescript": "^5.0.0",
38
+ "@vitejs/plugin-vue": "^5.0.0"
39
+ },
40
+ "dependencies": {
41
+ "@enquio/popup-core": "1.0.0"
42
+ },
43
+ "scripts": {
44
+ "build": "vite build",
45
+ "clean": "rm -rf dist",
46
+ "prepublishOnly": "npm run build"
47
+ }
48
+ }