@aws/mynah-ui 4.35.5 → 4.35.7-beta.1

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 (37) hide show
  1. package/Dockerfile +21 -4
  2. package/dist/components/chat-item/chat-prompt-input.d.ts +3 -0
  3. package/dist/components/chat-item/chat-wrapper.d.ts +7 -0
  4. package/dist/components/chat-item/prompt-input/prompt-text-input.d.ts +4 -0
  5. package/dist/components/icon.d.ts +2 -1
  6. package/dist/main.d.ts +3 -0
  7. package/dist/main.js +1 -1
  8. package/dist/main.js.map +1 -1
  9. package/dist/static.d.ts +24 -1
  10. package/docs/DATAMODEL.md +42 -1
  11. package/docs/PROPERTIES.md +63 -0
  12. package/docs/USAGE.md +32 -1
  13. package/docs/img/data-model/chatItems/formItemsTooltip.png +0 -0
  14. package/docs/img/data-model/chatItems/options-all-filled.png +0 -0
  15. package/docs/img/data-model/chatItems/options-mandatory-filled.png +0 -0
  16. package/docs/img/data-model/chatItems/options-submitted.png +0 -0
  17. package/docs/img/data-model/chatItems/options.png +0 -0
  18. package/docs/img/data-model/tabStore/quickActionCommandsHeader.png +0 -0
  19. package/package.json +11 -5
  20. package/scripts/docker-build.js +36 -0
  21. package/scripts/docker-health-check.js +45 -0
  22. package/scripts/get-playwright-version.js +62 -0
  23. package/scripts/pre-test-setup.js +80 -0
  24. package/scripts/setup-playwright.js +61 -0
  25. package/scripts/test-webkit.js +44 -0
  26. package/ui-tests/__snapshots__/chromium/Open-MynahUI-Forms-should-render-form-elements-correctly/Open-MynahUI-Forms-should-render-form-elements-correctly-1.png +0 -0
  27. package/ui-tests/__snapshots__/chromium/Open-MynahUI-Quick-Action-Commands-Header-should-handle-quick-action-commands-header-interaction/quick-action-commands-header-hover.png +0 -0
  28. package/ui-tests/__snapshots__/chromium/Open-MynahUI-Quick-Action-Commands-Header-should-not-render-header-when-not-applicable/quick-action-commands-header-not-present.png +0 -0
  29. package/ui-tests/__snapshots__/chromium/Open-MynahUI-Quick-Action-Commands-Header-should-render-header-with-correct-status-styling/quick-action-commands-header-status.png +0 -0
  30. package/ui-tests/__snapshots__/chromium/Open-MynahUI-Quick-Action-Commands-Header-should-render-the-quick-action-commands-header/quick-action-commands-header.png +0 -0
  31. package/ui-tests/__snapshots__/webkit/Open-MynahUI-Forms-should-render-form-elements-correctly/Open-MynahUI-Forms-should-render-form-elements-correctly-1.png +0 -0
  32. package/ui-tests/__snapshots__/webkit/Open-MynahUI-Quick-Action-Commands-Header-should-handle-quick-action-commands-header-interaction/quick-action-commands-header-hover.png +0 -0
  33. package/ui-tests/__snapshots__/webkit/Open-MynahUI-Quick-Action-Commands-Header-should-not-render-header-when-not-applicable/quick-action-commands-header-not-present.png +0 -0
  34. package/ui-tests/__snapshots__/webkit/Open-MynahUI-Quick-Action-Commands-Header-should-render-header-with-correct-status-styling/quick-action-commands-header-status.png +0 -0
  35. package/ui-tests/__snapshots__/webkit/Open-MynahUI-Quick-Action-Commands-Header-should-render-the-quick-action-commands-header/quick-action-commands-header.png +0 -0
  36. package/ui-tests/package.json +10 -6
  37. package/ui-tests/playwright.config.ts +13 -1
package/Dockerfile CHANGED
@@ -1,5 +1,7 @@
1
- # Use the official Playwright image which includes browsers
2
- FROM mcr.microsoft.com/playwright:v1.53.0
1
+ # Version-agnostic Dockerfile for Mynah UI E2E Tests
2
+ # Supports dynamic Playwright version detection
3
+ ARG PLAYWRIGHT_VERSION=latest
4
+ FROM mcr.microsoft.com/playwright:${PLAYWRIGHT_VERSION}
3
5
 
4
6
  # Set working directory
5
7
  WORKDIR /app
@@ -14,6 +16,9 @@ COPY ./postinstall.js /app
14
16
  COPY ./webpack.config.js /app
15
17
  COPY ./tsconfig.json /app
16
18
 
19
+ # Copy scripts directory for version-agnostic setup
20
+ COPY ./scripts /app/scripts
21
+
17
22
  # Copy required files from ui-tests
18
23
  COPY ./ui-tests/package.json /app/ui-tests/
19
24
  COPY ./ui-tests/playwright.config.ts /app/ui-tests/
