@inboxsdk/core 0.2.28-alpha.4 → 0.2.28-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/inboxsdk.js +1 -1
- package/package.json +5 -1
- package/src/inboxsdk-js/check-requirements.js +7 -3
- package/src/inboxsdk-js/header.js +1 -0
- package/src/inboxsdk-js/inboxsdk-NONREMOTE-INTEGRATED-PAGEWORLD.js +5 -6
- package/src/inboxsdk-js/inboxsdk-NONREMOTE.js +4 -3
- package/src/inboxsdk-js/inboxsdk-REMOTE.js +3 -1
- package/src/inboxsdk-js/inboxsdk-TEST.js +4 -3
- package/src/inboxsdk-js/inboxsdk.js +33 -39
- package/src/inboxsdk-js/loading/load-platform-implementation-DEV.js +15 -18
- package/src/injected-js/gmail/modify-suggestions.test.js +8 -9
- package/src/injected-js/gmail/setup-gmail-interceptor.js +340 -579
- package/src/injected-js/gmail/sync-compose-request-processor.test.js +39 -49
- package/src/injected-js/gmail/thread-identifier/click-and-get-popup-url.js +20 -33
- package/src/injected-js/gmail/thread-identifier/index.js +57 -93
- package/src/injected-js/gmail/thread-identifier/thread-row-parser.js +22 -31
- package/src/injected-js/gmail/thread-identifier/thread-row-parser.test.js +12 -28
- package/src/injected-js/inbox/setupAjaxInterceptor.js +64 -121
- package/src/injected-js/inbox/setupClickAndGetNewIframeSrc.js +53 -66
- package/src/injected-js/inbox/setupComposeViewDraftIDFinder.js +20 -36
- package/src/injected-js/inbox/setupInboxFakeWindowResizeListener.js +13 -13
- package/src/injected-js/main.js +11 -24
- package/src/injected-js/message-metadata-holder.js +52 -82
- package/src/injected-js/setup-data-exposer.js +89 -148
- package/src/injected-js/setup-error-silencer.js +21 -21
- package/src/injected-js/setup-event-reemitter.js +30 -22
- package/src/injected-js/setupInboxCustomViewLinkFixer.js +24 -29
- package/src/injected-js/setupPushStateListener.js +18 -11
- package/src/injected-js/xhr-helper.js +62 -65
- package/src/injected-js/xhr-proxy-factory.js +195 -445
- package/src/injected-js/xhr-proxy-factory.test.js +824 -991
- package/src/platform-implementation-js/constants/router.js +14 -9
- package/src/platform-implementation-js/constants/toolbars.js +8 -3
- package/src/platform-implementation-js/dom-driver/gmail/custom-style.js +13 -13
- package/src/platform-implementation-js/dom-driver/gmail/gmail-butter-bar-driver.js +115 -136
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-toolbar-button-for-app.js +13 -14
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/create-link.js +27 -48
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-draft-id-for-message-id.js +31 -42
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-native-nav-item.js +30 -40
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-url-object.js +10 -18
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadForOldGmailThreadId.js +21 -28
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadFromSyncThreadId.js +33 -45
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/gmail-load-event.js +31 -49
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/goto-view.js +58 -65
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/keyboard-shortcut-help-modifier.js +40 -124
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-compose-window.js +17 -22
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-draft-by-message-id.test.js +10 -11
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/override-gmail-back-button.js +44 -80
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/register-search-query-rewriter.js +19 -26
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/register-search-suggestions-provider.js +71 -147
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-compose-view-driver-stream.js +91 -148
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-route-view-driver-stream.js +150 -166
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-route-view-driver-stream.test.js +70 -120
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-app-id-warning.js +15 -15
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-route-view.js +44 -67
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-thread-list.js +230 -379
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-thread-list.test.js +121 -307
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-native-route-view.js +17 -24
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/suppressAddon.js +41 -49
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/temporary-track-download-url-validity.js +30 -40
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/thread-row-identifier.js +28 -60
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-events.js +61 -133
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/user-info.js +30 -42
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/user-info.test.js +52 -46
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.js +354 -694
- package/src/platform-implementation-js/dom-driver/gmail/make-xhr-interceptor.js +77 -93
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.js +35 -82
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.test.js +44 -94
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-companion-global-icon-area.js +12 -19
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-companion-thread-icon-area.js +17 -29
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-to-icon-area.js +26 -26
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/index.js +391 -797
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view/monitor-top-banner-size-and-react.js +7 -9
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view.js +60 -109
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-area-view.js +95 -135
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-card-view.js +103 -211
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-card-view.test.js +61 -61
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-backdrop.js +17 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-collapsible-section-view.js +188 -541
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-button.js +67 -135
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-compose-notice.js +27 -49
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-inner-sidebar.js +7 -13
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-outer-sidebar.js +9 -22
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-recipient-row.js +36 -63
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-tooltip-to-button.js +38 -113
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/ensure-app-button-toolbars-are-closed.js +11 -16
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/ensure-grouping-is-open.js +11 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/focus.js +8 -11
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/from-manager.js +27 -47
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-additional-action-toolbar.js +11 -24
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-address-changes-stream.js +59 -111
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-body-changes-stream.js +15 -14
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-formatting-area-offset-left.js +11 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-minimized-stream.js +18 -24
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-response-type-changes-stream.js +19 -23
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/insert-link-into-body.js +11 -19
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/manage-button-grouping.js +141 -376
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/monitor-selection-range.js +17 -28
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/override-edit-subject.js +34 -70
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/position-formatting-toolbar.js +10 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/size-fixer.js +83 -137
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/update-insert-more-area-left.js +10 -19
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view.js +632 -1190
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view/get-updated-contact.js +29 -38
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view.js +327 -617
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-processor.js +26 -49
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-view.js +188 -380
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-row-list-view.js +104 -194
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-row-view.js +382 -811
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view/add-icon-area.js +34 -58
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.js +330 -581
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.test.js +123 -277
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view/width-manager.js +15 -35
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view.js +216 -571
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-toolbar-view.js +152 -336
- package/src/platform-implementation-js/dom-driver/gmail/views/native-gmail-nav-item-view.js +87 -211
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/inbox-dropdown-button-view.js +10 -11
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-action-button-view.js +20 -29
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-label-view.js +41 -76
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-modal-view-driver.js +45 -99
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-mole-view-driver.js +76 -128
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-tooltip-view.js +128 -319
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-top-message-bar-driver.js +45 -78
- package/src/platform-implementation-js/dom-driver/inbox/__mocks__/getSidebarClassnames.js +8 -4
- package/src/platform-implementation-js/dom-driver/inbox/addNavItem.js +36 -54
- package/src/platform-implementation-js/dom-driver/inbox/addRecipientRow.js +35 -53
- package/src/platform-implementation-js/dom-driver/inbox/createLink.js +13 -15
- package/src/platform-implementation-js/dom-driver/inbox/createLink.test.js +15 -18
- package/src/platform-implementation-js/dom-driver/inbox/custom-style.js +14 -13
- package/src/platform-implementation-js/dom-driver/inbox/detection/appToolbarLocation/parser.js +14 -20
- package/src/platform-implementation-js/dom-driver/inbox/detection/attachmentCard/parser.js +14 -13
- package/src/platform-implementation-js/dom-driver/inbox/detection/attachmentOverlay/parser.js +35 -67
- package/src/platform-implementation-js/dom-driver/inbox/detection/chatSidebar/parser.js +16 -18
- package/src/platform-implementation-js/dom-driver/inbox/detection/compose/parser.js +68 -185
- package/src/platform-implementation-js/dom-driver/inbox/detection/message/parser.js +28 -56
- package/src/platform-implementation-js/dom-driver/inbox/detection/nativeDrawer/parser.js +12 -10
- package/src/platform-implementation-js/dom-driver/inbox/detection/searchBar/parser.js +16 -16
- package/src/platform-implementation-js/dom-driver/inbox/detection/thread/parser.js +24 -35
- package/src/platform-implementation-js/dom-driver/inbox/detection/thread-row/parser.js +37 -89
- package/src/platform-implementation-js/dom-driver/inbox/getComposeViewDriverLiveSet.js +56 -78
- package/src/platform-implementation-js/dom-driver/inbox/getInboxMessageIdForInboxThreadId.js +26 -32
- package/src/platform-implementation-js/dom-driver/inbox/getSidebarClassnames.js +52 -109
- package/src/platform-implementation-js/dom-driver/inbox/getSidebarClassnames.test.js +7 -8
- package/src/platform-implementation-js/dom-driver/inbox/gotoView.js +16 -20
- package/src/platform-implementation-js/dom-driver/inbox/gotoView.test.js +15 -16
- package/src/platform-implementation-js/dom-driver/inbox/inbox-butter-bar-driver.js +75 -83
- package/src/platform-implementation-js/dom-driver/inbox/inbox-driver.js +530 -822
- package/src/platform-implementation-js/dom-driver/inbox/inbox-page-communicator.js +48 -61
- package/src/platform-implementation-js/dom-driver/inbox/inboxResponseProcessor.js +9 -12
- package/src/platform-implementation-js/dom-driver/inbox/inboxResponseProcessor.test.js +12 -19
- package/src/platform-implementation-js/dom-driver/inbox/makePageParserTree.js +24 -33
- package/src/platform-implementation-js/dom-driver/inbox/pageParserOptions.js +201 -388
- package/src/platform-implementation-js/dom-driver/inbox/registerSearchSuggestionsProvider.js +249 -265
- package/src/platform-implementation-js/dom-driver/inbox/setupCustomAutocompleteSelectionHandling.js +84 -152
- package/src/platform-implementation-js/dom-driver/inbox/setupRouteViewDriverStream.js +55 -67
- package/src/platform-implementation-js/dom-driver/inbox/setupRouteViewDriverStream.test.js +43 -65
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxLabelView.js +31 -56
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxMoleViewDriver.js +191 -294
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxToolbarButtonView.js +32 -45
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxToolbarView.js +21 -39
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-sidebar-view.js +153 -240
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-toolbar-button-view.js +75 -150
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-toolbar-tooltip-view.js +20 -37
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-attachment-card-view.js +60 -114
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-attachment-overlay-view.js +47 -65
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-backdrop.js +41 -52
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-chat-sidebar-view.js +27 -36
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-compose-button-view.js +52 -80
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-compose-view.js +465 -649
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-custom-route-view.js +37 -58
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-custom-route-view.test.js +14 -26
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-drawer-view.js +118 -235
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-dropdown-view.js +10 -11
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-dummy-route-view.js +28 -46
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-message-view.js +131 -202
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-modal-view.js +40 -80
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-route-view.js +35 -61
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-row-view.js +124 -221
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-view.js +125 -213
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-view.test.js +104 -126
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-tooltip-view.js +36 -51
- package/src/platform-implementation-js/dom-driver/inbox/views/inboxNavItemView.js +158 -297
- package/src/platform-implementation-js/dom-driver/inbox/waitForAnimationClickBlockerGone.js +21 -35
- package/src/platform-implementation-js/driver-common/compose/getDiscardStream.js +24 -43
- package/src/platform-implementation-js/driver-common/compose/getPresendingStream.js +39 -68
- package/src/platform-implementation-js/driver-common/getGmailMessageIdForSyncMessageId.js +14 -19
- package/src/platform-implementation-js/driver-common/getGmailThreadIdForRfcMessageId.js +27 -35
- package/src/platform-implementation-js/driver-common/getRfcMessageIdForSyncMessageId.js +16 -22
- package/src/platform-implementation-js/driver-common/getThreadIdFromMessageId.js +14 -14
- package/src/platform-implementation-js/driver-common/inboxAjax.js +12 -7
- package/src/platform-implementation-js/driver-common/requestGmailThread.js +19 -20
- package/src/platform-implementation-js/driver-common/sidebar/AppSidebar.js +197 -306
- package/src/platform-implementation-js/driver-common/sidebar/ContentPanelViewDriver.js +113 -161
- package/src/platform-implementation-js/driver-interfaces/compose-view-driver.js +1 -114
- package/src/platform-implementation-js/driver-interfaces/driver.js +1 -131
- package/src/platform-implementation-js/driver-interfaces/message-view-driver.js +4 -48
- package/src/platform-implementation-js/driver-interfaces/mole-view-driver.js +1 -29
- package/src/platform-implementation-js/driver-interfaces/route-view-driver.js +1 -32
- package/src/platform-implementation-js/driver-interfaces/thread-row-view-driver.js +1 -11
- package/src/platform-implementation-js/lib/array-to-lifetimes.js +43 -41
- package/src/platform-implementation-js/lib/array-to-lifetimes.test.js +139 -155
- package/src/platform-implementation-js/lib/copyAndValidateAutocompleteResults.js +19 -38
- package/src/platform-implementation-js/lib/css-selector-escape.js +7 -3
- package/src/platform-implementation-js/lib/dom/element-view-mapper.js +8 -11
- package/src/platform-implementation-js/lib/dom/get-selection.js +23 -52
- package/src/platform-implementation-js/lib/dom/insert-html-at-cursor.js +69 -101
- package/src/platform-implementation-js/lib/dom/is-node-in-range.js +8 -10
- package/src/platform-implementation-js/lib/dom/on-mouse-down-and-up.js +15 -17
- package/src/platform-implementation-js/lib/dom/querySelectorOne.js +8 -11
- package/src/platform-implementation-js/lib/dom/set-css.js +7 -3
- package/src/platform-implementation-js/lib/dom/set-value-and-dispatch-event.js +9 -11
- package/src/platform-implementation-js/lib/dom/simulate-drag-and-drop.js +32 -33
- package/src/platform-implementation-js/lib/extract-contact-from-email-contact-string.test.js +23 -26
- package/src/platform-implementation-js/lib/handle-compose-link-chips.js +86 -149
- package/src/platform-implementation-js/lib/insert-link-chip-into-body.js +42 -57
- package/src/platform-implementation-js/lib/make-revocable-function.js +19 -21
- package/src/platform-implementation-js/lib/make-revocable-function.test.js +20 -22
- package/src/platform-implementation-js/lib/parseParamsFromRouteID.js +15 -17
- package/src/platform-implementation-js/lib/parseParamsFromRouteID.test.js +9 -18
- package/src/platform-implementation-js/lib/populateRouteID.js +8 -9
- package/src/platform-implementation-js/lib/populateRouteID.test.js +20 -19
- package/src/platform-implementation-js/lib/react/ElementContainer.js +23 -20
- package/src/platform-implementation-js/lib/rewriteCssWithIdMap.js +10 -9
- package/src/platform-implementation-js/lib/rewriteCssWithIdMap.test.js +13 -20
- package/src/platform-implementation-js/lib/routeIDmatchesHash.js +13 -18
- package/src/platform-implementation-js/lib/routeIDmatchesHash.test.js +11 -17
- package/src/platform-implementation-js/lib/shared-style.js +14 -13
- package/src/platform-implementation-js/lib/toItemWithLifetimeStream.js +18 -17
- package/src/platform-implementation-js/lib/toLiveSet.js +17 -15
- package/src/platform-implementation-js/main-INTEGRATED-PAGEWORLD.js +6 -5
- package/src/platform-implementation-js/main.js +9 -24
- package/src/platform-implementation-js/namespaces/compose.js +37 -60
- package/src/platform-implementation-js/namespaces/conversations.js +52 -124
- package/src/platform-implementation-js/namespaces/global.js +27 -39
- package/src/platform-implementation-js/namespaces/keyboard.js +29 -33
- package/src/platform-implementation-js/namespaces/lists.js +25 -31
- package/src/platform-implementation-js/namespaces/modal.js +34 -28
- package/src/platform-implementation-js/namespaces/nav-menu.js +30 -45
- package/src/platform-implementation-js/namespaces/router.js +70 -137
- package/src/platform-implementation-js/namespaces/search.js +19 -17
- package/src/platform-implementation-js/namespaces/toolbars.js +71 -117
- package/src/platform-implementation-js/namespaces/user.js +36 -37
- package/src/platform-implementation-js/namespaces/widgets.js +54 -61
- package/src/platform-implementation-js/platform-implementation.js +98 -229
- package/src/platform-implementation-js/views/app-toolbar-button-view.js +26 -47
- package/src/platform-implementation-js/views/collapsible-section-view.js +66 -63
- package/src/platform-implementation-js/views/content-panel-view.js +28 -30
- package/src/platform-implementation-js/views/conversations/attachment-card-view.js +21 -44
- package/src/platform-implementation-js/views/conversations/custom-message-view.js +44 -104
- package/src/platform-implementation-js/views/conversations/message-view.js +131 -202
- package/src/platform-implementation-js/views/conversations/thread-view.js +75 -127
- package/src/platform-implementation-js/views/native-nav-item-view.js +32 -65
- package/src/platform-implementation-js/views/nav-item-view.js +51 -115
- package/src/platform-implementation-js/views/route-view/custom-route-view.js +25 -20
- package/src/platform-implementation-js/views/route-view/dummy-route-view-driver.js +18 -18
- package/src/platform-implementation-js/views/route-view/list-route-view.js +30 -52
- package/src/platform-implementation-js/views/route-view/route-view.js +24 -35
- package/src/platform-implementation-js/views/section-view.js +60 -52
- package/src/platform-implementation-js/views/thread-row-view.js +49 -74
- package/src/platform-implementation-js/widgets/drawer-view.js +29 -36
- package/src/platform-implementation-js/widgets/modal-view.js +39 -68
- package/src/platform-implementation-js/widgets/mole-view.js +22 -22
- package/src/platform-implementation-js/widgets/top-message-bar-view.js +13 -10
|
@@ -1,512 +1,386 @@
|
|
|
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 _once = _interopRequireDefault(require("lodash/once"));
|
|
10
|
+
var _constant = _interopRequireDefault(require("lodash/constant"));
|
|
11
|
+
var _includes = _interopRequireDefault(require("lodash/includes"));
|
|
12
|
+
var _autoHtml = _interopRequireDefault(require("auto-html"));
|
|
13
|
+
var _kefir = _interopRequireDefault(require("kefir"));
|
|
14
|
+
var _kefirBus = _interopRequireDefault(require("kefir-bus"));
|
|
15
|
+
var _kefirStopper = _interopRequireDefault(require("kefir-stopper"));
|
|
16
|
+
var _ud = require("ud");
|
|
17
|
+
var _liveSet = _interopRequireDefault(require("live-set"));
|
|
18
|
+
var _filter = _interopRequireDefault(require("live-set/filter"));
|
|
19
|
+
var _merge = _interopRequireDefault(require("live-set/merge"));
|
|
20
|
+
var _flatMap = _interopRequireDefault(require("live-set/flatMap"));
|
|
21
|
+
var _mapWithRemoval = _interopRequireDefault(require("live-set/mapWithRemoval"));
|
|
22
|
+
var _toValueObservable = _interopRequireDefault(require("live-set/toValueObservable"));
|
|
23
|
+
var _makePageParserTree = _interopRequireDefault(require("./makePageParserTree"));
|
|
24
|
+
var _logger = _interopRequireDefault(require("../../lib/logger"));
|
|
25
|
+
var _toItemWithLifetimeStream = _interopRequireDefault(require("../../lib/toItemWithLifetimeStream"));
|
|
26
|
+
var _injectScript = require("../../lib/inject-script");
|
|
27
|
+
var _fromEventTargetCapture = _interopRequireDefault(require("../../lib/from-event-target-capture"));
|
|
28
|
+
var _bimapcache = _interopRequireDefault(require("bimapcache"));
|
|
29
|
+
var _getInboxMessageIdForInboxThreadId = _interopRequireDefault(require("./getInboxMessageIdForInboxThreadId"));
|
|
30
|
+
var _getGmailMessageIdForSyncMessageId = _interopRequireDefault(require("../../driver-common/getGmailMessageIdForSyncMessageId"));
|
|
31
|
+
var _getThreadIdFromMessageId = _interopRequireDefault(require("../../driver-common/getThreadIdFromMessageId"));
|
|
32
|
+
var _gmailAjax = _interopRequireDefault(require("../../driver-common/gmailAjax"));
|
|
33
|
+
var _getAccountUrlPart = _interopRequireDefault(require("../../driver-common/getAccountUrlPart"));
|
|
34
|
+
var _simulateKey = _interopRequireDefault(require("../../lib/dom/simulate-key"));
|
|
35
|
+
var _setCss = _interopRequireDefault(require("../../lib/dom/set-css"));
|
|
36
|
+
var _querySelectorOrFail = _interopRequireDefault(require("../../lib/dom/querySelectorOrFail"));
|
|
37
|
+
var _customStyle = _interopRequireDefault(require("./custom-style"));
|
|
38
|
+
var _censorHTMLstring = _interopRequireDefault(require("../../../common/censorHTMLstring"));
|
|
39
|
+
var _censorHTMLtree = _interopRequireDefault(require("../../../common/censorHTMLtree"));
|
|
40
|
+
var _getComposeViewDriverLiveSet = _interopRequireDefault(require("./getComposeViewDriverLiveSet"));
|
|
41
|
+
var _addNavItem = _interopRequireDefault(require("./addNavItem"));
|
|
42
|
+
var _querySelectorOne = _interopRequireDefault(require("../../lib/dom/querySelectorOne"));
|
|
43
|
+
var _idMap = _interopRequireDefault(require("../../lib/idMap"));
|
|
44
|
+
var _makeMutationObserverChunkedStream = _interopRequireDefault(require("../../lib/dom/make-mutation-observer-chunked-stream"));
|
|
45
|
+
var _getSidebarClassnames = _interopRequireDefault(require("./getSidebarClassnames"));
|
|
46
|
+
var _inboxButterBarDriver = _interopRequireDefault(require("./inbox-butter-bar-driver"));
|
|
47
|
+
var _createLink = _interopRequireDefault(require("./createLink"));
|
|
48
|
+
var _gotoView = _interopRequireDefault(require("./gotoView"));
|
|
49
|
+
var _parser = _interopRequireDefault(require("./detection/thread/parser"));
|
|
50
|
+
var _parser2 = _interopRequireDefault(require("./detection/thread-row/parser"));
|
|
51
|
+
var _parser3 = _interopRequireDefault(require("./detection/message/parser"));
|
|
52
|
+
var _parser4 = _interopRequireDefault(require("./detection/attachmentCard/parser"));
|
|
53
|
+
var _parser5 = _interopRequireDefault(require("./detection/attachmentOverlay/parser"));
|
|
54
|
+
var _parser6 = _interopRequireDefault(require("./detection/nativeDrawer/parser"));
|
|
55
|
+
var _parser7 = _interopRequireDefault(require("./detection/searchBar/parser"));
|
|
56
|
+
var _parser8 = _interopRequireDefault(require("./detection/chatSidebar/parser"));
|
|
57
|
+
var _parser9 = _interopRequireDefault(require("./detection/appToolbarLocation/parser"));
|
|
58
|
+
var _setupRouteViewDriverStream = _interopRequireDefault(require("./setupRouteViewDriverStream"));
|
|
59
|
+
var _inboxThreadView = _interopRequireDefault(require("./views/inbox-thread-view"));
|
|
60
|
+
var _inboxThreadRowView = _interopRequireDefault(require("./views/inbox-thread-row-view"));
|
|
61
|
+
var _inboxMessageView = _interopRequireDefault(require("./views/inbox-message-view"));
|
|
62
|
+
var _inboxAttachmentCardView = _interopRequireDefault(require("./views/inbox-attachment-card-view"));
|
|
63
|
+
var _inboxAttachmentOverlayView = _interopRequireDefault(require("./views/inbox-attachment-overlay-view"));
|
|
64
|
+
var _inboxChatSidebarView = _interopRequireDefault(require("./views/inbox-chat-sidebar-view"));
|
|
65
|
+
var _InboxToolbarView = _interopRequireDefault(require("./views/InboxToolbarView"));
|
|
66
|
+
var _InboxMoleViewDriver = _interopRequireDefault(require("./views/InboxMoleViewDriver"));
|
|
67
|
+
var _inboxAppSidebarView = _interopRequireDefault(require("./views/inbox-app-sidebar-view"));
|
|
68
|
+
var _registerSearchSuggestionsProvider = _interopRequireDefault(require("./registerSearchSuggestionsProvider"));
|
|
69
|
+
var _inboxAppToolbarButtonView = _interopRequireDefault(require("./views/inbox-app-toolbar-button-view"));
|
|
70
|
+
var _inboxPageCommunicator = _interopRequireDefault(require("./inbox-page-communicator"));
|
|
71
|
+
var _inboxModalView = _interopRequireDefault(require("./views/inbox-modal-view"));
|
|
72
|
+
var _inboxDrawerView = _interopRequireDefault(require("./views/inbox-drawer-view"));
|
|
73
|
+
var _inboxBackdrop = _interopRequireDefault(require("./views/inbox-backdrop"));
|
|
1
74
|
/* eslint-disable flowtype/require-valid-file-annotation -- flow support is deprecated and this file existed for a Google product that no longer exists */
|
|
2
75
|
|
|
3
|
-
import once from 'lodash/once';
|
|
4
|
-
import constant from 'lodash/constant';
|
|
5
|
-
import includes from 'lodash/includes';
|
|
6
|
-
import autoHtml from 'auto-html';
|
|
7
|
-
|
|
8
|
-
import Kefir from 'kefir';
|
|
9
|
-
import kefirBus from 'kefir-bus';
|
|
10
|
-
import type { Bus } from 'kefir-bus';
|
|
11
|
-
import kefirStopper from 'kefir-stopper';
|
|
12
|
-
import type { Stopper } from 'kefir-stopper';
|
|
13
|
-
import { defn } from 'ud';
|
|
14
|
-
|
|
15
|
-
import type { TagTree } from 'tag-tree';
|
|
16
|
-
import LiveSet from 'live-set';
|
|
17
|
-
import lsFilter from 'live-set/filter';
|
|
18
|
-
import lsMerge from 'live-set/merge';
|
|
19
|
-
import lsFlatMap from 'live-set/flatMap';
|
|
20
|
-
import lsMapWithRemoval from 'live-set/mapWithRemoval';
|
|
21
|
-
import toValueObservable from 'live-set/toValueObservable';
|
|
22
|
-
import type PageParserTree from 'page-parser-tree';
|
|
23
|
-
import makePageParserTree from './makePageParserTree';
|
|
24
|
-
|
|
25
|
-
import Logger from '../../lib/logger';
|
|
26
|
-
import toItemWithLifetimeStream from '../../lib/toItemWithLifetimeStream';
|
|
27
|
-
import { injectScript } from '../../lib/inject-script';
|
|
28
|
-
import fromEventTargetCapture from '../../lib/from-event-target-capture';
|
|
29
|
-
import BiMapCache from 'bimapcache';
|
|
30
|
-
import getInboxMessageIdForInboxThreadId from './getInboxMessageIdForInboxThreadId';
|
|
31
|
-
import getGmailMessageIdForSyncMessageId from '../../driver-common/getGmailMessageIdForSyncMessageId';
|
|
32
|
-
import getThreadIdFromMessageId from '../../driver-common/getThreadIdFromMessageId';
|
|
33
|
-
import gmailAjax from '../../driver-common/gmailAjax';
|
|
34
|
-
import getAccountUrlPart from '../../driver-common/getAccountUrlPart';
|
|
35
|
-
import simulateKey from '../../lib/dom/simulate-key';
|
|
36
|
-
import setCss from '../../lib/dom/set-css';
|
|
37
|
-
import querySelector from '../../lib/dom/querySelectorOrFail';
|
|
38
|
-
import customStyle from './custom-style';
|
|
39
|
-
import censorHTMLstring from '../../../common/censorHTMLstring';
|
|
40
|
-
import censorHTMLtree from '../../../common/censorHTMLtree';
|
|
41
|
-
import type KeyboardShortcutHandle from '../../views/keyboard-shortcut-handle';
|
|
42
|
-
import getComposeViewDriverLiveSet from './getComposeViewDriverLiveSet';
|
|
43
|
-
import addNavItem from './addNavItem';
|
|
44
|
-
|
|
45
|
-
import type {
|
|
46
|
-
ItemWithLifetime,
|
|
47
|
-
ElementWithLifetime,
|
|
48
|
-
} from '../../lib/dom/make-element-child-stream';
|
|
49
|
-
import querySelectorOne from '../../lib/dom/querySelectorOne';
|
|
50
|
-
import idMap from '../../lib/idMap';
|
|
51
|
-
import makeMutationObserverChunkedStream from '../../lib/dom/make-mutation-observer-chunked-stream';
|
|
52
|
-
import getSidebarClassnames from './getSidebarClassnames';
|
|
53
|
-
import InboxButterBarDriver from './inbox-butter-bar-driver';
|
|
54
|
-
import createLink from './createLink';
|
|
55
|
-
import gotoView from './gotoView';
|
|
56
|
-
|
|
57
|
-
import threadParser from './detection/thread/parser';
|
|
58
|
-
import threadRowParser from './detection/thread-row/parser';
|
|
59
|
-
import messageParser from './detection/message/parser';
|
|
60
|
-
import attachmentCardParser from './detection/attachmentCard/parser';
|
|
61
|
-
import attachmentOverlayParser from './detection/attachmentOverlay/parser';
|
|
62
|
-
import nativeDrawerParser from './detection/nativeDrawer/parser';
|
|
63
|
-
import searchBarParser from './detection/searchBar/parser';
|
|
64
|
-
import chatSidebarParser from './detection/chatSidebar/parser';
|
|
65
|
-
import appToolbarLocationParser from './detection/appToolbarLocation/parser';
|
|
66
|
-
|
|
67
|
-
import setupRouteViewDriverStream from './setupRouteViewDriverStream';
|
|
68
|
-
|
|
69
|
-
import type InboxRouteView from './views/inbox-route-view';
|
|
70
|
-
import type InboxCustomRouteView from './views/inbox-custom-route-view';
|
|
71
|
-
import type InboxDummyRouteView from './views/inbox-dummy-route-view';
|
|
72
|
-
import type InboxComposeView from './views/inbox-compose-view';
|
|
73
|
-
import InboxThreadView from './views/inbox-thread-view';
|
|
74
|
-
import InboxThreadRowView from './views/inbox-thread-row-view';
|
|
75
|
-
import InboxMessageView from './views/inbox-message-view';
|
|
76
|
-
import InboxAttachmentCardView from './views/inbox-attachment-card-view';
|
|
77
|
-
import InboxAttachmentOverlayView from './views/inbox-attachment-overlay-view';
|
|
78
|
-
import InboxChatSidebarView from './views/inbox-chat-sidebar-view';
|
|
79
|
-
import InboxToolbarView from './views/InboxToolbarView';
|
|
80
|
-
import InboxMoleViewDriver from './views/InboxMoleViewDriver';
|
|
81
|
-
|
|
82
|
-
import InboxAppSidebarView from './views/inbox-app-sidebar-view';
|
|
83
|
-
|
|
84
|
-
import registerSearchSuggestionsProvider from './registerSearchSuggestionsProvider';
|
|
85
|
-
|
|
86
|
-
import InboxAppToolbarButtonView from './views/inbox-app-toolbar-button-view';
|
|
87
|
-
import InboxPageCommunicator from './inbox-page-communicator';
|
|
88
|
-
import InboxModalView from './views/inbox-modal-view';
|
|
89
|
-
import InboxDrawerView from './views/inbox-drawer-view';
|
|
90
|
-
import InboxBackdrop from './views/inbox-backdrop';
|
|
91
|
-
import type ButterBar from '../../namespaces/butter-bar';
|
|
92
|
-
import type { RouteParams } from '../../namespaces/router';
|
|
93
|
-
import type { Driver, DrawerViewOptions } from '../../driver-interfaces/driver';
|
|
94
|
-
import type { PiOpts, EnvData } from '../../platform-implementation';
|
|
95
|
-
|
|
96
76
|
class InboxDriver {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
_butterBar: ButterBar;
|
|
122
|
-
_pageCommunicator: InboxPageCommunicator;
|
|
123
|
-
_lastInteractedAttachmentCardView: ?InboxAttachmentCardView = null;
|
|
124
|
-
_lastInteractedAttachmentCardViewSet: Bus<any> = kefirBus();
|
|
125
|
-
_appSidebarView: ?InboxAppSidebarView = null;
|
|
126
|
-
_customRouteIDs: Set<string> = new Set();
|
|
127
|
-
_navMenuContainer: ?HTMLElement;
|
|
128
|
-
_threadIdStats: {
|
|
129
|
-
threadRows: {
|
|
130
|
-
totalThreads: Set<string>,
|
|
131
|
-
totalCalls: number,
|
|
132
|
-
threadsWithoutGmailId: Set<string>,
|
|
133
|
-
callsWithoutGmailId: number,
|
|
134
|
-
threadsWithFetch: number,
|
|
135
|
-
},
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
getGmailMessageIdForSyncMessageId: (
|
|
139
|
-
inboxMessageId: string
|
|
140
|
-
) => Promise<string>;
|
|
141
|
-
getInboxMessageIdForInboxThreadId: (inboxThreadId: string) => Promise<string>;
|
|
142
|
-
getThreadIdFromMessageId: (messageId: string) => Promise<string>;
|
|
143
|
-
|
|
144
|
-
constructor(
|
|
145
|
-
appId: string,
|
|
146
|
-
LOADER_VERSION: string,
|
|
147
|
-
IMPL_VERSION: string,
|
|
148
|
-
logger: Logger,
|
|
149
|
-
opts: PiOpts,
|
|
150
|
-
envData: EnvData
|
|
151
|
-
) {
|
|
152
|
-
(this: Driver); // interface check
|
|
153
|
-
customStyle();
|
|
77
|
+
constructor(appId, LOADER_VERSION, IMPL_VERSION, logger, opts, envData) {
|
|
78
|
+
(0, _defineProperty2.default)(this, "_threadViewElements", new WeakMap());
|
|
79
|
+
(0, _defineProperty2.default)(this, "_messageViewElements", new WeakMap());
|
|
80
|
+
(0, _defineProperty2.default)(this, "_butterBarDriver", new _inboxButterBarDriver.default());
|
|
81
|
+
(0, _defineProperty2.default)(this, "_lastInteractedAttachmentCardView", null);
|
|
82
|
+
(0, _defineProperty2.default)(this, "_lastInteractedAttachmentCardViewSet", (0, _kefirBus.default)());
|
|
83
|
+
(0, _defineProperty2.default)(this, "_appSidebarView", null);
|
|
84
|
+
(0, _defineProperty2.default)(this, "_customRouteIDs", new Set());
|
|
85
|
+
(0, _defineProperty2.default)(this, "getGmailActionToken", (0, _once.default)(async () => {
|
|
86
|
+
const response = await (0, _gmailAjax.default)({
|
|
87
|
+
url: `https://mail.google.com/mail${(0, _getAccountUrlPart.default)()}/`,
|
|
88
|
+
xhrFields: {
|
|
89
|
+
withCredentials: true
|
|
90
|
+
},
|
|
91
|
+
canRetry: true
|
|
92
|
+
});
|
|
93
|
+
const tokenVarMatch = response.text.match(/var GM_ACTION_TOKEN=("[^"]+")/);
|
|
94
|
+
if (!tokenVarMatch) {
|
|
95
|
+
throw new Error('Could not find GM_ACTION_TOKEN');
|
|
96
|
+
}
|
|
97
|
+
return JSON.parse(tokenVarMatch[1]);
|
|
98
|
+
}));
|
|
99
|
+
this; // interface check
|
|
100
|
+
(0, _customStyle.default)();
|
|
154
101
|
this._appId = appId;
|
|
155
102
|
this._logger = logger;
|
|
156
103
|
this._opts = opts;
|
|
157
104
|
this._envData = envData;
|
|
158
|
-
this._stopper =
|
|
159
|
-
this._pageCommunicator = new
|
|
160
|
-
|
|
161
|
-
this._page = makePageParserTree(this, document);
|
|
105
|
+
this._stopper = (0, _kefirStopper.default)();
|
|
106
|
+
this._pageCommunicator = new _inboxPageCommunicator.default();
|
|
107
|
+
this._page = (0, _makePageParserTree.default)(this, document);
|
|
162
108
|
this._stopper.onValue(() => this._page.dump());
|
|
163
|
-
|
|
164
|
-
this.onready = injectScript().then(() => {
|
|
109
|
+
this.onready = (0, _injectScript.injectScript)().then(() => {
|
|
165
110
|
this._logger.setUserEmailAddress(this.getUserEmailAddress());
|
|
166
111
|
});
|
|
167
|
-
|
|
168
112
|
this._setupThreadIdStats();
|
|
169
|
-
|
|
170
113
|
{
|
|
171
114
|
if (global.localStorage) {
|
|
172
115
|
// We used to not always identify the ids of messages correctly, so we
|
|
173
116
|
// just drop the old cache and use a new one.
|
|
174
|
-
global.localStorage.removeItem(
|
|
175
|
-
'inboxsdk__cached_gmail_and_inbox_message_ids'
|
|
176
|
-
);
|
|
117
|
+
global.localStorage.removeItem('inboxsdk__cached_gmail_and_inbox_message_ids');
|
|
177
118
|
}
|
|
178
|
-
const gmailMessageIdForInboxMessageIdCache = new
|
|
119
|
+
const gmailMessageIdForInboxMessageIdCache = new _bimapcache.default({
|
|
179
120
|
key: 'inboxsdk__cached_gmail_and_inbox_message_ids_2',
|
|
180
|
-
getAfromB:
|
|
181
|
-
getGmailMessageIdForSyncMessageId(this, inboxMessageId),
|
|
121
|
+
getAfromB: inboxMessageId => (0, _getGmailMessageIdForSyncMessageId.default)(this, inboxMessageId),
|
|
182
122
|
getBfromA() {
|
|
183
123
|
throw new Error('should not happen');
|
|
184
|
-
}
|
|
124
|
+
}
|
|
185
125
|
});
|
|
186
|
-
this.getGmailMessageIdForSyncMessageId = (inboxMessageId)
|
|
187
|
-
gmailMessageIdForInboxMessageIdCache.getAfromB(inboxMessageId);
|
|
126
|
+
this.getGmailMessageIdForSyncMessageId = inboxMessageId => gmailMessageIdForInboxMessageIdCache.getAfromB(inboxMessageId);
|
|
188
127
|
}
|
|
189
|
-
|
|
190
128
|
{
|
|
191
|
-
const inboxMessageIdForInboxThreadIdCache = new
|
|
129
|
+
const inboxMessageIdForInboxThreadIdCache = new _bimapcache.default({
|
|
192
130
|
key: 'inboxsdk__cached_inbox_message_and_inbox_thread_ids',
|
|
193
|
-
getAfromB:
|
|
131
|
+
getAfromB: inboxThreadId => {
|
|
194
132
|
this._threadIdStats.threadRows.threadsWithFetch += 1;
|
|
195
|
-
return
|
|
133
|
+
return (0, _getInboxMessageIdForInboxThreadId.default)(this, inboxThreadId);
|
|
196
134
|
},
|
|
197
135
|
getBfromA() {
|
|
198
136
|
throw new Error('should not happen');
|
|
199
|
-
}
|
|
137
|
+
}
|
|
200
138
|
});
|
|
201
|
-
this.getInboxMessageIdForInboxThreadId = (inboxThreadId)
|
|
202
|
-
inboxMessageIdForInboxThreadIdCache.getAfromB(inboxThreadId);
|
|
139
|
+
this.getInboxMessageIdForInboxThreadId = inboxThreadId => inboxMessageIdForInboxThreadIdCache.getAfromB(inboxThreadId);
|
|
203
140
|
}
|
|
204
|
-
|
|
205
141
|
{
|
|
206
|
-
const threadIdFromMessageIdCache = new
|
|
142
|
+
const threadIdFromMessageIdCache = new _bimapcache.default({
|
|
207
143
|
key: 'inboxsdk__cached_thread_and_message_ids',
|
|
208
|
-
getAfromB:
|
|
209
|
-
getThreadIdFromMessageId(this, messageId),
|
|
144
|
+
getAfromB: messageId => (0, _getThreadIdFromMessageId.default)(this, messageId),
|
|
210
145
|
getBfromA() {
|
|
211
146
|
throw new Error('should not happen');
|
|
212
|
-
}
|
|
147
|
+
}
|
|
213
148
|
});
|
|
214
|
-
this.getThreadIdFromMessageId = (messageId)
|
|
215
|
-
threadIdFromMessageIdCache.getAfromB(messageId);
|
|
149
|
+
this.getThreadIdFromMessageId = messageId => threadIdFromMessageIdCache.getAfromB(messageId);
|
|
216
150
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
(
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
score: parsed.score,
|
|
226
|
-
errors: parsed.errors,
|
|
227
|
-
html: censorHTMLtree(el),
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
const view = new InboxThreadRowView(el, this, parsed);
|
|
231
|
-
removal.then(() => {
|
|
232
|
-
view.destroy();
|
|
151
|
+
this._threadRowViewDriverLiveSet = (0, _mapWithRemoval.default)(this._page.tree.getAllByTag('collapsedThreadRow'), (node, removal) => {
|
|
152
|
+
const el = node.getValue();
|
|
153
|
+
const parsed = (0, _parser2.default)(el);
|
|
154
|
+
if (parsed.errors.length) {
|
|
155
|
+
this._logger.errorSite(new Error('parse errors (threadRow)'), {
|
|
156
|
+
score: parsed.score,
|
|
157
|
+
errors: parsed.errors,
|
|
158
|
+
html: (0, _censorHTMLtree.default)(el)
|
|
233
159
|
});
|
|
234
|
-
return view;
|
|
235
160
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
return new LiveSet({
|
|
251
|
-
read() {
|
|
252
|
-
throw new Error();
|
|
253
|
-
},
|
|
254
|
-
listen: (setValues, controller) => {
|
|
255
|
-
setValues(new Set());
|
|
256
|
-
const unsub = kefirStopper();
|
|
257
|
-
|
|
258
|
-
// If the InboxThreadView is destroyed before the element is removed,
|
|
259
|
-
// then make a new InboxThreadView out of the same element.
|
|
260
|
-
const newView = (firstRun) => {
|
|
261
|
-
if (!firstRun) {
|
|
262
|
-
parsed = threadParser(el);
|
|
263
|
-
if (parsed.errors.length > 0) {
|
|
264
|
-
this._logger.errorSite(new Error('thread reparse errors'), {
|
|
265
|
-
score: parsed.score,
|
|
266
|
-
errors: parsed.errors,
|
|
267
|
-
html: censorHTMLtree(el),
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
const view = new InboxThreadView(el, this, parsed);
|
|
272
|
-
view
|
|
273
|
-
.getStopper()
|
|
274
|
-
.takeUntilBy(unsub)
|
|
275
|
-
.onValue(() => {
|
|
276
|
-
controller.remove(view);
|
|
277
|
-
newView(false);
|
|
278
|
-
});
|
|
279
|
-
unsub.takeUntilBy(view.getStopper()).onValue(() => {
|
|
280
|
-
view.destroy();
|
|
281
|
-
});
|
|
282
|
-
controller.add(view);
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
newView(true);
|
|
286
|
-
|
|
287
|
-
return () => {
|
|
288
|
-
unsub.destroy();
|
|
289
|
-
};
|
|
290
|
-
},
|
|
161
|
+
const view = new _inboxThreadRowView.default(el, this, parsed);
|
|
162
|
+
removal.then(() => {
|
|
163
|
+
view.destroy();
|
|
164
|
+
});
|
|
165
|
+
return view;
|
|
166
|
+
});
|
|
167
|
+
this._threadViewDriverLiveSet = (0, _flatMap.default)(this._page.tree.getAllByTag('thread'), node => {
|
|
168
|
+
const el = node.getValue();
|
|
169
|
+
let parsed = (0, _parser.default)(el);
|
|
170
|
+
if (parsed.errors.length) {
|
|
171
|
+
this._logger.errorSite(new Error('parse errors (thread)'), {
|
|
172
|
+
score: parsed.score,
|
|
173
|
+
errors: parsed.errors,
|
|
174
|
+
html: (0, _censorHTMLtree.default)(el)
|
|
291
175
|
});
|
|
292
176
|
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
},
|
|
312
|
-
listen: (setValues, controller) => {
|
|
313
|
-
setValues(new Set());
|
|
314
|
-
const unsub = kefirStopper();
|
|
315
|
-
|
|
316
|
-
// If the InboxMessageView is destroyed before the element is removed,
|
|
317
|
-
// then make a new InboxMessageView out of the same element. Inbox re-uses
|
|
318
|
-
// elements for different messages in some cases.
|
|
319
|
-
const newView = (firstRun) => {
|
|
320
|
-
if (!firstRun) {
|
|
321
|
-
parsed = messageParser(el);
|
|
322
|
-
if (parsed.errors.length > 0) {
|
|
323
|
-
this._logger.errorSite(new Error(`message reparse errors`), {
|
|
324
|
-
score: parsed.score,
|
|
325
|
-
errors: parsed.errors,
|
|
326
|
-
html: censorHTMLtree(el),
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
const view = new InboxMessageView(el, this, parsed);
|
|
331
|
-
view
|
|
332
|
-
.getStopper()
|
|
333
|
-
.takeUntilBy(unsub)
|
|
334
|
-
.onValue(() => {
|
|
335
|
-
controller.remove(view);
|
|
336
|
-
newView(false);
|
|
177
|
+
return new _liveSet.default({
|
|
178
|
+
read() {
|
|
179
|
+
throw new Error();
|
|
180
|
+
},
|
|
181
|
+
listen: (setValues, controller) => {
|
|
182
|
+
setValues(new Set());
|
|
183
|
+
const unsub = (0, _kefirStopper.default)();
|
|
184
|
+
|
|
185
|
+
// If the InboxThreadView is destroyed before the element is removed,
|
|
186
|
+
// then make a new InboxThreadView out of the same element.
|
|
187
|
+
const newView = firstRun => {
|
|
188
|
+
if (!firstRun) {
|
|
189
|
+
parsed = (0, _parser.default)(el);
|
|
190
|
+
if (parsed.errors.length > 0) {
|
|
191
|
+
this._logger.errorSite(new Error('thread reparse errors'), {
|
|
192
|
+
score: parsed.score,
|
|
193
|
+
errors: parsed.errors,
|
|
194
|
+
html: (0, _censorHTMLtree.default)(el)
|
|
337
195
|
});
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
this._attachmentCardViewDriverLiveSet = lsMapWithRemoval(
|
|
355
|
-
this._page.tree.getAllByTag('attachmentCard'),
|
|
356
|
-
(node, removal) => {
|
|
357
|
-
const el = node.getValue();
|
|
358
|
-
const parsed = attachmentCardParser(el);
|
|
359
|
-
if (parsed.errors.length) {
|
|
360
|
-
this._logger.errorSite(new Error('parse errors (attachmentCard)'), {
|
|
361
|
-
score: parsed.score,
|
|
362
|
-
errors: parsed.errors,
|
|
363
|
-
html: censorHTMLtree(el),
|
|
364
|
-
});
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
const view = new _inboxThreadView.default(el, this, parsed);
|
|
199
|
+
view.getStopper().takeUntilBy(unsub).onValue(() => {
|
|
200
|
+
controller.remove(view);
|
|
201
|
+
newView(false);
|
|
202
|
+
});
|
|
203
|
+
unsub.takeUntilBy(view.getStopper()).onValue(() => {
|
|
204
|
+
view.destroy();
|
|
205
|
+
});
|
|
206
|
+
controller.add(view);
|
|
207
|
+
};
|
|
208
|
+
newView(true);
|
|
209
|
+
return () => {
|
|
210
|
+
unsub.destroy();
|
|
211
|
+
};
|
|
365
212
|
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
this._messageViewDriverLiveSet = (0, _flatMap.default)(this._page.tree.getAllByTag('message'), node => {
|
|
216
|
+
const el = node.getValue();
|
|
217
|
+
let parsed = (0, _parser3.default)(el);
|
|
218
|
+
if (parsed.errors.length > 0) {
|
|
219
|
+
this._logger.errorSite(new Error('parse errors (message)'), {
|
|
220
|
+
score: parsed.score,
|
|
221
|
+
errors: parsed.errors,
|
|
222
|
+
html: (0, _censorHTMLtree.default)(el)
|
|
369
223
|
});
|
|
370
|
-
return view;
|
|
371
224
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
225
|
+
if (parsed.attributes.isDraft) return _liveSet.default.constant(new Set());
|
|
226
|
+
return new _liveSet.default({
|
|
227
|
+
read() {
|
|
228
|
+
throw new Error();
|
|
229
|
+
},
|
|
230
|
+
listen: (setValues, controller) => {
|
|
231
|
+
setValues(new Set());
|
|
232
|
+
const unsub = (0, _kefirStopper.default)();
|
|
233
|
+
|
|
234
|
+
// If the InboxMessageView is destroyed before the element is removed,
|
|
235
|
+
// then make a new InboxMessageView out of the same element. Inbox re-uses
|
|
236
|
+
// elements for different messages in some cases.
|
|
237
|
+
const newView = firstRun => {
|
|
238
|
+
if (!firstRun) {
|
|
239
|
+
parsed = (0, _parser3.default)(el);
|
|
240
|
+
if (parsed.errors.length > 0) {
|
|
241
|
+
this._logger.errorSite(new Error(`message reparse errors`), {
|
|
242
|
+
score: parsed.score,
|
|
243
|
+
errors: parsed.errors,
|
|
244
|
+
html: (0, _censorHTMLtree.default)(el)
|
|
245
|
+
});
|
|
246
|
+
}
|
|
386
247
|
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
);
|
|
394
|
-
return LiveSet.constant(new Set());
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
return new LiveSet({
|
|
398
|
-
read() {
|
|
399
|
-
throw new Error();
|
|
400
|
-
},
|
|
401
|
-
listen: (setValues) => {
|
|
402
|
-
const view = new InboxAttachmentOverlayView(
|
|
403
|
-
this,
|
|
404
|
-
el,
|
|
405
|
-
parsed,
|
|
406
|
-
cardView
|
|
407
|
-
);
|
|
408
|
-
setValues(new Set([view]));
|
|
409
|
-
return () => {
|
|
248
|
+
const view = new _inboxMessageView.default(el, this, parsed);
|
|
249
|
+
view.getStopper().takeUntilBy(unsub).onValue(() => {
|
|
250
|
+
controller.remove(view);
|
|
251
|
+
newView(false);
|
|
252
|
+
});
|
|
253
|
+
unsub.takeUntilBy(view.getStopper()).onValue(() => {
|
|
410
254
|
view.destroy();
|
|
411
|
-
};
|
|
412
|
-
|
|
255
|
+
});
|
|
256
|
+
controller.add(view);
|
|
257
|
+
};
|
|
258
|
+
newView(true);
|
|
259
|
+
return () => {
|
|
260
|
+
unsub.destroy();
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
this._attachmentCardViewDriverLiveSet = (0, _mapWithRemoval.default)(this._page.tree.getAllByTag('attachmentCard'), (node, removal) => {
|
|
266
|
+
const el = node.getValue();
|
|
267
|
+
const parsed = (0, _parser4.default)(el);
|
|
268
|
+
if (parsed.errors.length) {
|
|
269
|
+
this._logger.errorSite(new Error('parse errors (attachmentCard)'), {
|
|
270
|
+
score: parsed.score,
|
|
271
|
+
errors: parsed.errors,
|
|
272
|
+
html: (0, _censorHTMLtree.default)(el)
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
const view = new _inboxAttachmentCardView.default({
|
|
276
|
+
element: el,
|
|
277
|
+
parsed
|
|
278
|
+
}, this);
|
|
279
|
+
removal.then(() => {
|
|
280
|
+
view.destroy();
|
|
281
|
+
});
|
|
282
|
+
return view;
|
|
283
|
+
});
|
|
284
|
+
this._attachmentOverlayViewDriverLiveSet = (0, _flatMap.default)(this._page.tree.getAllByTag('attachmentOverlay'), node => {
|
|
285
|
+
const el = node.getValue();
|
|
286
|
+
const parsed = (0, _parser5.default)(el);
|
|
287
|
+
if (parsed.errors.length) {
|
|
288
|
+
this._logger.errorSite(new Error('parse errors (attachmentOverlay)'), {
|
|
289
|
+
score: parsed.score,
|
|
290
|
+
errors: parsed.errors,
|
|
291
|
+
html: (0, _censorHTMLtree.default)(el)
|
|
413
292
|
});
|
|
414
293
|
}
|
|
415
|
-
|
|
294
|
+
const cardView = this.getLastInteractedAttachmentCardView();
|
|
295
|
+
if (!cardView) {
|
|
296
|
+
this._logger.error(new Error('Encountered overlay without knowing cardView'));
|
|
297
|
+
return _liveSet.default.constant(new Set());
|
|
298
|
+
}
|
|
299
|
+
return new _liveSet.default({
|
|
300
|
+
read() {
|
|
301
|
+
throw new Error();
|
|
302
|
+
},
|
|
303
|
+
listen: setValues => {
|
|
304
|
+
const view = new _inboxAttachmentOverlayView.default(this, el, parsed, cardView);
|
|
305
|
+
setValues(new Set([view]));
|
|
306
|
+
return () => {
|
|
307
|
+
view.destroy();
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
});
|
|
416
312
|
this._attachmentOverlayViewDriverLiveSet.subscribe({});
|
|
417
313
|
// force activation because nothing outside of the driver is going to
|
|
418
314
|
// subscribe to this, unlike some of the other livesets.
|
|
419
315
|
|
|
420
|
-
this._composeViewDriverLiveSet =
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
const parsed = chatSidebarParser(el);
|
|
430
|
-
if (parsed.errors.length) {
|
|
431
|
-
this._logger.errorSite(new Error('parse errors (chatSidebar)'), {
|
|
432
|
-
score: parsed.score,
|
|
433
|
-
errors: parsed.errors,
|
|
434
|
-
html: censorHTMLtree(el),
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
const view = new InboxChatSidebarView(el, parsed);
|
|
438
|
-
removal.then(() => {
|
|
439
|
-
view.destroy();
|
|
316
|
+
this._composeViewDriverLiveSet = (0, _getComposeViewDriverLiveSet.default)(this, this._page.tree);
|
|
317
|
+
this._chatSidebarViewLiveSet = (0, _mapWithRemoval.default)(this._page.tree.getAllByTag('chatSidebar'), (node, removal) => {
|
|
318
|
+
const el = node.getValue();
|
|
319
|
+
const parsed = (0, _parser8.default)(el);
|
|
320
|
+
if (parsed.errors.length) {
|
|
321
|
+
this._logger.errorSite(new Error('parse errors (chatSidebar)'), {
|
|
322
|
+
score: parsed.score,
|
|
323
|
+
errors: parsed.errors,
|
|
324
|
+
html: (0, _censorHTMLtree.default)(el)
|
|
440
325
|
});
|
|
441
|
-
return view;
|
|
442
326
|
}
|
|
443
|
-
|
|
327
|
+
const view = new _inboxChatSidebarView.default(el, parsed);
|
|
328
|
+
removal.then(() => {
|
|
329
|
+
view.destroy();
|
|
330
|
+
});
|
|
331
|
+
return view;
|
|
332
|
+
});
|
|
444
333
|
this._chatSidebarViewLiveSet.subscribe({});
|
|
445
334
|
// force activation because nothing outside of the driver is going to
|
|
446
335
|
// subscribe to this, unlike some of the other livesets.
|
|
447
336
|
|
|
448
|
-
this._routeViewDriverStream =
|
|
449
|
-
this._routeViewDriverStream
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
)
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
({ value: node }) => {
|
|
469
|
-
const el = node.getValue();
|
|
470
|
-
const parsed = searchBarParser(el);
|
|
471
|
-
if (parsed.errors.length) {
|
|
472
|
-
this._logger.errorSite(new Error('parse errors (searchBar)'), {
|
|
473
|
-
score: parsed.score,
|
|
474
|
-
errors: parsed.errors,
|
|
475
|
-
html: censorHTMLtree(el),
|
|
476
|
-
});
|
|
477
|
-
}
|
|
337
|
+
this._routeViewDriverStream = (0, _setupRouteViewDriverStream.default)(this);
|
|
338
|
+
this._routeViewDriverStream.takeUntilBy(this._stopper).onValue(routeViewDriver => {
|
|
339
|
+
this._currentRouteViewDriver = routeViewDriver;
|
|
340
|
+
});
|
|
341
|
+
this._rowListViewDriverStream = _kefir.default.never();
|
|
342
|
+
_kefir.default.later(30 * 1000).takeUntilBy((0, _toItemWithLifetimeStream.default)(this._page.tree.getAllByTag('appToolbarLocation'))).onValue(() => {
|
|
343
|
+
this._logger.errorSite(new Error('Failed to find appToolbarLocation'));
|
|
344
|
+
});
|
|
345
|
+
(0, _toValueObservable.default)(this._page.tree.getAllByTag('searchBar')).subscribe(_ref => {
|
|
346
|
+
let {
|
|
347
|
+
value: node
|
|
348
|
+
} = _ref;
|
|
349
|
+
const el = node.getValue();
|
|
350
|
+
const parsed = (0, _parser7.default)(el);
|
|
351
|
+
if (parsed.errors.length) {
|
|
352
|
+
this._logger.errorSite(new Error('parse errors (searchBar)'), {
|
|
353
|
+
score: parsed.score,
|
|
354
|
+
errors: parsed.errors,
|
|
355
|
+
html: (0, _censorHTMLtree.default)(el)
|
|
356
|
+
});
|
|
478
357
|
}
|
|
479
|
-
);
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
score: parsed.score,
|
|
496
|
-
errors: parsed.errors,
|
|
497
|
-
html: censorHTMLtree(el),
|
|
498
|
-
});
|
|
499
|
-
}
|
|
358
|
+
});
|
|
359
|
+
_kefir.default.later(30 * 1000).takeUntilBy((0, _toItemWithLifetimeStream.default)(this._page.tree.getAllByTag('searchBar'))).onValue(() => {
|
|
360
|
+
this._logger.errorSite(new Error('Failed to find searchBar'));
|
|
361
|
+
});
|
|
362
|
+
(0, _toValueObservable.default)(this._page.tree.getAllByTag('nativeDrawer')).subscribe(_ref2 => {
|
|
363
|
+
let {
|
|
364
|
+
value: node
|
|
365
|
+
} = _ref2;
|
|
366
|
+
const el = node.getValue();
|
|
367
|
+
const parsed = (0, _parser6.default)(el);
|
|
368
|
+
if (parsed.errors.length) {
|
|
369
|
+
this._logger.errorSite(new Error('parse errors (nativeDrawer)'), {
|
|
370
|
+
score: parsed.score,
|
|
371
|
+
errors: parsed.errors,
|
|
372
|
+
html: (0, _censorHTMLtree.default)(el)
|
|
373
|
+
});
|
|
500
374
|
}
|
|
501
|
-
);
|
|
375
|
+
});
|
|
502
376
|
|
|
503
377
|
// When a user goes from one thread to another, a new thread view is made
|
|
504
378
|
// but the old thread view doesn't get destroyed until it finishes
|
|
505
379
|
// animating out. We need to clear the old thread view's sidebar
|
|
506
380
|
// immediately when a new thread view comes in.
|
|
507
381
|
let _currentThreadView = null;
|
|
508
|
-
this._threadViewDriverLiveSet.subscribe(
|
|
509
|
-
changes.forEach(
|
|
382
|
+
this._threadViewDriverLiveSet.subscribe(changes => {
|
|
383
|
+
changes.forEach(change => {
|
|
510
384
|
if (change.type === 'add') {
|
|
511
385
|
const threadView = change.value;
|
|
512
386
|
if (_currentThreadView) {
|
|
@@ -516,52 +390,38 @@ class InboxDriver {
|
|
|
516
390
|
}
|
|
517
391
|
});
|
|
518
392
|
});
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
(
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
)
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
(inboxThreadView, removal) => {
|
|
535
|
-
const el = inboxThreadView.getToolbarElement();
|
|
536
|
-
const view = new InboxToolbarView(el, this, inboxThreadView);
|
|
537
|
-
removal.then(() => {
|
|
538
|
-
view.destroy();
|
|
539
|
-
});
|
|
540
|
-
return view;
|
|
541
|
-
}
|
|
542
|
-
),
|
|
543
|
-
]);
|
|
393
|
+
this._toolbarViewDriverLiveSet = (0, _merge.default)([(0, _mapWithRemoval.default)(this._page.tree.getAllByTag('listToolBar'), (node, removal) => {
|
|
394
|
+
const el = node.getValue();
|
|
395
|
+
const view = new _InboxToolbarView.default(el, this, null);
|
|
396
|
+
removal.then(() => {
|
|
397
|
+
view.destroy();
|
|
398
|
+
});
|
|
399
|
+
return view;
|
|
400
|
+
}), (0, _mapWithRemoval.default)(this._threadViewDriverLiveSet, (inboxThreadView, removal) => {
|
|
401
|
+
const el = inboxThreadView.getToolbarElement();
|
|
402
|
+
const view = new _InboxToolbarView.default(el, this, inboxThreadView);
|
|
403
|
+
removal.then(() => {
|
|
404
|
+
view.destroy();
|
|
405
|
+
});
|
|
406
|
+
return view;
|
|
407
|
+
})]);
|
|
544
408
|
}
|
|
545
|
-
|
|
546
409
|
_setupThreadIdStats() {
|
|
547
410
|
this._resetThreadIdStats();
|
|
548
|
-
|
|
549
411
|
setInterval(() => {
|
|
550
412
|
if (this._threadIdStats.threadRows.totalCalls === 0) return;
|
|
551
|
-
|
|
552
|
-
|
|
413
|
+
const {
|
|
414
|
+
threadRows
|
|
415
|
+
} = this._threadIdStats;
|
|
553
416
|
const stats = {};
|
|
554
417
|
stats.threadRows = Object.assign({}, threadRows, {
|
|
555
418
|
totalThreads: threadRows.totalThreads.size,
|
|
556
|
-
threadsWithoutGmailId: threadRows.threadsWithoutGmailId.size
|
|
419
|
+
threadsWithoutGmailId: threadRows.threadsWithoutGmailId.size
|
|
557
420
|
});
|
|
558
|
-
|
|
559
421
|
this._logger.eventSdkPassive('inboxThreadIdStats', stats);
|
|
560
|
-
|
|
561
422
|
this._resetThreadIdStats();
|
|
562
423
|
}, 1000 * 60 * 60);
|
|
563
424
|
}
|
|
564
|
-
|
|
565
425
|
_resetThreadIdStats() {
|
|
566
426
|
this._threadIdStats = {
|
|
567
427
|
threadRows: {
|
|
@@ -569,35 +429,31 @@ class InboxDriver {
|
|
|
569
429
|
totalCalls: 0,
|
|
570
430
|
threadsWithoutGmailId: new Set(),
|
|
571
431
|
callsWithoutGmailId: 0,
|
|
572
|
-
threadsWithFetch: 0
|
|
573
|
-
}
|
|
432
|
+
threadsWithFetch: 0
|
|
433
|
+
}
|
|
574
434
|
};
|
|
575
435
|
}
|
|
576
|
-
|
|
577
|
-
trackThreadRowIdCall(hasGmailId: boolean, inboxThreadId: string) {
|
|
436
|
+
trackThreadRowIdCall(hasGmailId, inboxThreadId) {
|
|
578
437
|
this._threadIdStats.threadRows.totalCalls += 1;
|
|
579
438
|
this._threadIdStats.threadRows.totalThreads.add(inboxThreadId);
|
|
580
|
-
|
|
581
439
|
if (!hasGmailId) {
|
|
582
440
|
this._threadIdStats.threadRows.callsWithoutGmailId += 1;
|
|
583
441
|
this._threadIdStats.threadRows.threadsWithoutGmailId.add(inboxThreadId);
|
|
584
442
|
}
|
|
585
443
|
}
|
|
586
|
-
|
|
587
444
|
destroy() {
|
|
588
445
|
this._stopper.destroy();
|
|
589
446
|
}
|
|
590
|
-
|
|
591
447
|
getAppId() {
|
|
592
448
|
return this._appId;
|
|
593
449
|
}
|
|
594
|
-
getOpts()
|
|
450
|
+
getOpts() {
|
|
595
451
|
return this._opts;
|
|
596
452
|
}
|
|
597
|
-
getLogger()
|
|
453
|
+
getLogger() {
|
|
598
454
|
return this._logger;
|
|
599
455
|
}
|
|
600
|
-
getStopper()
|
|
456
|
+
getStopper() {
|
|
601
457
|
return this._stopper;
|
|
602
458
|
}
|
|
603
459
|
getRouteViewDriverStream() {
|
|
@@ -607,437 +463,321 @@ class InboxDriver {
|
|
|
607
463
|
return this._currentRouteViewDriver;
|
|
608
464
|
}
|
|
609
465
|
getRowListViewDriverStream() {
|
|
610
|
-
return
|
|
466
|
+
return _kefir.default.never();
|
|
611
467
|
}
|
|
612
468
|
getComposeViewDriverLiveSet() {
|
|
613
469
|
return this._composeViewDriverLiveSet;
|
|
614
470
|
}
|
|
615
471
|
getComposeViewDriverStream() {
|
|
616
|
-
return
|
|
617
|
-
|
|
618
|
-
|
|
472
|
+
return (0, _toItemWithLifetimeStream.default)(this._composeViewDriverLiveSet).map(_ref3 => {
|
|
473
|
+
let {
|
|
474
|
+
el
|
|
475
|
+
} = _ref3;
|
|
476
|
+
return el;
|
|
477
|
+
});
|
|
619
478
|
}
|
|
620
479
|
getThreadRowViewDriverLiveSet() {
|
|
621
480
|
return this._threadRowViewDriverLiveSet;
|
|
622
481
|
}
|
|
623
482
|
getThreadRowViewDriverStream() {
|
|
624
|
-
return
|
|
625
|
-
|
|
626
|
-
|
|
483
|
+
return (0, _toItemWithLifetimeStream.default)(this._threadRowViewDriverLiveSet).map(_ref4 => {
|
|
484
|
+
let {
|
|
485
|
+
el
|
|
486
|
+
} = _ref4;
|
|
487
|
+
return el;
|
|
488
|
+
});
|
|
627
489
|
}
|
|
628
490
|
getThreadViewDriverStream() {
|
|
629
|
-
return
|
|
630
|
-
|
|
631
|
-
|
|
491
|
+
return (0, _toItemWithLifetimeStream.default)(this._threadViewDriverLiveSet).map(_ref5 => {
|
|
492
|
+
let {
|
|
493
|
+
el
|
|
494
|
+
} = _ref5;
|
|
495
|
+
return el;
|
|
496
|
+
});
|
|
632
497
|
}
|
|
633
498
|
getMessageViewDriverStream() {
|
|
634
|
-
return
|
|
635
|
-
|
|
636
|
-
|
|
499
|
+
return (0, _toItemWithLifetimeStream.default)(this._messageViewDriverLiveSet).map(_ref6 => {
|
|
500
|
+
let {
|
|
501
|
+
el
|
|
502
|
+
} = _ref6;
|
|
503
|
+
return el;
|
|
504
|
+
});
|
|
637
505
|
}
|
|
638
506
|
getAttachmentCardViewDriverStream() {
|
|
639
|
-
return
|
|
640
|
-
|
|
641
|
-
|
|
507
|
+
return (0, _toItemWithLifetimeStream.default)(this._attachmentCardViewDriverLiveSet).map(_ref7 => {
|
|
508
|
+
let {
|
|
509
|
+
el
|
|
510
|
+
} = _ref7;
|
|
511
|
+
return el;
|
|
512
|
+
});
|
|
642
513
|
}
|
|
643
|
-
getButterBarDriver()
|
|
514
|
+
getButterBarDriver() {
|
|
644
515
|
return this._butterBarDriver;
|
|
645
516
|
}
|
|
646
|
-
getButterBar()
|
|
517
|
+
getButterBar() {
|
|
647
518
|
return this._butterBar;
|
|
648
519
|
}
|
|
649
|
-
setButterBar(bb
|
|
520
|
+
setButterBar(bb) {
|
|
650
521
|
this._butterBar = bb;
|
|
651
522
|
}
|
|
652
|
-
getPageCommunicator()
|
|
523
|
+
getPageCommunicator() {
|
|
653
524
|
return this._pageCommunicator;
|
|
654
525
|
}
|
|
655
|
-
|
|
656
526
|
getThreadViewElementsMap() {
|
|
657
527
|
return this._threadViewElements;
|
|
658
528
|
}
|
|
659
529
|
getMessageViewElementsMap() {
|
|
660
530
|
return this._messageViewElements;
|
|
661
531
|
}
|
|
662
|
-
|
|
663
|
-
getTagTree(): TagTree<HTMLElement> {
|
|
532
|
+
getTagTree() {
|
|
664
533
|
return this._page.tree;
|
|
665
534
|
}
|
|
666
|
-
|
|
667
|
-
getCustomRouteIDs(): Set<string> {
|
|
535
|
+
getCustomRouteIDs() {
|
|
668
536
|
return this._customRouteIDs;
|
|
669
537
|
}
|
|
670
|
-
|
|
671
|
-
getCurrentChatSidebarView(): InboxChatSidebarView {
|
|
538
|
+
getCurrentChatSidebarView() {
|
|
672
539
|
const view = Array.from(this._chatSidebarViewLiveSet.values())[0];
|
|
673
540
|
if (!view) throw new Error('No chat sidebar found');
|
|
674
541
|
return view;
|
|
675
542
|
}
|
|
676
|
-
|
|
677
|
-
getAppSidebarView(): InboxAppSidebarView {
|
|
543
|
+
getAppSidebarView() {
|
|
678
544
|
if (!this._appSidebarView) {
|
|
679
|
-
this._appSidebarView = new
|
|
545
|
+
this._appSidebarView = new _inboxAppSidebarView.default(this);
|
|
680
546
|
}
|
|
681
547
|
return this._appSidebarView;
|
|
682
548
|
}
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
const
|
|
686
|
-
this._page.tree.getAllByTag('appToolbarLocation').values()
|
|
687
|
-
)[0];
|
|
688
|
-
const parsed = appToolbarLocationNode
|
|
689
|
-
? appToolbarLocationParser(appToolbarLocationNode.getValue())
|
|
690
|
-
: null;
|
|
549
|
+
getChatSidebarButton() {
|
|
550
|
+
const appToolbarLocationNode = Array.from(this._page.tree.getAllByTag('appToolbarLocation').values())[0];
|
|
551
|
+
const parsed = appToolbarLocationNode ? (0, _parser9.default)(appToolbarLocationNode.getValue()) : null;
|
|
691
552
|
const el = parsed ? parsed.elements.chatSidebarButton : null;
|
|
692
553
|
if (!el) throw new Error('No chat sidebar button found');
|
|
693
554
|
return el;
|
|
694
555
|
}
|
|
695
|
-
|
|
696
556
|
getLastInteractedAttachmentCardView() {
|
|
697
557
|
return this._lastInteractedAttachmentCardView;
|
|
698
558
|
}
|
|
699
|
-
setLastInteractedAttachmentCardView(card
|
|
559
|
+
setLastInteractedAttachmentCardView(card) {
|
|
700
560
|
this._lastInteractedAttachmentCardViewSet.emit();
|
|
701
561
|
this._lastInteractedAttachmentCardView = card;
|
|
702
562
|
if (card) {
|
|
703
|
-
card
|
|
704
|
-
.
|
|
705
|
-
|
|
706
|
-
.take(1)
|
|
707
|
-
.takeUntilBy(this._lastInteractedAttachmentCardViewSet)
|
|
708
|
-
.takeUntilBy(this._stopper)
|
|
709
|
-
.onValue(() => {
|
|
710
|
-
this._lastInteractedAttachmentCardView = null;
|
|
711
|
-
});
|
|
563
|
+
card.getStopper().merge((0, _fromEventTargetCapture.default)(document.body, 'click')).take(1).takeUntilBy(this._lastInteractedAttachmentCardViewSet).takeUntilBy(this._stopper).onValue(() => {
|
|
564
|
+
this._lastInteractedAttachmentCardView = null;
|
|
565
|
+
});
|
|
712
566
|
}
|
|
713
567
|
}
|
|
714
|
-
|
|
715
|
-
openNewComposeViewDriver(): Promise<InboxComposeView> {
|
|
568
|
+
openNewComposeViewDriver() {
|
|
716
569
|
const composeViewDriverPromise = this.getNextComposeViewDriver();
|
|
717
|
-
const fabButton =
|
|
718
|
-
(document.body: any),
|
|
719
|
-
'nav[role=banner] ~ div[aria-expanded] button:not([tabindex="-1"])'
|
|
720
|
-
);
|
|
570
|
+
const fabButton = (0, _querySelectorOne.default)(document.body, 'nav[role=banner] ~ div[aria-expanded] button:not([tabindex="-1"])');
|
|
721
571
|
fabButton.click();
|
|
722
572
|
return composeViewDriverPromise;
|
|
723
573
|
}
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
): Promise<InboxComposeView> {
|
|
728
|
-
const s = Kefir.stream((em) => {
|
|
574
|
+
getNextComposeViewDriver() {
|
|
575
|
+
let timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10 * 1000;
|
|
576
|
+
const s = _kefir.default.stream(em => {
|
|
729
577
|
const subscription = this._composeViewDriverLiveSet.subscribe({
|
|
730
|
-
next:
|
|
731
|
-
const newComposeChange = changes.filter(
|
|
732
|
-
(change) => change.type === 'add'
|
|
733
|
-
)[0];
|
|
578
|
+
next: changes => {
|
|
579
|
+
const newComposeChange = changes.filter(change => change.type === 'add')[0];
|
|
734
580
|
if (newComposeChange) {
|
|
735
581
|
// make flow happy
|
|
736
|
-
if (newComposeChange.type !== 'add')
|
|
737
|
-
throw new Error('should not happen');
|
|
738
|
-
|
|
582
|
+
if (newComposeChange.type !== 'add') throw new Error('should not happen');
|
|
739
583
|
em.value(newComposeChange.value);
|
|
740
584
|
}
|
|
741
585
|
},
|
|
742
|
-
complete: em.end
|
|
586
|
+
complete: em.end
|
|
743
587
|
});
|
|
744
588
|
return () => subscription.unsubscribe();
|
|
745
589
|
});
|
|
746
|
-
|
|
747
|
-
return s
|
|
748
|
-
.merge(
|
|
749
|
-
Kefir.later(
|
|
750
|
-
timeout,
|
|
751
|
-
new Error(
|
|
752
|
-
'Reached timeout while waiting for getNextComposeViewDriver'
|
|
753
|
-
)
|
|
754
|
-
)
|
|
755
|
-
)
|
|
756
|
-
.beforeEnd(
|
|
757
|
-
() => new Error('Driver was shut down before a new compose was found')
|
|
758
|
-
)
|
|
759
|
-
.flatMap((x) =>
|
|
760
|
-
x instanceof Error ? Kefir.constantError(x) : Kefir.constant(x)
|
|
761
|
-
)
|
|
762
|
-
.take(1)
|
|
763
|
-
.takeErrors(1)
|
|
764
|
-
.toPromise();
|
|
590
|
+
return s.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();
|
|
765
591
|
}
|
|
766
|
-
|
|
767
|
-
activateShortcut(
|
|
768
|
-
keyboardShortcutHandle: KeyboardShortcutHandle,
|
|
769
|
-
appName: ?string,
|
|
770
|
-
appIconUrl: ?string
|
|
771
|
-
): void {
|
|
592
|
+
activateShortcut(keyboardShortcutHandle, appName, appIconUrl) {
|
|
772
593
|
// eslint-disable-next-line no-console
|
|
773
594
|
console.warn('activateShortcut not implemented');
|
|
774
595
|
}
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
const response = await gmailAjax({
|
|
778
|
-
url: `https://mail.google.com/mail${getAccountUrlPart()}/`,
|
|
779
|
-
xhrFields: {
|
|
780
|
-
withCredentials: true,
|
|
781
|
-
},
|
|
782
|
-
canRetry: true,
|
|
783
|
-
});
|
|
784
|
-
const tokenVarMatch = response.text.match(/var GM_ACTION_TOKEN=("[^"]+")/);
|
|
785
|
-
if (!tokenVarMatch) {
|
|
786
|
-
throw new Error('Could not find GM_ACTION_TOKEN');
|
|
787
|
-
}
|
|
788
|
-
return JSON.parse(tokenVarMatch[1]);
|
|
789
|
-
});
|
|
790
|
-
|
|
791
|
-
getUserEmailAddress(): string {
|
|
792
|
-
const s = (document.head: any).getAttribute(
|
|
793
|
-
'data-inboxsdk-user-email-address'
|
|
794
|
-
);
|
|
596
|
+
getUserEmailAddress() {
|
|
597
|
+
const s = document.head.getAttribute('data-inboxsdk-user-email-address');
|
|
795
598
|
if (s == null) throw new Error('should not happen');
|
|
796
599
|
return s;
|
|
797
600
|
}
|
|
798
|
-
|
|
799
|
-
isConversationViewDisabled(): Promise<boolean> {
|
|
601
|
+
isConversationViewDisabled() {
|
|
800
602
|
return Promise.resolve(false);
|
|
801
603
|
}
|
|
802
|
-
|
|
803
|
-
getUserLanguage(): string {
|
|
604
|
+
getUserLanguage() {
|
|
804
605
|
return this._pageCommunicator.getUserLanguage();
|
|
805
606
|
}
|
|
806
|
-
|
|
807
|
-
getUserContact(): Contact {
|
|
607
|
+
getUserContact() {
|
|
808
608
|
return {
|
|
809
609
|
emailAddress: this.getUserEmailAddress(),
|
|
810
|
-
name: this.getUserEmailAddress()
|
|
610
|
+
name: this.getUserEmailAddress()
|
|
811
611
|
};
|
|
812
612
|
}
|
|
813
|
-
|
|
814
|
-
getAccountSwitcherContactList(): Contact[] {
|
|
613
|
+
getAccountSwitcherContactList() {
|
|
815
614
|
// eslint-disable-next-line no-console
|
|
816
615
|
console.log('getAccountSwitcherContactList not implemented');
|
|
817
616
|
return [this.getUserContact()];
|
|
818
617
|
}
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
const
|
|
822
|
-
|
|
823
|
-
const removeButtonOnUnregister = (button) => {
|
|
618
|
+
registerThreadButton(options) {
|
|
619
|
+
const unregister = (0, _kefirStopper.default)();
|
|
620
|
+
const removeButtonOnUnregister = button => {
|
|
824
621
|
unregister.takeUntilBy(button.getStopper()).onValue(() => {
|
|
825
622
|
button.destroy();
|
|
826
623
|
});
|
|
827
624
|
};
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
625
|
+
const toolbarViewSub = (0, _toValueObservable.default)(this._toolbarViewDriverLiveSet).subscribe(_ref8 => {
|
|
626
|
+
let {
|
|
627
|
+
value: inboxToolbarView
|
|
628
|
+
} = _ref8;
|
|
832
629
|
if (inboxToolbarView.isForThread()) {
|
|
833
|
-
if (!options.positions ||
|
|
630
|
+
if (!options.positions || (0, _includes.default)(options.positions, 'THREAD')) {
|
|
834
631
|
if (options.threadSection === 'OTHER') {
|
|
835
632
|
// eslint-disable-next-line no-console
|
|
836
|
-
console.warn(
|
|
837
|
-
'registerThreadButton does not support OTHER section items in Inbox yet.'
|
|
838
|
-
);
|
|
633
|
+
console.warn('registerThreadButton does not support OTHER section items in Inbox yet.');
|
|
839
634
|
return;
|
|
840
635
|
}
|
|
841
|
-
removeButtonOnUnregister(
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
onClick
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
});
|
|
853
|
-
},
|
|
854
|
-
})
|
|
855
|
-
);
|
|
636
|
+
removeButtonOnUnregister(inboxToolbarView.addButton({
|
|
637
|
+
...options,
|
|
638
|
+
onClick: event => {
|
|
639
|
+
options.onClick({
|
|
640
|
+
position: 'THREAD',
|
|
641
|
+
dropdown: event.dropdown,
|
|
642
|
+
selectedThreadViewDrivers: [inboxToolbarView.getThreadViewDriver()],
|
|
643
|
+
selectedThreadRowViewDrivers: []
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
}));
|
|
856
647
|
}
|
|
857
648
|
} else if (inboxToolbarView.isForRowList()) {
|
|
858
|
-
if (!options.positions ||
|
|
649
|
+
if (!options.positions || (0, _includes.default)(options.positions, 'LIST')) {
|
|
859
650
|
if (options.listSection === 'OTHER') {
|
|
860
651
|
// eslint-disable-next-line no-console
|
|
861
|
-
console.warn(
|
|
862
|
-
'registerThreadButton does not support OTHER section items in Inbox yet.'
|
|
863
|
-
);
|
|
652
|
+
console.warn('registerThreadButton does not support OTHER section items in Inbox yet.');
|
|
864
653
|
return;
|
|
865
654
|
}
|
|
866
|
-
removeButtonOnUnregister(
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
onClick
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
},
|
|
878
|
-
})
|
|
879
|
-
);
|
|
655
|
+
removeButtonOnUnregister(inboxToolbarView.addButton({
|
|
656
|
+
...options,
|
|
657
|
+
onClick: event => {
|
|
658
|
+
options.onClick({
|
|
659
|
+
position: 'LIST',
|
|
660
|
+
dropdown: event.dropdown,
|
|
661
|
+
selectedThreadViewDrivers: [],
|
|
662
|
+
selectedThreadRowViewDrivers: this.getSelectedThreadRowViewDrivers()
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
}));
|
|
880
666
|
}
|
|
881
667
|
}
|
|
882
668
|
});
|
|
883
669
|
unregister.onValue(() => {
|
|
884
670
|
toolbarViewSub.unsubscribe();
|
|
885
671
|
});
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
(
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
})
|
|
904
|
-
);
|
|
905
|
-
}
|
|
906
|
-
);
|
|
672
|
+
if (!options.positions || (0, _includes.default)(options.positions, 'ROW')) {
|
|
673
|
+
const threadRowViewSub = (0, _toValueObservable.default)(this._threadRowViewDriverLiveSet).subscribe(_ref9 => {
|
|
674
|
+
let {
|
|
675
|
+
value: inboxThreadRowView
|
|
676
|
+
} = _ref9;
|
|
677
|
+
removeButtonOnUnregister(inboxThreadRowView.addToolbarButton({
|
|
678
|
+
...options,
|
|
679
|
+
onClick: event => {
|
|
680
|
+
options.onClick({
|
|
681
|
+
position: 'ROW',
|
|
682
|
+
dropdown: event.dropdown,
|
|
683
|
+
selectedThreadViewDrivers: [],
|
|
684
|
+
selectedThreadRowViewDrivers: [inboxThreadRowView]
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
}));
|
|
688
|
+
});
|
|
907
689
|
unregister.onValue(() => {
|
|
908
690
|
threadRowViewSub.unsubscribe();
|
|
909
691
|
});
|
|
910
692
|
}
|
|
911
|
-
|
|
912
693
|
return () => {
|
|
913
694
|
unregister.destroy();
|
|
914
695
|
};
|
|
915
696
|
}
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
return Array.from(this.getThreadRowViewDriverLiveSet().values()).filter(
|
|
919
|
-
(threadRowViewDriver) => threadRowViewDriver.isSelected()
|
|
920
|
-
);
|
|
697
|
+
getSelectedThreadRowViewDrivers() {
|
|
698
|
+
return Array.from(this.getThreadRowViewDriverLiveSet().values()).filter(threadRowViewDriver => threadRowViewDriver.isSelected());
|
|
921
699
|
}
|
|
922
|
-
|
|
923
|
-
async addNavItem(
|
|
924
|
-
appId: string,
|
|
925
|
-
navItemDescriptor: Kefir.Observable<Object>
|
|
926
|
-
): Promise<any> {
|
|
700
|
+
async addNavItem(appId, navItemDescriptor) {
|
|
927
701
|
if (!this._navMenuContainer) {
|
|
928
702
|
this._navMenuContainer = document.createElement('div');
|
|
929
703
|
this._navMenuContainer.classList.add('inboxsdk__navItem_appContainer');
|
|
930
704
|
}
|
|
931
|
-
|
|
932
|
-
return addNavItem(
|
|
933
|
-
navItemDescriptor,
|
|
934
|
-
this._page.tree.getAllByTag('leftNav'),
|
|
935
|
-
(this._navMenuContainer: any)
|
|
936
|
-
);
|
|
705
|
+
return (0, _addNavItem.default)(navItemDescriptor, this._page.tree.getAllByTag('leftNav'), this._navMenuContainer);
|
|
937
706
|
}
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
getSentMailNativeNavItem(): Promise<Object> {
|
|
707
|
+
addSupportItem(supportItemDescriptor) {}
|
|
708
|
+
getSentMailNativeNavItem() {
|
|
942
709
|
// stub, never resolve
|
|
943
710
|
// console.log('getSentMailNativeNavItem not implemented');
|
|
944
711
|
return new Promise((resolve, reject) => {});
|
|
945
712
|
}
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
return createLink(this, routeID, params);
|
|
713
|
+
createLink(routeID, params) {
|
|
714
|
+
return (0, _createLink.default)(this, routeID, params);
|
|
949
715
|
}
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
gotoView(this, routeID, params);
|
|
716
|
+
async goto(routeID, params) {
|
|
717
|
+
(0, _gotoView.default)(this, routeID, params);
|
|
953
718
|
}
|
|
954
|
-
|
|
955
|
-
addCustomRouteID(routeID: string): () => void {
|
|
719
|
+
addCustomRouteID(routeID) {
|
|
956
720
|
this._customRouteIDs.add(routeID);
|
|
957
|
-
this._pageCommunicator.registerAllowedHashLinkStartTerm(
|
|
958
|
-
routeID.split('/')[0]
|
|
959
|
-
);
|
|
721
|
+
this._pageCommunicator.registerAllowedHashLinkStartTerm(routeID.split('/')[0]);
|
|
960
722
|
return () => {
|
|
961
723
|
this._customRouteIDs.delete(routeID);
|
|
962
724
|
};
|
|
963
725
|
}
|
|
964
|
-
|
|
965
|
-
addCustomListRouteID(routeID: string, handler: Function): () => void {
|
|
726
|
+
addCustomListRouteID(routeID, handler) {
|
|
966
727
|
// eslint-disable-next-line no-console
|
|
967
728
|
console.log('addCustomListRouteID not implemented');
|
|
968
729
|
return () => {};
|
|
969
730
|
}
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
let customViewBase = document.querySelector(
|
|
973
|
-
'body > .inboxsdk__custom_view'
|
|
974
|
-
);
|
|
731
|
+
showCustomRouteView(el) {
|
|
732
|
+
let customViewBase = document.querySelector('body > .inboxsdk__custom_view');
|
|
975
733
|
if (!customViewBase) {
|
|
976
|
-
const _customViewBase =
|
|
734
|
+
const _customViewBase = customViewBase = document.createElement('div');
|
|
977
735
|
customViewBase.className = 'inboxsdk__custom_view';
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
`
|
|
736
|
+
const {
|
|
737
|
+
chat,
|
|
738
|
+
nav
|
|
739
|
+
} = (0, _getSidebarClassnames.default)();
|
|
740
|
+
(0, _setCss.default)('custom_view_base_margins', `
|
|
984
741
|
.inboxsdk__custom_view.${nav || 'nav_sidebar'} >
|
|
985
|
-
.${
|
|
742
|
+
.${(0, _idMap.default)('custom_view_container')}.${(0, _idMap.default)('custom_view_min_margins')} {
|
|
986
743
|
margin-left: 232px;
|
|
987
744
|
}
|
|
988
745
|
.inboxsdk__custom_view.${chat || 'chat_sidebar'} >
|
|
989
|
-
.${
|
|
746
|
+
.${(0, _idMap.default)('custom_view_container')}.${(0, _idMap.default)('custom_view_min_margins')} {
|
|
990
747
|
margin-right: 232px;
|
|
991
748
|
}
|
|
992
|
-
`
|
|
993
|
-
);
|
|
749
|
+
`);
|
|
994
750
|
|
|
995
751
|
// Mirror the nav and chat sidebar classnames onto the inboxsdk__custom_view
|
|
996
752
|
// element so that if the custom_view_container element also has the centerList
|
|
997
753
|
// classname, then Inbox's margin rules for centerList will apply to it.
|
|
998
|
-
const main =
|
|
999
|
-
|
|
1000
|
-
'body > div[class][id][jsaction][jslog]'
|
|
1001
|
-
);
|
|
1002
|
-
makeMutationObserverChunkedStream(main, {
|
|
754
|
+
const main = (0, _querySelectorOrFail.default)(document, 'body > div[class][id][jsaction][jslog]');
|
|
755
|
+
(0, _makeMutationObserverChunkedStream.default)(main, {
|
|
1003
756
|
attributes: true,
|
|
1004
|
-
attributeFilter: ['class']
|
|
1005
|
-
})
|
|
1006
|
-
.
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
_customViewBase.classList.remove(className);
|
|
1013
|
-
}
|
|
1014
|
-
});
|
|
757
|
+
attributeFilter: ['class']
|
|
758
|
+
}).toProperty(() => null).onValue(() => {
|
|
759
|
+
[chat, nav].filter(Boolean).forEach(className => {
|
|
760
|
+
if (main.classList.contains(className)) {
|
|
761
|
+
_customViewBase.classList.add(className);
|
|
762
|
+
} else {
|
|
763
|
+
_customViewBase.classList.remove(className);
|
|
764
|
+
}
|
|
1015
765
|
});
|
|
1016
|
-
|
|
1017
|
-
|
|
766
|
+
});
|
|
767
|
+
document.body.appendChild(customViewBase);
|
|
1018
768
|
}
|
|
1019
|
-
|
|
1020
769
|
customViewBase.innerHTML = '';
|
|
1021
770
|
customViewBase.appendChild(el);
|
|
1022
771
|
customViewBase.style.display = '';
|
|
1023
|
-
|
|
1024
|
-
((document.body: any): HTMLElement).classList.add(
|
|
1025
|
-
'inboxsdk__custom_view_active'
|
|
1026
|
-
);
|
|
1027
|
-
|
|
772
|
+
document.body.classList.add('inboxsdk__custom_view_active');
|
|
1028
773
|
const main = document.querySelector('[id][jsaction] > div[token][class]');
|
|
1029
774
|
if (main) {
|
|
1030
775
|
main.style.display = 'none';
|
|
1031
776
|
}
|
|
1032
777
|
}
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
'inboxsdk__custom_view_active'
|
|
1037
|
-
);
|
|
1038
|
-
const customViewBase = document.querySelector(
|
|
1039
|
-
'body > .inboxsdk__custom_view'
|
|
1040
|
-
);
|
|
778
|
+
showNativeRouteView() {
|
|
779
|
+
document.body.classList.remove('inboxsdk__custom_view_active');
|
|
780
|
+
const customViewBase = document.querySelector('body > .inboxsdk__custom_view');
|
|
1041
781
|
if (customViewBase) {
|
|
1042
782
|
customViewBase.style.display = 'none';
|
|
1043
783
|
customViewBase.innerHTML = '';
|
|
@@ -1047,46 +787,30 @@ class InboxDriver {
|
|
|
1047
787
|
main.style.display = '';
|
|
1048
788
|
}
|
|
1049
789
|
}
|
|
1050
|
-
|
|
1051
|
-
setShowNativeNavMarker(isNative: boolean) {
|
|
790
|
+
setShowNativeNavMarker(isNative) {
|
|
1052
791
|
// stub
|
|
1053
792
|
}
|
|
1054
|
-
|
|
1055
|
-
setShowNativeAddonSidebar(isNative: boolean) {
|
|
793
|
+
setShowNativeAddonSidebar(isNative) {
|
|
1056
794
|
// stub
|
|
1057
795
|
}
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
registerSearchSuggestionsProvider(this, handler);
|
|
796
|
+
registerSearchSuggestionsProvider(handler) {
|
|
797
|
+
(0, _registerSearchSuggestionsProvider.default)(this, handler);
|
|
1061
798
|
}
|
|
1062
|
-
|
|
1063
|
-
registerSearchQueryRewriter(obj: Object) {
|
|
799
|
+
registerSearchQueryRewriter(obj) {
|
|
1064
800
|
// eslint-disable-next-line no-console
|
|
1065
801
|
console.log('registerSearchQueryRewriter not implemented');
|
|
1066
802
|
}
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
buttonDescriptor: Kefir.Observable<Object>
|
|
1070
|
-
): Promise<InboxAppToolbarButtonView> {
|
|
1071
|
-
const view = new InboxAppToolbarButtonView(
|
|
1072
|
-
buttonDescriptor,
|
|
1073
|
-
this._page.tree.getAllByTag('appToolbarLocation'),
|
|
1074
|
-
this._page.tree.getAllByTag('searchBar')
|
|
1075
|
-
);
|
|
803
|
+
addToolbarButtonForApp(buttonDescriptor) {
|
|
804
|
+
const view = new _inboxAppToolbarButtonView.default(buttonDescriptor, this._page.tree.getAllByTag('appToolbarLocation'), this._page.tree.getAllByTag('searchBar'));
|
|
1076
805
|
return view.waitForReady();
|
|
1077
806
|
}
|
|
1078
|
-
|
|
1079
|
-
addGlobalSidebarContentPanel(
|
|
1080
|
-
buttonDescriptor: Kefir.Observable<Object>
|
|
1081
|
-
): Promise<?Object> {
|
|
807
|
+
addGlobalSidebarContentPanel(buttonDescriptor) {
|
|
1082
808
|
// stub
|
|
1083
809
|
return Promise.resolve(null);
|
|
1084
810
|
}
|
|
1085
|
-
|
|
1086
|
-
isRunningInPageContext(): boolean {
|
|
811
|
+
isRunningInPageContext() {
|
|
1087
812
|
return !!(global.gbar && global.gbar._CONFIG);
|
|
1088
813
|
}
|
|
1089
|
-
|
|
1090
814
|
showAppIdWarning() {
|
|
1091
815
|
const topDiv = document.createElement('div');
|
|
1092
816
|
topDiv.className = 'inboxsdk__appid_warning';
|
|
@@ -1098,67 +822,51 @@ class InboxDriver {
|
|
|
1098
822
|
</div>
|
|
1099
823
|
<a class="inboxsdk__appid_register" target="_blank" href="https://www.inboxsdk.com/register">Register Your App</a>
|
|
1100
824
|
`;
|
|
1101
|
-
|
|
1102
|
-
((document.body: any): HTMLElement).insertBefore(
|
|
1103
|
-
topDiv,
|
|
1104
|
-
((document.body: any): HTMLElement).firstChild
|
|
1105
|
-
);
|
|
1106
|
-
|
|
825
|
+
document.body.insertBefore(topDiv, document.body.firstChild);
|
|
1107
826
|
const closeBtn = topDiv.querySelector('.inboxsdk__close_button');
|
|
1108
827
|
if (!closeBtn) throw new Error('Should not happen');
|
|
1109
|
-
closeBtn.addEventListener('click', function (e
|
|
828
|
+
closeBtn.addEventListener('click', function (e) {
|
|
1110
829
|
topDiv.remove();
|
|
1111
830
|
});
|
|
1112
831
|
}
|
|
1113
|
-
|
|
1114
|
-
openDraftByMessageID(messageID: string): Promise<void> {
|
|
832
|
+
openDraftByMessageID(messageID) {
|
|
1115
833
|
throw new Error('Not implemented');
|
|
1116
834
|
}
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
return new InboxMoleViewDriver(options, this);
|
|
835
|
+
createMoleViewDriver(options) {
|
|
836
|
+
return new _InboxMoleViewDriver.default(options, this);
|
|
1120
837
|
}
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
return new InboxModalView(options);
|
|
838
|
+
createModalViewDriver(options) {
|
|
839
|
+
return new _inboxModalView.default(options);
|
|
1124
840
|
}
|
|
1125
|
-
|
|
1126
|
-
createTopMessageBarDriver(options: Object): Object {
|
|
841
|
+
createTopMessageBarDriver(options) {
|
|
1127
842
|
throw new Error('Not implemented');
|
|
1128
843
|
}
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
const drawerView = new InboxDrawerView(options);
|
|
844
|
+
createDrawerViewDriver(options) {
|
|
845
|
+
const drawerView = new _inboxDrawerView.default(options);
|
|
1132
846
|
// TODO if a native drawer was already open, we should close the native
|
|
1133
847
|
// drawer istead of the new one.
|
|
1134
848
|
|
|
1135
849
|
// If a nativeDrawer is opened while the new SDK drawer is open, then close
|
|
1136
850
|
// the SDK drawer.
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
drawerView.close();
|
|
1143
|
-
break;
|
|
1144
|
-
}
|
|
851
|
+
_kefir.default.fromESObservable(this._page.tree.getAllByTag('nativeDrawer')).takeUntilBy(drawerView.getClosingStream()).onValue(changes => {
|
|
852
|
+
for (let change of changes) {
|
|
853
|
+
if (change.type === 'add') {
|
|
854
|
+
drawerView.close();
|
|
855
|
+
break;
|
|
1145
856
|
}
|
|
1146
|
-
}
|
|
1147
|
-
|
|
857
|
+
}
|
|
858
|
+
});
|
|
1148
859
|
return drawerView;
|
|
1149
860
|
}
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
return new InboxBackdrop(zIndex, target);
|
|
861
|
+
createBackdrop(zIndex, target) {
|
|
862
|
+
return new _inboxBackdrop.default(zIndex, target);
|
|
1153
863
|
}
|
|
1154
|
-
|
|
1155
864
|
closeOpenThread() {
|
|
1156
|
-
|
|
865
|
+
(0, _simulateKey.default)(document.body, 27, 27);
|
|
1157
866
|
}
|
|
1158
|
-
|
|
1159
|
-
registerThreadRowViewSelectionHandler(handler: () => any): () => void {
|
|
867
|
+
registerThreadRowViewSelectionHandler(handler) {
|
|
1160
868
|
return () => {};
|
|
1161
869
|
}
|
|
1162
870
|
}
|
|
1163
|
-
|
|
1164
|
-
|
|
871
|
+
var _default = (0, _ud.defn)(module, InboxDriver);
|
|
872
|
+
exports.default = _default;
|