nuxt-callapp 1.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 +58 -0
- package/dist/module.cjs +5 -0
- package/dist/module.d.mts +8 -0
- package/dist/module.d.ts +8 -0
- package/dist/module.json +5 -0
- package/dist/module.mjs +26 -0
- package/dist/runtime/call-app.client.d.ts +2 -0
- package/dist/runtime/call-app.client.mjs +21 -0
- package/dist/types.d.mts +16 -0
- package/dist/types.d.ts +16 -0
- package/package.json +60 -0
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Get your module up and running quickly.
|
|
3
|
+
|
|
4
|
+
Find and replace all on all files (CMD+SHIFT+F):
|
|
5
|
+
- Name: My Module
|
|
6
|
+
- Package name: nuxt-callapp
|
|
7
|
+
- Description: My new Nuxt module
|
|
8
|
+
-->
|
|
9
|
+
|
|
10
|
+
# My Module
|
|
11
|
+
|
|
12
|
+
[![npm version][npm-version-src]][npm-version-href]
|
|
13
|
+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
14
|
+
|
|
15
|
+
A nuxt module for [callapp-lib](https://github.com/suanmei/callapp-lib)
|
|
16
|
+
|
|
17
|
+
- [✨ Release Notes](/CHANGELOG.md)
|
|
18
|
+
<!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/nuxt-callapp?file=playground%2Fapp.vue) -->
|
|
19
|
+
<!-- - [📖 Documentation](https://example.com) -->
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## Quick Setup
|
|
25
|
+
|
|
26
|
+
1. Add `nuxt-callapp` dependency to your project
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Using pnpm
|
|
30
|
+
pnpm add -D nuxt-callapp
|
|
31
|
+
|
|
32
|
+
# Using yarn
|
|
33
|
+
yarn add --dev nuxt-callapp
|
|
34
|
+
|
|
35
|
+
# Using npm
|
|
36
|
+
npm install --save-dev nuxt-callapp
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
2. Add `nuxt-callapp` to the `modules` section of `nuxt.config.ts`
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
export default defineNuxtConfig({
|
|
43
|
+
modules: [
|
|
44
|
+
'nuxt-callapp'
|
|
45
|
+
]
|
|
46
|
+
})
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
That's it! You can now use My Module in your Nuxt app ✨
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
<!-- Badges -->
|
|
53
|
+
[npm-version-src]: https://img.shields.io/npm/v/nuxt-callapp/latest.svg?style=flat&colorA=020420&colorB=00DC82
|
|
54
|
+
[npm-version-href]: https://npmjs.com/package/nuxt-callapp
|
|
55
|
+
|
|
56
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/nuxt-callapp.svg?style=flat&colorA=020420&colorB=00DC82
|
|
57
|
+
[npm-downloads-href]: https://npmjs.com/package/nuxt-callapp
|
|
58
|
+
|
package/dist/module.cjs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
+
import { CallappOptions } from 'callapp-lib/dist/type/types';
|
|
3
|
+
|
|
4
|
+
interface ModuleOptions extends CallappOptions {
|
|
5
|
+
}
|
|
6
|
+
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
|
|
7
|
+
|
|
8
|
+
export { type ModuleOptions, _default as default };
|
package/dist/module.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
+
import { CallappOptions } from 'callapp-lib/dist/type/types';
|
|
3
|
+
|
|
4
|
+
interface ModuleOptions extends CallappOptions {
|
|
5
|
+
}
|
|
6
|
+
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
|
|
7
|
+
|
|
8
|
+
export { type ModuleOptions, _default as default };
|
package/dist/module.json
ADDED
package/dist/module.mjs
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { defineNuxtModule, createResolver, addPlugin } from '@nuxt/kit';
|
|
2
|
+
import { defu } from 'defu';
|
|
3
|
+
|
|
4
|
+
const module = defineNuxtModule({
|
|
5
|
+
meta: {
|
|
6
|
+
name: "nuxt-callapp",
|
|
7
|
+
configKey: "callapp"
|
|
8
|
+
},
|
|
9
|
+
// Default configuration options of the Nuxt module
|
|
10
|
+
defaults: {
|
|
11
|
+
scheme: {
|
|
12
|
+
protocol: "zhihu"
|
|
13
|
+
},
|
|
14
|
+
appstore: "",
|
|
15
|
+
fallback: ""
|
|
16
|
+
},
|
|
17
|
+
setup(options, nuxt) {
|
|
18
|
+
const resolver = createResolver(import.meta.url);
|
|
19
|
+
nuxt.options.runtimeConfig.public.callapp = defu(options, {
|
|
20
|
+
timeout: 2e3
|
|
21
|
+
});
|
|
22
|
+
addPlugin(resolver.resolve("./runtime/call-app.client"));
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export { module as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import CallApp from "callapp-lib";
|
|
2
|
+
let callApp;
|
|
3
|
+
function createCallApp(options) {
|
|
4
|
+
return new CallApp(options);
|
|
5
|
+
}
|
|
6
|
+
function useCallApp(params, callback) {
|
|
7
|
+
const options = useRuntimeConfig().public.callapp;
|
|
8
|
+
if (!callApp) {
|
|
9
|
+
callApp = new CallApp(options);
|
|
10
|
+
}
|
|
11
|
+
if (callback) {
|
|
12
|
+
params.callback = callback;
|
|
13
|
+
}
|
|
14
|
+
callApp.open(params);
|
|
15
|
+
}
|
|
16
|
+
export default defineNuxtPlugin(() => ({
|
|
17
|
+
provide: {
|
|
18
|
+
createCallApp,
|
|
19
|
+
useCallApp
|
|
20
|
+
}
|
|
21
|
+
}));
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
import type { ModuleOptions } from './module.js'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
declare module '@nuxt/schema' {
|
|
6
|
+
interface NuxtConfig { ['callapp']?: Partial<ModuleOptions> }
|
|
7
|
+
interface NuxtOptions { ['callapp']?: ModuleOptions }
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare module 'nuxt/schema' {
|
|
11
|
+
interface NuxtConfig { ['callapp']?: Partial<ModuleOptions> }
|
|
12
|
+
interface NuxtOptions { ['callapp']?: ModuleOptions }
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export type { ModuleOptions, default } from './module.js'
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
import type { ModuleOptions } from './module'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
declare module '@nuxt/schema' {
|
|
6
|
+
interface NuxtConfig { ['callapp']?: Partial<ModuleOptions> }
|
|
7
|
+
interface NuxtOptions { ['callapp']?: ModuleOptions }
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare module 'nuxt/schema' {
|
|
11
|
+
interface NuxtConfig { ['callapp']?: Partial<ModuleOptions> }
|
|
12
|
+
interface NuxtOptions { ['callapp']?: ModuleOptions }
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export type { ModuleOptions, default } from './module'
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nuxt-callapp",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "A Nuxt module for callapp-lib",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "xjccc",
|
|
7
|
+
"email": "546534045@qq.com",
|
|
8
|
+
"url": "https://github.com/xjccc"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/xjccc/nuxt-callapp"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/types.d.ts",
|
|
19
|
+
"import": "./dist/module.mjs",
|
|
20
|
+
"require": "./dist/module.cjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"main": "./dist/module.cjs",
|
|
24
|
+
"types": "./dist/types.d.ts",
|
|
25
|
+
"keywords": [
|
|
26
|
+
"nuxt-module",
|
|
27
|
+
"callapp",
|
|
28
|
+
"nuxt-callapp"
|
|
29
|
+
],
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"prepack": "nuxt-module-build build",
|
|
35
|
+
"dev": "nuxi dev playground",
|
|
36
|
+
"dev:build": "nuxi build playground",
|
|
37
|
+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
38
|
+
"release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
|
|
39
|
+
"lint": "eslint .",
|
|
40
|
+
"test": "vitest run",
|
|
41
|
+
"test:watch": "vitest watch"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@nuxt/kit": "^3.10.3",
|
|
45
|
+
"callapp-lib": "^3.5.3",
|
|
46
|
+
"defu": "^6.1.4"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@nuxt/devtools": "latest",
|
|
50
|
+
"@nuxt/eslint-config": "^0.2.0",
|
|
51
|
+
"@nuxt/module-builder": "^0.5.5",
|
|
52
|
+
"@nuxt/schema": "^3.10.3",
|
|
53
|
+
"@nuxt/test-utils": "^3.11.0",
|
|
54
|
+
"@types/node": "^20.11.22",
|
|
55
|
+
"changelogen": "^0.5.5",
|
|
56
|
+
"eslint": "^8.57.0",
|
|
57
|
+
"nuxt": "^3.10.3",
|
|
58
|
+
"vitest": "^1.3.1"
|
|
59
|
+
}
|
|
60
|
+
}
|