@aws/mynah-ui 2.0.0-beta.1 → 2.0.0-beta.10.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 (55) hide show
  1. package/DEVELOPMENT.md +24 -0
  2. package/README.md +1 -1
  3. package/dist/components/chat-item/chat-item-card.d.ts +3 -3
  4. package/dist/components/chat-item/chat-item-followup.d.ts +2 -1
  5. package/dist/components/chat-item/chat-item-relevance-vote.d.ts +17 -0
  6. package/dist/components/{suggestion-card/suggestion-card-context-wrapper.d.ts → chat-item/chat-item-tree-view-wrapper.d.ts} +6 -4
  7. package/dist/components/chat-item/chat-item-tree-view.d.ts +22 -0
  8. package/dist/components/chat-item/chat-prompt-input.d.ts +12 -10
  9. package/dist/components/chat-item/chat-wrapper.d.ts +10 -9
  10. package/dist/components/feedback-form/feedback-form-comment.d.ts +2 -2
  11. package/dist/components/feedback-form/feedback-form.d.ts +5 -2
  12. package/dist/components/icon/icon-importer.d.ts +9 -0
  13. package/dist/components/icon.d.ts +6 -3
  14. package/dist/components/navigation-tabs.d.ts +7 -6
  15. package/dist/components/notification/notification.d.ts +0 -4
  16. package/dist/components/overlay/overlay.d.ts +4 -37
  17. package/dist/components/suggestion-card/suggestion-card-body.d.ts +2 -1
  18. package/dist/components/suggestion-card/suggestion-card-header.d.ts +2 -2
  19. package/dist/components/suggestion-card/suggestion-card.d.ts +1 -1
  20. package/dist/components/syntax-highlighter.d.ts +21 -3
  21. package/dist/components/toggle.d.ts +7 -5
  22. package/dist/helper/config.d.ts +6 -5
  23. package/dist/helper/date-time.d.ts +2 -2
  24. package/dist/helper/dom.d.ts +2 -0
  25. package/dist/helper/events.d.ts +0 -15
  26. package/dist/helper/file-tree.d.ts +16 -0
  27. package/dist/helper/store.d.ts +2 -38
  28. package/dist/helper/tabs-store.d.ts +40 -0
  29. package/dist/main.d.ts +30 -70
  30. package/dist/main.js +1 -1
  31. package/dist/main.js.LICENSE.txt +5 -0
  32. package/dist/main.js.map +1 -1
  33. package/dist/static.d.ts +78 -233
  34. package/package.json +12 -8
  35. package/dist/components/context-item.d.ts +0 -16
  36. package/dist/components/feedback-form/feedback-form-stars.d.ts +0 -15
  37. package/dist/components/main-container.d.ts +0 -20
  38. package/dist/components/navigation-tabs-vertical.d.ts +0 -13
  39. package/dist/components/prioritization-menu.d.ts +0 -18
  40. package/dist/components/query-text-short-view.d.ts +0 -10
  41. package/dist/components/search-block/autocomplete-card.d.ts +0 -20
  42. package/dist/components/search-block/autocomplete-content.d.ts +0 -32
  43. package/dist/components/search-block/search-api-help.d.ts +0 -14
  44. package/dist/components/search-block/search-card-header.d.ts +0 -11
  45. package/dist/components/search-block/search-card.d.ts +0 -19
  46. package/dist/components/search-block/search-context.d.ts +0 -30
  47. package/dist/components/search-block/search-history-card.d.ts +0 -16
  48. package/dist/components/search-block/search-history-content.d.ts +0 -19
  49. package/dist/components/search-block/search-input.d.ts +0 -22
  50. package/dist/components/search-block/search-live-toggle.d.ts +0 -15
  51. package/dist/components/suggestion-card/suggestion-card-relevance-vote.d.ts +0 -14
  52. package/dist/helper/find-language.d.ts +0 -17
  53. package/dist/helper/payload-transformer.d.ts +0 -13
  54. package/dist/translations/en.d.ts +0 -13
  55. package/dist/translations/i18n.d.ts +0 -17
@@ -8,53 +8,17 @@ export declare class EmptyMynahUIDataModel {
8
8
  constructor(defaults?: MynahUIDataModel | null);
9
9
  }
