webitel-sdk 0.1.92 → 0.1.97

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.
Files changed (77) hide show
  1. package/bundles/index.esm.js +624 -15
  2. package/bundles/index.esm.js.map +1 -1
  3. package/bundles/index.esm.min.js +1 -1
  4. package/bundles/index.esm.min.js.map +1 -1
  5. package/bundles/index.umd.js +715 -15
  6. package/bundles/index.umd.js.map +1 -1
  7. package/bundles/index.umd.min.js +1 -1
  8. package/bundles/index.umd.min.js.map +1 -1
  9. package/esm2015/api/engine-chat-plan.js +13 -0
  10. package/esm2015/api/engine-chat-plan.js.map +1 -0
  11. package/esm2015/api/engine-create-chat-plan-request.js +13 -0
  12. package/esm2015/api/engine-create-chat-plan-request.js.map +1 -0
  13. package/esm2015/api/engine-list-chat-plan.js +13 -0
  14. package/esm2015/api/engine-list-chat-plan.js.map +1 -0
  15. package/esm2015/api/engine-patch-chat-plan-request.js +13 -0
  16. package/esm2015/api/engine-patch-chat-plan-request.js.map +1 -0
  17. package/esm2015/api/engine-update-chat-plan-request.js +13 -0
  18. package/esm2015/api/engine-update-chat-plan-request.js.map +1 -0
  19. package/esm2015/api/index.js.map +1 -1
  20. package/esm2015/api/routing-chat-plan-service-api.js +572 -0
  21. package/esm2015/api/routing-chat-plan-service-api.js.map +1 -0
  22. package/esm2015/api.js +1 -0
  23. package/esm2015/api.js.map +1 -1
  24. package/esm2015/socket/client.js +25 -4
  25. package/esm2015/socket/client.js.map +1 -1
  26. package/esm2015/socket/conversation.js +40 -9
  27. package/esm2015/socket/conversation.js.map +1 -1
  28. package/esm2015/socket/task.js +2 -1
  29. package/esm2015/socket/task.js.map +1 -1
  30. package/esm5/api/engine-chat-plan.js +13 -0
  31. package/esm5/api/engine-chat-plan.js.map +1 -0
  32. package/esm5/api/engine-create-chat-plan-request.js +13 -0
  33. package/esm5/api/engine-create-chat-plan-request.js.map +1 -0
  34. package/esm5/api/engine-list-chat-plan.js +13 -0
  35. package/esm5/api/engine-list-chat-plan.js.map +1 -0
  36. package/esm5/api/engine-patch-chat-plan-request.js +13 -0
  37. package/esm5/api/engine-patch-chat-plan-request.js.map +1 -0
  38. package/esm5/api/engine-update-chat-plan-request.js +13 -0
  39. package/esm5/api/engine-update-chat-plan-request.js.map +1 -0
  40. package/esm5/api/index.js.map +1 -1
  41. package/esm5/api/routing-chat-plan-service-api.js +645 -0
  42. package/esm5/api/routing-chat-plan-service-api.js.map +1 -0
  43. package/esm5/api.js +1 -0
  44. package/esm5/api.js.map +1 -1
  45. package/esm5/socket/client.js +29 -5
  46. package/esm5/socket/client.js.map +1 -1
  47. package/esm5/socket/conversation.js +53 -9
  48. package/esm5/socket/conversation.js.map +1 -1
  49. package/esm5/socket/task.js +2 -1
  50. package/esm5/socket/task.js.map +1 -1
  51. package/package.json +3 -3
  52. package/types/api/create-call-request-call-settings.d.ts +6 -0
  53. package/types/api/create-call-request-call-settings.d.ts.map +1 -1
  54. package/types/api/engine-chat-plan.d.ts +50 -0
  55. package/types/api/engine-chat-plan.d.ts.map +1 -0
  56. package/types/api/engine-create-chat-plan-request.d.ts +44 -0
  57. package/types/api/engine-create-chat-plan-request.d.ts.map +1 -0
  58. package/types/api/engine-history-call.d.ts +6 -0
  59. package/types/api/engine-history-call.d.ts.map +1 -1
  60. package/types/api/engine-list-chat-plan.d.ts +32 -0
  61. package/types/api/engine-list-chat-plan.d.ts.map +1 -0
  62. package/types/api/engine-patch-chat-plan-request.d.ts +56 -0
  63. package/types/api/engine-patch-chat-plan-request.d.ts.map +1 -0
  64. package/types/api/engine-queue-resource-group.d.ts +6 -0
  65. package/types/api/engine-queue-resource-group.d.ts.map +1 -1
  66. package/types/api/engine-update-chat-plan-request.d.ts +50 -0
  67. package/types/api/engine-update-chat-plan-request.d.ts.map +1 -0
  68. package/types/api/index.d.ts +5 -0
  69. package/types/api/index.d.ts.map +1 -1
  70. package/types/api/routing-chat-plan-service-api.d.ts +225 -0
  71. package/types/api/routing-chat-plan-service-api.d.ts.map +1 -0
  72. package/types/api.d.ts +1 -0
  73. package/types/api.d.ts.map +1 -1
  74. package/types/socket/client.d.ts.map +1 -1
  75. package/types/socket/conversation.d.ts +14 -4
  76. package/types/socket/conversation.d.ts.map +1 -1
  77. package/types/socket/task.d.ts.map +1 -1
@@ -21588,6 +21588,633 @@
21588
21588
  return RegionServiceApi;
21589
21589
  }(BaseAPI));
21590
21590
 
