@becklinks/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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Beck Link
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,42 @@
1
- # Temporary Holding Version
1
+ # @becklinks/vue
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Beck Links for Vue 3.3 and newer, including Nuxt: a plugin, a composable that creates deep links, and
4
+ an open-in-app banner component. It builds on
5
+ [`@becklinks/web`](https://www.npmjs.com/package/@becklinks/web).
6
+
7
+ ```bash
8
+ npm install @becklinks/vue
9
+ ```
10
+
11
+ ```ts
12
+ // main.ts
13
+ import { createApp } from 'vue';
14
+ import { BeckLinksPlugin } from '@becklinks/vue';
15
+ import App from './App.vue';
16
+
17
+ createApp(App).use(BeckLinksPlugin, { publishableKey: 'pk_live_…' }).mount('#app');
18
+ ```
19
+
20
+ ```vue
21
+ <script setup lang="ts">
22
+ import { SmartBanner, useCreateLink } from '@becklinks/vue';
23
+
24
+ const { createLink, isPending } = useCreateLink();
25
+ async function share() {
26
+ const link = await createLink({ deepLinkPath: '/product/42' });
27
+ await navigator.share({ url: link.url });
28
+ }
29
+ </script>
30
+
31
+ <template>
32
+ <SmartBanner url="https://yourproject.becklinks.com/summer" title="Open in the Acme app" />
33
+ <button type="button" :disabled="isPending" @click="share">Share</button>
34
+ </template>
35
+ ```
36
+
37
+ List your website under **Settings → Web origins** in the Beck Links dashboard first, and use the
38
+ publishable key (`pk_…`) only. `<SmartBanner>` renders nothing during server rendering and mounts the
39
+ banner in the browser.
40
+
41
+ Documentation: [docs.becklinks.com/vue-sdk](https://docs.becklinks.com/vue-sdk) · MIT licensed, made
42
+ by [Tecbeck](https://tecbeck.com).
@@ -0,0 +1,7 @@
1
+ export { BECKLINKS_KEY, BeckLinksPlugin, useBeckLinks } from './plugin.js';
2
+ export { SmartBanner } from './smart-banner.js';
3
+ export { useCreateLink } from './use-create-link.js';
4
+ export type { UseCreateLink } from './use-create-link.js';
5
+ export { BeckLinksError } from '@becklinks/web';
6
+ export type { BannerHandle, BannerOptions, BeckLink, BeckLinksClient, BeckLinksOptions, CreateLinkInput, MobilePlatform, UtmParameters, } from '@becklinks/web';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,YAAY,EACV,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,aAAa,GACd,MAAM,gBAAgB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export { BECKLINKS_KEY, BeckLinksPlugin, useBeckLinks } from './plugin.js';
2
+ export { SmartBanner } from './smart-banner.js';
3
+ export { useCreateLink } from './use-create-link.js';
4
+ // The core's types and error class, so an app imports everything from one package.
5
+ export { BeckLinksError } from '@becklinks/web';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAIrD,mFAAmF;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { BeckLinksClient, BeckLinksOptions } from '@becklinks/web';
2
+ import type { App, InjectionKey } from 'vue';
3
+ export declare const BECKLINKS_KEY: InjectionKey<BeckLinksClient>;
4
+ /**
5
+ * `app.use(BeckLinksPlugin, { publishableKey: 'pk_live_…' })`. The key is public by design; keep
6
+ * secret keys (`sk_…`) on your server.
7
+ */
8
+ export declare const BeckLinksPlugin: {
9
+ install(app: App, options: BeckLinksOptions): void;
10
+ };
11
+ /** The client the plugin installed. Throws when the plugin is missing, so the mistake shows at once. */
12
+ export declare function useBeckLinks(): BeckLinksClient;
13
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AAK7C,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,eAAe,CAAuB,CAAC;AAEhF;;;GAGG;AACH,eAAO,MAAM,eAAe;iBACb,GAAG,WAAW,gBAAgB,GAAG,IAAI;CAMnD,CAAC;AAEF,wGAAwG;AACxG,wBAAgB,YAAY,IAAI,eAAe,CAQ9C"}
package/dist/plugin.js ADDED
@@ -0,0 +1,23 @@
1
+ import { createBeckLinks } from '@becklinks/web';
2
+ import { inject } from 'vue';
3
+ const VUE_SDK_NAME = 'becklinks_vue';
4
+ const VUE_SDK_VERSION = '0.1.0';
5
+ export const BECKLINKS_KEY = Symbol('becklinks');
6
+ /**
7
+ * `app.use(BeckLinksPlugin, { publishableKey: 'pk_live_…' })`. The key is public by design; keep
8
+ * secret keys (`sk_…`) on your server.
9
+ */
10
+ export const BeckLinksPlugin = {
11
+ install(app, options) {
12
+ app.provide(BECKLINKS_KEY, createBeckLinks({ sdkName: VUE_SDK_NAME, sdkVersion: VUE_SDK_VERSION, ...options }));
13
+ },
14
+ };
15
+ /** The client the plugin installed. Throws when the plugin is missing, so the mistake shows at once. */
16
+ export function useBeckLinks() {
17
+ const client = inject(BECKLINKS_KEY, null);
18
+ if (client === null) {
19
+ throw new Error("useBeckLinks needs the plugin: app.use(BeckLinksPlugin, { publishableKey: 'pk_…' }).");
20
+ }
21
+ return client;
22
+ }
23
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAK7B,MAAM,YAAY,GAAG,eAAe,CAAC;AACrC,MAAM,eAAe,GAAG,OAAO,CAAC;AAEhC,MAAM,CAAC,MAAM,aAAa,GAAkC,MAAM,CAAC,WAAW,CAAC,CAAC;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,OAAO,CAAC,GAAQ,EAAE,OAAyB;QACzC,GAAG,CAAC,OAAO,CACT,aAAa,EACb,eAAe,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,OAAO,EAAE,CAAC,CACpF,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,wGAAwG;AACxG,MAAM,UAAU,YAAY;IAC1B,MAAM,MAAM,GAAG,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IAC3C,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,sFAAsF,CACvF,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,96 @@
1
+ import type { MobilePlatform } from '@becklinks/web';
2
+ import type { PropType } from 'vue';
3
+ /**
4
+ * The open-in-app banner for phones. Renders nothing itself; it mounts the banner in the browser
5
+ * after the component is mounted (never during server rendering) and removes it on unmount.
6
+ */
7
+ export declare const SmartBanner: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
8
+ url: {
9
+ type: StringConstructor;
10
+ required: true;
11
+ };
12
+ title: {
13
+ type: StringConstructor;
14
+ required: true;
15
+ };
16
+ description: {
17
+ type: StringConstructor;
18
+ default: undefined;
19
+ };
20
+ buttonLabel: {
21
+ type: StringConstructor;
22
+ default: undefined;
23
+ };
24
+ closeLabel: {
25
+ type: StringConstructor;
26
+ default: undefined;
27
+ };
28
+ iconUrl: {
29
+ type: StringConstructor;
30
+ default: undefined;
31
+ };
32
+ platforms: {
33
+ type: PropType<MobilePlatform[]>;
34
+ default: undefined;
35
+ };
36
+ position: {
37
+ type: PropType<"top" | "bottom">;
38
+ default: undefined;
39
+ };
40
+ dismissDays: {
41
+ type: NumberConstructor;
42
+ default: undefined;
43
+ };
44
+ }>, () => null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
45
+ open: () => true;
46
+ dismiss: () => true;
47
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
48
+ url: {
49
+ type: StringConstructor;
50
+ required: true;
51
+ };
52
+ title: {
53
+ type: StringConstructor;
54
+ required: true;
55
+ };
56
+ description: {
57
+ type: StringConstructor;
58
+ default: undefined;
59
+ };
60
+ buttonLabel: {
61
+ type: StringConstructor;
62
+ default: undefined;
63
+ };
64
+ closeLabel: {
65
+ type: StringConstructor;
66
+ default: undefined;
67
+ };
68
+ iconUrl: {
69
+ type: StringConstructor;
70
+ default: undefined;
71
+ };
72
+ platforms: {
73
+ type: PropType<MobilePlatform[]>;
74
+ default: undefined;
75
+ };
76
+ position: {
77
+ type: PropType<"top" | "bottom">;
78
+ default: undefined;
79
+ };
80
+ dismissDays: {
81
+ type: NumberConstructor;
82
+ default: undefined;
83
+ };
84
+ }>> & Readonly<{
85
+ onOpen?: (() => any) | undefined;
86
+ onDismiss?: (() => any) | undefined;
87
+ }>, {
88
+ description: string;
89
+ buttonLabel: string;
90
+ closeLabel: string;
91
+ iconUrl: string;
92
+ platforms: MobilePlatform[];
93
+ position: "top" | "bottom";
94
+ dismissDays: number;
95
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
96
+ //# sourceMappingURL=smart-banner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smart-banner.d.ts","sourceRoot":"","sources":["../src/smart-banner.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAgB,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAEpC;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;cASQ,QAAQ,CAAC,cAAc,EAAE,CAAC;;;;cAC1B,QAAQ,CAAC,KAAK,GAAG,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAD1B,QAAQ,CAAC,cAAc,EAAE,CAAC;;;;cAC1B,QAAQ,CAAC,KAAK,GAAG,QAAQ,CAAC;;;;;;;;;;;;;;;;;;4EAwDxD,CAAC"}
@@ -0,0 +1,68 @@
1
+ import { defineComponent, onBeforeUnmount, onMounted, watch } from 'vue';
2
+ import { useBeckLinks } from './plugin.js';
3
+ /**
4
+ * The open-in-app banner for phones. Renders nothing itself; it mounts the banner in the browser
5
+ * after the component is mounted (never during server rendering) and removes it on unmount.
6
+ */
7
+ export const SmartBanner = defineComponent({
8
+ name: 'BeckLinksSmartBanner',
9
+ props: {
10
+ url: { type: String, required: true },
11
+ title: { type: String, required: true },
12
+ description: { type: String, default: undefined },
13
+ buttonLabel: { type: String, default: undefined },
14
+ closeLabel: { type: String, default: undefined },
15
+ iconUrl: { type: String, default: undefined },
16
+ platforms: { type: Array, default: undefined },
17
+ position: { type: String, default: undefined },
18
+ dismissDays: { type: Number, default: undefined },
19
+ },
20
+ emits: {
21
+ open: () => true,
22
+ dismiss: () => true,
23
+ },
24
+ setup(props, { emit }) {
25
+ const client = useBeckLinks();
26
+ let banner = null;
27
+ function mount() {
28
+ banner?.destroy();
29
+ banner = client.showBanner({
30
+ url: props.url,
31
+ title: props.title,
32
+ ...(props.description === undefined ? {} : { description: props.description }),
33
+ ...(props.buttonLabel === undefined ? {} : { buttonLabel: props.buttonLabel }),
34
+ ...(props.closeLabel === undefined ? {} : { closeLabel: props.closeLabel }),
35
+ ...(props.iconUrl === undefined ? {} : { iconUrl: props.iconUrl }),
36
+ ...(props.platforms === undefined ? {} : { platforms: props.platforms }),
37
+ ...(props.position === undefined ? {} : { position: props.position }),
38
+ ...(props.dismissDays === undefined ? {} : { dismissDays: props.dismissDays }),
39
+ onOpen: () => {
40
+ emit('open');
41
+ },
42
+ onDismiss: () => {
43
+ emit('dismiss');
44
+ },
45
+ });
46
+ }
47
+ onMounted(() => {
48
+ mount();
49
+ watch(() => [
50
+ props.url,
51
+ props.title,
52
+ props.description,
53
+ props.buttonLabel,
54
+ props.closeLabel,
55
+ props.iconUrl,
56
+ props.position,
57
+ props.dismissDays,
58
+ props.platforms?.join(','),
59
+ ], mount);
60
+ });
61
+ onBeforeUnmount(() => {
62
+ banner?.destroy();
63
+ banner = null;
64
+ });
65
+ return () => null;
66
+ },
67
+ });
68
+ //# sourceMappingURL=smart-banner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smart-banner.js","sourceRoot":"","sources":["../src/smart-banner.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,13 @@
1
+ import type { BeckLink, BeckLinksError, CreateLinkInput } from '@becklinks/web';
2
+ import type { ComputedRef, ShallowRef } from 'vue';
3
+ export interface UseCreateLink {
4
+ /** Resolves with the link and rejects with a `BeckLinksError`; the refs below follow along. */
5
+ readonly createLink: (input: CreateLinkInput) => Promise<BeckLink>;
6
+ readonly link: Readonly<ShallowRef<BeckLink | null>>;
7
+ readonly error: Readonly<ShallowRef<BeckLinksError | null>>;
8
+ readonly isPending: ComputedRef<boolean>;
9
+ readonly reset: () => void;
10
+ }
11
+ /** Creates links from a component. Only the newest call updates the refs. */
12
+ export declare function useCreateLink(): UseCreateLink;
13
+ //# sourceMappingURL=use-create-link.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-create-link.d.ts","sourceRoot":"","sources":["../src/use-create-link.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEnD,MAAM,WAAW,aAAa;IAC5B,+FAA+F;IAC/F,QAAQ,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC;IACrD,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC,CAAC;IAC5D,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED,6EAA6E;AAC7E,wBAAgB,aAAa,IAAI,aAAa,CAqC7C"}
@@ -0,0 +1,40 @@
1
+ import { computed, shallowRef } from 'vue';
2
+ import { useBeckLinks } from './plugin.js';
3
+ /** Creates links from a component. Only the newest call updates the refs. */
4
+ export function useCreateLink() {
5
+ const client = useBeckLinks();
6
+ const link = shallowRef(null);
7
+ const error = shallowRef(null);
8
+ const pending = shallowRef(false);
9
+ let latest = 0;
10
+ async function createLink(input) {
11
+ latest += 1;
12
+ const call = latest;
13
+ pending.value = true;
14
+ error.value = null;
15
+ try {
16
+ const created = await client.createLink(input);
17
+ if (call === latest) {
18
+ link.value = created;
19
+ pending.value = false;
20
+ }
21
+ return created;
22
+ }
23
+ catch (caught) {
24
+ if (call === latest) {
25
+ error.value = caught;
26
+ link.value = null;
27
+ pending.value = false;
28
+ }
29
+ throw caught;
30
+ }
31
+ }
32
+ function reset() {
33
+ latest += 1;
34
+ link.value = null;
35
+ error.value = null;
36
+ pending.value = false;
37
+ }
38
+ return { createLink, link, error, isPending: computed(() => pending.value), reset };
39
+ }
40
+ //# sourceMappingURL=use-create-link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-create-link.js","sourceRoot":"","sources":["../src/use-create-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAc3C,6EAA6E;AAC7E,MAAM,UAAU,aAAa;IAC3B,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAC9B,MAAM,IAAI,GAAG,UAAU,CAAkB,IAAI,CAAC,CAAC;IAC/C,MAAM,KAAK,GAAG,UAAU,CAAwB,IAAI,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAClC,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,KAAK,UAAU,UAAU,CAAC,KAAsB;QAC9C,MAAM,IAAI,CAAC,CAAC;QACZ,MAAM,IAAI,GAAG,MAAM,CAAC;QACpB,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;QACrB,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YAC/C,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;gBACpB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC;gBACrB,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;YACxB,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;QAAC,OAAO,MAAM,EAAE,CAAC;YAChB,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;gBACpB,KAAK,CAAC,KAAK,GAAG,MAAwB,CAAC;gBACvC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;gBAClB,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;YACxB,CAAC;YACD,MAAM,MAAM,CAAC;QACf,CAAC;IACH,CAAC;IAED,SAAS,KAAK;QACZ,MAAM,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC;QACnB,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;IACxB,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC;AACtF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,55 @@
1
1
  {
2
2
  "name": "@becklinks/vue",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Beck Links for Vue 3: a plugin, composables to create deep links and an open-in-app banner component.",
5
+ "keywords": [
6
+ "vue",
7
+ "nuxt",
8
+ "deep links",
9
+ "smart banner",
10
+ "becklinks"
11
+ ],
12
+ "homepage": "https://docs.becklinks.com/sdks/vue",
13
+ "license": "MIT",
14
+ "type": "module",
15
+ "sideEffects": false,
16
+ "main": "./dist/index.js",
17
+ "module": "./dist/index.js",
18
+ "types": "./dist/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "default": "./dist/index.js"
23
+ },
24
+ "./package.json": "./package.json"
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "README.md",
29
+ "LICENSE"
30
+ ],
31
+ "dependencies": {
32
+ "@becklinks/web": "^0.1.0"
33
+ },
34
+ "peerDependencies": {
35
+ "vue": ">=3.3"
36
+ },
37
+ "devDependencies": {
38
+ "eslint": "10.12.0",
39
+ "jsdom": "30.1.3",
40
+ "typescript": "6.0.3",
41
+ "vitest": "5.0.3",
42
+ "vue": "3.5.43",
43
+ "@becklink/config": "0.0.0"
44
+ },
45
+ "engines": {
46
+ "node": ">=18"
47
+ },
48
+ "scripts": {
49
+ "build": "tsc -p tsconfig.build.json",
50
+ "typecheck": "tsc -p tsconfig.json --noEmit",
51
+ "lint": "eslint .",
52
+ "test": "vitest run",
53
+ "clean": "rimraf dist coverage"
54
+ }
6
55
  }