@cimulate/copilot-sdk 1.1.2 → 1.2.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 (106) hide show
  1. package/README.md +15 -0
  2. package/dist/bundle.cimulate.copilot-sdk.099d19fa.umd.js +2 -0
  3. package/dist/bundle.cimulate.copilot-sdk.099d19fa.umd.js.map +1 -0
  4. package/dist/bundle.cimulate.copilot-sdk.5716b677.cjs.js +2 -0
  5. package/dist/bundle.cimulate.copilot-sdk.5716b677.cjs.js.map +1 -0
  6. package/dist/bundle.cimulate.copilot-sdk.64883fd2.esm.js +2 -0
  7. package/dist/bundle.cimulate.copilot-sdk.64883fd2.esm.js.map +1 -0
  8. package/dist/index.cjs.js +1 -1
  9. package/dist/index.cjs.js.map +1 -1
  10. package/dist/index.esm.js +1 -1
  11. package/dist/index.esm.js.map +1 -1
  12. package/dist/index.umd.js +1 -1
  13. package/dist/index.umd.js.map +1 -1
  14. package/dist/types/copilot.d.ts +17 -17
  15. package/dist/types/model/CommonFields.d.ts +0 -1
  16. package/dist/types/model/CommonMetadata.d.ts +7 -0
  17. package/dist/types/model/CommonRequiredFields.d.ts +0 -1
  18. package/dist/types/model/ConnectAck.d.ts +1 -1
  19. package/dist/types/model/{ConnectionAcknowledgmentMessageFields.d.ts → ConnectAckMessageFields.d.ts} +3 -2
  20. package/dist/types/model/CopilotEvent.d.ts +20 -0
  21. package/dist/types/model/CopilotSearch.d.ts +2 -2
  22. package/dist/types/model/CopilotSearchSuggestion.d.ts +7 -0
  23. package/dist/types/model/DisplayProducts.d.ts +4 -3
  24. package/dist/types/model/DisplayProductsMessageFields.d.ts +4 -2
  25. package/dist/types/model/Done.d.ts +1 -1
  26. package/dist/types/model/DoneMessageFields.d.ts +4 -0
  27. package/dist/types/model/Error.d.ts +1 -1
  28. package/dist/types/model/ErrorMessageFields.d.ts +1 -0
  29. package/dist/types/model/EventAck.d.ts +11 -5
  30. package/dist/types/model/EventAckMessageFields.d.ts +10 -0
  31. package/dist/types/model/EventAckNames.d.ts +6 -0
  32. package/dist/types/model/FacetedNavigation.d.ts +2 -2
  33. package/dist/types/model/FacetedNavigationSuggestion.d.ts +7 -0
  34. package/dist/types/model/FollowUp.d.ts +4 -3
  35. package/dist/types/model/FollowUpMessageFields.d.ts +7 -0
  36. package/dist/types/model/Inquiry.d.ts +1 -1
  37. package/dist/types/model/InquiryMessageFields.d.ts +4 -0
  38. package/dist/types/model/PartialInquiry.d.ts +1 -1
  39. package/dist/types/model/PartialInquiryMessageFields.d.ts +1 -0
  40. package/dist/types/model/RefinedSearch.d.ts +6 -5
  41. package/dist/types/model/RefinedSearchMessageFields.d.ts +6 -4
  42. package/dist/types/model/ReturnedFields.d.ts +2 -0
  43. package/dist/types/model/Root.d.ts +17 -9
  44. package/dist/types/model/SearchParams.d.ts +5 -0
  45. package/dist/types/model/SessionData.d.ts +5 -4
  46. package/dist/types/model/SessionEventStatusReply.d.ts +0 -1
  47. package/dist/types/model/SessionInformation.d.ts +3 -3
  48. package/dist/types/model/WorkflowMetadata.d.ts +5 -0
  49. package/dist/types/model/index.d.ts +14 -8
  50. package/package.json +6 -4
  51. package/rollup.config.js +1 -1
  52. package/src/copilot.ts +49 -25
  53. package/src/model/CommonFields.ts +0 -1
  54. package/src/model/CommonMetadata.ts +7 -0
  55. package/src/model/CommonRequiredFields.ts +0 -1
  56. package/src/model/ConnectAck.ts +1 -1
  57. package/src/model/{ConnectionAcknowledgmentMessageFields.ts → ConnectAckMessageFields.ts} +3 -2
  58. package/src/model/CopilotEvent.ts +20 -0
  59. package/src/model/CopilotSearch.ts +2 -2
  60. package/src/model/CopilotSearchSuggestion.ts +7 -0
  61. package/src/model/DisplayProducts.ts +4 -4
  62. package/src/model/DisplayProductsMessageFields.ts +4 -3
  63. package/src/model/Done.ts +1 -1
  64. package/src/model/DoneMessageFields.ts +5 -0
  65. package/src/model/Error.ts +1 -1
  66. package/src/model/ErrorMessageFields.ts +1 -0
  67. package/src/model/EventAck.ts +13 -5
  68. package/src/model/EventAckMessageFields.ts +10 -0
  69. package/src/model/EventAckNames.ts +7 -0
  70. package/src/model/FacetedNavigation.ts +2 -2
  71. package/src/model/FacetedNavigationSuggestion.ts +7 -0
  72. package/src/model/FollowUp.ts +4 -3
  73. package/src/model/FollowUpMessageFields.ts +7 -0
  74. package/src/model/Inquiry.ts +1 -1
  75. package/src/model/InquiryMessageFields.ts +5 -0
  76. package/src/model/PartialInquiry.ts +1 -1
  77. package/src/model/PartialInquiryMessageFields.ts +1 -0
  78. package/src/model/RefinedSearch.ts +6 -5
  79. package/src/model/RefinedSearchMessageFields.ts +6 -4
  80. package/src/model/ReturnedFields.ts +4 -0
  81. package/src/model/Root.ts +17 -9
  82. package/src/model/SearchParams.ts +6 -0
  83. package/src/model/SessionData.ts +5 -4
  84. package/src/model/SessionEventStatusReply.ts +0 -1
  85. package/src/model/SessionInformation.ts +3 -3
  86. package/src/model/WorkflowMetadata.ts +6 -0
  87. package/src/model/index.ts +14 -8
  88. package/tsconfig.json +2 -1
  89. package/dist/bundle.cimulate.copilot-sdk.2115a6a5.esm.js +0 -2
  90. package/dist/bundle.cimulate.copilot-sdk.2115a6a5.esm.js.map +0 -1
  91. package/dist/bundle.cimulate.copilot-sdk.4bdff942.cjs.js +0 -2
  92. package/dist/bundle.cimulate.copilot-sdk.4bdff942.cjs.js.map +0 -1
  93. package/dist/bundle.cimulate.copilot-sdk.83e04b89.umd.js +0 -2
  94. package/dist/bundle.cimulate.copilot-sdk.83e04b89.umd.js.map +0 -1
  95. package/dist/types/model/EventAcknowledgmentMessageFields.d.ts +0 -6
  96. package/dist/types/model/FollowMinusUpMessageFields.d.ts +0 -5
  97. package/dist/types/model/ReservedEvent.d.ts +0 -10
  98. package/dist/types/model/SearchParameters.d.ts +0 -5
  99. package/dist/types/model/SessionEventInformationReply.d.ts +0 -5
  100. package/dist/types/model/Suggestion.d.ts +0 -6
  101. package/src/model/EventAcknowledgmentMessageFields.ts +0 -6
  102. package/src/model/FollowMinusUpMessageFields.ts +0 -5
  103. package/src/model/ReservedEvent.ts +0 -11
  104. package/src/model/SearchParameters.ts +0 -6
  105. package/src/model/SessionEventInformationReply.ts +0 -6
  106. package/src/model/Suggestion.ts +0 -7
