@inboxsdk/core 0.2.28-alpha.5 → 0.2.28
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.
- package/inboxsdk.js +28 -62
- package/inboxsdk.js.map +1 -1
- package/package.json +1 -5
- package/pageWorld.js.map +1 -1
- package/src/build/exec.d.ts +0 -1
- package/src/build/spawn.d.ts +0 -1
- package/src/common/ajax.d.ts +0 -1
- package/src/common/cachebust-url.d.ts +0 -1
- package/src/common/censorHTMLstring.d.ts +0 -1
- package/src/common/censorHTMLtree.d.ts +0 -1
- package/src/common/censorJSONTree.d.ts +0 -1
- package/src/common/connectivity-test.d.ts +0 -1
- package/src/common/defer.d.ts +0 -1
- package/src/common/find-parent.d.ts +0 -1
- package/src/common/get-extension-id.d.ts +0 -1
- package/src/common/get-or-fail.d.ts +0 -1
- package/src/common/get-session-id.d.ts +0 -1
- package/src/common/get-stack-trace.d.ts +0 -1
- package/src/common/html-to-text.d.ts +0 -1
- package/src/common/isElementVisible.d.ts +0 -1
- package/src/common/load-script.d.ts +0 -1
- package/src/common/log-error.d.ts +0 -1
- package/src/common/quoted-split.d.ts +0 -1
- package/src/common/rate-limit-queuer.d.ts +0 -1
- package/src/common/rate-limit.d.ts +0 -1
- package/src/common/version.d.ts +0 -1
- package/src/inboxsdk-js/check-requirements.js +3 -7
- package/src/inboxsdk-js/header.js +0 -1
- package/src/inboxsdk-js/inboxsdk-NONREMOTE-INTEGRATED-PAGEWORLD.js +6 -5
- package/src/inboxsdk-js/inboxsdk-NONREMOTE.js +3 -4
- package/src/inboxsdk-js/inboxsdk-REMOTE.js +1 -3
- package/src/inboxsdk-js/inboxsdk-TEST.js +3 -4
- package/src/inboxsdk-js/inboxsdk.js +39 -33
- package/src/inboxsdk-js/loading/load-platform-implementation-DEV.js +18 -15
- package/src/inboxsdk-js/loading/platform-implementation-loader.d.ts +0 -1
- package/src/inboxsdk.d.ts +27 -10
- package/src/injected-js/gmail/constants.d.ts +0 -1
- package/src/injected-js/gmail/modify-suggestions.d.ts +0 -1
- package/src/injected-js/gmail/modify-suggestions.test.js +9 -8
- package/src/injected-js/gmail/setup-gmail-interceptor.js +579 -340
- package/src/injected-js/gmail/setup-gmonkey-handler.d.ts +0 -1
- package/src/injected-js/gmail/sync-compose-processor-20220909.d.ts +0 -1
- package/src/injected-js/gmail/sync-compose-processor.d.ts +0 -1
- package/src/injected-js/gmail/sync-compose-request-processor.d.ts +0 -1
- package/src/injected-js/gmail/sync-compose-request-processor.test.js +49 -39
- package/src/injected-js/gmail/thread-identifier/click-and-get-popup-url.js +33 -20
- package/src/injected-js/gmail/thread-identifier/index.js +93 -57
- package/src/injected-js/gmail/thread-identifier/thread-row-parser.js +31 -22
- package/src/injected-js/gmail/thread-identifier/thread-row-parser.test.js +28 -12
- package/src/injected-js/inbox/setupAjaxInterceptor.js +121 -64
- package/src/injected-js/inbox/setupClickAndGetNewIframeSrc.js +66 -53
- package/src/injected-js/inbox/setupComposeViewDraftIDFinder.js +36 -20
- package/src/injected-js/inbox/setupInboxFakeWindowResizeListener.js +13 -13
- package/src/injected-js/injected-logger.d.ts +0 -1
- package/src/injected-js/main.js +24 -11
- package/src/injected-js/message-metadata-holder.js +82 -52
- package/src/injected-js/setup-data-exposer.js +148 -89
- package/src/injected-js/setup-error-silencer.js +21 -21
- package/src/injected-js/setup-event-reemitter.js +22 -30
- package/src/injected-js/setupCustomViewEventAssassin.d.ts +0 -1
- package/src/injected-js/setupInboxCustomViewLinkFixer.js +29 -24
- package/src/injected-js/setupPushStateListener.js +11 -18
- package/src/injected-js/xhr-helper.js +65 -62
- package/src/injected-js/xhr-proxy-factory.js +445 -195
- package/src/injected-js/xhr-proxy-factory.test.js +991 -824
- package/src/platform-implementation-js/constants/nav-item-types.d.ts +0 -1
- package/src/platform-implementation-js/constants/router.js +9 -17
- package/src/platform-implementation-js/constants/toolbars.js +3 -8
- package/src/platform-implementation-js/dom-driver/gmail/custom-style.js +13 -13
- package/src/platform-implementation-js/dom-driver/gmail/gmail-butter-bar-driver.js +136 -115
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-nav-item.d.ts +2 -3
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-support-item.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-toolbar-button-for-app.js +14 -13
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/create-link.js +48 -27
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/encodeDraftUrlId.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-draft-id-for-message-id.js +42 -31
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-native-nav-item.js +40 -30
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-rfc-message-id-for-gmail-message-id.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-rfc-message-id-for-gmail-thread-id.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-url-object.js +18 -10
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadForOldGmailThreadId.js +28 -21
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadFromSyncThreadId.js +45 -33
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/gmail-load-event.js +49 -31
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/goto-view.js +65 -58
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/isIntegratedViewGmail.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/keyboard-shortcut-help-modifier.js +124 -40
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-compose-window.js +22 -17
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-draft-by-message-id.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-draft-by-message-id.test.js +11 -10
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/override-gmail-back-button.js +80 -44
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/register-search-query-rewriter.js +26 -19
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/register-search-suggestions-provider.js +147 -71
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-compose-view-driver-stream.js +148 -91
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-route-view-driver-stream.js +166 -150
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-route-view-driver-stream.test.js +120 -70
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-app-id-warning.js +15 -15
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-route-view.js +67 -44
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-thread-list.js +379 -230
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-thread-list.test.js +307 -121
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-native-route-view.js +24 -17
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/suppressAddon.js +49 -41
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/temporary-track-download-url-validity.js +40 -30
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/thread-row-identifier.js +60 -28
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-events.js +133 -61
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-gmail-styles.js +110 -83
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/user-info.js +42 -30
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/user-info.test.js +46 -52
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.d.ts +3 -13
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.js +683 -355
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter/get-main-content-element-changed-stream.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter/wait-for-gmail-mode-to-settle.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter.d.ts +0 -4
- package/src/platform-implementation-js/dom-driver/gmail/gmail-page-communicator.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-response-processor.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-sync-response-processor.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/is-compose-titlebar-light-color.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/make-xhr-interceptor.js +93 -77
- package/src/platform-implementation-js/dom-driver/gmail/makePageParserTree.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/pageParserOptions.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.js +82 -35
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.test.js +94 -44
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-companion-global-icon-area.js +19 -12
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-companion-thread-icon-area.js +29 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-to-icon-area.js +26 -26
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/index.js +797 -391
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view/monitor-top-banner-size-and-react.js +9 -7
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view.js +109 -60
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-area-view.js +135 -95
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-card-view.js +211 -103
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-card-view.test.js +61 -61
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-backdrop.js +17 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-collapsible-section-view.js +541 -188
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-button.js +135 -67
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-compose-notice.js +49 -27
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-inner-sidebar.js +13 -7
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-outer-sidebar.js +22 -9
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-recipient-row.js +63 -36
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-status-bar.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-tooltip-to-button.js +113 -38
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/detectClassicRecipientsArea.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/ensure-app-button-toolbars-are-closed.js +16 -11
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/ensure-grouping-is-open.js +17 -11
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/focus.js +11 -8
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/from-manager.js +47 -27
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-additional-action-toolbar.js +24 -11
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-address-changes-stream.js +111 -59
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-address-information-extractor.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-body-changes-stream.js +14 -15
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-formatting-area-offset-left.js +17 -11
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-minimized-stream.js +24 -18
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-recipients.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-response-type-changes-stream.js +23 -19
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/gmail-compose-button-view.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/insert-link-into-body.js +19 -11
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/manage-button-grouping.js +376 -141
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/monitor-selection-range.js +28 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/override-edit-subject.js +70 -34
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/page-parser.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/position-formatting-toolbar.js +17 -10
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/set-recipients.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/setupLinkPopovers.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/size-fixer.js +137 -83
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/update-insert-more-area-left.js +19 -10
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view.js +1190 -632
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view/attachment-icon.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view/get-updated-contact.js +38 -29
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view.js +617 -327
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-nav-item-view.d.ts +1 -34
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-processor.js +48 -29
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-view.js +380 -188
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-row-list-view.js +194 -104
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-support-item-view.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-row-view.js +811 -382
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view/add-icon-area.js +58 -34
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.js +581 -330
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.test.js +277 -123
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view/width-manager.js +35 -15
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view.js +571 -216
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-toolbar-view.js +336 -152
- package/src/platform-implementation-js/dom-driver/gmail/views/native-gmail-nav-item-view.js +211 -87
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/button-color-classes.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/button-view.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-accessory-button-view.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-parent-accessory-button-view.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/inbox-dropdown-button-view.js +11 -10
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/modal-button-view.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/more-dropdown-button-view.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/more-parent-accessory-button-view.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-action-button-view.js +29 -20
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-dropdown-view.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-label-view.js +76 -41
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-modal-view-driver.js +99 -45
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-mole-view-driver.js +128 -76
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-tooltip-view.js +319 -128
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-top-message-bar-driver.js +78 -45
- package/src/platform-implementation-js/dom-driver/inbox/__mocks__/getSidebarClassnames.js +4 -8
- package/src/platform-implementation-js/dom-driver/inbox/addNavItem.js +54 -36
- package/src/platform-implementation-js/dom-driver/inbox/addRecipientRow.js +53 -35
- package/src/platform-implementation-js/dom-driver/inbox/createLink.js +15 -13
- package/src/platform-implementation-js/dom-driver/inbox/createLink.test.js +18 -15
- package/src/platform-implementation-js/dom-driver/inbox/custom-style.js +13 -14
- package/src/platform-implementation-js/dom-driver/inbox/detection/appToolbarLocation/parser.js +20 -14
- package/src/platform-implementation-js/dom-driver/inbox/detection/attachmentCard/parser.js +13 -14
- package/src/platform-implementation-js/dom-driver/inbox/detection/attachmentOverlay/parser.js +67 -35
- package/src/platform-implementation-js/dom-driver/inbox/detection/chatSidebar/parser.js +18 -16
- package/src/platform-implementation-js/dom-driver/inbox/detection/compose/parser.js +185 -68
- package/src/platform-implementation-js/dom-driver/inbox/detection/message/parser.js +56 -28
- package/src/platform-implementation-js/dom-driver/inbox/detection/nativeDrawer/parser.js +10 -12
- package/src/platform-implementation-js/dom-driver/inbox/detection/searchBar/parser.js +16 -16
- package/src/platform-implementation-js/dom-driver/inbox/detection/thread/parser.js +35 -24
- package/src/platform-implementation-js/dom-driver/inbox/detection/thread-row/parser.js +89 -37
- package/src/platform-implementation-js/dom-driver/inbox/getComposeViewDriverLiveSet.js +78 -56
- package/src/platform-implementation-js/dom-driver/inbox/getInboxMessageIdForInboxThreadId.js +32 -26
- package/src/platform-implementation-js/dom-driver/inbox/getSidebarClassnames.js +109 -52
- package/src/platform-implementation-js/dom-driver/inbox/getSidebarClassnames.test.js +8 -7
- package/src/platform-implementation-js/dom-driver/inbox/gotoView.js +20 -16
- package/src/platform-implementation-js/dom-driver/inbox/gotoView.test.js +16 -15
- package/src/platform-implementation-js/dom-driver/inbox/inbox-butter-bar-driver.js +83 -75
- package/src/platform-implementation-js/dom-driver/inbox/inbox-driver.js +823 -531
- package/src/platform-implementation-js/dom-driver/inbox/inbox-page-communicator.js +61 -48
- package/src/platform-implementation-js/dom-driver/inbox/inboxResponseProcessor.js +12 -9
- package/src/platform-implementation-js/dom-driver/inbox/inboxResponseProcessor.test.js +19 -12
- package/src/platform-implementation-js/dom-driver/inbox/makePageParserTree.js +33 -24
- package/src/platform-implementation-js/dom-driver/inbox/pageParserOptions.js +388 -201
- package/src/platform-implementation-js/dom-driver/inbox/registerSearchSuggestionsProvider.js +265 -249
- package/src/platform-implementation-js/dom-driver/inbox/setupCustomAutocompleteSelectionHandling.js +152 -84
- package/src/platform-implementation-js/dom-driver/inbox/setupRouteViewDriverStream.js +67 -55
- package/src/platform-implementation-js/dom-driver/inbox/setupRouteViewDriverStream.test.js +65 -43
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxLabelView.js +56 -31
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxMoleViewDriver.js +294 -191
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxToolbarButtonView.js +45 -32
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxToolbarView.js +39 -21
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-sidebar-view.js +240 -153
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-toolbar-button-view.js +150 -75
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-toolbar-tooltip-view.js +37 -20
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-attachment-card-view.js +114 -60
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-attachment-overlay-view.js +65 -47
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-backdrop.js +52 -41
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-chat-sidebar-view.js +36 -27
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-compose-button-view.js +80 -52
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-compose-view.js +649 -465
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-custom-route-view.js +58 -37
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-custom-route-view.test.js +26 -14
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-drawer-view.js +235 -118
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-dropdown-view.js +11 -10
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-dummy-route-view.js +46 -28
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-message-view.js +202 -131
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-modal-view.js +80 -40
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-route-view.js +61 -35
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-row-view.js +221 -124
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-view.js +213 -125
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-view.test.js +126 -104
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-tooltip-view.js +51 -36
- package/src/platform-implementation-js/dom-driver/inbox/views/inboxNavItemView.js +297 -158
- package/src/platform-implementation-js/dom-driver/inbox/waitForAnimationClickBlockerGone.js +35 -21
- package/src/platform-implementation-js/driver-common/compose/getDiscardStream.js +43 -24
- package/src/platform-implementation-js/driver-common/compose/getPresendingStream.js +68 -39
- package/src/platform-implementation-js/driver-common/getAccountUrlPart.d.ts +0 -1
- package/src/platform-implementation-js/driver-common/getGmailMessageIdForSyncMessageId.js +19 -14
- package/src/platform-implementation-js/driver-common/getGmailThreadIdForRfcMessageId.js +35 -27
- package/src/platform-implementation-js/driver-common/getOriginalMessagePage.d.ts +0 -1
- package/src/platform-implementation-js/driver-common/getRfcMessageIdForSyncMessageId.js +22 -16
- package/src/platform-implementation-js/driver-common/getSyncThreadsForSearch.d.ts +0 -1
- package/src/platform-implementation-js/driver-common/getThreadIdFromMessageId.js +14 -14
- package/src/platform-implementation-js/driver-common/gmailAjax.d.ts +0 -1
- package/src/platform-implementation-js/driver-common/inboxAjax.js +7 -12
- package/src/platform-implementation-js/driver-common/render-custom-icon.d.ts +0 -1
- package/src/platform-implementation-js/driver-common/requestGmailThread.js +20 -19
- package/src/platform-implementation-js/driver-common/sidebar/AppSidebar.js +306 -197
- package/src/platform-implementation-js/driver-common/sidebar/ContentPanelViewDriver.js +161 -113
- package/src/platform-implementation-js/driver-common/update-icon.d.ts +0 -1
- package/src/platform-implementation-js/driver-interfaces/compose-view-driver.js +114 -1
- package/src/platform-implementation-js/driver-interfaces/driver.d.ts +0 -5
- package/src/platform-implementation-js/driver-interfaces/driver.js +126 -1
- package/src/platform-implementation-js/driver-interfaces/message-view-driver.js +48 -4
- package/src/platform-implementation-js/driver-interfaces/mole-view-driver.js +29 -1
- package/src/platform-implementation-js/driver-interfaces/route-view-driver.js +32 -1
- package/src/platform-implementation-js/driver-interfaces/thread-row-view-driver.js +11 -1
- package/src/platform-implementation-js/lib/ErrorCollector.d.ts +0 -1
- package/src/platform-implementation-js/lib/Membrane.d.ts +0 -1
- package/src/platform-implementation-js/lib/ScrollableContainByScreen.d.ts +0 -1
- package/src/platform-implementation-js/lib/array-to-lifetimes.js +41 -43
- package/src/platform-implementation-js/lib/array-to-lifetimes.test.js +155 -139
- package/src/platform-implementation-js/lib/attemptWithRetries.d.ts +0 -1
- package/src/platform-implementation-js/lib/common-page-communicator.d.ts +0 -1
- package/src/platform-implementation-js/lib/copyAndValidateAutocompleteResults.js +38 -19
- package/src/platform-implementation-js/lib/css-selector-escape.js +3 -7
- package/src/platform-implementation-js/lib/delay-asap.d.ts +0 -1
- package/src/platform-implementation-js/lib/delay-idle.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/block-and-reemit-keyboard-events.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/element-view-mapper.js +11 -8
- package/src/platform-implementation-js/lib/dom/generic-button-view.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/get-insert-before-element.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/get-selection.js +52 -23
- package/src/platform-implementation-js/lib/dom/insert-element-in-order.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/insert-html-at-cursor.js +101 -69
- package/src/platform-implementation-js/lib/dom/is-node-in-range.js +10 -8
- package/src/platform-implementation-js/lib/dom/keyboard-shortcut-stream.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/make-element-child-stream.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/make-element-stream-merger.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/make-element-view-stream.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/make-mutation-observer-chunked-stream.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/make-mutation-observer-stream.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/on-mouse-down-and-up.js +17 -15
- package/src/platform-implementation-js/lib/dom/outsideClicksAndEscape.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/parentNodes.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/querySelectorOne.js +11 -8
- package/src/platform-implementation-js/lib/dom/querySelectorOrFail.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/reemitClickEventForReact.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/set-css.js +3 -7
- package/src/platform-implementation-js/lib/dom/set-value-and-dispatch-event.js +11 -9
- package/src/platform-implementation-js/lib/dom/simulate-drag-and-drop.js +33 -32
- package/src/platform-implementation-js/lib/dom/simulate-key.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/simulate-mouse-event.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/trigger-relay-event.d.ts +0 -1
- package/src/platform-implementation-js/lib/extract-contact-from-email-contact-string.d.ts +0 -1
- package/src/platform-implementation-js/lib/extract-contact-from-email-contact-string.test.js +26 -23
- package/src/platform-implementation-js/lib/fake-window-resize.d.ts +0 -1
- package/src/platform-implementation-js/lib/from-event-target-capture.d.ts +0 -1
- package/src/platform-implementation-js/lib/fromEventsWithOptions.d.ts +0 -1
- package/src/platform-implementation-js/lib/handle-compose-link-chips.js +149 -86
- package/src/platform-implementation-js/lib/handler-registry.d.ts +0 -1
- package/src/platform-implementation-js/lib/idMap.d.ts +0 -1
- package/src/platform-implementation-js/lib/imageRequest.d.ts +0 -1
- package/src/platform-implementation-js/lib/incrementName.d.ts +0 -1
- package/src/platform-implementation-js/lib/inject-script-EMBEDDED.d.ts +0 -1
- package/src/platform-implementation-js/lib/inject-script.d.ts +0 -1
- package/src/platform-implementation-js/lib/insert-link-chip-into-body.js +57 -42
- package/src/platform-implementation-js/lib/is-valid-app-id.d.ts +0 -1
- package/src/platform-implementation-js/lib/is-valid-email.d.ts +0 -1
- package/src/platform-implementation-js/lib/isNotNil.d.ts +0 -1
- package/src/platform-implementation-js/lib/isStreakAppId.d.ts +0 -1
- package/src/platform-implementation-js/lib/logger.d.ts +0 -1
- package/src/platform-implementation-js/lib/make-revocable-function.js +21 -19
- package/src/platform-implementation-js/lib/make-revocable-function.test.js +22 -20
- package/src/platform-implementation-js/lib/parseParamsFromRouteID.js +17 -15
- package/src/platform-implementation-js/lib/parseParamsFromRouteID.test.js +18 -9
- package/src/platform-implementation-js/lib/persistent-queue.d.ts +0 -1
- package/src/platform-implementation-js/lib/populateRouteID.js +9 -8
- package/src/platform-implementation-js/lib/populateRouteID.test.js +19 -20
- package/src/platform-implementation-js/lib/react/ElementContainer.js +20 -23
- package/src/platform-implementation-js/lib/rewriteCssWithIdMap.js +9 -10
- package/src/platform-implementation-js/lib/rewriteCssWithIdMap.test.js +20 -13
- package/src/platform-implementation-js/lib/routeIDmatchesHash.js +18 -13
- package/src/platform-implementation-js/lib/routeIDmatchesHash.test.js +17 -11
- package/src/platform-implementation-js/lib/safe-event-emitter.d.ts +0 -1
- package/src/platform-implementation-js/lib/shared-style.js +13 -14
- package/src/platform-implementation-js/lib/stopper-pool.d.ts +0 -1
- package/src/platform-implementation-js/lib/stream-wait-for.d.ts +0 -1
- package/src/platform-implementation-js/lib/toItemWithLifetimeStream.js +17 -18
- package/src/platform-implementation-js/lib/toLiveSet.js +15 -17
- package/src/platform-implementation-js/lib/wait-for.d.ts +1 -2
- package/src/platform-implementation-js/lib/waitForAsync.d.ts +0 -1
- package/src/platform-implementation-js/main-INTEGRATED-PAGEWORLD.js +5 -6
- package/src/platform-implementation-js/main.js +24 -9
- package/src/platform-implementation-js/namespaces/butter-bar.d.ts +0 -1
- package/src/platform-implementation-js/namespaces/compose.js +60 -37
- package/src/platform-implementation-js/namespaces/conversations.js +124 -52
- package/src/platform-implementation-js/namespaces/global.js +39 -27
- package/src/platform-implementation-js/namespaces/keyboard.js +33 -29
- package/src/platform-implementation-js/namespaces/lists.js +31 -25
- package/src/platform-implementation-js/namespaces/modal.js +28 -34
- package/src/platform-implementation-js/namespaces/nav-menu.js +45 -30
- package/src/platform-implementation-js/namespaces/router.js +137 -70
- package/src/platform-implementation-js/namespaces/search.js +17 -19
- package/src/platform-implementation-js/namespaces/toolbars.js +117 -71
- package/src/platform-implementation-js/namespaces/user.js +37 -36
- package/src/platform-implementation-js/namespaces/widgets.js +61 -54
- package/src/platform-implementation-js/platform-implementation.d.ts +0 -2
- package/src/platform-implementation-js/platform-implementation.js +226 -98
- package/src/platform-implementation-js/views/SimpleElementView.d.ts +0 -1
- package/src/platform-implementation-js/views/app-toolbar-button-view.js +47 -26
- package/src/platform-implementation-js/views/collapsible-section-view.js +63 -66
- package/src/platform-implementation-js/views/compose-button-view.d.ts +0 -1
- package/src/platform-implementation-js/views/compose-view.d.ts +0 -1
- package/src/platform-implementation-js/views/content-panel-view.js +30 -28
- package/src/platform-implementation-js/views/conversations/attachment-card-view.js +44 -21
- package/src/platform-implementation-js/views/conversations/custom-message-view.js +104 -44
- package/src/platform-implementation-js/views/conversations/message-view.js +202 -131
- package/src/platform-implementation-js/views/conversations/thread-view.js +127 -75
- package/src/platform-implementation-js/views/keyboard-shortcut-handle.d.ts +0 -1
- package/src/platform-implementation-js/views/native-nav-item-view.js +65 -32
- package/src/platform-implementation-js/views/nav-item-view.js +115 -51
- package/src/platform-implementation-js/views/route-view/custom-route-view.js +20 -25
- package/src/platform-implementation-js/views/route-view/dummy-route-view-driver.js +18 -18
- package/src/platform-implementation-js/views/route-view/list-route-view.js +52 -30
- package/src/platform-implementation-js/views/route-view/route-view.js +35 -24
- package/src/platform-implementation-js/views/section-view.js +52 -60
- package/src/platform-implementation-js/views/thread-row-view.js +74 -49
- package/src/platform-implementation-js/widgets/buttons/basic-button-view-controller.d.ts +0 -1
- package/src/platform-implementation-js/widgets/buttons/dropdown-button-view-controller.d.ts +0 -1
- package/src/platform-implementation-js/widgets/buttons/dropdown-view.d.ts +0 -1
- package/src/platform-implementation-js/widgets/drawer-view.js +36 -29
- package/src/platform-implementation-js/widgets/modal-view.js +68 -39
- package/src/platform-implementation-js/widgets/mole-view.js +22 -22
- package/src/platform-implementation-js/widgets/top-message-bar-view.js +10 -13
- package/src/build/exec.d.ts.map +0 -1
- package/src/build/exec.js +0 -26
- package/src/build/spawn.d.ts.map +0 -1
- package/src/build/spawn.js +0 -17
- package/src/common/ajax.d.ts.map +0 -1
- package/src/common/ajax.js +0 -90
- package/src/common/cachebust-url.d.ts.map +0 -1
- package/src/common/cachebust-url.js +0 -10
- package/src/common/censorHTMLstring.d.ts.map +0 -1
- package/src/common/censorHTMLstring.js +0 -37
- package/src/common/censorHTMLtree.d.ts.map +0 -1
- package/src/common/censorHTMLtree.js +0 -28
- package/src/common/censorJSONTree.d.ts.map +0 -1
- package/src/common/censorJSONTree.js +0 -15
- package/src/common/connectivity-test.d.ts.map +0 -1
- package/src/common/connectivity-test.js +0 -21
- package/src/common/defer.d.ts.map +0 -1
- package/src/common/defer.js +0 -11
- package/src/common/find-parent.d.ts.map +0 -1
- package/src/common/find-parent.js +0 -10
- package/src/common/get-extension-id.d.ts.map +0 -1
- package/src/common/get-extension-id.js +0 -7
- package/src/common/get-or-fail.d.ts.map +0 -1
- package/src/common/get-or-fail.js +0 -8
- package/src/common/get-session-id.d.ts.map +0 -1
- package/src/common/get-session-id.js +0 -14
- package/src/common/get-stack-trace.d.ts.map +0 -1
- package/src/common/get-stack-trace.js +0 -6
- package/src/common/html-to-text.d.ts.map +0 -1
- package/src/common/html-to-text.js +0 -7
- package/src/common/isElementVisible.d.ts.map +0 -1
- package/src/common/isElementVisible.js +0 -6
- package/src/common/load-script.d.ts.map +0 -1
- package/src/common/load-script.js +0 -127
- package/src/common/log-error.d.ts.map +0 -1
- package/src/common/log-error.js +0 -191
- package/src/common/quoted-split.d.ts.map +0 -1
- package/src/common/quoted-split.js +0 -18
- package/src/common/rate-limit-queuer.d.ts.map +0 -1
- package/src/common/rate-limit-queuer.js +0 -57
- package/src/common/rate-limit.d.ts.map +0 -1
- package/src/common/rate-limit.js +0 -14
- package/src/common/version.d.ts.map +0 -1
- package/src/common/version.js +0 -6
- package/src/inboxsdk-js/loading/platform-implementation-loader.d.ts.map +0 -1
- package/src/inboxsdk-js/loading/platform-implementation-loader.js +0 -27
- package/src/injected-js/gmail/constants.d.ts.map +0 -1
- package/src/injected-js/gmail/constants.js +0 -2
- package/src/injected-js/gmail/modify-suggestions.d.ts.map +0 -1
- package/src/injected-js/gmail/modify-suggestions.js +0 -106
- package/src/injected-js/gmail/setup-gmonkey-handler.d.ts.map +0 -1
- package/src/injected-js/gmail/setup-gmonkey-handler.js +0 -49
- package/src/injected-js/gmail/sync-compose-processor-20220909.d.ts.map +0 -1
- package/src/injected-js/gmail/sync-compose-processor-20220909.js +0 -298
- package/src/injected-js/gmail/sync-compose-processor.d.ts.map +0 -1
- package/src/injected-js/gmail/sync-compose-processor.js +0 -55
- package/src/injected-js/gmail/sync-compose-request-processor.d.ts.map +0 -1
- package/src/injected-js/gmail/sync-compose-request-processor.js +0 -110
- package/src/injected-js/injected-logger.d.ts.map +0 -1
- package/src/injected-js/injected-logger.js +0 -50
- package/src/injected-js/setupCustomViewEventAssassin.d.ts.map +0 -1
- package/src/injected-js/setupCustomViewEventAssassin.js +0 -90
- package/src/platform-implementation-js/constants/nav-item-types.d.ts.map +0 -1
- package/src/platform-implementation-js/constants/nav-item-types.js +0 -19
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-app-menu-item.d.ts +0 -5
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-app-menu-item.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-app-menu-item.js +0 -21
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-collapsible-panel.d.ts +0 -5
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-collapsible-panel.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-collapsible-panel.js +0 -28
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-nav-item.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-nav-item.js +0 -98
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-support-item.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-support-item.js +0 -4
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/encodeDraftUrlId.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/encodeDraftUrlId.js +0 -8
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-rfc-message-id-for-gmail-message-id.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-rfc-message-id-for-gmail-message-id.js +0 -12
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-rfc-message-id-for-gmail-thread-id.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-rfc-message-id-for-gmail-thread-id.js +0 -33
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/isIntegratedViewGmail.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/isIntegratedViewGmail.js +0 -4
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-draft-by-message-id.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-draft-by-message-id.js +0 -44
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-gmail-styles.d.ts +0 -2
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-gmail-styles.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter/get-main-content-element-changed-stream.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter/get-main-content-element-changed-stream.js +0 -38
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter/wait-for-gmail-mode-to-settle.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter/wait-for-gmail-mode-to-settle.js +0 -12
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter.js +0 -253
- package/src/platform-implementation-js/dom-driver/gmail/gmail-page-communicator.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-page-communicator.js +0 -200
- package/src/platform-implementation-js/dom-driver/gmail/gmail-response-processor.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-response-processor.js +0 -533
- package/src/platform-implementation-js/dom-driver/gmail/gmail-sync-response-processor.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-sync-response-processor.js +0 -289
- package/src/platform-implementation-js/dom-driver/gmail/is-compose-titlebar-light-color.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/is-compose-titlebar-light-color.js +0 -21
- package/src/platform-implementation-js/dom-driver/gmail/makePageParserTree.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/makePageParserTree.js +0 -28
- package/src/platform-implementation-js/dom-driver/gmail/pageParserOptions.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/pageParserOptions.js +0 -19
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-menu-item-view.d.ts +0 -43
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-menu-item-view.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-menu-item-view.js +0 -126
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-status-bar.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-status-bar.js +0 -101
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/detectClassicRecipientsArea.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/detectClassicRecipientsArea.js +0 -38
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-address-information-extractor.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-address-information-extractor.js +0 -28
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-recipients.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-recipients.js +0 -22
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/gmail-compose-button-view.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/gmail-compose-button-view.js +0 -233
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/page-parser.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/page-parser.js +0 -223
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/set-recipients.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/set-recipients.js +0 -157
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/setupLinkPopovers.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/setupLinkPopovers.js +0 -109
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view/attachment-icon.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view/attachment-icon.js +0 -5
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-nav-item-view.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-nav-item-view.js +0 -759
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-support-item-view.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-support-item-view.js +0 -84
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/button-color-classes.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/button-color-classes.js +0 -33
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/button-view.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/button-view.js +0 -325
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-accessory-button-view.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-accessory-button-view.js +0 -58
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-parent-accessory-button-view.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-parent-accessory-button-view.js +0 -55
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/modal-button-view.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/modal-button-view.js +0 -96
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/more-dropdown-button-view.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/more-dropdown-button-view.js +0 -30
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/more-parent-accessory-button-view.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/more-parent-accessory-button-view.js +0 -10
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-dropdown-view.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-dropdown-view.js +0 -22
- package/src/platform-implementation-js/driver-common/getAccountUrlPart.d.ts.map +0 -1
- package/src/platform-implementation-js/driver-common/getAccountUrlPart.js +0 -17
- package/src/platform-implementation-js/driver-common/getOriginalMessagePage.d.ts.map +0 -1
- package/src/platform-implementation-js/driver-common/getOriginalMessagePage.js +0 -33
- package/src/platform-implementation-js/driver-common/getSyncThreadsForSearch.d.ts.map +0 -1
- package/src/platform-implementation-js/driver-common/getSyncThreadsForSearch.js +0 -49
- package/src/platform-implementation-js/driver-common/gmailAjax.d.ts.map +0 -1
- package/src/platform-implementation-js/driver-common/gmailAjax.js +0 -65
- package/src/platform-implementation-js/driver-common/render-custom-icon.d.ts.map +0 -1
- package/src/platform-implementation-js/driver-common/render-custom-icon.js +0 -16
- package/src/platform-implementation-js/driver-common/update-icon.d.ts.map +0 -1
- package/src/platform-implementation-js/driver-common/update-icon.js +0 -90
- package/src/platform-implementation-js/lib/ErrorCollector.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/ErrorCollector.js +0 -47
- package/src/platform-implementation-js/lib/Membrane.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/Membrane.js +0 -22
- package/src/platform-implementation-js/lib/ScrollableContainByScreen.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/ScrollableContainByScreen.js +0 -30
- package/src/platform-implementation-js/lib/attemptWithRetries.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/attemptWithRetries.js +0 -16
- package/src/platform-implementation-js/lib/common-page-communicator.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/common-page-communicator.js +0 -137
- package/src/platform-implementation-js/lib/delay-asap.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/delay-asap.js +0 -12
- package/src/platform-implementation-js/lib/delay-idle.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/delay-idle.js +0 -16
- package/src/platform-implementation-js/lib/dom/block-and-reemit-keyboard-events.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/block-and-reemit-keyboard-events.js +0 -36
- package/src/platform-implementation-js/lib/dom/generic-button-view.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/generic-button-view.js +0 -39
- package/src/platform-implementation-js/lib/dom/get-insert-before-element.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/get-insert-before-element.js +0 -39
- package/src/platform-implementation-js/lib/dom/insert-element-in-order.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/insert-element-in-order.js +0 -38
- package/src/platform-implementation-js/lib/dom/keyboard-shortcut-stream.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/keyboard-shortcut-stream.js +0 -12
- package/src/platform-implementation-js/lib/dom/make-element-child-stream.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/make-element-child-stream.js +0 -79
- package/src/platform-implementation-js/lib/dom/make-element-stream-merger.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/make-element-stream-merger.js +0 -28
- package/src/platform-implementation-js/lib/dom/make-element-view-stream.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/make-element-view-stream.js +0 -15
- package/src/platform-implementation-js/lib/dom/make-mutation-observer-chunked-stream.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/make-mutation-observer-chunked-stream.js +0 -15
- package/src/platform-implementation-js/lib/dom/make-mutation-observer-stream.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/make-mutation-observer-stream.js +0 -5
- package/src/platform-implementation-js/lib/dom/outsideClicksAndEscape.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/outsideClicksAndEscape.js +0 -39
- package/src/platform-implementation-js/lib/dom/parentNodes.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/parentNodes.js +0 -8
- package/src/platform-implementation-js/lib/dom/querySelectorOrFail.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/querySelectorOrFail.js +0 -6
- package/src/platform-implementation-js/lib/dom/reemitClickEventForReact.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/reemitClickEventForReact.js +0 -22
- package/src/platform-implementation-js/lib/dom/simulate-key.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/simulate-key.js +0 -46
- package/src/platform-implementation-js/lib/dom/simulate-mouse-event.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/simulate-mouse-event.js +0 -16
- package/src/platform-implementation-js/lib/dom/trigger-relay-event.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/trigger-relay-event.js +0 -7
- package/src/platform-implementation-js/lib/extract-contact-from-email-contact-string.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/extract-contact-from-email-contact-string.js +0 -25
- package/src/platform-implementation-js/lib/fake-window-resize.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/fake-window-resize.js +0 -5
- package/src/platform-implementation-js/lib/from-event-target-capture.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/from-event-target-capture.js +0 -12
- package/src/platform-implementation-js/lib/fromEventsWithOptions.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/fromEventsWithOptions.js +0 -10
- package/src/platform-implementation-js/lib/handler-registry.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/handler-registry.js +0 -67
- package/src/platform-implementation-js/lib/idMap.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/idMap.js +0 -45
- package/src/platform-implementation-js/lib/imageRequest.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/imageRequest.js +0 -8
- package/src/platform-implementation-js/lib/incrementName.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/incrementName.js +0 -7
- package/src/platform-implementation-js/lib/inject-script-EMBEDDED.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/inject-script-EMBEDDED.js +0 -14
- package/src/platform-implementation-js/lib/inject-script.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/inject-script.js +0 -33
- package/src/platform-implementation-js/lib/is-valid-app-id.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/is-valid-app-id.js +0 -27
- package/src/platform-implementation-js/lib/is-valid-email.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/is-valid-email.js +0 -14
- package/src/platform-implementation-js/lib/isNotNil.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/isNotNil.js +0 -5
- package/src/platform-implementation-js/lib/isStreakAppId.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/isStreakAppId.js +0 -11
- package/src/platform-implementation-js/lib/logger.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/logger.js +0 -441
- package/src/platform-implementation-js/lib/persistent-queue.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/persistent-queue.js +0 -107
- package/src/platform-implementation-js/lib/safe-event-emitter.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/safe-event-emitter.js +0 -17
- package/src/platform-implementation-js/lib/stopper-pool.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/stopper-pool.js +0 -41
- package/src/platform-implementation-js/lib/stream-wait-for.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/stream-wait-for.js +0 -30
- package/src/platform-implementation-js/lib/wait-for.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/wait-for.js +0 -28
- package/src/platform-implementation-js/lib/waitForAsync.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/waitForAsync.js +0 -19
- package/src/platform-implementation-js/namespaces/app-menu.d.ts +0 -38
- package/src/platform-implementation-js/namespaces/app-menu.d.ts.map +0 -1
- package/src/platform-implementation-js/namespaces/app-menu.js +0 -31
- package/src/platform-implementation-js/namespaces/butter-bar.d.ts.map +0 -1
- package/src/platform-implementation-js/namespaces/butter-bar.js +0 -163
- package/src/platform-implementation-js/views/SimpleElementView.d.ts.map +0 -1
- package/src/platform-implementation-js/views/SimpleElementView.js +0 -16
- package/src/platform-implementation-js/views/app-menu-item-view.d.ts +0 -23
- package/src/platform-implementation-js/views/app-menu-item-view.d.ts.map +0 -1
- package/src/platform-implementation-js/views/app-menu-item-view.js +0 -257
- package/src/platform-implementation-js/views/collapsible-panel-view.d.ts +0 -50
- package/src/platform-implementation-js/views/collapsible-panel-view.d.ts.map +0 -1
- package/src/platform-implementation-js/views/collapsible-panel-view.js +0 -222
- package/src/platform-implementation-js/views/compose-button-view.d.ts.map +0 -1
- package/src/platform-implementation-js/views/compose-button-view.js +0 -45
- package/src/platform-implementation-js/views/compose-view.d.ts.map +0 -1
- package/src/platform-implementation-js/views/compose-view.js +0 -312
- package/src/platform-implementation-js/views/keyboard-shortcut-handle.d.ts.map +0 -1
- package/src/platform-implementation-js/views/keyboard-shortcut-handle.js +0 -14
- package/src/platform-implementation-js/views/nav-item-view.d.ts +0 -24
- package/src/platform-implementation-js/widgets/buttons/basic-button-view-controller.d.ts.map +0 -1
- package/src/platform-implementation-js/widgets/buttons/basic-button-view-controller.js +0 -39
- package/src/platform-implementation-js/widgets/buttons/dropdown-button-view-controller.d.ts.map +0 -1
- package/src/platform-implementation-js/widgets/buttons/dropdown-button-view-controller.js +0 -98
- package/src/platform-implementation-js/widgets/buttons/dropdown-view.d.ts.map +0 -1
- package/src/platform-implementation-js/widgets/buttons/dropdown-view.js +0 -122
|
@@ -1,102 +1,173 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
exports.removeAllThreadRowUnclaimedModifications = removeAllThreadRowUnclaimedModifications;
|
|
9
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
-
var _once = _interopRequireDefault(require("lodash/once"));
|
|
11
|
-
var _flatten = _interopRequireDefault(require("lodash/flatten"));
|
|
12
|
-
var _includes = _interopRequireDefault(require("lodash/includes"));
|
|
13
|
-
var _intersection = _interopRequireDefault(require("lodash/intersection"));
|
|
14
|
-
var _uniqBy = _interopRequireDefault(require("lodash/uniqBy"));
|
|
15
|
-
var _flatMap = _interopRequireDefault(require("lodash/flatMap"));
|
|
16
|
-
var _ud = require("ud");
|
|
17
|
-
var _assert = _interopRequireDefault(require("assert"));
|
|
18
|
-
var _kefir = _interopRequireDefault(require("kefir"));
|
|
19
|
-
var _asap = _interopRequireDefault(require("asap"));
|
|
20
|
-
var _kefirBus = _interopRequireDefault(require("kefir-bus"));
|
|
21
|
-
var _querySelectorOrFail = _interopRequireDefault(require("../../../lib/dom/querySelectorOrFail"));
|
|
22
|
-
var _makeMutationObserverChunkedStream = _interopRequireDefault(require("../../../lib/dom/make-mutation-observer-chunked-stream"));
|
|
23
|
-
var _insertElementInOrder = _interopRequireDefault(require("../../../lib/dom/insert-element-in-order"));
|
|
24
|
-
var _kefirCast = _interopRequireDefault(require("kefir-cast"));
|
|
25
|
-
var _delayAsap = _interopRequireDefault(require("../../../lib/delay-asap"));
|
|
26
|
-
var _kefirStopper = _interopRequireDefault(require("kefir-stopper"));
|
|
27
|
-
var _gmailDropdownView = _interopRequireDefault(require("../widgets/gmail-dropdown-view"));
|
|
28
|
-
var _dropdownView = _interopRequireDefault(require("../../../widgets/buttons/dropdown-view"));
|
|
29
|
-
var _gmailLabelView = _interopRequireDefault(require("../widgets/gmail-label-view"));
|
|
30
|
-
var _gmailActionButtonView = _interopRequireDefault(require("../widgets/gmail-action-button-view"));
|
|
31
|
-
var _updateIcon = _interopRequireDefault(require("../../../driver-common/update-icon"));
|
|
1
|
+
/* @flow */
|
|
32
2
|
/* eslint-disable no-console */
|
|
33
|
-
|
|
3
|
+
|
|
4
|
+
import once from 'lodash/once';
|
|
5
|
+
import flatten from 'lodash/flatten';
|
|
6
|
+
import includes from 'lodash/includes';
|
|
7
|
+
import intersection from 'lodash/intersection';
|
|
8
|
+
import uniqBy from 'lodash/uniqBy';
|
|
9
|
+
import flatMap from 'lodash/flatMap';
|
|
10
|
+
import { defn, defonce } from 'ud';
|
|
11
|
+
import assert from 'assert';
|
|
12
|
+
import Kefir from 'kefir';
|
|
13
|
+
import asap from 'asap';
|
|
14
|
+
import kefirBus from 'kefir-bus';
|
|
15
|
+
import type { Bus } from 'kefir-bus';
|
|
16
|
+
|
|
17
|
+
import querySelector from '../../../lib/dom/querySelectorOrFail';
|
|
18
|
+
import makeMutationObserverChunkedStream from '../../../lib/dom/make-mutation-observer-chunked-stream';
|
|
19
|
+
import insertElementInOrder from '../../../lib/dom/insert-element-in-order';
|
|
20
|
+
import kefirCast from 'kefir-cast';
|
|
21
|
+
import type { ThreadRowViewDriver } from '../../../driver-interfaces/thread-row-view-driver';
|
|
22
|
+
import delayAsap from '../../../lib/delay-asap';
|
|
23
|
+
import kefirStopper from 'kefir-stopper';
|
|
24
|
+
|
|
25
|
+
import GmailDropdownView from '../widgets/gmail-dropdown-view';
|
|
26
|
+
import DropdownView from '../../../widgets/buttons/dropdown-view';
|
|
27
|
+
import GmailLabelView from '../widgets/gmail-label-view';
|
|
28
|
+
import GmailActionButtonView from '../widgets/gmail-action-button-view';
|
|
29
|
+
import type GmailDriver from '../gmail-driver';
|
|
30
|
+
import type GmailRowListView from './gmail-row-list-view';
|
|
31
|
+
|
|
32
|
+
import updateIcon from '../../../driver-common/update-icon';
|
|
33
|
+
|
|
34
|
+
type LabelMod = { gmailLabelView: Object, remove(): void };
|
|
35
|
+
type ActionButtonMod = {
|
|
36
|
+
gmailActionButtonView: GmailActionButtonView,
|
|
37
|
+
remove(): void,
|
|
38
|
+
};
|
|
39
|
+
type ButtonMod = {
|
|
40
|
+
buttonSpan: HTMLElement,
|
|
41
|
+
iconSettings: Object,
|
|
42
|
+
remove(): void,
|
|
43
|
+
};
|
|
44
|
+
type ImageMod = {
|
|
45
|
+
iconSettings: Object,
|
|
46
|
+
iconWrapper: HTMLElement,
|
|
47
|
+
remove(): void,
|
|
48
|
+
};
|
|
49
|
+
type ReplacedDateMod = { el: HTMLElement, remove(): void };
|
|
50
|
+
type ReplacedDraftLabelMod = ReplacedDateMod;
|
|
51
|
+
|
|
52
|
+
type Mods = {
|
|
53
|
+
label: { unclaimed: LabelMod[], claimed: LabelMod[] },
|
|
54
|
+
action: { unclaimed: ActionButtonMod[], claimed: ActionButtonMod[] },
|
|
55
|
+
button: { unclaimed: ButtonMod[], claimed: ButtonMod[] },
|
|
56
|
+
image: { unclaimed: ImageMod[], claimed: ImageMod[] },
|
|
57
|
+
replacedDate: { unclaimed: ReplacedDateMod[], claimed: ReplacedDateMod[] },
|
|
58
|
+
replacedDraftLabel: {
|
|
59
|
+
unclaimed: ReplacedDraftLabelMod[],
|
|
60
|
+
claimed: ReplacedDraftLabelMod[],
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const cachedModificationsByRow: WeakMap<HTMLElement, Mods> = defonce(
|
|
65
|
+
module,
|
|
66
|
+
() => new WeakMap()
|
|
67
|
+
);
|
|
68
|
+
|
|
34
69
|
function focusAndNoPropagation(event) {
|
|
35
70
|
this.focus();
|
|
36
71
|
event.stopImmediatePropagation();
|
|
37
72
|
}
|
|
73
|
+
|
|
38
74
|
function starGroupEventInterceptor(event) {
|
|
39
75
|
const isOnStar = this.firstElementChild.contains(event.target);
|
|
40
76
|
const isOnSDKButton = !isOnStar && this !== event.target;
|
|
41
77
|
if (!isOnStar) {
|
|
42
78
|
event.stopImmediatePropagation();
|
|
43
79
|
if (!isOnSDKButton || event.type == 'mouseover') {
|
|
44
|
-
const newEvent = document.createEvent('MouseEvents');
|
|
45
|
-
newEvent.initMouseEvent(
|
|
80
|
+
const newEvent: Object = document.createEvent('MouseEvents');
|
|
81
|
+
newEvent.initMouseEvent(
|
|
82
|
+
event.type,
|
|
83
|
+
event.bubbles,
|
|
84
|
+
event.cancelable,
|
|
85
|
+
event.view,
|
|
86
|
+
event.detail,
|
|
87
|
+
event.screenX,
|
|
88
|
+
event.screenY,
|
|
89
|
+
event.clientX,
|
|
90
|
+
event.clientY,
|
|
91
|
+
event.ctrlKey,
|
|
92
|
+
event.altKey,
|
|
93
|
+
event.shiftKey,
|
|
94
|
+
event.metaKey,
|
|
95
|
+
event.button,
|
|
96
|
+
event.relatedTarget
|
|
97
|
+
);
|
|
46
98
|
this.parentElement.dispatchEvent(newEvent);
|
|
47
99
|
}
|
|
48
100
|
}
|
|
49
101
|
}
|
|
102
|
+
|
|
103
|
+
type Counts = {
|
|
104
|
+
messageCount: number,
|
|
105
|
+
draftCount: number,
|
|
106
|
+
};
|
|
107
|
+
|
|
50
108
|
class GmailThreadRowView {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
109
|
+
_elements: HTMLElement[];
|
|
110
|
+
_modifications: Mods;
|
|
111
|
+
_alreadyHadModifications: boolean;
|
|
112
|
+
_rowListViewDriver: GmailRowListView;
|
|
113
|
+
_driver: GmailDriver;
|
|
114
|
+
_userView: ?Object;
|
|
115
|
+
_cachedThreadID: ?string;
|
|
116
|
+
_cachedSyncThreadID: ?string;
|
|
117
|
+
_cachedSyncDraftIDPromise: ?Promise<?string>;
|
|
118
|
+
_stopper = kefirStopper();
|
|
119
|
+
_refresher: ?Kefir.Observable<any>;
|
|
120
|
+
_subjectRefresher: ?Kefir.Observable<any>;
|
|
121
|
+
_imageRefresher: ?Kefir.Observable<any>;
|
|
122
|
+
_counts: ?Counts;
|
|
123
|
+
_isVertical: boolean;
|
|
124
|
+
_isDestroyed: boolean = false;
|
|
125
|
+
|
|
126
|
+
constructor(
|
|
127
|
+
element: HTMLElement,
|
|
128
|
+
rowListViewDriver: GmailRowListView,
|
|
129
|
+
gmailDriver: GmailDriver
|
|
130
|
+
) {
|
|
131
|
+
(this: ThreadRowViewDriver);
|
|
132
|
+
assert(element.hasAttribute('id'), 'check element is main thread row');
|
|
133
|
+
|
|
134
|
+
this._isVertical =
|
|
135
|
+
intersection(Array.from(element.classList), ['zA', 'apv']).length === 2;
|
|
57
136
|
if (this._isVertical) {
|
|
58
137
|
const threadRow2 = element.nextElementSibling;
|
|
138
|
+
|
|
59
139
|
if (!threadRow2) throw new Error('threadRow2 not found');
|
|
140
|
+
|
|
60
141
|
const threadRow3 = threadRow2.nextElementSibling;
|
|
61
142
|
const has3Rows = threadRow3 && threadRow3.classList.contains('apw');
|
|
62
|
-
this._elements = has3Rows
|
|
143
|
+
this._elements = has3Rows
|
|
144
|
+
? [
|
|
145
|
+
element,
|
|
146
|
+
(element: any).nextElementSibling,
|
|
147
|
+
(element: any).nextElementSibling.nextElementSibling,
|
|
148
|
+
]
|
|
149
|
+
: [element, (element: any).nextElementSibling];
|
|
63
150
|
} else {
|
|
64
151
|
this._elements = [element];
|
|
65
152
|
}
|
|
153
|
+
|
|
66
154
|
const modifications = cachedModificationsByRow.get(this._elements[0]);
|
|
67
155
|
if (!modifications) {
|
|
68
156
|
this._alreadyHadModifications = false;
|
|
69
157
|
this._modifications = {
|
|
70
|
-
label: {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
claimed: []
|
|
77
|
-
},
|
|
78
|
-
button: {
|
|
79
|
-
unclaimed: [],
|
|
80
|
-
claimed: []
|
|
81
|
-
},
|
|
82
|
-
image: {
|
|
83
|
-
unclaimed: [],
|
|
84
|
-
claimed: []
|
|
85
|
-
},
|
|
86
|
-
replacedDate: {
|
|
87
|
-
unclaimed: [],
|
|
88
|
-
claimed: []
|
|
89
|
-
},
|
|
90
|
-
replacedDraftLabel: {
|
|
91
|
-
unclaimed: [],
|
|
92
|
-
claimed: []
|
|
93
|
-
}
|
|
158
|
+
label: { unclaimed: [], claimed: [] },
|
|
159
|
+
action: { unclaimed: [], claimed: [] },
|
|
160
|
+
button: { unclaimed: [], claimed: [] },
|
|
161
|
+
image: { unclaimed: [], claimed: [] },
|
|
162
|
+
replacedDate: { unclaimed: [], claimed: [] },
|
|
163
|
+
replacedDraftLabel: { unclaimed: [], claimed: [] },
|
|
94
164
|
};
|
|
95
165
|
cachedModificationsByRow.set(this._elements[0], this._modifications);
|
|
96
166
|
} else {
|
|
97
167
|
this._modifications = modifications;
|
|
98
168
|
this._alreadyHadModifications = true;
|
|
99
169
|
}
|
|
170
|
+
|
|
100
171
|
this._rowListViewDriver = rowListViewDriver;
|
|
101
172
|
this._driver = gmailDriver;
|
|
102
173
|
this._userView = null; // supplied by ThreadRowView
|
|
@@ -106,41 +177,74 @@ class GmailThreadRowView {
|
|
|
106
177
|
this._subjectRefresher = null;
|
|
107
178
|
this._imageRefresher = null;
|
|
108
179
|
this._counts = null;
|
|
180
|
+
|
|
109
181
|
this._elements[0].setAttribute('data-inboxsdk-thread-row', 'true');
|
|
110
182
|
}
|
|
183
|
+
|
|
111
184
|
destroy() {
|
|
112
185
|
if (!this._elements.length) {
|
|
113
186
|
return;
|
|
114
187
|
}
|
|
188
|
+
|
|
115
189
|
this._isDestroyed = true;
|
|
116
|
-
|
|
190
|
+
|
|
191
|
+
this._modifications.label.unclaimed =
|
|
192
|
+
this._modifications.label.claimed.concat(
|
|
193
|
+
this._modifications.label.unclaimed
|
|
194
|
+
);
|
|
117
195
|
this._modifications.label.claimed.length = 0;
|
|
118
|
-
|
|
196
|
+
|
|
197
|
+
this._modifications.action.unclaimed =
|
|
198
|
+
this._modifications.action.claimed.concat(
|
|
199
|
+
this._modifications.action.unclaimed
|
|
200
|
+
);
|
|
119
201
|
this._modifications.action.claimed.length = 0;
|
|
120
|
-
|
|
202
|
+
|
|
203
|
+
this._modifications.button.unclaimed =
|
|
204
|
+
this._modifications.button.claimed.concat(
|
|
205
|
+
this._modifications.button.unclaimed
|
|
206
|
+
);
|
|
121
207
|
this._modifications.button.claimed.length = 0;
|
|
122
|
-
|
|
208
|
+
|
|
209
|
+
this._modifications.image.unclaimed =
|
|
210
|
+
this._modifications.image.claimed.concat(
|
|
211
|
+
this._modifications.image.unclaimed
|
|
212
|
+
);
|
|
123
213
|
this._modifications.image.claimed.length = 0;
|
|
124
|
-
|
|
214
|
+
|
|
215
|
+
this._modifications.replacedDate.unclaimed =
|
|
216
|
+
this._modifications.replacedDate.claimed.concat(
|
|
217
|
+
this._modifications.replacedDate.unclaimed
|
|
218
|
+
);
|
|
125
219
|
this._modifications.replacedDate.claimed.length = 0;
|
|
126
|
-
|
|
220
|
+
|
|
221
|
+
this._modifications.replacedDraftLabel.unclaimed =
|
|
222
|
+
this._modifications.replacedDraftLabel.claimed.concat(
|
|
223
|
+
this._modifications.replacedDraftLabel.unclaimed
|
|
224
|
+
);
|
|
127
225
|
this._modifications.replacedDraftLabel.claimed.length = 0;
|
|
128
|
-
|
|
226
|
+
|
|
227
|
+
flatMap(this._elements, (el) =>
|
|
228
|
+
Array.from(el.getElementsByClassName('inboxsdk__thread_row_addition'))
|
|
229
|
+
).forEach((el) => {
|
|
129
230
|
el.remove();
|
|
130
231
|
});
|
|
232
|
+
|
|
131
233
|
this._stopper.destroy();
|
|
132
234
|
this._elements.length = 0;
|
|
133
235
|
}
|
|
134
|
-
|
|
236
|
+
|
|
237
|
+
getElement(): HTMLElement {
|
|
135
238
|
return this._elements[0];
|
|
136
239
|
}
|
|
240
|
+
|
|
137
241
|
_removeUnclaimedModifications() {
|
|
138
242
|
_removeThreadRowUnclaimedModifications(this._modifications);
|
|
139
243
|
|
|
140
244
|
// TODO fix column width to deal with removed buttons
|
|
141
245
|
}
|
|
142
246
|
|
|
143
|
-
getAlreadyHadModifications() {
|
|
247
|
+
getAlreadyHadModifications(): boolean {
|
|
144
248
|
return this._alreadyHadModifications;
|
|
145
249
|
}
|
|
146
250
|
|
|
@@ -149,110 +253,168 @@ class GmailThreadRowView {
|
|
|
149
253
|
// a few cases such as with multiple inbox or the drafts page that it needs a moment.
|
|
150
254
|
// make sure you take until by on the gmailThreadRowView.getStopper() because waitForReady
|
|
151
255
|
// must not be called after the gmailThreadRowView is destroyed
|
|
152
|
-
waitForReady() {
|
|
256
|
+
waitForReady(): Kefir.Observable<GmailThreadRowView> {
|
|
153
257
|
const time = [0, 10, 100, 1000, 15000];
|
|
154
258
|
const step = () => {
|
|
155
259
|
if (this._threadIdReady()) {
|
|
156
|
-
(
|
|
260
|
+
asap(() => {
|
|
157
261
|
if (this._elements.length) this._removeUnclaimedModifications();
|
|
158
262
|
});
|
|
159
|
-
return
|
|
263
|
+
return Kefir.constant(this);
|
|
160
264
|
} else {
|
|
161
265
|
const stepTime = time.shift();
|
|
162
266
|
if (stepTime == undefined) {
|
|
163
|
-
console.log(
|
|
164
|
-
|
|
267
|
+
console.log(
|
|
268
|
+
'Should not happen: ThreadRowViewDriver never became ready',
|
|
269
|
+
this
|
|
270
|
+
);
|
|
271
|
+
return Kefir.never();
|
|
165
272
|
} else {
|
|
166
|
-
return
|
|
273
|
+
return Kefir.later(stepTime).flatMap(step);
|
|
167
274
|
}
|
|
168
275
|
}
|
|
169
276
|
};
|
|
277
|
+
|
|
170
278
|
return step();
|
|
171
279
|
}
|
|
172
|
-
|
|
280
|
+
|
|
281
|
+
setUserView(userView: Object) {
|
|
173
282
|
this._userView = userView;
|
|
174
283
|
}
|
|
175
|
-
|
|
284
|
+
|
|
285
|
+
getCounts(): Counts {
|
|
176
286
|
let counts = this._counts;
|
|
177
287
|
if (!counts) {
|
|
178
|
-
const recipientsElement = (
|
|
288
|
+
const recipientsElement = querySelector(this._elements[0], 'td div.yW');
|
|
289
|
+
|
|
179
290
|
if (this._driver.isUsingSyncAPI()) {
|
|
180
291
|
const draftCount = recipientsElement.querySelectorAll('.boq').length;
|
|
181
292
|
const messageCountMatch = recipientsElement.querySelector('.bx0');
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
293
|
+
|
|
294
|
+
const messageCount =
|
|
295
|
+
messageCountMatch && messageCountMatch.innerHTML
|
|
296
|
+
? +messageCountMatch.innerHTML
|
|
297
|
+
: draftCount
|
|
298
|
+
? 0
|
|
299
|
+
: 1;
|
|
300
|
+
|
|
301
|
+
counts = this._counts = { messageCount, draftCount };
|
|
187
302
|
} else {
|
|
188
|
-
const [preDrafts, drafts] = recipientsElement.innerHTML.split(
|
|
189
|
-
|
|
303
|
+
const [preDrafts, drafts] = recipientsElement.innerHTML.split(
|
|
304
|
+
/<font color=[^>]+>[^>]+<\/font>/
|
|
305
|
+
);
|
|
306
|
+
|
|
307
|
+
const preDraftsWithoutNames = preDrafts.replace(
|
|
308
|
+
/<span\b[^>]*>.*?<\/span>/g,
|
|
309
|
+
''
|
|
310
|
+
);
|
|
311
|
+
|
|
190
312
|
const messageCountMatch = preDraftsWithoutNames.match(/\((\d+)\)/);
|
|
191
|
-
const messageCount = messageCountMatch
|
|
313
|
+
const messageCount = messageCountMatch
|
|
314
|
+
? +messageCountMatch[1]
|
|
315
|
+
: preDrafts
|
|
316
|
+
? 1
|
|
317
|
+
: 0;
|
|
318
|
+
|
|
192
319
|
const draftCountMatch = drafts && drafts.match(/\((\d+)\)/);
|
|
193
|
-
const draftCount = draftCountMatch
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
320
|
+
const draftCount = draftCountMatch
|
|
321
|
+
? +draftCountMatch[1]
|
|
322
|
+
: drafts != null
|
|
323
|
+
? 1
|
|
324
|
+
: 0;
|
|
325
|
+
counts = this._counts = { messageCount, draftCount };
|
|
198
326
|
}
|
|
199
327
|
}
|
|
328
|
+
|
|
200
329
|
return counts;
|
|
201
330
|
}
|
|
202
|
-
|
|
331
|
+
|
|
332
|
+
_expandColumn(colSelector: string, width: number) {
|
|
203
333
|
this._rowListViewDriver.expandColumn(colSelector, width);
|
|
204
334
|
}
|
|
205
|
-
|
|
335
|
+
|
|
336
|
+
addLabel(label: Object) {
|
|
206
337
|
if (!this._elements.length) {
|
|
207
338
|
console.warn('addLabel called on destroyed thread row');
|
|
208
339
|
return;
|
|
209
340
|
}
|
|
210
|
-
const prop = (
|
|
341
|
+
const prop: Kefir.Observable<?Object> = kefirCast(Kefir, label)
|
|
342
|
+
.takeUntilBy(this._stopper)
|
|
343
|
+
.toProperty();
|
|
211
344
|
let labelMod = null;
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
labelMod
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
345
|
+
|
|
346
|
+
prop
|
|
347
|
+
.combine(this._getRefresher())
|
|
348
|
+
.takeUntilBy(this._stopper)
|
|
349
|
+
.onValue(([labelDescriptor]) => {
|
|
350
|
+
if (!labelDescriptor) {
|
|
351
|
+
if (labelMod) {
|
|
352
|
+
labelMod.remove();
|
|
353
|
+
this._modifications.label.claimed.splice(
|
|
354
|
+
this._modifications.label.claimed.indexOf(labelMod),
|
|
355
|
+
1
|
|
356
|
+
);
|
|
357
|
+
labelMod = null;
|
|
358
|
+
}
|
|
359
|
+
} else {
|
|
223
360
|
if (!labelMod) {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
gmailLabelView
|
|
230
|
-
|
|
231
|
-
|
|
361
|
+
labelMod = this._modifications.label.unclaimed.shift();
|
|
362
|
+
if (!labelMod) {
|
|
363
|
+
const gmailLabelView = new GmailLabelView({
|
|
364
|
+
classes: ['inboxsdk__thread_row_label'],
|
|
365
|
+
});
|
|
366
|
+
const el = gmailLabelView.getElement();
|
|
367
|
+
labelMod = {
|
|
368
|
+
gmailLabelView,
|
|
369
|
+
remove: el.remove.bind(el),
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
this._modifications.label.claimed.push(labelMod);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
labelMod.gmailLabelView.updateLabelDescriptor(labelDescriptor);
|
|
376
|
+
|
|
377
|
+
const labelParentDiv = this._getLabelParent();
|
|
378
|
+
|
|
379
|
+
if (
|
|
380
|
+
labelParentDiv !==
|
|
381
|
+
labelMod.gmailLabelView.getElement().parentElement
|
|
382
|
+
) {
|
|
383
|
+
labelParentDiv.insertAdjacentElement(
|
|
384
|
+
'afterbegin',
|
|
385
|
+
labelMod.gmailLabelView.getElement()
|
|
386
|
+
);
|
|
232
387
|
}
|
|
233
|
-
this._modifications.label.claimed.push(labelMod);
|
|
234
|
-
}
|
|
235
|
-
labelMod.gmailLabelView.updateLabelDescriptor(labelDescriptor);
|
|
236
|
-
const labelParentDiv = this._getLabelParent();
|
|
237
|
-
if (labelParentDiv !== labelMod.gmailLabelView.getElement().parentElement) {
|
|
238
|
-
labelParentDiv.insertAdjacentElement('afterbegin', labelMod.gmailLabelView.getElement());
|
|
239
388
|
}
|
|
240
|
-
}
|
|
241
|
-
});
|
|
389
|
+
});
|
|
242
390
|
}
|
|
243
|
-
|
|
391
|
+
|
|
392
|
+
addImage(inIconDescriptor: Object) {
|
|
244
393
|
if (!this._elements.length) {
|
|
245
394
|
console.warn('addImage called on destroyed thread row');
|
|
246
395
|
return;
|
|
247
396
|
}
|
|
248
|
-
const prop = (
|
|
397
|
+
const prop = kefirCast(Kefir, inIconDescriptor)
|
|
398
|
+
.toProperty()
|
|
399
|
+
.combine(
|
|
400
|
+
Kefir.merge([
|
|
401
|
+
this._getRefresher(),
|
|
402
|
+
this._getSubjectRefresher(),
|
|
403
|
+
this._getImageContainerRefresher(),
|
|
404
|
+
])
|
|
405
|
+
)
|
|
406
|
+
.takeUntilBy(this._stopper);
|
|
407
|
+
|
|
249
408
|
let imageMod = null;
|
|
250
|
-
|
|
251
|
-
|
|
409
|
+
|
|
410
|
+
prop.onValue(([iconDescriptor]) => {
|
|
252
411
|
if (!iconDescriptor) {
|
|
253
412
|
if (imageMod) {
|
|
254
413
|
imageMod.remove();
|
|
255
|
-
this._modifications.image.claimed.splice(
|
|
414
|
+
this._modifications.image.claimed.splice(
|
|
415
|
+
this._modifications.image.claimed.indexOf(imageMod),
|
|
416
|
+
1
|
|
417
|
+
);
|
|
256
418
|
imageMod = null;
|
|
257
419
|
}
|
|
258
420
|
} else {
|
|
@@ -264,32 +426,46 @@ class GmailThreadRowView {
|
|
|
264
426
|
iconWrapper: document.createElement('div'),
|
|
265
427
|
remove() {
|
|
266
428
|
this.iconWrapper.remove();
|
|
267
|
-
}
|
|
429
|
+
},
|
|
268
430
|
};
|
|
269
|
-
imageMod.iconWrapper.className =
|
|
431
|
+
imageMod.iconWrapper.className =
|
|
432
|
+
'inboxsdk__thread_row_icon_wrapper';
|
|
270
433
|
}
|
|
271
434
|
this._modifications.image.claimed.push(imageMod);
|
|
272
435
|
}
|
|
273
|
-
const {
|
|
436
|
+
const { iconSettings, iconWrapper } = imageMod;
|
|
437
|
+
|
|
438
|
+
updateIcon(
|
|
274
439
|
iconSettings,
|
|
275
|
-
iconWrapper
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
440
|
+
iconWrapper,
|
|
441
|
+
false,
|
|
442
|
+
iconDescriptor.imageClass,
|
|
443
|
+
iconDescriptor.imageUrl
|
|
444
|
+
);
|
|
445
|
+
|
|
446
|
+
const containerRow =
|
|
447
|
+
this._elements.length === 3 ? this._elements[2] : this._elements[0];
|
|
279
448
|
containerRow.classList.add('inboxsdk__thread_row_image_added');
|
|
449
|
+
|
|
280
450
|
if (iconDescriptor.tooltip) {
|
|
281
451
|
iconWrapper.setAttribute('data-tooltip', iconDescriptor.tooltip);
|
|
282
452
|
} else {
|
|
283
453
|
iconWrapper.removeAttribute('data-tooltip');
|
|
284
454
|
}
|
|
455
|
+
|
|
285
456
|
const labelParent = this._getLabelParent();
|
|
457
|
+
|
|
286
458
|
if (!labelParent.contains(iconWrapper)) {
|
|
287
|
-
(
|
|
459
|
+
querySelector(labelParent, '.y6').insertAdjacentElement(
|
|
460
|
+
'beforebegin',
|
|
461
|
+
iconWrapper
|
|
462
|
+
);
|
|
288
463
|
}
|
|
289
464
|
}
|
|
290
465
|
});
|
|
291
466
|
}
|
|
292
|
-
|
|
467
|
+
|
|
468
|
+
addButton(buttonDescriptor: Object) {
|
|
293
469
|
if (!this._elements.length) {
|
|
294
470
|
console.warn('addButton called on destroyed thread row');
|
|
295
471
|
return;
|
|
@@ -298,8 +474,12 @@ class GmailThreadRowView {
|
|
|
298
474
|
|
|
299
475
|
let activeDropdown = null;
|
|
300
476
|
let buttonMod = null;
|
|
301
|
-
|
|
302
|
-
prop.
|
|
477
|
+
|
|
478
|
+
const prop: Kefir.Observable<?Object> = kefirCast(Kefir, buttonDescriptor)
|
|
479
|
+
.toProperty()
|
|
480
|
+
.takeUntilBy(this._stopper);
|
|
481
|
+
|
|
482
|
+
prop.merge(this._stopper).onValue((buttonDescriptor) => {
|
|
303
483
|
if (!buttonDescriptor) {
|
|
304
484
|
if (activeDropdown) {
|
|
305
485
|
activeDropdown.close();
|
|
@@ -307,18 +487,22 @@ class GmailThreadRowView {
|
|
|
307
487
|
}
|
|
308
488
|
}
|
|
309
489
|
});
|
|
490
|
+
|
|
310
491
|
this._stopper.onValue(() => {
|
|
311
492
|
if (buttonMod && buttonMod.buttonSpan) {
|
|
312
|
-
buttonMod.buttonSpan.onclick = null;
|
|
493
|
+
(buttonMod.buttonSpan: any).onclick = null;
|
|
313
494
|
}
|
|
314
495
|
});
|
|
315
|
-
|
|
316
|
-
|
|
496
|
+
|
|
497
|
+
prop.combine(this._getRefresher()).onValue(([_buttonDescriptor]) => {
|
|
317
498
|
const buttonDescriptor = _buttonDescriptor;
|
|
318
499
|
if (!buttonDescriptor) {
|
|
319
500
|
if (buttonMod) {
|
|
320
501
|
buttonMod.remove();
|
|
321
|
-
this._modifications.button.claimed.splice(
|
|
502
|
+
this._modifications.button.claimed.splice(
|
|
503
|
+
this._modifications.button.claimed.indexOf(buttonMod),
|
|
504
|
+
1
|
|
505
|
+
);
|
|
322
506
|
buttonMod = null;
|
|
323
507
|
}
|
|
324
508
|
} else {
|
|
@@ -327,8 +511,11 @@ class GmailThreadRowView {
|
|
|
327
511
|
buttonDescriptor.iconClass = buttonDescriptor.className;
|
|
328
512
|
delete buttonDescriptor.className;
|
|
329
513
|
}
|
|
514
|
+
|
|
330
515
|
let buttonSpan, iconSettings;
|
|
331
|
-
const buttonToolbar =
|
|
516
|
+
const buttonToolbar =
|
|
517
|
+
this._elements[0].querySelector('ul[role=toolbar]');
|
|
518
|
+
|
|
332
519
|
if (!buttonMod) {
|
|
333
520
|
buttonMod = this._modifications.button.unclaimed.shift();
|
|
334
521
|
if (!buttonMod) {
|
|
@@ -340,34 +527,47 @@ class GmailThreadRowView {
|
|
|
340
527
|
// T-KT is one of the class names on the star button.
|
|
341
528
|
buttonSpan.classList.add('T-KT');
|
|
342
529
|
}
|
|
530
|
+
|
|
343
531
|
buttonSpan.classList.add('inboxsdk__thread_row_button');
|
|
532
|
+
|
|
344
533
|
if (buttonDescriptor.title) {
|
|
345
534
|
buttonSpan.setAttribute('title', buttonDescriptor.title);
|
|
346
535
|
} else {
|
|
347
536
|
buttonSpan.removeAttribute('title');
|
|
348
537
|
}
|
|
349
538
|
buttonSpan.setAttribute('tabindex', '-1');
|
|
350
|
-
buttonSpan.setAttribute(
|
|
351
|
-
|
|
539
|
+
buttonSpan.setAttribute(
|
|
540
|
+
'data-order-hint',
|
|
541
|
+
String(buttonDescriptor.orderHint || 0)
|
|
542
|
+
);
|
|
543
|
+
(buttonSpan: any).addEventListener(
|
|
544
|
+
'onmousedown',
|
|
545
|
+
focusAndNoPropagation
|
|
546
|
+
);
|
|
547
|
+
|
|
352
548
|
iconSettings = {};
|
|
549
|
+
|
|
353
550
|
buttonMod = {
|
|
354
551
|
buttonSpan,
|
|
355
552
|
iconSettings,
|
|
356
|
-
remove: buttonSpan.remove.bind(buttonSpan)
|
|
553
|
+
remove: buttonSpan.remove.bind(buttonSpan),
|
|
357
554
|
};
|
|
358
555
|
}
|
|
359
556
|
this._modifications.button.claimed.push(buttonMod);
|
|
360
557
|
}
|
|
361
558
|
|
|
362
559
|
// could also be trash icon
|
|
363
|
-
const starGroup = buttonToolbar
|
|
560
|
+
const starGroup = buttonToolbar
|
|
561
|
+
? null
|
|
562
|
+
: querySelector(this._elements[0], 'td.apU.xY, td.aqM.xY');
|
|
364
563
|
buttonSpan = buttonMod.buttonSpan;
|
|
365
564
|
iconSettings = buttonMod.iconSettings;
|
|
565
|
+
|
|
366
566
|
if (buttonDescriptor.onClick) {
|
|
367
|
-
buttonSpan.onclick = event => {
|
|
567
|
+
(buttonSpan: any).onclick = (event) => {
|
|
368
568
|
const appEvent = {
|
|
369
|
-
dropdown: null,
|
|
370
|
-
threadRowView: this._userView
|
|
569
|
+
dropdown: (null: ?DropdownView),
|
|
570
|
+
threadRowView: this._userView,
|
|
371
571
|
};
|
|
372
572
|
if (buttonDescriptor.hasDropdown) {
|
|
373
573
|
if (activeDropdown) {
|
|
@@ -379,16 +579,21 @@ class GmailThreadRowView {
|
|
|
379
579
|
} else {
|
|
380
580
|
this._elements[0].classList.add('inboxsdk__dropdown_active');
|
|
381
581
|
this._elements[0].classList.add('buL'); // gmail class to force row button toolbar to be visible
|
|
382
|
-
appEvent.dropdown = activeDropdown = new
|
|
582
|
+
appEvent.dropdown = activeDropdown = new DropdownView(
|
|
583
|
+
new GmailDropdownView(),
|
|
584
|
+
buttonSpan,
|
|
585
|
+
null
|
|
586
|
+
);
|
|
383
587
|
activeDropdown.setPlacementOptions({
|
|
384
588
|
position: 'bottom',
|
|
385
589
|
hAlign: 'left',
|
|
386
|
-
vAlign: 'top'
|
|
590
|
+
vAlign: 'top',
|
|
387
591
|
});
|
|
388
592
|
|
|
389
593
|
// remember this reference before the destroy event and setTimeout
|
|
390
594
|
// because this._elements may be cleared by then.
|
|
391
595
|
const firstEl = this._elements[0];
|
|
596
|
+
|
|
392
597
|
activeDropdown.on('destroy', () => {
|
|
393
598
|
setTimeout(() => {
|
|
394
599
|
firstEl.classList.remove('inboxsdk__dropdown_active');
|
|
@@ -401,11 +606,18 @@ class GmailThreadRowView {
|
|
|
401
606
|
buttonDescriptor.onClick.call(null, appEvent);
|
|
402
607
|
};
|
|
403
608
|
}
|
|
404
|
-
|
|
609
|
+
|
|
610
|
+
updateIcon(
|
|
611
|
+
iconSettings,
|
|
612
|
+
buttonSpan,
|
|
613
|
+
false,
|
|
614
|
+
buttonDescriptor.iconClass,
|
|
615
|
+
buttonDescriptor.iconUrl
|
|
616
|
+
);
|
|
405
617
|
if (buttonToolbar && buttonSpan.parentElement !== buttonToolbar) {
|
|
406
|
-
(
|
|
618
|
+
insertElementInOrder(buttonToolbar, buttonSpan, undefined, true);
|
|
407
619
|
} else if (starGroup && buttonSpan.parentElement !== starGroup) {
|
|
408
|
-
(
|
|
620
|
+
insertElementInOrder(starGroup, buttonSpan);
|
|
409
621
|
this._expandColumn('col.y5', 26 * starGroup.children.length);
|
|
410
622
|
|
|
411
623
|
// Don't let the whole column count as the star for click and mouse over purposes.
|
|
@@ -416,351 +628,525 @@ class GmailThreadRowView {
|
|
|
416
628
|
// Click events that are on one of our buttons should be stopped. Click events
|
|
417
629
|
// that aren't on the star button or our buttons should be re-emitted from the
|
|
418
630
|
// thread row so it counts as clicking on the thread.
|
|
419
|
-
starGroup.onmouseover = starGroup.onclick =
|
|
631
|
+
(starGroup: any).onmouseover = (starGroup: any).onclick =
|
|
632
|
+
starGroupEventInterceptor;
|
|
420
633
|
}
|
|
421
634
|
}
|
|
422
635
|
});
|
|
423
636
|
}
|
|
424
|
-
|
|
637
|
+
|
|
638
|
+
addActionButton(actionButtonDescriptor: Object) {
|
|
425
639
|
if (this._elements.length !== 1) {
|
|
426
640
|
return;
|
|
427
641
|
}
|
|
428
|
-
const prop = (
|
|
642
|
+
const prop: Kefir.Observable<?Object> = kefirCast(
|
|
643
|
+
Kefir,
|
|
644
|
+
actionButtonDescriptor
|
|
645
|
+
)
|
|
646
|
+
.takeUntilBy(this._stopper)
|
|
647
|
+
.toProperty();
|
|
429
648
|
let actionMod = null;
|
|
649
|
+
|
|
430
650
|
this._stopper.onEnd(() => {
|
|
431
651
|
if (actionMod) {
|
|
432
652
|
actionMod.gmailActionButtonView.setOnClick(null);
|
|
433
653
|
}
|
|
434
654
|
});
|
|
435
|
-
|
|
655
|
+
|
|
656
|
+
prop.takeUntilBy(this._stopper).onValue((actionButtonDescriptor) => {
|
|
436
657
|
if (actionButtonDescriptor && actionButtonDescriptor.type !== 'LINK') {
|
|
437
658
|
console.error('Only type=LINK is currently supported');
|
|
438
659
|
return;
|
|
439
660
|
}
|
|
661
|
+
|
|
440
662
|
if (!actionButtonDescriptor) {
|
|
441
663
|
if (actionMod) {
|
|
442
664
|
actionMod.remove();
|
|
443
|
-
this._modifications.action.claimed.splice(
|
|
665
|
+
this._modifications.action.claimed.splice(
|
|
666
|
+
this._modifications.action.claimed.indexOf(actionMod),
|
|
667
|
+
1
|
|
668
|
+
);
|
|
444
669
|
actionMod = null;
|
|
445
670
|
}
|
|
446
671
|
} else {
|
|
447
672
|
if (!actionMod) {
|
|
448
673
|
actionMod = this._modifications.action.unclaimed.shift();
|
|
449
674
|
if (!actionMod) {
|
|
450
|
-
const gmailActionButtonView = new
|
|
675
|
+
const gmailActionButtonView = new GmailActionButtonView();
|
|
451
676
|
const el = gmailActionButtonView.getElement();
|
|
452
677
|
actionMod = {
|
|
453
678
|
gmailActionButtonView,
|
|
454
|
-
remove: el.remove.bind(el)
|
|
679
|
+
remove: el.remove.bind(el),
|
|
455
680
|
};
|
|
456
681
|
}
|
|
457
682
|
this._modifications.action.claimed.push(actionMod);
|
|
458
683
|
}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
} = actionButtonDescriptor;
|
|
464
|
-
actionMod.gmailActionButtonView.setOnClick(event => {
|
|
684
|
+
|
|
685
|
+
actionMod.gmailActionButtonView.updateDescriptor(
|
|
686
|
+
actionButtonDescriptor
|
|
687
|
+
);
|
|
688
|
+
const { url, onClick } = actionButtonDescriptor;
|
|
689
|
+
actionMod.gmailActionButtonView.setOnClick((event) => {
|
|
465
690
|
event.stopPropagation();
|
|
466
691
|
window.open(url, '_blank');
|
|
467
692
|
if (onClick) {
|
|
468
693
|
onClick.call(null, {});
|
|
469
694
|
}
|
|
470
695
|
});
|
|
471
|
-
|
|
696
|
+
|
|
697
|
+
const actionParentDiv =
|
|
698
|
+
this._elements[0].querySelector('td.a4W .a4X .aKS') ||
|
|
699
|
+
this._elements[0].querySelector('td.a4W div.xS');
|
|
472
700
|
if (!actionParentDiv) throw new Error('Failed to find actionParentDiv');
|
|
473
|
-
if (
|
|
474
|
-
|
|
701
|
+
if (
|
|
702
|
+
!includes(
|
|
703
|
+
actionParentDiv.children,
|
|
704
|
+
actionMod.gmailActionButtonView.getElement()
|
|
705
|
+
)
|
|
706
|
+
) {
|
|
707
|
+
actionParentDiv.insertBefore(
|
|
708
|
+
actionMod.gmailActionButtonView.getElement(),
|
|
709
|
+
actionParentDiv.firstChild
|
|
710
|
+
);
|
|
475
711
|
}
|
|
476
712
|
}
|
|
477
713
|
});
|
|
478
714
|
}
|
|
479
|
-
|
|
715
|
+
|
|
716
|
+
addAttachmentIcon(opts: Object) {
|
|
480
717
|
if (!this._elements.length) {
|
|
481
718
|
console.warn('addAttachmentIcon called on destroyed thread row');
|
|
482
719
|
return;
|
|
483
720
|
}
|
|
484
|
-
const getImgElement = (
|
|
721
|
+
const getImgElement = once(() => {
|
|
485
722
|
const img = document.createElement('img');
|
|
486
723
|
img.src = 'images/cleardot.gif';
|
|
487
724
|
return img;
|
|
488
725
|
});
|
|
489
|
-
|
|
726
|
+
|
|
727
|
+
const getCustomIconWrapper = once(() => {
|
|
490
728
|
const div = document.createElement('div');
|
|
491
729
|
return div;
|
|
492
730
|
});
|
|
731
|
+
|
|
493
732
|
var added = false;
|
|
494
733
|
var currentIconUrl;
|
|
495
|
-
|
|
496
|
-
prop.
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
added
|
|
504
|
-
|
|
505
|
-
|
|
734
|
+
|
|
735
|
+
var prop: Kefir.Observable<?Object> = kefirCast(Kefir, opts).toProperty();
|
|
736
|
+
prop
|
|
737
|
+
.combine(this._getRefresher())
|
|
738
|
+
.takeUntilBy(this._stopper)
|
|
739
|
+
.onValue(([opts]) => {
|
|
740
|
+
const attachmentDiv = querySelector(this._elements[0], 'td.yf.xY');
|
|
741
|
+
if (!opts) {
|
|
742
|
+
if (added) {
|
|
743
|
+
getCustomIconWrapper().remove();
|
|
744
|
+
getImgElement().remove();
|
|
745
|
+
added = false;
|
|
746
|
+
|
|
747
|
+
if (
|
|
748
|
+
!attachmentDiv.querySelector(
|
|
749
|
+
'.inboxsdk__thread_row_attachment_icon'
|
|
750
|
+
)
|
|
751
|
+
) {
|
|
752
|
+
attachmentDiv.classList.remove(
|
|
753
|
+
'inboxsdk__thread_row_attachment_icons_present'
|
|
754
|
+
);
|
|
755
|
+
}
|
|
506
756
|
}
|
|
507
|
-
}
|
|
508
|
-
} else {
|
|
509
|
-
const img = opts.iconHtml != null ? getCustomIconWrapper() : getImgElement();
|
|
510
|
-
if (opts.tooltip) {
|
|
511
|
-
img.setAttribute('data-tooltip', opts.tooltip);
|
|
512
757
|
} else {
|
|
513
|
-
img
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
758
|
+
const img =
|
|
759
|
+
opts.iconHtml != null ? getCustomIconWrapper() : getImgElement();
|
|
760
|
+
if (opts.tooltip) {
|
|
761
|
+
img.setAttribute('data-tooltip', opts.tooltip);
|
|
762
|
+
} else {
|
|
763
|
+
img.removeAttribute('data-tooltip');
|
|
519
764
|
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
765
|
+
|
|
766
|
+
img.className =
|
|
767
|
+
opts.iconHtml != null
|
|
768
|
+
? 'inboxsdk__thread_row_addition inboxsdk__thread_row_attachment_iconWrapper ' +
|
|
769
|
+
(opts.iconClass || '')
|
|
770
|
+
: 'inboxsdk__thread_row_addition inboxsdk__thread_row_attachment_icon ' +
|
|
771
|
+
(opts.iconClass || '');
|
|
772
|
+
|
|
773
|
+
if (opts.iconHtml != null) {
|
|
774
|
+
if (attachmentDiv.contains(getImgElement())) {
|
|
775
|
+
getImgElement().remove();
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
img.innerHTML = opts.iconHtml;
|
|
779
|
+
} else if (currentIconUrl != opts.iconUrl) {
|
|
780
|
+
if (attachmentDiv.contains(getCustomIconWrapper())) {
|
|
781
|
+
getCustomIconWrapper().remove();
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
img.style.background = opts.iconUrl
|
|
785
|
+
? 'url(' + opts.iconUrl + ') no-repeat 0 0'
|
|
786
|
+
: '';
|
|
787
|
+
currentIconUrl = opts.iconUrl;
|
|
524
788
|
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
this._fixDateColumnWidth();
|
|
789
|
+
|
|
790
|
+
if (!attachmentDiv.contains(img)) {
|
|
791
|
+
attachmentDiv.appendChild(img);
|
|
792
|
+
added = true;
|
|
793
|
+
this._expandColumn('col.yg', attachmentDiv.children.length * 16);
|
|
794
|
+
if (this._elements.length > 1) {
|
|
795
|
+
this._fixDateColumnWidth();
|
|
796
|
+
}
|
|
534
797
|
}
|
|
798
|
+
attachmentDiv.classList.add(
|
|
799
|
+
'inboxsdk__thread_row_attachment_icons_present'
|
|
800
|
+
);
|
|
535
801
|
}
|
|
536
|
-
|
|
537
|
-
}
|
|
538
|
-
});
|
|
802
|
+
});
|
|
539
803
|
}
|
|
804
|
+
|
|
540
805
|
_fixDateColumnWidth() {
|
|
541
|
-
(
|
|
806
|
+
asap(() => {
|
|
542
807
|
if (!this._elements.length) return;
|
|
543
|
-
|
|
808
|
+
|
|
809
|
+
const dateContainer = this._elements[0].querySelector(
|
|
810
|
+
'td.xW, td.yf > div.apm'
|
|
811
|
+
);
|
|
544
812
|
if (!dateContainer) return;
|
|
545
|
-
const visibleDateSpan =
|
|
813
|
+
const visibleDateSpan =
|
|
814
|
+
dateContainer.querySelector('.inboxsdk__thread_row_custom_date') ||
|
|
815
|
+
dateContainer.firstElementChild;
|
|
546
816
|
if (!visibleDateSpan || !(visibleDateSpan instanceof HTMLElement)) return;
|
|
547
817
|
|
|
548
818
|
// Attachment icons are only in the date column in vertical preivew pane.
|
|
549
|
-
const dateColumnAttachmentIconCount =
|
|
550
|
-
|
|
819
|
+
const dateColumnAttachmentIconCount =
|
|
820
|
+
this._elements[0].querySelectorAll('td.yf > img').length;
|
|
821
|
+
this._expandColumn(
|
|
822
|
+
'col.xX',
|
|
823
|
+
visibleDateSpan.offsetWidth +
|
|
824
|
+
8 +
|
|
825
|
+
2 +
|
|
826
|
+
20 +
|
|
827
|
+
dateColumnAttachmentIconCount * 16
|
|
828
|
+
);
|
|
551
829
|
});
|
|
552
830
|
}
|
|
553
|
-
|
|
831
|
+
|
|
832
|
+
replaceDraftLabel(opts: Object) {
|
|
554
833
|
if (!this._elements.length) {
|
|
555
834
|
console.warn('replaceDraftLabel called on destroyed thread row');
|
|
556
835
|
return;
|
|
557
836
|
}
|
|
558
837
|
let labelMod;
|
|
559
838
|
let draftElement, countElement;
|
|
560
|
-
const prop = (
|
|
561
|
-
prop
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
if (
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
labelMod
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
labelMod = this._modifications.replacedDraftLabel.unclaimed.shift();
|
|
578
|
-
if (!labelMod) {
|
|
579
|
-
labelMod = {
|
|
580
|
-
el: Object.assign(document.createElement('span'), {
|
|
581
|
-
className: 'inboxsdk__thread_row_custom_draft_label'
|
|
582
|
-
}),
|
|
583
|
-
remove() {
|
|
584
|
-
this.el.remove();
|
|
585
|
-
}
|
|
586
|
-
};
|
|
839
|
+
const prop: Kefir.Observable<?Object> = kefirCast(Kefir, opts).toProperty();
|
|
840
|
+
prop
|
|
841
|
+
.combine(this._getRefresher())
|
|
842
|
+
.takeUntilBy(this._stopper)
|
|
843
|
+
.onValue(([opts]) => {
|
|
844
|
+
const originalLabel = querySelector(this._elements[0], 'td > div.yW');
|
|
845
|
+
const recipientsContainer = originalLabel.parentElement;
|
|
846
|
+
if (!recipientsContainer) throw new Error('Should not happen');
|
|
847
|
+
|
|
848
|
+
if (!opts) {
|
|
849
|
+
if (labelMod) {
|
|
850
|
+
labelMod.remove();
|
|
851
|
+
this._modifications.replacedDraftLabel.claimed.splice(
|
|
852
|
+
this._modifications.replacedDraftLabel.claimed.indexOf(labelMod),
|
|
853
|
+
1
|
|
854
|
+
);
|
|
855
|
+
labelMod = null;
|
|
587
856
|
}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
if (!draftElement) {
|
|
603
|
-
return;
|
|
857
|
+
} else {
|
|
858
|
+
opts = Object.assign({ count: 1 }, opts);
|
|
859
|
+
|
|
860
|
+
if (!labelMod) {
|
|
861
|
+
labelMod = this._modifications.replacedDraftLabel.unclaimed.shift();
|
|
862
|
+
if (!labelMod) {
|
|
863
|
+
labelMod = {
|
|
864
|
+
el: Object.assign(document.createElement('span'), {
|
|
865
|
+
className: 'inboxsdk__thread_row_custom_draft_label',
|
|
866
|
+
}),
|
|
867
|
+
remove() {
|
|
868
|
+
this.el.remove();
|
|
869
|
+
},
|
|
870
|
+
};
|
|
604
871
|
}
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
872
|
+
this._modifications.replacedDraftLabel.claimed.push(labelMod);
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
const needToAdd = !includes(
|
|
876
|
+
recipientsContainer.children,
|
|
877
|
+
labelMod.el
|
|
878
|
+
);
|
|
879
|
+
|
|
880
|
+
if (needToAdd || !draftElement) {
|
|
881
|
+
labelMod.el.innerHTML = originalLabel.innerHTML;
|
|
882
|
+
const materiaUIlDraftElements = Array.from(
|
|
883
|
+
labelMod.el.querySelectorAll('.boq')
|
|
884
|
+
);
|
|
885
|
+
if (materiaUIlDraftElements.length > 0) {
|
|
886
|
+
materiaUIlDraftElements.forEach((el) => el.remove());
|
|
887
|
+
draftElement = Object.assign(document.createElement('span'), {
|
|
888
|
+
className: 'boq',
|
|
889
|
+
});
|
|
890
|
+
labelMod.el.appendChild(draftElement);
|
|
891
|
+
} else {
|
|
892
|
+
draftElement = labelMod.el.querySelector('font');
|
|
893
|
+
if (!draftElement) {
|
|
894
|
+
return;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
const nextSibling = draftElement.nextElementSibling;
|
|
898
|
+
if (nextSibling) {
|
|
899
|
+
nextSibling.remove();
|
|
900
|
+
}
|
|
608
901
|
}
|
|
902
|
+
|
|
903
|
+
draftElement.classList.add(
|
|
904
|
+
'inboxsdk__thread_row_custom_draft_part'
|
|
905
|
+
);
|
|
906
|
+
|
|
907
|
+
countElement = Object.assign(document.createElement('span'), {
|
|
908
|
+
className: 'inboxsdk__thread_row_custom_draft_count',
|
|
909
|
+
});
|
|
910
|
+
labelMod.el.appendChild(countElement);
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
draftElement.textContent = opts.text;
|
|
914
|
+
countElement.textContent = opts.count !== 1 ? ` (${opts.count})` : '';
|
|
915
|
+
|
|
916
|
+
if (needToAdd) {
|
|
917
|
+
recipientsContainer.insertBefore(labelMod.el, originalLabel);
|
|
609
918
|
}
|
|
610
|
-
draftElement.classList.add('inboxsdk__thread_row_custom_draft_part');
|
|
611
|
-
countElement = Object.assign(document.createElement('span'), {
|
|
612
|
-
className: 'inboxsdk__thread_row_custom_draft_count'
|
|
613
|
-
});
|
|
614
|
-
labelMod.el.appendChild(countElement);
|
|
615
|
-
}
|
|
616
|
-
draftElement.textContent = opts.text;
|
|
617
|
-
countElement.textContent = opts.count !== 1 ? ` (${opts.count})` : '';
|
|
618
|
-
if (needToAdd) {
|
|
619
|
-
recipientsContainer.insertBefore(labelMod.el, originalLabel);
|
|
620
919
|
}
|
|
621
|
-
}
|
|
622
|
-
});
|
|
920
|
+
});
|
|
623
921
|
}
|
|
624
|
-
|
|
922
|
+
|
|
923
|
+
replaceDate(opts: Object) {
|
|
625
924
|
if (!this._elements.length) {
|
|
626
925
|
console.warn('replaceDate called on destroyed thread row');
|
|
627
926
|
return;
|
|
628
927
|
}
|
|
629
928
|
let dateMod;
|
|
630
|
-
const prop = (
|
|
631
|
-
prop
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
remove() {
|
|
650
|
-
this.el.remove();
|
|
651
|
-
dateContainer.classList.remove('inboxsdk__thread_row_custom_date_container');
|
|
652
|
-
}
|
|
653
|
-
};
|
|
929
|
+
const prop: Kefir.Observable<?Object> = kefirCast(Kefir, opts).toProperty();
|
|
930
|
+
prop
|
|
931
|
+
.combine(this._getRefresher())
|
|
932
|
+
.takeUntilBy(this._stopper)
|
|
933
|
+
.onValue(([opts]) => {
|
|
934
|
+
const dateContainer = querySelector(
|
|
935
|
+
this._elements[0],
|
|
936
|
+
'td.xW, td.yf > div.apm'
|
|
937
|
+
);
|
|
938
|
+
const originalDateSpan = dateContainer.firstElementChild;
|
|
939
|
+
|
|
940
|
+
if (!opts) {
|
|
941
|
+
if (dateMod) {
|
|
942
|
+
dateMod.remove();
|
|
943
|
+
this._modifications.replacedDate.claimed.splice(
|
|
944
|
+
this._modifications.replacedDate.claimed.indexOf(dateMod),
|
|
945
|
+
1
|
|
946
|
+
);
|
|
947
|
+
dateMod = null;
|
|
654
948
|
}
|
|
655
|
-
this._modifications.replacedDate.claimed.push(dateMod);
|
|
656
|
-
}
|
|
657
|
-
dateMod.el.textContent = opts.text;
|
|
658
|
-
if (opts.tooltip) {
|
|
659
|
-
dateMod.el.setAttribute('data-tooltip', opts.tooltip);
|
|
660
|
-
dateMod.el.setAttribute('aria-label', opts.tooltip);
|
|
661
949
|
} else {
|
|
662
|
-
dateMod
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
950
|
+
if (!dateMod) {
|
|
951
|
+
dateMod = this._modifications.replacedDate.unclaimed.shift();
|
|
952
|
+
if (!dateMod) {
|
|
953
|
+
dateMod = {
|
|
954
|
+
el: Object.assign(document.createElement('span'), {
|
|
955
|
+
className: 'inboxsdk__thread_row_custom_date',
|
|
956
|
+
}),
|
|
957
|
+
remove() {
|
|
958
|
+
this.el.remove();
|
|
959
|
+
dateContainer.classList.remove(
|
|
960
|
+
'inboxsdk__thread_row_custom_date_container'
|
|
961
|
+
);
|
|
962
|
+
},
|
|
963
|
+
};
|
|
964
|
+
}
|
|
965
|
+
this._modifications.replacedDate.claimed.push(dateMod);
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
dateMod.el.textContent = opts.text;
|
|
969
|
+
if (opts.tooltip) {
|
|
970
|
+
dateMod.el.setAttribute('data-tooltip', opts.tooltip);
|
|
971
|
+
dateMod.el.setAttribute('aria-label', opts.tooltip);
|
|
972
|
+
} else {
|
|
973
|
+
dateMod.el.removeAttribute('data-tooltip');
|
|
974
|
+
dateMod.el.removeAttribute('aria-label');
|
|
975
|
+
}
|
|
976
|
+
dateMod.el.style.color = opts.textColor || '';
|
|
977
|
+
|
|
978
|
+
if (!includes(dateContainer.children, dateMod.el)) {
|
|
979
|
+
dateContainer.insertBefore(dateMod.el, dateContainer.firstChild);
|
|
980
|
+
dateContainer.classList.add(
|
|
981
|
+
'inboxsdk__thread_row_custom_date_container'
|
|
982
|
+
);
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
this._fixDateColumnWidth();
|
|
669
986
|
}
|
|
670
|
-
|
|
671
|
-
}
|
|
672
|
-
});
|
|
987
|
+
});
|
|
673
988
|
}
|
|
674
|
-
|
|
989
|
+
|
|
990
|
+
getEventStream(): Kefir.Observable<any> {
|
|
675
991
|
return this._stopper;
|
|
676
992
|
}
|
|
677
|
-
|
|
993
|
+
|
|
994
|
+
getStopper(): Kefir.Observable<any> {
|
|
678
995
|
return this._stopper;
|
|
679
996
|
}
|
|
680
|
-
|
|
997
|
+
|
|
998
|
+
getSubject(): string {
|
|
681
999
|
if (this._elements.length > 1) {
|
|
682
|
-
return (
|
|
1000
|
+
return querySelector(this._elements[1], 'div.xS div.xT div.y6 > span[id]')
|
|
1001
|
+
.textContent;
|
|
683
1002
|
} else {
|
|
684
|
-
return (
|
|
1003
|
+
return querySelector(
|
|
1004
|
+
this._elements[0],
|
|
1005
|
+
'td.a4W div.xS div.xT div.y6 > span[id]'
|
|
1006
|
+
).textContent;
|
|
685
1007
|
}
|
|
686
1008
|
}
|
|
687
|
-
|
|
688
|
-
|
|
1009
|
+
|
|
1010
|
+
getDateString(): string {
|
|
1011
|
+
return querySelector(
|
|
1012
|
+
this._elements[0],
|
|
1013
|
+
'td.xW > span[title]:not(.inboxsdk__thread_row_custom_date), td.yf.apt > div.apm > span[title]:not(.inboxsdk__thread_row_custom_date)'
|
|
1014
|
+
).title;
|
|
689
1015
|
}
|
|
690
|
-
|
|
1016
|
+
|
|
1017
|
+
_threadIdReady(): boolean {
|
|
691
1018
|
return !!this._getThreadID();
|
|
692
1019
|
}
|
|
693
|
-
|
|
1020
|
+
|
|
1021
|
+
_getThreadID(): ?string {
|
|
694
1022
|
if (this._cachedThreadID) {
|
|
695
1023
|
return this._cachedThreadID;
|
|
696
1024
|
}
|
|
1025
|
+
|
|
697
1026
|
if (this._driver.isUsingSyncAPI()) {
|
|
698
|
-
const elementWithId = (
|
|
1027
|
+
const elementWithId = flatten(
|
|
1028
|
+
this._elements.map((el) =>
|
|
1029
|
+
Array.from(
|
|
1030
|
+
el.querySelectorAll('[data-thread-id][data-legacy-thread-id]')
|
|
1031
|
+
)
|
|
1032
|
+
)
|
|
1033
|
+
).filter(Boolean)[0];
|
|
1034
|
+
|
|
699
1035
|
if (elementWithId) {
|
|
700
|
-
this._cachedSyncThreadID = elementWithId
|
|
701
|
-
|
|
1036
|
+
this._cachedSyncThreadID = elementWithId
|
|
1037
|
+
.getAttribute('data-thread-id')
|
|
1038
|
+
.replace('#', '');
|
|
1039
|
+
this._cachedThreadID = elementWithId
|
|
1040
|
+
.getAttribute('data-legacy-thread-id')
|
|
1041
|
+
.replace('#', '');
|
|
1042
|
+
|
|
702
1043
|
return this._cachedThreadID;
|
|
703
1044
|
} else {
|
|
704
|
-
const threadID = this._driver
|
|
1045
|
+
const threadID = this._driver
|
|
1046
|
+
.getThreadRowIdentifier()
|
|
1047
|
+
.getThreadIdForThreadRow(this, this._elements);
|
|
705
1048
|
this._cachedSyncThreadID = threadID;
|
|
1049
|
+
|
|
706
1050
|
if (threadID) {
|
|
707
|
-
this._driver
|
|
708
|
-
|
|
709
|
-
|
|
1051
|
+
this._driver
|
|
1052
|
+
.getOldGmailThreadIdFromSyncThreadId(threadID)
|
|
1053
|
+
.then((oldGmailThreadID) => {
|
|
1054
|
+
this._cachedThreadID = oldGmailThreadID;
|
|
1055
|
+
});
|
|
710
1056
|
}
|
|
711
1057
|
}
|
|
712
1058
|
} else {
|
|
713
|
-
this._cachedThreadID = this._driver
|
|
1059
|
+
this._cachedThreadID = this._driver
|
|
1060
|
+
.getThreadRowIdentifier()
|
|
1061
|
+
.getThreadIdForThreadRow(this, this._elements);
|
|
714
1062
|
}
|
|
1063
|
+
|
|
715
1064
|
return this._cachedThreadID;
|
|
716
1065
|
}
|
|
717
|
-
|
|
1066
|
+
|
|
1067
|
+
getThreadID(): string {
|
|
718
1068
|
const threadID = this._getThreadID();
|
|
719
1069
|
if (!threadID) {
|
|
720
1070
|
throw new Error('Should not happen: thread id was null');
|
|
721
1071
|
}
|
|
722
1072
|
return threadID;
|
|
723
1073
|
}
|
|
724
|
-
|
|
1074
|
+
|
|
1075
|
+
getSyncThreadID(): Promise<?string> {
|
|
725
1076
|
return Promise.resolve(this._cachedSyncThreadID);
|
|
726
1077
|
}
|
|
727
|
-
|
|
1078
|
+
|
|
1079
|
+
async getThreadIDAsync(): Promise<string> {
|
|
728
1080
|
return this.getThreadID();
|
|
729
1081
|
}
|
|
730
|
-
|
|
1082
|
+
|
|
1083
|
+
getDraftID(): Promise<?string> {
|
|
731
1084
|
if (this._cachedSyncDraftIDPromise) return this._cachedSyncDraftIDPromise;
|
|
1085
|
+
|
|
732
1086
|
if (this._driver.isUsingSyncAPI()) {
|
|
733
|
-
const elementWithId = (
|
|
734
|
-
|
|
1087
|
+
const elementWithId = flatten(
|
|
1088
|
+
this._elements.map((el) =>
|
|
1089
|
+
Array.from(el.querySelectorAll('[data-standalone-draft-id]'))
|
|
1090
|
+
)
|
|
1091
|
+
).filter(Boolean)[0];
|
|
1092
|
+
|
|
1093
|
+
this._cachedSyncDraftIDPromise = Promise.resolve(
|
|
1094
|
+
elementWithId
|
|
1095
|
+
? elementWithId
|
|
1096
|
+
.getAttribute('data-standalone-draft-id')
|
|
1097
|
+
.replace('#msg-a:', '')
|
|
1098
|
+
: null
|
|
1099
|
+
);
|
|
735
1100
|
} else {
|
|
736
|
-
this._cachedSyncDraftIDPromise = this._driver
|
|
1101
|
+
this._cachedSyncDraftIDPromise = this._driver
|
|
1102
|
+
.getThreadRowIdentifier()
|
|
1103
|
+
.getDraftIdForThreadRow(this);
|
|
737
1104
|
}
|
|
1105
|
+
|
|
738
1106
|
return this._cachedSyncDraftIDPromise;
|
|
739
1107
|
}
|
|
740
|
-
|
|
1108
|
+
|
|
1109
|
+
getVisibleDraftCount(): number {
|
|
741
1110
|
return this.getCounts().draftCount;
|
|
742
1111
|
}
|
|
743
|
-
|
|
1112
|
+
|
|
1113
|
+
getVisibleMessageCount(): number {
|
|
744
1114
|
return this.getCounts().messageCount;
|
|
745
1115
|
}
|
|
746
|
-
|
|
1116
|
+
|
|
1117
|
+
getContacts(): Contact[] {
|
|
747
1118
|
const senderSpans = this._elements[0].querySelectorAll('[email]');
|
|
748
|
-
|
|
1119
|
+
|
|
1120
|
+
const contacts = Array.from(senderSpans).map((span) => ({
|
|
749
1121
|
emailAddress: span.getAttribute('email'),
|
|
750
|
-
name: span.getAttribute('name')
|
|
1122
|
+
name: span.getAttribute('name'),
|
|
751
1123
|
}));
|
|
752
|
-
|
|
1124
|
+
|
|
1125
|
+
return uniqBy(contacts, (contact) => contact.emailAddress);
|
|
753
1126
|
}
|
|
754
|
-
|
|
755
|
-
|
|
1127
|
+
|
|
1128
|
+
isSelected(): boolean {
|
|
1129
|
+
return !!this._elements[0].querySelector(
|
|
1130
|
+
'div[role=checkbox][aria-checked=true]'
|
|
1131
|
+
);
|
|
756
1132
|
}
|
|
757
|
-
|
|
758
|
-
|
|
1133
|
+
|
|
1134
|
+
_getLabelParent(): HTMLElement {
|
|
1135
|
+
return this._elements.length > 1
|
|
1136
|
+
? querySelector(
|
|
1137
|
+
this._elements[this._elements.length === 2 ? 0 : 2],
|
|
1138
|
+
'div.apu'
|
|
1139
|
+
)
|
|
1140
|
+
: querySelector(this._elements[0], 'td.a4W div.xS div.xT');
|
|
759
1141
|
}
|
|
760
|
-
|
|
761
|
-
|
|
1142
|
+
|
|
1143
|
+
_getWatchElement(): HTMLElement {
|
|
1144
|
+
return this._elements.length === 1
|
|
1145
|
+
? this._elements[0]
|
|
1146
|
+
: (this._elements[0].children[2]: any);
|
|
762
1147
|
}
|
|
763
|
-
|
|
1148
|
+
|
|
1149
|
+
_getRefresher(): Kefir.Observable<any> {
|
|
764
1150
|
// Stream that emits an event after whenever Gmail replaces the ThreadRow DOM
|
|
765
1151
|
// nodes. One time this happens is when you have a new email in your inbox,
|
|
766
1152
|
// you read the email, return to the inbox, get another email, and then the
|
|
@@ -771,53 +1157,89 @@ class GmailThreadRowView {
|
|
|
771
1157
|
// us a little bit of work.
|
|
772
1158
|
let refresher = this._refresher;
|
|
773
1159
|
if (!refresher) {
|
|
774
|
-
refresher = this._refresher = (
|
|
775
|
-
|
|
776
|
-
|
|
1160
|
+
refresher = this._refresher = makeMutationObserverChunkedStream(
|
|
1161
|
+
this._getWatchElement(),
|
|
1162
|
+
{
|
|
1163
|
+
childList: true,
|
|
1164
|
+
}
|
|
1165
|
+
)
|
|
1166
|
+
.map(() => null)
|
|
1167
|
+
.takeUntilBy(this._stopper)
|
|
1168
|
+
.toProperty(() => null);
|
|
777
1169
|
}
|
|
1170
|
+
|
|
778
1171
|
return refresher;
|
|
779
1172
|
}
|
|
780
|
-
|
|
1173
|
+
|
|
1174
|
+
_getSubjectRefresher(): Kefir.Observable<any> {
|
|
781
1175
|
// emit an event whenever the subject element is swapped out for a new one.
|
|
782
1176
|
let subjectRefresher = this._subjectRefresher;
|
|
783
1177
|
if (!subjectRefresher) {
|
|
784
1178
|
if (this._isVertical) {
|
|
785
|
-
subjectRefresher = this._subjectRefresher =
|
|
1179
|
+
subjectRefresher = this._subjectRefresher = Kefir.constant(null);
|
|
786
1180
|
} else {
|
|
787
1181
|
const watchElement = this._getWatchElement();
|
|
788
|
-
const subjectElement = (
|
|
789
|
-
subjectRefresher = this._subjectRefresher =
|
|
790
|
-
|
|
791
|
-
|
|
1182
|
+
const subjectElement = querySelector(watchElement, '.y6');
|
|
1183
|
+
subjectRefresher = this._subjectRefresher =
|
|
1184
|
+
makeMutationObserverChunkedStream(subjectElement, {
|
|
1185
|
+
childList: true,
|
|
1186
|
+
})
|
|
1187
|
+
.map(() => null)
|
|
1188
|
+
.takeUntilBy(this._stopper)
|
|
1189
|
+
.toProperty(() => null);
|
|
792
1190
|
}
|
|
793
1191
|
}
|
|
1192
|
+
|
|
794
1193
|
return subjectRefresher;
|
|
795
1194
|
}
|
|
796
|
-
|
|
1195
|
+
|
|
1196
|
+
_getImageContainerRefresher(): Kefir.Observable<any> {
|
|
797
1197
|
let imageRefresher = this._imageRefresher;
|
|
798
1198
|
if (!imageRefresher) {
|
|
799
1199
|
if (this._isVertical) {
|
|
800
|
-
const containerRow =
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
1200
|
+
const containerRow =
|
|
1201
|
+
this._elements.length === 3 ? this._elements[2] : this._elements[0];
|
|
1202
|
+
const classChangeStream = makeMutationObserverChunkedStream(
|
|
1203
|
+
containerRow,
|
|
1204
|
+
{
|
|
1205
|
+
attributes: true,
|
|
1206
|
+
attributeFilter: ['class'],
|
|
1207
|
+
}
|
|
1208
|
+
);
|
|
1209
|
+
|
|
1210
|
+
imageRefresher = this._imageRefresher = classChangeStream
|
|
1211
|
+
.bufferBy(classChangeStream.flatMapLatest(() => delayAsap()))
|
|
1212
|
+
.filter(
|
|
1213
|
+
() =>
|
|
1214
|
+
containerRow.querySelectorAll(
|
|
1215
|
+
'.inboxsdk__thread_row_icon_wrapper'
|
|
1216
|
+
).length > 0 &&
|
|
1217
|
+
!containerRow.classList.contains(
|
|
1218
|
+
'inboxsdk__thread_row_image_added'
|
|
1219
|
+
)
|
|
1220
|
+
)
|
|
1221
|
+
.map(() => null)
|
|
1222
|
+
.takeUntilBy(this._stopper)
|
|
1223
|
+
.toProperty(() => null);
|
|
806
1224
|
} else {
|
|
807
|
-
imageRefresher = this._imageRefresher =
|
|
1225
|
+
imageRefresher = this._imageRefresher = Kefir.constant(null);
|
|
808
1226
|
}
|
|
809
1227
|
}
|
|
1228
|
+
|
|
810
1229
|
return imageRefresher;
|
|
811
1230
|
}
|
|
812
1231
|
}
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
1232
|
+
|
|
1233
|
+
export default defn(module, GmailThreadRowView);
|
|
1234
|
+
|
|
1235
|
+
export function removeAllThreadRowUnclaimedModifications() {
|
|
816
1236
|
// run in a setTimeout so that the thread rows get destroyed
|
|
817
1237
|
// and populate the unclaimed modifications
|
|
818
1238
|
setTimeout(() => {
|
|
819
|
-
const modifiedRows = document.querySelectorAll(
|
|
820
|
-
|
|
1239
|
+
const modifiedRows = document.querySelectorAll(
|
|
1240
|
+
'tr[data-inboxsdk-thread-row]'
|
|
1241
|
+
);
|
|
1242
|
+
Array.prototype.forEach.call(modifiedRows, (row) => {
|
|
821
1243
|
const modifications = cachedModificationsByRow.get(row);
|
|
822
1244
|
if (modifications) {
|
|
823
1245
|
_removeThreadRowUnclaimedModifications(modifications);
|
|
@@ -825,6 +1247,7 @@ function removeAllThreadRowUnclaimedModifications() {
|
|
|
825
1247
|
});
|
|
826
1248
|
}, 15);
|
|
827
1249
|
}
|
|
1250
|
+
|
|
828
1251
|
function _removeThreadRowUnclaimedModifications(modifications) {
|
|
829
1252
|
for (let ii = 0; ii < modifications.label.unclaimed.length; ii++) {
|
|
830
1253
|
const mod = modifications.label.unclaimed[ii];
|
|
@@ -844,15 +1267,21 @@ function _removeThreadRowUnclaimedModifications(modifications) {
|
|
|
844
1267
|
mod.remove();
|
|
845
1268
|
}
|
|
846
1269
|
modifications.image.unclaimed.length = 0;
|
|
1270
|
+
|
|
847
1271
|
for (let ii = 0; ii < modifications.replacedDate.unclaimed.length; ii++) {
|
|
848
1272
|
const mod = modifications.replacedDate.unclaimed[ii];
|
|
849
1273
|
//console.log('removing unclaimed replacedDate mod', mod);
|
|
850
1274
|
mod.remove();
|
|
851
1275
|
}
|
|
852
1276
|
modifications.replacedDate.unclaimed.length = 0;
|
|
853
|
-
|
|
1277
|
+
|
|
1278
|
+
for (
|
|
1279
|
+
let ii = 0;
|
|
1280
|
+
ii < modifications.replacedDraftLabel.unclaimed.length;
|
|
1281
|
+
ii++
|
|
1282
|
+
) {
|
|
854
1283
|
const mod = modifications.replacedDraftLabel.unclaimed[ii];
|
|
855
1284
|
mod.remove();
|
|
856
1285
|
}
|
|
857
1286
|
modifications.replacedDraftLabel.unclaimed.length = 0;
|
|
858
|
-
}
|
|
1287
|
+
}
|