@livechat/customer-sdk 3.1.3 → 3.1.5
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 +10 -18
- package/dist/customer-sdk.cjs.js +48 -68
- package/dist/customer-sdk.cjs.native.js +48 -68
- package/dist/customer-sdk.esm.js +45 -67
- package/dist/customer-sdk.js +215 -347
- package/dist/customer-sdk.min.js +1 -1
- package/package.json +6 -5
- package/types/createStore.d.ts +1 -1
- package/types/graylog/index.d.ts +2 -2
- package/types/index.d.ts +3 -9
- package/types/sendTicketForm.d.ts +1 -2
- package/types/serverFrameParser.d.ts +1 -1
- package/types/sideEffects/index.d.ts +1 -2
- package/types/sideStorage.d.ts +2 -2
- package/types/socketListener.d.ts +1 -4
- package/types/types/clientEntities.d.ts +0 -2
- package/types/types/serverEntities.d.ts +0 -1
- package/types/types/state.d.ts +2 -2
- package/types/constants/organizationIds.d.ts +0 -2
package/README.md
CHANGED
|
@@ -69,21 +69,21 @@ 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 (`licenseId` 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 licenseId 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
|
+
| licenseId | number | | Your license number, 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 | | 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
|
+
licenseId: LICENSE_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
|
+
licenseId: LICENSE_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 for licenses without continuous chats enabled.
|
|
1007
1007
|
|
|
1008
1008
|
## sendEvent
|
|
1009
1009
|
|
|
@@ -1212,7 +1212,7 @@ Parameters:
|
|
|
1212
1212
|
### Errors
|
|
1213
1213
|
|
|
1214
1214
|
- `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
|
|
1215
|
+
- `GROUPS_OFFLINE` - a group in the target chat is offline. It can happen for licenses, which don't allow Customers to chat during their unavailability.
|
|
1216
1216
|
|
|
1217
1217
|
## updateChatProperties
|
|
1218
1218
|
|
|
@@ -2085,11 +2085,11 @@ Internal error. Customer SDK reconnects on its own.
|
|
|
2085
2085
|
|
|
2086
2086
|
## License expired
|
|
2087
2087
|
|
|
2088
|
-
The
|
|
2088
|
+
The license with the specified ID has expired. You should make sure that there are no unpaid invoices for it.
|
|
2089
2089
|
|
|
2090
2090
|
## License not found
|
|
2091
2091
|
|
|
2092
|
-
The
|
|
2092
|
+
The license with the specified ID doesn't exist. You should check the options passed in to Customer SDK and make sure that the license parameter is correct.
|
|
2093
2093
|
|
|
2094
2094
|
This internally destroys the current instance of Customer SDK, so it won't be possible to reuse it.
|
|
2095
2095
|
|
|
@@ -2197,14 +2197,6 @@ customerSDK.on('disconnected', ({ reason }) => {
|
|
|
2197
2197
|
|
|
2198
2198
|
# Changelog
|
|
2199
2199
|
|
|
2200
|
-
## [v4.0.0] - XXXX-XX-X
|
|
2201
|
-
|
|
2202
|
-
### Changed
|
|
2203
|
-
|
|
2204
|
-
Switched to using Customer API 3.4:
|
|
2205
|
-
|
|
2206
|
-
- Drop support for the `licenseId` parameter in the `init` method. It has been replaced by the `organizationId`.
|
|
2207
|
-
|
|
2208
2200
|
## [v3.1.2] - 2023-02-28
|
|
2209
2201
|
|
|
2210
2202
|
### Fixed
|
package/dist/customer-sdk.cjs.js
CHANGED
|
@@ -7,7 +7,8 @@ var mitt = require('@livechat/mitt');
|
|
|
7
7
|
var dataUtils = require('@livechat/data-utils');
|
|
8
8
|
var redux = require('redux');
|
|
9
9
|
var createSideEffectsMiddleware = require('@livechat/side-effects-middleware');
|
|
10
|
-
var
|
|
10
|
+
var deferred = require('@livechat/deferred');
|
|
11
|
+
var promiseTry = require('@livechat/promise-try');
|
|
11
12
|
var createBackoff = require('@livechat/backoff');
|
|
12
13
|
var storage = require('@livechat/isomorphic-storage');
|
|
13
14
|
var unfetch = require('unfetch');
|
|
@@ -20,6 +21,8 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
20
21
|
var createAuth__default = /*#__PURE__*/_interopDefaultLegacy(createAuth);
|
|
21
22
|
var mitt__default = /*#__PURE__*/_interopDefaultLegacy(mitt);
|
|
22
23
|
var createSideEffectsMiddleware__default = /*#__PURE__*/_interopDefaultLegacy(createSideEffectsMiddleware);
|
|
24
|
+
var deferred__default = /*#__PURE__*/_interopDefaultLegacy(deferred);
|
|
25
|
+
var promiseTry__default = /*#__PURE__*/_interopDefaultLegacy(promiseTry);
|
|
23
26
|
var createBackoff__default = /*#__PURE__*/_interopDefaultLegacy(createBackoff);
|
|
24
27
|
var storage__default = /*#__PURE__*/_interopDefaultLegacy(storage);
|
|
25
28
|
var unfetch__default = /*#__PURE__*/_interopDefaultLegacy(unfetch);
|
|
@@ -154,8 +157,6 @@ var RECONNECTING = 'reconnecting';
|
|
|
154
157
|
var AGENT = 'agent';
|
|
155
158
|
var CUSTOMER = 'customer';
|
|
156
159
|
|
|
157
|
-
var LIVECHAT_ORGANIZATION_ID = 'feaf6c0e-9f43-48ff-9ad0-8e24e0350932';
|
|
158
|
-
|
|
159
160
|
var getAllRequests = function getAllRequests(state) {
|
|
160
161
|
return state.requests;
|
|
161
162
|
};
|
|
@@ -179,9 +180,9 @@ var isDestroyed = function isDestroyed(state) {
|
|
|
179
180
|
return getConnectionStatus(state) === DESTROYED;
|
|
180
181
|
};
|
|
181
182
|
var getEnvPart = function getEnvPart(_ref) {
|
|
182
|
-
var
|
|
183
|
+
var licenseId = _ref.licenseId,
|
|
183
184
|
env = _ref.env;
|
|
184
|
-
if (
|
|
185
|
+
if (licenseId === 1520) {
|
|
185
186
|
return '.staging';
|
|
186
187
|
}
|
|
187
188
|
if (env === 'production') {
|
|
@@ -195,12 +196,12 @@ var getApiOrigin = function getApiOrigin(state) {
|
|
|
195
196
|
return "https://api" + regionPart + getEnvPart(state) + ".livechatinc.com";
|
|
196
197
|
};
|
|
197
198
|
var getServerUrl = function getServerUrl(state) {
|
|
198
|
-
return getApiOrigin(state) + "/v3.
|
|
199
|
+
return getApiOrigin(state) + "/v3.3/customer";
|
|
199
200
|
};
|
|
200
201
|
var createInitialState = function createInitialState(initialStateData) {
|
|
201
202
|
var _initialStateData$app = initialStateData.application,
|
|
202
203
|
application = _initialStateData$app === void 0 ? {} : _initialStateData$app,
|
|
203
|
-
|
|
204
|
+
licenseId = initialStateData.licenseId,
|
|
204
205
|
_initialStateData$gro = initialStateData.groupId,
|
|
205
206
|
groupId = _initialStateData$gro === void 0 ? null : _initialStateData$gro,
|
|
206
207
|
env = initialStateData.env,
|
|
@@ -217,9 +218,9 @@ var createInitialState = function createInitialState(initialStateData) {
|
|
|
217
218
|
return {
|
|
218
219
|
application: _extends({}, application, {
|
|
219
220
|
name: "customer_sdk",
|
|
220
|
-
version: "3.1.
|
|
221
|
+
version: "3.1.5"
|
|
221
222
|
}),
|
|
222
|
-
|
|
223
|
+
licenseId: licenseId,
|
|
223
224
|
env: env,
|
|
224
225
|
groupId: groupId,
|
|
225
226
|
chats: {},
|
|
@@ -673,10 +674,10 @@ var socketDisconnected = function socketDisconnected() {
|
|
|
673
674
|
// TODO: this thing is not really well typed and should be improved
|
|
674
675
|
var sendRequestAction = function sendRequestAction(store, action) {
|
|
675
676
|
action.payload.id = dataUtils.generateUniqueId(store.getState().requests);
|
|
676
|
-
var
|
|
677
|
-
resolve =
|
|
678
|
-
reject =
|
|
679
|
-
promise =
|
|
677
|
+
var _deferred = deferred__default['default'](),
|
|
678
|
+
resolve = _deferred.resolve,
|
|
679
|
+
reject = _deferred.reject,
|
|
680
|
+
promise = _deferred.promise;
|
|
680
681
|
action.payload.promise = promise;
|
|
681
682
|
action.payload.resolve = resolve;
|
|
682
683
|
action.payload.reject = reject;
|
|
@@ -689,39 +690,24 @@ var CUSTOMER_BANNED$1 = 'CUSTOMER_BANNED';
|
|
|
689
690
|
var USERS_LIMIT_REACHED = 'USERS_LIMIT_REACHED';
|
|
690
691
|
var WRONG_PRODUCT_VERSION = 'WRONG_PRODUCT_VERSION';
|
|
691
692
|
|
|
692
|
-
var
|
|
693
|
+
var getSideStorageKey = function getSideStorageKey(store) {
|
|
693
694
|
var _store$getState = store.getState(),
|
|
695
|
+
licenseId = _store$getState.licenseId,
|
|
694
696
|
groupId = _store$getState.groupId,
|
|
695
697
|
uniqueGroups = _store$getState.uniqueGroups;
|
|
696
698
|
return "side_storage_" + licenseId + (uniqueGroups ? ":" + groupId : '');
|
|
697
699
|
};
|
|
698
|
-
var
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
groupId = _store$getState2.groupId,
|
|
702
|
-
uniqueGroups = _store$getState2.uniqueGroups;
|
|
703
|
-
return "side_storage_" + organizationId + (uniqueGroups ? ":" + groupId : '');
|
|
704
|
-
};
|
|
705
|
-
var getSideStorage = function getSideStorage(store, licenseId) {
|
|
706
|
-
var sideStorageLicenseKey = getSideStorageKeyByLicense(store, licenseId);
|
|
707
|
-
var sideStorageOrganizationKey = getSideStorageKeyByOrganization(store);
|
|
708
|
-
return storage__default['default'].getItem(sideStorageLicenseKey)["catch"](dataUtils.noop).then(function (sideStorage) {
|
|
709
|
-
if (!sideStorage) {
|
|
710
|
-
return storage__default['default'].getItem(sideStorageOrganizationKey)["catch"](dataUtils.noop).then(function (organizationSideStorage) {
|
|
711
|
-
return JSON.parse(organizationSideStorage || '{}');
|
|
712
|
-
})["catch"](dataUtils.noop);
|
|
713
|
-
}
|
|
714
|
-
return storage__default['default'].setItem(sideStorageOrganizationKey, sideStorage)["catch"](dataUtils.noop).then(function () {
|
|
715
|
-
return storage__default['default'].removeItem(sideStorageLicenseKey)["catch"](dataUtils.noop).then(function () {
|
|
716
|
-
return JSON.parse(sideStorage);
|
|
717
|
-
})["catch"](dataUtils.noop);
|
|
718
|
-
});
|
|
700
|
+
var getSideStorage = function getSideStorage(store) {
|
|
701
|
+
return storage__default['default'].getItem(getSideStorageKey(store))["catch"](dataUtils.noop).then(function (sideStorage) {
|
|
702
|
+
return JSON.parse(sideStorage || '{}');
|
|
719
703
|
})
|
|
720
704
|
// shouldnt get triggered, just a defensive measure against malformed storage entries
|
|
721
|
-
["catch"](
|
|
705
|
+
["catch"](function () {
|
|
706
|
+
return {};
|
|
707
|
+
});
|
|
722
708
|
};
|
|
723
709
|
var saveSideStorage = function saveSideStorage(store, sideStorage) {
|
|
724
|
-
storage__default['default'].setItem(
|
|
710
|
+
return storage__default['default'].setItem(getSideStorageKey(store), JSON.stringify(sideStorage))["catch"](dataUtils.noop);
|
|
725
711
|
};
|
|
726
712
|
|
|
727
713
|
var taskChain = function taskChain(_ref, onSuccess, onError) {
|
|
@@ -729,7 +715,7 @@ var taskChain = function taskChain(_ref, onSuccess, onError) {
|
|
|
729
715
|
var cancelled = false;
|
|
730
716
|
var next = function next(intermediateResult) {
|
|
731
717
|
var step = steps.shift();
|
|
732
|
-
|
|
718
|
+
promiseTry__default['default'](function () {
|
|
733
719
|
return step(intermediateResult);
|
|
734
720
|
}).then(function (result) {
|
|
735
721
|
if (cancelled) {
|
|
@@ -762,7 +748,7 @@ var delay = function delay(ms) {
|
|
|
762
748
|
setTimeout(resolve, ms);
|
|
763
749
|
});
|
|
764
750
|
};
|
|
765
|
-
function createLoginTask(auth, customerDataProvider
|
|
751
|
+
function createLoginTask(auth, customerDataProvider) {
|
|
766
752
|
var store;
|
|
767
753
|
var sentPage = null;
|
|
768
754
|
var task;
|
|
@@ -783,7 +769,7 @@ function createLoginTask(auth, customerDataProvider, licenseId) {
|
|
|
783
769
|
return store.dispatch(reconnect(currentBackoffStrategy.duration()));
|
|
784
770
|
};
|
|
785
771
|
var getTokenAndSideStorage = function getTokenAndSideStorage() {
|
|
786
|
-
return Promise.all([auth.getToken(), getSideStorage(store
|
|
772
|
+
return Promise.all([auth.getToken(), getSideStorage(store)]);
|
|
787
773
|
};
|
|
788
774
|
var dispatchSelfId = function dispatchSelfId(_ref2) {
|
|
789
775
|
var token = _ref2[0],
|
|
@@ -923,7 +909,7 @@ var checkGoals = function checkGoals(store, auth, sessionFields) {
|
|
|
923
909
|
return;
|
|
924
910
|
}
|
|
925
911
|
var query = urlUtils.buildQueryString({
|
|
926
|
-
|
|
912
|
+
license_id: state.licenseId
|
|
927
913
|
});
|
|
928
914
|
var payload = {
|
|
929
915
|
session_fields: parseCustomerSessionFields(sessionFields || {}),
|
|
@@ -1422,11 +1408,11 @@ var sendRequest$1 = function sendRequest(socket, _ref3) {
|
|
|
1422
1408
|
{
|
|
1423
1409
|
var upgradedPushes = [];
|
|
1424
1410
|
socket.emit(_extends({}, frame, {
|
|
1425
|
-
version: '3.
|
|
1411
|
+
version: '3.3',
|
|
1426
1412
|
payload: _extends({}, frame.payload, {
|
|
1427
1413
|
pushes: {
|
|
1428
|
-
// '3.
|
|
1429
|
-
'3.
|
|
1414
|
+
// '3.4': upgradedPushes,
|
|
1415
|
+
'3.3': dataUtils.values(serverPushActions).filter(function (pushAction) {
|
|
1430
1416
|
return (
|
|
1431
1417
|
// `customer_disconnected` can be sent immediately after opening the connection, before it even received login request
|
|
1432
1418
|
// therefore it's not possible to subscribe for a particular version of this push - the "connection version" is always used
|
|
@@ -1596,10 +1582,9 @@ var createSideEffectsHandler = (function (_ref9) {
|
|
|
1596
1582
|
var auth = _ref9.auth,
|
|
1597
1583
|
customerDataProvider = _ref9.customerDataProvider,
|
|
1598
1584
|
emitter = _ref9.emitter,
|
|
1599
|
-
socket = _ref9.socket
|
|
1600
|
-
licenseId = _ref9.licenseId;
|
|
1585
|
+
socket = _ref9.socket;
|
|
1601
1586
|
var emit = emitter.emit;
|
|
1602
|
-
var loginTask = createLoginTask(auth, customerDataProvider
|
|
1587
|
+
var loginTask = createLoginTask(auth, customerDataProvider);
|
|
1603
1588
|
|
|
1604
1589
|
// TODO: using Store type here is a lie, middleware only provides MiddlewareAPI here
|
|
1605
1590
|
return function (action, store) {
|
|
@@ -1896,7 +1881,7 @@ var initialize = function initialize(store, emitter) {
|
|
|
1896
1881
|
var url = (getServerUrl(state) + "/rtm/ws").replace(/^https/, 'wss');
|
|
1897
1882
|
return createPlatformClient__default['default'](url, {
|
|
1898
1883
|
query: {
|
|
1899
|
-
|
|
1884
|
+
license_id: state.licenseId
|
|
1900
1885
|
},
|
|
1901
1886
|
emitter: emitter
|
|
1902
1887
|
});
|
|
@@ -2188,17 +2173,16 @@ var parseListChatsResponse = function parseListChatsResponse(payload) {
|
|
|
2188
2173
|
var lastEventSummary = dataUtils.last(lastEventSummariesArray.sort(function (eventSummaryA, eventSummaryB) {
|
|
2189
2174
|
return eventSummaryA.thread_id === eventSummaryB.thread_id ? dataUtils.stringCompare(eventSummaryA.event.created_at, eventSummaryB.event.created_at) : dataUtils.stringCompare(eventSummaryA.thread_created_at, eventSummaryB.thread_created_at);
|
|
2190
2175
|
}));
|
|
2191
|
-
if (lastEventSummary
|
|
2176
|
+
if (lastEventSummary) {
|
|
2192
2177
|
chatSummary.lastEvent = chatSummary.lastEventsPerType[lastEventSummary.event.type];
|
|
2193
2178
|
}
|
|
2194
2179
|
return chatSummary;
|
|
2195
2180
|
});
|
|
2196
2181
|
return {
|
|
2197
2182
|
chatsSummary: dataUtils.numericSortBy(function (_ref4) {
|
|
2198
|
-
var _ref5;
|
|
2199
2183
|
var lastEvent = _ref4.lastEvent,
|
|
2200
2184
|
order = _ref4.order;
|
|
2201
|
-
return -1 * (
|
|
2185
|
+
return -1 * (lastEvent !== undefined ? lastEvent.timestamp : order);
|
|
2202
2186
|
}, chatsSummary),
|
|
2203
2187
|
totalChats: payload.total_chats,
|
|
2204
2188
|
users: dataUtils.uniqBy(function (user) {
|
|
@@ -2375,9 +2359,9 @@ var parsePush = function parsePush(push) {
|
|
|
2375
2359
|
};
|
|
2376
2360
|
}
|
|
2377
2361
|
};
|
|
2378
|
-
var parseResponse = function parseResponse(
|
|
2379
|
-
var request =
|
|
2380
|
-
response =
|
|
2362
|
+
var parseResponse = function parseResponse(_ref5) {
|
|
2363
|
+
var request = _ref5.request,
|
|
2364
|
+
response = _ref5.response;
|
|
2381
2365
|
switch (response.action) {
|
|
2382
2366
|
case ACCEPT_GREETING:
|
|
2383
2367
|
return {
|
|
@@ -2631,10 +2615,9 @@ var createTicketBody = function createTicketBody(state, _ref) {
|
|
|
2631
2615
|
customerId = _ref.customerId,
|
|
2632
2616
|
_ref$groupId = _ref.groupId,
|
|
2633
2617
|
groupId = _ref$groupId === void 0 ? state.groupId : _ref$groupId,
|
|
2634
|
-
licenseId = _ref.licenseId,
|
|
2635
2618
|
timeZone = _ref.timeZone;
|
|
2636
2619
|
var ticketBody = _extends({
|
|
2637
|
-
licence_id: licenseId,
|
|
2620
|
+
licence_id: state.licenseId,
|
|
2638
2621
|
ticket_message: '',
|
|
2639
2622
|
offline_message: '',
|
|
2640
2623
|
visitor_id: customerId,
|
|
@@ -2714,7 +2697,6 @@ var createTicketBody = function createTicketBody(state, _ref) {
|
|
|
2714
2697
|
var sendTicketForm = function sendTicketForm(store, auth, _ref2) {
|
|
2715
2698
|
var filledForm = _ref2.filledForm,
|
|
2716
2699
|
groupId = _ref2.groupId,
|
|
2717
|
-
licenseId = _ref2.licenseId,
|
|
2718
2700
|
timeZone = _ref2.timeZone;
|
|
2719
2701
|
return auth.getToken().then(function (token) {
|
|
2720
2702
|
var state = store.getState();
|
|
@@ -2726,7 +2708,6 @@ var sendTicketForm = function sendTicketForm(store, auth, _ref2) {
|
|
|
2726
2708
|
fields: filledForm.fields,
|
|
2727
2709
|
customerId: token.entityId,
|
|
2728
2710
|
groupId: groupId,
|
|
2729
|
-
licenseId: licenseId,
|
|
2730
2711
|
timeZone: timeZone
|
|
2731
2712
|
});
|
|
2732
2713
|
return unfetch__default['default'](url, {
|
|
@@ -2811,7 +2792,7 @@ var uploadFile = function uploadFile(_ref, _ref2) {
|
|
|
2811
2792
|
validateFile(file);
|
|
2812
2793
|
var state = store.getState();
|
|
2813
2794
|
var query = urlUtils.buildQueryString({
|
|
2814
|
-
|
|
2795
|
+
license_id: state.licenseId
|
|
2815
2796
|
});
|
|
2816
2797
|
var url = getServerUrl(state) + "/action/" + UPLOAD_FILE + "?" + query;
|
|
2817
2798
|
var payload = {
|
|
@@ -2877,7 +2858,7 @@ var makeGraylogRequest = function makeGraylogRequest(url, body) {
|
|
|
2877
2858
|
*/
|
|
2878
2859
|
var log = function log(_ref) {
|
|
2879
2860
|
var env = _ref.env,
|
|
2880
|
-
|
|
2861
|
+
licenseId = _ref.licenseId,
|
|
2881
2862
|
eventName = _ref.eventName;
|
|
2882
2863
|
if (env !== 'production' || "customer_sdk" !== 'customer_sdk') {
|
|
2883
2864
|
return Promise.resolve();
|
|
@@ -2885,10 +2866,10 @@ var log = function log(_ref) {
|
|
|
2885
2866
|
var message = {
|
|
2886
2867
|
event_name: eventName,
|
|
2887
2868
|
severity: 'Informational',
|
|
2888
|
-
sdkVersion: "3.1.
|
|
2869
|
+
sdkVersion: "3.1.5"
|
|
2889
2870
|
};
|
|
2890
2871
|
var body = {
|
|
2891
|
-
|
|
2872
|
+
licence_id: licenseId,
|
|
2892
2873
|
event_id: 'chat_widget_customer_sdk',
|
|
2893
2874
|
message: JSON.stringify(message)
|
|
2894
2875
|
};
|
|
@@ -3006,7 +2987,7 @@ var debug = (function (_sdk) {
|
|
|
3006
2987
|
});
|
|
3007
2988
|
|
|
3008
2989
|
var CHATS_PAGINATION_MAX_LIMIT = 25;
|
|
3009
|
-
var init = function init(config, env
|
|
2990
|
+
var init = function init(config, env) {
|
|
3010
2991
|
if (env === void 0) {
|
|
3011
2992
|
env = 'production';
|
|
3012
2993
|
}
|
|
@@ -3021,13 +3002,12 @@ var init = function init(config, env, licenseId) {
|
|
|
3021
3002
|
}));
|
|
3022
3003
|
var emitter = mitt__default['default']();
|
|
3023
3004
|
var socket = createSocketClient(store);
|
|
3024
|
-
var auth = typeof identityProvider === 'function' ? identityProvider() : createAuth__default['default'](instanceConfig,
|
|
3005
|
+
var auth = typeof identityProvider === 'function' ? identityProvider() : createAuth__default['default'](instanceConfig, env);
|
|
3025
3006
|
store.addSideEffectsHandler(createSideEffectsHandler({
|
|
3026
3007
|
emitter: emitter,
|
|
3027
3008
|
socket: socket,
|
|
3028
3009
|
auth: auth,
|
|
3029
|
-
customerDataProvider: customerDataProvider
|
|
3030
|
-
licenseId: licenseId
|
|
3010
|
+
customerDataProvider: customerDataProvider
|
|
3031
3011
|
}));
|
|
3032
3012
|
socketListener(store, socket);
|
|
3033
3013
|
var sendRequestAction$1 = sendRequestAction.bind(null, store);
|
|
@@ -3226,7 +3206,7 @@ var init = function init(config, env, licenseId) {
|
|
|
3226
3206
|
resumeChat: function resumeChat(data) {
|
|
3227
3207
|
log({
|
|
3228
3208
|
env: env,
|
|
3229
|
-
|
|
3209
|
+
licenseId: config.licenseId,
|
|
3230
3210
|
eventName: 'chat_started'
|
|
3231
3211
|
});
|
|
3232
3212
|
return sendRequestAction$1(sendRequest(RESUME_CHAT, parseResumeChatData(data)));
|
|
@@ -3281,7 +3261,7 @@ var init = function init(config, env, licenseId) {
|
|
|
3281
3261
|
}
|
|
3282
3262
|
log({
|
|
3283
3263
|
env: env,
|
|
3284
|
-
|
|
3264
|
+
licenseId: config.licenseId,
|
|
3285
3265
|
eventName: 'chat_started'
|
|
3286
3266
|
});
|
|
3287
3267
|
return sendRequestAction$1(sendRequest(START_CHAT, parseStartChatData(data)));
|