@@ -1,6 +1,6 @@
1
- import {SearchParameters} from './SearchParameters';
1
+ import {SearchParams} from './SearchParams';
2
2
  interface CopilotSearch {
3
- search_params: SearchParameters;
3
+ search_params: SearchParams;
4
4
  user_prompt?: string;
5
5
  }
6
6
  export { CopilotSearch };
@@ -0,0 +1,7 @@
1
+ import {CopilotSearch} from './CopilotSearch';
2
+ interface CopilotSearchSuggestion {
3
+ display_text: string;
4
+ action: 'copilot_search';
5
+ params: CopilotSearch;
6
+ }
7
+ export { CopilotSearchSuggestion };
@@ -1,11 +1,11 @@
1
-
2
- interface DisplayProducts {
1
+ import type {ReturnedFields} from './ReturnedFields';
2
+ interface DisplayProducts<T extends object = ReturnedFields> {
3
3
  session_id: string;
4
4
  event_id: string;
5
- event_name: string;
6
5
  timestamp: string;
7
6
  event_source_id: string;
8
7
  message: string;
9
- products: Map<string, any>[];
8
+ event_name: 'display_products';
9
+ products: T[];
10
10
  }
11
11
  export { DisplayProducts };
@@ -1,5 +1,6 @@
1
-
2
- interface DisplayProductsMessageFields {
3
- products: Map<string, any>[];
1
+ import type {ReturnedFields} from './ReturnedFields';
2
+ interface DisplayProductsMessageFields<T extends object = ReturnedFields> {
3
+ event_name: 'display_products';
4
+ products: T[];
4
5
  }
5
6
  export { DisplayProductsMessageFields };
package/src/model/Done.ts CHANGED
@@ -2,9 +2,9 @@
2
2
  interface Done {
3
3
  session_id: string;
4
4
  event_id: string;
5
- event_name: string;
6
5
  timestamp: string;
7
6
  event_source_id: string;
8
7
  message: string;
8
+ event_name: 'done';
9
9
  }
10
10
  export { Done };
@@ -0,0 +1,5 @@
1
+
2
+ interface DoneMessageFields {
3
+ event_name: 'done';
4
+ }
5
+ export { DoneMessageFields };
@@ -2,11 +2,11 @@
2
2
  interface Error {
3
3
  session_id: string;
4
4
  event_id: string;
5
- event_name: string;
6
5
  timestamp: string;
7
6
  event_source_id: string;
8
7
  message: string;
9
8
  status: number;
10
9
  error: string;
10
+ event_name: 'error';
11
11
  }
12
12
  export { Error };
@@ -2,5 +2,6 @@
2
2
  interface ErrorMessageFields {
3
3
  status: number;
4
4
  error: string;
5
+ event_name: 'error';
5
6
  }
6
7
  export { ErrorMessageFields };
@@ -1,12 +1,20 @@
1
1
  import {CopilotSearch} from './CopilotSearch';
2
- interface EventAck {
2
+ import {FacetedNavigation} from './FacetedNavigation';
3
+ import {Cancel} from './Cancel';
4
+ import {EventAckNames} from './EventAckNames';
5
+
6
+ type EventRequestMap = {
7
+ copilot_search_ack: CopilotSearch;
8
+ faceted_navigation_ack: FacetedNavigation;
9
+ cancel_ack: Cancel;
10
+ }
11
+
12
+ interface EventAck<T extends EventAckNames = EventAckNames> {
3
13
  session_id: string;
4
14
  event_id: string;
5
- event_name: string;
6
15
  timestamp: string;
7
- event_source_id: string;
8
- message: string;
9
16
  status: string;
10
- request: CopilotSearch;
17
+ request: EventRequestMap[T];
18
+ event_name: T;
11
19
  }
12
20
  export { EventAck };
@@ -0,0 +1,10 @@
1
+ import {CopilotSearch} from './CopilotSearch';
2
+ import {FacetedNavigation} from './FacetedNavigation';
3
+ import {Cancel} from './Cancel';
4
+ import {EventAckNames} from './EventAckNames';
5
+ interface EventAckMessageFields {
6
+ status: string;
7
+ request: CopilotSearch | FacetedNavigation | Cancel;
8
+ event_name: EventAckNames;
9
+ }
10
+ export { EventAckMessageFields };
@@ -0,0 +1,7 @@
1
+
2
+ enum EventAckNames {
3
+ COPILOT_SEARCH_ACK = "copilot_search_ack",
4
+ FACETED_NAVIGATION_ACK = "faceted_navigation_ack",
5
+ CANCEL_ACK = "cancel_ack",
6
+ }
7
+ export { EventAckNames };
@@ -1,5 +1,5 @@
1
- import {SearchParameters} from './SearchParameters';
1
+ import {SearchParams} from './SearchParams';
2
2
  interface FacetedNavigation {
3
- search_params: SearchParameters;
3
+ search_params: SearchParams;
4
4
  }
5
5
  export { FacetedNavigation };
@@ -0,0 +1,7 @@
1
+ import {FacetedNavigation} from './FacetedNavigation';
2
+ interface FacetedNavigationSuggestion {
3
+ display_text: string;
4
+ action: 'faceted_navigation';
5
+ params: FacetedNavigation;
6
+ }
7
+ export { FacetedNavigationSuggestion };
@@ -1,11 +1,12 @@
1
- import {Suggestion} from './Suggestion';
1
+ import {CopilotSearchSuggestion} from './CopilotSearchSuggestion';
2
+ import {FacetedNavigationSuggestion} from './FacetedNavigationSuggestion';
2
3
  interface FollowUp {
3
4
  session_id: string;
4
5
  event_id: string;
5
- event_name: string;
6
6
  timestamp: string;
7
7
  event_source_id: string;
8
8
  message: string;
9
- suggestions: Suggestion[];
9
+ suggestions: (CopilotSearchSuggestion | FacetedNavigationSuggestion)[];
10
+ event_name: 'follow_up';
10
11
  }
11
12
  export { FollowUp };
@@ -0,0 +1,7 @@
1
+ import {CopilotSearchSuggestion} from './CopilotSearchSuggestion';
2
+ import {FacetedNavigationSuggestion} from './FacetedNavigationSuggestion';
3
+ interface FollowUpMessageFields {
4
+ suggestions: (CopilotSearchSuggestion | FacetedNavigationSuggestion)[];
5
+ event_name: 'follow_up';
6
+ }
7
+ export { FollowUpMessageFields };
@@ -2,9 +2,9 @@
2
2
  interface Inquiry {
3
3
  session_id: string;
4
4
  event_id: string;
5
- event_name: string;
6
5
  timestamp: string;
7
6
  event_source_id: string;
8
7
  message: string;
8
+ event_name: 'inquiry';
9
9
  }
10
10
  export { Inquiry };
@@ -0,0 +1,5 @@
1
+
2
+ interface InquiryMessageFields {
3
+ event_name: 'inquiry';
4
+ }
5
+ export { InquiryMessageFields };
@@ -2,11 +2,11 @@
2
2
  interface PartialInquiry {
3
3
  session_id: string;
4
4
  event_id: string;
5
- event_name: string;
6
5
  timestamp: string;
7
6
  event_source_id: string;
8
7
  message: string;
9
8
  inquiry_event_id: string;
10
9
  index: number;
10
+ event_name: 'partial_inquiry';
11
11
  }
12
12
  export { PartialInquiry };
@@ -2,5 +2,6 @@
2
2
  interface PartialInquiryMessageFields {
3
3
  inquiry_event_id: string;
4
4
  index: number;
5
+ event_name: 'partial_inquiry';
5
6
  }
6
7
  export { PartialInquiryMessageFields };
@@ -1,14 +1,15 @@
1
- import {SearchParameters} from './SearchParameters';
1
+ import {SearchParams} from './SearchParams';
2
2
  import {Facet} from './Facet';
3
- interface RefinedSearch {
3
+ import type {ReturnedFields} from './ReturnedFields';
4
+ interface RefinedSearch<T extends object = ReturnedFields> {
4
5
  session_id: string;
5
6
  event_id: string;
6
- event_name: string;
7
7
  timestamp: string;
8
8
  event_source_id: string;
9
9
  message: string;
10
- search_params: SearchParameters;
11
- hits?: Map<string, any>[];
10
+ event_name: 'refined_search';
11
+ search_params: SearchParams;
12
+ hits?: T[];
12
13
  total_hits?: number;
13
14
  facets?: Facet[];
14
15
  }
@@ -1,8 +1,10 @@
1
- import {SearchParameters} from './SearchParameters';
1
+ import {SearchParams} from './SearchParams';
2
2
  import {Facet} from './Facet';
3
- interface RefinedSearchMessageFields {
4
- search_params: SearchParameters;
5
- hits?: Map<string, any>[];
3
+ import type {ReturnedFields} from './ReturnedFields';
4
+ interface RefinedSearchMessageFields<T extends object = ReturnedFields> {
5
+ event_name: 'refined_search';
6
+ search_params: SearchParams;
7
+ hits?: T[];
6
8
  total_hits?: number;
7
9
  facets?: Facet[];
8
10
  }
@@ -0,0 +1,4 @@
1
+ // This is added manually
2
+ type ReturnedFields<T = unknown> = Record<string, T>;
3
+
4
+ export type { ReturnedFields };
package/src/model/Root.ts CHANGED
@@ -1,54 +1,62 @@
1
1
  import {CommonRequiredFields} from './CommonRequiredFields';
2
2
  import {CommonFields} from './CommonFields';
3
+ import {CommonMetadata} from './CommonMetadata';
3
4
  import {ConnectAckMetadata} from './ConnectAckMetadata';
4
5
  import {ConnectAck} from './ConnectAck';
5
- import {SearchParameters} from './SearchParameters';
6
+ import {SearchParams} from './SearchParams';
6
7
  import {FacetValue} from './FacetValue';
7
8
  import {Facet} from './Facet';
8
9
  import {CopilotSearch} from './CopilotSearch';
9
10
  import {FacetedNavigation} from './FacetedNavigation';
11
+ import {EventAckNames} from './EventAckNames';
10
12
  import {EventAck} from './EventAck';
11
13
  import {RefinedSearch} from './RefinedSearch';
12
14
  import {DisplayProducts} from './DisplayProducts';
13
- import {Suggestion} from './Suggestion';
15
+ import {CopilotSearchSuggestion} from './CopilotSearchSuggestion';
16
+ import {FacetedNavigationSuggestion} from './FacetedNavigationSuggestion';
14
17
  import {FollowUp} from './FollowUp';
15
18
  import {PartialInquiry} from './PartialInquiry';
16
19
  import {Inquiry} from './Inquiry';
17
20
  import {Done} from './Done';
18
21
  import {Error} from './Error';
19
- import {ReservedEvent} from './ReservedEvent';
22
+ import {CopilotEvent} from './CopilotEvent';
20
23
  import {SessionData} from './SessionData';
21
24
  import {SessionInformation} from './SessionInformation';
22
- import {SessionEventInformationReply} from './SessionEventInformationReply';
23
25
  import {SessionEventStatusReply} from './SessionEventStatusReply';
24
26
  import {Cancel} from './Cancel';
27
+ import type {ReturnedFields} from './ReturnedFields';
25
28
  interface Root {
26
29
  common_fields?: CommonRequiredFields;
27
30
  common_event_fields?: CommonFields;
31
+ common_metadata?: CommonMetadata;
28
32
  connect_ack_metadata?: ConnectAckMetadata;
29
33
  connect_ack?: ConnectAck;
30
- search_params?: SearchParameters;
34
+ search_params?: SearchParams;
31
35
  facet_value?: FacetValue;
32
36
  facets?: Facet[];
33
37
  copilot_search?: CopilotSearch;
34
38
  faceted_navigation?: FacetedNavigation;
39
+ event_ack_names?: EventAckNames;
35
40
  event_ack?: EventAck;
36
41
  refined_search?: RefinedSearch;
37
42
  display_products?: DisplayProducts;
38
- suggestions?: Suggestion[];
43
+ copilot_search_suggestion?: CopilotSearchSuggestion;
44
+ faceted_navigation_suggestion?: FacetedNavigationSuggestion;
45
+ suggestions?: (CopilotSearchSuggestion | FacetedNavigationSuggestion)[];
39
46
  follow_up?: FollowUp;
40
47
  partial_inquiry?: PartialInquiry;
41
48
  inquiry?: Inquiry;
42
49
  done?: Done;
43
50
  error?: Error;
44
- event?: ReservedEvent;
51
+ event?: CopilotEvent;
45
52
  session_data?: SessionData;
46
53
  session_info_reply?: SessionInformation;
47
- session_events_reply?: Map<string, any>[];
54
+ session_events_reply?: CopilotEvent[];
48
55
  session_event_info?: string;
49
- session_event_info_reply?: SessionEventInformationReply;
56
+ session_event_info_reply?: ConnectAck | EventAck | FollowUp | Inquiry | DisplayProducts | RefinedSearch | Done | Error;
50
57
  session_event_status?: string;
51
58
  session_event_status_reply?: SessionEventStatusReply;
52
59
  cancel?: Cancel;
60
+ return_fields?: ReturnedFields;
53
61
  }
54
62
  export { Root };
@@ -0,0 +1,6 @@
1
+
2
+ interface SearchParams {
3
+ query: string;
4
+ facet_filters?: Record<string, string[]>;
5
+ }
6
+ export { SearchParams };
@@ -1,6 +1,7 @@
1
- import {ReservedEvent} from './ReservedEvent';
2
- interface SessionData {
3
- events?: Map<string, ReservedEvent>;
4
- event_source_map?: Map<string, string[]>;
1
+ import {CopilotEvent} from './CopilotEvent';
2
+ import type { RefinedSearch } from './RefinedSearch';
3
+ interface SessionData<T extends object = RefinedSearch> {
4
+ events?: Record<string, CopilotEvent<T>>;
5
+ event_source_map?: Record<string, string[]>;
5
6
  }
6
7
  export { SessionData };
@@ -1,6 +1,5 @@
1
1
 
2
2
  interface SessionEventStatusReply {
3
3
  status?: string;
4
- additionalProperties?: Map<string, any>;
5
4
  }
6
5
  export { SessionEventStatusReply };
@@ -1,10 +1,10 @@
1
1
  import {SessionData} from './SessionData';
2
- interface SessionInformation {
2
+ import type { RefinedSearch } from './RefinedSearch';
3
+ interface SessionInformation<T extends object = RefinedSearch> {
3
4
  session_id?: string;
4
5
  created_at?: string;
5
6
  last_active_at?: string;
6
7
  status?: string;
7
- data?: SessionData;
8
- metadata?: Map<string, any>;
8
+ data?: SessionData<T>;
9
9
  }
10
10
  export { SessionInformation };
@@ -0,0 +1,6 @@
1
+
2
+ interface WorkflowMetadata {
3
+ session_id?: string;
4
+ task_id?: string;
5
+ }
6
+ export { WorkflowMetadata };
@@ -2,32 +2,38 @@ export * from './Root';
2
2
  export * from './CommonRequiredFields';
3
3
  export * from './CommonFields';
4
4
  export * from './CommonEventFields';
5
+ export * from './CommonMetadata';
6
+ export * from './WorkflowMetadata';
5
7
  export * from './ConnectAckMetadata';
6
8
  export * from './ConnectAck';
7
- export * from './ConnectionAcknowledgmentMessageFields';
8
- export * from './SearchParameters';
9
+ export * from './ConnectAckMessageFields';
10
+ export * from './SearchParams';
9
11
  export * from './FacetValue';
10
12
  export * from './Facet';
11
13
  export * from './CopilotSearch';
12
14
  export * from './FacetedNavigation';
15
+ export * from './EventAckNames';
13
16
  export * from './EventAck';
14
- export * from './EventAcknowledgmentMessageFields';
17
+ export * from './Cancel';
18
+ export * from './EventAckMessageFields';
15
19
  export * from './RefinedSearch';
16
20
  export * from './RefinedSearchMessageFields';
17
21
  export * from './DisplayProducts';
18
22
  export * from './DisplayProductsMessageFields';
19
- export * from './Suggestion';
23
+ export * from './CopilotSearchSuggestion';
24
+ export * from './FacetedNavigationSuggestion';
20
25
  export * from './FollowUp';
21
- export * from './FollowMinusUpMessageFields';
26
+ export * from './FollowUpMessageFields';
22
27
  export * from './PartialInquiry';
23
28
  export * from './PartialInquiryMessageFields';
24
29
  export * from './Inquiry';
30
+ export * from './InquiryMessageFields';
25
31
  export * from './Done';
32
+ export * from './DoneMessageFields';
26
33
  export * from './Error';
27
34
  export * from './ErrorMessageFields';
28
- export * from './ReservedEvent';
35
+ export * from './CopilotEvent';
29
36
  export * from './SessionData';
30
37
  export * from './SessionInformation';
31
- export * from './SessionEventInformationReply';
32
38
  export * from './SessionEventStatusReply';
33
- export * from './Cancel';
39
+ export * from './ReturnedFields';
package/tsconfig.json CHANGED
@@ -12,7 +12,8 @@
12
12
  "pretty": true,
13
13
  "noFallthroughCasesInSwitch": true,
14
14
  "noImplicitReturns": true,
15
- "forceConsistentCasingInFileNames": true
15
+ "forceConsistentCasingInFileNames": true,
16
+ "allowSyntheticDefaultImports": true
16
17
  },
17
18
  "include": ["src"]
18
19
  }
@@ -1,2 +0,0 @@
1
- import t from"socket.io-client";const e=t=>{if("object"==typeof t&&null!==t){if("function"==typeof Object.getPrototypeOf){const e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}return"[object Object]"===Object.prototype.toString.call(t)}return!1},o=(...t)=>t.reduce(((t,s)=>{if(Array.isArray(s))throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");return Object.keys(s).forEach((n=>{["__proto__","constructor","prototype"].includes(n)||(Array.isArray(t[n])&&Array.isArray(s[n])?t[n]=o.options.mergeArrays?o.options.uniqueArrayItems?Array.from(new Set(t[n].concat(s[n]))):[...t[n],...s[n]]:s[n]:e(t[n])&&e(s[n])?t[n]=o(t[n],s[n]):t[n]=void 0===s[n]?o.options.allowUndefinedOverrides?s[n]:t[n]:s[n])})),t}),{}),s={allowUndefinedOverrides:!0,mergeArrays:!0,uniqueArrayItems:!0};o.options=s,o.withOptions=(t,...e)=>{o.options=Object.assign(Object.assign({},s),t);const n=o(...e);return o.options=s,n};const n={path:"/api/v1/socket.io",autoConnect:!1,transports:["polling","websocket"],upgrade:!0,timeout:1e4};class r{constructor({apiKey:e,baseUrl:s,namespace:r="/copilot",socketOptions:c={}}){const i=`${s}${r}`;this.socket=t(i,o(n,c,{withCredentials:!0,transportOptions:{polling:{extraHeaders:{"x-cimulate-api-key":e}}}}))}connect(){this.socket.connect()}search({userPrompt:t,searchParams:e},o){const s={user_prompt:t,search_params:e};o?this.socket.emit("copilot_search",s,o):this.socket.emit("copilot_search",s)}facetedNavigation({searchParams:t},e){const o={search_params:t};e?this.socket.emit("faceted_navigation",o,e):this.socket.emit("faceted_navigation",o)}cancelRequest({eventId:t,reason:e},o){const s={event_id:t,reason:e};o?this.socket.emit("cancel",s,o):this.socket.emit("cancel",s)}requestSessionInformation(t){this.socket.emit("session_info",t)}onConnectAck(t){this.socket.on("connect_ack",t)}onSearchAck(t){this.socket.on("search_ack",t)}onRefinedSearch(t){this.socket.on("refined_search",t)}onFollowUp(t){this.socket.on("follow_up",t)}onInquiry(t){this.socket.on("inquiry",t)}onPartialInquiry(t){this.socket.on("partial_inquiry",t)}onDisplayProducts(t){this.socket.on("display_products",t)}onDone(t){this.socket.on("done",t)}onError(t){this.socket.on("error",t)}disconnect(){this.socket.disconnect()}onDisconnect(t){this.socket.on("disconnect",t)}}export{r as CimulateCopilot};
2
- //# sourceMappingURL=bundle.cimulate.copilot-sdk.2115a6a5.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bundle.cimulate.copilot-sdk.2115a6a5.esm.js","sources":["../node_modules/ts-deepmerge/esm/index.js","../src/copilot.ts"],"sourcesContent":["// istanbul ignore next\nconst isObject = (obj) => {\n if (typeof obj === \"object\" && obj !== null) {\n if (typeof Object.getPrototypeOf === \"function\") {\n const prototype = Object.getPrototypeOf(obj);\n return prototype === Object.prototype || prototype === null;\n }\n return Object.prototype.toString.call(obj) === \"[object Object]\";\n }\n return false;\n};\nexport const merge = (...objects) => objects.reduce((result, current) => {\n if (Array.isArray(current)) {\n throw new TypeError(\"Arguments provided to ts-deepmerge must be objects, not arrays.\");\n }\n Object.keys(current).forEach((key) => {\n if ([\"__proto__\", \"constructor\", \"prototype\"].includes(key)) {\n return;\n }\n if (Array.isArray(result[key]) && Array.isArray(current[key])) {\n result[key] = merge.options.mergeArrays\n ? merge.options.uniqueArrayItems\n ? Array.from(new Set(result[key].concat(current[key])))\n : [...result[key], ...current[key]]\n : current[key];\n }\n else if (isObject(result[key]) && isObject(current[key])) {\n result[key] = merge(result[key], current[key]);\n }\n else {\n result[key] =\n current[key] === undefined\n ? merge.options.allowUndefinedOverrides\n ? current[key]\n : result[key]\n : current[key];\n }\n });\n return result;\n}, {});\nconst defaultOptions = {\n allowUndefinedOverrides: true,\n mergeArrays: true,\n uniqueArrayItems: true,\n};\nmerge.options = defaultOptions;\nmerge.withOptions = (options, ...objects) => {\n merge.options = Object.assign(Object.assign({}, defaultOptions), options);\n const result = merge(...objects);\n merge.options = defaultOptions;\n return result;\n};\n",null],"names":["isObject","obj","Object","getPrototypeOf","prototype","toString","call","merge","objects","reduce","result","current","Array","isArray","TypeError","keys","forEach","key","includes","options","mergeArrays","uniqueArrayItems","from","Set","concat","undefined","allowUndefinedOverrides","defaultOptions","withOptions","assign","socketDefaults","path","autoConnect","transports","upgrade","timeout","CimulateCopilot","constructor","apiKey","baseUrl","namespace","socketOptions","socketioEndpoint","this","socket","io","withCredentials","transportOptions","polling","extraHeaders","connect","search","userPrompt","searchParams","callback","payload","user_prompt","search_params","emit","facetedNavigation","cancelRequest","eventId","reason","event_id","requestSessionInformation","onConnectAck","on","onSearchAck","onRefinedSearch","onFollowUp","onInquiry","onPartialInquiry","onDisplayProducts","onDone","onError","disconnect","onDisconnect"],"mappings":"gCACA,MAAMA,EAAYC,IACd,GAAmB,iBAARA,GAA4B,OAARA,EAAc,CACzC,GAAqC,mBAA1BC,OAAOC,eAA+B,CAC7C,MAAMC,EAAYF,OAAOC,eAAeF,GACxC,OAAOG,IAAcF,OAAOE,WAA2B,OAAdA,CAC5C,CACD,MAA+C,oBAAxCF,OAAOE,UAAUC,SAASC,KAAKL,EACzC,CACD,OAAO,CAAK,EAEHM,EAAQ,IAAIC,IAAYA,EAAQC,QAAO,CAACC,EAAQC,KACzD,GAAIC,MAAMC,QAAQF,GACd,MAAM,IAAIG,UAAU,mEAyBxB,OAvBAZ,OAAOa,KAAKJ,GAASK,SAASC,IACtB,CAAC,YAAa,cAAe,aAAaC,SAASD,KAGnDL,MAAMC,QAAQH,EAAOO,KAASL,MAAMC,QAAQF,EAAQM,IACpDP,EAAOO,GAAOV,EAAMY,QAAQC,YACtBb,EAAMY,QAAQE,iBACVT,MAAMU,KAAK,IAAIC,IAAIb,EAAOO,GAAKO,OAAOb,EAAQM,MAC9C,IAAIP,EAAOO,MAASN,EAAQM,I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K,qBAAsBH,EACxC,CAED,aAAAK,EACEC,QAAEA,EAAOC,OAAEA,GACXR,GAEA,MAAMC,EAAU,CACdQ,SAAUF,EACVC,UAEER,EACFX,KAAKC,OAAOc,KAAK,SAAUH,EAASD,GAGtCX,KAAKC,OAAOc,KAAK,SAAUH,EAC5B,CAED,yBAAAS,CAA0BV,GACxBX,KAAKC,OAAOc,KAAK,eAAgBJ,EAClC,CAED,YAAAW,CAAaX,GACXX,KAAKC,OAAOsB,GAAG,cAAeZ,EAC/B,CAED,WAAAa,CAAYb,GACVX,KAAKC,OAAOsB,GAAG,aAAcZ,EAC9B,CAED,eAAAc,CAAgBd,GACdX,KAAKC,OAAOsB,GAAG,iBAAkBZ,EAClC,CAED,UAAAe,CAAWf,GACTX,KAAKC,OAAOsB,GAAG,YAAaZ,EAC7B,CAED,SAAAgB,CAAUhB,GACRX,KAAKC,OAAOsB,GAAG,UAAWZ,EAC3B,CAED,gBAAAiB,CAAiBjB,GACfX,KAAKC,OAAOsB,GAAG,kBAAmBZ,EACnC,CAED,iBAAAkB,CAAkBlB,GAChBX,KAAKC,OAAOsB,GAAG,mBAAoBZ,EACpC,CAED,MAAAmB,CAAOnB,GACLX,KAAKC,OAAOsB,GAAG,OAAQZ,EACxB,CAED,OAAAoB,CAAQpB,GACNX,KAAKC,OAAOsB,GAAG,QAASZ,EACzB,CAED,UAAAqB,GACEhC,KAAKC,OAAO+B,YACb,CAED,YAAAC,CAAatB,GACXX,KAAKC,OAAOsB,GAAG,aAAcZ,EAC9B"}
@@ -1,2 +0,0 @@
1
- "use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}Object.defineProperty(exports,"__esModule",{value:!0});var e=t(require("socket.io-client"));const o=t=>{if("object"==typeof t&&null!==t){if("function"==typeof Object.getPrototypeOf){const e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}return"[object Object]"===Object.prototype.toString.call(t)}return!1},s=(...t)=>t.reduce(((t,e)=>{if(Array.isArray(e))throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");return Object.keys(e).forEach((n=>{["__proto__","constructor","prototype"].includes(n)||(Array.isArray(t[n])&&Array.isArray(e[n])?t[n]=s.options.mergeArrays?s.options.uniqueArrayItems?Array.from(new Set(t[n].concat(e[n]))):[...t[n],...e[n]]:e[n]:o(t[n])&&o(e[n])?t[n]=s(t[n],e[n]):t[n]=void 0===e[n]?s.options.allowUndefinedOverrides?e[n]:t[n]:e[n])})),t}),{}),n={allowUndefinedOverrides:!0,mergeArrays:!0,uniqueArrayItems:!0};s.options=n,s.withOptions=(t,...e)=>{s.options=Object.assign(Object.assign({},n),t);const o=s(...e);return s.options=n,o};const r={path:"/api/v1/socket.io",autoConnect:!1,transports:["polling","websocket"],upgrade:!0,timeout:1e4};exports.CimulateCopilot=class{constructor({apiKey:t,baseUrl:o,namespace:n="/copilot",socketOptions:c={}}){const i=`${o}${n}`;this.socket=e.default(i,s(r,c,{withCredentials:!0,transportOptions:{polling:{extraHeaders:{"x-cimulate-api-key":t}}}}))}connect(){this.socket.connect()}search({userPrompt:t,searchParams:e},o){const s={user_prompt:t,search_params:e};o?this.socket.emit("copilot_search",s,o):this.socket.emit("copilot_search",s)}facetedNavigation({searchParams:t},e){const o={search_params:t};e?this.socket.emit("faceted_navigation",o,e):this.socket.emit("faceted_navigation",o)}cancelRequest({eventId:t,reason:e},o){const s={event_id:t,reason:e};o?this.socket.emit("cancel",s,o):this.socket.emit("cancel",s)}requestSessionInformation(t){this.socket.emit("session_info",t)}onConnectAck(t){this.socket.on("connect_ack",t)}onSearchAck(t){this.socket.on("search_ack",t)}onRefinedSearch(t){this.socket.on("refined_search",t)}onFollowUp(t){this.socket.on("follow_up",t)}onInquiry(t){this.socket.on("inquiry",t)}onPartialInquiry(t){this.socket.on("partial_inquiry",t)}onDisplayProducts(t){this.socket.on("display_products",t)}onDone(t){this.socket.on("done",t)}onError(t){this.socket.on("error",t)}disconnect(){this.socket.disconnect()}onDisconnect(t){this.socket.on("disconnect",t)}};
2
- //# sourceMappingURL=bundle.cimulate.copilot-sdk.4bdff942.cjs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bundle.cimulate.copilot-sdk.4bdff942.cjs.js","sources":["../node_modules/ts-deepmerge/esm/index.js","../src/copilot.ts"],"sourcesContent":["// istanbul ignore next\nconst isObject = (obj) => {\n if (typeof obj === \"object\" && obj !== null) {\n if (typeof Object.getPrototypeOf === \"function\") {\n const prototype = Object.getPrototypeOf(obj);\n return prototype === Object.prototype || prototype === null;\n }\n return Object.prototype.toString.call(obj) === \"[object Object]\";\n }\n return false;\n};\nexport const merge = (...objects) => objects.reduce((result, current) => {\n if (Array.isArray(current)) {\n throw new TypeError(\"Arguments provided to ts-deepmerge must be objects, not arrays.\");\n }\n Object.keys(current).forEach((key) => {\n if ([\"__proto__\", \"constructor\", \"prototype\"].includes(key)) {\n return;\n }\n if (Array.isArray(result[key]) && Array.isArray(current[key])) {\n result[key] = merge.options.mergeArrays\n ? merge.options.uniqueArrayItems\n ? Array.from(new Set(result[key].concat(current[key])))\n : [...result[key], ...current[key]]\n : current[key];\n }\n else if (isObject(result[key]) && isObject(current[key])) {\n result[key] = merge(result[key], current[key]);\n }\n else {\n result[key] =\n current[key] === undefined\n ? merge.options.allowUndefinedOverrides\n ? current[key]\n : result[key]\n : current[key];\n }\n });\n return result;\n}, {});\nconst defaultOptions = {\n allowUndefinedOverrides: true,\n mergeArrays: true,\n uniqueArrayItems: true,\n};\nmerge.options = defaultOptions;\nmerge.withOptions = (options, ...objects) => {\n merge.options = Object.assign(Object.assign({}, defaultOptions), options);\n const result = merge(...objects);\n merge.options = defaultOptions;\n return result;\n};\n",null],"names":["isObject","obj","Object","getPrototypeOf","prototype","toString","call","merge","objects","reduce","result","current","Array","isArray","TypeError","keys","forEach","key","includes","options","mergeArrays","uniqueArrayItems","from","Set","concat","undefined","allowUndefinedOverrides","defaultOptions","withOptions","assign","socketDefaults","path","autoConnect","transports","upgrade","timeout","constructor","apiKey","baseUrl","namespace","socketOptions","socketioEndpoint","this","socket","io","withCredentials","transportOptions","polling","extraHeaders","connect","search","userPrompt","searchParams","callback","payload","user_prompt","search_params","emit","facetedNavigation","cancelRequest","eventId","reason","event_id","requestSessionInformation","onConnectAck","on","onSearchAck","onRefinedSearch","onFollowUp","onInquiry","onPartialInquiry","onDisplayProducts","onDone","onError","disconnect","onDisconnect"],"mappings":"iLACA,MAAMA,EAAYC,IACd,GAAmB,iBAARA,GAA4B,OAARA,EAAc,CACzC,GAAqC,mBAA1BC,OAAOC,eAA+B,CAC7C,MAAMC,EAAYF,OAAOC,eAAeF,GACxC,OAAOG,IAAcF,OAAOE,WAA2B,OAAdA,CAC5C,CACD,MAA+C,oBAAxCF,OAAOE,UAAUC,SAASC,KAAKL,EACzC,CACD,OAAO,CAAK,EAEHM,EAAQ,IAAIC,IAAYA,EAAQC,QAAO,CAACC,EAAQC,KACzD,GAAIC,MAAMC,QAAQF,GACd,MAAM,IAAIG,UAAU,mEAyBxB,OAvBAZ,OAAOa,KAAKJ,GAASK,SAASC,IACtB,CAAC,YAAa,cAAe,aAAaC,SAASD,KAGnDL,MAAMC,QAAQH,EAAOO,KAASL,MAAMC,QAAQF,EAAQM,IACpDP,EAAOO,GAAOV,EAAMY,QAAQC,YACtBb,EAAMY,QAAQE,iBACVT,MAAMU,KAAK,IAAIC,IAAIb,EAAOO,GAAKO,OAAOb,EAAQM,MAC9C,IAAIP,EAAOO,MAASN,EAAQM,IAChCN,EAAQM,GAETjB,EAASU,EAAOO,KAASjB,EAASW,EAAQM,IAC/CP,EAAOO,GAAOV,EAAMG,EAAOO,GAAMN,EAAQM,IAGzCP,EAAOO,QACcQ,IAAjBd,EAAQM,GACFV,EAAMY,QAAQO,wBACVf,EAAQM,GACRP,EAAOO,GACXN,EAAQM,GACrB,IAEEP,CAAM,GACd,CAAE,GACCiB,EAAiB,CACnBD,yBAAyB,EACzBN,aAAa,EACbC,kBAAkB,GAEtBd,EAAMY,QAAUQ,EAChBpB,E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Aa,CAAYb,GACVX,KAAKC,OAAOsB,GAAG,aAAcZ,EAC9B,CAED,eAAAc,CAAgBd,GACdX,KAAKC,OAAOsB,GAAG,iBAAkBZ,EAClC,CAED,UAAAe,CAAWf,GACTX,KAAKC,OAAOsB,GAAG,YAAaZ,EAC7B,CAED,SAAAgB,CAAUhB,GACRX,KAAKC,OAAOsB,GAAG,UAAWZ,EAC3B,CAED,gBAAAiB,CAAiBjB,GACfX,KAAKC,OAAOsB,GAAG,kBAAmBZ,EACnC,CAED,iBAAAkB,CAAkBlB,GAChBX,KAAKC,OAAOsB,GAAG,mBAAoBZ,EACpC,CAED,MAAAmB,CAAOnB,GACLX,KAAKC,OAAOsB,GAAG,OAAQZ,EACxB,CAED,OAAAoB,CAAQpB,GACNX,KAAKC,OAAOsB,GAAG,QAASZ,EACzB,CAED,UAAAqB,GACEhC,KAAKC,OAAO+B,YACb,CAED,YAAAC,CAAatB,GACXX,KAAKC,OAAOsB,GAAG,aAAcZ,EAC9B"}
@@ -1,2 +0,0 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("socket.io-client")):"function"==typeof define&&define.amd?define(["exports","socket.io-client"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).CimulateCopilot={},e.io)}(this,(function(e,t){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=o(t);const n=e=>{if("object"==typeof e&&null!==e){if("function"==typeof Object.getPrototypeOf){const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}return"[object Object]"===Object.prototype.toString.call(e)}return!1},i=(...e)=>e.reduce(((e,t)=>{if(Array.isArray(t))throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");return Object.keys(t).forEach((o=>{["__proto__","constructor","prototype"].includes(o)||(Array.isArray(e[o])&&Array.isArray(t[o])?e[o]=i.options.mergeArrays?i.options.uniqueArrayItems?Array.from(new Set(e[o].concat(t[o]))):[...e[o],...t[o]]:t[o]:n(e[o])&&n(t[o])?e[o]=i(e[o],t[o]):e[o]=void 0===t[o]?i.options.allowUndefinedOverrides?t[o]:e[o]:t[o])})),e}),{}),r={allowUndefinedOverrides:!0,mergeArrays:!0,uniqueArrayItems:!0};i.options=r,i.withOptions=(e,...t)=>{i.options=Object.assign(Object.assign({},r),e);const o=i(...t);return i.options=r,o};const c={path:"/api/v1/socket.io",autoConnect:!1,transports:["polling","websocket"],upgrade:!0,timeout:1e4};e.CimulateCopilot=class{constructor({apiKey:e,baseUrl:t,namespace:o="/copilot",socketOptions:n={}}){const r=`${t}${o}`;this.socket=s.default(r,i(c,n,{withCredentials:!0,transportOptions:{polling:{extraHeaders:{"x-cimulate-api-key":e}}}}))}connect(){this.socket.connect()}search({userPrompt:e,searchParams:t},o){const s={user_prompt:e,search_params:t};o?this.socket.emit("copilot_search",s,o):this.socket.emit("copilot_search",s)}facetedNavigation({searchParams:e},t){const o={search_params:e};t?this.socket.emit("faceted_navigation",o,t):this.socket.emit("faceted_navigation",o)}cancelRequest({eventId:e,reason:t},o){const s={event_id:e,reason:t};o?this.socket.emit("cancel",s,o):this.socket.emit("cancel",s)}requestSessionInformation(e){this.socket.emit("session_info",e)}onConnectAck(e){this.socket.on("connect_ack",e)}onSearchAck(e){this.socket.on("search_ack",e)}onRefinedSearch(e){this.socket.on("refined_search",e)}onFollowUp(e){this.socket.on("follow_up",e)}onInquiry(e){this.socket.on("inquiry",e)}onPartialInquiry(e){this.socket.on("partial_inquiry",e)}onDisplayProducts(e){this.socket.on("display_products",e)}onDone(e){this.socket.on("done",e)}onError(e){this.socket.on("error",e)}disconnect(){this.socket.disconnect()}onDisconnect(e){this.socket.on("disconnect",e)}},Object.defineProperty(e,"__esModule",{value:!0})}));
2
- //# sourceMappingURL=bundle.cimulate.copilot-sdk.83e04b89.umd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bundle.cimulate.copilot-sdk.83e04b89.umd.js","sources":["../node_modules/ts-deepmerge/esm/index.js","../src/copilot.ts"],"sourcesContent":["// istanbul ignore next\nconst isObject = (obj) => {\n if (typeof obj === \"object\" && obj !== null) {\n if (typeof Object.getPrototypeOf === \"function\") {\n const prototype = Object.getPrototypeOf(obj);\n return prototype === Object.prototype || prototype === null;\n }\n return Object.prototype.toString.call(obj) === \"[object Object]\";\n }\n return false;\n};\nexport const merge = (...objects) => objects.reduce((result, current) => {\n if (Array.isArray(current)) {\n throw new TypeError(\"Arguments provided to ts-deepmerge must be objects, not arrays.\");\n }\n Object.keys(current).forEach((key) => {\n if ([\"__proto__\", \"constructor\", \"prototype\"].includes(key)) {\n return;\n }\n if (Array.isArray(result[key]) && Array.isArray(current[key])) {\n result[key] = merge.options.mergeArrays\n ? merge.options.uniqueArrayItems\n ? Array.from(new Set(result[key].concat(current[key])))\n : [...result[key], ...current[key]]\n : current[key];\n }\n else if (isObject(result[key]) && isObject(current[key])) {\n result[key] = merge(result[key], current[key]);\n }\n else {\n result[key] =\n current[key] === undefined\n ? merge.options.allowUndefinedOverrides\n ? current[key]\n : result[key]\n : current[key];\n }\n });\n return result;\n}, {});\nconst defaultOptions = {\n allowUndefinedOverrides: true,\n mergeArrays: true,\n uniqueArrayItems: true,\n};\nmerge.options = defaultOptions;\nmerge.withOptions = (options, ...objects) => {\n merge.options = Object.assign(Object.assign({}, defaultOptions), options);\n const result = merge(...objects);\n merge.options = defaultOptions;\n return result;\n};\n",null],"names":["isObject","obj","Object","getPrototypeOf","prototype","toString","call","merge","objects","reduce","result","current","Array","isArray","TypeError","keys","forEach","key","includes","options","mergeArrays","uniqueArrayItems","from","Set","concat","undefined","allowUndefinedOverrides","defaultOptions","withOptions","assign","socketDefaults","path","autoConnect","transports","upgrade","timeout","constructor","apiKey","baseUrl","namespace","socketOptions","socketioEndpoint","this","socket","io","withCredentials","transportOptions","polling","extraHeaders","connect","search","userPrompt","searchParams","callback","payload","user_prompt","search_params","emit","facetedNavigation","cancelRequest","eventId","reason","event_id","requestSessionInformation","onConnectAck","on","onSearchAck","onRefinedSearch","onFollowUp","onIn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SAAAgB,CAAUhB,GACRX,KAAKC,OAAOsB,GAAG,UAAWZ,EAC3B,CAED,gBAAAiB,CAAiBjB,GACfX,KAAKC,OAAOsB,GAAG,kBAAmBZ,EACnC,CAED,iBAAAkB,CAAkBlB,GAChBX,KAAKC,OAAOsB,GAAG,mBAAoBZ,EACpC,CAED,MAAAmB,CAAOnB,GACLX,KAAKC,OAAOsB,GAAG,OAAQZ,EACxB,CAED,OAAAoB,CAAQpB,GACNX,KAAKC,OAAOsB,GAAG,QAASZ,EACzB,CAED,UAAAqB,GACEhC,KAAKC,OAAO+B,YACb,CAED,YAAAC,CAAatB,GACXX,KAAKC,OAAOsB,GAAG,aAAcZ,EAC9B"}
@@ -1,6 +0,0 @@
1
- import { CopilotSearch } from './CopilotSearch';
2
- interface EventAcknowledgmentMessageFields {
3
- status: string;
4
- request: CopilotSearch;
5
- }
6
- export { EventAcknowledgmentMessageFields };
@@ -1,5 +0,0 @@
1
- import { Suggestion } from './Suggestion';
2
- interface FollowMinusUpMessageFields {
3
- suggestions: Suggestion[];
4
- }
5
- export { FollowMinusUpMessageFields };
@@ -1,10 +0,0 @@
1
- interface ReservedEvent {
2
- id?: string;
3
- session_id?: string;
4
- name?: string;
5
- event_source_id?: string;
6
- data?: any;
7
- created_at?: string;
8
- metadata?: Map<string, any>;
9
- }
10
- export { ReservedEvent };
@@ -1,5 +0,0 @@
1
- interface SearchParameters {
2
- query: string;
3
- facet_filters?: Map<string, string[]>;
4
- }
5
- export { SearchParameters };
@@ -1,5 +0,0 @@
1
- interface SessionEventInformationReply {
2
- type?: any;
3
- additionalProperties?: Map<string, any>;
4
- }
5
- export { SessionEventInformationReply };
@@ -1,6 +0,0 @@
1
- interface Suggestion {
2
- display_text?: string;
3
- action?: string;
4
- params?: Map<string, any>;
5
- }
6
- export { Suggestion };
@@ -1,6 +0,0 @@
1
- import {CopilotSearch} from './CopilotSearch';
2
- interface EventAcknowledgmentMessageFields {
3
- status: string;
4
- request: CopilotSearch;
5
- }
6
- export { EventAcknowledgmentMessageFields };
@@ -1,5 +0,0 @@
1
- import {Suggestion} from './Suggestion';
2
- interface FollowMinusUpMessageFields {
3
- suggestions: Suggestion[];
4
- }
5
- export { FollowMinusUpMessageFields };
@@ -1,11 +0,0 @@
1
-
2
- interface ReservedEvent {
3
- id?: string;
4
- session_id?: string;
5
- name?: string;
6
- event_source_id?: string;
7
- data?: any;
8
- created_at?: string;
9
- metadata?: Map<string, any>;
10
- }
11
- export { ReservedEvent };
@@ -1,6 +0,0 @@
1
-
2
- interface SearchParameters {
3
- query: string;
4
- facet_filters?: Map<string, string[]>;
5
- }
6
- export { SearchParameters };
@@ -1,6 +0,0 @@
1
-
2
- interface SessionEventInformationReply {
3
- type?: any;
4
- additionalProperties?: Map<string, any>;
5
- }
6
- export { SessionEventInformationReply };
@@ -1,7 +0,0 @@
1
-
2
- interface Suggestion {
3
- display_text?: string;
4
- action?: string;
5
- params?: Map<string, any>;
6
- }
7
- export { Suggestion };