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