@lapwy/vue 0.0.0-stage → 0.1.0
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 +23 -2
- package/dist/index.cjs +51 -0
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +21 -0
- package/package.json +36 -3
package/README.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @lapwy/vue
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
lapwy for Vue 3.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install @lapwy/vue
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
// main.ts
|
|
11
|
+
import { lapwy } from "@lapwy/vue";
|
|
12
|
+
|
|
13
|
+
createApp(App).use(lapwy, { site: "lw_…" }).mount("#app");
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
// in a component
|
|
18
|
+
import { useLapwy } from "@lapwy/vue";
|
|
19
|
+
|
|
20
|
+
const { track } = useLapwy();
|
|
21
|
+
track("signup", { plan: "pro" });
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
In templates it is also there as `$lapwy`. Vue Router changes the address, so route changes are page views without further setup. Under Nuxt, register it in a client-only plugin.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
consent: () => import_js.consent,
|
|
24
|
+
lapwy: () => lapwy,
|
|
25
|
+
notFound: () => import_js.notFound,
|
|
26
|
+
page: () => import_js.page,
|
|
27
|
+
track: () => import_js.track,
|
|
28
|
+
useLapwy: () => useLapwy
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(src_exports);
|
|
31
|
+
var import_js = require("@lapwy/js");
|
|
32
|
+
var api = { track: import_js.track, page: import_js.page, consent: import_js.consent, notFound: import_js.notFound };
|
|
33
|
+
var lapwy = {
|
|
34
|
+
install(app, options) {
|
|
35
|
+
(0, import_js.init)({ ...options, sdk: "vue-0.1" });
|
|
36
|
+
app.config.globalProperties.$lapwy = api;
|
|
37
|
+
app.provide("lapwy", api);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
function useLapwy() {
|
|
41
|
+
return api;
|
|
42
|
+
}
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
consent,
|
|
46
|
+
lapwy,
|
|
47
|
+
notFound,
|
|
48
|
+
page,
|
|
49
|
+
track,
|
|
50
|
+
useLapwy
|
|
51
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Plugin } from "vue";
|
|
2
|
+
import { consent, notFound, page, track, type Options, type Tracker } from "@lapwy/js";
|
|
3
|
+
export type LapwyOptions = Omit<Options, "sdk">;
|
|
4
|
+
/** The Vue plugin. Starts tracking when the app is created in a browser. */
|
|
5
|
+
export declare const lapwy: Plugin<[LapwyOptions]>;
|
|
6
|
+
/** track, page and consent, for use in setup(). */
|
|
7
|
+
export declare function useLapwy(): Tracker;
|
|
8
|
+
export { track, page, consent, notFound };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Plugin } from "vue";
|
|
2
|
+
import { consent, notFound, page, track, type Options, type Tracker } from "@lapwy/js";
|
|
3
|
+
export type LapwyOptions = Omit<Options, "sdk">;
|
|
4
|
+
/** The Vue plugin. Starts tracking when the app is created in a browser. */
|
|
5
|
+
export declare const lapwy: Plugin<[LapwyOptions]>;
|
|
6
|
+
/** track, page and consent, for use in setup(). */
|
|
7
|
+
export declare function useLapwy(): Tracker;
|
|
8
|
+
export { track, page, consent, notFound };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { consent, init, notFound, page, track } from "@lapwy/js";
|
|
3
|
+
var api = { track, page, consent, notFound };
|
|
4
|
+
var lapwy = {
|
|
5
|
+
install(app, options) {
|
|
6
|
+
init({ ...options, sdk: "vue-0.1" });
|
|
7
|
+
app.config.globalProperties.$lapwy = api;
|
|
8
|
+
app.provide("lapwy", api);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
function useLapwy() {
|
|
12
|
+
return api;
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
consent,
|
|
16
|
+
lapwy,
|
|
17
|
+
notFound,
|
|
18
|
+
page,
|
|
19
|
+
track,
|
|
20
|
+
useLapwy
|
|
21
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lapwy/vue",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "lapwy for Vue 3: a plugin and useLapwy().",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"main": "./dist/index.cjs",
|
|
12
|
+
"module": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"import": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"require": {
|
|
21
|
+
"types": "./dist/index.d.cts",
|
|
22
|
+
"default": "./dist/index.cjs"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@lapwy/js": "^0.1.0"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"vue": ">=3.3"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/cts-types.mjs"
|
|
38
|
+
}
|
|
6
39
|
}
|