stream-chat 8.16.0 → 8.18.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/dist/browser.es.js +979 -474
- package/dist/browser.es.js.map +1 -1
- package/dist/browser.full-bundle.min.js +1 -1
- package/dist/browser.full-bundle.min.js.map +1 -1
- package/dist/browser.js +980 -473
- package/dist/browser.js.map +1 -1
- package/dist/index.es.js +979 -474
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +980 -473
- package/dist/index.js.map +1 -1
- package/dist/types/campaign.d.ts +35 -0
- package/dist/types/campaign.d.ts.map +1 -0
- package/dist/types/channel.d.ts.map +1 -1
- package/dist/types/client.d.ts +45 -46
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/segment.d.ts +35 -0
- package/dist/types/segment.d.ts.map +1 -0
- package/dist/types/types.d.ts +43 -14
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +3 -7
- package/src/campaign.ts +97 -0
- package/src/channel.ts +14 -2
- package/src/client.ts +116 -88
- package/src/index.ts +2 -0
- package/src/segment.ts +89 -0
- package/src/types.ts +44 -14
package/dist/index.js
CHANGED
|
@@ -1993,7 +1993,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1993
1993
|
key: "updatePartial",
|
|
1994
1994
|
value: function () {
|
|
1995
1995
|
var _updatePartial = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee8(update) {
|
|
1996
|
-
var
|
|
1996
|
+
var _this$data2, _this$data3;
|
|
1997
|
+
|
|
1998
|
+
var data, areCapabilitiesChanged;
|
|
1997
1999
|
return _regeneratorRuntime__default['default'].wrap(function _callee8$(_context8) {
|
|
1998
2000
|
while (1) {
|
|
1999
2001
|
switch (_context8.prev = _context8.next) {
|
|
@@ -2003,10 +2005,20 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2003
2005
|
|
|
2004
2006
|
case 2:
|
|
2005
2007
|
data = _context8.sent;
|
|
2006
|
-
this.data = data.
|
|
2008
|
+
areCapabilitiesChanged = _toConsumableArray__default['default'](data.channel.own_capabilities || []).sort().join() !== _toConsumableArray__default['default'](Array.isArray((_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2.own_capabilities) ? (_this$data3 = this.data) === null || _this$data3 === void 0 ? void 0 : _this$data3.own_capabilities : []).sort().join();
|
|
2009
|
+
this.data = data.channel; // If the capabiltities are changed, we trigger the `capabilities.changed` event.
|
|
2010
|
+
|
|
2011
|
+
if (areCapabilitiesChanged) {
|
|
2012
|
+
this.getClient().dispatchEvent({
|
|
2013
|
+
type: 'capabilities.changed',
|
|
2014
|
+
cid: this.cid,
|
|
2015
|
+
own_capabilities: data.channel.own_capabilities
|
|
2016
|
+
});
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2007
2019
|
return _context8.abrupt("return", data);
|
|
2008
2020
|
|
|
2009
|
-
case
|
|
2021
|
+
case 7:
|
|
2010
2022
|
case "end":
|
|
2011
2023
|
return _context8.stop();
|
|
2012
2024
|
}
|
|
@@ -2820,7 +2832,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2820
2832
|
|
|
2821
2833
|
this._checkInitialized();
|
|
2822
2834
|
|
|
2823
|
-
if ((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) {
|
|
2835
|
+
if (!(!((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) && !this.getClient()._isUsingServerAuth())) {
|
|
2824
2836
|
_context26.next = 4;
|
|
2825
2837
|
break;
|
|
2826
2838
|
}
|
|
@@ -2867,7 +2879,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2867
2879
|
case 0:
|
|
2868
2880
|
this._checkInitialized();
|
|
2869
2881
|
|
|
2870
|
-
if ((_this$getConfig4 = this.getConfig()) !== null && _this$getConfig4 !== void 0 && _this$getConfig4.read_events) {
|
|
2882
|
+
if (!(!((_this$getConfig4 = this.getConfig()) !== null && _this$getConfig4 !== void 0 && _this$getConfig4.read_events) && !this.getClient()._isUsingServerAuth())) {
|
|
2871
2883
|
_context27.next = 3;
|
|
2872
2884
|
break;
|
|
2873
2885
|
}
|
|
@@ -3152,7 +3164,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3152
3164
|
}, {
|
|
3153
3165
|
key: "_countMessageAsUnread",
|
|
3154
3166
|
value: function _countMessageAsUnread(message) {
|
|
3155
|
-
var _message$user, _message$user2, _this$
|
|
3167
|
+
var _message$user, _message$user2, _this$data4, _this$data5;
|
|
3156
3168
|
|
|
3157
3169
|
if (message.shadowed) return false;
|
|
3158
3170
|
if (message.silent) return false;
|
|
@@ -3161,7 +3173,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3161
3173
|
if ((_message$user2 = message.user) !== null && _message$user2 !== void 0 && _message$user2.id && this.getClient().userMuteStatus(message.user.id)) return false;
|
|
3162
3174
|
if (message.type === 'system') return false; // Return false if channel doesn't allow read events.
|
|
3163
3175
|
|
|
3164
|
-
if (Array.isArray((_this$
|
|
3176
|
+
if (Array.isArray((_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.own_capabilities) && !((_this$data5 = this.data) !== null && _this$data5 !== void 0 && _this$data5.own_capabilities.includes('read-events'))) return false;
|
|
3165
3177
|
if (this.muteStatus().muted) return false;
|
|
3166
3178
|
return true;
|
|
3167
3179
|
}
|
|
@@ -3236,7 +3248,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3236
3248
|
*/
|
|
3237
3249
|
function () {
|
|
3238
3250
|
var _query = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee32(options) {
|
|
3239
|
-
var _this$
|
|
3251
|
+
var _this$data6, _this$data7;
|
|
3240
3252
|
|
|
3241
3253
|
var messageSetToAddToIfDoesNotExist,
|
|
3242
3254
|
queryURL,
|
|
@@ -3299,7 +3311,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3299
3311
|
|
|
3300
3312
|
|
|
3301
3313
|
_this$_initializeStat = this._initializeState(state, messageSetToAddToIfDoesNotExist), messageSet = _this$_initializeStat.messageSet;
|
|
3302
|
-
areCapabilitiesChanged = _toConsumableArray__default['default'](state.channel.own_capabilities || []).sort().join() !== _toConsumableArray__default['default'](Array.isArray((_this$
|
|
3314
|
+
areCapabilitiesChanged = _toConsumableArray__default['default'](state.channel.own_capabilities || []).sort().join() !== _toConsumableArray__default['default'](Array.isArray((_this$data6 = this.data) === null || _this$data6 === void 0 ? void 0 : _this$data6.own_capabilities) ? (_this$data7 = this.data) === null || _this$data7 === void 0 ? void 0 : _this$data7.own_capabilities : []).sort().join();
|
|
3303
3315
|
this.data = state.channel;
|
|
3304
3316
|
this.offlineMode = false;
|
|
3305
3317
|
|
|
@@ -6106,126 +6118,664 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
6106
6118
|
return WSConnectionFallback;
|
|
6107
6119
|
}();
|
|
6108
6120
|
|
|
6109
|
-
|
|
6121
|
+
var Campaign = /*#__PURE__*/function () {
|
|
6122
|
+
function Campaign(client, id, data) {
|
|
6123
|
+
_classCallCheck__default['default'](this, Campaign);
|
|
6110
6124
|
|
|
6111
|
-
|
|
6125
|
+
_defineProperty__default['default'](this, "id", void 0);
|
|
6112
6126
|
|
|
6113
|
-
|
|
6114
|
-
* Utility Types
|
|
6115
|
-
*/
|
|
6127
|
+
_defineProperty__default['default'](this, "data", void 0);
|
|
6116
6128
|
|
|
6117
|
-
|
|
6118
|
-
//alias to avoid breaking change
|
|
6129
|
+
_defineProperty__default['default'](this, "client", void 0);
|
|
6119
6130
|
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
// Thumb URL(thumb_url) is added considering video attachments as the backend will return the thumbnail in the response.
|
|
6131
|
+
this.client = client;
|
|
6132
|
+
this.id = id;
|
|
6133
|
+
this.data = data;
|
|
6134
|
+
}
|
|
6125
6135
|
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6136
|
+
_createClass__default['default'](Campaign, [{
|
|
6137
|
+
key: "create",
|
|
6138
|
+
value: function () {
|
|
6139
|
+
var _create = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
|
6140
|
+
var _this$data, _this$data2, _this$data3, _this$data4, _this$data5, _this$data6, _this$data7, _this$data8;
|
|
6130
6141
|
|
|
6131
|
-
|
|
6132
|
-
|
|
6142
|
+
var body, result;
|
|
6143
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
6144
|
+
while (1) {
|
|
6145
|
+
switch (_context.prev = _context.next) {
|
|
6146
|
+
case 0:
|
|
6147
|
+
body = {
|
|
6148
|
+
id: this.id,
|
|
6149
|
+
message_template: (_this$data = this.data) === null || _this$data === void 0 ? void 0 : _this$data.message_template,
|
|
6150
|
+
segment_ids: (_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2.segment_ids,
|
|
6151
|
+
sender_id: (_this$data3 = this.data) === null || _this$data3 === void 0 ? void 0 : _this$data3.sender_id,
|
|
6152
|
+
channel_template: (_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.channel_template,
|
|
6153
|
+
create_channels: (_this$data5 = this.data) === null || _this$data5 === void 0 ? void 0 : _this$data5.create_channels,
|
|
6154
|
+
description: (_this$data6 = this.data) === null || _this$data6 === void 0 ? void 0 : _this$data6.description,
|
|
6155
|
+
name: (_this$data7 = this.data) === null || _this$data7 === void 0 ? void 0 : _this$data7.name,
|
|
6156
|
+
user_ids: (_this$data8 = this.data) === null || _this$data8 === void 0 ? void 0 : _this$data8.user_ids
|
|
6157
|
+
};
|
|
6158
|
+
_context.next = 3;
|
|
6159
|
+
return this.client.createCampaign(body);
|
|
6133
6160
|
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6161
|
+
case 3:
|
|
6162
|
+
result = _context.sent;
|
|
6163
|
+
this.id = result.campaign.id;
|
|
6164
|
+
this.data = result.campaign;
|
|
6165
|
+
return _context.abrupt("return", result);
|
|
6137
6166
|
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6167
|
+
case 7:
|
|
6168
|
+
case "end":
|
|
6169
|
+
return _context.stop();
|
|
6170
|
+
}
|
|
6171
|
+
}
|
|
6172
|
+
}, _callee, this);
|
|
6173
|
+
}));
|
|
6141
6174
|
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6175
|
+
function create() {
|
|
6176
|
+
return _create.apply(this, arguments);
|
|
6177
|
+
}
|
|
6145
6178
|
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6179
|
+
return create;
|
|
6180
|
+
}()
|
|
6181
|
+
}, {
|
|
6182
|
+
key: "verifyCampaignId",
|
|
6183
|
+
value: function verifyCampaignId() {
|
|
6184
|
+
if (!this.id) {
|
|
6185
|
+
throw new Error('Campaign id is missing. Either create the campaign using campaign.create() or set the id during instantiation - const campaign = client.campaign(id)');
|
|
6186
|
+
}
|
|
6187
|
+
}
|
|
6188
|
+
}, {
|
|
6189
|
+
key: "start",
|
|
6190
|
+
value: function () {
|
|
6191
|
+
var _start = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(scheduledFor) {
|
|
6192
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
6193
|
+
while (1) {
|
|
6194
|
+
switch (_context2.prev = _context2.next) {
|
|
6195
|
+
case 0:
|
|
6196
|
+
this.verifyCampaignId();
|
|
6197
|
+
_context2.next = 3;
|
|
6198
|
+
return this.client.startCampaign(this.id, scheduledFor);
|
|
6149
6199
|
|
|
6150
|
-
|
|
6151
|
-
|
|
6200
|
+
case 3:
|
|
6201
|
+
return _context2.abrupt("return", _context2.sent);
|
|
6152
6202
|
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
`messages`:
|
|
6161
|
-
- soft: marks all user messages as deleted without removing any related message data
|
|
6162
|
-
- pruning: marks all user messages as deleted, nullifies message information and removes some message data such as reactions and flags
|
|
6163
|
-
- hard: deletes messages completely with all related information
|
|
6164
|
-
`new_channel_owner_id`: any channels owned by the hard-deleted user will be transferred to this user ID
|
|
6165
|
-
*/
|
|
6166
|
-
// TODO: add better typing
|
|
6167
|
-
var ErrorFromResponse = /*#__PURE__*/function (_Error) {
|
|
6168
|
-
_inherits__default['default'](ErrorFromResponse, _Error);
|
|
6203
|
+
case 4:
|
|
6204
|
+
case "end":
|
|
6205
|
+
return _context2.stop();
|
|
6206
|
+
}
|
|
6207
|
+
}
|
|
6208
|
+
}, _callee2, this);
|
|
6209
|
+
}));
|
|
6169
6210
|
|
|
6170
|
-
|
|
6211
|
+
function start(_x) {
|
|
6212
|
+
return _start.apply(this, arguments);
|
|
6213
|
+
}
|
|
6171
6214
|
|
|
6172
|
-
|
|
6173
|
-
|
|
6215
|
+
return start;
|
|
6216
|
+
}()
|
|
6217
|
+
}, {
|
|
6218
|
+
key: "update",
|
|
6219
|
+
value: function () {
|
|
6220
|
+
var _update = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3(data) {
|
|
6221
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
|
6222
|
+
while (1) {
|
|
6223
|
+
switch (_context3.prev = _context3.next) {
|
|
6224
|
+
case 0:
|
|
6225
|
+
this.verifyCampaignId();
|
|
6226
|
+
return _context3.abrupt("return", this.client.updateCampaign(this.id, data));
|
|
6174
6227
|
|
|
6175
|
-
|
|
6228
|
+
case 2:
|
|
6229
|
+
case "end":
|
|
6230
|
+
return _context3.stop();
|
|
6231
|
+
}
|
|
6232
|
+
}
|
|
6233
|
+
}, _callee3, this);
|
|
6234
|
+
}));
|
|
6176
6235
|
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6236
|
+
function update(_x2) {
|
|
6237
|
+
return _update.apply(this, arguments);
|
|
6238
|
+
}
|
|
6180
6239
|
|
|
6181
|
-
|
|
6240
|
+
return update;
|
|
6241
|
+
}()
|
|
6242
|
+
}, {
|
|
6243
|
+
key: "delete",
|
|
6244
|
+
value: function () {
|
|
6245
|
+
var _delete2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee4() {
|
|
6246
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee4$(_context4) {
|
|
6247
|
+
while (1) {
|
|
6248
|
+
switch (_context4.prev = _context4.next) {
|
|
6249
|
+
case 0:
|
|
6250
|
+
this.verifyCampaignId();
|
|
6251
|
+
_context4.next = 3;
|
|
6252
|
+
return this.client.delete(this.client.baseURL + "/campaigns/".concat(this.id));
|
|
6182
6253
|
|
|
6183
|
-
|
|
6254
|
+
case 3:
|
|
6255
|
+
return _context4.abrupt("return", _context4.sent);
|
|
6184
6256
|
|
|
6185
|
-
|
|
6257
|
+
case 4:
|
|
6258
|
+
case "end":
|
|
6259
|
+
return _context4.stop();
|
|
6260
|
+
}
|
|
6261
|
+
}
|
|
6262
|
+
}, _callee4, this);
|
|
6263
|
+
}));
|
|
6186
6264
|
|
|
6187
|
-
|
|
6265
|
+
function _delete() {
|
|
6266
|
+
return _delete2.apply(this, arguments);
|
|
6267
|
+
}
|
|
6188
6268
|
|
|
6189
|
-
|
|
6190
|
-
|
|
6269
|
+
return _delete;
|
|
6270
|
+
}()
|
|
6271
|
+
}, {
|
|
6272
|
+
key: "schedule",
|
|
6273
|
+
value: function () {
|
|
6274
|
+
var _schedule = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee5(params) {
|
|
6275
|
+
var scheduledFor, _yield$this$client$pa, campaign;
|
|
6191
6276
|
|
|
6192
|
-
|
|
6193
|
-
|
|
6277
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee5$(_context5) {
|
|
6278
|
+
while (1) {
|
|
6279
|
+
switch (_context5.prev = _context5.next) {
|
|
6280
|
+
case 0:
|
|
6281
|
+
this.verifyCampaignId();
|
|
6282
|
+
scheduledFor = params.scheduledFor;
|
|
6283
|
+
_context5.next = 4;
|
|
6284
|
+
return this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/schedule"), {
|
|
6285
|
+
scheduled_for: scheduledFor
|
|
6286
|
+
});
|
|
6194
6287
|
|
|
6195
|
-
|
|
6288
|
+
case 4:
|
|
6289
|
+
_yield$this$client$pa = _context5.sent;
|
|
6290
|
+
campaign = _yield$this$client$pa.campaign;
|
|
6291
|
+
return _context5.abrupt("return", campaign);
|
|
6196
6292
|
|
|
6197
|
-
|
|
6293
|
+
case 7:
|
|
6294
|
+
case "end":
|
|
6295
|
+
return _context5.stop();
|
|
6296
|
+
}
|
|
6297
|
+
}
|
|
6298
|
+
}, _callee5, this);
|
|
6299
|
+
}));
|
|
6198
6300
|
|
|
6199
|
-
function
|
|
6301
|
+
function schedule(_x3) {
|
|
6302
|
+
return _schedule.apply(this, arguments);
|
|
6303
|
+
}
|
|
6200
6304
|
|
|
6201
|
-
|
|
6305
|
+
return schedule;
|
|
6306
|
+
}()
|
|
6307
|
+
}, {
|
|
6308
|
+
key: "stop",
|
|
6309
|
+
value: function () {
|
|
6310
|
+
var _stop = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee6() {
|
|
6311
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee6$(_context6) {
|
|
6312
|
+
while (1) {
|
|
6313
|
+
switch (_context6.prev = _context6.next) {
|
|
6314
|
+
case 0:
|
|
6315
|
+
this.verifyCampaignId();
|
|
6316
|
+
return _context6.abrupt("return", this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/stop")));
|
|
6202
6317
|
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6318
|
+
case 2:
|
|
6319
|
+
case "end":
|
|
6320
|
+
return _context6.stop();
|
|
6321
|
+
}
|
|
6322
|
+
}
|
|
6323
|
+
}, _callee6, this);
|
|
6324
|
+
}));
|
|
6207
6325
|
|
|
6208
|
-
|
|
6326
|
+
function stop() {
|
|
6327
|
+
return _stop.apply(this, arguments);
|
|
6328
|
+
}
|
|
6209
6329
|
|
|
6210
|
-
|
|
6330
|
+
return stop;
|
|
6331
|
+
}()
|
|
6332
|
+
}, {
|
|
6333
|
+
key: "pause",
|
|
6334
|
+
value: function () {
|
|
6335
|
+
var _pause = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee7() {
|
|
6336
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee7$(_context7) {
|
|
6337
|
+
while (1) {
|
|
6338
|
+
switch (_context7.prev = _context7.next) {
|
|
6339
|
+
case 0:
|
|
6340
|
+
this.verifyCampaignId();
|
|
6341
|
+
return _context7.abrupt("return", this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/pause")));
|
|
6211
6342
|
|
|
6212
|
-
|
|
6343
|
+
case 2:
|
|
6344
|
+
case "end":
|
|
6345
|
+
return _context7.stop();
|
|
6346
|
+
}
|
|
6347
|
+
}
|
|
6348
|
+
}, _callee7, this);
|
|
6349
|
+
}));
|
|
6213
6350
|
|
|
6214
|
-
|
|
6351
|
+
function pause() {
|
|
6352
|
+
return _pause.apply(this, arguments);
|
|
6353
|
+
}
|
|
6215
6354
|
|
|
6216
|
-
|
|
6355
|
+
return pause;
|
|
6356
|
+
}()
|
|
6357
|
+
}, {
|
|
6358
|
+
key: "resume",
|
|
6359
|
+
value: function () {
|
|
6360
|
+
var _resume = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee8() {
|
|
6361
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee8$(_context8) {
|
|
6362
|
+
while (1) {
|
|
6363
|
+
switch (_context8.prev = _context8.next) {
|
|
6364
|
+
case 0:
|
|
6365
|
+
this.verifyCampaignId();
|
|
6366
|
+
return _context8.abrupt("return", this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/resume")));
|
|
6217
6367
|
|
|
6218
|
-
|
|
6368
|
+
case 2:
|
|
6369
|
+
case "end":
|
|
6370
|
+
return _context8.stop();
|
|
6371
|
+
}
|
|
6372
|
+
}
|
|
6373
|
+
}, _callee8, this);
|
|
6374
|
+
}));
|
|
6219
6375
|
|
|
6220
|
-
|
|
6376
|
+
function resume() {
|
|
6377
|
+
return _resume.apply(this, arguments);
|
|
6378
|
+
}
|
|
6221
6379
|
|
|
6222
|
-
|
|
6380
|
+
return resume;
|
|
6381
|
+
}()
|
|
6382
|
+
}, {
|
|
6383
|
+
key: "get",
|
|
6384
|
+
value: function () {
|
|
6385
|
+
var _get = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee9() {
|
|
6386
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee9$(_context9) {
|
|
6387
|
+
while (1) {
|
|
6388
|
+
switch (_context9.prev = _context9.next) {
|
|
6389
|
+
case 0:
|
|
6390
|
+
this.verifyCampaignId();
|
|
6391
|
+
return _context9.abrupt("return", this.client.getCampaign(this.id));
|
|
6223
6392
|
|
|
6224
|
-
|
|
6393
|
+
case 2:
|
|
6394
|
+
case "end":
|
|
6395
|
+
return _context9.stop();
|
|
6396
|
+
}
|
|
6397
|
+
}
|
|
6398
|
+
}, _callee9, this);
|
|
6399
|
+
}));
|
|
6225
6400
|
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6401
|
+
function get() {
|
|
6402
|
+
return _get.apply(this, arguments);
|
|
6403
|
+
}
|
|
6404
|
+
|
|
6405
|
+
return get;
|
|
6406
|
+
}()
|
|
6407
|
+
}]);
|
|
6408
|
+
|
|
6409
|
+
return Campaign;
|
|
6410
|
+
}();
|
|
6411
|
+
|
|
6412
|
+
var Segment = /*#__PURE__*/function () {
|
|
6413
|
+
function Segment(client, type, id, data) {
|
|
6414
|
+
_classCallCheck__default['default'](this, Segment);
|
|
6415
|
+
|
|
6416
|
+
_defineProperty__default['default'](this, "type", void 0);
|
|
6417
|
+
|
|
6418
|
+
_defineProperty__default['default'](this, "id", void 0);
|
|
6419
|
+
|
|
6420
|
+
_defineProperty__default['default'](this, "client", void 0);
|
|
6421
|
+
|
|
6422
|
+
_defineProperty__default['default'](this, "data", void 0);
|
|
6423
|
+
|
|
6424
|
+
this.client = client;
|
|
6425
|
+
this.type = type;
|
|
6426
|
+
this.id = id;
|
|
6427
|
+
this.data = data;
|
|
6428
|
+
}
|
|
6429
|
+
|
|
6430
|
+
_createClass__default['default'](Segment, [{
|
|
6431
|
+
key: "create",
|
|
6432
|
+
value: function () {
|
|
6433
|
+
var _create = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
|
6434
|
+
var _this$data, _this$data2, _this$data3, _this$data4;
|
|
6435
|
+
|
|
6436
|
+
var body;
|
|
6437
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
6438
|
+
while (1) {
|
|
6439
|
+
switch (_context.prev = _context.next) {
|
|
6440
|
+
case 0:
|
|
6441
|
+
body = {
|
|
6442
|
+
id: this.id,
|
|
6443
|
+
type: this.type,
|
|
6444
|
+
name: (_this$data = this.data) === null || _this$data === void 0 ? void 0 : _this$data.name,
|
|
6445
|
+
filter: (_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2.filter,
|
|
6446
|
+
description: (_this$data3 = this.data) === null || _this$data3 === void 0 ? void 0 : _this$data3.description,
|
|
6447
|
+
all_users: (_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.all_users
|
|
6448
|
+
};
|
|
6449
|
+
return _context.abrupt("return", this.client.post(this.client.baseURL + "/segments", body));
|
|
6450
|
+
|
|
6451
|
+
case 2:
|
|
6452
|
+
case "end":
|
|
6453
|
+
return _context.stop();
|
|
6454
|
+
}
|
|
6455
|
+
}
|
|
6456
|
+
}, _callee, this);
|
|
6457
|
+
}));
|
|
6458
|
+
|
|
6459
|
+
function create() {
|
|
6460
|
+
return _create.apply(this, arguments);
|
|
6461
|
+
}
|
|
6462
|
+
|
|
6463
|
+
return create;
|
|
6464
|
+
}()
|
|
6465
|
+
}, {
|
|
6466
|
+
key: "verifySegmentId",
|
|
6467
|
+
value: function verifySegmentId() {
|
|
6468
|
+
if (!this.id) {
|
|
6469
|
+
throw new Error('Segment id is missing. Either create the segment using segment.create() or set the id during instantiation - const segment = client.segment(id)');
|
|
6470
|
+
}
|
|
6471
|
+
}
|
|
6472
|
+
}, {
|
|
6473
|
+
key: "get",
|
|
6474
|
+
value: function () {
|
|
6475
|
+
var _get = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2() {
|
|
6476
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
6477
|
+
while (1) {
|
|
6478
|
+
switch (_context2.prev = _context2.next) {
|
|
6479
|
+
case 0:
|
|
6480
|
+
this.verifySegmentId();
|
|
6481
|
+
return _context2.abrupt("return", this.client.getSegment(this.id));
|
|
6482
|
+
|
|
6483
|
+
case 2:
|
|
6484
|
+
case "end":
|
|
6485
|
+
return _context2.stop();
|
|
6486
|
+
}
|
|
6487
|
+
}
|
|
6488
|
+
}, _callee2, this);
|
|
6489
|
+
}));
|
|
6490
|
+
|
|
6491
|
+
function get() {
|
|
6492
|
+
return _get.apply(this, arguments);
|
|
6493
|
+
}
|
|
6494
|
+
|
|
6495
|
+
return get;
|
|
6496
|
+
}()
|
|
6497
|
+
}, {
|
|
6498
|
+
key: "update",
|
|
6499
|
+
value: function () {
|
|
6500
|
+
var _update = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3(data) {
|
|
6501
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
|
6502
|
+
while (1) {
|
|
6503
|
+
switch (_context3.prev = _context3.next) {
|
|
6504
|
+
case 0:
|
|
6505
|
+
this.verifySegmentId();
|
|
6506
|
+
return _context3.abrupt("return", this.client.updateSegment(this.id, data));
|
|
6507
|
+
|
|
6508
|
+
case 2:
|
|
6509
|
+
case "end":
|
|
6510
|
+
return _context3.stop();
|
|
6511
|
+
}
|
|
6512
|
+
}
|
|
6513
|
+
}, _callee3, this);
|
|
6514
|
+
}));
|
|
6515
|
+
|
|
6516
|
+
function update(_x) {
|
|
6517
|
+
return _update.apply(this, arguments);
|
|
6518
|
+
}
|
|
6519
|
+
|
|
6520
|
+
return update;
|
|
6521
|
+
}()
|
|
6522
|
+
}, {
|
|
6523
|
+
key: "addTargets",
|
|
6524
|
+
value: function () {
|
|
6525
|
+
var _addTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee4(targets) {
|
|
6526
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee4$(_context4) {
|
|
6527
|
+
while (1) {
|
|
6528
|
+
switch (_context4.prev = _context4.next) {
|
|
6529
|
+
case 0:
|
|
6530
|
+
this.verifySegmentId();
|
|
6531
|
+
return _context4.abrupt("return", this.client.addSegmentTargets(this.id, targets));
|
|
6532
|
+
|
|
6533
|
+
case 2:
|
|
6534
|
+
case "end":
|
|
6535
|
+
return _context4.stop();
|
|
6536
|
+
}
|
|
6537
|
+
}
|
|
6538
|
+
}, _callee4, this);
|
|
6539
|
+
}));
|
|
6540
|
+
|
|
6541
|
+
function addTargets(_x2) {
|
|
6542
|
+
return _addTargets.apply(this, arguments);
|
|
6543
|
+
}
|
|
6544
|
+
|
|
6545
|
+
return addTargets;
|
|
6546
|
+
}()
|
|
6547
|
+
}, {
|
|
6548
|
+
key: "removeTargets",
|
|
6549
|
+
value: function () {
|
|
6550
|
+
var _removeTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee5(targets) {
|
|
6551
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee5$(_context5) {
|
|
6552
|
+
while (1) {
|
|
6553
|
+
switch (_context5.prev = _context5.next) {
|
|
6554
|
+
case 0:
|
|
6555
|
+
this.verifySegmentId();
|
|
6556
|
+
return _context5.abrupt("return", this.client.removeSegmentTargets(this.id, targets));
|
|
6557
|
+
|
|
6558
|
+
case 2:
|
|
6559
|
+
case "end":
|
|
6560
|
+
return _context5.stop();
|
|
6561
|
+
}
|
|
6562
|
+
}
|
|
6563
|
+
}, _callee5, this);
|
|
6564
|
+
}));
|
|
6565
|
+
|
|
6566
|
+
function removeTargets(_x3) {
|
|
6567
|
+
return _removeTargets.apply(this, arguments);
|
|
6568
|
+
}
|
|
6569
|
+
|
|
6570
|
+
return removeTargets;
|
|
6571
|
+
}()
|
|
6572
|
+
}, {
|
|
6573
|
+
key: "delete",
|
|
6574
|
+
value: function () {
|
|
6575
|
+
var _delete2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee6() {
|
|
6576
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee6$(_context6) {
|
|
6577
|
+
while (1) {
|
|
6578
|
+
switch (_context6.prev = _context6.next) {
|
|
6579
|
+
case 0:
|
|
6580
|
+
this.verifySegmentId();
|
|
6581
|
+
return _context6.abrupt("return", this.client.deleteSegment(this.id));
|
|
6582
|
+
|
|
6583
|
+
case 2:
|
|
6584
|
+
case "end":
|
|
6585
|
+
return _context6.stop();
|
|
6586
|
+
}
|
|
6587
|
+
}
|
|
6588
|
+
}, _callee6, this);
|
|
6589
|
+
}));
|
|
6590
|
+
|
|
6591
|
+
function _delete() {
|
|
6592
|
+
return _delete2.apply(this, arguments);
|
|
6593
|
+
}
|
|
6594
|
+
|
|
6595
|
+
return _delete;
|
|
6596
|
+
}()
|
|
6597
|
+
}, {
|
|
6598
|
+
key: "targetExists",
|
|
6599
|
+
value: function () {
|
|
6600
|
+
var _targetExists = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee7(targetId) {
|
|
6601
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee7$(_context7) {
|
|
6602
|
+
while (1) {
|
|
6603
|
+
switch (_context7.prev = _context7.next) {
|
|
6604
|
+
case 0:
|
|
6605
|
+
this.verifySegmentId();
|
|
6606
|
+
return _context7.abrupt("return", this.client.segmentTargetExists(this.id, targetId));
|
|
6607
|
+
|
|
6608
|
+
case 2:
|
|
6609
|
+
case "end":
|
|
6610
|
+
return _context7.stop();
|
|
6611
|
+
}
|
|
6612
|
+
}
|
|
6613
|
+
}, _callee7, this);
|
|
6614
|
+
}));
|
|
6615
|
+
|
|
6616
|
+
function targetExists(_x4) {
|
|
6617
|
+
return _targetExists.apply(this, arguments);
|
|
6618
|
+
}
|
|
6619
|
+
|
|
6620
|
+
return targetExists;
|
|
6621
|
+
}()
|
|
6622
|
+
}, {
|
|
6623
|
+
key: "queryTargets",
|
|
6624
|
+
value: function () {
|
|
6625
|
+
var _queryTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee8() {
|
|
6626
|
+
var filter,
|
|
6627
|
+
sort,
|
|
6628
|
+
options,
|
|
6629
|
+
_args8 = arguments;
|
|
6630
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee8$(_context8) {
|
|
6631
|
+
while (1) {
|
|
6632
|
+
switch (_context8.prev = _context8.next) {
|
|
6633
|
+
case 0:
|
|
6634
|
+
filter = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
|
|
6635
|
+
sort = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : [];
|
|
6636
|
+
options = _args8.length > 2 && _args8[2] !== undefined ? _args8[2] : {};
|
|
6637
|
+
this.verifySegmentId();
|
|
6638
|
+
return _context8.abrupt("return", this.client.querySegmentTargets(this.id, filter, sort, options));
|
|
6639
|
+
|
|
6640
|
+
case 5:
|
|
6641
|
+
case "end":
|
|
6642
|
+
return _context8.stop();
|
|
6643
|
+
}
|
|
6644
|
+
}
|
|
6645
|
+
}, _callee8, this);
|
|
6646
|
+
}));
|
|
6647
|
+
|
|
6648
|
+
function queryTargets() {
|
|
6649
|
+
return _queryTargets.apply(this, arguments);
|
|
6650
|
+
}
|
|
6651
|
+
|
|
6652
|
+
return queryTargets;
|
|
6653
|
+
}()
|
|
6654
|
+
}]);
|
|
6655
|
+
|
|
6656
|
+
return Segment;
|
|
6657
|
+
}();
|
|
6658
|
+
|
|
6659
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf__default['default'](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default['default'](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default['default'](this, result); }; }
|
|
6660
|
+
|
|
6661
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
6662
|
+
|
|
6663
|
+
/**
|
|
6664
|
+
* Utility Types
|
|
6665
|
+
*/
|
|
6666
|
+
|
|
6667
|
+
/* Unknown Record */
|
|
6668
|
+
//alias to avoid breaking change
|
|
6669
|
+
|
|
6670
|
+
/**
|
|
6671
|
+
* Response Types
|
|
6672
|
+
*/
|
|
6673
|
+
// TODO: Figure out a way to strongly type set and unset.
|
|
6674
|
+
// Thumb URL(thumb_url) is added considering video attachments as the backend will return the thumbnail in the response.
|
|
6675
|
+
|
|
6676
|
+
/**
|
|
6677
|
+
* Option Types
|
|
6678
|
+
*/
|
|
6679
|
+
// TODO: rename to UpdateChannelOptions in the next major update and use it in channel._update and/or channel.update
|
|
6680
|
+
|
|
6681
|
+
/** @deprecated use MarkChannelsReadOptions instead */
|
|
6682
|
+
// TODO: rename to UpdateChannelTypeOptions in the next major update
|
|
6683
|
+
|
|
6684
|
+
/**
|
|
6685
|
+
* Event Types
|
|
6686
|
+
*/
|
|
6687
|
+
|
|
6688
|
+
/**
|
|
6689
|
+
* Filter Types
|
|
6690
|
+
*/
|
|
6691
|
+
|
|
6692
|
+
/**
|
|
6693
|
+
* Sort Types
|
|
6694
|
+
*/
|
|
6695
|
+
|
|
6696
|
+
/**
|
|
6697
|
+
* Base Types
|
|
6698
|
+
*/
|
|
6699
|
+
|
|
6700
|
+
/*
|
|
6701
|
+
DeleteUserOptions specifies a collection of one or more `user_ids` to be deleted.
|
|
6702
|
+
|
|
6703
|
+
`user`:
|
|
6704
|
+
- soft: marks user as deleted and retains all user data
|
|
6705
|
+
- pruning: marks user as deleted and nullifies user information
|
|
6706
|
+
- hard: deletes user completely - this requires hard option for messages and conversation as well
|
|
6707
|
+
`conversations`:
|
|
6708
|
+
- soft: marks all conversation channels as deleted (same effect as Delete Channels with 'hard' option disabled)
|
|
6709
|
+
- hard: deletes channel and all its data completely including messages (same effect as Delete Channels with 'hard' option enabled)
|
|
6710
|
+
`messages`:
|
|
6711
|
+
- soft: marks all user messages as deleted without removing any related message data
|
|
6712
|
+
- pruning: marks all user messages as deleted, nullifies message information and removes some message data such as reactions and flags
|
|
6713
|
+
- hard: deletes messages completely with all related information
|
|
6714
|
+
`new_channel_owner_id`: any channels owned by the hard-deleted user will be transferred to this user ID
|
|
6715
|
+
*/
|
|
6716
|
+
// TODO: add better typing
|
|
6717
|
+
var ErrorFromResponse = /*#__PURE__*/function (_Error) {
|
|
6718
|
+
_inherits__default['default'](ErrorFromResponse, _Error);
|
|
6719
|
+
|
|
6720
|
+
var _super = _createSuper(ErrorFromResponse);
|
|
6721
|
+
|
|
6722
|
+
function ErrorFromResponse() {
|
|
6723
|
+
var _this;
|
|
6724
|
+
|
|
6725
|
+
_classCallCheck__default['default'](this, ErrorFromResponse);
|
|
6726
|
+
|
|
6727
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
6728
|
+
args[_key] = arguments[_key];
|
|
6729
|
+
}
|
|
6730
|
+
|
|
6731
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
6732
|
+
|
|
6733
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "code", void 0);
|
|
6734
|
+
|
|
6735
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "response", void 0);
|
|
6736
|
+
|
|
6737
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "status", void 0);
|
|
6738
|
+
|
|
6739
|
+
return _this;
|
|
6740
|
+
}
|
|
6741
|
+
|
|
6742
|
+
return ErrorFromResponse;
|
|
6743
|
+
}( /*#__PURE__*/_wrapNativeSuper__default['default'](Error));
|
|
6744
|
+
|
|
6745
|
+
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
6746
|
+
|
|
6747
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6748
|
+
|
|
6749
|
+
function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
6750
|
+
|
|
6751
|
+
function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
|
|
6752
|
+
|
|
6753
|
+
function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
6754
|
+
var Thread = /*#__PURE__*/function () {
|
|
6755
|
+
function Thread(client, t) {
|
|
6756
|
+
_classCallCheck__default['default'](this, Thread);
|
|
6757
|
+
|
|
6758
|
+
_defineProperty__default['default'](this, "id", void 0);
|
|
6759
|
+
|
|
6760
|
+
_defineProperty__default['default'](this, "latestReplies", []);
|
|
6761
|
+
|
|
6762
|
+
_defineProperty__default['default'](this, "participants", []);
|
|
6763
|
+
|
|
6764
|
+
_defineProperty__default['default'](this, "message", void 0);
|
|
6765
|
+
|
|
6766
|
+
_defineProperty__default['default'](this, "channel", void 0);
|
|
6767
|
+
|
|
6768
|
+
_defineProperty__default['default'](this, "_channel", void 0);
|
|
6769
|
+
|
|
6770
|
+
_defineProperty__default['default'](this, "replyCount", 0);
|
|
6771
|
+
|
|
6772
|
+
_defineProperty__default['default'](this, "_client", void 0);
|
|
6773
|
+
|
|
6774
|
+
_defineProperty__default['default'](this, "read", {});
|
|
6775
|
+
|
|
6776
|
+
this.id = t.parent_message.id;
|
|
6777
|
+
this.message = formatMessage(t.parent_message);
|
|
6778
|
+
this.latestReplies = t.latest_replies.map(formatMessage);
|
|
6229
6779
|
this.participants = t.thread_participants;
|
|
6230
6780
|
this.replyCount = t.reply_count;
|
|
6231
6781
|
this.channel = t.channel;
|
|
@@ -10623,7 +11173,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10623
11173
|
}, {
|
|
10624
11174
|
key: "getUserAgent",
|
|
10625
11175
|
value: function getUserAgent() {
|
|
10626
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.
|
|
11176
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.18.0");
|
|
10627
11177
|
}
|
|
10628
11178
|
}, {
|
|
10629
11179
|
key: "setUserAgent",
|
|
@@ -10920,6 +11470,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10920
11470
|
value: function getExportChannelStatus(id) {
|
|
10921
11471
|
return this.get("".concat(this.baseURL, "/export_channels/").concat(id));
|
|
10922
11472
|
}
|
|
11473
|
+
}, {
|
|
11474
|
+
key: "campaign",
|
|
11475
|
+
value: function campaign(idOrData, data) {
|
|
11476
|
+
if (typeof idOrData === 'string') {
|
|
11477
|
+
return new Campaign(this, idOrData, data);
|
|
11478
|
+
}
|
|
11479
|
+
|
|
11480
|
+
return new Campaign(this, null, idOrData);
|
|
11481
|
+
}
|
|
11482
|
+
}, {
|
|
11483
|
+
key: "segment",
|
|
11484
|
+
value: function segment(type, idOrData, data) {
|
|
11485
|
+
if (typeof idOrData === 'string') {
|
|
11486
|
+
return new Segment(this, type, idOrData, data);
|
|
11487
|
+
}
|
|
11488
|
+
|
|
11489
|
+
return new Segment(this, type, null, idOrData);
|
|
11490
|
+
}
|
|
11491
|
+
}, {
|
|
11492
|
+
key: "validateServerSideAuth",
|
|
11493
|
+
value: function validateServerSideAuth() {
|
|
11494
|
+
if (!this.secret) {
|
|
11495
|
+
throw new Error('Campaigns is a server-side only feature. Please initialize the client with a secret to use this feature.');
|
|
11496
|
+
}
|
|
11497
|
+
}
|
|
10923
11498
|
/**
|
|
10924
11499
|
* createSegment - Creates a segment
|
|
10925
11500
|
*
|
|
@@ -10929,34 +11504,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10929
11504
|
* @param {string} name Segment name (valid UUID)
|
|
10930
11505
|
* @param {SegmentData} params Segment data
|
|
10931
11506
|
*
|
|
10932
|
-
* @return {
|
|
11507
|
+
* @return {{segment: SegmentResponse} & APIResponse} The created Segment
|
|
10933
11508
|
*/
|
|
10934
11509
|
|
|
10935
11510
|
}, {
|
|
10936
11511
|
key: "createSegment",
|
|
10937
11512
|
value: function () {
|
|
10938
11513
|
var _createSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee63(type, id, name, data) {
|
|
10939
|
-
var body
|
|
10940
|
-
|
|
11514
|
+
var body;
|
|
10941
11515
|
return _regeneratorRuntime__default['default'].wrap(function _callee63$(_context63) {
|
|
10942
11516
|
while (1) {
|
|
10943
11517
|
switch (_context63.prev = _context63.next) {
|
|
10944
11518
|
case 0:
|
|
11519
|
+
this.validateServerSideAuth();
|
|
10945
11520
|
body = {
|
|
10946
11521
|
id: id,
|
|
10947
11522
|
type: type,
|
|
10948
11523
|
name: name,
|
|
10949
11524
|
data: data
|
|
10950
11525
|
};
|
|
10951
|
-
_context63.
|
|
10952
|
-
return this.post(this.baseURL + "/segments", body);
|
|
11526
|
+
return _context63.abrupt("return", this.post(this.baseURL + "/segments", body));
|
|
10953
11527
|
|
|
10954
11528
|
case 3:
|
|
10955
|
-
_yield$this$post = _context63.sent;
|
|
10956
|
-
segment = _yield$this$post.segment;
|
|
10957
|
-
return _context63.abrupt("return", segment);
|
|
10958
|
-
|
|
10959
|
-
case 6:
|
|
10960
11529
|
case "end":
|
|
10961
11530
|
return _context63.stop();
|
|
10962
11531
|
}
|
|
@@ -10988,13 +11557,10 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10988
11557
|
while (1) {
|
|
10989
11558
|
switch (_context64.prev = _context64.next) {
|
|
10990
11559
|
case 0:
|
|
10991
|
-
|
|
10992
|
-
return this.createSegment('user', id, name, data);
|
|
11560
|
+
this.validateServerSideAuth();
|
|
11561
|
+
return _context64.abrupt("return", this.createSegment('user', id, name, data));
|
|
10993
11562
|
|
|
10994
11563
|
case 2:
|
|
10995
|
-
return _context64.abrupt("return", _context64.sent);
|
|
10996
|
-
|
|
10997
|
-
case 3:
|
|
10998
11564
|
case "end":
|
|
10999
11565
|
return _context64.stop();
|
|
11000
11566
|
}
|
|
@@ -11026,13 +11592,10 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11026
11592
|
while (1) {
|
|
11027
11593
|
switch (_context65.prev = _context65.next) {
|
|
11028
11594
|
case 0:
|
|
11029
|
-
|
|
11030
|
-
return this.createSegment('channel', id, name, data);
|
|
11595
|
+
this.validateServerSideAuth();
|
|
11596
|
+
return _context65.abrupt("return", this.createSegment('channel', id, name, data));
|
|
11031
11597
|
|
|
11032
11598
|
case 2:
|
|
11033
|
-
return _context65.abrupt("return", _context65.sent);
|
|
11034
|
-
|
|
11035
|
-
case 3:
|
|
11036
11599
|
case "end":
|
|
11037
11600
|
return _context65.stop();
|
|
11038
11601
|
}
|
|
@@ -11046,34 +11609,18 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11046
11609
|
|
|
11047
11610
|
return createChannelSegment;
|
|
11048
11611
|
}()
|
|
11049
|
-
/**
|
|
11050
|
-
* updateSegment - Update a segment
|
|
11051
|
-
*
|
|
11052
|
-
* @param {string} id Segment ID
|
|
11053
|
-
* @param {Partial<UpdateSegmentData>} data Data to update
|
|
11054
|
-
*
|
|
11055
|
-
* @return {Segment} Updated Segment
|
|
11056
|
-
*/
|
|
11057
|
-
|
|
11058
11612
|
}, {
|
|
11059
|
-
key: "
|
|
11613
|
+
key: "getSegment",
|
|
11060
11614
|
value: function () {
|
|
11061
|
-
var
|
|
11062
|
-
var _yield$this$put, segment;
|
|
11063
|
-
|
|
11615
|
+
var _getSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee66(id) {
|
|
11064
11616
|
return _regeneratorRuntime__default['default'].wrap(function _callee66$(_context66) {
|
|
11065
11617
|
while (1) {
|
|
11066
11618
|
switch (_context66.prev = _context66.next) {
|
|
11067
11619
|
case 0:
|
|
11068
|
-
|
|
11069
|
-
return this.
|
|
11620
|
+
this.validateServerSideAuth();
|
|
11621
|
+
return _context66.abrupt("return", this.get(this.baseURL + "/segments/".concat(id)));
|
|
11070
11622
|
|
|
11071
11623
|
case 2:
|
|
11072
|
-
_yield$this$put = _context66.sent;
|
|
11073
|
-
segment = _yield$this$put.segment;
|
|
11074
|
-
return _context66.abrupt("return", segment);
|
|
11075
|
-
|
|
11076
|
-
case 5:
|
|
11077
11624
|
case "end":
|
|
11078
11625
|
return _context66.stop();
|
|
11079
11626
|
}
|
|
@@ -11081,40 +11628,33 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11081
11628
|
}, _callee66, this);
|
|
11082
11629
|
}));
|
|
11083
11630
|
|
|
11084
|
-
function
|
|
11085
|
-
return
|
|
11631
|
+
function getSegment(_x94) {
|
|
11632
|
+
return _getSegment.apply(this, arguments);
|
|
11086
11633
|
}
|
|
11087
11634
|
|
|
11088
|
-
return
|
|
11635
|
+
return getSegment;
|
|
11089
11636
|
}()
|
|
11090
11637
|
/**
|
|
11091
|
-
*
|
|
11638
|
+
* updateSegment - Update a segment
|
|
11092
11639
|
*
|
|
11093
11640
|
* @param {string} id Segment ID
|
|
11094
|
-
* @param {
|
|
11641
|
+
* @param {Partial<UpdateSegmentData>} data Data to update
|
|
11095
11642
|
*
|
|
11096
|
-
* @return {
|
|
11643
|
+
* @return {Segment} Updated Segment
|
|
11097
11644
|
*/
|
|
11098
11645
|
|
|
11099
11646
|
}, {
|
|
11100
|
-
key: "
|
|
11647
|
+
key: "updateSegment",
|
|
11101
11648
|
value: function () {
|
|
11102
|
-
var
|
|
11103
|
-
var body;
|
|
11649
|
+
var _updateSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee67(id, data) {
|
|
11104
11650
|
return _regeneratorRuntime__default['default'].wrap(function _callee67$(_context67) {
|
|
11105
11651
|
while (1) {
|
|
11106
11652
|
switch (_context67.prev = _context67.next) {
|
|
11107
11653
|
case 0:
|
|
11108
|
-
|
|
11109
|
-
|
|
11110
|
-
};
|
|
11111
|
-
_context67.next = 3;
|
|
11112
|
-
return this.post(this.baseURL + "/segments/".concat(id, "/addtargets"), body);
|
|
11654
|
+
this.validateServerSideAuth();
|
|
11655
|
+
return _context67.abrupt("return", this.put(this.baseURL + "/segments/".concat(id), data));
|
|
11113
11656
|
|
|
11114
|
-
case
|
|
11115
|
-
return _context67.abrupt("return", _context67.sent);
|
|
11116
|
-
|
|
11117
|
-
case 4:
|
|
11657
|
+
case 2:
|
|
11118
11658
|
case "end":
|
|
11119
11659
|
return _context67.stop();
|
|
11120
11660
|
}
|
|
@@ -11122,14 +11662,14 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11122
11662
|
}, _callee67, this);
|
|
11123
11663
|
}));
|
|
11124
11664
|
|
|
11125
|
-
function
|
|
11126
|
-
return
|
|
11665
|
+
function updateSegment(_x95, _x96) {
|
|
11666
|
+
return _updateSegment.apply(this, arguments);
|
|
11127
11667
|
}
|
|
11128
11668
|
|
|
11129
|
-
return
|
|
11669
|
+
return updateSegment;
|
|
11130
11670
|
}()
|
|
11131
11671
|
/**
|
|
11132
|
-
*
|
|
11672
|
+
* addSegmentTargets - Add targets to a segment
|
|
11133
11673
|
*
|
|
11134
11674
|
* @param {string} id Segment ID
|
|
11135
11675
|
* @param {string[]} targets Targets to add to the segment
|
|
@@ -11138,24 +11678,21 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11138
11678
|
*/
|
|
11139
11679
|
|
|
11140
11680
|
}, {
|
|
11141
|
-
key: "
|
|
11681
|
+
key: "addSegmentTargets",
|
|
11142
11682
|
value: function () {
|
|
11143
|
-
var
|
|
11683
|
+
var _addSegmentTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee68(id, targets) {
|
|
11144
11684
|
var body;
|
|
11145
11685
|
return _regeneratorRuntime__default['default'].wrap(function _callee68$(_context68) {
|
|
11146
11686
|
while (1) {
|
|
11147
11687
|
switch (_context68.prev = _context68.next) {
|
|
11148
11688
|
case 0:
|
|
11689
|
+
this.validateServerSideAuth();
|
|
11149
11690
|
body = {
|
|
11150
|
-
|
|
11691
|
+
target_ids: targets
|
|
11151
11692
|
};
|
|
11152
|
-
_context68.
|
|
11153
|
-
return this.post(this.baseURL + "/segments/".concat(id, "/deletetargets"), body);
|
|
11693
|
+
return _context68.abrupt("return", this.post(this.baseURL + "/segments/".concat(id, "/addtargets"), body));
|
|
11154
11694
|
|
|
11155
11695
|
case 3:
|
|
11156
|
-
return _context68.abrupt("return", _context68.sent);
|
|
11157
|
-
|
|
11158
|
-
case 4:
|
|
11159
11696
|
case "end":
|
|
11160
11697
|
return _context68.stop();
|
|
11161
11698
|
}
|
|
@@ -11163,43 +11700,34 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11163
11700
|
}, _callee68, this);
|
|
11164
11701
|
}));
|
|
11165
11702
|
|
|
11166
|
-
function
|
|
11167
|
-
return
|
|
11703
|
+
function addSegmentTargets(_x97, _x98) {
|
|
11704
|
+
return _addSegmentTargets.apply(this, arguments);
|
|
11168
11705
|
}
|
|
11169
11706
|
|
|
11170
|
-
return
|
|
11707
|
+
return addSegmentTargets;
|
|
11171
11708
|
}()
|
|
11172
|
-
/**
|
|
11173
|
-
* querySegments - Query Segments
|
|
11174
|
-
*
|
|
11175
|
-
* @param {filter} filter MongoDB style filter conditions
|
|
11176
|
-
* @param {QuerySegmentsOptions} options Options for sorting/paginating the results
|
|
11177
|
-
*
|
|
11178
|
-
* @return {Segment[]} Segments
|
|
11179
|
-
*/
|
|
11180
|
-
|
|
11181
11709
|
}, {
|
|
11182
|
-
key: "
|
|
11710
|
+
key: "querySegmentTargets",
|
|
11183
11711
|
value: function () {
|
|
11184
|
-
var
|
|
11185
|
-
var
|
|
11712
|
+
var _querySegmentTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee69(id) {
|
|
11713
|
+
var filter,
|
|
11714
|
+
sort,
|
|
11715
|
+
options,
|
|
11186
11716
|
_args69 = arguments;
|
|
11187
11717
|
return _regeneratorRuntime__default['default'].wrap(function _callee69$(_context69) {
|
|
11188
11718
|
while (1) {
|
|
11189
11719
|
switch (_context69.prev = _context69.next) {
|
|
11190
11720
|
case 0:
|
|
11191
|
-
|
|
11192
|
-
|
|
11193
|
-
|
|
11194
|
-
|
|
11195
|
-
|
|
11196
|
-
},
|
|
11197
|
-
|
|
11721
|
+
filter = _args69.length > 1 && _args69[1] !== undefined ? _args69[1] : {};
|
|
11722
|
+
sort = _args69.length > 2 && _args69[2] !== undefined ? _args69[2] : [];
|
|
11723
|
+
options = _args69.length > 3 && _args69[3] !== undefined ? _args69[3] : {};
|
|
11724
|
+
this.validateServerSideAuth();
|
|
11725
|
+
return _context69.abrupt("return", this.post(this.baseURL + "/segments/".concat(id, "/targets/query"), _objectSpread({
|
|
11726
|
+
filter: filter || {},
|
|
11727
|
+
sort: sort || []
|
|
11728
|
+
}, options)));
|
|
11198
11729
|
|
|
11199
|
-
case
|
|
11200
|
-
return _context69.abrupt("return", _context69.sent);
|
|
11201
|
-
|
|
11202
|
-
case 4:
|
|
11730
|
+
case 5:
|
|
11203
11731
|
case "end":
|
|
11204
11732
|
return _context69.stop();
|
|
11205
11733
|
}
|
|
@@ -11207,33 +11735,35 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11207
11735
|
}, _callee69, this);
|
|
11208
11736
|
}));
|
|
11209
11737
|
|
|
11210
|
-
function
|
|
11211
|
-
return
|
|
11738
|
+
function querySegmentTargets(_x99) {
|
|
11739
|
+
return _querySegmentTargets.apply(this, arguments);
|
|
11212
11740
|
}
|
|
11213
11741
|
|
|
11214
|
-
return
|
|
11742
|
+
return querySegmentTargets;
|
|
11215
11743
|
}()
|
|
11216
11744
|
/**
|
|
11217
|
-
*
|
|
11745
|
+
* removeSegmentTargets - Remove targets from a segment
|
|
11218
11746
|
*
|
|
11219
11747
|
* @param {string} id Segment ID
|
|
11748
|
+
* @param {string[]} targets Targets to add to the segment
|
|
11220
11749
|
*
|
|
11221
|
-
* @return {
|
|
11750
|
+
* @return {APIResponse} API response
|
|
11222
11751
|
*/
|
|
11223
11752
|
|
|
11224
11753
|
}, {
|
|
11225
|
-
key: "
|
|
11754
|
+
key: "removeSegmentTargets",
|
|
11226
11755
|
value: function () {
|
|
11227
|
-
var
|
|
11756
|
+
var _removeSegmentTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee70(id, targets) {
|
|
11757
|
+
var body;
|
|
11228
11758
|
return _regeneratorRuntime__default['default'].wrap(function _callee70$(_context70) {
|
|
11229
11759
|
while (1) {
|
|
11230
11760
|
switch (_context70.prev = _context70.next) {
|
|
11231
11761
|
case 0:
|
|
11232
|
-
|
|
11233
|
-
|
|
11234
|
-
|
|
11235
|
-
|
|
11236
|
-
return _context70.abrupt("return",
|
|
11762
|
+
this.validateServerSideAuth();
|
|
11763
|
+
body = {
|
|
11764
|
+
target_ids: targets
|
|
11765
|
+
};
|
|
11766
|
+
return _context70.abrupt("return", this.post(this.baseURL + "/segments/".concat(id, "/deletetargets"), body));
|
|
11237
11767
|
|
|
11238
11768
|
case 3:
|
|
11239
11769
|
case "end":
|
|
@@ -11243,34 +11773,37 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11243
11773
|
}, _callee70, this);
|
|
11244
11774
|
}));
|
|
11245
11775
|
|
|
11246
|
-
function
|
|
11247
|
-
return
|
|
11776
|
+
function removeSegmentTargets(_x100, _x101) {
|
|
11777
|
+
return _removeSegmentTargets.apply(this, arguments);
|
|
11248
11778
|
}
|
|
11249
11779
|
|
|
11250
|
-
return
|
|
11780
|
+
return removeSegmentTargets;
|
|
11251
11781
|
}()
|
|
11252
11782
|
/**
|
|
11253
|
-
*
|
|
11783
|
+
* querySegments - Query Segments
|
|
11254
11784
|
*
|
|
11255
|
-
* @param {
|
|
11256
|
-
* @param {
|
|
11785
|
+
* @param {filter} filter MongoDB style filter conditions
|
|
11786
|
+
* @param {QuerySegmentsOptions} options Options for sorting/paginating the results
|
|
11257
11787
|
*
|
|
11258
|
-
* @return {
|
|
11788
|
+
* @return {Segment[]} Segments
|
|
11259
11789
|
*/
|
|
11260
11790
|
|
|
11261
11791
|
}, {
|
|
11262
|
-
key: "
|
|
11792
|
+
key: "querySegments",
|
|
11263
11793
|
value: function () {
|
|
11264
|
-
var
|
|
11794
|
+
var _querySegments = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee71(filter, sort) {
|
|
11795
|
+
var options,
|
|
11796
|
+
_args71 = arguments;
|
|
11265
11797
|
return _regeneratorRuntime__default['default'].wrap(function _callee71$(_context71) {
|
|
11266
11798
|
while (1) {
|
|
11267
11799
|
switch (_context71.prev = _context71.next) {
|
|
11268
11800
|
case 0:
|
|
11269
|
-
|
|
11270
|
-
|
|
11271
|
-
|
|
11272
|
-
|
|
11273
|
-
|
|
11801
|
+
options = _args71.length > 2 && _args71[2] !== undefined ? _args71[2] : {};
|
|
11802
|
+
this.validateServerSideAuth();
|
|
11803
|
+
return _context71.abrupt("return", this.post(this.baseURL + "/segments/query", _objectSpread({
|
|
11804
|
+
filter: filter,
|
|
11805
|
+
sort: sort
|
|
11806
|
+
}, options)));
|
|
11274
11807
|
|
|
11275
11808
|
case 3:
|
|
11276
11809
|
case "end":
|
|
@@ -11280,41 +11813,32 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11280
11813
|
}, _callee71, this);
|
|
11281
11814
|
}));
|
|
11282
11815
|
|
|
11283
|
-
function
|
|
11284
|
-
return
|
|
11816
|
+
function querySegments(_x102, _x103) {
|
|
11817
|
+
return _querySegments.apply(this, arguments);
|
|
11285
11818
|
}
|
|
11286
11819
|
|
|
11287
|
-
return
|
|
11820
|
+
return querySegments;
|
|
11288
11821
|
}()
|
|
11289
11822
|
/**
|
|
11290
|
-
*
|
|
11823
|
+
* deleteSegment - Delete a Campaign Segment
|
|
11291
11824
|
*
|
|
11292
|
-
* @param {
|
|
11825
|
+
* @param {string} id Segment ID
|
|
11293
11826
|
*
|
|
11294
|
-
* @return {
|
|
11827
|
+
* @return {Promise<APIResponse>} The Server Response
|
|
11295
11828
|
*/
|
|
11296
11829
|
|
|
11297
11830
|
}, {
|
|
11298
|
-
key: "
|
|
11831
|
+
key: "deleteSegment",
|
|
11299
11832
|
value: function () {
|
|
11300
|
-
var
|
|
11301
|
-
var _yield$this$post2, campaign;
|
|
11302
|
-
|
|
11833
|
+
var _deleteSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee72(id) {
|
|
11303
11834
|
return _regeneratorRuntime__default['default'].wrap(function _callee72$(_context72) {
|
|
11304
11835
|
while (1) {
|
|
11305
11836
|
switch (_context72.prev = _context72.next) {
|
|
11306
11837
|
case 0:
|
|
11307
|
-
|
|
11308
|
-
return this.
|
|
11309
|
-
campaign: params
|
|
11310
|
-
});
|
|
11838
|
+
this.validateServerSideAuth();
|
|
11839
|
+
return _context72.abrupt("return", this.delete(this.baseURL + "/segments/".concat(id)));
|
|
11311
11840
|
|
|
11312
11841
|
case 2:
|
|
11313
|
-
_yield$this$post2 = _context72.sent;
|
|
11314
|
-
campaign = _yield$this$post2.campaign;
|
|
11315
|
-
return _context72.abrupt("return", campaign);
|
|
11316
|
-
|
|
11317
|
-
case 5:
|
|
11318
11842
|
case "end":
|
|
11319
11843
|
return _context72.stop();
|
|
11320
11844
|
}
|
|
@@ -11322,41 +11846,33 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11322
11846
|
}, _callee72, this);
|
|
11323
11847
|
}));
|
|
11324
11848
|
|
|
11325
|
-
function
|
|
11326
|
-
return
|
|
11849
|
+
function deleteSegment(_x104) {
|
|
11850
|
+
return _deleteSegment.apply(this, arguments);
|
|
11327
11851
|
}
|
|
11328
11852
|
|
|
11329
|
-
return
|
|
11853
|
+
return deleteSegment;
|
|
11330
11854
|
}()
|
|
11331
11855
|
/**
|
|
11332
|
-
*
|
|
11856
|
+
* segmentTargetExists - Check if a target exists in a segment
|
|
11333
11857
|
*
|
|
11858
|
+
* @param {string} segmentId Segment ID
|
|
11859
|
+
* @param {string} targetId Target ID
|
|
11334
11860
|
*
|
|
11335
|
-
* @return {
|
|
11861
|
+
* @return {Promise<APIResponse>} The Server Response
|
|
11336
11862
|
*/
|
|
11337
11863
|
|
|
11338
11864
|
}, {
|
|
11339
|
-
key: "
|
|
11865
|
+
key: "segmentTargetExists",
|
|
11340
11866
|
value: function () {
|
|
11341
|
-
var
|
|
11342
|
-
var options,
|
|
11343
|
-
_args73 = arguments;
|
|
11867
|
+
var _segmentTargetExists = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee73(segmentId, targetId) {
|
|
11344
11868
|
return _regeneratorRuntime__default['default'].wrap(function _callee73$(_context73) {
|
|
11345
11869
|
while (1) {
|
|
11346
11870
|
switch (_context73.prev = _context73.next) {
|
|
11347
11871
|
case 0:
|
|
11348
|
-
|
|
11349
|
-
_context73.
|
|
11350
|
-
return this.get(this.baseURL + "/campaigns", {
|
|
11351
|
-
payload: _objectSpread({
|
|
11352
|
-
filter_conditions: filters
|
|
11353
|
-
}, options)
|
|
11354
|
-
});
|
|
11355
|
-
|
|
11356
|
-
case 3:
|
|
11357
|
-
return _context73.abrupt("return", _context73.sent);
|
|
11872
|
+
this.validateServerSideAuth();
|
|
11873
|
+
return _context73.abrupt("return", this.get(this.baseURL + "/segments/".concat(segmentId, "/target/").concat(targetId)));
|
|
11358
11874
|
|
|
11359
|
-
case
|
|
11875
|
+
case 2:
|
|
11360
11876
|
case "end":
|
|
11361
11877
|
return _context73.stop();
|
|
11362
11878
|
}
|
|
@@ -11364,42 +11880,32 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11364
11880
|
}, _callee73, this);
|
|
11365
11881
|
}));
|
|
11366
11882
|
|
|
11367
|
-
function
|
|
11368
|
-
return
|
|
11883
|
+
function segmentTargetExists(_x105, _x106) {
|
|
11884
|
+
return _segmentTargetExists.apply(this, arguments);
|
|
11369
11885
|
}
|
|
11370
11886
|
|
|
11371
|
-
return
|
|
11887
|
+
return segmentTargetExists;
|
|
11372
11888
|
}()
|
|
11373
11889
|
/**
|
|
11374
|
-
*
|
|
11890
|
+
* createCampaign - Creates a Campaign
|
|
11375
11891
|
*
|
|
11376
|
-
* @param {
|
|
11377
|
-
* @param {Partial<CampaignData>} params Campaign data
|
|
11892
|
+
* @param {CampaignData} params Campaign data
|
|
11378
11893
|
*
|
|
11379
|
-
* @return {Campaign}
|
|
11894
|
+
* @return {Campaign} The Created Campaign
|
|
11380
11895
|
*/
|
|
11381
11896
|
|
|
11382
11897
|
}, {
|
|
11383
|
-
key: "
|
|
11898
|
+
key: "createCampaign",
|
|
11384
11899
|
value: function () {
|
|
11385
|
-
var
|
|
11386
|
-
var _yield$this$put2, campaign;
|
|
11387
|
-
|
|
11900
|
+
var _createCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee74(params) {
|
|
11388
11901
|
return _regeneratorRuntime__default['default'].wrap(function _callee74$(_context74) {
|
|
11389
11902
|
while (1) {
|
|
11390
11903
|
switch (_context74.prev = _context74.next) {
|
|
11391
11904
|
case 0:
|
|
11392
|
-
|
|
11393
|
-
return this.
|
|
11394
|
-
campaign: params
|
|
11395
|
-
});
|
|
11905
|
+
this.validateServerSideAuth();
|
|
11906
|
+
return _context74.abrupt("return", this.post(this.baseURL + "/campaigns", _objectSpread({}, params)));
|
|
11396
11907
|
|
|
11397
11908
|
case 2:
|
|
11398
|
-
_yield$this$put2 = _context74.sent;
|
|
11399
|
-
campaign = _yield$this$put2.campaign;
|
|
11400
|
-
return _context74.abrupt("return", campaign);
|
|
11401
|
-
|
|
11402
|
-
case 5:
|
|
11403
11909
|
case "end":
|
|
11404
11910
|
return _context74.stop();
|
|
11405
11911
|
}
|
|
@@ -11407,32 +11913,22 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11407
11913
|
}, _callee74, this);
|
|
11408
11914
|
}));
|
|
11409
11915
|
|
|
11410
|
-
function
|
|
11411
|
-
return
|
|
11916
|
+
function createCampaign(_x107) {
|
|
11917
|
+
return _createCampaign.apply(this, arguments);
|
|
11412
11918
|
}
|
|
11413
11919
|
|
|
11414
|
-
return
|
|
11920
|
+
return createCampaign;
|
|
11415
11921
|
}()
|
|
11416
|
-
/**
|
|
11417
|
-
* deleteCampaign - Delete a Campaign
|
|
11418
|
-
*
|
|
11419
|
-
* @param {string} id Campaign ID
|
|
11420
|
-
*
|
|
11421
|
-
* @return {Promise<APIResponse>} The Server Response
|
|
11422
|
-
*/
|
|
11423
|
-
|
|
11424
11922
|
}, {
|
|
11425
|
-
key: "
|
|
11923
|
+
key: "getCampaign",
|
|
11426
11924
|
value: function () {
|
|
11427
|
-
var
|
|
11428
|
-
var params,
|
|
11429
|
-
_args75 = arguments;
|
|
11925
|
+
var _getCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee75(id) {
|
|
11430
11926
|
return _regeneratorRuntime__default['default'].wrap(function _callee75$(_context75) {
|
|
11431
11927
|
while (1) {
|
|
11432
11928
|
switch (_context75.prev = _context75.next) {
|
|
11433
11929
|
case 0:
|
|
11434
|
-
|
|
11435
|
-
return _context75.abrupt("return", this.
|
|
11930
|
+
this.validateServerSideAuth();
|
|
11931
|
+
return _context75.abrupt("return", this.get(this.baseURL + "/campaigns/".concat(id)));
|
|
11436
11932
|
|
|
11437
11933
|
case 2:
|
|
11438
11934
|
case "end":
|
|
@@ -11442,43 +11938,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11442
11938
|
}, _callee75, this);
|
|
11443
11939
|
}));
|
|
11444
11940
|
|
|
11445
|
-
function
|
|
11446
|
-
return
|
|
11941
|
+
function getCampaign(_x108) {
|
|
11942
|
+
return _getCampaign.apply(this, arguments);
|
|
11447
11943
|
}
|
|
11448
11944
|
|
|
11449
|
-
return
|
|
11945
|
+
return getCampaign;
|
|
11450
11946
|
}()
|
|
11451
|
-
/**
|
|
11452
|
-
* scheduleCampaign - Schedule a Campaign
|
|
11453
|
-
*
|
|
11454
|
-
* @param {string} id Campaign ID
|
|
11455
|
-
* @param {{scheduledFor: number}} params Schedule params
|
|
11456
|
-
*
|
|
11457
|
-
* @return {Campaign} Scheduled Campaign
|
|
11458
|
-
*/
|
|
11459
|
-
|
|
11460
11947
|
}, {
|
|
11461
|
-
key: "
|
|
11948
|
+
key: "startCampaign",
|
|
11462
11949
|
value: function () {
|
|
11463
|
-
var
|
|
11464
|
-
var scheduledFor, _yield$this$patch, campaign;
|
|
11465
|
-
|
|
11950
|
+
var _startCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee76(id, scheduledFor) {
|
|
11466
11951
|
return _regeneratorRuntime__default['default'].wrap(function _callee76$(_context76) {
|
|
11467
11952
|
while (1) {
|
|
11468
11953
|
switch (_context76.prev = _context76.next) {
|
|
11469
11954
|
case 0:
|
|
11470
|
-
|
|
11471
|
-
_context76.
|
|
11472
|
-
return this.patch(this.baseURL + "/campaigns/".concat(id, "/schedule"), {
|
|
11955
|
+
this.validateServerSideAuth();
|
|
11956
|
+
return _context76.abrupt("return", this.post(this.baseURL + "/campaigns/".concat(id, "/start"), {
|
|
11473
11957
|
scheduled_for: scheduledFor
|
|
11474
|
-
});
|
|
11475
|
-
|
|
11476
|
-
case 3:
|
|
11477
|
-
_yield$this$patch = _context76.sent;
|
|
11478
|
-
campaign = _yield$this$patch.campaign;
|
|
11479
|
-
return _context76.abrupt("return", campaign);
|
|
11958
|
+
}));
|
|
11480
11959
|
|
|
11481
|
-
case
|
|
11960
|
+
case 2:
|
|
11482
11961
|
case "end":
|
|
11483
11962
|
return _context76.stop();
|
|
11484
11963
|
}
|
|
@@ -11486,39 +11965,38 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11486
11965
|
}, _callee76, this);
|
|
11487
11966
|
}));
|
|
11488
11967
|
|
|
11489
|
-
function
|
|
11490
|
-
return
|
|
11968
|
+
function startCampaign(_x109, _x110) {
|
|
11969
|
+
return _startCampaign.apply(this, arguments);
|
|
11491
11970
|
}
|
|
11492
11971
|
|
|
11493
|
-
return
|
|
11972
|
+
return startCampaign;
|
|
11494
11973
|
}()
|
|
11495
11974
|
/**
|
|
11496
|
-
*
|
|
11975
|
+
* queryCampaigns - Query Campaigns
|
|
11497
11976
|
*
|
|
11498
|
-
* @param {string} id Campaign ID
|
|
11499
11977
|
*
|
|
11500
|
-
* @return {Campaign}
|
|
11978
|
+
* @return {Campaign[]} Campaigns
|
|
11501
11979
|
*/
|
|
11502
11980
|
|
|
11503
11981
|
}, {
|
|
11504
|
-
key: "
|
|
11982
|
+
key: "queryCampaigns",
|
|
11505
11983
|
value: function () {
|
|
11506
|
-
var
|
|
11507
|
-
var _yield$this$patch2, campaign;
|
|
11508
|
-
|
|
11984
|
+
var _queryCampaigns = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee77(filter, sort, options) {
|
|
11509
11985
|
return _regeneratorRuntime__default['default'].wrap(function _callee77$(_context77) {
|
|
11510
11986
|
while (1) {
|
|
11511
11987
|
switch (_context77.prev = _context77.next) {
|
|
11512
11988
|
case 0:
|
|
11513
|
-
|
|
11514
|
-
|
|
11989
|
+
this.validateServerSideAuth();
|
|
11990
|
+
_context77.next = 3;
|
|
11991
|
+
return this.post(this.baseURL + "/campaigns/query", _objectSpread({
|
|
11992
|
+
filter: filter,
|
|
11993
|
+
sort: sort
|
|
11994
|
+
}, options || {}));
|
|
11515
11995
|
|
|
11516
|
-
case
|
|
11517
|
-
|
|
11518
|
-
campaign = _yield$this$patch2.campaign;
|
|
11519
|
-
return _context77.abrupt("return", campaign);
|
|
11996
|
+
case 3:
|
|
11997
|
+
return _context77.abrupt("return", _context77.sent);
|
|
11520
11998
|
|
|
11521
|
-
case
|
|
11999
|
+
case 4:
|
|
11522
12000
|
case "end":
|
|
11523
12001
|
return _context77.stop();
|
|
11524
12002
|
}
|
|
@@ -11526,39 +12004,33 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11526
12004
|
}, _callee77, this);
|
|
11527
12005
|
}));
|
|
11528
12006
|
|
|
11529
|
-
function
|
|
11530
|
-
return
|
|
12007
|
+
function queryCampaigns(_x111, _x112, _x113) {
|
|
12008
|
+
return _queryCampaigns.apply(this, arguments);
|
|
11531
12009
|
}
|
|
11532
12010
|
|
|
11533
|
-
return
|
|
12011
|
+
return queryCampaigns;
|
|
11534
12012
|
}()
|
|
11535
12013
|
/**
|
|
11536
|
-
*
|
|
12014
|
+
* updateCampaign - Update a Campaign
|
|
11537
12015
|
*
|
|
11538
12016
|
* @param {string} id Campaign ID
|
|
12017
|
+
* @param {Partial<CampaignData>} params Campaign data
|
|
11539
12018
|
*
|
|
11540
|
-
* @return {Campaign}
|
|
12019
|
+
* @return {Campaign} Updated Campaign
|
|
11541
12020
|
*/
|
|
11542
12021
|
|
|
11543
12022
|
}, {
|
|
11544
|
-
key: "
|
|
12023
|
+
key: "updateCampaign",
|
|
11545
12024
|
value: function () {
|
|
11546
|
-
var
|
|
11547
|
-
var _yield$this$patch3, campaign;
|
|
11548
|
-
|
|
12025
|
+
var _updateCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee78(id, params) {
|
|
11549
12026
|
return _regeneratorRuntime__default['default'].wrap(function _callee78$(_context78) {
|
|
11550
12027
|
while (1) {
|
|
11551
12028
|
switch (_context78.prev = _context78.next) {
|
|
11552
12029
|
case 0:
|
|
11553
|
-
|
|
11554
|
-
return this.
|
|
12030
|
+
this.validateServerSideAuth();
|
|
12031
|
+
return _context78.abrupt("return", this.put(this.baseURL + "/campaigns/".concat(id), params));
|
|
11555
12032
|
|
|
11556
12033
|
case 2:
|
|
11557
|
-
_yield$this$patch3 = _context78.sent;
|
|
11558
|
-
campaign = _yield$this$patch3.campaign;
|
|
11559
|
-
return _context78.abrupt("return", campaign);
|
|
11560
|
-
|
|
11561
|
-
case 5:
|
|
11562
12034
|
case "end":
|
|
11563
12035
|
return _context78.stop();
|
|
11564
12036
|
}
|
|
@@ -11566,40 +12038,32 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11566
12038
|
}, _callee78, this);
|
|
11567
12039
|
}));
|
|
11568
12040
|
|
|
11569
|
-
function
|
|
11570
|
-
return
|
|
12041
|
+
function updateCampaign(_x114, _x115) {
|
|
12042
|
+
return _updateCampaign.apply(this, arguments);
|
|
11571
12043
|
}
|
|
11572
12044
|
|
|
11573
|
-
return
|
|
12045
|
+
return updateCampaign;
|
|
11574
12046
|
}()
|
|
11575
12047
|
/**
|
|
11576
|
-
*
|
|
12048
|
+
* deleteCampaign - Delete a Campaign
|
|
11577
12049
|
*
|
|
11578
12050
|
* @param {string} id Campaign ID
|
|
11579
|
-
* @param {{users: string[]}} params Test params
|
|
11580
12051
|
*
|
|
11581
|
-
* @return {
|
|
12052
|
+
* @return {Promise<APIResponse>} The Server Response
|
|
11582
12053
|
*/
|
|
11583
12054
|
|
|
11584
12055
|
}, {
|
|
11585
|
-
key: "
|
|
12056
|
+
key: "deleteCampaign",
|
|
11586
12057
|
value: function () {
|
|
11587
|
-
var
|
|
11588
|
-
var users;
|
|
12058
|
+
var _deleteCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee79(id) {
|
|
11589
12059
|
return _regeneratorRuntime__default['default'].wrap(function _callee79$(_context79) {
|
|
11590
12060
|
while (1) {
|
|
11591
12061
|
switch (_context79.prev = _context79.next) {
|
|
11592
12062
|
case 0:
|
|
11593
|
-
|
|
11594
|
-
_context79.
|
|
11595
|
-
return this.post(this.baseURL + "/campaigns/".concat(id, "/test"), {
|
|
11596
|
-
users: users
|
|
11597
|
-
});
|
|
12063
|
+
this.validateServerSideAuth();
|
|
12064
|
+
return _context79.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id)));
|
|
11598
12065
|
|
|
11599
|
-
case
|
|
11600
|
-
return _context79.abrupt("return", _context79.sent);
|
|
11601
|
-
|
|
11602
|
-
case 4:
|
|
12066
|
+
case 2:
|
|
11603
12067
|
case "end":
|
|
11604
12068
|
return _context79.stop();
|
|
11605
12069
|
}
|
|
@@ -11607,11 +12071,52 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11607
12071
|
}, _callee79, this);
|
|
11608
12072
|
}));
|
|
11609
12073
|
|
|
11610
|
-
function
|
|
11611
|
-
return
|
|
12074
|
+
function deleteCampaign(_x116) {
|
|
12075
|
+
return _deleteCampaign.apply(this, arguments);
|
|
12076
|
+
}
|
|
12077
|
+
|
|
12078
|
+
return deleteCampaign;
|
|
12079
|
+
}()
|
|
12080
|
+
/**
|
|
12081
|
+
* stopCampaign - Stop a Campaign
|
|
12082
|
+
*
|
|
12083
|
+
* @param {string} id Campaign ID
|
|
12084
|
+
*
|
|
12085
|
+
* @return {Campaign} Stopped Campaign
|
|
12086
|
+
*/
|
|
12087
|
+
|
|
12088
|
+
}, {
|
|
12089
|
+
key: "stopCampaign",
|
|
12090
|
+
value: function () {
|
|
12091
|
+
var _stopCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee80(id) {
|
|
12092
|
+
var _yield$this$patch, campaign;
|
|
12093
|
+
|
|
12094
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee80$(_context80) {
|
|
12095
|
+
while (1) {
|
|
12096
|
+
switch (_context80.prev = _context80.next) {
|
|
12097
|
+
case 0:
|
|
12098
|
+
this.validateServerSideAuth();
|
|
12099
|
+
_context80.next = 3;
|
|
12100
|
+
return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
|
|
12101
|
+
|
|
12102
|
+
case 3:
|
|
12103
|
+
_yield$this$patch = _context80.sent;
|
|
12104
|
+
campaign = _yield$this$patch.campaign;
|
|
12105
|
+
return _context80.abrupt("return", campaign);
|
|
12106
|
+
|
|
12107
|
+
case 6:
|
|
12108
|
+
case "end":
|
|
12109
|
+
return _context80.stop();
|
|
12110
|
+
}
|
|
12111
|
+
}
|
|
12112
|
+
}, _callee80, this);
|
|
12113
|
+
}));
|
|
12114
|
+
|
|
12115
|
+
function stopCampaign(_x117) {
|
|
12116
|
+
return _stopCampaign.apply(this, arguments);
|
|
11612
12117
|
}
|
|
11613
12118
|
|
|
11614
|
-
return
|
|
12119
|
+
return stopCampaign;
|
|
11615
12120
|
}()
|
|
11616
12121
|
/**
|
|
11617
12122
|
* enrichURL - Get OpenGraph data of the given link
|
|
@@ -11623,24 +12128,24 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11623
12128
|
}, {
|
|
11624
12129
|
key: "enrichURL",
|
|
11625
12130
|
value: function () {
|
|
11626
|
-
var _enrichURL = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11627
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
12131
|
+
var _enrichURL = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee81(url) {
|
|
12132
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee81$(_context81) {
|
|
11628
12133
|
while (1) {
|
|
11629
|
-
switch (
|
|
12134
|
+
switch (_context81.prev = _context81.next) {
|
|
11630
12135
|
case 0:
|
|
11631
|
-
return
|
|
12136
|
+
return _context81.abrupt("return", this.get(this.baseURL + "/og", {
|
|
11632
12137
|
url: url
|
|
11633
12138
|
}));
|
|
11634
12139
|
|
|
11635
12140
|
case 1:
|
|
11636
12141
|
case "end":
|
|
11637
|
-
return
|
|
12142
|
+
return _context81.stop();
|
|
11638
12143
|
}
|
|
11639
12144
|
}
|
|
11640
|
-
},
|
|
12145
|
+
}, _callee81, this);
|
|
11641
12146
|
}));
|
|
11642
12147
|
|
|
11643
|
-
function enrichURL(
|
|
12148
|
+
function enrichURL(_x118) {
|
|
11644
12149
|
return _enrichURL.apply(this, arguments);
|
|
11645
12150
|
}
|
|
11646
12151
|
|
|
@@ -11657,22 +12162,22 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11657
12162
|
}, {
|
|
11658
12163
|
key: "getTask",
|
|
11659
12164
|
value: function () {
|
|
11660
|
-
var _getTask = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11661
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
12165
|
+
var _getTask = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee82(id) {
|
|
12166
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee82$(_context82) {
|
|
11662
12167
|
while (1) {
|
|
11663
|
-
switch (
|
|
12168
|
+
switch (_context82.prev = _context82.next) {
|
|
11664
12169
|
case 0:
|
|
11665
|
-
return
|
|
12170
|
+
return _context82.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
|
|
11666
12171
|
|
|
11667
12172
|
case 1:
|
|
11668
12173
|
case "end":
|
|
11669
|
-
return
|
|
12174
|
+
return _context82.stop();
|
|
11670
12175
|
}
|
|
11671
12176
|
}
|
|
11672
|
-
},
|
|
12177
|
+
}, _callee82, this);
|
|
11673
12178
|
}));
|
|
11674
12179
|
|
|
11675
|
-
function getTask(
|
|
12180
|
+
function getTask(_x119) {
|
|
11676
12181
|
return _getTask.apply(this, arguments);
|
|
11677
12182
|
}
|
|
11678
12183
|
|
|
@@ -11690,31 +12195,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11690
12195
|
}, {
|
|
11691
12196
|
key: "deleteChannels",
|
|
11692
12197
|
value: function () {
|
|
11693
|
-
var _deleteChannels = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
12198
|
+
var _deleteChannels = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee83(cids) {
|
|
11694
12199
|
var options,
|
|
11695
|
-
|
|
11696
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
12200
|
+
_args83 = arguments;
|
|
12201
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee83$(_context83) {
|
|
11697
12202
|
while (1) {
|
|
11698
|
-
switch (
|
|
12203
|
+
switch (_context83.prev = _context83.next) {
|
|
11699
12204
|
case 0:
|
|
11700
|
-
options =
|
|
11701
|
-
|
|
12205
|
+
options = _args83.length > 1 && _args83[1] !== undefined ? _args83[1] : {};
|
|
12206
|
+
_context83.next = 3;
|
|
11702
12207
|
return this.post(this.baseURL + "/channels/delete", _objectSpread({
|
|
11703
12208
|
cids: cids
|
|
11704
12209
|
}, options));
|
|
11705
12210
|
|
|
11706
12211
|
case 3:
|
|
11707
|
-
return
|
|
12212
|
+
return _context83.abrupt("return", _context83.sent);
|
|
11708
12213
|
|
|
11709
12214
|
case 4:
|
|
11710
12215
|
case "end":
|
|
11711
|
-
return
|
|
12216
|
+
return _context83.stop();
|
|
11712
12217
|
}
|
|
11713
12218
|
}
|
|
11714
|
-
},
|
|
12219
|
+
}, _callee83, this);
|
|
11715
12220
|
}));
|
|
11716
12221
|
|
|
11717
|
-
function deleteChannels(
|
|
12222
|
+
function deleteChannels(_x120) {
|
|
11718
12223
|
return _deleteChannels.apply(this, arguments);
|
|
11719
12224
|
}
|
|
11720
12225
|
|
|
@@ -11732,17 +12237,17 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11732
12237
|
}, {
|
|
11733
12238
|
key: "deleteUsers",
|
|
11734
12239
|
value: function () {
|
|
11735
|
-
var _deleteUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
12240
|
+
var _deleteUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee84(user_ids) {
|
|
11736
12241
|
var options,
|
|
11737
|
-
|
|
11738
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
12242
|
+
_args84 = arguments;
|
|
12243
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee84$(_context84) {
|
|
11739
12244
|
while (1) {
|
|
11740
|
-
switch (
|
|
12245
|
+
switch (_context84.prev = _context84.next) {
|
|
11741
12246
|
case 0:
|
|
11742
|
-
options =
|
|
12247
|
+
options = _args84.length > 1 && _args84[1] !== undefined ? _args84[1] : {};
|
|
11743
12248
|
|
|
11744
12249
|
if (!(typeof options.user !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.user))) {
|
|
11745
|
-
|
|
12250
|
+
_context84.next = 3;
|
|
11746
12251
|
break;
|
|
11747
12252
|
}
|
|
11748
12253
|
|
|
@@ -11750,7 +12255,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11750
12255
|
|
|
11751
12256
|
case 3:
|
|
11752
12257
|
if (!(typeof options.conversations !== 'undefined' && !['soft', 'hard'].includes(options.conversations))) {
|
|
11753
|
-
|
|
12258
|
+
_context84.next = 5;
|
|
11754
12259
|
break;
|
|
11755
12260
|
}
|
|
11756
12261
|
|
|
@@ -11758,30 +12263,30 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11758
12263
|
|
|
11759
12264
|
case 5:
|
|
11760
12265
|
if (!(typeof options.messages !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.messages))) {
|
|
11761
|
-
|
|
12266
|
+
_context84.next = 7;
|
|
11762
12267
|
break;
|
|
11763
12268
|
}
|
|
11764
12269
|
|
|
11765
12270
|
throw new Error('Invalid delete user options. messages must be one of [soft hard pruning]');
|
|
11766
12271
|
|
|
11767
12272
|
case 7:
|
|
11768
|
-
|
|
12273
|
+
_context84.next = 9;
|
|
11769
12274
|
return this.post(this.baseURL + "/users/delete", _objectSpread({
|
|
11770
12275
|
user_ids: user_ids
|
|
11771
12276
|
}, options));
|
|
11772
12277
|
|
|
11773
12278
|
case 9:
|
|
11774
|
-
return
|
|
12279
|
+
return _context84.abrupt("return", _context84.sent);
|
|
11775
12280
|
|
|
11776
12281
|
case 10:
|
|
11777
12282
|
case "end":
|
|
11778
|
-
return
|
|
12283
|
+
return _context84.stop();
|
|
11779
12284
|
}
|
|
11780
12285
|
}
|
|
11781
|
-
},
|
|
12286
|
+
}, _callee84, this);
|
|
11782
12287
|
}));
|
|
11783
12288
|
|
|
11784
|
-
function deleteUsers(
|
|
12289
|
+
function deleteUsers(_x121) {
|
|
11785
12290
|
return _deleteUsers.apply(this, arguments);
|
|
11786
12291
|
}
|
|
11787
12292
|
|
|
@@ -11802,28 +12307,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11802
12307
|
}, {
|
|
11803
12308
|
key: "_createImportURL",
|
|
11804
12309
|
value: function () {
|
|
11805
|
-
var _createImportURL2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11806
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
12310
|
+
var _createImportURL2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee85(filename) {
|
|
12311
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee85$(_context85) {
|
|
11807
12312
|
while (1) {
|
|
11808
|
-
switch (
|
|
12313
|
+
switch (_context85.prev = _context85.next) {
|
|
11809
12314
|
case 0:
|
|
11810
|
-
|
|
12315
|
+
_context85.next = 2;
|
|
11811
12316
|
return this.post(this.baseURL + "/import_urls", {
|
|
11812
12317
|
filename: filename
|
|
11813
12318
|
});
|
|
11814
12319
|
|
|
11815
12320
|
case 2:
|
|
11816
|
-
return
|
|
12321
|
+
return _context85.abrupt("return", _context85.sent);
|
|
11817
12322
|
|
|
11818
12323
|
case 3:
|
|
11819
12324
|
case "end":
|
|
11820
|
-
return
|
|
12325
|
+
return _context85.stop();
|
|
11821
12326
|
}
|
|
11822
12327
|
}
|
|
11823
|
-
},
|
|
12328
|
+
}, _callee85, this);
|
|
11824
12329
|
}));
|
|
11825
12330
|
|
|
11826
|
-
function _createImportURL(
|
|
12331
|
+
function _createImportURL(_x122) {
|
|
11827
12332
|
return _createImportURL2.apply(this, arguments);
|
|
11828
12333
|
}
|
|
11829
12334
|
|
|
@@ -11845,33 +12350,33 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11845
12350
|
}, {
|
|
11846
12351
|
key: "_createImport",
|
|
11847
12352
|
value: function () {
|
|
11848
|
-
var _createImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
12353
|
+
var _createImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee86(path) {
|
|
11849
12354
|
var options,
|
|
11850
|
-
|
|
11851
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
12355
|
+
_args86 = arguments;
|
|
12356
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee86$(_context86) {
|
|
11852
12357
|
while (1) {
|
|
11853
|
-
switch (
|
|
12358
|
+
switch (_context86.prev = _context86.next) {
|
|
11854
12359
|
case 0:
|
|
11855
|
-
options =
|
|
12360
|
+
options = _args86.length > 1 && _args86[1] !== undefined ? _args86[1] : {
|
|
11856
12361
|
mode: 'upsert'
|
|
11857
12362
|
};
|
|
11858
|
-
|
|
12363
|
+
_context86.next = 3;
|
|
11859
12364
|
return this.post(this.baseURL + "/imports", _objectSpread({
|
|
11860
12365
|
path: path
|
|
11861
12366
|
}, options));
|
|
11862
12367
|
|
|
11863
12368
|
case 3:
|
|
11864
|
-
return
|
|
12369
|
+
return _context86.abrupt("return", _context86.sent);
|
|
11865
12370
|
|
|
11866
12371
|
case 4:
|
|
11867
12372
|
case "end":
|
|
11868
|
-
return
|
|
12373
|
+
return _context86.stop();
|
|
11869
12374
|
}
|
|
11870
12375
|
}
|
|
11871
|
-
},
|
|
12376
|
+
}, _callee86, this);
|
|
11872
12377
|
}));
|
|
11873
12378
|
|
|
11874
|
-
function _createImport(
|
|
12379
|
+
function _createImport(_x123) {
|
|
11875
12380
|
return _createImport2.apply(this, arguments);
|
|
11876
12381
|
}
|
|
11877
12382
|
|
|
@@ -11893,26 +12398,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11893
12398
|
}, {
|
|
11894
12399
|
key: "_getImport",
|
|
11895
12400
|
value: function () {
|
|
11896
|
-
var _getImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11897
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
12401
|
+
var _getImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee87(id) {
|
|
12402
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee87$(_context87) {
|
|
11898
12403
|
while (1) {
|
|
11899
|
-
switch (
|
|
12404
|
+
switch (_context87.prev = _context87.next) {
|
|
11900
12405
|
case 0:
|
|
11901
|
-
|
|
12406
|
+
_context87.next = 2;
|
|
11902
12407
|
return this.get(this.baseURL + "/imports/".concat(id));
|
|
11903
12408
|
|
|
11904
12409
|
case 2:
|
|
11905
|
-
return
|
|
12410
|
+
return _context87.abrupt("return", _context87.sent);
|
|
11906
12411
|
|
|
11907
12412
|
case 3:
|
|
11908
12413
|
case "end":
|
|
11909
|
-
return
|
|
12414
|
+
return _context87.stop();
|
|
11910
12415
|
}
|
|
11911
12416
|
}
|
|
11912
|
-
},
|
|
12417
|
+
}, _callee87, this);
|
|
11913
12418
|
}));
|
|
11914
12419
|
|
|
11915
|
-
function _getImport(
|
|
12420
|
+
function _getImport(_x124) {
|
|
11916
12421
|
return _getImport2.apply(this, arguments);
|
|
11917
12422
|
}
|
|
11918
12423
|
|
|
@@ -11934,26 +12439,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11934
12439
|
}, {
|
|
11935
12440
|
key: "_listImports",
|
|
11936
12441
|
value: function () {
|
|
11937
|
-
var _listImports2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11938
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
12442
|
+
var _listImports2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee88(options) {
|
|
12443
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee88$(_context88) {
|
|
11939
12444
|
while (1) {
|
|
11940
|
-
switch (
|
|
12445
|
+
switch (_context88.prev = _context88.next) {
|
|
11941
12446
|
case 0:
|
|
11942
|
-
|
|
12447
|
+
_context88.next = 2;
|
|
11943
12448
|
return this.get(this.baseURL + "/imports", options);
|
|
11944
12449
|
|
|
11945
12450
|
case 2:
|
|
11946
|
-
return
|
|
12451
|
+
return _context88.abrupt("return", _context88.sent);
|
|
11947
12452
|
|
|
11948
12453
|
case 3:
|
|
11949
12454
|
case "end":
|
|
11950
|
-
return
|
|
12455
|
+
return _context88.stop();
|
|
11951
12456
|
}
|
|
11952
12457
|
}
|
|
11953
|
-
},
|
|
12458
|
+
}, _callee88, this);
|
|
11954
12459
|
}));
|
|
11955
12460
|
|
|
11956
|
-
function _listImports(
|
|
12461
|
+
function _listImports(_x125) {
|
|
11957
12462
|
return _listImports2.apply(this, arguments);
|
|
11958
12463
|
}
|
|
11959
12464
|
|
|
@@ -11972,28 +12477,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11972
12477
|
}, {
|
|
11973
12478
|
key: "upsertPushProvider",
|
|
11974
12479
|
value: function () {
|
|
11975
|
-
var _upsertPushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11976
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
12480
|
+
var _upsertPushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee89(pushProvider) {
|
|
12481
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee89$(_context89) {
|
|
11977
12482
|
while (1) {
|
|
11978
|
-
switch (
|
|
12483
|
+
switch (_context89.prev = _context89.next) {
|
|
11979
12484
|
case 0:
|
|
11980
|
-
|
|
12485
|
+
_context89.next = 2;
|
|
11981
12486
|
return this.post(this.baseURL + "/push_providers", {
|
|
11982
12487
|
push_provider: pushProvider
|
|
11983
12488
|
});
|
|
11984
12489
|
|
|
11985
12490
|
case 2:
|
|
11986
|
-
return
|
|
12491
|
+
return _context89.abrupt("return", _context89.sent);
|
|
11987
12492
|
|
|
11988
12493
|
case 3:
|
|
11989
12494
|
case "end":
|
|
11990
|
-
return
|
|
12495
|
+
return _context89.stop();
|
|
11991
12496
|
}
|
|
11992
12497
|
}
|
|
11993
|
-
},
|
|
12498
|
+
}, _callee89, this);
|
|
11994
12499
|
}));
|
|
11995
12500
|
|
|
11996
|
-
function upsertPushProvider(
|
|
12501
|
+
function upsertPushProvider(_x126) {
|
|
11997
12502
|
return _upsertPushProvider.apply(this, arguments);
|
|
11998
12503
|
}
|
|
11999
12504
|
|
|
@@ -12012,28 +12517,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12012
12517
|
}, {
|
|
12013
12518
|
key: "deletePushProvider",
|
|
12014
12519
|
value: function () {
|
|
12015
|
-
var _deletePushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
12520
|
+
var _deletePushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee90(_ref10) {
|
|
12016
12521
|
var type, name;
|
|
12017
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
12522
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee90$(_context90) {
|
|
12018
12523
|
while (1) {
|
|
12019
|
-
switch (
|
|
12524
|
+
switch (_context90.prev = _context90.next) {
|
|
12020
12525
|
case 0:
|
|
12021
12526
|
type = _ref10.type, name = _ref10.name;
|
|
12022
|
-
|
|
12527
|
+
_context90.next = 3;
|
|
12023
12528
|
return this.delete(this.baseURL + "/push_providers/".concat(type, "/").concat(name));
|
|
12024
12529
|
|
|
12025
12530
|
case 3:
|
|
12026
|
-
return
|
|
12531
|
+
return _context90.abrupt("return", _context90.sent);
|
|
12027
12532
|
|
|
12028
12533
|
case 4:
|
|
12029
12534
|
case "end":
|
|
12030
|
-
return
|
|
12535
|
+
return _context90.stop();
|
|
12031
12536
|
}
|
|
12032
12537
|
}
|
|
12033
|
-
},
|
|
12538
|
+
}, _callee90, this);
|
|
12034
12539
|
}));
|
|
12035
12540
|
|
|
12036
|
-
function deletePushProvider(
|
|
12541
|
+
function deletePushProvider(_x127) {
|
|
12037
12542
|
return _deletePushProvider.apply(this, arguments);
|
|
12038
12543
|
}
|
|
12039
12544
|
|
|
@@ -12050,23 +12555,23 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12050
12555
|
}, {
|
|
12051
12556
|
key: "listPushProviders",
|
|
12052
12557
|
value: function () {
|
|
12053
|
-
var _listPushProviders = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
12054
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
12558
|
+
var _listPushProviders = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee91() {
|
|
12559
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee91$(_context91) {
|
|
12055
12560
|
while (1) {
|
|
12056
|
-
switch (
|
|
12561
|
+
switch (_context91.prev = _context91.next) {
|
|
12057
12562
|
case 0:
|
|
12058
|
-
|
|
12563
|
+
_context91.next = 2;
|
|
12059
12564
|
return this.get(this.baseURL + "/push_providers");
|
|
12060
12565
|
|
|
12061
12566
|
case 2:
|
|
12062
|
-
return
|
|
12567
|
+
return _context91.abrupt("return", _context91.sent);
|
|
12063
12568
|
|
|
12064
12569
|
case 3:
|
|
12065
12570
|
case "end":
|
|
12066
|
-
return
|
|
12571
|
+
return _context91.stop();
|
|
12067
12572
|
}
|
|
12068
12573
|
}
|
|
12069
|
-
},
|
|
12574
|
+
}, _callee91, this);
|
|
12070
12575
|
}));
|
|
12071
12576
|
|
|
12072
12577
|
function listPushProviders() {
|
|
@@ -12094,26 +12599,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12094
12599
|
}, {
|
|
12095
12600
|
key: "commitMessage",
|
|
12096
12601
|
value: function () {
|
|
12097
|
-
var _commitMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
12098
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
12602
|
+
var _commitMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee92(id) {
|
|
12603
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee92$(_context92) {
|
|
12099
12604
|
while (1) {
|
|
12100
|
-
switch (
|
|
12605
|
+
switch (_context92.prev = _context92.next) {
|
|
12101
12606
|
case 0:
|
|
12102
|
-
|
|
12607
|
+
_context92.next = 2;
|
|
12103
12608
|
return this.post(this.baseURL + "/messages/".concat(id, "/commit"));
|
|
12104
12609
|
|
|
12105
12610
|
case 2:
|
|
12106
|
-
return
|
|
12611
|
+
return _context92.abrupt("return", _context92.sent);
|
|
12107
12612
|
|
|
12108
12613
|
case 3:
|
|
12109
12614
|
case "end":
|
|
12110
|
-
return
|
|
12615
|
+
return _context92.stop();
|
|
12111
12616
|
}
|
|
12112
12617
|
}
|
|
12113
|
-
},
|
|
12618
|
+
}, _callee92, this);
|
|
12114
12619
|
}));
|
|
12115
12620
|
|
|
12116
|
-
function commitMessage(
|
|
12621
|
+
function commitMessage(_x128) {
|
|
12117
12622
|
return _commitMessage.apply(this, arguments);
|
|
12118
12623
|
}
|
|
12119
12624
|
|
|
@@ -12271,6 +12776,7 @@ exports.AnyResource = AnyResource;
|
|
|
12271
12776
|
exports.AnyRole = AnyRole;
|
|
12272
12777
|
exports.BuiltinPermissions = BuiltinPermissions;
|
|
12273
12778
|
exports.BuiltinRoles = BuiltinRoles;
|
|
12779
|
+
exports.Campaign = Campaign;
|
|
12274
12780
|
exports.Channel = Channel;
|
|
12275
12781
|
exports.ChannelState = ChannelState;
|
|
12276
12782
|
exports.CheckSignature = CheckSignature;
|
|
@@ -12286,6 +12792,7 @@ exports.JWTUserToken = JWTUserToken;
|
|
|
12286
12792
|
exports.MaxPriority = MaxPriority;
|
|
12287
12793
|
exports.MinPriority = MinPriority;
|
|
12288
12794
|
exports.Permission = Permission;
|
|
12795
|
+
exports.Segment = Segment;
|
|
12289
12796
|
exports.StableWSConnection = StableWSConnection;
|
|
12290
12797
|
exports.StreamChat = StreamChat;
|
|
12291
12798
|
exports.Thread = Thread;
|