@@ -28,7 +33,19 @@ COPY ./ui-tests/__snapshots__ /app/ui-tests/__snapshots__
28
33
  # Install dependencies and build MynahUI
29
34
  RUN npm install
30
35
  RUN npm run build
31
- RUN cd ./ui-tests && npm install && npm run prepare
36
+
37
+ # Setup Playwright with version-agnostic approach
38
+ RUN cd ./ui-tests && node ../scripts/setup-playwright.js && npm run prepare
39
+
40
+ # Ensure all browsers are installed with dependencies
41
+ RUN cd ./ui-tests && npx playwright install --with-deps
42
+
43
+ # Run health check to verify installation
44
+ RUN cd ./ui-tests && node ../scripts/docker-health-check.js
45
+
46
+ # Set environment variables for WebKit
47
+ ENV WEBKIT_FORCE_COMPLEX_TEXT=0
48
+ ENV WEBKIT_DISABLE_COMPOSITING_MODE=1
32
49
 
33
50
  # Default command to run the tests
34
- CMD ["sh", "-c", "cd ./ui-tests && npm run e2e${BROWSER:+:$BROWSER}"]
51
+ CMD ["sh", "-c", "cd ./ui-tests && npm run e2e${BROWSER:+:$BROWSER}"]
@@ -62,8 +62,11 @@ export declare class ChatPromptInput {
62
62
  private readonly sendPrompt;
63
63
  private readonly getPromptInputTextLabel;
64
64
  readonly clearTextArea: (keepAttachment?: boolean) => void;
65
+ readonly getCursorPosition: () => number;
65
66
  readonly addAttachment: (attachmentContent: string, type?: PromptAttachmentType) => void;
66
67
  readonly openTopBarButtonItemOverlay: (data: TopBarButtonOverlayProps) => void;
67
68
  readonly updateTopBarButtonItemOverlay: (data: DetailedList) => void;
68
69
  readonly closeTopBarButtonItemOverlay: () => void;
70
+ readonly destroy: () => void;
71
+ readonly getCurrentTriggerSource: () => 'top-bar' | 'prompt-input';
69
72
  }
@@ -46,4 +46,11 @@ export declare class ChatWrapper {
46
46
  openTopBarButtonItemOverlay: (data: TopBarButtonOverlayProps) => void;
47
47
  updateTopBarButtonItemOverlay: (data: DetailedList) => void;
48
48
  closeTopBarButtonItemOverlay: () => void;
49
+ getPromptInputCursorPosition: () => number;
50
+ /**
51
+ * Returns true if the current tab has an image context command available.
52
+ */
53
+ private hasImageContextCommand;
54
+ destroy: () => void;
55
+ getCurrentTriggerSource(): 'top-bar' | 'prompt-input';
49
56
  }
@@ -20,7 +20,10 @@ export declare class PromptTextInput {
20
20
  private readonly selectedContext;
21
21
  private contextTooltip;
22
22
  private contextTooltipTimeout;
23
+ private mutationObserver;
23
24
  constructor(props: PromptTextInputProps);
25
+ private readonly setupContextRemovalObserver;
26
+ private readonly handleContextRemoval;
24
27
  readonly restoreRange: (range: Range) => void;
25
28
  private readonly updateCursorPos;
26
29
  private readonly checkIsEmpty;
@@ -51,4 +54,5 @@ export declare class PromptTextInput {
51
54
  isAtTheEnd: boolean;
52
55
  };
53
56
  readonly getUsedContext: () => QuickActionCommand[];
57
+ readonly destroy: () => void;
54
58
  }
@@ -80,7 +80,8 @@ export declare enum MynahIcons {
80
80
  MCP = "mcp",
81
81
  TRASH = "trash",
82
82
  TRANSFORM = "transform",
83
- HISTORY = "history"
83
+ HISTORY = "history",
84
+ IMAGE = "image"
84
85
  }
85
86
  export interface CustomIcon {
86
87
  name: string;
package/dist/main.d.ts CHANGED
@@ -98,6 +98,8 @@ export interface MynahUIProps {
98
98
  id: string;
99
99
  }, eventId?: string) => void;
100
100
  onSplashLoaderActionClick?: (action: Action, eventId?: string) => void;
101
+ onOpenFileDialogClick?: (tabId: string, fileType: string, insertPosition: number) => void;
102
+ onFilesDropped?: (tabId: string, files: FileList, insertPosition: number) => void;
101
103
  }
102
104
  export declare class MynahUI {
103
105
  private readonly render;
@@ -123,6 +125,7 @@ export declare class MynahUI {
123
125
  * @param answer ChatItem object.
124
126
  */
125
127
  addChatItem: (tabId: string, chatItem: ChatItem) => void;
128
+ addCustomContextToPrompt: (tabId: string, contextItem: QuickActionCommand[], insertPosition?: number) => void;
126
129
  /**
127
130
  * Updates the last ChatItemType.ANSWER_STREAM chat item
128
131
  * @param tabId Corresponding tab ID.