@voxie/contacts.js 1.5.0 → 1.6.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 CHANGED
@@ -7,7 +7,7 @@
7
7
  ```html
8
8
  <head>
9
9
  <!-- inject contacts library inside head tag-->
10
- <script src="https://unpkg.com/@voxie/contacts.js@^1.5/dist/contacts.js"></script>
10
+ <script src="https://unpkg.com/@voxie/contacts.js@^1.6/dist/contacts.js"></script>
11
11
  </head>
12
12
  <body>
13
13
  <!-- display your form -->
@@ -26,7 +26,7 @@
26
26
  form.addEventListener('submit', async (e) => {
27
27
  e.preventDefault();
28
28
  // initialize contacts library
29
- const voxie = await Voxie.init({
29
+ const voxie = Voxie.init({
30
30
  publicKeyId: '<YOUR_PUBLIC_KEY_ID>',
31
31
  publicSecret: '<YOUR_PUBLIC_KEY_ID>',
32
32
  });
@@ -42,10 +42,10 @@
42
42
  ### React
43
43
 
44
44
  ```jsx
45
- import { Voxie } from '@voxie/contacts.js';
45
+ import Voxie from '@voxie/contacts.js';
46
46
 
47
47
  // we can export this instance to share with rest of our codebase.
48
- export const voxie = await Voxie.init({
48
+ export const voxie = Voxie.init({
49
49
  publicKeyId: '<YOUR_PUBLIC_KEY_ID>',
50
50
  publicSecret: '<YOUR_PUBLIC_KEY_ID>',
51
51
  });
@@ -70,24 +70,8 @@ const App = () => (
70
70
 
71
71
  ### Vue 3
72
72
 
73
- 1. Create composable file voxie.ts
74
-
75
- ```ts
76
- import { voxie } from '@voxie/contacts.js';
77
-
78
- export function useVoxie() = {
79
- return await Voxie.init({
80
- publicKeyId: '<YOUR_PUBLIC_KEY_ID>',
81
- publicSecret: '<YOUR_PUBLIC_KEY_ID>',
82
- });
83
- }
84
- ```
85
-
86
- 2. In component
87
-
88
- ```html
73
+ ```vue
89
74
  <template>
90
- <!-- (inlined for brevity) - pass telephone input to voxie capture -->
91
75
  <form @submit.prevent="capture($event)">
92
76
  <label>
93
77
  Phone:
@@ -98,24 +82,29 @@ export function useVoxie() = {
98
82
  </template>
99
83
 
100
84
  <script>
101
- import { defineComponent } from 'vue';
102
- import { useVoxie as voxie } from './services/voxie';
103
-
104
- export default defineComponent({
105
- setup() {
106
- function capture(event) {
107
- voxie.capture(event.target.phone.value);
108
- }
109
-
110
- return {
111
- capture,
112
- };
113
- },
114
- });
85
+ import Voxie from '@voxie/contacts.js';
86
+ import { defineComponent } from 'vue';
87
+
88
+ export default defineComponent({
89
+ setup() {
90
+ const voxie = Voxie.init({
91
+ publicKeyId: '<YOUR_PUBLIC_KEY_ID>',
92
+ publicSecret: '<YOUR_PUBLIC_KEY_ID>',
93
+ });
94
+
95
+ function capture(event) {
96
+ voxie.capture(event.target.phone.value);
97
+ }
98
+
99
+ return {
100
+ capture,
101
+ };
102
+ },
103
+ });
115
104
  </script>
116
105
  ```
117
106
 
118
- ## Installing via package manager
107
+ ### Installing via package manager
119
108
 
120
109
  ```sh
121
110
  # npm
@@ -129,7 +118,7 @@ pnpm add @voxie/contacts.js
129
118
  ```
130
119
 
131
120
  ```ts
132
- import { Voxie } from '@voxie/contacts';
121
+ import Voxie from '@voxie/contacts.js';
133
122
 
134
123
  const voxie = Voxie.init({
135
124
  publicKeyId: '<YOUR_PUBLIC_KEY_ID>',
@@ -149,3 +138,9 @@ voxie.capture('+15551231234', {
149
138
  },
150
139
  });
151
140
  ```
141
+
142
+
143
+ ## Development
144
+
145
+ - Use `npm run build` to build the library.
146
+ - Open `index.html` in the browser.
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023 Voxie
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export {};
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright 2023 Voxie
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export declare const CONFIG: {
17
+ services: {
18
+ connect: string;
19
+ };
20
+ };