21591
+ // tslint:disable
21592
+ /**
21593
+ * RoutingChatPlanServiceApi - axios parameter creator
21594
+ * @export
21595
+ */
21596
+ var RoutingChatPlanServiceApiAxiosParamCreator = function (configuration) {
21597
+ var _this = this;
21598
+ return {
21599
+ /**
21600
+ *
21601
+ * @param {EngineCreateChatPlanRequest} body
21602
+ * @param {*} [options] Override http request option.
21603
+ * @throws {RequiredError}
21604
+ */
21605
+ createChatPlan: function (body, options) {
21606
+ if (options === void 0) { options = {}; }
21607
+ return tslib.__awaiter(_this, void 0, void 0, function () {
21608
+ var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, localVarApiKeyValue, _a, headersFromBaseOptions, needsSerialization;
21609
+ return tslib.__generator(this, function (_b) {
21610
+ switch (_b.label) {
21611
+ case 0:
21612
+ // verify required parameter 'body' is not null or undefined
21613
+ if (body === null || body === undefined) {
21614
+ throw new RequiredError('body', 'Required parameter body was null or undefined when calling createChatPlan.');
21615
+ }
21616
+ localVarPath = "/routing/outbound/chat";
21617
+ localVarUrlObj = globalImportUrl.parse(localVarPath, true);
21618
+ if (configuration) {
21619
+ baseOptions = configuration.baseOptions;
21620
+ }
21621
+ localVarRequestOptions = tslib.__assign(tslib.__assign({ method: 'POST' }, baseOptions), options);
21622
+ localVarHeaderParameter = {};
21623
+ localVarQueryParameter = {};
21624
+ if (!(configuration && configuration.apiKey)) return [3 /*break*/, 5];
21625
+ if (!(typeof configuration.apiKey === 'function')) return [3 /*break*/, 2];
21626
+ return [4 /*yield*/, configuration.apiKey('X-Webitel-Access')];
21627
+ case 1:
21628
+ _a = _b.sent();
21629
+ return [3 /*break*/, 4];
21630
+ case 2: return [4 /*yield*/, configuration.apiKey];
21631
+ case 3:
21632
+ _a = _b.sent();
21633
+ _b.label = 4;
21634
+ case 4:
21635
+ localVarApiKeyValue = _a;
21636
+ localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
21637
+ _b.label = 5;
21638
+ case 5:
21639
+ localVarHeaderParameter['Content-Type'] = 'application/json';
21640
+ localVarUrlObj.query = tslib.__assign(tslib.__assign(tslib.__assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
21641
+ // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
21642
+ delete localVarUrlObj.search;
21643
+ headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
21644
+ localVarRequestOptions.headers = tslib.__assign(tslib.__assign(tslib.__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
21645
+ needsSerialization = typeof body !== 'string' ||
21646
+ localVarRequestOptions.headers['Content-Type'] === 'application/json';
21647
+ localVarRequestOptions.data = needsSerialization
21648
+ ? JSON.stringify(body !== undefined ? body : {})
21649
+ : body || '';
21650
+ return [2 /*return*/, {
21651
+ url: globalImportUrl.format(localVarUrlObj),
21652
+ options: localVarRequestOptions,
21653
+ }];
21654
+ }
21655
+ });
21656
+ });
21657
+ },
21658
+ /**
21659
+ *
21660
+ * @param {number} id
21661
+ * @param {EnginePatchChatPlanRequest} body
21662
+ * @param {*} [options] Override http request option.
21663
+ * @throws {RequiredError}
21664
+ */
21665
+ patchChatPlan: function (id, body, options) {
21666
+ if (options === void 0) { options = {}; }
21667
+ return tslib.__awaiter(_this, void 0, void 0, function () {
21668
+ var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, localVarApiKeyValue, _a, headersFromBaseOptions, needsSerialization;
21669
+ return tslib.__generator(this, function (_b) {
21670
+ switch (_b.label) {
21671
+ case 0:
21672
+ // verify required parameter 'id' is not null or undefined
21673
+ if (id === null || id === undefined) {
21674
+ throw new RequiredError('id', 'Required parameter id was null or undefined when calling patchChatPlan.');
21675
+ }
21676
+ // verify required parameter 'body' is not null or undefined
21677
+ if (body === null || body === undefined) {
21678
+ throw new RequiredError('body', 'Required parameter body was null or undefined when calling patchChatPlan.');
21679
+ }
21680
+ localVarPath = "/routing/outbound/chat/{id}".replace("{" + 'id' + "}", encodeURIComponent(String(id)));
21681
+ localVarUrlObj = globalImportUrl.parse(localVarPath, true);
21682
+ if (configuration) {
21683
+ baseOptions = configuration.baseOptions;
21684
+ }
21685
+ localVarRequestOptions = tslib.__assign(tslib.__assign({ method: 'PATCH' }, baseOptions), options);
21686
+ localVarHeaderParameter = {};
21687
+ localVarQueryParameter = {};
21688
+ if (!(configuration && configuration.apiKey)) return [3 /*break*/, 5];
21689
+ if (!(typeof configuration.apiKey === 'function')) return [3 /*break*/, 2];
21690
+ return [4 /*yield*/, configuration.apiKey('X-Webitel-Access')];
21691
+ case 1:
21692
+ _a = _b.sent();
21693
+ return [3 /*break*/, 4];
21694
+ case 2: return [4 /*yield*/, configuration.apiKey];
21695
+ case 3:
21696
+ _a = _b.sent();
21697
+ _b.label = 4;
21698
+ case 4:
21699
+ localVarApiKeyValue = _a;
21700
+ localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
21701
+ _b.label = 5;
21702
+ case 5:
21703
+ localVarHeaderParameter['Content-Type'] = 'application/json';
21704
+ localVarUrlObj.query = tslib.__assign(tslib.__assign(tslib.__assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
21705
+ // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
21706
+ delete localVarUrlObj.search;
21707
+ headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
21708
+ localVarRequestOptions.headers = tslib.__assign(tslib.__assign(tslib.__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
21709
+ needsSerialization = typeof body !== 'string' ||
21710
+ localVarRequestOptions.headers['Content-Type'] === 'application/json';
21711
+ localVarRequestOptions.data = needsSerialization
21712
+ ? JSON.stringify(body !== undefined ? body : {})
21713
+ : body || '';
21714
+ return [2 /*return*/, {
21715
+ url: globalImportUrl.format(localVarUrlObj),
21716
+ options: localVarRequestOptions,
21717
+ }];
21718
+ }
21719
+ });
21720
+ });
21721
+ },
21722
+ /**
21723
+ *
21724
+ * @param {number} id
21725
+ * @param {*} [options] Override http request option.
21726
+ * @throws {RequiredError}
21727
+ */
21728
+ readChatPlan: function (id, options) {
21729
+ if (options === void 0) { options = {}; }
21730
+ return tslib.__awaiter(_this, void 0, void 0, function () {
21731
+ var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, localVarApiKeyValue, _a, headersFromBaseOptions;
21732
+ return tslib.__generator(this, function (_b) {
21733
+ switch (_b.label) {
21734
+ case 0:
21735
+ // verify required parameter 'id' is not null or undefined
21736
+ if (id === null || id === undefined) {
21737
+ throw new RequiredError('id', 'Required parameter id was null or undefined when calling readChatPlan.');
21738
+ }
21739
+ localVarPath = "/routing/outbound/chat/{id}".replace("{" + 'id' + "}", encodeURIComponent(String(id)));
21740
+ localVarUrlObj = globalImportUrl.parse(localVarPath, true);
21741
+ if (configuration) {
21742
+ baseOptions = configuration.baseOptions;
21743
+ }
21744
+ localVarRequestOptions = tslib.__assign(tslib.__assign({ method: 'GET' }, baseOptions), options);
21745
+ localVarHeaderParameter = {};
21746
+ localVarQueryParameter = {};
21747
+ if (!(configuration && configuration.apiKey)) return [3 /*break*/, 5];
21748
+ if (!(typeof configuration.apiKey === 'function')) return [3 /*break*/, 2];
21749
+ return [4 /*yield*/, configuration.apiKey('X-Webitel-Access')];
21750
+ case 1:
21751
+ _a = _b.sent();
21752
+ return [3 /*break*/, 4];
21753
+ case 2: return [4 /*yield*/, configuration.apiKey];
21754
+ case 3:
21755
+ _a = _b.sent();
21756
+ _b.label = 4;
21757
+ case 4:
21758
+ localVarApiKeyValue = _a;
21759
+ localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
21760
+ _b.label = 5;
21761
+ case 5:
21762
+ localVarUrlObj.query = tslib.__assign(tslib.__assign(tslib.__assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
21763
+ // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
21764
+ delete localVarUrlObj.search;
21765
+ headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
21766
+ localVarRequestOptions.headers = tslib.__assign(tslib.__assign(tslib.__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
21767
+ return [2 /*return*/, {
21768
+ url: globalImportUrl.format(localVarUrlObj),
21769
+ options: localVarRequestOptions,
21770
+ }];
21771
+ }
21772
+ });
21773
+ });
21774
+ },
21775
+ /**
21776
+ *
21777
+ * @param {number} [page]
21778
+ * @param {number} [size]
21779
+ * @param {string} [q]
21780
+ * @param {string} [sort]
21781
+ * @param {Array<string>} [fields]
21782
+ * @param {Array<number>} [id]
21783
+ * @param {string} [name]
21784
+ * @param {boolean} [enabled]
21785
+ * @param {*} [options] Override http request option.
21786
+ * @throws {RequiredError}
21787
+ */
21788
+ searchChatPlan: function (page, size, q, sort, fields, id, name, enabled, options) {
21789
+ if (options === void 0) { options = {}; }
21790
+ return tslib.__awaiter(_this, void 0, void 0, function () {
21791
+ var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, localVarApiKeyValue, _a, headersFromBaseOptions;
21792
+ return tslib.__generator(this, function (_b) {
21793
+ switch (_b.label) {
21794
+ case 0:
21795
+ localVarPath = "/routing/outbound/chat";
21796
+ localVarUrlObj = globalImportUrl.parse(localVarPath, true);
21797
+ if (configuration) {
21798
+ baseOptions = configuration.baseOptions;
21799
+ }
21800
+ localVarRequestOptions = tslib.__assign(tslib.__assign({ method: 'GET' }, baseOptions), options);
21801
+ localVarHeaderParameter = {};
21802
+ localVarQueryParameter = {};
21803
+ if (!(configuration && configuration.apiKey)) return [3 /*break*/, 5];
21804
+ if (!(typeof configuration.apiKey === 'function')) return [3 /*break*/, 2];
21805
+ return [4 /*yield*/, configuration.apiKey('X-Webitel-Access')];
21806
+ case 1:
21807
+ _a = _b.sent();
21808
+ return [3 /*break*/, 4];
21809
+ case 2: return [4 /*yield*/, configuration.apiKey];
21810
+ case 3:
21811
+ _a = _b.sent();
21812
+ _b.label = 4;
21813
+ case 4:
21814
+ localVarApiKeyValue = _a;
21815
+ localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
21816
+ _b.label = 5;
21817
+ case 5:
21818
+ if (page !== undefined) {
21819
+ localVarQueryParameter['page'] = page;
21820
+ }
21821
+ if (size !== undefined) {
21822
+ localVarQueryParameter['size'] = size;
21823
+ }
21824
+ if (q !== undefined) {
21825
+ localVarQueryParameter['q'] = q;
21826
+ }
21827
+ if (sort !== undefined) {
21828
+ localVarQueryParameter['sort'] = sort;
21829
+ }
21830
+ if (fields) {
21831
+ localVarQueryParameter['fields'] = fields;
21832
+ }
21833
+ if (id) {
21834
+ localVarQueryParameter['id'] = id;
21835
+ }
21836
+ if (name !== undefined) {
21837
+ localVarQueryParameter['name'] = name;
21838
+ }
21839
+ if (enabled !== undefined) {
21840
+ localVarQueryParameter['enabled'] = enabled;
21841
+ }
21842
+ localVarUrlObj.query = tslib.__assign(tslib.__assign(tslib.__assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
21843
+ // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
21844
+ delete localVarUrlObj.search;
21845
+ headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
21846
+ localVarRequestOptions.headers = tslib.__assign(tslib.__assign(tslib.__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
21847
+ return [2 /*return*/, {
21848
+ url: globalImportUrl.format(localVarUrlObj),
21849
+ options: localVarRequestOptions,
21850
+ }];
21851
+ }
21852
+ });
21853
+ });
21854
+ },
21855
+ /**
21856
+ *
21857
+ * @param {number} id
21858
+ * @param {EngineUpdateChatPlanRequest} body
21859
+ * @param {*} [options] Override http request option.
21860
+ * @throws {RequiredError}
21861
+ */
21862
+ updateChatPlan: function (id, body, options) {
21863
+ if (options === void 0) { options = {}; }
21864
+ return tslib.__awaiter(_this, void 0, void 0, function () {
21865
+ var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, localVarApiKeyValue, _a, headersFromBaseOptions, needsSerialization;
21866
+ return tslib.__generator(this, function (_b) {
21867
+ switch (_b.label) {
21868
+ case 0:
21869
+ // verify required parameter 'id' is not null or undefined
21870
+ if (id === null || id === undefined) {
21871
+ throw new RequiredError('id', 'Required parameter id was null or undefined when calling updateChatPlan.');
21872
+ }
21873
+ // verify required parameter 'body' is not null or undefined
21874
+ if (body === null || body === undefined) {
21875
+ throw new RequiredError('body', 'Required parameter body was null or undefined when calling updateChatPlan.');
21876
+ }
21877
+ localVarPath = "/routing/outbound/chat/{id}".replace("{" + 'id' + "}", encodeURIComponent(String(id)));
21878
+ localVarUrlObj = globalImportUrl.parse(localVarPath, true);
21879
+ if (configuration) {
21880
+ baseOptions = configuration.baseOptions;
21881
+ }
21882
+ localVarRequestOptions = tslib.__assign(tslib.__assign({ method: 'PUT' }, baseOptions), options);
21883
+ localVarHeaderParameter = {};
21884
+ localVarQueryParameter = {};
21885
+ if (!(configuration && configuration.apiKey)) return [3 /*break*/, 5];
21886
+ if (!(typeof configuration.apiKey === 'function')) return [3 /*break*/, 2];
21887
+ return [4 /*yield*/, configuration.apiKey('X-Webitel-Access')];
21888
+ case 1:
21889
+ _a = _b.sent();
21890
+ return [3 /*break*/, 4];
21891
+ case 2: return [4 /*yield*/, configuration.apiKey];
21892
+ case 3:
21893
+ _a = _b.sent();
21894
+ _b.label = 4;
21895
+ case 4:
21896
+ localVarApiKeyValue = _a;
21897
+ localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
21898
+ _b.label = 5;
21899
+ case 5:
21900
+ localVarHeaderParameter['Content-Type'] = 'application/json';
21901
+ localVarUrlObj.query = tslib.__assign(tslib.__assign(tslib.__assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
21902
+ // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
21903
+ delete localVarUrlObj.search;
21904
+ headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
21905
+ localVarRequestOptions.headers = tslib.__assign(tslib.__assign(tslib.__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
21906
+ needsSerialization = typeof body !== 'string' ||
21907
+ localVarRequestOptions.headers['Content-Type'] === 'application/json';
21908
+ localVarRequestOptions.data = needsSerialization
21909
+ ? JSON.stringify(body !== undefined ? body : {})
21910
+ : body || '';
21911
+ return [2 /*return*/, {
21912
+ url: globalImportUrl.format(localVarUrlObj),
21913
+ options: localVarRequestOptions,
21914
+ }];
21915
+ }
21916
+ });
21917
+ });
21918
+ },
21919
+ };
21920
+ };
21921
+ /**
21922
+ * RoutingChatPlanServiceApi - functional programming interface
21923
+ * @export
21924
+ */
21925
+ var RoutingChatPlanServiceApiFp = function (configuration) {
21926
+ return {
21927
+ /**
21928
+ *
21929
+ * @param {EngineCreateChatPlanRequest} body
21930
+ * @param {*} [options] Override http request option.
21931
+ * @throws {RequiredError}
21932
+ */
21933
+ createChatPlan: function (body, options) {
21934
+ return tslib.__awaiter(this, void 0, void 0, function () {
21935
+ var localVarAxiosArgs;
21936
+ return tslib.__generator(this, function (_a) {
21937
+ switch (_a.label) {
21938
+ case 0: return [4 /*yield*/, RoutingChatPlanServiceApiAxiosParamCreator(configuration).createChatPlan(body, options)];
21939
+ case 1:
21940
+ localVarAxiosArgs = _a.sent();
21941
+ return [2 /*return*/, function (axios, basePath) {
21942
+ if (axios === void 0) { axios = globalAxios; }
21943
+ if (basePath === void 0) { basePath = BASE_PATH; }
21944
+ var axiosRequestArgs = tslib.__assign(tslib.__assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
21945
+ return axios.request(axiosRequestArgs);
21946
+ }];
21947
+ }
21948
+ });
21949
+ });
21950
+ },
21951
+ /**
21952
+ *
21953
+ * @param {number} id
21954
+ * @param {EnginePatchChatPlanRequest} body
21955
+ * @param {*} [options] Override http request option.
21956
+ * @throws {RequiredError}
21957
+ */
21958
+ patchChatPlan: function (id, body, options) {
21959
+ return tslib.__awaiter(this, void 0, void 0, function () {
21960
+ var localVarAxiosArgs;
21961
+ return tslib.__generator(this, function (_a) {
21962
+ switch (_a.label) {
21963
+ case 0: return [4 /*yield*/, RoutingChatPlanServiceApiAxiosParamCreator(configuration).patchChatPlan(id, body, options)];
21964
+ case 1:
21965
+ localVarAxiosArgs = _a.sent();
21966
+ return [2 /*return*/, function (axios, basePath) {
21967
+ if (axios === void 0) { axios = globalAxios; }
21968
+ if (basePath === void 0) { basePath = BASE_PATH; }
21969
+ var axiosRequestArgs = tslib.__assign(tslib.__assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
21970
+ return axios.request(axiosRequestArgs);
21971
+ }];
21972
+ }
21973
+ });
21974
+ });
21975
+ },
21976
+ /**
21977
+ *
21978
+ * @param {number} id
21979
+ * @param {*} [options] Override http request option.
21980
+ * @throws {RequiredError}
21981
+ */
21982
+ readChatPlan: function (id, options) {
21983
+ return tslib.__awaiter(this, void 0, void 0, function () {
21984
+ var localVarAxiosArgs;
21985
+ return tslib.__generator(this, function (_a) {
21986
+ switch (_a.label) {
21987
+ case 0: return [4 /*yield*/, RoutingChatPlanServiceApiAxiosParamCreator(configuration).readChatPlan(id, options)];
21988
+ case 1:
21989
+ localVarAxiosArgs = _a.sent();
21990
+ return [2 /*return*/, function (axios, basePath) {
21991
+ if (axios === void 0) { axios = globalAxios; }
21992
+ if (basePath === void 0) { basePath = BASE_PATH; }
21993
+ var axiosRequestArgs = tslib.__assign(tslib.__assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
21994
+ return axios.request(axiosRequestArgs);
21995
+ }];
21996
+ }
21997
+ });
21998
+ });
21999
+ },
22000
+ /**
22001
+ *
22002
+ * @param {number} [page]
22003
+ * @param {number} [size]
22004
+ * @param {string} [q]
22005
+ * @param {string} [sort]
22006
+ * @param {Array<string>} [fields]
22007
+ * @param {Array<number>} [id]
22008
+ * @param {string} [name]
22009
+ * @param {boolean} [enabled]
22010
+ * @param {*} [options] Override http request option.
22011
+ * @throws {RequiredError}
22012
+ */
22013
+ searchChatPlan: function (page, size, q, sort, fields, id, name, enabled, options) {
22014
+ return tslib.__awaiter(this, void 0, void 0, function () {
22015
+ var localVarAxiosArgs;
22016
+ return tslib.__generator(this, function (_a) {
22017
+ switch (_a.label) {
22018
+ case 0: return [4 /*yield*/, RoutingChatPlanServiceApiAxiosParamCreator(configuration).searchChatPlan(page, size, q, sort, fields, id, name, enabled, options)];
22019
+ case 1:
22020
+ localVarAxiosArgs = _a.sent();
22021
+ return [2 /*return*/, function (axios, basePath) {
22022
+ if (axios === void 0) { axios = globalAxios; }
22023
+ if (basePath === void 0) { basePath = BASE_PATH; }
22024
+ var axiosRequestArgs = tslib.__assign(tslib.__assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
22025
+ return axios.request(axiosRequestArgs);
22026
+ }];
22027
+ }
22028
+ });
22029
+ });
22030
+ },
22031
+ /**
22032
+ *
22033
+ * @param {number} id
22034
+ * @param {EngineUpdateChatPlanRequest} body
22035
+ * @param {*} [options] Override http request option.
22036
+ * @throws {RequiredError}
22037
+ */
22038
+ updateChatPlan: function (id, body, options) {
22039
+ return tslib.__awaiter(this, void 0, void 0, function () {
22040
+ var localVarAxiosArgs;
22041
+ return tslib.__generator(this, function (_a) {
22042
+ switch (_a.label) {
22043
+ case 0: return [4 /*yield*/, RoutingChatPlanServiceApiAxiosParamCreator(configuration).updateChatPlan(id, body, options)];
22044
+ case 1:
22045
+ localVarAxiosArgs = _a.sent();
22046
+ return [2 /*return*/, function (axios, basePath) {
22047
+ if (axios === void 0) { axios = globalAxios; }
22048
+ if (basePath === void 0) { basePath = BASE_PATH; }
22049
+ var axiosRequestArgs = tslib.__assign(tslib.__assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
22050
+ return axios.request(axiosRequestArgs);
22051
+ }];
22052
+ }
22053
+ });
22054
+ });
22055
+ },
22056
+ };
22057
+ };
22058
+ /**
22059
+ * RoutingChatPlanServiceApi - factory interface
22060
+ * @export
22061
+ */
22062
+ var RoutingChatPlanServiceApiFactory = function (configuration, basePath, axios) {
22063
+ return {
22064
+ /**
22065
+ *
22066
+ * @param {EngineCreateChatPlanRequest} body
22067
+ * @param {*} [options] Override http request option.
22068
+ * @throws {RequiredError}
22069
+ */
22070
+ createChatPlan: function (body, options) {
22071
+ return RoutingChatPlanServiceApiFp(configuration)
22072
+ .createChatPlan(body, options)
22073
+ .then(function (request) { return request(axios, basePath); });
22074
+ },
22075
+ /**
22076
+ *
22077
+ * @param {number} id
22078
+ * @param {EnginePatchChatPlanRequest} body
22079
+ * @param {*} [options] Override http request option.
22080
+ * @throws {RequiredError}
22081
+ */
22082
+ patchChatPlan: function (id, body, options) {
22083
+ return RoutingChatPlanServiceApiFp(configuration)
22084
+ .patchChatPlan(id, body, options)
22085
+ .then(function (request) { return request(axios, basePath); });
22086
+ },
22087
+ /**
22088
+ *
22089
+ * @param {number} id
22090
+ * @param {*} [options] Override http request option.
22091
+ * @throws {RequiredError}
22092
+ */
22093
+ readChatPlan: function (id, options) {
22094
+ return RoutingChatPlanServiceApiFp(configuration)
22095
+ .readChatPlan(id, options)
22096
+ .then(function (request) { return request(axios, basePath); });
22097
+ },
22098
+ /**
22099
+ *
22100
+ * @param {number} [page]
22101
+ * @param {number} [size]
22102
+ * @param {string} [q]
22103
+ * @param {string} [sort]
22104
+ * @param {Array<string>} [fields]
22105
+ * @param {Array<number>} [id]
22106
+ * @param {string} [name]
22107
+ * @param {boolean} [enabled]
22108
+ * @param {*} [options] Override http request option.
22109
+ * @throws {RequiredError}
22110
+ */
22111
+ searchChatPlan: function (page, size, q, sort, fields, id, name, enabled, options) {
22112
+ return RoutingChatPlanServiceApiFp(configuration)
22113
+ .searchChatPlan(page, size, q, sort, fields, id, name, enabled, options)
22114
+ .then(function (request) { return request(axios, basePath); });
22115
+ },
22116
+ /**
22117
+ *
22118
+ * @param {number} id
22119
+ * @param {EngineUpdateChatPlanRequest} body
22120
+ * @param {*} [options] Override http request option.
22121
+ * @throws {RequiredError}
22122
+ */
22123
+ updateChatPlan: function (id, body, options) {
22124
+ return RoutingChatPlanServiceApiFp(configuration)
22125
+ .updateChatPlan(id, body, options)
22126
+ .then(function (request) { return request(axios, basePath); });
22127
+ },
22128
+ };
22129
+ };
22130
+ /**
22131
+ * RoutingChatPlanServiceApi - object-oriented interface
22132
+ * @export
22133
+ * @class RoutingChatPlanServiceApi
22134
+ * @extends {BaseAPI}
22135
+ */
22136
+ var RoutingChatPlanServiceApi = /** @class */ (function (_super) {
22137
+ tslib.__extends(RoutingChatPlanServiceApi, _super);
22138
+ function RoutingChatPlanServiceApi() {
22139
+ return _super !== null && _super.apply(this, arguments) || this;
22140
+ }
22141
+ /**
22142
+ *
22143
+ * @param {EngineCreateChatPlanRequest} body
22144
+ * @param {*} [options] Override http request option.
22145
+ * @throws {RequiredError}
22146
+ * @memberof RoutingChatPlanServiceApi
22147
+ */
22148
+ RoutingChatPlanServiceApi.prototype.createChatPlan = function (body, options) {
22149
+ var _this = this;
22150
+ return RoutingChatPlanServiceApiFp(this.configuration)
22151
+ .createChatPlan(body, options)
22152
+ .then(function (request) { return request(_this.axios, _this.basePath); });
22153
+ };
22154
+ /**
22155
+ *
22156
+ * @param {number} id
22157
+ * @param {EnginePatchChatPlanRequest} body
22158
+ * @param {*} [options] Override http request option.
22159
+ * @throws {RequiredError}
22160
+ * @memberof RoutingChatPlanServiceApi
22161
+ */
22162
+ RoutingChatPlanServiceApi.prototype.patchChatPlan = function (id, body, options) {
22163
+ var _this = this;
22164
+ return RoutingChatPlanServiceApiFp(this.configuration)
22165
+ .patchChatPlan(id, body, options)
22166
+ .then(function (request) { return request(_this.axios, _this.basePath); });
22167
+ };
22168
+ /**
22169
+ *
22170
+ * @param {number} id
22171
+ * @param {*} [options] Override http request option.
22172
+ * @throws {RequiredError}
22173
+ * @memberof RoutingChatPlanServiceApi
22174
+ */
22175
+ RoutingChatPlanServiceApi.prototype.readChatPlan = function (id, options) {
22176
+ var _this = this;
22177
+ return RoutingChatPlanServiceApiFp(this.configuration)
22178
+ .readChatPlan(id, options)
22179
+ .then(function (request) { return request(_this.axios, _this.basePath); });
22180
+ };
22181
+ /**
22182
+ *
22183
+ * @param {number} [page]
22184
+ * @param {number} [size]
22185
+ * @param {string} [q]
22186
+ * @param {string} [sort]
22187
+ * @param {Array<string>} [fields]
22188
+ * @param {Array<number>} [id]
22189
+ * @param {string} [name]
22190
+ * @param {boolean} [enabled]
22191
+ * @param {*} [options] Override http request option.
22192
+ * @throws {RequiredError}
22193
+ * @memberof RoutingChatPlanServiceApi
22194
+ */
22195
+ RoutingChatPlanServiceApi.prototype.searchChatPlan = function (page, size, q, sort, fields, id, name, enabled, options) {
22196
+ var _this = this;
22197
+ return RoutingChatPlanServiceApiFp(this.configuration)
22198
+ .searchChatPlan(page, size, q, sort, fields, id, name, enabled, options)
22199
+ .then(function (request) { return request(_this.axios, _this.basePath); });
22200
+ };
22201
+ /**
22202
+ *
22203
+ * @param {number} id
22204
+ * @param {EngineUpdateChatPlanRequest} body
22205
+ * @param {*} [options] Override http request option.
22206
+ * @throws {RequiredError}
22207
+ * @memberof RoutingChatPlanServiceApi
22208
+ */
22209
+ RoutingChatPlanServiceApi.prototype.updateChatPlan = function (id, body, options) {
22210
+ var _this = this;
22211
+ return RoutingChatPlanServiceApiFp(this.configuration)
22212
+ .updateChatPlan(id, body, options)
22213
+ .then(function (request) { return request(_this.axios, _this.basePath); });
22214
+ };
22215
+ return RoutingChatPlanServiceApi;
22216
+ }(BaseAPI));
22217
+
21591
22218
  // tslint:disable
21592
22219
  /**
21593
22220
  * RoutingOutboundCallServiceApi - axios parameter creator
@@ -25263,11 +25890,12 @@
25263
25890
  this.lastStatusChange = Date.now();
25264
25891
  };
25265
25892
  Task.prototype.setProcessing = function (p) {
25893
+ this.state = 'processing'; // todo
25266
25894
  if (!this.startProcessingAt) {
25267
25895
  this.startProcessingAt = Date.now();
25268
25896
  }
25269
25897
  if (p.sec) {
25270
- p.timeout = this.startProcessingAt + p.sec * 1000; // bug
25898
+ p.timeout = Date.now() + p.sec * 1000; // bug
25271
25899
  }
25272
25900
  this._processing = p;
25273
25901
  };
@@ -26284,7 +26912,13 @@
26284
26912
  this.members = (members || []).map(function (i) { return wrapChannelMember(i); });
26285
26913
  this._messages = messages || [];
26286
26914
  this.state = exports.ConversationState.Invite;
26287
- this.variables = variables;
26915
+ this.variables = {};
26916
+ this._hasReporting = !!(variables && variables.cc_reporting === 'true');
26917
+ for (var k in variables) {
26918
+ if (!k.startsWith('cc_') && variables.hasOwnProperty(k)) {
26919
+ this.variables[k] = variables[k];
26920
+ }
26921
+ }
26288
26922
  if (variables &&
26289
26923
  variables.hasOwnProperty('cc_attempt_id') &&
26290
26924
  this.client.agent) {
@@ -26308,7 +26942,7 @@
26308
26942
  };
26309
26943
  Object.defineProperty(Conversation.prototype, "id", {
26310
26944
  get: function () {
26311
- return this.conversationId;
26945
+ return this.channelId || this.inviteId || this.conversationId;
26312
26946
  },
26313
26947
  enumerable: true,
26314
26948
  configurable: true
@@ -26330,6 +26964,7 @@
26330
26964
  channelId: i.channel_id,
26331
26965
  createdAt: i.created_at,
26332
26966
  updatedAt: i.updated_at,
26967
+ contact: null,
26333
26968
  };
26334
26969
  if (i.hasOwnProperty('file')) {
26335
26970
  i.file.url = _this.client.fileUrlDownload(i.file.id);
@@ -26338,6 +26973,9 @@
26338
26973
  if (i.hasOwnProperty('text')) {
26339
26974
  msg.text = i.text;
26340
26975
  }
26976
+ if (i.hasOwnProperty('contact')) {
26977
+ msg.contact = i.contact;
26978
+ }
26341
26979
  return msg;
26342
26980
  });
26343
26981
  };
@@ -26388,7 +27026,19 @@
26388
27026
  });
26389
27027
  Object.defineProperty(Conversation.prototype, "hasReporting", {
26390
27028
  get: function () {
26391
- return this.variables && this.variables.cc_reporting === 'true';
27029
+ return this._hasReporting;
27030
+ },
27031
+ enumerable: true,
27032
+ configurable: true
27033
+ });
27034
+ Object.defineProperty(Conversation.prototype, "membersId", {
27035
+ get: function () {
27036
+ var res = [this.id];
27037
+ for (var _i = 0, _a = this.members; _i < _a.length; _i++) {
27038
+ var m = _a[_i];
27039
+ res.push(m.id);
27040
+ }
27041
+ return res;
26392
27042
  },
26393
27043
  enumerable: true,
26394
27044
  configurable: true
@@ -26425,7 +27075,7 @@
26425
27075
  throw new Error('This conversation not active');
26426
27076
  return [2 /*return*/, this.client.request("close_chat", {
26427
27077
  channel_id: this.channelId,
26428
- conversation_id: this.id,
27078
+ conversation_id: this.conversationId,
26429
27079
  cause: cause,
26430
27080
  })];
26431
27081
  });
@@ -26438,7 +27088,7 @@
26438
27088
  throw new Error('This conversation not active');
26439
27089
  return [2 /*return*/, this.client.request("leave_chat", {
26440
27090
  channel_id: this.channelId,
26441
- conversation_id: this.id,
27091
+ conversation_id: this.conversationId,
26442
27092
  cause: cause,
26443
27093
  })];
26444
27094
  });
@@ -26481,14 +27131,14 @@
26481
27131
  var storedFiles, f;
26482
27132
  return tslib.__generator(this, function (_a) {
26483
27133
  switch (_a.label) {
26484
- case 0: return [4 /*yield*/, this.client.storeFile(this.id, [file], cb)];
27134
+ case 0: return [4 /*yield*/, this.client.storeFile(this.conversationId, [file], cb)];
26485
27135
  case 1:
26486
27136
  storedFiles = _a.sent();
26487
27137
  f = storedFiles[0];
26488
27138
  // todo bug if chat response error
26489
27139
  return [2 /*return*/, this.client.request("send_file_chat", {
26490
27140
  channel_id: this.channelId,
26491
- conversation_id: this.id,
27141
+ conversation_id: this.conversationId,
26492
27142
  id: f.id,
26493
27143
  name: file.name,
26494
27144
  mime: f.mime,
@@ -26520,7 +27170,7 @@
26520
27170
  return tslib.__generator(this, function (_a) {
26521
27171
  return [2 /*return*/, this.client.request("add_to_chat", {
26522
27172
  channel_id: this.channelId,
26523
- conversation_id: this.id,
27173
+ conversation_id: this.conversationId,
26524
27174
  user_id: userId,
26525
27175
  title: title,
26526
27176
  })];
@@ -26565,10 +27215,32 @@
26565
27215
  });
26566
27216
  });
26567
27217
  };
27218
+ Conversation.prototype.transferToPlan = function (planId) {
27219
+ return tslib.__awaiter(this, void 0, void 0, function () {
27220
+ return tslib.__generator(this, function (_a) {
27221
+ return [2 /*return*/, this.client.request("blind_transfer_chat", {
27222
+ conversation_id: this.conversationId,
27223
+ channel_id: this.channelId,
27224
+ plan_id: planId,
27225
+ })];
27226
+ });
27227
+ });
27228
+ };
27229
+ Conversation.prototype.transferToUser = function (userId) {
27230
+ return tslib.__awaiter(this, void 0, void 0, function () {
27231
+ return tslib.__generator(this, function (_a) {
27232
+ return [2 /*return*/, this.client.request("transfer_user_chat", {
27233
+ conversation_id: this.conversationId,
27234
+ channel_id: this.channelId,
27235
+ user_id: userId,
27236
+ })];
27237
+ });
27238
+ });
27239
+ };
26568
27240
  Conversation.prototype.sendMessageTextChunk = function (text) {
26569
27241
  return this.client.request("send_text_chat", {
26570
27242
  channel_id: this.channelId,
26571
- conversation_id: this.id,
27243
+ conversation_id: this.conversationId,
26572
27244
  text: text,
26573
27245
  });
26574
27246
  };
@@ -27503,8 +28175,8 @@
27503
28175
  };
27504
28176
  Client.prototype.handleChatEvents = function (event) {
27505
28177
  return tslib.__awaiter(this, void 0, void 0, function () {
27506
- var conversation, timestamp, inv, joined, message, e;
27507
- return tslib.__generator(this, function (_a) {
28178
+ var conversation, timestamp, inv, joined, message, _i, _a, v, c, _b, _c, v, l, e;
28179
+ return tslib.__generator(this, function (_d) {
27508
28180
  timestamp = Date.now() // todo bug
27509
28181
  ;
27510
28182
  switch (event.action) {
@@ -27516,7 +28188,7 @@
27516
28188
  break;
27517
28189
  case exports.ChatActions.Joined:
27518
28190
  joined = event.data;
27519
- conversation = this.conversationById(joined.conversation_id);
28191
+ conversation = this.conversationById(joined.member.id);
27520
28192
  if (conversation) {
27521
28193
  conversation.setAnswered(joined.member.id, timestamp, joined.member);
27522
28194
  }
@@ -27524,16 +28196,40 @@
27524
28196
  case exports.ChatActions.Message:
27525
28197
  message = event.data;
27526
28198
  message.timestamp = timestamp;
27527
- conversation = this.conversationById(message.conversation_id);
28199
+ // fixme
28200
+ for (_i = 0, _a = this.allConversations(); _i < _a.length; _i++) {
28201
+ v = _a[_i];
28202
+ if (!v.closedAt && v.membersId.indexOf(message.channel_id) > -1) {
28203
+ conversation = v;
28204
+ }
28205
+ }
27528
28206
  if (conversation) {
27529
28207
  conversation.newMessage(message);
27530
28208
  }
27531
28209
  break;
27532
28210
  case exports.ChatActions.Close:
28211
+ c = event.data;
28212
+ // fixme
28213
+ for (_b = 0, _c = this.allConversations(); _b < _c.length; _b++) {
28214
+ v = _c[_b];
28215
+ if (!v.closedAt && v.membersId.indexOf(c.from_channel_id) > -1) {
28216
+ conversation = v;
28217
+ }
28218
+ }
28219
+ if (conversation) {
28220
+ conversation.setClosed(timestamp);
28221
+ }
28222
+ break;
27533
28223
  case exports.ChatActions.Leave:
28224
+ l = event.data;
28225
+ conversation = this.conversationById(l.leaved_channel_id);
28226
+ if (conversation) {
28227
+ conversation.setClosed(timestamp);
28228
+ }
28229
+ break;
27534
28230
  case exports.ChatActions.Decline:
27535
28231
  e = event.data;
27536
- conversation = this.conversationById(e.conversation_id);
28232
+ conversation = this.conversationById(e.invite_id);
27537
28233
  if (conversation) {
27538
28234
  conversation.setClosed(timestamp);
27539
28235
  }
@@ -28072,6 +28768,10 @@
28072
28768
  exports.RegionServiceApiFp = RegionServiceApiFp;
28073
28769
  exports.RegionServiceApiFactory = RegionServiceApiFactory;
28074
28770
  exports.RegionServiceApi = RegionServiceApi;
28771
+ exports.RoutingChatPlanServiceApiAxiosParamCreator = RoutingChatPlanServiceApiAxiosParamCreator;
28772
+ exports.RoutingChatPlanServiceApiFp = RoutingChatPlanServiceApiFp;
28773
+ exports.RoutingChatPlanServiceApiFactory = RoutingChatPlanServiceApiFactory;
28774
+ exports.RoutingChatPlanServiceApi = RoutingChatPlanServiceApi;
28075
28775
  exports.RoutingOutboundCallServiceApiAxiosParamCreator = RoutingOutboundCallServiceApiAxiosParamCreator;
28076
28776
  exports.RoutingOutboundCallServiceApiFp = RoutingOutboundCallServiceApiFp;
28077
28777
  exports.RoutingOutboundCallServiceApiFactory = RoutingOutboundCallServiceApiFactory;