@hellotext/hellotext 1.8.7 → 2.0.1
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 +27 -2
- package/dist/hellotext.js +1 -1
- package/index.d.ts +61 -0
- package/lib/api/businesses.cjs +37 -0
- package/lib/api/businesses.js +3 -9
- package/lib/api/events.cjs +45 -0
- package/lib/api/events.js +8 -14
- package/lib/api/forms.cjs +51 -0
- package/lib/api/forms.js +10 -17
- package/lib/api/index.cjs +51 -0
- package/lib/api/index.js +10 -23
- package/lib/api/response.cjs +76 -0
- package/lib/api/response.js +1 -7
- package/lib/api/submissions.cjs +47 -0
- package/lib/api/submissions.js +9 -17
- package/lib/api/webchat/messages.cjs +70 -0
- package/lib/api/webchat/messages.js +10 -18
- package/lib/api/webchats.cjs +44 -0
- package/lib/api/webchats.js +8 -16
- package/lib/builders/input_builder.cjs +61 -0
- package/lib/builders/input_builder.js +4 -11
- package/lib/builders/logo_builder.cjs +50 -0
- package/lib/builders/logo_builder.js +5 -12
- package/lib/channels/application_channel.cjs +67 -0
- package/lib/channels/application_channel.js +1 -8
- package/lib/channels/{web_chat_channel.js → webchat_channel.cjs} +35 -20
- package/lib/channels/webchat_channel.js +3 -11
- package/lib/controllers/form_controller.cjs +141 -0
- package/lib/controllers/form_controller.js +15 -22
- package/lib/controllers/mixins/usePopover.cjs +59 -0
- package/lib/controllers/mixins/usePopover.js +6 -14
- package/lib/controllers/{web_chat/pagination_controller.js → webchat/emoji_picker_controller.cjs} +74 -29
- package/lib/controllers/webchat/emoji_picker_controller.js +11 -17
- package/lib/controllers/webchat_controller.cjs +433 -0
- package/lib/controllers/webchat_controller.js +49 -51
- package/lib/core/configuration/forms.cjs +49 -0
- package/lib/core/configuration/forms.js +2 -8
- package/lib/core/configuration/{web_chat.js → webchat.cjs} +53 -38
- package/lib/core/configuration/webchat.js +2 -9
- package/lib/core/configuration.cjs +65 -0
- package/lib/core/configuration.js +8 -13
- package/lib/core/event.cjs +71 -0
- package/lib/core/event.js +5 -11
- package/lib/core/index.cjs +20 -0
- package/lib/core/index.js +2 -20
- package/lib/errors/index.cjs +19 -0
- package/lib/errors/index.js +2 -19
- package/lib/errors/invalid_event.cjs +34 -0
- package/lib/errors/invalid_event.js +1 -7
- package/lib/errors/not_initialized_error.cjs +34 -0
- package/lib/errors/not_initialized_error.js +1 -7
- package/lib/hellotext.cjs +153 -0
- package/lib/hellotext.js +19 -27
- package/lib/index.cjs +19 -0
- package/lib/index.js +11 -20
- package/lib/locales/en.cjs +22 -0
- package/lib/locales/en.js +2 -9
- package/lib/locales/es.cjs +22 -0
- package/lib/locales/es.js +2 -9
- package/lib/locales/index.cjs +14 -0
- package/lib/locales/index.js +6 -14
- package/lib/models/business.cjs +62 -0
- package/lib/models/business.js +22 -24
- package/lib/models/cookies.cjs +40 -0
- package/lib/models/cookies.js +3 -10
- package/lib/models/form.cjs +166 -0
- package/lib/models/form.js +10 -17
- package/lib/models/form_collection.cjs +122 -0
- package/lib/models/form_collection.js +18 -22
- package/lib/models/index.cjs +54 -0
- package/lib/models/index.js +7 -54
- package/lib/models/query.cjs +51 -0
- package/lib/models/query.js +3 -9
- package/lib/models/session.cjs +58 -0
- package/lib/models/session.js +12 -17
- package/lib/models/{web_chat.js → webchat.cjs} +14 -22
- package/lib/models/webchat.js +6 -13
- package/lib/vanilla.cjs +13 -0
- package/lib/vanilla.js +1 -13
- package/package.json +41 -7
- package/src/controllers/webchat_controller.js +72 -47
- package/src/hellotext.js +5 -4
- package/src/index.bundle.js +5 -0
- package/src/index.js +1 -3
- package/src/models/business.js +3 -6
- package/src/models/form_collection.js +10 -4
- package/src/models/session.js +4 -3
- package/styles/index.css +22 -30
- package/.babelrc +0 -24
- package/.github/workflows/ci.yml +0 -24
- package/.prettierignore +0 -3
- package/.prettierrc.json +0 -18
- package/MIT-LICENSE +0 -20
- package/__tests__/builders/input_builder_test.js +0 -117
- package/__tests__/core/configuration/forms_test.js +0 -30
- package/__tests__/core/configuration/webchat_test.js +0 -163
- package/__tests__/core/configuration_test.js +0 -28
- package/__tests__/core/event_test.js +0 -56
- package/__tests__/hellotext_test.js +0 -197
- package/__tests__/models/business_test.js +0 -26
- package/__tests__/models/cookies_test.js +0 -25
- package/__tests__/models/form_collection_test.js +0 -103
- package/__tests__/models/form_test.js +0 -131
- package/__tests__/models/query_test.js +0 -97
- package/docs/forms.md +0 -176
- package/docs/tracking.md +0 -203
- package/docs/webchat.md +0 -101
- package/jest.config.js +0 -4
- package/jest.setup.js +0 -16
- package/lib/api/web_chat/messages.js +0 -74
- package/lib/api/web_chats.js +0 -53
- package/webpack.config.js +0 -24
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ Import the library into your app.
|
|
|
30
30
|
import Hellotext from '@hellotext/hellotext'
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
If you're running in a non-browser environment, such as Node.js, you can import the vanilla implementation which only includes
|
|
33
|
+
If you're running in a non-browser environment, such as Node.js, you can import the vanilla implementation which only includes
|
|
34
34
|
Hellotext.js class without initializing other libraries that rely on the browser environment.
|
|
35
35
|
|
|
36
36
|
```javascript
|
|
@@ -55,6 +55,31 @@ Learn how to leverage the library to track events and collect forms.
|
|
|
55
55
|
- [Forms](/docs/forms.md)
|
|
56
56
|
- [Webchat](/docs/webchat.md)
|
|
57
57
|
|
|
58
|
+
## CSS
|
|
59
|
+
|
|
60
|
+
The library ships with a minimal CSS file that is used for [Forms](/docs/forms.md). It is pre-bundled but you control when to import it.
|
|
61
|
+
|
|
62
|
+
## For Bundler Users (Vite, Webpack, etc.)
|
|
63
|
+
|
|
64
|
+
The CSS is not automatically imported to avoid issues with SSR frameworks. Import it separately:
|
|
65
|
+
|
|
66
|
+
```javascript
|
|
67
|
+
// Import the library
|
|
68
|
+
import Hellotext from '@hellotext/hellotext'
|
|
69
|
+
|
|
70
|
+
// Import the CSS separately
|
|
71
|
+
import '@hellotext/hellotext/styles/index.css'
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## For Script Tag Users
|
|
75
|
+
|
|
76
|
+
The UMD bundle (`dist/hellotext.js`) includes the CSS automatically:
|
|
77
|
+
|
|
78
|
+
```html
|
|
79
|
+
<script src="https://unpkg.com/@hellotext/hellotext"></script>
|
|
80
|
+
<!-- CSS is included in the bundle -->
|
|
81
|
+
```
|
|
82
|
+
|
|
58
83
|
## Events
|
|
59
84
|
|
|
60
85
|
This library emits events that you can listen to and perform specific action when the event happens.
|
|
@@ -134,7 +159,7 @@ Hellotext.initialize('HELLOTEXT_BUSINESS_ID', configurationOptions)
|
|
|
134
159
|
#### Configuration Options
|
|
135
160
|
|
|
136
161
|
| Property | Description | Type | Default |
|
|
137
|
-
|
|
162
|
+
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ----------------------------------------- |
|
|
138
163
|
| session | A valid Hellotext session which was stored previously. When not set, Hellotext attempts to retrieve the stored value from `document.cookie` when available, otherwise it creates a new session. | String | null |
|
|
139
164
|
| autoGenerateSession | Whether the library should automatically generate a session when no session is found in the query or the cookies | Boolean | true |
|
|
140
165
|
| forms | An object that controls how Hellotext should control the forms on the page. See [Forms](/docs/forms.md) documentation for more information. | Object | { autoMount: true, successMessage: true } |
|