10
10
  export declare class MynahUIDataStore {
11
- private static instance;
12
11
  private readonly subsciptions;
12
+ private readonly tabId;
13
13
  private store;
14
14
  private defaults;
15
- private constructor();
16
- static getInstance: (initialData?: MynahUIDataModel | undefined) => MynahUIDataStore;
17
- /**
18
- * Sets the defaults to use while clearing the store
19
- * @param defaults partial set of MynahUIDataModel for defaults
20
- */
15
+ constructor(tabId: string, initialData?: MynahUIDataModel);
21
16
  setDefaults: (defaults: MynahUIDataModel | null) => void;
22
- /**
23
- * Get the defaults to use while generating an empty store data
24
- */
25
17
  getDefaults: () => MynahUIDataModel | null;
26
- /**
27
- * Subscribe to value changes of a specific item in data store
28
- * @param storeKey One of the keys in MynahUIDataModel
29
- * @param handler function will be called when value of the given key is updated in store with new and old values
30
- * @returns subscriptionId which needed to unsubscribe
31
- */
32
18
  subscribe: (storeKey: keyof MynahUIDataModel, handler: (newValue: any, oldValue?: any) => void) => string;
33
- /**
34
- * Unsubscribe from changes of a specific item in data store
35
- * @param storeKey One of the keys in MynahUIDataModel
36
- * @param subscriptionId subsciptionId which is returned from subscribe function
37
- */
38
19
  unsubscribe: (storeKey: keyof MynahUIDataModel, subscriptionId: string) => void;
39
- /**
40
- * Returns current value of an item in data store
41
- * @param storeKey One of the keys in MynahUIDataModel
42
- * @returns value of the given key in data store
43
- */
44
20
  getValue: (storeKey: keyof MynahUIDataModel) => any;
45
- /**
46
- * Returns current value of an item in data store
47
- * @param storeKey One of the keys in MynahUIDataModel
48
- * @returns value of the given key in data store
49
- */
50
21
  getDefaultValue: (storeKey: keyof MynahUIDataModel) => any;
51
- /**
52
- * Updates the store and informs the subscribers.
53
- * @param data A full or partial set of store data model with values.
54
- */
55
22
  updateStore: (data: MynahUIDataModel, skipSubscribers?: boolean | undefined) => void;
56
- /**
57
- * Clears store data and informs all the subscribers
58
- */
59
23
  resetStore: () => void;
60
24
  }
