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