@vendasta/conversation 0.25.0 → 0.26.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.
Files changed (31) hide show
  1. package/esm2020/lib/_internal/inbox.api.service.mjs +46 -0
  2. package/esm2020/lib/_internal/index.mjs +2 -1
  3. package/esm2020/lib/_internal/interfaces/api.interface.mjs +1 -1
  4. package/esm2020/lib/_internal/interfaces/common.interface.mjs +8 -0
  5. package/esm2020/lib/_internal/interfaces/configuration.interface.mjs +2 -0
  6. package/esm2020/lib/_internal/interfaces/conversation.interface.mjs +1 -7
  7. package/esm2020/lib/_internal/interfaces/index.mjs +1 -1
  8. package/esm2020/lib/_internal/objects/api.mjs +95 -1
  9. package/esm2020/lib/_internal/objects/common.mjs +34 -0
  10. package/esm2020/lib/_internal/objects/configuration.mjs +49 -0
  11. package/esm2020/lib/_internal/objects/conversation.mjs +2 -27
  12. package/esm2020/lib/_internal/objects/index.mjs +5 -3
  13. package/esm2020/lib/index.mjs +2 -1
  14. package/fesm2015/vendasta-conversation.mjs +222 -42
  15. package/fesm2015/vendasta-conversation.mjs.map +1 -1
  16. package/fesm2020/vendasta-conversation.mjs +222 -42
  17. package/fesm2020/vendasta-conversation.mjs.map +1 -1
  18. package/lib/_internal/inbox.api.service.d.ts +17 -0
  19. package/lib/_internal/index.d.ts +1 -0
  20. package/lib/_internal/interfaces/api.interface.d.ts +14 -0
  21. package/lib/_internal/interfaces/common.interface.d.ts +5 -0
  22. package/lib/_internal/interfaces/configuration.interface.d.ts +8 -0
  23. package/lib/_internal/interfaces/conversation.interface.d.ts +1 -4
  24. package/lib/_internal/interfaces/index.d.ts +4 -2
  25. package/lib/_internal/objects/api.d.ts +26 -0
  26. package/lib/_internal/objects/common.d.ts +10 -0
  27. package/lib/_internal/objects/configuration.d.ts +13 -0
  28. package/lib/_internal/objects/conversation.d.ts +1 -7
  29. package/lib/_internal/objects/index.d.ts +4 -2
  30. package/lib/index.d.ts +1 -0
  31. package/package.json +1 -1
@@ -111,7 +111,7 @@ var SetLastSeenRequestStatus;
111
111
 
112
112
  // *********************************
113
113
 
