@inboxsdk/core 0.2.28-alpha.3 → 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/inboxsdk.js.map +1 -1
- package/package.json +5 -1
- package/src/build/exec.js +26 -0
- package/src/build/spawn.js +17 -0
- package/src/common/ajax.js +90 -0
- package/src/common/cachebust-url.js +10 -0
- package/src/common/censorHTMLstring.js +37 -0
- package/src/common/censorHTMLtree.js +28 -0
- package/src/common/censorJSONTree.js +15 -0
- package/src/common/connectivity-test.js +21 -0
- package/src/common/defer.js +11 -0
- package/src/common/find-parent.js +10 -0
- package/src/common/get-extension-id.js +7 -0
- package/src/common/get-or-fail.js +8 -0
- package/src/common/get-session-id.js +14 -0
- package/src/common/get-stack-trace.js +6 -0
- package/src/common/html-to-text.js +7 -0
- package/src/common/isElementVisible.js +6 -0
- package/src/common/load-script.js +127 -0
- package/src/common/log-error.js +191 -0
- package/src/common/quoted-split.js +18 -0
- package/src/common/rate-limit-queuer.js +57 -0
- package/src/common/rate-limit.js +14 -0
- package/src/common/version.js +6 -0
- 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/inboxsdk-js/loading/platform-implementation-loader.js +27 -0
- package/src/injected-js/gmail/constants.js +2 -0
- package/src/injected-js/gmail/modify-suggestions.js +106 -0
- 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/setup-gmonkey-handler.js +49 -0
- package/src/injected-js/gmail/sync-compose-processor-20220909.js +298 -0
- package/src/injected-js/gmail/sync-compose-processor.js +55 -0
- package/src/injected-js/gmail/sync-compose-request-processor.js +110 -0
- 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/injected-logger.js +50 -0
- 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/setupCustomViewEventAssassin.js +90 -0
- 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/nav-item-types.js +19 -0
- 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-app-menu-item.js +21 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-collapsible-panel.js +28 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-nav-item.js +98 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-support-item.js +4 -0
- 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/encodeDraftUrlId.js +8 -0
- 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-rfc-message-id-for-gmail-message-id.js +12 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-rfc-message-id-for-gmail-thread-id.js +33 -0
- 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/isIntegratedViewGmail.js +4 -0
- 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.js +44 -0
- 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/track-gmail-styles.js +95 -0
- 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/gmail-element-getter/get-main-content-element-changed-stream.js +38 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter/wait-for-gmail-mode-to-settle.js +12 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter.js +253 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-page-communicator.js +200 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-response-processor.js +533 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-sync-response-processor.js +289 -0
- package/src/platform-implementation-js/dom-driver/gmail/is-compose-titlebar-light-color.js +21 -0
- package/src/platform-implementation-js/dom-driver/gmail/make-xhr-interceptor.js +77 -93
- package/src/platform-implementation-js/dom-driver/gmail/makePageParserTree.js +28 -0
- package/src/platform-implementation-js/dom-driver/gmail/pageParserOptions.js +19 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-menu-item-view.js +126 -0
- 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-status-bar.js +101 -0
- 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/detectClassicRecipientsArea.js +38 -0
- 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-address-information-extractor.js +28 -0
- 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-recipients.js +22 -0
- 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/gmail-compose-button-view.js +233 -0
- 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/page-parser.js +223 -0
- 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/set-recipients.js +157 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/setupLinkPopovers.js +109 -0
- 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/attachment-icon.js +5 -0
- 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-nav-item-view.js +759 -0
- 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-support-item-view.js +84 -0
- 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/button-color-classes.js +33 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/button-view.js +325 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-accessory-button-view.js +58 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-parent-accessory-button-view.js +55 -0
- 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/buttons/modal-button-view.js +96 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/more-dropdown-button-view.js +30 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/more-parent-accessory-button-view.js +10 -0
- 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-dropdown-view.js +22 -0
- 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/getAccountUrlPart.js +17 -0
- 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/getOriginalMessagePage.js +33 -0
- package/src/platform-implementation-js/driver-common/getRfcMessageIdForSyncMessageId.js +16 -22
- package/src/platform-implementation-js/driver-common/getSyncThreadsForSearch.js +49 -0
- package/src/platform-implementation-js/driver-common/getThreadIdFromMessageId.js +14 -14
- package/src/platform-implementation-js/driver-common/gmailAjax.js +65 -0
- package/src/platform-implementation-js/driver-common/inboxAjax.js +12 -7
- package/src/platform-implementation-js/driver-common/render-custom-icon.js +16 -0
- 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-common/update-icon.js +90 -0
- 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/ErrorCollector.js +47 -0
- package/src/platform-implementation-js/lib/Membrane.js +22 -0
- package/src/platform-implementation-js/lib/ScrollableContainByScreen.js +30 -0
- 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/attemptWithRetries.js +16 -0
- package/src/platform-implementation-js/lib/common-page-communicator.js +137 -0
- 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/delay-asap.js +12 -0
- package/src/platform-implementation-js/lib/delay-idle.js +16 -0
- package/src/platform-implementation-js/lib/dom/block-and-reemit-keyboard-events.js +36 -0
- package/src/platform-implementation-js/lib/dom/element-view-mapper.js +8 -11
- package/src/platform-implementation-js/lib/dom/generic-button-view.js +39 -0
- package/src/platform-implementation-js/lib/dom/get-insert-before-element.js +39 -0
- package/src/platform-implementation-js/lib/dom/get-selection.js +23 -52
- package/src/platform-implementation-js/lib/dom/insert-element-in-order.js +38 -0
- 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/keyboard-shortcut-stream.js +12 -0
- package/src/platform-implementation-js/lib/dom/make-element-child-stream.js +79 -0
- package/src/platform-implementation-js/lib/dom/make-element-stream-merger.js +28 -0
- package/src/platform-implementation-js/lib/dom/make-element-view-stream.js +15 -0
- package/src/platform-implementation-js/lib/dom/make-mutation-observer-chunked-stream.js +15 -0
- package/src/platform-implementation-js/lib/dom/make-mutation-observer-stream.js +5 -0
- package/src/platform-implementation-js/lib/dom/on-mouse-down-and-up.js +15 -17
- package/src/platform-implementation-js/lib/dom/outsideClicksAndEscape.js +39 -0
- package/src/platform-implementation-js/lib/dom/parentNodes.js +8 -0
- package/src/platform-implementation-js/lib/dom/querySelectorOne.js +8 -11
- package/src/platform-implementation-js/lib/dom/querySelectorOrFail.js +6 -0
- package/src/platform-implementation-js/lib/dom/reemitClickEventForReact.js +22 -0
- 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/dom/simulate-key.js +46 -0
- package/src/platform-implementation-js/lib/dom/simulate-mouse-event.js +16 -0
- package/src/platform-implementation-js/lib/dom/trigger-relay-event.js +7 -0
- package/src/platform-implementation-js/lib/extract-contact-from-email-contact-string.js +25 -0
- package/src/platform-implementation-js/lib/extract-contact-from-email-contact-string.test.js +23 -26
- package/src/platform-implementation-js/lib/fake-window-resize.js +5 -0
- package/src/platform-implementation-js/lib/from-event-target-capture.js +12 -0
- package/src/platform-implementation-js/lib/fromEventsWithOptions.js +10 -0
- package/src/platform-implementation-js/lib/handle-compose-link-chips.js +86 -149
- package/src/platform-implementation-js/lib/handler-registry.js +67 -0
- package/src/platform-implementation-js/lib/idMap.js +45 -0
- package/src/platform-implementation-js/lib/imageRequest.js +8 -0
- package/src/platform-implementation-js/lib/incrementName.js +7 -0
- package/src/platform-implementation-js/lib/inject-script-EMBEDDED.js +14 -0
- package/src/platform-implementation-js/lib/inject-script.js +33 -0
- package/src/platform-implementation-js/lib/insert-link-chip-into-body.js +42 -57
- package/src/platform-implementation-js/lib/is-valid-app-id.js +27 -0
- package/src/platform-implementation-js/lib/is-valid-email.js +14 -0
- package/src/platform-implementation-js/lib/isNotNil.js +5 -0
- package/src/platform-implementation-js/lib/isStreakAppId.js +11 -0
- package/src/platform-implementation-js/lib/logger.js +441 -0
- 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/persistent-queue.js +107 -0
- 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/safe-event-emitter.js +17 -0
- package/src/platform-implementation-js/lib/shared-style.js +14 -13
- package/src/platform-implementation-js/lib/stopper-pool.js +41 -0
- package/src/platform-implementation-js/lib/stream-wait-for.js +30 -0
- 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/lib/wait-for.js +28 -0
- package/src/platform-implementation-js/lib/waitForAsync.js +19 -0
- 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/app-menu.d.ts.map +1 -1
- package/src/platform-implementation-js/namespaces/app-menu.js +31 -0
- package/src/platform-implementation-js/namespaces/butter-bar.js +163 -0
- 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/SimpleElementView.js +16 -0
- package/src/platform-implementation-js/views/app-menu-item-view.js +257 -0
- package/src/platform-implementation-js/views/app-toolbar-button-view.js +26 -47
- package/src/platform-implementation-js/views/collapsible-panel-view.js +222 -0
- package/src/platform-implementation-js/views/collapsible-section-view.js +66 -63
- package/src/platform-implementation-js/views/compose-button-view.js +45 -0
- package/src/platform-implementation-js/views/compose-view.js +312 -0
- 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/keyboard-shortcut-handle.js +14 -0
- 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/buttons/basic-button-view-controller.js +39 -0
- package/src/platform-implementation-js/widgets/buttons/dropdown-button-view-controller.js +98 -0
- package/src/platform-implementation-js/widgets/buttons/dropdown-view.js +122 -0
- 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,208 +1,126 @@
|
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
import getSyncThreadFromSyncThreadId from './gmail-driver/getSyncThreadFromSyncThreadId';
|
|
70
|
-
import getSyncThreadForOldGmailThreadId from './gmail-driver/getSyncThreadForOldGmailThreadId';
|
|
71
|
-
|
|
72
|
-
import toItemWithLifetimeStream from '../../lib/toItemWithLifetimeStream';
|
|
73
|
-
import toLiveSet from '../../lib/toLiveSet';
|
|
74
|
-
|
|
75
|
-
import waitFor from '../../lib/stream-wait-for';
|
|
76
|
-
import promiseWaitFor from '../../lib/wait-for';
|
|
77
|
-
|
|
78
|
-
import type Logger from '../../lib/logger';
|
|
79
|
-
import type PageCommunicator from './gmail-page-communicator';
|
|
80
|
-
import type { RouteParams } from '../../namespaces/router';
|
|
81
|
-
import type ButterBar from '../../namespaces/butter-bar';
|
|
82
|
-
import type { Driver, DrawerViewOptions } from '../../driver-interfaces/driver';
|
|
83
|
-
import type { ComposeViewDriver } from '../../driver-interfaces/compose-view-driver';
|
|
84
|
-
import type GmailComposeView from './views/gmail-compose-view';
|
|
85
|
-
import type GmailMessageView from './views/gmail-message-view';
|
|
86
|
-
import type GmailThreadView from './views/gmail-thread-view';
|
|
87
|
-
import type GmailToolbarView from './views/gmail-toolbar-view';
|
|
88
|
-
import type GmailRowListView from './views/gmail-row-list-view';
|
|
89
|
-
import type GmailRouteView from './views/gmail-route-view/gmail-route-view';
|
|
90
|
-
import type GmailSupportItemView from './views/gmail-support-item-view';
|
|
91
|
-
import type SupportItemDescriptor from './views/gmail-support-item-view';
|
|
92
|
-
import type { PiOpts, EnvData } from '../../platform-implementation';
|
|
93
|
-
import type NativeGmailNavItemView from './views/native-gmail-nav-item-view';
|
|
94
|
-
import type { AppMenuItemDescriptor } from '../../namespaces/app-menu';
|
|
95
|
-
|
|
96
|
-
import type ContentPanelViewDriver from '../../driver-common/sidebar/ContentPanelViewDriver';
|
|
97
|
-
import GmailNavItemView from './views/gmail-nav-item-view';
|
|
98
|
-
|
|
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 _toValueObservable = _interopRequireDefault(require("live-set/toValueObservable"));
|
|
10
|
+
var _ud = require("ud");
|
|
11
|
+
var _transducers = _interopRequireDefault(require("transducers.js"));
|
|
12
|
+
var _kefir = _interopRequireDefault(require("kefir"));
|
|
13
|
+
var _kefirStopper = _interopRequireDefault(require("kefir-stopper"));
|
|
14
|
+
var _kefirBus = _interopRequireDefault(require("kefir-bus"));
|
|
15
|
+
var _asap = _interopRequireDefault(require("asap"));
|
|
16
|
+
var _includes = _interopRequireDefault(require("lodash/includes"));
|
|
17
|
+
var _getOrFail = _interopRequireDefault(require("../../../common/get-or-fail"));
|
|
18
|
+
var _showAppIdWarning = _interopRequireDefault(require("./gmail-driver/show-app-id-warning"));
|
|
19
|
+
var _makePageParserTree = _interopRequireDefault(require("./makePageParserTree"));
|
|
20
|
+
var _gmailElementGetter = _interopRequireDefault(require("./gmail-element-getter"));
|
|
21
|
+
var _makeXhrInterceptor = _interopRequireDefault(require("./make-xhr-interceptor"));
|
|
22
|
+
var _gmailBackdrop = _interopRequireDefault(require("./views/gmail-backdrop"));
|
|
23
|
+
var _gmailThreadRowView = require("./views/gmail-thread-row-view");
|
|
24
|
+
var _gmailTopMessageBarDriver = _interopRequireDefault(require("./widgets/gmail-top-message-bar-driver"));
|
|
25
|
+
var _gmailModalViewDriver = _interopRequireDefault(require("./widgets/gmail-modal-view-driver"));
|
|
26
|
+
var _gmailMoleViewDriver = _interopRequireDefault(require("./widgets/gmail-mole-view-driver"));
|
|
27
|
+
var _inboxDrawerView = _interopRequireDefault(require("../inbox/views/inbox-drawer-view"));
|
|
28
|
+
var _gmailRouteProcessor = _interopRequireDefault(require("./views/gmail-route-view/gmail-route-processor"));
|
|
29
|
+
var _keyboardShortcutHelpModifier = _interopRequireDefault(require("./gmail-driver/keyboard-shortcut-help-modifier"));
|
|
30
|
+
var _openDraftByMessageId = _interopRequireDefault(require("./gmail-driver/open-draft-by-message-id"));
|
|
31
|
+
var _userInfo = _interopRequireDefault(require("./gmail-driver/user-info"));
|
|
32
|
+
var _gmailButterBarDriver = _interopRequireDefault(require("./gmail-butter-bar-driver"));
|
|
33
|
+
var _trackGmailStyles = _interopRequireDefault(require("./gmail-driver/track-gmail-styles"));
|
|
34
|
+
var _temporaryTrackDownloadUrlValidity = _interopRequireDefault(require("./gmail-driver/temporary-track-download-url-validity"));
|
|
35
|
+
var _getGmailThreadIdForRfcMessageId = _interopRequireDefault(require("../../driver-common/getGmailThreadIdForRfcMessageId"));
|
|
36
|
+
var _getRfcMessageIdForGmailThreadId = _interopRequireDefault(require("./gmail-driver/get-rfc-message-id-for-gmail-thread-id"));
|
|
37
|
+
var _getGmailMessageIdForSyncMessageId = _interopRequireDefault(require("../../driver-common/getGmailMessageIdForSyncMessageId"));
|
|
38
|
+
var _bimapcache = _interopRequireDefault(require("bimapcache"));
|
|
39
|
+
var _getDraftIdForMessageId = _interopRequireDefault(require("./gmail-driver/get-draft-id-for-message-id"));
|
|
40
|
+
var _addNavItem = _interopRequireDefault(require("./gmail-driver/add-nav-item"));
|
|
41
|
+
var _addAppMenuItem = require("./gmail-driver/add-app-menu-item");
|
|
42
|
+
var _addSupportItem = _interopRequireDefault(require("./gmail-driver/add-support-item"));
|
|
43
|
+
var _gotoView = _interopRequireDefault(require("./gmail-driver/goto-view"));
|
|
44
|
+
var _showCustomThreadList = _interopRequireDefault(require("./gmail-driver/show-custom-thread-list"));
|
|
45
|
+
var _showCustomRouteView = _interopRequireDefault(require("./gmail-driver/show-custom-route-view"));
|
|
46
|
+
var _showNativeRouteView = _interopRequireDefault(require("./gmail-driver/show-native-route-view"));
|
|
47
|
+
var _registerSearchSuggestionsProvider = _interopRequireDefault(require("./gmail-driver/register-search-suggestions-provider"));
|
|
48
|
+
var _setupComposeViewDriverStream = _interopRequireDefault(require("./gmail-driver/setup-compose-view-driver-stream"));
|
|
49
|
+
var _trackEvents = _interopRequireDefault(require("./gmail-driver/track-events"));
|
|
50
|
+
var _gmailLoadEvent = _interopRequireDefault(require("./gmail-driver/gmail-load-event"));
|
|
51
|
+
var _threadRowIdentifier = _interopRequireDefault(require("./gmail-driver/thread-row-identifier"));
|
|
52
|
+
var _customStyle = _interopRequireDefault(require("./custom-style"));
|
|
53
|
+
var _overrideGmailBackButton = _interopRequireDefault(require("./gmail-driver/override-gmail-back-button"));
|
|
54
|
+
var _addToolbarButtonForApp = _interopRequireDefault(require("./gmail-driver/add-toolbar-button-for-app"));
|
|
55
|
+
var _setupRouteViewDriverStream = _interopRequireDefault(require("./gmail-driver/setup-route-view-driver-stream"));
|
|
56
|
+
var _getNativeNavItem = _interopRequireDefault(require("./gmail-driver/get-native-nav-item"));
|
|
57
|
+
var _createLink = _interopRequireDefault(require("./gmail-driver/create-link"));
|
|
58
|
+
var _registerSearchQueryRewriter = _interopRequireDefault(require("./gmail-driver/register-search-query-rewriter"));
|
|
59
|
+
var _openComposeWindow = _interopRequireDefault(require("./gmail-driver/open-compose-window"));
|
|
60
|
+
var _gmailAppSidebarView = _interopRequireDefault(require("./views/gmail-app-sidebar-view"));
|
|
61
|
+
var _suppressAddon = _interopRequireDefault(require("./gmail-driver/suppressAddon"));
|
|
62
|
+
var _getSyncThreadFromSyncThreadId = _interopRequireDefault(require("./gmail-driver/getSyncThreadFromSyncThreadId"));
|
|
63
|
+
var _getSyncThreadForOldGmailThreadId = _interopRequireDefault(require("./gmail-driver/getSyncThreadForOldGmailThreadId"));
|
|
64
|
+
var _toItemWithLifetimeStream = _interopRequireDefault(require("../../lib/toItemWithLifetimeStream"));
|
|
65
|
+
var _toLiveSet = _interopRequireDefault(require("../../lib/toLiveSet"));
|
|
66
|
+
var _streamWaitFor = _interopRequireDefault(require("../../lib/stream-wait-for"));
|
|
67
|
+
var _waitFor = _interopRequireDefault(require("../../lib/wait-for"));
|
|
68
|
+
var _gmailNavItemView = _interopRequireDefault(require("./views/gmail-nav-item-view"));
|
|
99
69
|
class GmailDriver {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
_pageCommunicatorPromise: Promise<PageCommunicator>;
|
|
115
|
-
_butterBar: ?ButterBar;
|
|
116
|
-
_butterBarDriver: GmailButterBarDriver;
|
|
117
|
-
_routeViewDriverStream: Kefir.Observable<GmailRouteView>;
|
|
118
|
-
_rowListViewDriverStream: Kefir.Observable<Object>;
|
|
119
|
-
_threadRowViewDriverKefirStream: Kefir.Observable<Object>;
|
|
120
|
-
_threadViewDriverLiveSet: LiveSet<GmailThreadView>;
|
|
121
|
-
_toolbarViewDriverLiveSet: LiveSet<GmailToolbarView>;
|
|
122
|
-
_composeViewDriverStream: Kefir.Observable<GmailComposeView>;
|
|
123
|
-
_xhrInterceptorStream: Kefir.Observable<Object>;
|
|
124
|
-
_messageViewDriverStream: Kefir.Observable<GmailMessageView>;
|
|
125
|
-
_stopper = kefirStopper();
|
|
126
|
-
_navMarkerHiddenChanged: Bus<null> = kefirBus();
|
|
127
|
-
_addonSidebarHiddenChanged: Bus<null> = kefirBus();
|
|
128
|
-
_userInfo: UserInfo;
|
|
129
|
-
_timestampAccountSwitcherReady: ?number;
|
|
130
|
-
_timestampGlobalsFound: ?number;
|
|
131
|
-
_timestampOnready: ?number;
|
|
132
|
-
_lastCustomThreadListActivity: ?{ customRouteID: string, timestamp: Date };
|
|
133
|
-
_currentRouteViewDriver: GmailRouteView;
|
|
134
|
-
_appSidebarView: ?GmailAppSidebarView = null;
|
|
135
|
-
|
|
136
|
-
getGmailThreadIdForRfcMessageId: (rfcId: string) => Promise<string>;
|
|
137
|
-
getRfcMessageIdForGmailThreadId: (threadId: string) => Promise<string>;
|
|
138
|
-
getSyncThreadIdForOldGmailThreadId: (threadId: string) => Promise<string>;
|
|
139
|
-
getOldGmailThreadIdFromSyncThreadId: (threadId: string) => Promise<string>;
|
|
140
|
-
removeCachedOldGmailThreadIdFromSyncThreadId: (threadId: string) => void;
|
|
141
|
-
|
|
142
|
-
getGmailMessageIdForSyncDraftId: (syncDraftId: string) => Promise<string>;
|
|
143
|
-
getGmailMessageIdForSyncMessageId: (syncMessageId: string) => Promise<string>;
|
|
144
|
-
removeCachedGmailMessageIdForSyncMessageId: (syncMessageID: string) => void;
|
|
145
|
-
|
|
146
|
-
constructor(
|
|
147
|
-
appId: string,
|
|
148
|
-
LOADER_VERSION: string,
|
|
149
|
-
IMPL_VERSION: string,
|
|
150
|
-
logger: Logger,
|
|
151
|
-
opts: PiOpts,
|
|
152
|
-
envData: EnvData
|
|
153
|
-
) {
|
|
154
|
-
(this: Driver); // interface check
|
|
155
|
-
customStyle();
|
|
156
|
-
|
|
70
|
+
constructor(appId, LOADER_VERSION, IMPL_VERSION, logger, opts, envData) {
|
|
71
|
+
(0, _defineProperty2.default)(this, "_customRouteIDs", new Set());
|
|
72
|
+
(0, _defineProperty2.default)(this, "_customListRouteIDs", new Map());
|
|
73
|
+
(0, _defineProperty2.default)(this, "_customListSearchStringsToRouteIds", new Map());
|
|
74
|
+
(0, _defineProperty2.default)(this, "_messageIDsToThreadIDs", new Map());
|
|
75
|
+
(0, _defineProperty2.default)(this, "_stopper", (0, _kefirStopper.default)());
|
|
76
|
+
(0, _defineProperty2.default)(this, "_navMarkerHiddenChanged", (0, _kefirBus.default)());
|
|
77
|
+
(0, _defineProperty2.default)(this, "_addonSidebarHiddenChanged", (0, _kefirBus.default)());
|
|
78
|
+
(0, _defineProperty2.default)(this, "_appSidebarView", null);
|
|
79
|
+
(0, _defineProperty2.default)(this, "_recentSyncDraftIds", new Map());
|
|
80
|
+
(0, _defineProperty2.default)(this, "_selectedThreadRows", _transducers.default.mapcat(gmailRowListView => gmailRowListView.getSelectedThreadRowViewDrivers()));
|
|
81
|
+
(0, _defineProperty2.default)(this, "_threadRowViewSelectionChanges", (0, _kefirBus.default)());
|
|
82
|
+
this; // interface check
|
|
83
|
+
(0, _customStyle.default)();
|
|
157
84
|
this._appId = appId;
|
|
158
85
|
this._logger = logger;
|
|
159
86
|
this._opts = opts;
|
|
160
87
|
this._envData = envData;
|
|
161
|
-
this._page =
|
|
88
|
+
this._page = (0, _makePageParserTree.default)(this, document);
|
|
162
89
|
this._stopper.onValue(() => this._page.dump());
|
|
163
90
|
|
|
164
91
|
// Manages the mapping between RFC Message Ids and Gmail Message Ids. Caches to
|
|
165
92
|
// localStorage. Used for custom thread lists.
|
|
166
93
|
{
|
|
167
|
-
const rfcIdCache = new
|
|
94
|
+
const rfcIdCache = new _bimapcache.default({
|
|
168
95
|
key: 'inboxsdk__cached_thread_ids',
|
|
169
|
-
getAfromB: (gmailThreadId)
|
|
170
|
-
|
|
171
|
-
getBfromA: (rfcMessageId) =>
|
|
172
|
-
getGmailThreadIdForRfcMessageId(this, rfcMessageId),
|
|
96
|
+
getAfromB: gmailThreadId => (0, _getRfcMessageIdForGmailThreadId.default)(this, gmailThreadId),
|
|
97
|
+
getBfromA: rfcMessageId => (0, _getGmailThreadIdForRfcMessageId.default)(this, rfcMessageId)
|
|
173
98
|
});
|
|
174
|
-
this.getGmailThreadIdForRfcMessageId = (rfcMessageId)
|
|
175
|
-
|
|
176
|
-
this.getRfcMessageIdForGmailThreadId = (gmailThreadId) =>
|
|
177
|
-
rfcIdCache.getAfromB(gmailThreadId);
|
|
99
|
+
this.getGmailThreadIdForRfcMessageId = rfcMessageId => rfcIdCache.getBfromA(rfcMessageId);
|
|
100
|
+
this.getRfcMessageIdForGmailThreadId = gmailThreadId => rfcIdCache.getAfromB(gmailThreadId);
|
|
178
101
|
}
|
|
179
102
|
|
|
180
103
|
// Manages mapping between old hex thread ids and new sync based thread ids
|
|
181
104
|
{
|
|
182
|
-
const syncThreadIdToOldGmailThreadIdCache = new
|
|
105
|
+
const syncThreadIdToOldGmailThreadIdCache = new _bimapcache.default({
|
|
183
106
|
key: 'inboxsdk__cached_sync_thread_id_old_gmail_thread_id',
|
|
184
|
-
getAfromB:
|
|
185
|
-
return
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
(syncThread) => {
|
|
192
|
-
if (syncThread) return syncThread.oldGmailThreadID;
|
|
193
|
-
else throw new Error('syncThread not found');
|
|
194
|
-
}
|
|
195
|
-
);
|
|
107
|
+
getAfromB: oldGmailThreadId => {
|
|
108
|
+
return (0, _getSyncThreadForOldGmailThreadId.default)(this, oldGmailThreadId).then(_ref => {
|
|
109
|
+
let {
|
|
110
|
+
syncThreadID
|
|
111
|
+
} = _ref;
|
|
112
|
+
return syncThreadID;
|
|
113
|
+
});
|
|
196
114
|
},
|
|
115
|
+
getBfromA: syncThreadID => {
|
|
116
|
+
return (0, _getSyncThreadFromSyncThreadId.default)(this, syncThreadID).then(syncThread => {
|
|
117
|
+
if (syncThread) return syncThread.oldGmailThreadID;else throw new Error('syncThread not found');
|
|
118
|
+
});
|
|
119
|
+
}
|
|
197
120
|
});
|
|
198
|
-
this.getSyncThreadIdForOldGmailThreadId = (oldGmailThreadId)
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
this.getOldGmailThreadIdFromSyncThreadId = (syncThreadId) =>
|
|
202
|
-
syncThreadIdToOldGmailThreadIdCache.getBfromA(syncThreadId);
|
|
203
|
-
|
|
204
|
-
this.removeCachedOldGmailThreadIdFromSyncThreadId = (syncThreadId) =>
|
|
205
|
-
syncThreadIdToOldGmailThreadIdCache.removeAfromCache(syncThreadId);
|
|
121
|
+
this.getSyncThreadIdForOldGmailThreadId = oldGmailThreadId => syncThreadIdToOldGmailThreadIdCache.getAfromB(oldGmailThreadId);
|
|
122
|
+
this.getOldGmailThreadIdFromSyncThreadId = syncThreadId => syncThreadIdToOldGmailThreadIdCache.getBfromA(syncThreadId);
|
|
123
|
+
this.removeCachedOldGmailThreadIdFromSyncThreadId = syncThreadId => syncThreadIdToOldGmailThreadIdCache.removeAfromCache(syncThreadId);
|
|
206
124
|
}
|
|
207
125
|
|
|
208
126
|
// mapping between sync message ids and old message ids
|
|
@@ -210,111 +128,92 @@ class GmailDriver {
|
|
|
210
128
|
try {
|
|
211
129
|
// TODO remove sometime after March 24 2019 to give time for this to
|
|
212
130
|
// run for most users.
|
|
213
|
-
localStorage.removeItem(
|
|
214
|
-
'inboxsdk__cached_gmail_and_inbox_message_ids_2'
|
|
215
|
-
);
|
|
131
|
+
localStorage.removeItem('inboxsdk__cached_gmail_and_inbox_message_ids_2');
|
|
216
132
|
} catch (err) {
|
|
217
133
|
// eslint-disable-next-line no-console
|
|
218
134
|
console.error(err);
|
|
219
135
|
}
|
|
220
|
-
const gmailMessageIdForSyncMessageIdCache = new
|
|
136
|
+
const gmailMessageIdForSyncMessageIdCache = new _bimapcache.default({
|
|
221
137
|
key: 'inboxsdk__cached_gmail_and_inbox_message_ids_3',
|
|
222
|
-
getAfromB:
|
|
223
|
-
getGmailMessageIdForSyncMessageId(this, sync),
|
|
138
|
+
getAfromB: sync => (0, _getGmailMessageIdForSyncMessageId.default)(this, sync),
|
|
224
139
|
getBfromA() {
|
|
225
140
|
throw new Error('should not happen');
|
|
226
|
-
}
|
|
141
|
+
}
|
|
227
142
|
});
|
|
228
|
-
this.getGmailMessageIdForSyncMessageId = (syncMessageId)
|
|
229
|
-
|
|
230
|
-
this.removeCachedGmailMessageIdForSyncMessageId = (syncMessageId) =>
|
|
231
|
-
gmailMessageIdForSyncMessageIdCache.removeBfromCache(syncMessageId);
|
|
143
|
+
this.getGmailMessageIdForSyncMessageId = syncMessageId => gmailMessageIdForSyncMessageIdCache.getAfromB(syncMessageId);
|
|
144
|
+
this.removeCachedGmailMessageIdForSyncMessageId = syncMessageId => gmailMessageIdForSyncMessageIdCache.removeBfromCache(syncMessageId);
|
|
232
145
|
|
|
233
146
|
// It's important that this doesn't use the same cache for looking up
|
|
234
147
|
// sync message IDs, because the legacy ID of a draft changes when it's
|
|
235
148
|
// sent. It doesn't really need to be cached so it's not here.
|
|
236
|
-
this.getGmailMessageIdForSyncDraftId = (syncDraftId)
|
|
237
|
-
getGmailMessageIdForSyncMessageId(this, syncDraftId);
|
|
149
|
+
this.getGmailMessageIdForSyncDraftId = syncDraftId => (0, _getGmailMessageIdForSyncMessageId.default)(this, syncDraftId);
|
|
238
150
|
}
|
|
239
|
-
|
|
240
|
-
this.
|
|
241
|
-
this.
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
.takeUntilBy(
|
|
246
|
-
toItemWithLifetimeStream(this._page.tree.getAllByTag('supportMenu'))
|
|
247
|
-
)
|
|
248
|
-
.onValue(() => {
|
|
249
|
-
this._logger.errorSite(new Error('Failed to find gmail supportMenu'));
|
|
250
|
-
});
|
|
251
|
-
|
|
151
|
+
this._gmailRouteProcessor = new _gmailRouteProcessor.default();
|
|
152
|
+
this._keyboardShortcutHelpModifier = new _keyboardShortcutHelpModifier.default();
|
|
153
|
+
this._butterBarDriver = new _gmailButterBarDriver.default();
|
|
154
|
+
_kefir.default.later(45 * 1000).takeUntilBy((0, _toItemWithLifetimeStream.default)(this._page.tree.getAllByTag('supportMenu'))).onValue(() => {
|
|
155
|
+
this._logger.errorSite(new Error('Failed to find gmail supportMenu'));
|
|
156
|
+
});
|
|
252
157
|
this._setupEventStreams();
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
.
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
.catch((err) => {
|
|
266
|
-
this._logger.error(err);
|
|
267
|
-
});
|
|
158
|
+
this.onready.then(() => {
|
|
159
|
+
(0, _trackEvents.default)(this);
|
|
160
|
+
(0, _gmailLoadEvent.default)(this);
|
|
161
|
+
(0, _overrideGmailBackButton.default)(this, this._gmailRouteProcessor);
|
|
162
|
+
(0, _trackGmailStyles.default)();
|
|
163
|
+
(0, _temporaryTrackDownloadUrlValidity.default)(this);
|
|
164
|
+
if (opts.suppressAddonTitle != null) {
|
|
165
|
+
(0, _suppressAddon.default)(this, opts.suppressAddonTitle);
|
|
166
|
+
}
|
|
167
|
+
}).catch(err => {
|
|
168
|
+
this._logger.error(err);
|
|
169
|
+
});
|
|
268
170
|
}
|
|
269
|
-
|
|
270
171
|
destroy() {
|
|
271
172
|
this._threadRowViewSelectionChanges.end();
|
|
272
173
|
this._keyboardShortcutHelpModifier.destroy();
|
|
273
174
|
this._stopper.destroy();
|
|
274
|
-
|
|
275
|
-
removeAllThreadRowUnclaimedModifications();
|
|
175
|
+
(0, _gmailThreadRowView.removeAllThreadRowUnclaimedModifications)();
|
|
276
176
|
}
|
|
277
|
-
|
|
278
|
-
getAppId(): string {
|
|
177
|
+
getAppId() {
|
|
279
178
|
return this._appId;
|
|
280
179
|
}
|
|
281
|
-
getOpts()
|
|
180
|
+
getOpts() {
|
|
282
181
|
return this._opts;
|
|
283
182
|
}
|
|
284
|
-
getPageCommunicator()
|
|
183
|
+
getPageCommunicator() {
|
|
285
184
|
return this._pageCommunicator;
|
|
286
185
|
}
|
|
287
|
-
getPageCommunicatorPromise()
|
|
186
|
+
getPageCommunicatorPromise() {
|
|
288
187
|
return this._pageCommunicatorPromise;
|
|
289
188
|
}
|
|
290
|
-
getLogger()
|
|
189
|
+
getLogger() {
|
|
291
190
|
return this._logger;
|
|
292
191
|
}
|
|
293
|
-
getTagTree()
|
|
192
|
+
getTagTree() {
|
|
294
193
|
return this._page.tree;
|
|
295
194
|
}
|
|
296
|
-
getCustomListSearchStringsToRouteIds()
|
|
195
|
+
getCustomListSearchStringsToRouteIds() {
|
|
297
196
|
return this._customListSearchStringsToRouteIds;
|
|
298
197
|
}
|
|
299
|
-
getThreadRowIdentifier()
|
|
198
|
+
getThreadRowIdentifier() {
|
|
300
199
|
return this._threadRowIdentifier;
|
|
301
200
|
}
|
|
302
|
-
getButterBarDriver()
|
|
201
|
+
getButterBarDriver() {
|
|
303
202
|
return this._butterBarDriver;
|
|
304
203
|
}
|
|
305
|
-
getButterBar()
|
|
204
|
+
getButterBar() {
|
|
306
205
|
return this._butterBar;
|
|
307
206
|
}
|
|
308
|
-
setButterBar(bb
|
|
207
|
+
setButterBar(bb) {
|
|
309
208
|
this._butterBar = bb;
|
|
310
209
|
}
|
|
311
|
-
getCustomRouteIDs()
|
|
210
|
+
getCustomRouteIDs() {
|
|
312
211
|
return this._customRouteIDs;
|
|
313
212
|
}
|
|
314
|
-
getCustomListRouteIDs()
|
|
213
|
+
getCustomListRouteIDs() {
|
|
315
214
|
return this._customListRouteIDs;
|
|
316
215
|
}
|
|
317
|
-
getKeyboardShortcutHelpModifier()
|
|
216
|
+
getKeyboardShortcutHelpModifier() {
|
|
318
217
|
return this._keyboardShortcutHelpModifier;
|
|
319
218
|
}
|
|
320
219
|
getRouteViewDriverStream() {
|
|
@@ -327,41 +226,32 @@ class GmailDriver {
|
|
|
327
226
|
return this._threadRowViewDriverKefirStream;
|
|
328
227
|
}
|
|
329
228
|
getThreadViewDriverStream() {
|
|
330
|
-
return
|
|
331
|
-
|
|
332
|
-
|
|
229
|
+
return (0, _toItemWithLifetimeStream.default)(this._threadViewDriverLiveSet).map(_ref2 => {
|
|
230
|
+
let {
|
|
231
|
+
el
|
|
232
|
+
} = _ref2;
|
|
233
|
+
return el;
|
|
234
|
+
});
|
|
333
235
|
}
|
|
334
236
|
getAttachmentCardViewDriverStream() {
|
|
335
|
-
return this._messageViewDriverStream
|
|
336
|
-
.flatMap((messageViewDriver) =>
|
|
337
|
-
messageViewDriver.isLoaded()
|
|
338
|
-
? Kefir.constant(messageViewDriver)
|
|
339
|
-
: messageViewDriver
|
|
340
|
-
.getEventStream()
|
|
341
|
-
.filter((event) => event.eventName === 'messageLoad')
|
|
342
|
-
.map(() => messageViewDriver)
|
|
343
|
-
.take(1)
|
|
344
|
-
)
|
|
345
|
-
.map((messageView) => messageView.getAttachmentCardViewDrivers())
|
|
346
|
-
.flatten();
|
|
237
|
+
return this._messageViewDriverStream.flatMap(messageViewDriver => messageViewDriver.isLoaded() ? _kefir.default.constant(messageViewDriver) : messageViewDriver.getEventStream().filter(event => event.eventName === 'messageLoad').map(() => messageViewDriver).take(1)).map(messageView => messageView.getAttachmentCardViewDrivers()).flatten();
|
|
347
238
|
}
|
|
348
239
|
getComposeViewDriverStream() {
|
|
349
240
|
return this._composeViewDriverStream;
|
|
350
241
|
}
|
|
351
|
-
getXhrInterceptorStream()
|
|
242
|
+
getXhrInterceptorStream() {
|
|
352
243
|
return this._xhrInterceptorStream;
|
|
353
244
|
}
|
|
354
245
|
getMessageViewDriverStream() {
|
|
355
246
|
return this._messageViewDriverStream;
|
|
356
247
|
}
|
|
357
|
-
getStopper()
|
|
248
|
+
getStopper() {
|
|
358
249
|
return this._stopper;
|
|
359
250
|
}
|
|
360
|
-
getEnvData()
|
|
251
|
+
getEnvData() {
|
|
361
252
|
return this._envData;
|
|
362
253
|
}
|
|
363
|
-
|
|
364
|
-
getTimestampOnReady(): number {
|
|
254
|
+
getTimestampOnReady() {
|
|
365
255
|
if (this._timestampOnready == null) {
|
|
366
256
|
this._logger.error(new Error('getTimestampOnReady called before ready'));
|
|
367
257
|
return Date.now();
|
|
@@ -371,218 +261,169 @@ class GmailDriver {
|
|
|
371
261
|
|
|
372
262
|
// Returns a stream that emits an event once at least `time` milliseconds has
|
|
373
263
|
// passed since the GmailDriver's ready event.
|
|
374
|
-
delayToTimeAfterReady(time
|
|
264
|
+
delayToTimeAfterReady(time) {
|
|
375
265
|
const targetTime = this.getTimestampOnReady() + time;
|
|
376
266
|
const timeToWait = Math.max(0, targetTime - Date.now());
|
|
377
|
-
return
|
|
267
|
+
return _kefir.default.later(timeToWait);
|
|
378
268
|
}
|
|
379
|
-
|
|
380
|
-
getTimings(): { [ix: string]: ?number } {
|
|
269
|
+
getTimings() {
|
|
381
270
|
return {
|
|
382
271
|
piMainStarted: this._envData.piMainStarted,
|
|
383
272
|
piLoadStarted: this._envData.piLoadStarted,
|
|
384
273
|
globalsFound: this._timestampGlobalsFound,
|
|
385
274
|
accountSwitcherReady: this._timestampAccountSwitcherReady,
|
|
386
|
-
onready: this._timestampOnready
|
|
275
|
+
onready: this._timestampOnready
|
|
387
276
|
};
|
|
388
277
|
}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
const
|
|
392
|
-
|
|
393
|
-
const removeButtonOnUnregister = (button) => {
|
|
278
|
+
registerThreadButton(options) {
|
|
279
|
+
const unregister = (0, _kefirStopper.default)();
|
|
280
|
+
const removeButtonOnUnregister = button => {
|
|
394
281
|
unregister.takeUntilBy(button.getStopper()).onValue(() => {
|
|
395
282
|
button.destroy();
|
|
396
283
|
});
|
|
397
284
|
};
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
285
|
+
const toolbarViewSub = (0, _toValueObservable.default)(this._toolbarViewDriverLiveSet).subscribe(_ref3 => {
|
|
286
|
+
let {
|
|
287
|
+
value: gmailToolbarView
|
|
288
|
+
} = _ref3;
|
|
402
289
|
if (gmailToolbarView.isForThread()) {
|
|
403
|
-
if (!options.positions ||
|
|
404
|
-
removeButtonOnUnregister(
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
onClick
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
});
|
|
417
|
-
},
|
|
418
|
-
})
|
|
419
|
-
);
|
|
290
|
+
if (!options.positions || (0, _includes.default)(options.positions, 'THREAD')) {
|
|
291
|
+
removeButtonOnUnregister(gmailToolbarView.addButton({
|
|
292
|
+
...options,
|
|
293
|
+
section: options.threadSection || 'METADATA_STATE',
|
|
294
|
+
onClick: event => {
|
|
295
|
+
options.onClick({
|
|
296
|
+
position: 'THREAD',
|
|
297
|
+
dropdown: event.dropdown,
|
|
298
|
+
selectedThreadViewDrivers: [gmailToolbarView.getThreadViewDriver()],
|
|
299
|
+
selectedThreadRowViewDrivers: []
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
}));
|
|
420
303
|
}
|
|
421
304
|
} else if (gmailToolbarView.isForRowList()) {
|
|
422
|
-
if (!options.positions ||
|
|
423
|
-
removeButtonOnUnregister(
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
selectedThreadRowViewDrivers,
|
|
437
|
-
});
|
|
438
|
-
},
|
|
439
|
-
})
|
|
440
|
-
);
|
|
305
|
+
if (!options.positions || (0, _includes.default)(options.positions, 'LIST')) {
|
|
306
|
+
removeButtonOnUnregister(gmailToolbarView.addButton({
|
|
307
|
+
...options,
|
|
308
|
+
section: options.listSection || 'METADATA_STATE',
|
|
309
|
+
onClick: event => {
|
|
310
|
+
const selectedThreadRowViewDrivers = Array.from(gmailToolbarView.getThreadRowViewDrivers()).filter(gmailThreadRow => gmailThreadRow.isSelected());
|
|
311
|
+
options.onClick({
|
|
312
|
+
position: 'LIST',
|
|
313
|
+
dropdown: event.dropdown,
|
|
314
|
+
selectedThreadViewDrivers: [],
|
|
315
|
+
selectedThreadRowViewDrivers
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
}));
|
|
441
319
|
}
|
|
442
320
|
}
|
|
443
321
|
});
|
|
444
322
|
unregister.onValue(() => {
|
|
445
323
|
toolbarViewSub.unsubscribe();
|
|
446
324
|
});
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
onClick
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
},
|
|
465
|
-
}).merge(unregister)
|
|
466
|
-
);
|
|
325
|
+
if (!options.positions || (0, _includes.default)(options.positions, 'ROW')) {
|
|
326
|
+
const perThreadRow = gmailThreadRow => {
|
|
327
|
+
gmailThreadRow.addButton(_kefir.default.constant({
|
|
328
|
+
hasDropdown: options.hasDropdown,
|
|
329
|
+
iconClass: options.iconClass,
|
|
330
|
+
iconUrl: options.iconUrl,
|
|
331
|
+
orderHint: options.orderHint,
|
|
332
|
+
onClick: event => {
|
|
333
|
+
if (!options.onClick) return;
|
|
334
|
+
options.onClick({
|
|
335
|
+
position: 'ROW',
|
|
336
|
+
dropdown: event.dropdown,
|
|
337
|
+
selectedThreadViewDrivers: [],
|
|
338
|
+
selectedThreadRowViewDrivers: [gmailThreadRow]
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
}).merge(unregister));
|
|
467
342
|
};
|
|
468
|
-
|
|
469
343
|
if (this._currentRouteViewDriver) {
|
|
470
|
-
this._currentRouteViewDriver
|
|
471
|
-
.
|
|
472
|
-
|
|
473
|
-
gmailRowListView.getThreadRowViewDrivers().forEach(perThreadRow);
|
|
474
|
-
});
|
|
344
|
+
this._currentRouteViewDriver.getRowListViews().forEach(gmailRowListView => {
|
|
345
|
+
gmailRowListView.getThreadRowViewDrivers().forEach(perThreadRow);
|
|
346
|
+
});
|
|
475
347
|
}
|
|
476
348
|
const threadRowViewSub = this._threadRowViewDriverKefirStream.observe({
|
|
477
|
-
value: perThreadRow
|
|
349
|
+
value: perThreadRow
|
|
478
350
|
});
|
|
479
351
|
unregister.onValue(() => {
|
|
480
352
|
threadRowViewSub.unsubscribe();
|
|
481
353
|
});
|
|
482
354
|
}
|
|
483
|
-
|
|
484
355
|
return () => {
|
|
485
356
|
unregister.destroy();
|
|
486
357
|
};
|
|
487
358
|
}
|
|
488
|
-
|
|
489
|
-
hashChangeNoViewChange(hash: string) {
|
|
359
|
+
hashChangeNoViewChange(hash) {
|
|
490
360
|
if (hash[0] !== '#') {
|
|
491
361
|
throw new Error('bad hash');
|
|
492
362
|
}
|
|
493
363
|
window.history.replaceState(null, null, hash);
|
|
494
|
-
var hce = new
|
|
495
|
-
oldURL:
|
|
496
|
-
|
|
497
|
-
newURL: document.location.href.replace(/#.*$/, '') + hash,
|
|
364
|
+
var hce = new window.HashChangeEvent('hashchange', {
|
|
365
|
+
oldURL: document.location.href.replace(/#.*$/, '') + '#inboxsdk-fake-no-vc',
|
|
366
|
+
newURL: document.location.href.replace(/#.*$/, '') + hash
|
|
498
367
|
});
|
|
499
368
|
window.dispatchEvent(hce);
|
|
500
369
|
}
|
|
501
|
-
|
|
502
|
-
addCustomRouteID(routeID: string): () => void {
|
|
370
|
+
addCustomRouteID(routeID) {
|
|
503
371
|
this._customRouteIDs.add(routeID);
|
|
504
|
-
this._pageCommunicator.registerAllowedHashLinkStartTerm(
|
|
505
|
-
routeID.split('/')[0]
|
|
506
|
-
);
|
|
372
|
+
this._pageCommunicator.registerAllowedHashLinkStartTerm(routeID.split('/')[0]);
|
|
507
373
|
return () => {
|
|
508
374
|
this._customRouteIDs.delete(routeID);
|
|
509
375
|
};
|
|
510
376
|
}
|
|
511
|
-
|
|
512
|
-
addCustomListRouteID(routeID: string, handler: Function): () => void {
|
|
377
|
+
addCustomListRouteID(routeID, handler) {
|
|
513
378
|
this._customListRouteIDs.set(routeID, handler);
|
|
514
|
-
this._pageCommunicator.registerAllowedHashLinkStartTerm(
|
|
515
|
-
routeID.split('/')[0]
|
|
516
|
-
);
|
|
379
|
+
this._pageCommunicator.registerAllowedHashLinkStartTerm(routeID.split('/')[0]);
|
|
517
380
|
return () => {
|
|
518
381
|
this._customListRouteIDs.delete(routeID);
|
|
519
382
|
};
|
|
520
383
|
}
|
|
521
|
-
|
|
522
|
-
signalCustomThreadListActivity(customRouteID: string) {
|
|
384
|
+
signalCustomThreadListActivity(customRouteID) {
|
|
523
385
|
this._lastCustomThreadListActivity = {
|
|
524
386
|
customRouteID,
|
|
525
|
-
timestamp: new Date()
|
|
387
|
+
timestamp: new Date()
|
|
526
388
|
};
|
|
527
389
|
}
|
|
528
390
|
|
|
529
391
|
// Returns the last time a request for a custom thread list search has gone
|
|
530
392
|
// out or we got a response, and the customRouteID for that.
|
|
531
|
-
getLastCustomThreadListActivity()
|
|
532
|
-
customRouteID: string,
|
|
533
|
-
timestamp: Date,
|
|
534
|
-
} {
|
|
393
|
+
getLastCustomThreadListActivity() {
|
|
535
394
|
return this._lastCustomThreadListActivity;
|
|
536
395
|
}
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
customRouteID: string,
|
|
540
|
-
onActivate: Function,
|
|
541
|
-
params: Array<string>
|
|
542
|
-
) {
|
|
543
|
-
showCustomThreadList(this, customRouteID, onActivate, params);
|
|
396
|
+
showCustomThreadList(customRouteID, onActivate, params) {
|
|
397
|
+
(0, _showCustomThreadList.default)(this, customRouteID, onActivate, params);
|
|
544
398
|
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
showCustomRouteView(this, element);
|
|
399
|
+
showCustomRouteView(element) {
|
|
400
|
+
(0, _showCustomRouteView.default)(this, element);
|
|
548
401
|
}
|
|
549
|
-
|
|
550
402
|
showNativeRouteView() {
|
|
551
|
-
|
|
403
|
+
(0, _showNativeRouteView.default)(this);
|
|
552
404
|
}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
return createLink(this._gmailRouteProcessor, routeID, params);
|
|
405
|
+
createLink(routeID, params) {
|
|
406
|
+
return (0, _createLink.default)(this._gmailRouteProcessor, routeID, params);
|
|
556
407
|
}
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
return gotoView(this, routeID, params);
|
|
408
|
+
goto(routeID, params) {
|
|
409
|
+
return (0, _gotoView.default)(this, routeID, params);
|
|
560
410
|
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
return this._pageCommunicatorPromise.then((pageCommunicator) =>
|
|
564
|
-
pageCommunicator.resolveUrlRedirects(url)
|
|
565
|
-
);
|
|
411
|
+
resolveUrlRedirects(url) {
|
|
412
|
+
return this._pageCommunicatorPromise.then(pageCommunicator => pageCommunicator.resolveUrlRedirects(url));
|
|
566
413
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
registerSearchSuggestionsProvider(this, handler);
|
|
414
|
+
registerSearchSuggestionsProvider(handler) {
|
|
415
|
+
(0, _registerSearchSuggestionsProvider.default)(this, handler);
|
|
570
416
|
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
registerSearchQueryRewriter(this._pageCommunicator, obj);
|
|
417
|
+
registerSearchQueryRewriter(obj) {
|
|
418
|
+
(0, _registerSearchQueryRewriter.default)(this._pageCommunicator, obj);
|
|
574
419
|
}
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
buttonDescriptor: Object
|
|
578
|
-
): Promise<GmailAppToolbarButtonView> {
|
|
579
|
-
return addToolbarButtonForApp(this, buttonDescriptor);
|
|
420
|
+
addToolbarButtonForApp(buttonDescriptor) {
|
|
421
|
+
return (0, _addToolbarButtonForApp.default)(this, buttonDescriptor);
|
|
580
422
|
}
|
|
581
|
-
|
|
582
|
-
async openNewComposeViewDriver(): Promise<GmailComposeView> {
|
|
423
|
+
async openNewComposeViewDriver() {
|
|
583
424
|
try {
|
|
584
425
|
const composeViewDriverPromise = this.getNextComposeViewDriver();
|
|
585
|
-
await
|
|
426
|
+
await (0, _openComposeWindow.default)(this);
|
|
586
427
|
const composeViewDriver = await composeViewDriverPromise;
|
|
587
428
|
return composeViewDriver;
|
|
588
429
|
} catch (err) {
|
|
@@ -590,412 +431,231 @@ class GmailDriver {
|
|
|
590
431
|
throw err;
|
|
591
432
|
}
|
|
592
433
|
}
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
timeout
|
|
596
|
-
): Promise<GmailComposeView> {
|
|
597
|
-
return this._composeViewDriverStream
|
|
598
|
-
.merge(
|
|
599
|
-
Kefir.later(
|
|
600
|
-
timeout,
|
|
601
|
-
new Error(
|
|
602
|
-
'Reached timeout while waiting for getNextComposeViewDriver'
|
|
603
|
-
)
|
|
604
|
-
)
|
|
605
|
-
)
|
|
606
|
-
.beforeEnd(
|
|
607
|
-
() => new Error('Driver was shut down before a new compose was found')
|
|
608
|
-
)
|
|
609
|
-
.flatMap((x) =>
|
|
610
|
-
x instanceof Error ? Kefir.constantError(x) : Kefir.constant(x)
|
|
611
|
-
)
|
|
612
|
-
.take(1)
|
|
613
|
-
.takeErrors(1)
|
|
614
|
-
.toPromise();
|
|
434
|
+
getNextComposeViewDriver() {
|
|
435
|
+
let timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10 * 1000;
|
|
436
|
+
return this._composeViewDriverStream.merge(_kefir.default.later(timeout, new Error('Reached timeout while waiting for getNextComposeViewDriver'))).beforeEnd(() => new Error('Driver was shut down before a new compose was found')).flatMap(x => x instanceof Error ? _kefir.default.constantError(x) : _kefir.default.constant(x)).take(1).takeErrors(1).toPromise();
|
|
615
437
|
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
return openDraftByMessageID(this, messageID);
|
|
438
|
+
openDraftByMessageID(messageID) {
|
|
439
|
+
return (0, _openDraftByMessageId.default)(this, messageID);
|
|
619
440
|
}
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
return new GmailModalViewDriver(options);
|
|
441
|
+
createModalViewDriver(options) {
|
|
442
|
+
return new _gmailModalViewDriver.default(options);
|
|
623
443
|
}
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
return new GmailMoleViewDriver(this, options);
|
|
444
|
+
createMoleViewDriver(options) {
|
|
445
|
+
return new _gmailMoleViewDriver.default(this, options);
|
|
627
446
|
}
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
return new InboxDrawerView(options);
|
|
447
|
+
createDrawerViewDriver(options) {
|
|
448
|
+
return new _inboxDrawerView.default(options);
|
|
631
449
|
}
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
return new GmailBackdrop(zIndex, target);
|
|
450
|
+
createBackdrop(zIndex, target) {
|
|
451
|
+
return new _gmailBackdrop.default(zIndex, target);
|
|
635
452
|
}
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
appId: string,
|
|
639
|
-
navItemDescriptorPropertyStream: Kefir.Observable<Object>,
|
|
640
|
-
navMenuInjectionContainer?: HTMLElement
|
|
641
|
-
): Promise<GmailNavItemView> {
|
|
642
|
-
return addNavItem(
|
|
643
|
-
this,
|
|
644
|
-
appId,
|
|
645
|
-
navItemDescriptorPropertyStream,
|
|
646
|
-
navMenuInjectionContainer
|
|
647
|
-
);
|
|
453
|
+
addNavItem(appId, navItemDescriptorPropertyStream, navMenuInjectionContainer) {
|
|
454
|
+
return (0, _addNavItem.default)(this, appId, navItemDescriptorPropertyStream, navMenuInjectionContainer);
|
|
648
455
|
}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
return addAppMenuItem(this, menuItemDescriptor);
|
|
456
|
+
addAppMenuItem(menuItemDescriptor) {
|
|
457
|
+
return (0, _addAppMenuItem.addAppMenuItem)(this, menuItemDescriptor);
|
|
652
458
|
}
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
supportItemDescriptor: SupportItemDescriptor
|
|
656
|
-
): GmailSupportItemView {
|
|
657
|
-
return addSupportItem(this, supportItemDescriptor);
|
|
459
|
+
addSupportItem(supportItemDescriptor) {
|
|
460
|
+
return (0, _addSupportItem.default)(this, supportItemDescriptor);
|
|
658
461
|
}
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
p.catch((err) => this._logger.error(err));
|
|
462
|
+
getSentMailNativeNavItem() {
|
|
463
|
+
const p = (0, _getNativeNavItem.default)(this, 'sent');
|
|
464
|
+
p.catch(err => this._logger.error(err));
|
|
663
465
|
return p;
|
|
664
466
|
}
|
|
665
|
-
|
|
666
|
-
setShowNativeNavMarker(isNative: boolean) {
|
|
467
|
+
setShowNativeNavMarker(isNative) {
|
|
667
468
|
this._navMarkerHiddenChanged.emit(null);
|
|
668
|
-
const leftNavContainerElement =
|
|
669
|
-
GmailElementGetter.getLeftNavContainerElement();
|
|
469
|
+
const leftNavContainerElement = _gmailElementGetter.default.getLeftNavContainerElement();
|
|
670
470
|
if (leftNavContainerElement) {
|
|
671
471
|
if (isNative) {
|
|
672
|
-
leftNavContainerElement.classList.remove(
|
|
673
|
-
'inboxsdk__hide_native_marker'
|
|
674
|
-
);
|
|
472
|
+
leftNavContainerElement.classList.remove('inboxsdk__hide_native_marker');
|
|
675
473
|
} else {
|
|
676
474
|
leftNavContainerElement.classList.add('inboxsdk__hide_native_marker');
|
|
677
475
|
this._stopper.takeUntilBy(this._navMarkerHiddenChanged).onValue(() => {
|
|
678
|
-
leftNavContainerElement.classList.remove(
|
|
679
|
-
'inboxsdk__hide_native_marker'
|
|
680
|
-
);
|
|
476
|
+
leftNavContainerElement.classList.remove('inboxsdk__hide_native_marker');
|
|
681
477
|
});
|
|
682
478
|
}
|
|
683
479
|
}
|
|
684
480
|
}
|
|
685
|
-
|
|
686
|
-
setShowNativeAddonSidebar(isNative: boolean) {
|
|
481
|
+
setShowNativeAddonSidebar(isNative) {
|
|
687
482
|
this._addonSidebarHiddenChanged.emit(null);
|
|
688
|
-
const addonContainerElement =
|
|
689
|
-
|
|
690
|
-
const mainContentBodyContainerElement =
|
|
691
|
-
GmailElementGetter.getMainContentBodyContainerElement();
|
|
692
|
-
|
|
483
|
+
const addonContainerElement = _gmailElementGetter.default.getAddonSidebarContainerElement();
|
|
484
|
+
const mainContentBodyContainerElement = _gmailElementGetter.default.getMainContentBodyContainerElement();
|
|
693
485
|
if (addonContainerElement && mainContentBodyContainerElement) {
|
|
694
486
|
const parent = mainContentBodyContainerElement.parentElement;
|
|
695
487
|
if (!parent) return;
|
|
696
|
-
|
|
697
488
|
if (isNative) {
|
|
698
489
|
parent.classList.remove('inboxsdk__hide_addon_container');
|
|
699
490
|
} else {
|
|
700
491
|
parent.classList.add('inboxsdk__hide_addon_container');
|
|
701
|
-
this._stopper
|
|
702
|
-
.
|
|
703
|
-
|
|
704
|
-
parent.classList.remove('inboxsdk__hide_addon_container');
|
|
705
|
-
});
|
|
492
|
+
this._stopper.takeUntilBy(this._addonSidebarHiddenChanged).onValue(() => {
|
|
493
|
+
parent.classList.remove('inboxsdk__hide_addon_container');
|
|
494
|
+
});
|
|
706
495
|
}
|
|
707
496
|
}
|
|
708
497
|
}
|
|
709
|
-
|
|
710
|
-
async getGmailActionToken(): Promise<string> {
|
|
498
|
+
async getGmailActionToken() {
|
|
711
499
|
return this._pageCommunicator.getActionTokenValue();
|
|
712
500
|
}
|
|
713
|
-
|
|
714
|
-
getUserEmailAddress(): string {
|
|
501
|
+
getUserEmailAddress() {
|
|
715
502
|
return this._pageCommunicator.getUserEmailAddress();
|
|
716
503
|
}
|
|
717
|
-
|
|
718
|
-
isConversationViewDisabled(): Promise<boolean> {
|
|
504
|
+
isConversationViewDisabled() {
|
|
719
505
|
return this._pageCommunicator.isConversationViewDisabled();
|
|
720
506
|
}
|
|
721
|
-
|
|
722
|
-
getUserLanguage(): string {
|
|
507
|
+
getUserLanguage() {
|
|
723
508
|
return this._pageCommunicator.getUserLanguage();
|
|
724
509
|
}
|
|
725
|
-
|
|
726
|
-
getUserContact(): Contact {
|
|
510
|
+
getUserContact() {
|
|
727
511
|
return {
|
|
728
512
|
emailAddress: this.getUserEmailAddress(),
|
|
729
|
-
name: this._userInfo.getUserName()
|
|
513
|
+
name: this._userInfo.getUserName()
|
|
730
514
|
};
|
|
731
515
|
}
|
|
732
|
-
|
|
733
|
-
getAccountSwitcherContactList(): Contact[] {
|
|
516
|
+
getAccountSwitcherContactList() {
|
|
734
517
|
return this._userInfo.getAccountSwitcherContactList();
|
|
735
518
|
}
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
keyboardShortcutHandle: KeyboardShortcutHandle,
|
|
739
|
-
appName: ?string,
|
|
740
|
-
appIconUrl: ?string
|
|
741
|
-
) {
|
|
742
|
-
this.getKeyboardShortcutHelpModifier().set(
|
|
743
|
-
keyboardShortcutHandle,
|
|
744
|
-
this._appId,
|
|
745
|
-
appName,
|
|
746
|
-
appIconUrl
|
|
747
|
-
);
|
|
519
|
+
activateShortcut(keyboardShortcutHandle, appName, appIconUrl) {
|
|
520
|
+
this.getKeyboardShortcutHelpModifier().set(keyboardShortcutHandle, this._appId, appName, appIconUrl);
|
|
748
521
|
keyboardShortcutHandle.once('destroy', () => {
|
|
749
522
|
this.getKeyboardShortcutHelpModifier().delete(keyboardShortcutHandle);
|
|
750
523
|
});
|
|
751
524
|
}
|
|
752
|
-
|
|
753
525
|
_setupEventStreams() {
|
|
754
|
-
var result =
|
|
755
|
-
|
|
756
|
-
this._xhrInterceptorStream = result.xhrInterceptStream.takeUntilBy(
|
|
757
|
-
this._stopper
|
|
758
|
-
);
|
|
759
|
-
|
|
526
|
+
var result = (0, _makeXhrInterceptor.default)();
|
|
527
|
+
this._xhrInterceptorStream = result.xhrInterceptStream.takeUntilBy(this._stopper);
|
|
760
528
|
this._pageCommunicatorPromise = result.pageCommunicatorPromise;
|
|
761
|
-
|
|
762
|
-
this.onready = this._pageCommunicatorPromise.then((pageCommunicator) => {
|
|
529
|
+
this.onready = this._pageCommunicatorPromise.then(pageCommunicator => {
|
|
763
530
|
this._timestampGlobalsFound = Date.now();
|
|
764
531
|
this._pageCommunicator = pageCommunicator;
|
|
765
532
|
this._logger.setUserEmailAddress(this.getUserEmailAddress());
|
|
766
533
|
this._logger.setIsUsingSyncAPI(pageCommunicator.isUsingSyncAPI());
|
|
767
|
-
this._userInfo = new
|
|
768
|
-
|
|
534
|
+
this._userInfo = new _userInfo.default(this);
|
|
769
535
|
this._timestampAccountSwitcherReady = Date.now();
|
|
770
|
-
|
|
771
|
-
this._routeViewDriverStream
|
|
772
|
-
this._gmailRouteProcessor,
|
|
773
|
-
this
|
|
774
|
-
)
|
|
775
|
-
.takeUntilBy(this._stopper)
|
|
776
|
-
.toProperty();
|
|
777
|
-
|
|
778
|
-
this._routeViewDriverStream.onValue((gmailRouteView) => {
|
|
536
|
+
this._routeViewDriverStream = (0, _setupRouteViewDriverStream.default)(this._gmailRouteProcessor, this).takeUntilBy(this._stopper).toProperty();
|
|
537
|
+
this._routeViewDriverStream.onValue(gmailRouteView => {
|
|
779
538
|
this._currentRouteViewDriver = gmailRouteView;
|
|
780
539
|
});
|
|
781
|
-
|
|
782
|
-
this._rowListViewDriverStream = this._setupRouteSubViewDriver(
|
|
783
|
-
'newGmailRowListView'
|
|
784
|
-
).takeUntilBy(this._stopper);
|
|
785
|
-
|
|
540
|
+
this._rowListViewDriverStream = this._setupRouteSubViewDriver('newGmailRowListView').takeUntilBy(this._stopper);
|
|
786
541
|
this._setupThreadRowViewDriverKefirStream();
|
|
787
|
-
this._threadViewDriverLiveSet =
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
gmailThreadView.getReadyStream().map(() => gmailThreadView)
|
|
792
|
-
)
|
|
793
|
-
.map((gmailThreadView) => ({
|
|
794
|
-
el: gmailThreadView,
|
|
795
|
-
removalStream: gmailThreadView.getStopper(),
|
|
796
|
-
}))
|
|
797
|
-
);
|
|
798
|
-
|
|
542
|
+
this._threadViewDriverLiveSet = (0, _toLiveSet.default)(this._setupRouteSubViewDriver('newGmailThreadView').takeUntilBy(this._stopper).flatMap(gmailThreadView => gmailThreadView.getReadyStream().map(() => gmailThreadView)).map(gmailThreadView => ({
|
|
543
|
+
el: gmailThreadView,
|
|
544
|
+
removalStream: gmailThreadView.getStopper()
|
|
545
|
+
})));
|
|
799
546
|
this._setupToolbarViewDriverStream();
|
|
800
547
|
this._setupMessageViewDriverStream();
|
|
801
548
|
this._setupComposeViewDriverStream();
|
|
802
|
-
|
|
803
|
-
this._threadRowIdentifier = new ThreadRowIdentifier(this);
|
|
804
|
-
|
|
549
|
+
this._threadRowIdentifier = new _threadRowIdentifier.default(this);
|
|
805
550
|
this._timestampOnready = Date.now();
|
|
806
551
|
});
|
|
807
552
|
}
|
|
808
|
-
|
|
809
553
|
_setupComposeViewDriverStream() {
|
|
810
|
-
this._composeViewDriverStream =
|
|
811
|
-
this,
|
|
812
|
-
this._messageViewDriverStream,
|
|
813
|
-
this._xhrInterceptorStream
|
|
814
|
-
).takeUntilBy(this._stopper);
|
|
554
|
+
this._composeViewDriverStream = (0, _setupComposeViewDriverStream.default)(this, this._messageViewDriverStream, this._xhrInterceptorStream).takeUntilBy(this._stopper);
|
|
815
555
|
}
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
return gmailRouteView
|
|
820
|
-
.getEventStream()
|
|
821
|
-
.filter((event) => event.eventName === viewName)
|
|
822
|
-
.map((event) => event.view);
|
|
556
|
+
_setupRouteSubViewDriver(viewName) {
|
|
557
|
+
return this._routeViewDriverStream.flatMap(gmailRouteView => {
|
|
558
|
+
return gmailRouteView.getEventStream().filter(event => event.eventName === viewName).map(event => event.view);
|
|
823
559
|
});
|
|
824
560
|
}
|
|
825
|
-
|
|
826
561
|
_setupThreadRowViewDriverKefirStream() {
|
|
827
|
-
this._threadRowViewDriverKefirStream = this._rowListViewDriverStream
|
|
828
|
-
.flatMap((rowListViewDriver) =>
|
|
829
|
-
rowListViewDriver.getRowViewDriverStream()
|
|
830
|
-
)
|
|
831
|
-
.takeUntilBy(this._stopper);
|
|
562
|
+
this._threadRowViewDriverKefirStream = this._rowListViewDriverStream.flatMap(rowListViewDriver => rowListViewDriver.getRowViewDriverStream()).takeUntilBy(this._stopper);
|
|
832
563
|
}
|
|
833
|
-
|
|
834
564
|
_setupToolbarViewDriverStream() {
|
|
835
|
-
this._toolbarViewDriverLiveSet =
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
),
|
|
840
|
-
this.getThreadViewDriverStream().map((gmailThreadView) =>
|
|
841
|
-
gmailThreadView.getToolbarView()
|
|
842
|
-
),
|
|
843
|
-
])
|
|
844
|
-
.filter(Boolean)
|
|
845
|
-
.flatMap((gmailToolbarView) => gmailToolbarView.waitForReady())
|
|
846
|
-
.map((gmailToolbarView) => ({
|
|
847
|
-
el: gmailToolbarView,
|
|
848
|
-
removalStream: gmailToolbarView.getStopper(),
|
|
849
|
-
}))
|
|
850
|
-
.takeUntilBy(this._stopper)
|
|
851
|
-
);
|
|
565
|
+
this._toolbarViewDriverLiveSet = (0, _toLiveSet.default)(_kefir.default.merge([this._rowListViewDriverStream.map(gmailRowListView => gmailRowListView.getToolbarView()), this.getThreadViewDriverStream().map(gmailThreadView => gmailThreadView.getToolbarView())]).filter(Boolean).flatMap(gmailToolbarView => gmailToolbarView.waitForReady()).map(gmailToolbarView => ({
|
|
566
|
+
el: gmailToolbarView,
|
|
567
|
+
removalStream: gmailToolbarView.getStopper()
|
|
568
|
+
})).takeUntilBy(this._stopper));
|
|
852
569
|
this._toolbarViewDriverLiveSet.subscribe({});
|
|
853
570
|
}
|
|
854
|
-
|
|
855
571
|
_setupMessageViewDriverStream() {
|
|
856
|
-
this._messageViewDriverStream = this.getThreadViewDriverStream()
|
|
857
|
-
.flatMap((gmailThreadView) =>
|
|
858
|
-
gmailThreadView.getMessageViewDriverStream()
|
|
859
|
-
)
|
|
860
|
-
.takeUntilBy(this._stopper);
|
|
572
|
+
this._messageViewDriverStream = this.getThreadViewDriverStream().flatMap(gmailThreadView => gmailThreadView.getMessageViewDriverStream()).takeUntilBy(this._stopper);
|
|
861
573
|
}
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
descriptor: Kefir.Observable<Object>
|
|
865
|
-
): Promise<?ContentPanelViewDriver> {
|
|
866
|
-
await this.waitForGlobalSidebarReady()
|
|
867
|
-
.merge(
|
|
868
|
-
this._stopper.flatMap(() =>
|
|
869
|
-
Kefir.constantError(new Error('Driver instance was destroyed early'))
|
|
870
|
-
)
|
|
871
|
-
)
|
|
872
|
-
.take(1)
|
|
873
|
-
.takeErrors(1)
|
|
874
|
-
.toPromise();
|
|
574
|
+
async addGlobalSidebarContentPanel(descriptor) {
|
|
575
|
+
await this.waitForGlobalSidebarReady().merge(this._stopper.flatMap(() => _kefir.default.constantError(new Error('Driver instance was destroyed early')))).take(1).takeErrors(1).toPromise();
|
|
875
576
|
const appSidebar = this.getGlobalSidebar();
|
|
876
577
|
return appSidebar.addGlobalSidebarContentPanel(descriptor);
|
|
877
578
|
}
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
const condition = () =>
|
|
881
|
-
GmailElementGetter.getCompanionSidebarContentContainerElement() &&
|
|
882
|
-
(GmailElementGetter.getCompanionSidebarIconContainerElement() ||
|
|
883
|
-
GmailElementGetter.getAddonSidebarContainerElement());
|
|
579
|
+
waitForGlobalSidebarReady() {
|
|
580
|
+
const condition = () => _gmailElementGetter.default.getCompanionSidebarContentContainerElement() && (_gmailElementGetter.default.getCompanionSidebarIconContainerElement() || _gmailElementGetter.default.getAddonSidebarContainerElement());
|
|
884
581
|
if (condition()) {
|
|
885
|
-
return
|
|
582
|
+
return _kefir.default.constant(undefined);
|
|
886
583
|
}
|
|
887
|
-
return
|
|
584
|
+
return (0, _streamWaitFor.default)(condition).map(() => undefined);
|
|
888
585
|
}
|
|
889
|
-
|
|
890
|
-
getGlobalSidebar(): GmailAppSidebarView {
|
|
586
|
+
getGlobalSidebar() {
|
|
891
587
|
let appSidebarView = this._appSidebarView;
|
|
892
588
|
if (!appSidebarView) {
|
|
893
|
-
const companionSidebarContentContainerEl =
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
throw new Error('did not find companionSidebarContentContainerEl');
|
|
897
|
-
appSidebarView = this._appSidebarView = new GmailAppSidebarView(
|
|
898
|
-
this,
|
|
899
|
-
companionSidebarContentContainerEl
|
|
900
|
-
);
|
|
589
|
+
const companionSidebarContentContainerEl = _gmailElementGetter.default.getCompanionSidebarContentContainerElement();
|
|
590
|
+
if (!companionSidebarContentContainerEl) throw new Error('did not find companionSidebarContentContainerEl');
|
|
591
|
+
appSidebarView = this._appSidebarView = new _gmailAppSidebarView.default(this, companionSidebarContentContainerEl);
|
|
901
592
|
}
|
|
902
|
-
|
|
903
593
|
return appSidebarView;
|
|
904
594
|
}
|
|
905
|
-
|
|
906
|
-
isRunningInPageContext(): boolean {
|
|
595
|
+
isRunningInPageContext() {
|
|
907
596
|
return !!(global.GLOBALS && global._GM_main);
|
|
908
597
|
}
|
|
909
|
-
|
|
910
|
-
isUsingSyncAPI(): boolean {
|
|
598
|
+
isUsingSyncAPI() {
|
|
911
599
|
return this._pageCommunicator.isUsingSyncAPI();
|
|
912
600
|
}
|
|
913
|
-
|
|
914
601
|
showAppIdWarning() {
|
|
915
|
-
|
|
602
|
+
(0, _showAppIdWarning.default)(this);
|
|
916
603
|
}
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
optionStream: Kefir.Observable<?Object>
|
|
920
|
-
): GmailTopMessageBarDriver {
|
|
921
|
-
return new GmailTopMessageBarDriver(optionStream);
|
|
604
|
+
createTopMessageBarDriver(optionStream) {
|
|
605
|
+
return new _gmailTopMessageBarDriver.default(optionStream);
|
|
922
606
|
}
|
|
923
|
-
|
|
924
|
-
associateThreadAndMessageIDs(threadID: string, messageID: string) {
|
|
607
|
+
associateThreadAndMessageIDs(threadID, messageID) {
|
|
925
608
|
this._messageIDsToThreadIDs.set(messageID, threadID);
|
|
926
609
|
}
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
return get(this._messageIDsToThreadIDs, messageID);
|
|
610
|
+
getThreadIDForMessageID(messageID) {
|
|
611
|
+
return (0, _getOrFail.default)(this._messageIDsToThreadIDs, messageID);
|
|
930
612
|
}
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
messageID
|
|
934
|
-
skipCache: boolean = false
|
|
935
|
-
): Promise<GetDraftIdResult> {
|
|
936
|
-
return getDraftIDForMessageID(this, messageID, skipCache);
|
|
613
|
+
getDraftIDForMessageID(messageID) {
|
|
614
|
+
let skipCache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
615
|
+
return (0, _getDraftIdForMessageId.default)(this, messageID, skipCache);
|
|
937
616
|
}
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
reportRecentSyncDraftId(syncDraftId: string) {
|
|
942
|
-
const count: ?number = this._recentSyncDraftIds.get(syncDraftId);
|
|
617
|
+
reportRecentSyncDraftId(syncDraftId) {
|
|
618
|
+
const count = this._recentSyncDraftIds.get(syncDraftId);
|
|
943
619
|
const newCount = (count ?? 0) + 1;
|
|
944
620
|
this._recentSyncDraftIds.set(syncDraftId, newCount);
|
|
945
621
|
}
|
|
946
|
-
reportDraftClosed(syncDraftId
|
|
947
|
-
|
|
948
|
-
.
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
this._recentSyncDraftIds.delete(syncDraftId);
|
|
965
|
-
} else {
|
|
966
|
-
this._recentSyncDraftIds.set(syncDraftId, newCount);
|
|
967
|
-
}
|
|
968
|
-
});
|
|
622
|
+
reportDraftClosed(syncDraftId) {
|
|
623
|
+
_kefir.default.later(30 * 1000).takeUntilBy(this._stopper).onValue(() => {
|
|
624
|
+
const count = this._recentSyncDraftIds.get(syncDraftId);
|
|
625
|
+
let newCount;
|
|
626
|
+
if (count == null || count < 1) {
|
|
627
|
+
newCount = 0;
|
|
628
|
+
this._logger.error(new Error('_recentSyncDraftIds count had unexpected value'), {
|
|
629
|
+
count
|
|
630
|
+
});
|
|
631
|
+
} else {
|
|
632
|
+
newCount = count - 1;
|
|
633
|
+
}
|
|
634
|
+
if (newCount === 0) {
|
|
635
|
+
this._recentSyncDraftIds.delete(syncDraftId);
|
|
636
|
+
} else {
|
|
637
|
+
this._recentSyncDraftIds.set(syncDraftId, newCount);
|
|
638
|
+
}
|
|
639
|
+
});
|
|
969
640
|
}
|
|
970
|
-
isRecentSyncDraftId(syncMessageId
|
|
641
|
+
isRecentSyncDraftId(syncMessageId) {
|
|
971
642
|
return this._recentSyncDraftIds.has(syncMessageId);
|
|
972
643
|
}
|
|
973
|
-
|
|
974
|
-
_selectedThreadRows = t.mapcat((gmailRowListView: GmailRowListView) =>
|
|
975
|
-
gmailRowListView.getSelectedThreadRowViewDrivers()
|
|
976
|
-
);
|
|
977
|
-
getSelectedThreadRowViewDrivers(): $ReadOnlyArray<GmailThreadRowView> {
|
|
644
|
+
getSelectedThreadRowViewDrivers() {
|
|
978
645
|
if (!this._currentRouteViewDriver) {
|
|
979
646
|
return [];
|
|
980
647
|
}
|
|
981
|
-
return
|
|
982
|
-
this._currentRouteViewDriver.getRowListViews(),
|
|
983
|
-
this._selectedThreadRows
|
|
984
|
-
);
|
|
648
|
+
return _transducers.default.toArray(this._currentRouteViewDriver.getRowListViews(), this._selectedThreadRows);
|
|
985
649
|
}
|
|
986
|
-
|
|
987
|
-
_threadRowViewSelectionChanges = kefirBus();
|
|
988
|
-
|
|
989
650
|
signalThreadRowViewSelectionChange() {
|
|
990
651
|
this._threadRowViewSelectionChanges.value(undefined);
|
|
991
652
|
}
|
|
992
|
-
|
|
993
|
-
registerThreadRowViewSelectionHandler(handler: () => any): () => void {
|
|
653
|
+
registerThreadRowViewSelectionHandler(handler) {
|
|
994
654
|
this._threadRowViewSelectionChanges.onValue(handler);
|
|
995
655
|
return () => {
|
|
996
656
|
this._threadRowViewSelectionChanges.offValue(handler);
|
|
997
657
|
};
|
|
998
658
|
}
|
|
999
659
|
}
|
|
1000
|
-
|
|
1001
|
-
|
|
660
|
+
var _default = (0, _ud.defn)(module, GmailDriver);
|
|
661
|
+
exports.default = _default;
|