@verdocs/web-sdk-vue 5.0.22 → 5.0.23

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.
Files changed (2) hide show
  1. package/README.md +46 -75
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,92 +1,63 @@
1
1
  # Verdocs Vue SDK
2
2
 
3
- > Library of components and embeds to quickly build Verdocs-enabled apps in React.
3
+ > Library of components and embeds to quickly build Verdocs-enabled apps in Vue.
4
4
 
5
5
  This SDK provides UI controls and components for building rich, Verdocs-enabled document signing experiences for the Web. Components
6
6
  are built in [StencilJS](https://stenciljs.com/) for maximum portability between front-end frameworks. This package contains the
7
- React framework components - for Angular or Vue, please see the parent repository.
7
+ Vue framework components - for React or Angular, please see the parent repository.
8
8
 
9
9
  ## Installation
10
10
 
11
- Begin by installing the SDK into your app. Currently Vue >= 3 is supported. You will also need the Verdocs JS SDK:
11
+ Begin by installing the SDK into your app. Currently Vue >= 3 is supported. Although it is not required,
12
+ it is recommended to install the Verdocs JS SDK as well, as it provides the underlying API access for
13
+ the components in this package.
12
14
 
13
15
  npm i -S @verdocs/web-sdk-vue @verdocs/js-sdk
14
16
 
15
- or:
16
-
17
- yarn add @verdocs/web-sdk-vue @verdocs/js-sdk
18
-
19
- Then authenticate to the Verdocs API somewhere in your app. The best way to do this is by logging in with a username/password
20
- created at [Verdocs.com](https://verdocs.com). Most Web applications have some type of login process, and if your app uses the
21
- same username/password for access, you can reuse that for this step:
22
-
23
- ```typescript
24
- import {Auth} from '@verdocs/js-sdk/Users';
25
- import {Transport} from '@verdocs/js-sdk/HTTP';
26
-
27
- try {
28
- const {accessToken} = await Auth.authenticateUser({
29
- username: MY_USERNAME,
30
- password: MY_PASSWORD,
31
- });
32
- console.log('Authenticated to Verdocs', accessToken.substring(0, 10));
33
- Transport.setAuthToken(accessToken);
34
- } catch (e) {
35
- console.error('Unable to authenticate to Verdocs.', e);
17
+ Next, per the instructions at [Vue and Web Components](https://vuejs.org/guide/extras/web-components#example-vite-config), configure the Vue plugin for Vite to support
18
+ custom components by adding the following to your `vite.config.js`:
19
+
20
+ ```javascript
21
+ ...
22
+
23
+ export default defineConfig({
24
+ plugins: [
25
+ vue({
26
+ // Add this configuration block
27
+ template: {
28
+ compilerOptions: {
29
+ // treat all tags with a dash as custom elements
30
+ isCustomElement: (tag) => tag.includes('-')
31
+ }
32
+ }
33
+ }),
34
+ ...
35
+ ],
36
+ ...
37
+ })
38
+
39
+ ````
40
+
41
+ Finally, register the Verdocs Web SDK with Vue by adding the following to your `App.vue`:
42
+
43
+ ```javascript
44
+ ...
45
+ import {ComponentLibrary, VerdocsAuth} from '@verdocs/web-sdk-vue';
46
+ ...
47
+
48
+ if (ComponentLibrary?.install) {
49
+ ComponentLibrary.install();
36
50
  }
37
- ```
38
-
39
- Note that the components in this library leverage the same underlying Verdocs JS SDK that you can call directly from your code.
40
- Authenticating via the above process will provide access both for the JS SDK and this library's components at the same time.
51
+ ````
41
52
 
42
53
  ## Usage
43
54
 
44
- ```typescript jsx
45
- import { PdfViewer } from "@verdocs/web-sdk-react";
46
-
47
- export const SimplePDFView: FC = () => {
48
- const templateId = "c3fc6310-bf9d-47a1-b0ad-daf2bbf657c2";
49
- const documentId = "ed117472-4d4e-4c62-9386-af047a3373a2";
50
- const pdfurl = `https://api.verdocs.com/templates/${templateId}/documents/${documentId}?file=true`;
55
+ Verdocs Web Components may be used like any other custom component in Vue. The only adjustment to
56
+ keep in mind is that the component name must be in kebab-case, and event handlers must omit the `on`
57
+ prefix, e.g.:
51
58
 
52
- return (
53
- <div style={{ width: 600, height: 800 }}>
54
- <PdfViewer src={pdfUrl} />
55
- </div>
56
- );
57
- };
59
+ ```vue
60
+ <verdocs-templates-list
61
+ @viewTemplate="(event) => console.log('Selected', event.detail)"
62
+ />
58
63
  ```
59
-
60
- Components available in this package are broken down into three categories:
61
-
62
- - `controls` - Low level UI controls such as drop-downs, buttons, etc. UI controls should be 100% independent from one another. If
63
- a control requires data to operate properly, it should be passed in as a property (controls should not call the API directly).
64
- - `elements` - Elements are widgets that combine one or more controls and potentially additional business logic into a functional unit,
65
- such as a search result entry, a Template preview "card", or a document "actions" menu (with appropriate logic to hide/show certain
66
- options that may not be available based on the document's state). Elements are more complex than simple controls, but still require the
67
- parent to provide some data, control, and business logic.
68
- - `embeds` - Embeds are fully functional "mini-apps". If provided with appropriate configurations (e.g API endpoints and authorization
69
- details) they can be used to represent entire experiences such as document preview, document signing, or search.
70
-
71
- For more information, please refer to the [Verdocs Embeds Documentation](https://developers.verdocs.com/embeds/index.html).
72
-
73
- ## Styles and Fonts
74
-
75
- Most of the widgets in this library specify "Barlow" as the default font, but do not include it as a dependency to keep the package size
76
- as small as possible. To support Barlow in your own app, including the following lines of code in your `<head>` tag:
77
-
78
- ```html
79
- <link rel="preconnect" href="https://fonts.googleapis.com" />
80
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
81
- <link href="https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;700&display=swap" rel="stylesheet" />
82
- ```
83
-
84
- ## compomnents.ts fixups
85
-
86
- Replace
87
-
88
- `import type { JSX } from '@verdocs/web-sdk/components';`
89
-
90
- with
91
-
92
- `import type { JSX } from '@verdocs/web-sdk/dist/types';`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdocs/web-sdk-vue",
3
- "version": "5.0.22",
3
+ "version": "5.0.23",
4
4
  "description": "Verdocs Web SDK for React",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
@@ -18,7 +18,7 @@
18
18
  "rollup": "rollup -c"
19
19
  },
20
20
  "dependencies": {
21
- "@verdocs/web-sdk": "^5.0.22",
21
+ "@verdocs/web-sdk": "^5.0.23",
22
22
  "@stencil/vue-output-target": "^0.9.2"
23
23
  },
24
24
  "peerDependencies": {