@inboxsdk/core 0.2.28-alpha.4 → 0.2.28-alpha.5
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 +1 -1
- package/package.json +5 -1
- package/src/inboxsdk-js/check-requirements.js +7 -3
- package/src/inboxsdk-js/header.js +1 -0
- package/src/inboxsdk-js/inboxsdk-NONREMOTE-INTEGRATED-PAGEWORLD.js +5 -6
- package/src/inboxsdk-js/inboxsdk-NONREMOTE.js +4 -3
- package/src/inboxsdk-js/inboxsdk-REMOTE.js +3 -1
- package/src/inboxsdk-js/inboxsdk-TEST.js +4 -3
- package/src/inboxsdk-js/inboxsdk.js +33 -39
- package/src/inboxsdk-js/loading/load-platform-implementation-DEV.js +15 -18
- package/src/injected-js/gmail/modify-suggestions.test.js +8 -9
- package/src/injected-js/gmail/setup-gmail-interceptor.js +340 -579
- package/src/injected-js/gmail/sync-compose-request-processor.test.js +39 -49
- package/src/injected-js/gmail/thread-identifier/click-and-get-popup-url.js +20 -33
- package/src/injected-js/gmail/thread-identifier/index.js +57 -93
- package/src/injected-js/gmail/thread-identifier/thread-row-parser.js +22 -31
- package/src/injected-js/gmail/thread-identifier/thread-row-parser.test.js +12 -28
- package/src/injected-js/inbox/setupAjaxInterceptor.js +64 -121
- package/src/injected-js/inbox/setupClickAndGetNewIframeSrc.js +53 -66
- package/src/injected-js/inbox/setupComposeViewDraftIDFinder.js +20 -36
- package/src/injected-js/inbox/setupInboxFakeWindowResizeListener.js +13 -13
- package/src/injected-js/main.js +11 -24
- package/src/injected-js/message-metadata-holder.js +52 -82
- package/src/injected-js/setup-data-exposer.js +89 -148
- package/src/injected-js/setup-error-silencer.js +21 -21
- package/src/injected-js/setup-event-reemitter.js +30 -22
- package/src/injected-js/setupInboxCustomViewLinkFixer.js +24 -29
- package/src/injected-js/setupPushStateListener.js +18 -11
- package/src/injected-js/xhr-helper.js +62 -65
- package/src/injected-js/xhr-proxy-factory.js +195 -445
- package/src/injected-js/xhr-proxy-factory.test.js +824 -991
- package/src/platform-implementation-js/constants/router.js +14 -9
- package/src/platform-implementation-js/constants/toolbars.js +8 -3
- 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 +115 -136
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-toolbar-button-for-app.js +13 -14
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/create-link.js +27 -48
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-draft-id-for-message-id.js +31 -42
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-native-nav-item.js +30 -40
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-url-object.js +10 -18
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadForOldGmailThreadId.js +21 -28
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadFromSyncThreadId.js +33 -45
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/gmail-load-event.js +31 -49
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/goto-view.js +58 -65
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/keyboard-shortcut-help-modifier.js +40 -124
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-compose-window.js +17 -22
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-draft-by-message-id.test.js +10 -11
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/override-gmail-back-button.js +44 -80
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/register-search-query-rewriter.js +19 -26
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/register-search-suggestions-provider.js +71 -147
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-compose-view-driver-stream.js +91 -148
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-route-view-driver-stream.js +150 -166
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-route-view-driver-stream.test.js +70 -120
- 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 +44 -67
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-thread-list.js +230 -379
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-thread-list.test.js +121 -307
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-native-route-view.js +17 -24
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/suppressAddon.js +41 -49
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/temporary-track-download-url-validity.js +30 -40
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/thread-row-identifier.js +28 -60
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-events.js +61 -133
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/user-info.js +30 -42
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/user-info.test.js +52 -46
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.js +354 -694
- package/src/platform-implementation-js/dom-driver/gmail/make-xhr-interceptor.js +77 -93
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.js +35 -82
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.test.js +44 -94
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-companion-global-icon-area.js +12 -19
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-companion-thread-icon-area.js +17 -29
- 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 +391 -797
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view/monitor-top-banner-size-and-react.js +7 -9
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view.js +60 -109
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-area-view.js +95 -135
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-card-view.js +103 -211
- 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 +188 -541
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-button.js +67 -135
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-compose-notice.js +27 -49
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-inner-sidebar.js +7 -13
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-outer-sidebar.js +9 -22
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-recipient-row.js +36 -63
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-tooltip-to-button.js +38 -113
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/ensure-app-button-toolbars-are-closed.js +11 -16
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/ensure-grouping-is-open.js +11 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/focus.js +8 -11
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/from-manager.js +27 -47
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-additional-action-toolbar.js +11 -24
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-address-changes-stream.js +59 -111
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-body-changes-stream.js +15 -14
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-formatting-area-offset-left.js +11 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-minimized-stream.js +18 -24
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-response-type-changes-stream.js +19 -23
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/insert-link-into-body.js +11 -19
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/manage-button-grouping.js +141 -376
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/monitor-selection-range.js +17 -28
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/override-edit-subject.js +34 -70
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/position-formatting-toolbar.js +10 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/size-fixer.js +83 -137
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/update-insert-more-area-left.js +10 -19
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view.js +632 -1190
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view/get-updated-contact.js +29 -38
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view.js +327 -617
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-processor.js +26 -49
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-view.js +188 -380
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-row-list-view.js +104 -194
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-row-view.js +382 -811
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view/add-icon-area.js +34 -58
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.js +330 -581
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.test.js +123 -277
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view/width-manager.js +15 -35
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view.js +216 -571
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-toolbar-view.js +152 -336
- package/src/platform-implementation-js/dom-driver/gmail/views/native-gmail-nav-item-view.js +87 -211
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/inbox-dropdown-button-view.js +10 -11
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-action-button-view.js +20 -29
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-label-view.js +41 -76
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-modal-view-driver.js +45 -99
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-mole-view-driver.js +76 -128
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-tooltip-view.js +128 -319
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-top-message-bar-driver.js +45 -78
- package/src/platform-implementation-js/dom-driver/inbox/__mocks__/getSidebarClassnames.js +8 -4
- package/src/platform-implementation-js/dom-driver/inbox/addNavItem.js +36 -54
- package/src/platform-implementation-js/dom-driver/inbox/addRecipientRow.js +35 -53
- package/src/platform-implementation-js/dom-driver/inbox/createLink.js +13 -15
- package/src/platform-implementation-js/dom-driver/inbox/createLink.test.js +15 -18
- package/src/platform-implementation-js/dom-driver/inbox/custom-style.js +14 -13
- package/src/platform-implementation-js/dom-driver/inbox/detection/appToolbarLocation/parser.js +14 -20
- package/src/platform-implementation-js/dom-driver/inbox/detection/attachmentCard/parser.js +14 -13
- package/src/platform-implementation-js/dom-driver/inbox/detection/attachmentOverlay/parser.js +35 -67
- package/src/platform-implementation-js/dom-driver/inbox/detection/chatSidebar/parser.js +16 -18
- package/src/platform-implementation-js/dom-driver/inbox/detection/compose/parser.js +68 -185
- package/src/platform-implementation-js/dom-driver/inbox/detection/message/parser.js +28 -56
- package/src/platform-implementation-js/dom-driver/inbox/detection/nativeDrawer/parser.js +12 -10
- 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 +24 -35
- package/src/platform-implementation-js/dom-driver/inbox/detection/thread-row/parser.js +37 -89
- package/src/platform-implementation-js/dom-driver/inbox/getComposeViewDriverLiveSet.js +56 -78
- package/src/platform-implementation-js/dom-driver/inbox/getInboxMessageIdForInboxThreadId.js +26 -32
- package/src/platform-implementation-js/dom-driver/inbox/getSidebarClassnames.js +52 -109
- package/src/platform-implementation-js/dom-driver/inbox/getSidebarClassnames.test.js +7 -8
- package/src/platform-implementation-js/dom-driver/inbox/gotoView.js +16 -20
- package/src/platform-implementation-js/dom-driver/inbox/gotoView.test.js +15 -16
- package/src/platform-implementation-js/dom-driver/inbox/inbox-butter-bar-driver.js +75 -83
- package/src/platform-implementation-js/dom-driver/inbox/inbox-driver.js +530 -822
- package/src/platform-implementation-js/dom-driver/inbox/inbox-page-communicator.js +48 -61
- package/src/platform-implementation-js/dom-driver/inbox/inboxResponseProcessor.js +9 -12
- package/src/platform-implementation-js/dom-driver/inbox/inboxResponseProcessor.test.js +12 -19
- package/src/platform-implementation-js/dom-driver/inbox/makePageParserTree.js +24 -33
- package/src/platform-implementation-js/dom-driver/inbox/pageParserOptions.js +201 -388
- package/src/platform-implementation-js/dom-driver/inbox/registerSearchSuggestionsProvider.js +249 -265
- package/src/platform-implementation-js/dom-driver/inbox/setupCustomAutocompleteSelectionHandling.js +84 -152
- package/src/platform-implementation-js/dom-driver/inbox/setupRouteViewDriverStream.js +55 -67
- package/src/platform-implementation-js/dom-driver/inbox/setupRouteViewDriverStream.test.js +43 -65
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxLabelView.js +31 -56
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxMoleViewDriver.js +191 -294
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxToolbarButtonView.js +32 -45
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxToolbarView.js +21 -39
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-sidebar-view.js +153 -240
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-toolbar-button-view.js +75 -150
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-toolbar-tooltip-view.js +20 -37
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-attachment-card-view.js +60 -114
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-attachment-overlay-view.js +47 -65
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-backdrop.js +41 -52
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-chat-sidebar-view.js +27 -36
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-compose-button-view.js +52 -80
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-compose-view.js +465 -649
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-custom-route-view.js +37 -58
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-custom-route-view.test.js +14 -26
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-drawer-view.js +118 -235
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-dropdown-view.js +10 -11
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-dummy-route-view.js +28 -46
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-message-view.js +131 -202
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-modal-view.js +40 -80
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-route-view.js +35 -61
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-row-view.js +124 -221
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-view.js +125 -213
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-view.test.js +104 -126
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-tooltip-view.js +36 -51
- package/src/platform-implementation-js/dom-driver/inbox/views/inboxNavItemView.js +158 -297
- package/src/platform-implementation-js/dom-driver/inbox/waitForAnimationClickBlockerGone.js +21 -35
- package/src/platform-implementation-js/driver-common/compose/getDiscardStream.js +24 -43
- package/src/platform-implementation-js/driver-common/compose/getPresendingStream.js +39 -68
- package/src/platform-implementation-js/driver-common/getGmailMessageIdForSyncMessageId.js +14 -19
- package/src/platform-implementation-js/driver-common/getGmailThreadIdForRfcMessageId.js +27 -35
- package/src/platform-implementation-js/driver-common/getRfcMessageIdForSyncMessageId.js +16 -22
- package/src/platform-implementation-js/driver-common/getThreadIdFromMessageId.js +14 -14
- package/src/platform-implementation-js/driver-common/inboxAjax.js +12 -7
- package/src/platform-implementation-js/driver-common/requestGmailThread.js +19 -20
- package/src/platform-implementation-js/driver-common/sidebar/AppSidebar.js +197 -306
- package/src/platform-implementation-js/driver-common/sidebar/ContentPanelViewDriver.js +113 -161
- package/src/platform-implementation-js/driver-interfaces/compose-view-driver.js +1 -114
- package/src/platform-implementation-js/driver-interfaces/driver.js +1 -131
- package/src/platform-implementation-js/driver-interfaces/message-view-driver.js +4 -48
- package/src/platform-implementation-js/driver-interfaces/mole-view-driver.js +1 -29
- package/src/platform-implementation-js/driver-interfaces/route-view-driver.js +1 -32
- package/src/platform-implementation-js/driver-interfaces/thread-row-view-driver.js +1 -11
- package/src/platform-implementation-js/lib/array-to-lifetimes.js +43 -41
- package/src/platform-implementation-js/lib/array-to-lifetimes.test.js +139 -155
- package/src/platform-implementation-js/lib/copyAndValidateAutocompleteResults.js +19 -38
- package/src/platform-implementation-js/lib/css-selector-escape.js +7 -3
- package/src/platform-implementation-js/lib/dom/element-view-mapper.js +8 -11
- package/src/platform-implementation-js/lib/dom/get-selection.js +23 -52
- package/src/platform-implementation-js/lib/dom/insert-html-at-cursor.js +69 -101
- package/src/platform-implementation-js/lib/dom/is-node-in-range.js +8 -10
- package/src/platform-implementation-js/lib/dom/on-mouse-down-and-up.js +15 -17
- package/src/platform-implementation-js/lib/dom/querySelectorOne.js +8 -11
- package/src/platform-implementation-js/lib/dom/set-css.js +7 -3
- package/src/platform-implementation-js/lib/dom/set-value-and-dispatch-event.js +9 -11
- package/src/platform-implementation-js/lib/dom/simulate-drag-and-drop.js +32 -33
- package/src/platform-implementation-js/lib/extract-contact-from-email-contact-string.test.js +23 -26
- package/src/platform-implementation-js/lib/handle-compose-link-chips.js +86 -149
- package/src/platform-implementation-js/lib/insert-link-chip-into-body.js +42 -57
- package/src/platform-implementation-js/lib/make-revocable-function.js +19 -21
- package/src/platform-implementation-js/lib/make-revocable-function.test.js +20 -22
- package/src/platform-implementation-js/lib/parseParamsFromRouteID.js +15 -17
- package/src/platform-implementation-js/lib/parseParamsFromRouteID.test.js +9 -18
- package/src/platform-implementation-js/lib/populateRouteID.js +8 -9
- package/src/platform-implementation-js/lib/populateRouteID.test.js +20 -19
- package/src/platform-implementation-js/lib/react/ElementContainer.js +23 -20
- package/src/platform-implementation-js/lib/rewriteCssWithIdMap.js +10 -9
- package/src/platform-implementation-js/lib/rewriteCssWithIdMap.test.js +13 -20
- package/src/platform-implementation-js/lib/routeIDmatchesHash.js +13 -18
- package/src/platform-implementation-js/lib/routeIDmatchesHash.test.js +11 -17
- package/src/platform-implementation-js/lib/shared-style.js +14 -13
- package/src/platform-implementation-js/lib/toItemWithLifetimeStream.js +18 -17
- package/src/platform-implementation-js/lib/toLiveSet.js +17 -15
- package/src/platform-implementation-js/main-INTEGRATED-PAGEWORLD.js +6 -5
- package/src/platform-implementation-js/main.js +9 -24
- package/src/platform-implementation-js/namespaces/compose.js +37 -60
- package/src/platform-implementation-js/namespaces/conversations.js +52 -124
- package/src/platform-implementation-js/namespaces/global.js +27 -39
- package/src/platform-implementation-js/namespaces/keyboard.js +29 -33
- package/src/platform-implementation-js/namespaces/lists.js +25 -31
- package/src/platform-implementation-js/namespaces/modal.js +34 -28
- package/src/platform-implementation-js/namespaces/nav-menu.js +30 -45
- package/src/platform-implementation-js/namespaces/router.js +70 -137
- package/src/platform-implementation-js/namespaces/search.js +19 -17
- package/src/platform-implementation-js/namespaces/toolbars.js +71 -117
- package/src/platform-implementation-js/namespaces/user.js +36 -37
- package/src/platform-implementation-js/namespaces/widgets.js +54 -61
- package/src/platform-implementation-js/platform-implementation.js +98 -229
- package/src/platform-implementation-js/views/app-toolbar-button-view.js +26 -47
- package/src/platform-implementation-js/views/collapsible-section-view.js +66 -63
- package/src/platform-implementation-js/views/content-panel-view.js +28 -30
- package/src/platform-implementation-js/views/conversations/attachment-card-view.js +21 -44
- package/src/platform-implementation-js/views/conversations/custom-message-view.js +44 -104
- package/src/platform-implementation-js/views/conversations/message-view.js +131 -202
- package/src/platform-implementation-js/views/conversations/thread-view.js +75 -127
- package/src/platform-implementation-js/views/native-nav-item-view.js +32 -65
- package/src/platform-implementation-js/views/nav-item-view.js +51 -115
- package/src/platform-implementation-js/views/route-view/custom-route-view.js +25 -20
- 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 +30 -52
- package/src/platform-implementation-js/views/route-view/route-view.js +24 -35
- package/src/platform-implementation-js/views/section-view.js +60 -52
- package/src/platform-implementation-js/views/thread-row-view.js +49 -74
- package/src/platform-implementation-js/widgets/drawer-view.js +29 -36
- package/src/platform-implementation-js/widgets/modal-view.js +39 -68
- package/src/platform-implementation-js/widgets/mole-view.js +22 -22
- package/src/platform-implementation-js/widgets/top-message-bar-view.js +13 -10
|
@@ -1,71 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
import type GmailDriver from '../gmail-driver';
|
|
33
|
-
import type GmailThreadView from './gmail-thread-view';
|
|
34
|
-
import type GmailToolbarView from './gmail-toolbar-view';
|
|
35
|
-
|
|
36
|
-
import type {
|
|
37
|
-
MessageViewDriver,
|
|
38
|
-
VIEW_STATE,
|
|
39
|
-
} from '../../../driver-interfaces/message-view-driver';
|
|
40
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _sortBy = _interopRequireDefault(require("lodash/sortBy"));
|
|
10
|
+
var _once = _interopRequireDefault(require("lodash/once"));
|
|
11
|
+
var _autoHtml = _interopRequireDefault(require("auto-html"));
|
|
12
|
+
var _asap = _interopRequireDefault(require("asap"));
|
|
13
|
+
var _ud = require("ud");
|
|
14
|
+
var _kefir = _interopRequireDefault(require("kefir"));
|
|
15
|
+
var _kefirBus = _interopRequireDefault(require("kefir-bus"));
|
|
16
|
+
var _kefirStopper = _interopRequireDefault(require("kefir-stopper"));
|
|
17
|
+
var _kefirCast = _interopRequireDefault(require("kefir-cast"));
|
|
18
|
+
var _gmailAttachmentAreaView = _interopRequireDefault(require("./gmail-attachment-area-view"));
|
|
19
|
+
var _gmailAttachmentCardView = _interopRequireDefault(require("./gmail-attachment-card-view"));
|
|
20
|
+
var _getUpdatedContact = _interopRequireDefault(require("./gmail-message-view/get-updated-contact"));
|
|
21
|
+
var _attachmentIcon = _interopRequireDefault(require("./gmail-message-view/attachment-icon"));
|
|
22
|
+
var _delayAsap = _interopRequireDefault(require("../../../lib/delay-asap"));
|
|
23
|
+
var _waitFor = _interopRequireDefault(require("../../../lib/wait-for"));
|
|
24
|
+
var _makeMutationObserverStream = _interopRequireDefault(require("../../../lib/dom/make-mutation-observer-stream"));
|
|
25
|
+
var _querySelectorOrFail = _interopRequireDefault(require("../../../lib/dom/querySelectorOrFail"));
|
|
26
|
+
var _makeMutationObserverChunkedStream = _interopRequireDefault(require("../../../lib/dom/make-mutation-observer-chunked-stream"));
|
|
27
|
+
var _simulateMouseEvent = require("../../../lib/dom/simulate-mouse-event");
|
|
28
|
+
var _censorHTMLtree = _interopRequireDefault(require("../../../../common/censorHTMLtree"));
|
|
29
|
+
var _findParent = _interopRequireDefault(require("../../../../common/find-parent"));
|
|
30
|
+
var _reemitClickEventForReact = _interopRequireDefault(require("../../../lib/dom/reemitClickEventForReact"));
|
|
41
31
|
let hasSeenOldElement = false;
|
|
42
|
-
|
|
43
32
|
class GmailMessageView {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
_readyStream: Kefir.Observable<null>;
|
|
53
|
-
_replyElement: ?HTMLElement;
|
|
54
|
-
_gmailAttachmentAreaView: ?GmailAttachmentAreaView;
|
|
55
|
-
_messageLoaded: boolean = false;
|
|
56
|
-
_openMoreMenu: ?HTMLElement;
|
|
57
|
-
_sender: ?Contact = null;
|
|
58
|
-
_recipients: ?(Contact[]) = null;
|
|
59
|
-
_recipientEmailAddresses: ?(string[]) = null;
|
|
60
|
-
_recipientsFull: ?(Contact[]) = null;
|
|
61
|
-
|
|
62
|
-
constructor(
|
|
63
|
-
element: HTMLElement,
|
|
64
|
-
gmailThreadView: GmailThreadView,
|
|
65
|
-
driver: GmailDriver
|
|
66
|
-
) {
|
|
33
|
+
constructor(element, gmailThreadView, driver) {
|
|
34
|
+
(0, _defineProperty2.default)(this, "_eventStream", (0, _kefirBus.default)());
|
|
35
|
+
(0, _defineProperty2.default)(this, "_stopper", (0, _kefirStopper.default)());
|
|
36
|
+
(0, _defineProperty2.default)(this, "_messageLoaded", false);
|
|
37
|
+
(0, _defineProperty2.default)(this, "_sender", null);
|
|
38
|
+
(0, _defineProperty2.default)(this, "_recipients", null);
|
|
39
|
+
(0, _defineProperty2.default)(this, "_recipientEmailAddresses", null);
|
|
40
|
+
(0, _defineProperty2.default)(this, "_recipientsFull", null);
|
|
67
41
|
this._element = element;
|
|
68
|
-
|
|
69
42
|
this._threadViewDriver = gmailThreadView;
|
|
70
43
|
this._driver = driver;
|
|
71
44
|
this._moreMenuItemDescriptors = [];
|
|
@@ -73,16 +46,12 @@ class GmailMessageView {
|
|
|
73
46
|
this._replyElement = null;
|
|
74
47
|
|
|
75
48
|
// Outputs the same type of stream as makeElementChildStream does.
|
|
76
|
-
this._replyElementStream = this._eventStream
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
})
|
|
80
|
-
.map((event) => event.change);
|
|
81
|
-
|
|
49
|
+
this._replyElementStream = this._eventStream.filter(function (event) {
|
|
50
|
+
return event.eventName === 'replyElement';
|
|
51
|
+
}).map(event => event.change);
|
|
82
52
|
this._setupMessageStateStream();
|
|
83
53
|
this._monitorEmailAddressHovering();
|
|
84
54
|
this._setupMoreMenuWatching();
|
|
85
|
-
|
|
86
55
|
let partialReadyStream;
|
|
87
56
|
if (driver.isUsingSyncAPI()) {
|
|
88
57
|
// handle the case that the data-message-id is available, but the data-legacy-message-id is not
|
|
@@ -93,335 +62,231 @@ class GmailMessageView {
|
|
|
93
62
|
const messageIdElement = this._element.querySelector('[data-message-id]');
|
|
94
63
|
if (messageIdElement) {
|
|
95
64
|
const syncMessageId = messageIdElement.getAttribute('data-message-id');
|
|
96
|
-
if (!syncMessageId)
|
|
97
|
-
throw new Error('data-message-id attribute has no value');
|
|
65
|
+
if (!syncMessageId) throw new Error('data-message-id attribute has no value');
|
|
98
66
|
|
|
99
67
|
// Only respect data-legacy-message-id if data-message-id is not the id
|
|
100
68
|
// of a draft we've seen recently, in order to work around a Gmail bug.
|
|
101
69
|
// https://github.com/StreakYC/GmailSDK/issues/515#issuecomment-457420619
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
!this._driver.isRecentSyncDraftId(syncMessageId.replace('#', ''))
|
|
105
|
-
) {
|
|
106
|
-
partialReadyStream = Kefir.constant(null);
|
|
70
|
+
if (messageIdElement.hasAttribute('data-legacy-message-id') && !this._driver.isRecentSyncDraftId(syncMessageId.replace('#', ''))) {
|
|
71
|
+
partialReadyStream = _kefir.default.constant(null);
|
|
107
72
|
} else {
|
|
108
73
|
// we have a data message id, but not the legacy message id. So now we have to poll for the gmail message id
|
|
109
|
-
partialReadyStream =
|
|
110
|
-
(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
messageIdElement.setAttribute(
|
|
119
|
-
'data-legacy-message-id',
|
|
120
|
-
gmailMessageId
|
|
121
|
-
);
|
|
122
|
-
return null;
|
|
123
|
-
} catch (e) {
|
|
124
|
-
await new Promise((resolve) => setTimeout(resolve, ii * 200));
|
|
125
|
-
}
|
|
74
|
+
partialReadyStream = _kefir.default.fromPromise((async () => {
|
|
75
|
+
for (let ii = 0; ii < 10; ii++) {
|
|
76
|
+
try {
|
|
77
|
+
const gmailMessageId = await this._driver.getGmailMessageIdForSyncMessageId(syncMessageId.replace('#', ''));
|
|
78
|
+
// set the legacy message id attribute so subsequent calls to getMessageId find the legacy message id in the dom
|
|
79
|
+
messageIdElement.setAttribute('data-legacy-message-id', gmailMessageId);
|
|
80
|
+
return null;
|
|
81
|
+
} catch (e) {
|
|
82
|
+
await new Promise(resolve => setTimeout(resolve, ii * 200));
|
|
126
83
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
);
|
|
84
|
+
}
|
|
85
|
+
throw new Error('gmail message id never became available');
|
|
86
|
+
})());
|
|
131
87
|
}
|
|
132
88
|
} else {
|
|
133
|
-
partialReadyStream =
|
|
89
|
+
partialReadyStream = _kefir.default.constant(null);
|
|
134
90
|
}
|
|
135
91
|
} else {
|
|
136
|
-
partialReadyStream =
|
|
92
|
+
partialReadyStream = _kefir.default.constant(null);
|
|
137
93
|
}
|
|
138
|
-
|
|
139
|
-
this._readyStream = partialReadyStream
|
|
140
|
-
.takeUntilBy(this._stopper)
|
|
141
|
-
.onValue(() => this._processInitialState());
|
|
94
|
+
this._readyStream = partialReadyStream.takeUntilBy(this._stopper).onValue(() => this._processInitialState());
|
|
142
95
|
}
|
|
143
|
-
|
|
144
96
|
destroy() {
|
|
145
97
|
this._stopper.destroy();
|
|
146
98
|
this._eventStream.end();
|
|
147
99
|
if (this._gmailAttachmentAreaView) this._gmailAttachmentAreaView.destroy();
|
|
148
|
-
|
|
149
|
-
this._moreMenuAddedElements.forEach((el) => {
|
|
100
|
+
this._moreMenuAddedElements.forEach(el => {
|
|
150
101
|
el.remove();
|
|
151
102
|
});
|
|
152
103
|
}
|
|
153
|
-
|
|
154
|
-
getEventStream(): Kefir.Observable<Object> {
|
|
104
|
+
getEventStream() {
|
|
155
105
|
return this._eventStream;
|
|
156
106
|
}
|
|
157
|
-
|
|
158
|
-
getReplyElementStream(): Kefir.Observable<ElementWithLifetime> {
|
|
107
|
+
getReplyElementStream() {
|
|
159
108
|
return this._replyElementStream;
|
|
160
109
|
}
|
|
161
|
-
|
|
162
|
-
getElement(): HTMLElement {
|
|
110
|
+
getElement() {
|
|
163
111
|
return this._element;
|
|
164
112
|
}
|
|
165
|
-
|
|
166
|
-
getThreadViewDriver(): GmailThreadView {
|
|
113
|
+
getThreadViewDriver() {
|
|
167
114
|
return this._threadViewDriver;
|
|
168
115
|
}
|
|
169
|
-
|
|
170
|
-
isLoaded(): boolean {
|
|
116
|
+
isLoaded() {
|
|
171
117
|
return this._messageLoaded;
|
|
172
118
|
}
|
|
173
|
-
|
|
174
|
-
getContentsElement(): HTMLElement {
|
|
119
|
+
getContentsElement() {
|
|
175
120
|
if (!this._messageLoaded) {
|
|
176
121
|
throw new Error('tried to get message contents before message is loaded');
|
|
177
122
|
}
|
|
178
|
-
|
|
179
123
|
try {
|
|
180
|
-
return
|
|
124
|
+
return (0, _querySelectorOrFail.default)(this._element, 'div.ii.gt');
|
|
181
125
|
} catch (err) {
|
|
182
126
|
// Keep old fallback selector until we're confident of the new one.
|
|
183
127
|
this._driver.getLogger().error(err);
|
|
184
|
-
return
|
|
128
|
+
return (0, _querySelectorOrFail.default)(this._element, '.adP');
|
|
185
129
|
}
|
|
186
130
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
return findParent(element, (el) => el.nodeName === 'BLOCKQUOTE') != null;
|
|
131
|
+
isElementInQuotedArea(element) {
|
|
132
|
+
return (0, _findParent.default)(element, el => el.nodeName === 'BLOCKQUOTE') != null;
|
|
190
133
|
}
|
|
191
|
-
|
|
192
|
-
getSender(): Contact {
|
|
134
|
+
getSender() {
|
|
193
135
|
let sender = this._sender;
|
|
194
136
|
if (sender) return sender;
|
|
195
|
-
|
|
196
|
-
const senderSpan = querySelector(this._element, 'td.gF span[email]');
|
|
197
|
-
|
|
137
|
+
const senderSpan = (0, _querySelectorOrFail.default)(this._element, 'td.gF span[email]');
|
|
198
138
|
const emailAddress = senderSpan.getAttribute('email');
|
|
199
139
|
if (!emailAddress) throw new Error('Could not find email address');
|
|
200
|
-
|
|
201
140
|
sender = this._sender = {
|
|
202
141
|
name: senderSpan.getAttribute('name'),
|
|
203
|
-
emailAddress
|
|
142
|
+
emailAddress
|
|
204
143
|
};
|
|
205
|
-
|
|
206
144
|
return sender;
|
|
207
145
|
}
|
|
208
|
-
|
|
209
|
-
getRecipients(): Array<Contact> {
|
|
146
|
+
getRecipients() {
|
|
210
147
|
let recipients = this._recipients;
|
|
211
148
|
if (recipients) return recipients;
|
|
212
|
-
const receipientSpans = Array.from(
|
|
213
|
-
|
|
214
|
-
);
|
|
215
|
-
recipients = this._recipients = receipientSpans.map((span) => {
|
|
149
|
+
const receipientSpans = Array.from(this._element.querySelectorAll('.hb span[email]'));
|
|
150
|
+
recipients = this._recipients = receipientSpans.map(span => {
|
|
216
151
|
return this._getUpdatedContact({
|
|
217
152
|
name: span.getAttribute('name'),
|
|
218
|
-
emailAddress: span.getAttribute('email') || ''
|
|
153
|
+
emailAddress: span.getAttribute('email') || ''
|
|
219
154
|
});
|
|
220
155
|
});
|
|
221
|
-
|
|
222
156
|
return recipients;
|
|
223
157
|
}
|
|
224
|
-
|
|
225
|
-
getRecipientEmailAddresses(): Array<string> {
|
|
158
|
+
getRecipientEmailAddresses() {
|
|
226
159
|
let recipients = this._recipientEmailAddresses;
|
|
227
160
|
if (recipients) return recipients;
|
|
228
|
-
const receipientSpans = Array.from(
|
|
229
|
-
|
|
230
|
-
);
|
|
231
|
-
recipients = this._recipientEmailAddresses = receipientSpans.map(
|
|
232
|
-
(span) => span.getAttribute('email') || ''
|
|
233
|
-
);
|
|
161
|
+
const receipientSpans = Array.from(this._element.querySelectorAll('.hb span[email]'));
|
|
162
|
+
recipients = this._recipientEmailAddresses = receipientSpans.map(span => span.getAttribute('email') || '');
|
|
234
163
|
return recipients;
|
|
235
164
|
}
|
|
236
|
-
|
|
237
|
-
async getRecipientsFull(): Promise<Array<Contact>> {
|
|
165
|
+
async getRecipientsFull() {
|
|
238
166
|
let recipients = this._recipientsFull;
|
|
239
167
|
if (recipients) return recipients;
|
|
240
|
-
|
|
241
168
|
if (this._driver.isUsingSyncAPI()) {
|
|
242
169
|
const threadID = this._threadViewDriver.getInternalID();
|
|
243
|
-
recipients = this._recipientsFull = await this._driver
|
|
244
|
-
.getPageCommunicator()
|
|
245
|
-
.getMessageRecipients(threadID, this._element);
|
|
170
|
+
recipients = this._recipientsFull = await this._driver.getPageCommunicator().getMessageRecipients(threadID, this._element);
|
|
246
171
|
if (!recipients) {
|
|
247
|
-
this._driver
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
threadID,
|
|
251
|
-
});
|
|
172
|
+
this._driver.getLogger().error(new Error('Failed to find message recipients from response'), {
|
|
173
|
+
threadID
|
|
174
|
+
});
|
|
252
175
|
recipients = this._recipientsFull = this.getRecipients();
|
|
253
176
|
}
|
|
254
177
|
} else {
|
|
255
|
-
const receipientSpans = Array.from(
|
|
256
|
-
|
|
257
|
-
);
|
|
258
|
-
recipients = this._recipientsFull = receipientSpans.map((span) => {
|
|
178
|
+
const receipientSpans = Array.from(this._element.querySelectorAll('.hb span[email]'));
|
|
179
|
+
recipients = this._recipientsFull = receipientSpans.map(span => {
|
|
259
180
|
return this._getUpdatedContact({
|
|
260
181
|
name: span.getAttribute('name'),
|
|
261
|
-
emailAddress: span.getAttribute('email') || ''
|
|
182
|
+
emailAddress: span.getAttribute('email') || ''
|
|
262
183
|
});
|
|
263
184
|
});
|
|
264
185
|
}
|
|
265
|
-
|
|
266
186
|
return recipients;
|
|
267
187
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
return querySelector(this._element, '.ads .gK .g3').title;
|
|
188
|
+
getDateString() {
|
|
189
|
+
return (0, _querySelectorOrFail.default)(this._element, '.ads .gK .g3').title;
|
|
271
190
|
}
|
|
272
|
-
|
|
273
|
-
async getDate(): Promise<?number> {
|
|
191
|
+
async getDate() {
|
|
274
192
|
const threadID = this._threadViewDriver.getInternalID();
|
|
275
|
-
return await this._driver
|
|
276
|
-
.getPageCommunicator()
|
|
277
|
-
.getMessageDate(threadID, this._element);
|
|
193
|
+
return await this._driver.getPageCommunicator().getMessageDate(threadID, this._element);
|
|
278
194
|
}
|
|
279
|
-
|
|
280
195
|
getAttachmentCardViewDrivers() {
|
|
281
196
|
if (!this._gmailAttachmentAreaView) {
|
|
282
197
|
return [];
|
|
283
198
|
}
|
|
284
|
-
|
|
285
199
|
return this._gmailAttachmentAreaView.getAttachmentCardViews();
|
|
286
200
|
}
|
|
287
|
-
|
|
288
|
-
addButtonToDownloadAllArea(options: Object) {
|
|
201
|
+
addButtonToDownloadAllArea(options) {
|
|
289
202
|
var gmailAttachmentAreaView = this._getAttachmentArea();
|
|
290
|
-
|
|
291
203
|
if (!gmailAttachmentAreaView) {
|
|
292
204
|
return;
|
|
293
205
|
}
|
|
294
|
-
|
|
295
206
|
gmailAttachmentAreaView.addButtonToDownloadAllArea(options);
|
|
296
207
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
this._moreMenuItemDescriptors = sortBy(
|
|
300
|
-
this._moreMenuItemDescriptors.concat([options]),
|
|
301
|
-
(o) => o.orderHint
|
|
302
|
-
);
|
|
208
|
+
addMoreMenuItem(options) {
|
|
209
|
+
this._moreMenuItemDescriptors = (0, _sortBy.default)(this._moreMenuItemDescriptors.concat([options]), o => o.orderHint);
|
|
303
210
|
this._updateMoreMenu();
|
|
304
211
|
}
|
|
305
|
-
|
|
306
212
|
_setupMoreMenuWatching() {
|
|
307
213
|
// At the start, and whenever the view state changes, watch the
|
|
308
214
|
// 'aria-expanded' property of the more button, and when that changes,
|
|
309
215
|
// update the _openMoreMenu property.
|
|
310
216
|
this._openMoreMenu = null;
|
|
311
|
-
this._eventStream
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
? this._getOpenMoreMenu()
|
|
325
|
-
: null
|
|
326
|
-
);
|
|
327
|
-
})
|
|
328
|
-
.takeUntilBy(this._stopper)
|
|
329
|
-
.onValue((openMoreMenu) => {
|
|
330
|
-
this._openMoreMenu = openMoreMenu;
|
|
331
|
-
this._updateMoreMenu();
|
|
332
|
-
});
|
|
217
|
+
this._eventStream.filter(e => e.eventName === 'viewStateChange').toProperty(() => null).flatMapLatest(() => {
|
|
218
|
+
const moreButton = this._getMoreButton();
|
|
219
|
+
if (!moreButton) {
|
|
220
|
+
return _kefir.default.constant(null);
|
|
221
|
+
}
|
|
222
|
+
return (0, _makeMutationObserverChunkedStream.default)(moreButton, {
|
|
223
|
+
attributes: true,
|
|
224
|
+
attributeFilter: ['aria-expanded']
|
|
225
|
+
}).map(() => moreButton.getAttribute('aria-expanded') === 'true' ? this._getOpenMoreMenu() : null);
|
|
226
|
+
}).takeUntilBy(this._stopper).onValue(openMoreMenu => {
|
|
227
|
+
this._openMoreMenu = openMoreMenu;
|
|
228
|
+
this._updateMoreMenu();
|
|
229
|
+
});
|
|
333
230
|
}
|
|
334
|
-
|
|
335
|
-
_getMoreButton(): ?HTMLElement {
|
|
231
|
+
_getMoreButton() {
|
|
336
232
|
if (this.getViewState() !== 'EXPANDED') {
|
|
337
233
|
return null;
|
|
338
234
|
}
|
|
339
|
-
return this._element.querySelector(
|
|
340
|
-
'tr.acZ div.T-I.J-J5-Ji.aap.L3[role=button][aria-haspopup]'
|
|
341
|
-
);
|
|
235
|
+
return this._element.querySelector('tr.acZ div.T-I.J-J5-Ji.aap.L3[role=button][aria-haspopup]');
|
|
342
236
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
const
|
|
346
|
-
'td > div.nH.a98.iY > div.nH.aHU .b7.J-M[aria-haspopup=true]';
|
|
347
|
-
|
|
348
|
-
const maybeMoreMenu = ((document.body: any): HTMLElement).querySelector(
|
|
349
|
-
selector_2022_11_23
|
|
350
|
-
);
|
|
237
|
+
_getOpenMoreMenu() {
|
|
238
|
+
const selector_2022_11_23 = 'td > div.nH.a98.iY > div.nH.aHU .b7.J-M[aria-haspopup=true]';
|
|
239
|
+
const maybeMoreMenu = document.body.querySelector(selector_2022_11_23);
|
|
351
240
|
|
|
352
241
|
// This will find any message's open more menu! The caller needs to make
|
|
353
242
|
// sure it belongs to this message!
|
|
354
|
-
return (
|
|
355
|
-
maybeMoreMenu ||
|
|
356
|
-
((document.body: any): HTMLElement).querySelector(
|
|
357
|
-
'td > div.nH.if > div.nH.aHU div.b7.J-M[aria-haspopup=true]'
|
|
358
|
-
)
|
|
359
|
-
);
|
|
243
|
+
return maybeMoreMenu || document.body.querySelector('td > div.nH.if > div.nH.aHU div.b7.J-M[aria-haspopup=true]');
|
|
360
244
|
}
|
|
361
|
-
|
|
362
245
|
_closeActiveEmailMenu() {
|
|
363
246
|
const moreButton = this._getMoreButton();
|
|
364
247
|
if (moreButton) {
|
|
365
|
-
simulateClick(moreButton);
|
|
248
|
+
(0, _simulateMouseEvent.simulateClick)(moreButton);
|
|
366
249
|
}
|
|
367
250
|
}
|
|
368
|
-
|
|
369
251
|
_updateMoreMenu() {
|
|
370
|
-
this._moreMenuAddedElements.forEach(
|
|
252
|
+
this._moreMenuAddedElements.forEach(el => {
|
|
371
253
|
el.remove();
|
|
372
254
|
});
|
|
373
255
|
this._moreMenuAddedElements.length = 0;
|
|
374
|
-
|
|
375
256
|
const openMoreMenu = this._openMoreMenu;
|
|
376
257
|
if (openMoreMenu && this._moreMenuItemDescriptors.length) {
|
|
377
258
|
const originalHeight = openMoreMenu.offsetHeight;
|
|
378
259
|
const originalWidth = openMoreMenu.offsetWidth;
|
|
379
|
-
|
|
380
260
|
const dividerEl = document.createElement('div');
|
|
381
261
|
dividerEl.className = 'J-Kh';
|
|
382
262
|
this._moreMenuAddedElements.push(dividerEl);
|
|
383
263
|
openMoreMenu.appendChild(dividerEl);
|
|
384
|
-
|
|
385
|
-
this._moreMenuItemDescriptors.forEach((options) => {
|
|
264
|
+
this._moreMenuItemDescriptors.forEach(options => {
|
|
386
265
|
const itemEl = document.createElement('div');
|
|
387
266
|
itemEl.className = 'J-N';
|
|
388
267
|
itemEl.setAttribute('role', 'menuitem');
|
|
389
|
-
itemEl.innerHTML =
|
|
390
|
-
|
|
391
|
-
itemEl.addEventListener('
|
|
392
|
-
|
|
393
|
-
);
|
|
394
|
-
itemEl.addEventListener('mouseleave', (event: MouseEvent) =>
|
|
395
|
-
itemEl.classList.remove('J-N-JT')
|
|
396
|
-
);
|
|
397
|
-
itemEl.addEventListener('click', (event: MouseEvent) => {
|
|
268
|
+
itemEl.innerHTML = (0, _autoHtml.default)`<div class="J-N-Jz">${options.title}</div>`;
|
|
269
|
+
itemEl.addEventListener('mouseenter', event => itemEl.classList.add('J-N-JT'));
|
|
270
|
+
itemEl.addEventListener('mouseleave', event => itemEl.classList.remove('J-N-JT'));
|
|
271
|
+
itemEl.addEventListener('click', event => {
|
|
398
272
|
this._closeActiveEmailMenu();
|
|
399
273
|
options.onClick();
|
|
400
274
|
});
|
|
401
|
-
|
|
402
275
|
if (options.iconUrl || options.iconClass) {
|
|
403
276
|
const iconEl = document.createElement('img');
|
|
404
|
-
iconEl.className = `f4 J-N-JX inboxsdk__message_more_icon ${
|
|
405
|
-
options.iconClass || ''
|
|
406
|
-
}`;
|
|
277
|
+
iconEl.className = `f4 J-N-JX inboxsdk__message_more_icon ${options.iconClass || ''}`;
|
|
407
278
|
iconEl.src = options.iconUrl || 'images/cleardot.gif';
|
|
408
|
-
|
|
409
279
|
const insertionPoint = itemEl.firstElementChild;
|
|
410
280
|
if (insertionPoint) insertionPoint.appendChild(iconEl);
|
|
411
281
|
}
|
|
412
|
-
|
|
413
282
|
this._moreMenuAddedElements.push(itemEl);
|
|
414
283
|
openMoreMenu.appendChild(itemEl);
|
|
415
284
|
});
|
|
416
|
-
|
|
417
285
|
const menuRect = openMoreMenu.getBoundingClientRect();
|
|
418
|
-
|
|
419
286
|
const addedWidth = menuRect.width - originalWidth;
|
|
420
287
|
if (addedWidth > 0) {
|
|
421
|
-
openMoreMenu.style.left =
|
|
422
|
-
Math.max(0, parseInt(openMoreMenu.style.left) - addedWidth) + 'px';
|
|
288
|
+
openMoreMenu.style.left = Math.max(0, parseInt(openMoreMenu.style.left) - addedWidth) + 'px';
|
|
423
289
|
}
|
|
424
|
-
|
|
425
290
|
const moreButton = this._getMoreButton();
|
|
426
291
|
if (moreButton) {
|
|
427
292
|
const moreButtonRect = moreButton.getBoundingClientRect();
|
|
@@ -430,37 +295,30 @@ class GmailMessageView {
|
|
|
430
295
|
// upwards to compensate for the buttons we added.
|
|
431
296
|
if (menuRect.top < moreButtonRect.top) {
|
|
432
297
|
const addedHeight = menuRect.height - originalHeight;
|
|
433
|
-
openMoreMenu.style.top =
|
|
434
|
-
Math.max(0, parseInt(openMoreMenu.style.top) - addedHeight) + 'px';
|
|
298
|
+
openMoreMenu.style.top = Math.max(0, parseInt(openMoreMenu.style.top) - addedHeight) + 'px';
|
|
435
299
|
}
|
|
436
300
|
}
|
|
437
301
|
}
|
|
438
302
|
}
|
|
439
|
-
|
|
440
|
-
|
|
303
|
+
getMessageID() {
|
|
304
|
+
let ignoreLoadStatus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
441
305
|
if (!ignoreLoadStatus && !this._messageLoaded) {
|
|
442
306
|
throw new Error('tried to get message id before message is loaded');
|
|
443
307
|
}
|
|
444
|
-
|
|
445
|
-
const messageIdElement = this._element.querySelector(
|
|
446
|
-
'[data-legacy-message-id]'
|
|
447
|
-
);
|
|
308
|
+
const messageIdElement = this._element.querySelector('[data-legacy-message-id]');
|
|
448
309
|
if (messageIdElement) {
|
|
449
310
|
const messageId = messageIdElement.getAttribute('data-legacy-message-id');
|
|
450
|
-
if (!messageId)
|
|
451
|
-
throw new Error('message id attribute with no value, wtf?');
|
|
311
|
+
if (!messageId) throw new Error('message id attribute with no value, wtf?');
|
|
452
312
|
return messageId;
|
|
453
313
|
}
|
|
454
|
-
|
|
455
314
|
const messageEl = this._element.querySelector('div.ii.gt');
|
|
456
315
|
if (!messageEl) {
|
|
457
316
|
const err = new Error('Could not find message id element');
|
|
458
317
|
this._driver.getLogger().error(err, {
|
|
459
|
-
elementHtml:
|
|
318
|
+
elementHtml: (0, _censorHTMLtree.default)(this._element)
|
|
460
319
|
});
|
|
461
320
|
throw err;
|
|
462
321
|
}
|
|
463
|
-
|
|
464
322
|
let m = messageEl.className.match(/\bm([0-9a-f]+)\b/);
|
|
465
323
|
if (m) {
|
|
466
324
|
if (!hasSeenOldElement) {
|
|
@@ -474,7 +332,7 @@ class GmailMessageView {
|
|
|
474
332
|
const err = new Error('Could not find message id value');
|
|
475
333
|
this._driver.getLogger().error(err, {
|
|
476
334
|
reason: 'Could not find element',
|
|
477
|
-
messageHtml:
|
|
335
|
+
messageHtml: (0, _censorHTMLtree.default)(messageEl)
|
|
478
336
|
});
|
|
479
337
|
throw err;
|
|
480
338
|
}
|
|
@@ -483,50 +341,38 @@ class GmailMessageView {
|
|
|
483
341
|
const err = new Error('Could not find message id value');
|
|
484
342
|
this._driver.getLogger().error(err, {
|
|
485
343
|
reason: 'Element was missing message className',
|
|
486
|
-
messageHtml:
|
|
344
|
+
messageHtml: (0, _censorHTMLtree.default)(messageEl)
|
|
487
345
|
});
|
|
488
346
|
throw err;
|
|
489
347
|
}
|
|
490
348
|
return m[1];
|
|
491
349
|
}
|
|
492
350
|
}
|
|
493
|
-
|
|
494
|
-
async getMessageIDAsync(): Promise<string> {
|
|
351
|
+
async getMessageIDAsync() {
|
|
495
352
|
return this.getMessageID();
|
|
496
353
|
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
const attachmentIcon = new AttachmentIcon();
|
|
500
|
-
|
|
354
|
+
addAttachmentIcon(iconDescriptor) {
|
|
355
|
+
const attachmentIcon = new _attachmentIcon.default();
|
|
501
356
|
if (!this._element) {
|
|
502
357
|
console.warn('addDateIcon called on destroyed message'); //eslint-disable-line no-console
|
|
503
358
|
return attachmentIcon;
|
|
504
359
|
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
'inboxsdk__message_added_attachment_icon',
|
|
508
|
-
'true'
|
|
509
|
-
);
|
|
510
|
-
|
|
511
|
-
const getImgElement = once(() => {
|
|
360
|
+
this._element.setAttribute('inboxsdk__message_added_attachment_icon', 'true');
|
|
361
|
+
const getImgElement = (0, _once.default)(() => {
|
|
512
362
|
const img = document.createElement('img');
|
|
513
363
|
img.src = 'images/cleardot.gif';
|
|
514
364
|
return img;
|
|
515
365
|
});
|
|
516
|
-
|
|
517
|
-
const getCustomIconWrapper = once(() => {
|
|
366
|
+
const getCustomIconWrapper = (0, _once.default)(() => {
|
|
518
367
|
const div = document.createElement('div');
|
|
519
368
|
return div;
|
|
520
369
|
});
|
|
521
|
-
|
|
522
|
-
const getTooltipNodeWrapper = once(() => {
|
|
370
|
+
const getTooltipNodeWrapper = (0, _once.default)(() => {
|
|
523
371
|
const div = document.createElement('div');
|
|
524
372
|
return div;
|
|
525
373
|
});
|
|
526
|
-
|
|
527
374
|
let added = false;
|
|
528
375
|
let currentIconUrl = null;
|
|
529
|
-
|
|
530
376
|
this._stopper.onValue(() => {
|
|
531
377
|
if (added) {
|
|
532
378
|
getCustomIconWrapper().remove();
|
|
@@ -535,123 +381,83 @@ class GmailMessageView {
|
|
|
535
381
|
added = false;
|
|
536
382
|
}
|
|
537
383
|
});
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
.
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
if (
|
|
549
|
-
|
|
550
|
-
getCustomIconWrapper().remove();
|
|
551
|
-
getImgElement().remove();
|
|
552
|
-
getTooltipNodeWrapper().remove();
|
|
553
|
-
added = false;
|
|
554
|
-
}
|
|
384
|
+
(0, _kefirCast.default)(_kefir.default, iconDescriptor).combine(this._eventStream.filter(event => event.eventName === 'viewStateChange').toProperty(() => null), opts => opts).takeUntilBy(this._stopper).onValue(opts => {
|
|
385
|
+
if (!opts) {
|
|
386
|
+
if (added) {
|
|
387
|
+
getCustomIconWrapper().remove();
|
|
388
|
+
getImgElement().remove();
|
|
389
|
+
getTooltipNodeWrapper().remove();
|
|
390
|
+
added = false;
|
|
391
|
+
}
|
|
392
|
+
} else {
|
|
393
|
+
let attachmentDiv;
|
|
394
|
+
if (this.getViewState() === 'COLLAPSED') {
|
|
395
|
+
attachmentDiv = (0, _querySelectorOrFail.default)(this._element, '.adf.ads td.gH span');
|
|
555
396
|
} else {
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
img.onmouseleave = function (event) {
|
|
602
|
-
event.preventDefault();
|
|
603
|
-
event.stopPropagation();
|
|
604
|
-
img.removeChild(tooltipWrapper);
|
|
605
|
-
attachmentIcon.emit('tooltipHidden');
|
|
606
|
-
};
|
|
607
|
-
|
|
608
|
-
img.removeAttribute('data-tooltip');
|
|
609
|
-
} else if (opts.tooltip && typeof opts.tooltip == 'string') {
|
|
610
|
-
img.setAttribute('data-tooltip', opts.tooltip);
|
|
611
|
-
} else {
|
|
612
|
-
img.removeAttribute('data-tooltip');
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
img.className =
|
|
616
|
-
opts.iconHtml != null
|
|
617
|
-
? `inboxsdk__message_attachment_iconWrapper ${
|
|
618
|
-
opts.iconClass || ''
|
|
619
|
-
}`
|
|
620
|
-
: 'inboxsdk__message_attachment_icon ' + (opts.iconClass || '');
|
|
621
|
-
|
|
622
|
-
if (opts.iconHtml != null) {
|
|
623
|
-
if (attachmentDiv.contains(getImgElement())) {
|
|
624
|
-
getImgElement().remove();
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
img.innerHTML = opts.iconHtml;
|
|
628
|
-
} else if (currentIconUrl != opts.iconUrl) {
|
|
629
|
-
if (attachmentDiv.contains(getCustomIconWrapper())) {
|
|
630
|
-
getCustomIconWrapper().remove();
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
img.style.background = opts.iconUrl
|
|
634
|
-
? 'url(' + opts.iconUrl + ') no-repeat 0 0'
|
|
635
|
-
: '';
|
|
636
|
-
|
|
637
|
-
currentIconUrl = opts.iconUrl;
|
|
397
|
+
attachmentDiv = (0, _querySelectorOrFail.default)(this._element, 'td.gH div.gK span');
|
|
398
|
+
}
|
|
399
|
+
const img = opts.iconHtml != null ? getCustomIconWrapper() : getImgElement();
|
|
400
|
+
const onClick = opts.onClick;
|
|
401
|
+
if (onClick) {
|
|
402
|
+
img.onclick = function (event) {
|
|
403
|
+
event.preventDefault();
|
|
404
|
+
event.stopPropagation();
|
|
405
|
+
onClick();
|
|
406
|
+
};
|
|
407
|
+
img.style.cursor = 'pointer';
|
|
408
|
+
} else {
|
|
409
|
+
img.onclick = null;
|
|
410
|
+
img.style.cursor = '';
|
|
411
|
+
}
|
|
412
|
+
if (opts.tooltip && typeof opts.tooltip == 'object' && opts.tooltip instanceof HTMLElement) {
|
|
413
|
+
const tooltipWrapper = getTooltipNodeWrapper();
|
|
414
|
+
tooltipWrapper.className = 'inboxsdk__message_attachment_tooltipWrapper';
|
|
415
|
+
tooltipWrapper.onclick = function (event) {
|
|
416
|
+
event.stopPropagation();
|
|
417
|
+
(0, _reemitClickEventForReact.default)(event);
|
|
418
|
+
};
|
|
419
|
+
tooltipWrapper.appendChild(opts.tooltip);
|
|
420
|
+
img.onmouseenter = function (event) {
|
|
421
|
+
event.preventDefault();
|
|
422
|
+
event.stopPropagation();
|
|
423
|
+
img.appendChild(tooltipWrapper);
|
|
424
|
+
attachmentIcon.emit('tooltipShown');
|
|
425
|
+
};
|
|
426
|
+
img.onmouseleave = function (event) {
|
|
427
|
+
event.preventDefault();
|
|
428
|
+
event.stopPropagation();
|
|
429
|
+
img.removeChild(tooltipWrapper);
|
|
430
|
+
attachmentIcon.emit('tooltipHidden');
|
|
431
|
+
};
|
|
432
|
+
img.removeAttribute('data-tooltip');
|
|
433
|
+
} else if (opts.tooltip && typeof opts.tooltip == 'string') {
|
|
434
|
+
img.setAttribute('data-tooltip', opts.tooltip);
|
|
435
|
+
} else {
|
|
436
|
+
img.removeAttribute('data-tooltip');
|
|
437
|
+
}
|
|
438
|
+
img.className = opts.iconHtml != null ? `inboxsdk__message_attachment_iconWrapper ${opts.iconClass || ''}` : 'inboxsdk__message_attachment_icon ' + (opts.iconClass || '');
|
|
439
|
+
if (opts.iconHtml != null) {
|
|
440
|
+
if (attachmentDiv.contains(getImgElement())) {
|
|
441
|
+
getImgElement().remove();
|
|
638
442
|
}
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
443
|
+
img.innerHTML = opts.iconHtml;
|
|
444
|
+
} else if (currentIconUrl != opts.iconUrl) {
|
|
445
|
+
if (attachmentDiv.contains(getCustomIconWrapper())) {
|
|
446
|
+
getCustomIconWrapper().remove();
|
|
643
447
|
}
|
|
448
|
+
img.style.background = opts.iconUrl ? 'url(' + opts.iconUrl + ') no-repeat 0 0' : '';
|
|
449
|
+
currentIconUrl = opts.iconUrl;
|
|
644
450
|
}
|
|
645
|
-
|
|
646
|
-
|
|
451
|
+
if (!attachmentDiv.contains(img)) {
|
|
452
|
+
attachmentDiv.appendChild(img);
|
|
453
|
+
added = true;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
});
|
|
647
457
|
return attachmentIcon;
|
|
648
458
|
}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
if (
|
|
652
|
-
this._element.classList.contains('kQ') ||
|
|
653
|
-
this._element.classList.contains('kx')
|
|
654
|
-
) {
|
|
459
|
+
getViewState() {
|
|
460
|
+
if (this._element.classList.contains('kQ') || this._element.classList.contains('kx')) {
|
|
655
461
|
return 'HIDDEN';
|
|
656
462
|
} else if (this._element.classList.contains('kv')) {
|
|
657
463
|
return 'COLLAPSED';
|
|
@@ -659,117 +465,75 @@ class GmailMessageView {
|
|
|
659
465
|
return 'EXPANDED';
|
|
660
466
|
}
|
|
661
467
|
}
|
|
662
|
-
|
|
663
|
-
hasOpenReply(): boolean {
|
|
468
|
+
hasOpenReply() {
|
|
664
469
|
return Boolean(this._replyElement);
|
|
665
470
|
}
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
var gmailAttachmentCardView = new GmailAttachmentCardView(
|
|
669
|
-
options,
|
|
670
|
-
this._driver,
|
|
671
|
-
this
|
|
672
|
-
);
|
|
673
|
-
|
|
471
|
+
addAttachmentCard(options) {
|
|
472
|
+
var gmailAttachmentCardView = new _gmailAttachmentCardView.default(options, this._driver, this);
|
|
674
473
|
if (!this._gmailAttachmentAreaView) {
|
|
675
474
|
this._gmailAttachmentAreaView = this._getAttachmentArea();
|
|
676
475
|
}
|
|
677
|
-
|
|
678
476
|
if (!this._gmailAttachmentAreaView) {
|
|
679
477
|
this._gmailAttachmentAreaView = this._createAttachmentArea();
|
|
680
478
|
}
|
|
681
|
-
|
|
682
|
-
this._gmailAttachmentAreaView.addGmailAttachmentCardView(
|
|
683
|
-
gmailAttachmentCardView
|
|
684
|
-
);
|
|
685
|
-
|
|
479
|
+
this._gmailAttachmentAreaView.addGmailAttachmentCardView(gmailAttachmentCardView);
|
|
686
480
|
return gmailAttachmentCardView;
|
|
687
481
|
}
|
|
688
|
-
|
|
689
482
|
_setupMessageStateStream() {
|
|
690
483
|
var self = this;
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
return { oldValue, newValue, currentClassList };
|
|
735
|
-
})
|
|
736
|
-
.map(function (event) {
|
|
737
|
-
if (event.newValue === 'EXPANDED' && event.oldValue !== 'EXPANDED') {
|
|
738
|
-
self._checkMessageOpenState(event.currentClassList);
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
return event;
|
|
742
|
-
})
|
|
743
|
-
.filter(function (event) {
|
|
744
|
-
return (
|
|
745
|
-
event.newValue !== event.oldValue &&
|
|
746
|
-
!!event.oldValue &&
|
|
747
|
-
!!event.newValue
|
|
748
|
-
);
|
|
749
|
-
})
|
|
750
|
-
.map(function (event) {
|
|
751
|
-
return {
|
|
752
|
-
eventName: 'viewStateChange',
|
|
753
|
-
oldValue: event.oldValue,
|
|
754
|
-
newValue: event.newValue,
|
|
755
|
-
};
|
|
756
|
-
})
|
|
757
|
-
);
|
|
484
|
+
this._eventStream.plug((0, _makeMutationObserverStream.default)(this._element, {
|
|
485
|
+
attributes: true,
|
|
486
|
+
attributeFilter: ['class'],
|
|
487
|
+
attributeOldValue: true
|
|
488
|
+
}).takeUntilBy(this._stopper).map(function (mutation) {
|
|
489
|
+
const currentClassList = mutation.target.classList;
|
|
490
|
+
const mutationOldValue = mutation.oldValue;
|
|
491
|
+
let oldValue;
|
|
492
|
+
let newValue;
|
|
493
|
+
if (mutationOldValue.indexOf('kQ') > -1 || mutationOldValue.indexOf('kx') > -1) {
|
|
494
|
+
oldValue = 'HIDDEN';
|
|
495
|
+
} else if (mutationOldValue.indexOf('kv') > -1 || mutationOldValue.indexOf('ky') > -1) {
|
|
496
|
+
oldValue = 'COLLAPSED';
|
|
497
|
+
} else if (mutationOldValue.indexOf('h7') > -1) {
|
|
498
|
+
oldValue = 'EXPANDED';
|
|
499
|
+
}
|
|
500
|
+
if (currentClassList.contains('kQ') || currentClassList.contains('kx')) {
|
|
501
|
+
newValue = 'HIDDEN';
|
|
502
|
+
} else if (currentClassList.contains('kv') || currentClassList.contains('ky')) {
|
|
503
|
+
newValue = 'COLLAPSED';
|
|
504
|
+
} else if (currentClassList.contains('h7')) {
|
|
505
|
+
newValue = 'EXPANDED';
|
|
506
|
+
}
|
|
507
|
+
return {
|
|
508
|
+
oldValue,
|
|
509
|
+
newValue,
|
|
510
|
+
currentClassList
|
|
511
|
+
};
|
|
512
|
+
}).map(function (event) {
|
|
513
|
+
if (event.newValue === 'EXPANDED' && event.oldValue !== 'EXPANDED') {
|
|
514
|
+
self._checkMessageOpenState(event.currentClassList);
|
|
515
|
+
}
|
|
516
|
+
return event;
|
|
517
|
+
}).filter(function (event) {
|
|
518
|
+
return event.newValue !== event.oldValue && !!event.oldValue && !!event.newValue;
|
|
519
|
+
}).map(function (event) {
|
|
520
|
+
return {
|
|
521
|
+
eventName: 'viewStateChange',
|
|
522
|
+
oldValue: event.oldValue,
|
|
523
|
+
newValue: event.newValue
|
|
524
|
+
};
|
|
525
|
+
}));
|
|
758
526
|
}
|
|
759
|
-
|
|
760
527
|
_processInitialState() {
|
|
761
528
|
this._checkMessageOpenState(this._element.classList);
|
|
762
529
|
}
|
|
763
|
-
|
|
764
|
-
_checkMessageOpenState(classList: Object) {
|
|
530
|
+
_checkMessageOpenState(classList) {
|
|
765
531
|
if (!classList.contains('h7')) {
|
|
766
532
|
return;
|
|
767
533
|
}
|
|
768
|
-
|
|
769
534
|
if (this._messageLoaded) {
|
|
770
535
|
return;
|
|
771
536
|
}
|
|
772
|
-
|
|
773
537
|
let messageId;
|
|
774
538
|
try {
|
|
775
539
|
messageId = this.getMessageID(true);
|
|
@@ -777,174 +541,120 @@ class GmailMessageView {
|
|
|
777
541
|
this._driver.getLogger().error(err);
|
|
778
542
|
return;
|
|
779
543
|
}
|
|
780
|
-
|
|
781
544
|
this._messageLoaded = true;
|
|
782
|
-
|
|
783
545
|
try {
|
|
784
|
-
this._driver.associateThreadAndMessageIDs(
|
|
785
|
-
this._threadViewDriver.getThreadID(),
|
|
786
|
-
messageId
|
|
787
|
-
);
|
|
546
|
+
this._driver.associateThreadAndMessageIDs(this._threadViewDriver.getThreadID(), messageId);
|
|
788
547
|
} catch (err) {
|
|
789
548
|
this._driver.getLogger().error(err);
|
|
790
549
|
}
|
|
791
550
|
this._gmailAttachmentAreaView = this._getAttachmentArea();
|
|
792
|
-
|
|
793
551
|
this._eventStream.emit({
|
|
794
552
|
type: 'internal',
|
|
795
|
-
eventName: 'messageLoad'
|
|
553
|
+
eventName: 'messageLoad'
|
|
796
554
|
});
|
|
797
|
-
|
|
798
555
|
this._setupReplyStream();
|
|
799
556
|
}
|
|
800
|
-
|
|
801
557
|
_setupReplyStream() {
|
|
802
558
|
const replyContainer = this._element.querySelector('.ip');
|
|
803
|
-
|
|
804
559
|
if (!replyContainer) {
|
|
805
560
|
return;
|
|
806
561
|
}
|
|
807
|
-
|
|
808
562
|
var self = this;
|
|
809
563
|
var currentReplyElementRemovalStream = null;
|
|
810
564
|
|
|
811
565
|
// hold off on emitting the mutation for a millisecond so
|
|
812
566
|
// that compose-view-driver-stream is listening to reply stream
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
self._eventStream.emit({
|
|
832
|
-
type: 'internal',
|
|
833
|
-
eventName: 'replyElement',
|
|
834
|
-
change: {
|
|
835
|
-
el: replyElement,
|
|
836
|
-
removalStream: currentReplyElementRemovalStream,
|
|
837
|
-
},
|
|
838
|
-
});
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
} else {
|
|
842
|
-
if (currentReplyElementRemovalStream) {
|
|
843
|
-
// Ending the currentReplyElementRemovalStream can trigger something
|
|
844
|
-
// that triggers the mutation observer stream which will call back into
|
|
845
|
-
// this function before we've unset currentReplyElementRemovalStream,
|
|
846
|
-
// so we need to copy the bus to a temporary variable and unset
|
|
847
|
-
// currentReplyElementRemovalStream first.
|
|
848
|
-
var temp = currentReplyElementRemovalStream;
|
|
849
|
-
currentReplyElementRemovalStream = null;
|
|
850
|
-
temp.emit(null);
|
|
851
|
-
temp.end();
|
|
852
|
-
|
|
853
|
-
self._replyElement = null;
|
|
567
|
+
_kefir.default.combine([(0, _makeMutationObserverChunkedStream.default)(replyContainer, {
|
|
568
|
+
attributes: true,
|
|
569
|
+
attributeFilter: ['class']
|
|
570
|
+
}), _kefir.default.later(1, null)]).merge(_kefir.default.later(1)).takeUntilBy(this._stopper).beforeEnd(() => 'END').onValue(mutation => {
|
|
571
|
+
if (mutation !== 'END' && replyContainer.classList.contains('adB')) {
|
|
572
|
+
if (!currentReplyElementRemovalStream) {
|
|
573
|
+
const replyElement = replyContainer.firstElementChild;
|
|
574
|
+
self._replyElement = replyElement;
|
|
575
|
+
if (replyElement) {
|
|
576
|
+
currentReplyElementRemovalStream = (0, _kefirBus.default)();
|
|
577
|
+
self._eventStream.emit({
|
|
578
|
+
type: 'internal',
|
|
579
|
+
eventName: 'replyElement',
|
|
580
|
+
change: {
|
|
581
|
+
el: replyElement,
|
|
582
|
+
removalStream: currentReplyElementRemovalStream
|
|
583
|
+
}
|
|
584
|
+
});
|
|
854
585
|
}
|
|
855
586
|
}
|
|
856
|
-
}
|
|
587
|
+
} else {
|
|
588
|
+
if (currentReplyElementRemovalStream) {
|
|
589
|
+
// Ending the currentReplyElementRemovalStream can trigger something
|
|
590
|
+
// that triggers the mutation observer stream which will call back into
|
|
591
|
+
// this function before we've unset currentReplyElementRemovalStream,
|
|
592
|
+
// so we need to copy the bus to a temporary variable and unset
|
|
593
|
+
// currentReplyElementRemovalStream first.
|
|
594
|
+
var temp = currentReplyElementRemovalStream;
|
|
595
|
+
currentReplyElementRemovalStream = null;
|
|
596
|
+
temp.emit(null);
|
|
597
|
+
temp.end();
|
|
598
|
+
self._replyElement = null;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
});
|
|
857
602
|
}
|
|
858
|
-
|
|
859
603
|
_monitorEmailAddressHovering() {
|
|
860
604
|
var self = this;
|
|
861
|
-
this._eventStream.plug(
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
},
|
|
886
|
-
contactType: contactType,
|
|
887
|
-
eventName: 'contactHover',
|
|
888
|
-
messageViewDriver: self,
|
|
889
|
-
};
|
|
890
|
-
})
|
|
891
|
-
);
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
_getAttachmentArea(): ?GmailAttachmentAreaView {
|
|
605
|
+
this._eventStream.plug(_kefir.default.fromEvents(this._element, 'mouseover').map(e => e.target).filter(function (element) {
|
|
606
|
+
return element && element.getAttribute('email');
|
|
607
|
+
}).map(function (element) {
|
|
608
|
+
let contactType = null;
|
|
609
|
+
if (!self._element.classList.contains('h7')) {
|
|
610
|
+
contactType = 'sender';
|
|
611
|
+
} else {
|
|
612
|
+
if (self._element.querySelector('h3.iw').contains(element)) {
|
|
613
|
+
contactType = 'sender';
|
|
614
|
+
} else {
|
|
615
|
+
contactType = 'recipient';
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
return {
|
|
619
|
+
get contact() {
|
|
620
|
+
return self._getUpdatedContact(_extractContactInformation(element));
|
|
621
|
+
},
|
|
622
|
+
contactType: contactType,
|
|
623
|
+
eventName: 'contactHover',
|
|
624
|
+
messageViewDriver: self
|
|
625
|
+
};
|
|
626
|
+
}));
|
|
627
|
+
}
|
|
628
|
+
_getAttachmentArea() {
|
|
895
629
|
if (this._element.querySelector('.hq')) {
|
|
896
|
-
return new
|
|
897
|
-
this._element.querySelector('.hq'),
|
|
898
|
-
this._driver,
|
|
899
|
-
this
|
|
900
|
-
);
|
|
630
|
+
return new _gmailAttachmentAreaView.default(this._element.querySelector('.hq'), this._driver, this);
|
|
901
631
|
}
|
|
902
|
-
|
|
903
632
|
return null;
|
|
904
633
|
}
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
const
|
|
908
|
-
null,
|
|
909
|
-
this._driver,
|
|
910
|
-
this
|
|
911
|
-
);
|
|
912
|
-
|
|
913
|
-
const beforeElement = querySelector(this._element, '.hi');
|
|
634
|
+
_createAttachmentArea() {
|
|
635
|
+
const gmailAttachmentAreaView = new _gmailAttachmentAreaView.default(null, this._driver, this);
|
|
636
|
+
const beforeElement = (0, _querySelectorOrFail.default)(this._element, '.hi');
|
|
914
637
|
const parentNode = beforeElement.parentNode;
|
|
915
638
|
if (!parentNode) throw new Error('parentNode not found');
|
|
916
|
-
parentNode.insertBefore(
|
|
917
|
-
gmailAttachmentAreaView.getElement(),
|
|
918
|
-
beforeElement
|
|
919
|
-
);
|
|
920
|
-
|
|
639
|
+
parentNode.insertBefore(gmailAttachmentAreaView.getElement(), beforeElement);
|
|
921
640
|
return gmailAttachmentAreaView;
|
|
922
641
|
}
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
return getUpdatedContact(inContact, this._element);
|
|
642
|
+
_getUpdatedContact(inContact) {
|
|
643
|
+
return (0, _getUpdatedContact.default)(inContact, this._element);
|
|
926
644
|
}
|
|
927
|
-
|
|
928
645
|
getReadyStream() {
|
|
929
646
|
return this._readyStream;
|
|
930
647
|
}
|
|
931
648
|
}
|
|
932
|
-
|
|
933
649
|
function _extractContactInformation(span) {
|
|
934
650
|
return {
|
|
935
651
|
name: span.getAttribute('name'),
|
|
936
|
-
emailAddress: span.getAttribute('email')
|
|
652
|
+
emailAddress: span.getAttribute('email')
|
|
937
653
|
};
|
|
938
654
|
}
|
|
939
|
-
|
|
940
|
-
export default defn(module, GmailMessageView);
|
|
941
|
-
|
|
942
|
-
// This function does not get executed. It's only checked by Flow to make sure
|
|
655
|
+
var _default = (0, _ud.defn)(module, GmailMessageView); // This function does not get executed. It's only checked by Flow to make sure
|
|
943
656
|
// this class successfully implements the type interface.
|
|
657
|
+
exports.default = _default;
|
|
944
658
|
function __interfaceCheck() {
|
|
945
|
-
const test
|
|
946
|
-
|
|
947
|
-
({}: any),
|
|
948
|
-
({}: any)
|
|
949
|
-
);
|
|
950
|
-
}
|
|
659
|
+
const test = new GmailMessageView({}, {}, {});
|
|
660
|
+
}
|