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