114
- function enumStringToValue$4(enumRef, value) {
114
+ function enumStringToValue$6(enumRef, value) {
115
115
  if (typeof value === 'number') {
116
116
  return value;
117
117
  }
@@ -128,7 +128,7 @@ class Message {
128
128
  let m = new Message();
129
129
  m = Object.assign(m, proto);
130
130
  if (proto.type) {
131
- m.type = enumStringToValue$4(MessageType, proto.type);
131
+ m.type = enumStringToValue$6(MessageType, proto.type);
132
132
  }
133
133
  if (proto.created) {
134
134
  m.created = new Date(proto.created);
@@ -190,7 +190,7 @@ class ParticipantMessageStatus {
190
190
  let m = new ParticipantMessageStatus();
191
191
  m = Object.assign(m, proto);
192
192
  if (proto.status) {
193
- m.status = enumStringToValue$4(MessageStatus, proto.status);
193
+ m.status = enumStringToValue$6(MessageStatus, proto.status);
194
194
  }
195
195
  if (proto.updated) {
196
196
  m.updated = new Date(proto.updated);
@@ -215,7 +215,40 @@ class ParticipantMessageStatus {
215
215
  }
216
216
  }
217
217
 
218
- function enumStringToValue$3(enumRef, value) {
218
+ function enumStringToValue$5(enumRef, value) {
219
+ if (typeof value === 'number') {
220
+ return value;
221
+ }
222
+ return enumRef[value];
223
+ }
224
+ class SubjectParticipant {
225
+ constructor(kwargs) {
226
+ if (!kwargs) {
227
+ return;
228
+ }
229
+ Object.assign(this, kwargs);
230
+ }
231
+ static fromProto(proto) {
232
+ let m = new SubjectParticipant();
233
+ m = Object.assign(m, proto);
234
+ if (proto.participantType) {
235
+ m.participantType = enumStringToValue$5(GlobalParticipantType, proto.participantType);
236
+ }
237
+ return m;
238
+ }
239
+ toApiJson() {
240
+ const toReturn = {};
241
+ if (typeof this.participantType !== 'undefined') {
242
+ toReturn['participantType'] = this.participantType;
243
+ }
244
+ if (typeof this.internalParticipantId !== 'undefined') {
245
+ toReturn['internalParticipantId'] = this.internalParticipantId;
246
+ }
247
+ return toReturn;
248
+ }
249
+ }
250
+
251
+ function enumStringToValue$4(enumRef, value) {
219
252
  if (typeof value === 'number') {
220
253
  return value;
221
254
  }
@@ -232,7 +265,7 @@ class Conversation {
232
265
  let m = new Conversation();
233
266
  m = Object.assign(m, proto);
234
267
  if (proto.channel) {
235
- m.channel = enumStringToValue$3(ConversationChannel, proto.channel);
268
+ m.channel = enumStringToValue$4(ConversationChannel, proto.channel);
236
269
  }
237
270
  if (proto.created) {
238
271
  m.created = new Date(proto.created);
@@ -247,7 +280,7 @@ class Conversation {
247
280
  m.latestMsgSentTime = new Date(proto.latestMsgSentTime);
248
281
  }
249
282
  if (proto.originLocation) {
250
- m.originLocation = enumStringToValue$3(PlatformLocation, proto.originLocation);
283
+ m.originLocation = enumStringToValue$4(PlatformLocation, proto.originLocation);
251
284
  }
252
285
  if (proto.lastSeenByParticipant) {
253
286
  m.lastSeenByParticipant = proto.lastSeenByParticipant.map(LastSeenByParticipant.fromProto);
@@ -306,7 +339,7 @@ class ConversationKey {
306
339
  m.subjectParticipants = proto.subjectParticipants.map(SubjectParticipant.fromProto);
307
340
  }
308
341
  if (proto.channel) {
309
- m.channel = enumStringToValue$3(ConversationChannel, proto.channel);
342
+ m.channel = enumStringToValue$4(ConversationChannel, proto.channel);
310
343
  }
311
344
  return m;
312
345
  }
@@ -350,34 +383,8 @@ class LastSeenByParticipant {
350
383
  return toReturn;
351
384
  }
352
385
  }
353
- class SubjectParticipant {
354
- constructor(kwargs) {
355
- if (!kwargs) {
356
- return;
357
- }
358
- Object.assign(this, kwargs);
359
- }
360
- static fromProto(proto) {
361
- let m = new SubjectParticipant();
362
- m = Object.assign(m, proto);
363
- if (proto.participantType) {
364
- m.participantType = enumStringToValue$3(GlobalParticipantType, proto.participantType);
365
- }
366
- return m;
367
- }
368
- toApiJson() {
369
- const toReturn = {};
370
- if (typeof this.participantType !== 'undefined') {
371
- toReturn['participantType'] = this.participantType;
372
- }
373
- if (typeof this.internalParticipantId !== 'undefined') {
374
- toReturn['internalParticipantId'] = this.internalParticipantId;
375
- }
376
- return toReturn;
377
- }
378
- }
379
386
 
380
- function enumStringToValue$2(enumRef, value) {
387
+ function enumStringToValue$3(enumRef, value) {
381
388
  if (typeof value === 'number') {
382
389
  return value;
383
390
  }
@@ -429,10 +436,10 @@ class Participant {
429
436
  let m = new Participant();
430
437
  m = Object.assign(m, proto);
431
438
  if (proto.location) {
432
- m.location = enumStringToValue$2(PlatformLocation, proto.location);
439
+ m.location = enumStringToValue$3(PlatformLocation, proto.location);
433
440
  }
434
441
  if (proto.channel) {
435
- m.channel = enumStringToValue$2(ConversationChannel, proto.channel);
442
+ m.channel = enumStringToValue$3(ConversationChannel, proto.channel);
436
443
  }
437
444
  if (proto.created) {
438
445
  m.created = new Date(proto.created);
@@ -444,7 +451,7 @@ class Participant {
444
451
  m.deleted = new Date(proto.deleted);
445
452
  }
446
453
  if (proto.participantType) {
447
- m.participantType = enumStringToValue$2(ParticipantType, proto.participantType);
454
+ m.participantType = enumStringToValue$3(ParticipantType, proto.participantType);
448
455
  }
449
456
  if (proto.address) {
450
457
  m.address = Address.fromProto(proto.address);
@@ -521,13 +528,13 @@ class ParticipantKey {
521
528
  let m = new ParticipantKey();
522
529
  m = Object.assign(m, proto);
523
530
  if (proto.location) {
524
- m.location = enumStringToValue$2(PlatformLocation, proto.location);
531
+ m.location = enumStringToValue$3(PlatformLocation, proto.location);
525
532
  }
526
533
  if (proto.channels) {
527
- m.channels = proto.channels.map((v) => enumStringToValue$2(ConversationChannel, v));
534
+ m.channels = proto.channels.map((v) => enumStringToValue$3(ConversationChannel, v));
528
535
  }
529
536
  if (proto.participantType) {
530
- m.participantType = enumStringToValue$2(GlobalParticipantType, proto.participantType);
537
+ m.participantType = enumStringToValue$3(GlobalParticipantType, proto.participantType);
531
538
  }
532
539
  return m;
533
540
  }
@@ -555,7 +562,7 @@ class ParticipantKey {
555
562
  }
556
563
  }
557
564
 
558
- function enumStringToValue$1(enumRef, value) {
565
+ function enumStringToValue$2(enumRef, value) {
559
566
  if (typeof value === 'number') {
560
567
  return value;
561
568
  }
@@ -585,6 +592,54 @@ class Access {
585
592
  }
586
593
  }
587
594
 
595
+ function enumStringToValue$1(enumRef, value) {
596
+ if (typeof value === 'number') {
597
+ return value;
598
+ }
599
+ return enumRef[value];
600
+ }
601
+ class Configuration {
602
+ constructor(kwargs) {
603
+ if (!kwargs) {
604
+ return;
605
+ }
606
+ Object.assign(this, kwargs);
607
+ }
608
+ static fromProto(proto) {
609
+ let m = new Configuration();
610
+ m = Object.assign(m, proto);
611
+ if (proto.subjectParticipant) {
612
+ m.subjectParticipant = SubjectParticipant.fromProto(proto.subjectParticipant);
613
+ }
614
+ if (proto.createdAt) {
615
+ m.createdAt = new Date(proto.createdAt);
616
+ }
617
+ if (proto.updatedAt) {
618
+ m.updatedAt = new Date(proto.updatedAt);
619
+ }
620
+ return m;
621
+ }
622
+ toApiJson() {
623
+ const toReturn = {};
624
+ if (typeof this.subjectParticipant !== 'undefined' && this.subjectParticipant !== null) {
625
+ toReturn['subjectParticipant'] = 'toApiJson' in this.subjectParticipant ? this.subjectParticipant.toApiJson() : this.subjectParticipant;
626
+ }
627
+ if (typeof this.createdAt !== 'undefined' && this.createdAt !== null) {
628
+ toReturn['createdAt'] = 'toApiJson' in this.createdAt ? this.createdAt.toApiJson() : this.createdAt;
629
+ }
630
+ if (typeof this.updatedAt !== 'undefined' && this.updatedAt !== null) {
631
+ toReturn['updatedAt'] = 'toApiJson' in this.updatedAt ? this.updatedAt.toApiJson() : this.updatedAt;
632
+ }
633
+ if (typeof this.availabilityMessage !== 'undefined') {
634
+ toReturn['availabilityMessage'] = this.availabilityMessage;
635
+ }
636
+ if (typeof this.showAvailabilityMessage !== 'undefined') {
637
+ toReturn['showAvailabilityMessage'] = this.showAvailabilityMessage;
638
+ }
639
+ return toReturn;
640
+ }
641
+ }
642
+
588
643
  function enumStringToValue(enumRef, value) {
589
644
  if (typeof value === 'number') {
590
645
  return value;
@@ -965,6 +1020,52 @@ class GetMultiConversationDetailsResponseDetailedConversation {
965
1020
  return toReturn;
966
1021
  }
967
1022
  }
1023
+ class GetConfigurationRequest {
1024
+ constructor(kwargs) {
1025
+ if (!kwargs) {
1026
+ return;
1027
+ }
1028
+ Object.assign(this, kwargs);
1029
+ }
1030
+ static fromProto(proto) {
1031
+ let m = new GetConfigurationRequest();
1032
+ m = Object.assign(m, proto);
1033
+ if (proto.subjectParticipant) {
1034
+ m.subjectParticipant = SubjectParticipant.fromProto(proto.subjectParticipant);
1035
+ }
1036
+ return m;
1037
+ }
1038
+ toApiJson() {
1039
+ const toReturn = {};
1040
+ if (typeof this.subjectParticipant !== 'undefined' && this.subjectParticipant !== null) {
1041
+ toReturn['subjectParticipant'] = 'toApiJson' in this.subjectParticipant ? this.subjectParticipant.toApiJson() : this.subjectParticipant;
1042
+ }
1043
+ return toReturn;
1044
+ }
1045
+ }
1046
+ class GetConfigurationResponse {
1047
+ constructor(kwargs) {
1048
+ if (!kwargs) {
1049
+ return;
1050
+ }
1051
+ Object.assign(this, kwargs);
1052
+ }
1053
+ static fromProto(proto) {
1054
+ let m = new GetConfigurationResponse();
1055
+ m = Object.assign(m, proto);
1056
+ if (proto.configuration) {
1057
+ m.configuration = Configuration.fromProto(proto.configuration);
1058
+ }
1059
+ return m;
1060
+ }
1061
+ toApiJson() {
1062
+ const toReturn = {};
1063
+ if (typeof this.configuration !== 'undefined' && this.configuration !== null) {
1064
+ toReturn['configuration'] = 'toApiJson' in this.configuration ? this.configuration.toApiJson() : this.configuration;
1065
+ }
1066
+ return toReturn;
1067
+ }
1068
+ }
968
1069
  class GetConversationByKeyRequest {
969
1070
  constructor(kwargs) {
970
1071
  if (!kwargs) {
@@ -1831,6 +1932,52 @@ class UpdateMessageStatusRequest {
1831
1932
  return toReturn;
1832
1933
  }
1833
1934
  }
1935
+ class UpsertConfigurationRequest {
1936
+ constructor(kwargs) {
1937
+ if (!kwargs) {
1938
+ return;
1939
+ }
1940
+ Object.assign(this, kwargs);
1941
+ }
1942
+ static fromProto(proto) {
1943
+ let m = new UpsertConfigurationRequest();
1944
+ m = Object.assign(m, proto);
1945
+ if (proto.configuration) {
1946
+ m.configuration = Configuration.fromProto(proto.configuration);
1947
+ }
1948
+ return m;
1949
+ }
1950
+ toApiJson() {
1951
+ const toReturn = {};
1952
+ if (typeof this.configuration !== 'undefined' && this.configuration !== null) {
1953
+ toReturn['configuration'] = 'toApiJson' in this.configuration ? this.configuration.toApiJson() : this.configuration;
1954
+ }
1955
+ return toReturn;
1956
+ }
1957
+ }
1958
+ class UpsertConfigurationResponse {
1959
+ constructor(kwargs) {
1960
+ if (!kwargs) {
1961
+ return;
1962
+ }
1963
+ Object.assign(this, kwargs);
1964
+ }
1965
+ static fromProto(proto) {
1966
+ let m = new UpsertConfigurationResponse();
1967
+ m = Object.assign(m, proto);
1968
+ if (proto.configuration) {
1969
+ m.configuration = Configuration.fromProto(proto.configuration);
1970
+ }
1971
+ return m;
1972
+ }
1973
+ toApiJson() {
1974
+ const toReturn = {};
1975
+ if (typeof this.configuration !== 'undefined' && this.configuration !== null) {
1976
+ toReturn['configuration'] = 'toApiJson' in this.configuration ? this.configuration.toApiJson() : this.configuration;
1977
+ }
1978
+ return toReturn;
1979
+ }
1980
+ }
1834
1981
 
1835
1982
  // *********************************
1836
1983
 
@@ -1970,11 +2117,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.6", ngImpor
1970
2117
  args: [{ providedIn: 'root' }]
1971
2118
  }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: HostService }]; } });
1972
2119
 
2120
+ // *********************************
2121
+ class InboxApiService {
2122
+ constructor(http, hostService) {
2123
+ this.http = http;
2124
+ this.hostService = hostService;
2125
+ this._host = this.hostService.hostWithScheme;
2126
+ }
2127
+ apiOptions() {
2128
+ return {
2129
+ headers: new HttpHeaders({
2130
+ 'Content-Type': 'application/json'
2131
+ }),
2132
+ withCredentials: true
2133
+ };
2134
+ }
2135
+ getConfiguration(r) {
2136
+ const request = (r.toApiJson) ? r : new GetConfigurationRequest(r);
2137
+ return this.http.post(this._host + "/conversation.v1.InboxService/GetConfiguration", request.toApiJson(), this.apiOptions())
2138
+ .pipe(map(resp => GetConfigurationResponse.fromProto(resp)));
2139
+ }
2140
+ upsertConfiguration(r) {
2141
+ const request = (r.toApiJson) ? r : new UpsertConfigurationRequest(r);
2142
+ return this.http.post(this._host + "/conversation.v1.InboxService/UpsertConfiguration", request.toApiJson(), this.apiOptions())
2143
+ .pipe(map(resp => UpsertConfigurationResponse.fromProto(resp)));
2144
+ }
2145
+ }
2146
+ InboxApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: InboxApiService, deps: [{ token: i1.HttpClient }, { token: HostService }], target: i0.ɵɵFactoryTarget.Injectable });
2147
+ InboxApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: InboxApiService, providedIn: 'root' });
2148
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: InboxApiService, decorators: [{
2149
+ type: Injectable,
2150
+ args: [{ providedIn: 'root' }]
2151
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: HostService }]; } });
2152
+
1973
2153
  // *********************************
1974
2154
 
1975
2155
  /**
1976
2156
  * Generated bundle index. Do not edit.
1977
2157
  */
1978
2158
 
1979
- export { Access, AddMultiParticipantsRequest, AddMultiParticipantsResponse, Address, Conversation, ConversationApiService, ConversationChannel, ConversationKey, ConversationMessageCount, CreateConversationRequest, CreateConversationResponse, CreateMultiMessagesRequest, DeleteConversationRequest, DeleteMessageRequest, GetConversationByKeyRequest, GetConversationByKeyResponse, GetMessageRequest, GetMultiConversationDetailsRequest, GetMultiConversationDetailsResponse, GetMultiConversationDetailsResponseDetailedConversation, GetMultiConversationMessageCountRequest, GetMultiConversationMessageCountResponse, GetMultiConversationMessageCountResponseCountsEntry, GetMultiMessagesRequest, GetMultiMessagesResponse, GetMultiParticipantsRequest, GetMultiParticipantsResponse, GetParticipantsByKeyRequest, GetParticipantsByKeyResponse, GlobalParticipantType, LastSeenByParticipant, ListMessagesRequest, ListMessagesRequestListMessagesFilters, ListMessagesResponse, LookupConversationsRequest, LookupConversationsRequestLookupConversationsFilters, LookupConversationsResponse, LookupConversationsResponseConversations, Message, MessageStatus, MessageType, Metadata, MetadataDataEntry, MetadataIdentifier, PagedRequestOptions, PagedResponseMetadata, Participant, ParticipantKey, ParticipantMessageStatus, ParticipantType, PlatformLocation, ReceiveMessageRequest, ReceiveMessageRequestMetadataEntry, SearchConversationsRequest, SearchConversationsResponse, SearchConversationsResponseDetailedConversation, SendMessageRequest, SendMessageResponse, SetLastSeenRequest, SetLastSeenRequestStatus, SetLastSeenResponse, SubjectParticipant, UpdateMessageStatusRequest };
2159
+ export { Access, AddMultiParticipantsRequest, AddMultiParticipantsResponse, Address, Configuration, Conversation, ConversationApiService, ConversationChannel, ConversationKey, ConversationMessageCount, CreateConversationRequest, CreateConversationResponse, CreateMultiMessagesRequest, DeleteConversationRequest, DeleteMessageRequest, GetConfigurationRequest, GetConfigurationResponse, GetConversationByKeyRequest, GetConversationByKeyResponse, GetMessageRequest, GetMultiConversationDetailsRequest, GetMultiConversationDetailsResponse, GetMultiConversationDetailsResponseDetailedConversation, GetMultiConversationMessageCountRequest, GetMultiConversationMessageCountResponse, GetMultiConversationMessageCountResponseCountsEntry, GetMultiMessagesRequest, GetMultiMessagesResponse, GetMultiParticipantsRequest, GetMultiParticipantsResponse, GetParticipantsByKeyRequest, GetParticipantsByKeyResponse, GlobalParticipantType, InboxApiService, LastSeenByParticipant, ListMessagesRequest, ListMessagesRequestListMessagesFilters, ListMessagesResponse, LookupConversationsRequest, LookupConversationsRequestLookupConversationsFilters, LookupConversationsResponse, LookupConversationsResponseConversations, Message, MessageStatus, MessageType, Metadata, MetadataDataEntry, MetadataIdentifier, PagedRequestOptions, PagedResponseMetadata, Participant, ParticipantKey, ParticipantMessageStatus, ParticipantType, PlatformLocation, ReceiveMessageRequest, ReceiveMessageRequestMetadataEntry, SearchConversationsRequest, SearchConversationsResponse, SearchConversationsResponseDetailedConversation, SendMessageRequest, SendMessageResponse, SetLastSeenRequest, SetLastSeenRequestStatus, SetLastSeenResponse, SubjectParticipant, UpdateMessageStatusRequest, UpsertConfigurationRequest, UpsertConfigurationResponse };
1980
2160
  //# sourceMappingURL=vendasta-conversation.mjs.map