@livechat/customer-sdk 3.1.4 → 4.0.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 +27 -78
- package/dist/customer-sdk.cjs.js +208 -228
- package/dist/customer-sdk.cjs.native.js +208 -228
- package/dist/customer-sdk.esm.js +202 -227
- package/dist/customer-sdk.js +222 -249
- package/dist/customer-sdk.min.js +1 -1
- package/package.json +7 -7
- package/types/actions.d.ts +331 -0
- package/types/chatHistory.d.ts +19 -0
- package/types/clientDataParsers.d.ts +55 -0
- package/types/completionValues.d.ts +4 -0
- package/types/constants/clientErrorCodes.d.ts +11 -0
- package/types/constants/connectionStatuses.d.ts +6 -0
- package/types/constants/eventTypes.d.ts +8 -0
- package/types/constants/organizationIds.d.ts +2 -0
- package/types/constants/reduxActions.d.ts +23 -0
- package/types/constants/serverDisconnectionReasons.d.ts +16 -0
- package/types/constants/serverErrorCodes.d.ts +23 -0
- package/types/constants/serverPushActions.d.ts +27 -0
- package/types/constants/serverRequestActions.d.ts +30 -0
- package/types/constants/sortOrders.d.ts +3 -0
- package/types/constants/userTypes.d.ts +3 -0
- package/types/createError.d.ts +9 -0
- package/types/createStore.d.ts +12 -0
- package/types/debug.d.ts +3 -0
- package/types/graylog/index.d.ts +14 -0
- package/types/graylog/makeGrayLogRequest.d.ts +2 -0
- package/types/graylog/makeGrayLogRequest.native.d.ts +6 -0
- package/types/index.d.ts +252 -0
- package/types/reducer.d.ts +545 -0
- package/types/sendRequestAction.d.ts +4 -0
- package/types/sendTicketForm.d.ts +14 -0
- package/types/serverDataParser.d.ts +34 -0
- package/types/serverEventParser.d.ts +12 -0
- package/types/serverFrameParser.d.ts +393 -0
- package/types/sideEffects/checkGoals.d.ts +5 -0
- package/types/sideEffects/index.d.ts +13 -0
- package/types/sideStorage.d.ts +5 -0
- package/types/socketClient.d.ts +11 -0
- package/types/socketListener.d.ts +12 -0
- package/types/thunks.d.ts +4 -0
- package/types/types/actions.d.ts +157 -0
- package/types/types/clientEntities.d.ts +376 -0
- package/types/types/frames.d.ts +644 -0
- package/types/types/serverEntities.d.ts +409 -0
- package/types/types/state.d.ts +56 -0
- package/types/uploadFile.d.ts +19 -0
- package/types/validateFile/index.d.ts +3 -0
package/README.md
CHANGED
|
@@ -63,27 +63,27 @@ Or use the node-style `require` call:
|
|
|
63
63
|
|
|
64
64
|
### Using a script tag - UMD module hosted on unpkg's CDN
|
|
65
65
|
|
|
66
|
-
`<script src="https://unpkg.com/@livechat/customer-sdk@3.1.
|
|
66
|
+
`<script src="https://unpkg.com/@livechat/customer-sdk@3.1.1"></script>`
|
|
67
67
|
|
|
68
68
|
If you just want to look around and play with the SDK, check out our
|
|
69
69
|
[sample chat widget implementation](https://codesandbox.io/s/rm3prxw88n).
|
|
70
70
|
|
|
71
71
|
For the time being you need to register your application in the <a href="https://developers.livechat.com/console" target="_blank">Developers Console</a>
|
|
72
|
-
as a "Web app (frontend, eg. JavaScript)" type. Then, you have to pass the configured `redirectUri` to the `init`, along with the regular required properties (`
|
|
72
|
+
as a "Web app (frontend, eg. JavaScript)" type. Then, you have to pass the configured `redirectUri` to the `init`, along with the regular required properties (`organizationId` and `clientId`).
|
|
73
73
|
|
|
74
74
|
## Using the API
|
|
75
75
|
|
|
76
76
|
To use the API you will first need to create an instance using the `init` function.
|
|
77
|
-
You will need to provide your
|
|
77
|
+
You will need to provide your organizationId and clientId when creating a Customer SDK instance.
|
|
78
78
|
|
|
79
79
|
Other optional configuration parameters are also available:
|
|
80
80
|
|
|
81
81
|
| parameters | type | default | description |
|
|
82
82
|
| -------------------- | ------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
83
|
-
|
|
|
83
|
+
| organizationId | string | | Your Organization ID, you receive this value when creating a new livechat account. |
|
|
84
84
|
| clientId | string | | Your client id, you receive this value when you register your application in the LiveChat Developer Console. |
|
|
85
85
|
| autoConnect | boolean | true | Optional; should the library try to reconnect on it's own. |
|
|
86
|
-
| groupId | number |
|
|
86
|
+
| groupId | number | 0 | Optional; the id of the group you wish to connect to. |
|
|
87
87
|
| uniqueGroups | boolean | false | Optional; by default, the customer's identity is the same for all groups. If you want to create a separate customer identity for each group, set this parameter to `true`. When set to `true`, passing a `groupId` is required. |
|
|
88
88
|
| region | 'dal' \| 'fra' | 'dal' | Optional; the server region your license is at. |
|
|
89
89
|
| redirectUri | string | | Optional; should only be used inside ReactNative, this is the URI which your webview is redirected to after authorization. |
|
|
@@ -111,7 +111,7 @@ The `init` function will return a Customer SDK instance:
|
|
|
111
111
|
|
|
112
112
|
```js
|
|
113
113
|
const customerSDK = CustomerSDK.init({
|
|
114
|
-
|
|
114
|
+
organizationId: ORGANIZATION_ID,
|
|
115
115
|
clientId: CLIENT_ID,
|
|
116
116
|
})
|
|
117
117
|
```
|
|
@@ -163,7 +163,7 @@ export default class App extends React.Component {
|
|
|
163
163
|
|
|
164
164
|
componentDidMount() {
|
|
165
165
|
this.customerSDK = init({
|
|
166
|
-
|
|
166
|
+
organizationId: ORGANIZATION_ID,
|
|
167
167
|
clientId: CLIENT_ID,
|
|
168
168
|
redirectUri: REDIRECT_URI,
|
|
169
169
|
})
|
|
@@ -1003,7 +1003,7 @@ Parameters:
|
|
|
1003
1003
|
### Errors
|
|
1004
1004
|
|
|
1005
1005
|
- `CHAT_ALREADY_ACTIVE` - the chat is already active and you can't activate it again.
|
|
1006
|
-
- `GROUPS_OFFLINE` - a group in the targeted chat is offline. It can happen
|
|
1006
|
+
- `GROUPS_OFFLINE` - a group in the targeted chat is offline. It can happen when asynchronous communication is disabled.
|
|
1007
1007
|
|
|
1008
1008
|
## sendEvent
|
|
1009
1009
|
|
|
@@ -1071,73 +1071,6 @@ Parameters:
|
|
|
1071
1071
|
| postback.id | string | | Postback button ID |
|
|
1072
1072
|
| postback.toggled | boolean | true | Postback toggled |
|
|
1073
1073
|
|
|
1074
|
-
## sendTicketForm
|
|
1075
|
-
|
|
1076
|
-
Can be used to send a filled ticket form.
|
|
1077
|
-
|
|
1078
|
-
```js
|
|
1079
|
-
customerSDK
|
|
1080
|
-
.sendTicketForm({
|
|
1081
|
-
groupId: 10,
|
|
1082
|
-
filledForm: {
|
|
1083
|
-
type: 'filled_form',
|
|
1084
|
-
formId: '',
|
|
1085
|
-
fields: [
|
|
1086
|
-
{
|
|
1087
|
-
type: 'subject',
|
|
1088
|
-
id: '0',
|
|
1089
|
-
label: 'Subject:',
|
|
1090
|
-
answer: 'Order number 123',
|
|
1091
|
-
},
|
|
1092
|
-
{
|
|
1093
|
-
type: 'email',
|
|
1094
|
-
id: '1',
|
|
1095
|
-
label: 'Your email:',
|
|
1096
|
-
answer: 'john.doe@example.com',
|
|
1097
|
-
},
|
|
1098
|
-
{
|
|
1099
|
-
type: 'checkbox',
|
|
1100
|
-
id: '2',
|
|
1101
|
-
label: 'Question:',
|
|
1102
|
-
answers: [
|
|
1103
|
-
{ id: '0', label: 'First answer' },
|
|
1104
|
-
{ id: '1', label: 'Second answer' },
|
|
1105
|
-
],
|
|
1106
|
-
},
|
|
1107
|
-
{
|
|
1108
|
-
type: 'textarea',
|
|
1109
|
-
id: '3',
|
|
1110
|
-
label: 'Your message:',
|
|
1111
|
-
answer:
|
|
1112
|
-
'Could I get a status update on this order? Have you already shipped it?',
|
|
1113
|
-
},
|
|
1114
|
-
],
|
|
1115
|
-
},
|
|
1116
|
-
})
|
|
1117
|
-
.then(response => {
|
|
1118
|
-
console.log(`Created a ticket with id: ${response.id}`)
|
|
1119
|
-
})
|
|
1120
|
-
.catch(error => {
|
|
1121
|
-
console.log(error)
|
|
1122
|
-
})
|
|
1123
|
-
```
|
|
1124
|
-
|
|
1125
|
-
Parameters:
|
|
1126
|
-
|
|
1127
|
-
| parameters | type | description |
|
|
1128
|
-
| ----------------- | ----------------- | ------------------------------ |
|
|
1129
|
-
| filledForm.type | 'filled_form' | |
|
|
1130
|
-
| filledForm.formId | string | |
|
|
1131
|
-
| filledForm.fields | FilledFormField[] | |
|
|
1132
|
-
| groupId | number | Optional |
|
|
1133
|
-
| timeZone | string | Optional, valid IANA Time Zone |
|
|
1134
|
-
|
|
1135
|
-
Returned value:
|
|
1136
|
-
|
|
1137
|
-
| properties | type | description |
|
|
1138
|
-
| ---------- | ------ | ------------------------ |
|
|
1139
|
-
| id | string | ID of the created ticket |
|
|
1140
|
-
|
|
1141
1074
|
## setCustomerSessionFields
|
|
1142
1075
|
|
|
1143
1076
|
Sends the request to set customer's session fields. They are available for the duration of the session.
|
|
@@ -1212,7 +1145,7 @@ Parameters:
|
|
|
1212
1145
|
### Errors
|
|
1213
1146
|
|
|
1214
1147
|
- `CHAT_LIMIT_REACHED` - the maximum limit of chats per Customer has been reached, and it's not possible to start a new one. You should activate one of the existing chats. The limit is 1.
|
|
1215
|
-
- `GROUPS_OFFLINE` - a group in the
|
|
1148
|
+
- `GROUPS_OFFLINE` - a group in the targeted chat is offline. It can happen when asynchronous communication is disabled.
|
|
1216
1149
|
|
|
1217
1150
|
## updateChatProperties
|
|
1218
1151
|
|
|
@@ -2085,11 +2018,11 @@ Internal error. Customer SDK reconnects on its own.
|
|
|
2085
2018
|
|
|
2086
2019
|
## License expired
|
|
2087
2020
|
|
|
2088
|
-
The
|
|
2021
|
+
The subscription for LiveChat product associated with the specified ID has expired. You should make sure that there are no unpaid invoices for it.
|
|
2089
2022
|
|
|
2090
2023
|
## License not found
|
|
2091
2024
|
|
|
2092
|
-
The
|
|
2025
|
+
The LiveChat product associated with the specified ID doesn't exist. You should check the options passed in to Customer SDK and make sure that the parameters provided are correct.
|
|
2093
2026
|
|
|
2094
2027
|
This internally destroys the current instance of Customer SDK, so it won't be possible to reuse it.
|
|
2095
2028
|
|
|
@@ -2197,6 +2130,22 @@ customerSDK.on('disconnected', ({ reason }) => {
|
|
|
2197
2130
|
|
|
2198
2131
|
# Changelog
|
|
2199
2132
|
|
|
2133
|
+
## [v4.0.0] - 2023-09-19
|
|
2134
|
+
|
|
2135
|
+
### Added
|
|
2136
|
+
|
|
2137
|
+
- Additional types and constants for better development experience.
|
|
2138
|
+
|
|
2139
|
+
### Changed
|
|
2140
|
+
|
|
2141
|
+
Switched to using Customer API 3.5:
|
|
2142
|
+
|
|
2143
|
+
- Drop support for the `licenseId` parameter in the `init` method. It has been replaced by the `organizationId`.
|
|
2144
|
+
|
|
2145
|
+
### Removed
|
|
2146
|
+
|
|
2147
|
+
- `sendTicketForm` method. As of June 1 2023 LiveChat tickets are handled by [HelpDesk](https://www.helpdesk.com/help/tickets-dashboard-guide/)
|
|
2148
|
+
|
|
2200
2149
|
## [v3.1.2] - 2023-02-28
|
|
2201
2150
|
|
|
2202
2151
|
### Fixed
|