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