@@ -0,0 +1,40 @@
1
+ /*!
2
+ * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { MynahUIDataModel, MynahUITabStoreModel, MynahUITabStoreTab } from '../static';
6
+ interface TabStoreSubscription {
7
+ 'add': Record<string, (tabId: string, tabData?: MynahUITabStoreTab) => void>;
8
+ 'remove': Record<string, (tabId: string, newSelectedTab?: MynahUITabStoreTab) => void>;
9
+ 'update': Record<string, (tabId: string, tabData?: MynahUITabStoreTab) => void>;
10
+ 'selectedTabChange': Record<string, (tabId: string, previousSelectedTab?: MynahUITabStoreTab) => void>;
11
+ }
12
+ export declare class EmptyMynahUITabsStoreModel {
13
+ data: Required<MynahUITabStoreModel>;
14
+ constructor();
15
+ }
16
+ export declare class MynahUITabsStore {
17
+ private static instance;
18
+ private readonly subsciptions;
19
+ private readonly tabDefaults;
20
+ private readonly tabsStore;
21
+ private readonly tabsDataStore;
22
+ private constructor();
23
+ private readonly deselectAllTabs;
24
+ readonly addTab: (tabData?: MynahUITabStoreTab | undefined) => string;
25
+ readonly removeTab: (tabId: string) => string;
26
+ readonly selectTab: (tabId: string) => void;
27
+ updateTab: (tabId: string, tabData?: Partial<MynahUITabStoreTab> | undefined, skipSubscribers?: boolean | undefined) => void;
28
+ static getInstance: (initialData?: MynahUITabStoreModel | undefined, defaults?: MynahUITabStoreTab | undefined) => MynahUITabsStore;
29
+ addListener: (eventName: keyof TabStoreSubscription, handler: (tabId: string, tabData?: MynahUITabStoreTab | undefined) => void) => string;
30
+ addListenerToDataStore: (tabId: string, storeKey: keyof MynahUIDataModel, handler: (newValue: any, oldValue?: any) => void) => string | null;
31
+ removeListenerFromDataStore: (tabId: string, subscriptionId: string, storeKey: keyof MynahUIDataModel) => void;
32
+ removeListener: (eventName: keyof TabStoreSubscription, subscriptionId: string) => void;
33
+ private readonly informSubscribers;
34
+ getTab: (tabId: string) => MynahUITabStoreTab | null;
35
+ getAllTabs: () => MynahUITabStoreModel;
36
+ getTabDataStore: (tabId: string) => any;
37
+ getSelectedTabId: () => string;
38
+ removeAllTabs: () => void;
39
+ }
40
+ export {};
package/dist/main.d.ts CHANGED
@@ -2,89 +2,49 @@
2
2
  * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
- import { SuggestionEngagement, Suggestion, SearchPayload, LiveSearchState, SuggestionEventName, RelevancyVoteType, FeedbackPayload, MynahUIDataModel, ContextChangeType, ContextType, SearchHistoryFilters, NotificationType, ChatItem, ChatItemFollowUp, ChatPrompt, MynahMode } from './static';
5
+ import { SuggestionEngagement, Suggestion, SuggestionEventName, RelevancyVoteType, FeedbackPayload, MynahUIDataModel, NotificationType, ChatItem, ChatItemFollowUp, ChatPrompt, MynahUITabStoreModel, MynahUITabStoreTab, ConfigModel, ReferenceTrackerInformation } from './static';
6
6
  import './styles/styles.scss';
7
- export { AutocompleteItem, SearchPayloadCodeSelection, FeedbackPayload, RelevancyVoteType, LiveSearchState, SearchPayload, Suggestion, ContextType, SearchHistoryItem, EngagementType, SuggestionEngagement, SuggestionEventName, SearchHistoryFilters, MynahUIDataModel, ContextChangeType, ContextSource, ContextTypes, NotificationType, MynahMode, ChatItem, ChatItemFollowUp, ChatItemType, ChatPrompt } from './static';
7
+ export { FeedbackPayload, RelevancyVoteType, Suggestion, EngagementType, SuggestionEngagement, SuggestionEventName, MynahUIDataModel, NotificationType, ChatItem, ChatItemFollowUp, ChatItemType, ChatPrompt } from './static';
8
8
  export { ToggleOption } from './components/toggle';
9
9
  export { MynahIcons } from './components/icon';
10
- export { transformPayloadData, validateRulesOnPayloadData, PayloadTransformRule, } from './helper/payload-transformer';
11
10
  export interface MynahUIProps {
12
11
  rootSelector?: string;
13
- storeData?: MynahUIDataModel;
14
- onSearch?: ((searchPayload: SearchPayload, isFromHistory?: boolean, isFromAutocomplete?: boolean) => void) | ((searchPayload: SearchPayload, isFromHistory?: boolean, isFromAutocomplete?: boolean) => MynahUIDataModel);
15
- onShowMoreWebResultsClick?: () => void;
12
+ defaults?: MynahUITabStoreTab;
13
+ tabs?: MynahUITabStoreModel;
14
+ config?: ConfigModel;
15
+ onShowMoreWebResultsClick?: (tabId: string, messageId: string) => void;
16
16
  onReady?: () => void;
17
- onClickSuggestionVote?: (suggestion: Suggestion, vote: RelevancyVoteType) => void;
18
- onClickCodeDetails?: (code: string, fileName?: string, range?: {
19
- start: {
20
- row: string;
21
- column?: string;
22
- };
23
- end?: {
24
- row: string;
25
- column?: string;
26
- };
27
- }) => void;
28
- onClearChat?: () => void;
29
- onStopChatResponse?: () => void;
30
- onResetStore?: () => void;
31
- onChangeContext?: (changeType: ContextChangeType, queryContext: ContextType) => void;
32
- onChatPrompt?: (prompt: ChatPrompt) => void;
33
- onFollowUpClicked?: (followUp: ChatItemFollowUp) => void;
34
- onSuggestionAttachedToChatPrompt?: (attachment: Suggestion) => void;
35
- onNavigationTabChange?: (selectedTab: string) => void;
36
- onSideNavigationTabChange?: (selectedTab: string) => void;
37
- onSuggestionEngagement?: (engagement: SuggestionEngagement) => void;
38
- onSuggestionClipboardInteraction?: (suggestionId: string, type?: string, text?: string) => void;
39
- onSuggestionInteraction?: (eventName: SuggestionEventName, suggestion: Suggestion, mouseEvent?: MouseEvent) => void;
40
- onSendFeedback?: (feedbackPayload: FeedbackPayload) => void;
41
- onRequestHistoryRecords?: (filterPayload: SearchHistoryFilters) => void;
42
- onInputQueryChange?: (input: string) => void;
43
- onChangeLiveSearchState?: (liveSearchState: LiveSearchState) => void;
44
- onClickAutocompleteItem?: (text: string, currSelected?: number, suggestionCount?: number) => void;
17
+ onVote?: (tabId: string, messageId: string, vote: RelevancyVoteType) => void;
18
+ onStopChatResponse?: (tabId: string) => void;
19
+ onResetStore?: (tabId: string) => void;
20
+ onChatPrompt?: (tabId: string, prompt: ChatPrompt) => void;
21
+ onFollowUpClicked?: (tabId: string, followUp: ChatItemFollowUp) => void;
22
+ onTabChange?: (tabId: string) => void;
23
+ onTabAdd?: (tabId: string) => void;
24
+ onTabRemove?: (tabId: string) => void;
25
+ onSuggestionEngagement?: (tabId: string, engagement: SuggestionEngagement) => void;
26
+ onCopyCodeToClipboard?: (tabId: string, code?: string, type?: 'selection' | 'block', referenceTrackerInformation?: ReferenceTrackerInformation[]) => void;
27
+ onCodeInsertToCursorPosition?: (tabId: string, code?: string, type?: 'selection' | 'block', referenceTrackerInformation?: ReferenceTrackerInformation[]) => void;
28
+ onSuggestionInteraction?: (tabId: string, eventName: SuggestionEventName, suggestion: Suggestion, mouseEvent?: MouseEvent) => void;
29
+ onSendFeedback?: (tabId: string, feedbackPayload: FeedbackPayload) => void;
30
+ onOpenDiff?: (tabId: string, leftPath: string, rightPath: string, messageId?: string) => void;
45
31
  }
46
32
  export declare class MynahUI {
47
33
  private readonly props;
48
34
  private readonly wrapper;
49
- private readonly sideNav;
35
+ private readonly tabsWrapper;
36
+ private readonly tabContentsWrapper;
50
37
  private readonly feedbackForm?;
51
- private readonly mainContainer;
52
- private readonly chatWrapper;
53
- private readonly config;
38
+ private readonly chatWrappers;
54
39
  constructor(props: MynahUIProps);
55
- private readonly sideNavigationTabChanged;
56
40
  private readonly addGlobalListeners;
57
- /**
58
- * Adds a new answer on the chat window
59
- * @param anwer An ChatItem object.
60
- */
61
- addChatAnswer: (answer: ChatItem) => void;
62
- getLastChatAnswer: () => ChatItem | undefined;
63
- /**
64
- * Updates the body of the last ChatItemType.ANSWER_STREAM chat item
65
- * @param body new body stream as string.
66
- */
67
- updateLastChatAnswerStream: (body: string) => void;
68
- /**
69
- * Updates only the UI with the given data.
70
- * @param data A full or partial set of data with values.
71
- */
72
- updateStore: (data: MynahUIDataModel) => void;
73
- getMode: () => MynahMode | undefined;
74
- /**
75
- * Sets store defaults to use while clearing the store
76
- * To clear the defaults, send `null`
77
- * @param defaults partial set of MynahUIDataModel for defaults
78
- */
79
- setStoreDefaults: (defaults: MynahUIDataModel | null) => void;
80
- /**
81
- * Returns the current search payload
82
- */
83
- getSearchPayload: () => SearchPayload;
84
- /**
85
- * Simply creates and shows a notification
86
- * @param props NotificationProps
87
- */
41
+ addChatAnswer: (tabId: string, answer: ChatItem) => void;
42
+ getLastChatAnswer: (tabId: string) => ChatItem | undefined;
43
+ updateLastChatAnswerStream: (tabId: string, updateWith: string | {
44
+ title: string | boolean;
45
+ suggestions: Suggestion[];
46
+ }) => void;
47
+ updateStore: (tabId: string | '', data: MynahUIDataModel) => string;
88
48
  notify: (props: {
89
49
  duration?: number;
90
50
  type?: NotificationType;