@inboxsdk/core 1.1.6 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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,641 +1,721 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var _incrementName = _interopRequireDefault(require("../../../../../lib/incrementName"));
|
|
24
|
-
var _querySelectorOrFail = _interopRequireDefault(require("../../../../../lib/dom/querySelectorOrFail"));
|
|
25
|
-
var _makeMutationObserverChunkedStream = _interopRequireDefault(require("../../../../../lib/dom/make-mutation-observer-chunked-stream"));
|
|
26
|
-
var _makeElementChildStream = _interopRequireDefault(require("../../../../../lib/dom/make-element-child-stream"));
|
|
27
|
-
var _simulateMouseEvent = require("../../../../../lib/dom/simulate-mouse-event");
|
|
28
|
-
var _fakeWindowResize = _interopRequireDefault(require("../../../../../lib/fake-window-resize"));
|
|
29
|
-
var _addCompanionThreadIconArea = _interopRequireDefault(require("./add-companion-thread-icon-area"));
|
|
30
|
-
var _addCompanionGlobalIconArea = _interopRequireDefault(require("./add-companion-global-icon-area"));
|
|
31
|
-
var _addToIconArea = _interopRequireDefault(require("./add-to-icon-area"));
|
|
32
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
33
|
-
var _constants = require("../../../../../driver-common/sidebar/constants");
|
|
1
|
+
import findIndex from 'lodash/findIndex';
|
|
2
|
+
import autoHtml from 'auto-html';
|
|
3
|
+
import asap from 'asap';
|
|
4
|
+
import * as Kefir from 'kefir';
|
|
5
|
+
import kefirBus from 'kefir-bus';
|
|
6
|
+
import kefirStopper from 'kefir-stopper';
|
|
7
|
+
import OrderManager from 'order-manager';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import ReactDOM from 'react-dom';
|
|
10
|
+
import AppSidebar from '../../../../../driver-common/sidebar/AppSidebar';
|
|
11
|
+
import GmailElementGetter from '../../../gmail-element-getter';
|
|
12
|
+
import idMap from '../../../../../lib/idMap';
|
|
13
|
+
import incrementName from '../../../../../lib/incrementName';
|
|
14
|
+
import querySelector from '../../../../../lib/dom/querySelectorOrFail';
|
|
15
|
+
import makeMutationObserverChunkedStream from '../../../../../lib/dom/make-mutation-observer-chunked-stream';
|
|
16
|
+
import { simulateClick } from '../../../../../lib/dom/simulate-mouse-event';
|
|
17
|
+
import fakeWindowResize from '../../../../../lib/fake-window-resize';
|
|
18
|
+
import addCompanionThreadIconArea from './add-companion-thread-icon-area';
|
|
19
|
+
import addCompanionGlobalIconArea from './add-companion-global-icon-area';
|
|
20
|
+
import addToIconArea from './add-to-icon-area';
|
|
21
|
+
import cx from 'classnames';
|
|
22
|
+
import { sidebarWaitingPlatformClassName, sidebarWaitingPlatformSelector, } from '../../../../../driver-common/sidebar/constants';
|
|
34
23
|
const ACTIVE_ADD_ON_ICON_SELECTOR = '.aT5-aOt-I-KO';
|
|
35
|
-
const COMPANION_SIDEBAR_CONTENT_CLOSED_SHADOW_CLASS = 'brC-brG-btc';
|
|
36
|
-
|
|
37
|
-
// Only one instance of this Primary is ever created within a page, even if
|
|
24
|
+
const COMPANION_SIDEBAR_CONTENT_CLOSED_SHADOW_CLASS = 'brC-brG-btc'; // Only one instance of this Primary is ever created within a page, even if
|
|
38
25
|
// there are multiple InboxSDK instances and/or extensions. All other InboxSDK
|
|
39
26
|
// instances (including from other extensions) communicate with this Primary
|
|
40
27
|
// through DOM events.
|
|
41
28
|
class GmailAppSidebarPrimary {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
29
|
+
_stopper = kefirStopper();
|
|
30
|
+
// There could be multiple InboxSDK instances (and therefore GmailDrivers)
|
|
31
|
+
// talking to this Primary, so we shouldn't privilege the specific GmailDriver
|
|
32
|
+
// that happened to create the Primary. Only use this GmailDriver for
|
|
33
|
+
// logging-related functionality!
|
|
34
|
+
_driver;
|
|
35
|
+
// This Primary has an identifier used by the DOM events to specify they're
|
|
36
|
+
// talking to this Primary. This leaves us some room for having multiple
|
|
37
|
+
// Primary instances (representing different visual locations in Gmail) or
|
|
38
|
+
// multiple classes that make use of the same DOM events, but we don't make
|
|
39
|
+
// use of that now. Mainly I didn't want to risk baking in the singleton
|
|
40
|
+
// nature too deeply; that always seems to bite me.
|
|
41
|
+
_instanceId = `${Date.now()}-${Math.random()}`;
|
|
42
|
+
_companionSidebarContentContainerEl;
|
|
43
|
+
_instanceIdsToDescriptors = new Map();
|
|
44
|
+
_threadSidebarComponent = null;
|
|
45
|
+
_threadIconArea = null;
|
|
46
|
+
_globalIconArea = null;
|
|
47
|
+
_globalButtonContainers = new Map();
|
|
48
|
+
_threadButtonContainers = new Map();
|
|
49
|
+
_contentContainers = new Map();
|
|
50
|
+
_threadSidebarContainerEl = null;
|
|
51
|
+
_companionSidebarOuterWrapper;
|
|
52
|
+
_currentIds = new Set();
|
|
53
|
+
_orderManager = new OrderManager({
|
|
54
|
+
get() {
|
|
55
|
+
try {
|
|
56
|
+
return JSON.parse(global.localStorage.getItem('inboxsdk__sidebar_ordering') || 'null');
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
console.error('failed to read sidebar order data', err);
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
set(data) {
|
|
63
|
+
try {
|
|
64
|
+
global.localStorage.setItem('inboxsdk__sidebar_ordering', JSON.stringify(data));
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
console.error('failed to set sidebar order data', err);
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
_containerProp;
|
|
72
|
+
_updateHighlightedAppThreadIconBus = kefirBus();
|
|
73
|
+
constructor(driver, companionSidebarContentContainerElement) {
|
|
74
|
+
this._driver = driver;
|
|
75
|
+
this._companionSidebarContentContainerEl =
|
|
76
|
+
companionSidebarContentContainerElement;
|
|
77
|
+
this._setupElement();
|
|
78
|
+
}
|
|
79
|
+
getInstanceId() {
|
|
80
|
+
return this._instanceId;
|
|
81
|
+
}
|
|
82
|
+
// Only use this if a different Primary needs to take over this one's elements.
|
|
83
|
+
// Currently this is only done when hot-reloading in dev. Don't use this when
|
|
84
|
+
// a threadview exits, the sdk.destroy() is called, etc.
|
|
85
|
+
destroy() {
|
|
86
|
+
this._stopper.destroy();
|
|
87
|
+
}
|
|
88
|
+
// This value controls whether the app sidebar should automatically open
|
|
89
|
+
// itself when available when the chat sidebar isn't present. It's only set
|
|
90
|
+
// if the user interacts with the app sidebar button.
|
|
91
|
+
_getShouldGlobalAppSidebarOpen() {
|
|
92
|
+
return (global.localStorage.getItem('inboxsdk__global_app_sidebar_should_open') === 'true');
|
|
93
|
+
}
|
|
94
|
+
_setShouldGlobalAppSidebarOpen(open) {
|
|
63
95
|
try {
|
|
64
|
-
|
|
65
|
-
} catch (err) {
|
|
66
|
-
console.error('failed to read sidebar order data', err);
|
|
96
|
+
global.localStorage.setItem('inboxsdk__global_app_sidebar_should_open', String(open));
|
|
67
97
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
try {
|
|
71
|
-
global.localStorage.setItem('inboxsdk__sidebar_ordering', JSON.stringify(data));
|
|
72
|
-
} catch (err) {
|
|
73
|
-
console.error('failed to set sidebar order data', err);
|
|
98
|
+
catch (err) {
|
|
99
|
+
console.error('error saving', err);
|
|
74
100
|
}
|
|
75
|
-
}
|
|
76
|
-
}));
|
|
77
|
-
(0, _defineProperty2.default)(this, "_updateHighlightedAppThreadIconBus", (0, _kefirBus.default)());
|
|
78
|
-
(0, _defineProperty2.default)(this, "_appSidebarRefSetter", threadSidebarComponent => {
|
|
79
|
-
if (threadSidebarComponent) {
|
|
80
|
-
this._threadSidebarComponent = threadSidebarComponent;
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
(0, _defineProperty2.default)(this, "_closeButton", null);
|
|
84
|
-
this._driver = driver;
|
|
85
|
-
this._companionSidebarContentContainerEl = companionSidebarContentContainerElement;
|
|
86
|
-
this._setupElement();
|
|
87
|
-
}
|
|
88
|
-
getInstanceId() {
|
|
89
|
-
return this._instanceId;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Only use this if a different Primary needs to take over this one's elements.
|
|
93
|
-
// Currently this is only done when hot-reloading in dev. Don't use this when
|
|
94
|
-
// a threadview exits, the sdk.destroy() is called, etc.
|
|
95
|
-
destroy() {
|
|
96
|
-
this._stopper.destroy();
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// This value controls whether the app sidebar should automatically open
|
|
100
|
-
// itself when available when the chat sidebar isn't present. It's only set
|
|
101
|
-
// if the user interacts with the app sidebar button.
|
|
102
|
-
_getShouldGlobalAppSidebarOpen() {
|
|
103
|
-
return global.localStorage.getItem('inboxsdk__global_app_sidebar_should_open') === 'true';
|
|
104
|
-
}
|
|
105
|
-
_setShouldGlobalAppSidebarOpen(open) {
|
|
106
|
-
try {
|
|
107
|
-
global.localStorage.setItem('inboxsdk__global_app_sidebar_should_open', String(open));
|
|
108
|
-
} catch (err) {
|
|
109
|
-
console.error('error saving', err);
|
|
110
101
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return global.localStorage.getItem('inboxsdk__thread_app_sidebar_should_open') !== 'false';
|
|
114
|
-
}
|
|
115
|
-
_setShouldThreadAppSidebarOpen(open) {
|
|
116
|
-
try {
|
|
117
|
-
global.localStorage.setItem('inboxsdk__thread_app_sidebar_should_open', String(open));
|
|
118
|
-
} catch (err) {
|
|
119
|
-
console.error('error saving', err);
|
|
102
|
+
_getShouldThreadAppSidebarOpen() {
|
|
103
|
+
return (global.localStorage.getItem('inboxsdk__thread_app_sidebar_should_open') !== 'false');
|
|
120
104
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
const threadSidebarContainerEl = this._threadSidebarContainerEl = document.createElement('div');
|
|
125
|
-
threadSidebarContainerEl.classList.add('thread_app_sidebar', (0, _idMap.default)('app_sidebar_container'), 'addon_sidebar');
|
|
126
|
-
this._companionSidebarContentContainerEl.insertBefore(threadSidebarContainerEl, this._companionSidebarContentContainerEl.firstElementChild);
|
|
127
|
-
this._containerProp = () => threadSidebarContainerEl;
|
|
128
|
-
|
|
129
|
-
// Kefir flow type def has wrong type for bufferWithTimeOrCount
|
|
130
|
-
this._updateHighlightedAppThreadIconBus.bufferWithTimeOrCount(150, 100).filter(events => events.length > 0).takeUntilBy(this._stopper).onValue(() => {
|
|
131
|
-
// Before touching this code, make sure you understand the meaning of the clientRect
|
|
132
|
-
// values and of scrollTop. In particular, make sure you understand the distinction of
|
|
133
|
-
// absolute (the scroll[Top|Bottom|Height] values) vs relative (the BoundingRect top
|
|
134
|
-
// and bottom values) scroll values.
|
|
135
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect
|
|
136
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTop
|
|
137
|
-
|
|
138
|
-
const containerBoundingBox = threadSidebarContainerEl.getBoundingClientRect();
|
|
139
|
-
const titleBars = Array.from(threadSidebarContainerEl.querySelectorAll(`.${(0, _idMap.default)('app_sidebar_content_panel')}.${(0, _idMap.default)('expanded')} .${(0, _idMap.default)('app_sidebar_content_panel_top_line')}`));
|
|
140
|
-
const absoluteScrollOfViewportTop = threadSidebarContainerEl.scrollTop;
|
|
141
|
-
const absoluteScrollOfViewportMidpoint = absoluteScrollOfViewportTop + containerBoundingBox.height / 2;
|
|
142
|
-
let titleBar = titleBars.find(t => {
|
|
143
|
-
const tBoundingBox = t.getBoundingClientRect();
|
|
144
|
-
const relativeScrollOfTitleBottom = tBoundingBox.bottom;
|
|
145
|
-
const absoluteScrollOfTitleBottom = relativeScrollOfTitleBottom + absoluteScrollOfViewportTop;
|
|
146
|
-
|
|
147
|
-
// Return true for an element that is below the top of the viewport but above its midpoint
|
|
148
|
-
return absoluteScrollOfTitleBottom > absoluteScrollOfViewportTop && absoluteScrollOfTitleBottom < absoluteScrollOfViewportMidpoint;
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
// If titleBar is falsey then there isn't a title element in the top half of the viewport.
|
|
152
|
-
// In this case, find the first title element above the viewport.
|
|
153
|
-
if (!titleBar) {
|
|
154
|
-
// We make the assumption here that ordering of the elements in titleBars matches the
|
|
155
|
-
// ordering of how they appear in the sidebar (i.e. their ordering from top to bottom).
|
|
156
|
-
let lastElementAboveViewPort;
|
|
157
|
-
for (let i = 0; i < titleBars.length; i++) {
|
|
158
|
-
const tElement = titleBars[i];
|
|
159
|
-
const tBoundingBox = tElement.getBoundingClientRect();
|
|
160
|
-
const relativeScrollOfTitleBottom = tBoundingBox.bottom;
|
|
161
|
-
if (relativeScrollOfTitleBottom < 0) {
|
|
162
|
-
lastElementAboveViewPort = tElement;
|
|
163
|
-
} else if (relativeScrollOfTitleBottom > 0) {
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
105
|
+
_setShouldThreadAppSidebarOpen(open) {
|
|
106
|
+
try {
|
|
107
|
+
global.localStorage.setItem('inboxsdk__thread_app_sidebar_should_open', String(open));
|
|
166
108
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
if (titleBar) {
|
|
170
|
-
const instanceId = titleBar.getAttribute('data-instance-id');
|
|
171
|
-
const appName = titleBar.getAttribute('data-app-name');
|
|
172
|
-
if (!appName) return;
|
|
173
|
-
const appButton = this._threadButtonContainers.get(appName);
|
|
174
|
-
if (!appButton || !this._threadIconArea) return;
|
|
175
|
-
const activeButtonContainer = this._threadIconArea.querySelector('.sidebar_button_container_active');
|
|
176
|
-
if (activeButtonContainer) {
|
|
177
|
-
activeButtonContainer.classList.remove('sidebar_button_container_active');
|
|
109
|
+
catch (err) {
|
|
110
|
+
console.error('error saving', err);
|
|
178
111
|
}
|
|
179
|
-
appButton.classList.add('sidebar_button_container_active');
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
//listen for scroll and update active icon if needed
|
|
184
|
-
this._updateHighlightedAppThreadIconBus.plug(_kefir.default.fromEvents(threadSidebarContainerEl, 'scroll').map(() => null));
|
|
185
|
-
|
|
186
|
-
// handle rendering thread sidebar contents
|
|
187
|
-
this._renderThreadSidebar();
|
|
188
|
-
return threadSidebarContainerEl;
|
|
189
|
-
}
|
|
190
|
-
_renderThreadSidebarIfPresent() {
|
|
191
|
-
if (!this._threadSidebarContainerEl) {
|
|
192
|
-
return;
|
|
193
112
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
113
|
+
_createThreadSidebarIfNeeded() {
|
|
114
|
+
if (this._threadSidebarContainerEl)
|
|
115
|
+
return this._threadSidebarContainerEl;
|
|
116
|
+
const threadSidebarContainerEl = (this._threadSidebarContainerEl =
|
|
117
|
+
document.createElement('div'));
|
|
118
|
+
threadSidebarContainerEl.classList.add('thread_app_sidebar', idMap('app_sidebar_container'), 'addon_sidebar');
|
|
119
|
+
this._companionSidebarContentContainerEl.insertBefore(threadSidebarContainerEl, this._companionSidebarContentContainerEl.firstElementChild);
|
|
120
|
+
this._containerProp = () => threadSidebarContainerEl;
|
|
121
|
+
this._updateHighlightedAppThreadIconBus
|
|
122
|
+
.bufferWithTimeOrCount(150, 100)
|
|
123
|
+
.filter((events) => events.length > 0)
|
|
124
|
+
.takeUntilBy(this._stopper)
|
|
125
|
+
.onValue(() => {
|
|
126
|
+
// Before touching this code, make sure you understand the meaning of the clientRect
|
|
127
|
+
// values and of scrollTop. In particular, make sure you understand the distinction of
|
|
128
|
+
// absolute (the scroll[Top|Bottom|Height] values) vs relative (the BoundingRect top
|
|
129
|
+
// and bottom values) scroll values.
|
|
130
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect
|
|
131
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTop
|
|
132
|
+
const containerBoundingBox = threadSidebarContainerEl.getBoundingClientRect();
|
|
133
|
+
const titleBars = Array.from(threadSidebarContainerEl.querySelectorAll(`.${idMap('app_sidebar_content_panel')}.${idMap('expanded')} .${idMap('app_sidebar_content_panel_top_line')}`));
|
|
134
|
+
const absoluteScrollOfViewportTop = threadSidebarContainerEl.scrollTop;
|
|
135
|
+
const absoluteScrollOfViewportMidpoint = absoluteScrollOfViewportTop + containerBoundingBox.height / 2;
|
|
136
|
+
let titleBar = titleBars.find((t) => {
|
|
137
|
+
const tBoundingBox = t.getBoundingClientRect();
|
|
138
|
+
const relativeScrollOfTitleBottom = tBoundingBox.bottom;
|
|
139
|
+
const absoluteScrollOfTitleBottom = relativeScrollOfTitleBottom + absoluteScrollOfViewportTop;
|
|
140
|
+
// Return true for an element that is below the top of the viewport but above its midpoint
|
|
141
|
+
return (absoluteScrollOfTitleBottom > absoluteScrollOfViewportTop &&
|
|
142
|
+
absoluteScrollOfTitleBottom < absoluteScrollOfViewportMidpoint);
|
|
143
|
+
});
|
|
144
|
+
// If titleBar is falsey then there isn't a title element in the top half of the viewport.
|
|
145
|
+
// In this case, find the first title element above the viewport.
|
|
146
|
+
if (!titleBar) {
|
|
147
|
+
// We make the assumption here that ordering of the elements in titleBars matches the
|
|
148
|
+
// ordering of how they appear in the sidebar (i.e. their ordering from top to bottom).
|
|
149
|
+
let lastElementAboveViewPort;
|
|
150
|
+
for (let i = 0; i < titleBars.length; i++) {
|
|
151
|
+
const tElement = titleBars[i];
|
|
152
|
+
const tBoundingBox = tElement.getBoundingClientRect();
|
|
153
|
+
const relativeScrollOfTitleBottom = tBoundingBox.bottom;
|
|
154
|
+
if (relativeScrollOfTitleBottom < 0) {
|
|
155
|
+
lastElementAboveViewPort = tElement;
|
|
156
|
+
}
|
|
157
|
+
else if (relativeScrollOfTitleBottom > 0) {
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
titleBar = lastElementAboveViewPort;
|
|
162
|
+
}
|
|
163
|
+
if (titleBar) {
|
|
164
|
+
const instanceId = titleBar.getAttribute('data-instance-id');
|
|
165
|
+
const appName = titleBar.getAttribute('data-app-name');
|
|
166
|
+
if (!appName)
|
|
167
|
+
return;
|
|
168
|
+
const appButton = this._threadButtonContainers.get(appName);
|
|
169
|
+
if (!appButton || !this._threadIconArea)
|
|
170
|
+
return;
|
|
171
|
+
const activeButtonContainer = this._threadIconArea.querySelector('.sidebar_button_container_active');
|
|
172
|
+
if (activeButtonContainer) {
|
|
173
|
+
activeButtonContainer.classList.remove('sidebar_button_container_active');
|
|
174
|
+
}
|
|
175
|
+
appButton.classList.add('sidebar_button_container_active');
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
//listen for scroll and update active icon if needed
|
|
179
|
+
this._updateHighlightedAppThreadIconBus.plug(Kefir.fromEvents(threadSidebarContainerEl, 'scroll').map(() => null));
|
|
180
|
+
// handle rendering thread sidebar contents
|
|
181
|
+
this._renderThreadSidebar();
|
|
182
|
+
return threadSidebarContainerEl;
|
|
200
183
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
panels: this._orderManager.getOrderedItems().map(x => x.value),
|
|
205
|
-
onMoveEnd: (newList, movedItem, oldIndex, newIndex) => {
|
|
206
|
-
this._orderManager.moveItem(oldIndex, newIndex);
|
|
207
|
-
this._renderThreadSidebar();
|
|
208
|
-
},
|
|
209
|
-
onExpandedToggle: () => {
|
|
210
|
-
this._updateHighlightedAppThreadIconBus.emit(null);
|
|
211
|
-
},
|
|
212
|
-
container: this._containerProp
|
|
213
|
-
}), threadSidebarContainerEl, () => {
|
|
214
|
-
if (!this._threadSidebarComponent) {
|
|
215
|
-
throw new Error('Should not happen');
|
|
184
|
+
_renderThreadSidebarIfPresent() {
|
|
185
|
+
if (!this._threadSidebarContainerEl) {
|
|
186
|
+
return;
|
|
216
187
|
}
|
|
217
|
-
|
|
218
|
-
this._updateHighlightedAppThreadIconBus.emit(null);
|
|
219
|
-
});
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
_getActiveButtonContainer() {
|
|
223
|
-
let activeButtonContainer;
|
|
224
|
-
if (this._globalIconArea) {
|
|
225
|
-
activeButtonContainer = this._globalIconArea.querySelector('.sidebar_button_container_active');
|
|
188
|
+
this._renderThreadSidebar();
|
|
226
189
|
}
|
|
227
|
-
|
|
228
|
-
|
|
190
|
+
_appSidebarRefSetter = (threadSidebarComponent) => {
|
|
191
|
+
if (threadSidebarComponent) {
|
|
192
|
+
this._threadSidebarComponent = threadSidebarComponent;
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
_renderThreadSidebar() {
|
|
196
|
+
const threadSidebarContainerEl = this._threadSidebarContainerEl;
|
|
197
|
+
if (!threadSidebarContainerEl) {
|
|
198
|
+
throw new Error('_renderThreadSidebar should not be called when _threadSidebarContainerEl is unset');
|
|
199
|
+
}
|
|
200
|
+
return new Promise((resolve) => {
|
|
201
|
+
ReactDOM.render(React.createElement(AppSidebar, { ref: this._appSidebarRefSetter, panels: this._orderManager.getOrderedItems().map((x) => x.value), onMoveEnd: (newList, movedItem, oldIndex, newIndex) => {
|
|
202
|
+
this._orderManager.moveItem(oldIndex, newIndex);
|
|
203
|
+
this._renderThreadSidebar();
|
|
204
|
+
}, onExpandedToggle: () => {
|
|
205
|
+
this._updateHighlightedAppThreadIconBus.emit(null);
|
|
206
|
+
}, container: this._containerProp }), threadSidebarContainerEl, () => {
|
|
207
|
+
if (!this._threadSidebarComponent) {
|
|
208
|
+
throw new Error('Should not happen');
|
|
209
|
+
}
|
|
210
|
+
resolve(this._threadSidebarComponent);
|
|
211
|
+
this._updateHighlightedAppThreadIconBus.emit(null);
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
_getActiveButtonContainer() {
|
|
216
|
+
let activeButtonContainer;
|
|
217
|
+
if (this._globalIconArea) {
|
|
218
|
+
activeButtonContainer = this._globalIconArea.querySelector('.sidebar_button_container_active');
|
|
219
|
+
}
|
|
220
|
+
if (!activeButtonContainer && this._threadIconArea) {
|
|
221
|
+
activeButtonContainer = this._threadIconArea.querySelector('.sidebar_button_container_active');
|
|
222
|
+
}
|
|
223
|
+
return activeButtonContainer;
|
|
229
224
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
225
|
+
_closeButton = null;
|
|
226
|
+
_addButton(iconArea, event, isGlobal) {
|
|
227
|
+
// we put adding the content panel icon in the iconArea in an asap so that we
|
|
228
|
+
// get consistent ordering. The ordering of the icons is based on the position of the FIRST
|
|
229
|
+
// panel with that app name. This means we need to wait for all the panels for a particular appName
|
|
230
|
+
// to be added first, and then we can get the correct position
|
|
231
|
+
asap(() => {
|
|
232
|
+
if (!iconArea)
|
|
233
|
+
throw new Error('should not happen');
|
|
234
|
+
const instanceId = event.detail.instanceId;
|
|
235
|
+
const iconUrl = isGlobal && event.detail.iconUrl
|
|
236
|
+
? event.detail.iconUrl
|
|
237
|
+
: event.detail.appIconUrl;
|
|
238
|
+
const appName = event.detail.appName;
|
|
239
|
+
const iconClass = event.detail.iconClass || '';
|
|
240
|
+
// If there's an existing button for the app, then just increment its
|
|
241
|
+
// data-count attribute instead of adding a new button.
|
|
242
|
+
const existingButtonContainer = isGlobal
|
|
243
|
+
? this._globalButtonContainers.get(appName)
|
|
244
|
+
: this._threadButtonContainers.get(appName);
|
|
245
|
+
let buttonContainer;
|
|
246
|
+
if (existingButtonContainer) {
|
|
247
|
+
const currentCount = Number(existingButtonContainer.getAttribute('data-count')) || 1;
|
|
248
|
+
existingButtonContainer.setAttribute('data-count', String(currentCount + 1));
|
|
249
|
+
buttonContainer = existingButtonContainer;
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
buttonContainer = document.createElement('div');
|
|
253
|
+
buttonContainer.className = idMap('sidebar_button_container');
|
|
254
|
+
buttonContainer.setAttribute('data-app-name', appName);
|
|
255
|
+
buttonContainer.innerHTML = autoHtml `
|
|
258
256
|
<button class="inboxsdk__button_icon ${iconClass}" type="button" data-tooltip="${appName}">
|
|
259
257
|
<img class="inboxsdk__button_iconImg" src="${iconUrl}">
|
|
260
258
|
</button>
|
|
261
259
|
<div class="inboxsdk__button_selectedIndicator"></div>
|
|
262
260
|
`;
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
}
|
|
266
|
-
if (isGlobal) {
|
|
267
|
-
this._globalButtonContainers.set(appName, buttonContainer);
|
|
268
|
-
} else {
|
|
269
|
-
this._threadButtonContainers.set(appName, buttonContainer);
|
|
270
|
-
}
|
|
271
|
-
const activate = function () {
|
|
272
|
-
let dontScrollIntoView = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
273
|
-
const activeButtonContainer = _this._getActiveButtonContainer();
|
|
274
|
-
if (activeButtonContainer === buttonContainer) {
|
|
275
|
-
// button was clicked while its panel was open, so close it.
|
|
276
|
-
if (!_this._closeButton) throw new Error();
|
|
277
|
-
_this._closeButton(true);
|
|
278
|
-
} else {
|
|
279
|
-
// button was clicked while its own panel wasn't open, so open it.
|
|
280
|
-
|
|
281
|
-
if (_this._closeButton) {
|
|
282
|
-
_this._closeButton(true);
|
|
283
|
-
}
|
|
284
|
-
if (isGlobal) _this._setShouldGlobalAppSidebarOpen(true);else _this._setShouldThreadAppSidebarOpen(true);
|
|
285
|
-
_this._openSidebarAndActivateButton(buttonContainer, isGlobal);
|
|
286
|
-
if (isGlobal) {
|
|
287
|
-
const contentEl = _this._contentContainers.get(appName);
|
|
288
|
-
if (contentEl) contentEl.style.display = '';
|
|
289
|
-
_this._companionSidebarContentContainerEl.classList.add('companion_global_app_sidebar_visible');
|
|
290
|
-
|
|
291
|
-
// let app listen for activate event
|
|
292
|
-
document.body.dispatchEvent(new CustomEvent('inboxsdkSidebarPanelActivated', {
|
|
293
|
-
bubbles: true,
|
|
294
|
-
cancelable: false,
|
|
295
|
-
detail: {
|
|
296
|
-
instanceId
|
|
261
|
+
if (event.detail.primaryColor) {
|
|
262
|
+
querySelector(buttonContainer, '.inboxsdk__button_selectedIndicator').style.backgroundColor = event.detail.primaryColor;
|
|
297
263
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
264
|
+
if (isGlobal) {
|
|
265
|
+
this._globalButtonContainers.set(appName, buttonContainer);
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
this._threadButtonContainers.set(appName, buttonContainer);
|
|
269
|
+
}
|
|
270
|
+
const activate = (dontScrollIntoView = false) => {
|
|
271
|
+
const activeButtonContainer = this._getActiveButtonContainer();
|
|
272
|
+
if (activeButtonContainer === buttonContainer) {
|
|
273
|
+
// button was clicked while its panel was open, so close it.
|
|
274
|
+
if (!this._closeButton)
|
|
275
|
+
throw new Error();
|
|
276
|
+
this._closeButton(true);
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
// button was clicked while its own panel wasn't open, so open it.
|
|
280
|
+
if (this._closeButton) {
|
|
281
|
+
this._closeButton(true);
|
|
282
|
+
}
|
|
283
|
+
if (isGlobal)
|
|
284
|
+
this._setShouldGlobalAppSidebarOpen(true);
|
|
285
|
+
else
|
|
286
|
+
this._setShouldThreadAppSidebarOpen(true);
|
|
287
|
+
this._openSidebarAndActivateButton(buttonContainer, isGlobal);
|
|
288
|
+
if (isGlobal) {
|
|
289
|
+
const contentEl = this._contentContainers.get(appName);
|
|
290
|
+
if (contentEl)
|
|
291
|
+
contentEl.style.display = '';
|
|
292
|
+
this._companionSidebarContentContainerEl.classList.add('companion_global_app_sidebar_visible');
|
|
293
|
+
// let app listen for activate event
|
|
294
|
+
document.body.dispatchEvent(new CustomEvent('inboxsdkSidebarPanelActivated', {
|
|
295
|
+
bubbles: true,
|
|
296
|
+
cancelable: false,
|
|
297
|
+
detail: {
|
|
298
|
+
instanceId,
|
|
299
|
+
},
|
|
300
|
+
}));
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
const threadSidebarComponent = this._threadSidebarComponent;
|
|
304
|
+
if (!threadSidebarComponent) {
|
|
305
|
+
throw new Error('sidebar not mounted');
|
|
306
|
+
}
|
|
307
|
+
if (!dontScrollIntoView) {
|
|
308
|
+
threadSidebarComponent.openPanel(instanceId);
|
|
309
|
+
threadSidebarComponent.scrollPanelIntoView(instanceId, true);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
this._closeButton = (userClick) => {
|
|
313
|
+
this._closeButton = null;
|
|
314
|
+
const activeButtonContainer = this._getActiveButtonContainer();
|
|
315
|
+
if (!activeButtonContainer) {
|
|
316
|
+
throw new Error('Expected activeButtonContainer');
|
|
317
|
+
}
|
|
318
|
+
this._closeSidebarAndDeactivateButton(activeButtonContainer);
|
|
319
|
+
if (isGlobal) {
|
|
320
|
+
if (userClick)
|
|
321
|
+
this._setShouldGlobalAppSidebarOpen(false);
|
|
322
|
+
const contentEl = this._contentContainers.get(appName);
|
|
323
|
+
if (contentEl) {
|
|
324
|
+
contentEl.style.display = 'none';
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
this._driver
|
|
328
|
+
.getLogger()
|
|
329
|
+
.error(new Error('Unexpected: contentEl not set'));
|
|
330
|
+
}
|
|
331
|
+
document.body.dispatchEvent(new CustomEvent('inboxsdkSidebarPanelDeactivated', {
|
|
332
|
+
bubbles: true,
|
|
333
|
+
cancelable: false,
|
|
334
|
+
detail: {
|
|
335
|
+
instanceId,
|
|
336
|
+
},
|
|
337
|
+
}));
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
if (userClick)
|
|
341
|
+
this._setShouldThreadAppSidebarOpen(false);
|
|
342
|
+
}
|
|
343
|
+
//fake a window resize after closing so gmail fixes any heights that are messed up
|
|
344
|
+
fakeWindowResize();
|
|
345
|
+
};
|
|
346
|
+
//fake a window resize after opening so gmail fixes any heights that are messed up
|
|
347
|
+
fakeWindowResize();
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
querySelector(buttonContainer, 'button').addEventListener('click', (event) => {
|
|
351
|
+
event.stopPropagation();
|
|
352
|
+
activate();
|
|
353
|
+
}, true);
|
|
354
|
+
if (iconArea) {
|
|
355
|
+
addToIconArea(this._orderManager, appName, buttonContainer, iconArea);
|
|
356
|
+
}
|
|
357
|
+
// if we last had an SDK sidebar open then bring up the SDK sidebar when the first
|
|
358
|
+
// panel gets added
|
|
359
|
+
{
|
|
360
|
+
const activeButtonContainer = this._getActiveButtonContainer();
|
|
361
|
+
if (isGlobal) {
|
|
362
|
+
if (this._getShouldGlobalAppSidebarOpen()) {
|
|
363
|
+
const activeButtonContainerPresentAndIsForGlobal = this._globalIconArea &&
|
|
364
|
+
activeButtonContainer &&
|
|
365
|
+
this._globalIconArea.contains(activeButtonContainer);
|
|
366
|
+
if (!activeButtonContainerPresentAndIsForGlobal) {
|
|
367
|
+
activate(true);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
if (this._getShouldThreadAppSidebarOpen()) {
|
|
373
|
+
const activeButtonContainerPresentAndIsForThread = this._threadIconArea &&
|
|
374
|
+
activeButtonContainer &&
|
|
375
|
+
this._threadIconArea.contains(activeButtonContainer);
|
|
376
|
+
if (!activeButtonContainerPresentAndIsForThread) {
|
|
377
|
+
activate(true);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
323
381
|
}
|
|
324
|
-
document.body.dispatchEvent(new CustomEvent('inboxsdkSidebarPanelDeactivated', {
|
|
325
|
-
bubbles: true,
|
|
326
|
-
cancelable: false,
|
|
327
|
-
detail: {
|
|
328
|
-
instanceId
|
|
329
|
-
}
|
|
330
|
-
}));
|
|
331
|
-
} else {
|
|
332
|
-
if (userClick) _this._setShouldThreadAppSidebarOpen(false);
|
|
333
|
-
}
|
|
334
|
-
//fake a window resize after closing so gmail fixes any heights that are messed up
|
|
335
|
-
(0, _fakeWindowResize.default)();
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
//fake a window resize after opening so gmail fixes any heights that are messed up
|
|
339
|
-
(0, _fakeWindowResize.default)();
|
|
340
|
-
}
|
|
341
|
-
};
|
|
342
|
-
(0, _querySelectorOrFail.default)(buttonContainer, 'button').addEventListener('click', event => {
|
|
343
|
-
event.stopPropagation();
|
|
344
|
-
activate();
|
|
345
|
-
}, true);
|
|
346
|
-
if (iconArea) {
|
|
347
|
-
(0, _addToIconArea.default)(this._orderManager, appName, buttonContainer, iconArea);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
// if we last had an SDK sidebar open then bring up the SDK sidebar when the first
|
|
351
|
-
// panel gets added
|
|
352
|
-
{
|
|
353
|
-
const activeButtonContainer = this._getActiveButtonContainer();
|
|
354
|
-
if (isGlobal) {
|
|
355
|
-
if (this._getShouldGlobalAppSidebarOpen()) {
|
|
356
|
-
const activeButtonContainerPresentAndIsForGlobal = this._globalIconArea && activeButtonContainer && this._globalIconArea.contains(activeButtonContainer);
|
|
357
|
-
if (!activeButtonContainerPresentAndIsForGlobal) {
|
|
358
|
-
activate(true);
|
|
359
|
-
}
|
|
360
382
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
_removeButton(event, buttonContainers, iconArea) {
|
|
386
|
+
const appName = event.detail.appName;
|
|
387
|
+
const container = buttonContainers.get(appName);
|
|
388
|
+
if (!iconArea || !container) {
|
|
389
|
+
throw new Error('should not happen: tried to remove button without container or iconArea');
|
|
390
|
+
}
|
|
391
|
+
const currentCount = Number(container.getAttribute('data-count'));
|
|
392
|
+
if (currentCount <= 1) {
|
|
393
|
+
const activeButtonContainer = iconArea.querySelector('.sidebar_button_container_active');
|
|
394
|
+
if (container === activeButtonContainer) {
|
|
395
|
+
if (!this._closeButton)
|
|
396
|
+
throw new Error();
|
|
397
|
+
this._closeButton(false);
|
|
398
|
+
this._companionSidebarOuterWrapper.classList.remove('companion_app_sidebar_wrapper_visible');
|
|
399
|
+
this._companionSidebarContentContainerEl.classList.remove('companion_app_sidebar_visible');
|
|
400
|
+
const contentContainer = this._companionSidebarOuterWrapper.previousElementSibling;
|
|
401
|
+
if (contentContainer)
|
|
402
|
+
contentContainer.classList.remove('companion_container_app_sidebar_visible');
|
|
367
403
|
}
|
|
368
|
-
|
|
404
|
+
container.remove();
|
|
405
|
+
buttonContainers.delete(appName);
|
|
406
|
+
}
|
|
407
|
+
else if (currentCount === 2) {
|
|
408
|
+
container.removeAttribute('data-count');
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
container.setAttribute('data-count', String(currentCount - 1));
|
|
369
412
|
}
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
_removeButton(event, buttonContainers, iconArea) {
|
|
374
|
-
const appName = event.detail.appName;
|
|
375
|
-
const container = buttonContainers.get(appName);
|
|
376
|
-
if (!iconArea || !container) {
|
|
377
|
-
throw new Error('should not happen: tried to remove button without container or iconArea');
|
|
378
413
|
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
const activeButtonContainer = iconArea.querySelector('.sidebar_button_container_active');
|
|
382
|
-
if (container === activeButtonContainer) {
|
|
383
|
-
if (!this._closeButton) throw new Error();
|
|
384
|
-
this._closeButton(false);
|
|
414
|
+
_closeSidebarAndDeactivateButton(activeButtonContainer) {
|
|
415
|
+
activeButtonContainer.classList.remove('sidebar_button_container_active');
|
|
385
416
|
this._companionSidebarOuterWrapper.classList.remove('companion_app_sidebar_wrapper_visible');
|
|
386
|
-
this._companionSidebarContentContainerEl.classList.
|
|
417
|
+
this._companionSidebarContentContainerEl.classList.add(COMPANION_SIDEBAR_CONTENT_CLOSED_SHADOW_CLASS);
|
|
418
|
+
this._companionSidebarContentContainerEl.classList.remove('companion_app_sidebar_visible', 'companion_global_app_sidebar_visible');
|
|
387
419
|
const contentContainer = this._companionSidebarOuterWrapper.previousElementSibling;
|
|
388
|
-
if (contentContainer)
|
|
389
|
-
|
|
390
|
-
container.remove();
|
|
391
|
-
buttonContainers.delete(appName);
|
|
392
|
-
} else if (currentCount === 2) {
|
|
393
|
-
container.removeAttribute('data-count');
|
|
394
|
-
} else {
|
|
395
|
-
container.setAttribute('data-count', String(currentCount - 1));
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
_closeSidebarAndDeactivateButton(activeButtonContainer) {
|
|
399
|
-
activeButtonContainer.classList.remove('sidebar_button_container_active');
|
|
400
|
-
this._companionSidebarOuterWrapper.classList.remove('companion_app_sidebar_wrapper_visible');
|
|
401
|
-
this._companionSidebarContentContainerEl.classList.add(COMPANION_SIDEBAR_CONTENT_CLOSED_SHADOW_CLASS);
|
|
402
|
-
this._companionSidebarContentContainerEl.classList.remove('companion_app_sidebar_visible', 'companion_global_app_sidebar_visible');
|
|
403
|
-
const contentContainer = this._companionSidebarOuterWrapper.previousElementSibling;
|
|
404
|
-
if (contentContainer) contentContainer.classList.remove('companion_container_app_sidebar_visible');
|
|
405
|
-
}
|
|
406
|
-
_openSidebarAndActivateButton(buttonContainer, isGlobal) {
|
|
407
|
-
const companionSidebarIconContainerEl = _gmailElementGetter.default.getCompanionSidebarIconContainerElement();
|
|
408
|
-
if (!companionSidebarIconContainerEl) throw new Error('Could not find companion sidebar icon container element');
|
|
409
|
-
const activeButtonContainer = this._getActiveButtonContainer();
|
|
410
|
-
if (activeButtonContainer) {
|
|
411
|
-
throw new Error('activeButtonContainer should not be true');
|
|
412
|
-
// this._closeSidebarAndDeactivateButton(activeButtonContainer);
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
{
|
|
416
|
-
// If a gmail addon is active, close it.
|
|
417
|
-
const nativeActiveAddOnIcon = companionSidebarIconContainerEl.querySelector(ACTIVE_ADD_ON_ICON_SELECTOR);
|
|
418
|
-
if (nativeActiveAddOnIcon) {
|
|
419
|
-
(0, _simulateMouseEvent.simulateClick)(nativeActiveAddOnIcon);
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
buttonContainer.classList.add('sidebar_button_container_active');
|
|
423
|
-
this._companionSidebarOuterWrapper.classList.add('companion_app_sidebar_wrapper_visible');
|
|
424
|
-
this._companionSidebarContentContainerEl.classList.add('companion_app_sidebar_visible');
|
|
425
|
-
this._companionSidebarContentContainerEl.classList.remove(COMPANION_SIDEBAR_CONTENT_CLOSED_SHADOW_CLASS);
|
|
426
|
-
const contentContainer = this._companionSidebarOuterWrapper.previousElementSibling;
|
|
427
|
-
if (contentContainer) contentContainer.classList.add('companion_container_app_sidebar_visible');
|
|
428
|
-
if (isGlobal) this._companionSidebarContentContainerEl.classList.add('companion_global_app_sidebar_visible');
|
|
429
|
-
}
|
|
430
|
-
_setupElement() {
|
|
431
|
-
const companionSidebarIconContainerEl = _gmailElementGetter.default.getCompanionSidebarIconContainerElement();
|
|
432
|
-
if (!companionSidebarIconContainerEl) throw new Error('Could not find companion sidebar icon container element');
|
|
433
|
-
this._companionSidebarContentContainerEl.setAttribute('data-sdk-sidebar-instance-id', this._instanceId);
|
|
434
|
-
|
|
435
|
-
// TODO: Once the changes to the GMail DOM have been entirely ramped, drop the ternary here and
|
|
436
|
-
// always get the parentElement. (Jun 20, 2018)
|
|
437
|
-
this._companionSidebarOuterWrapper = this._companionSidebarContentContainerEl.classList.contains('bq9') ? this._companionSidebarContentContainerEl : this._companionSidebarContentContainerEl.parentElement;
|
|
438
|
-
if (!this._companionSidebarOuterWrapper) {
|
|
439
|
-
throw new Error('should not happen: failed to find companionSidebarOuterWrapper');
|
|
440
|
-
}
|
|
441
|
-
const contentContainer = this._companionSidebarOuterWrapper.previousElementSibling;
|
|
442
|
-
if (contentContainer) {
|
|
443
|
-
contentContainer.classList.add((0, _idMap.default)('companion_container_app_sidebar_in_use'));
|
|
420
|
+
if (contentContainer)
|
|
421
|
+
contentContainer.classList.remove('companion_container_app_sidebar_visible');
|
|
444
422
|
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
// thread sidebar content panels
|
|
453
|
-
{
|
|
454
|
-
_kefir.default.fromEvents(window, 'storage').filter(e => e.key === 'inboxsdk__sidebar_ordering').takeUntilBy(this._stopper).onValue(() => {
|
|
455
|
-
this._orderManager.reload();
|
|
456
|
-
this._renderThreadSidebarIfPresent();
|
|
457
|
-
});
|
|
458
|
-
_kefir.default.fromEvents(document.body, 'inboxsdkNewSidebarPanel').filter(e => e.detail.sidebarId === this._instanceId && !e.detail.isGlobal).takeUntilBy(this._stopper).onValue(event => {
|
|
459
|
-
this._createThreadSidebarIfNeeded();
|
|
460
|
-
let id = event.detail.id;
|
|
461
|
-
while (this._currentIds.has(id)) {
|
|
462
|
-
id = (0, _incrementName.default)(id);
|
|
423
|
+
_openSidebarAndActivateButton(buttonContainer, isGlobal) {
|
|
424
|
+
const companionSidebarIconContainerEl = GmailElementGetter.getCompanionSidebarIconContainerElement();
|
|
425
|
+
if (!companionSidebarIconContainerEl)
|
|
426
|
+
throw new Error('Could not find companion sidebar icon container element');
|
|
427
|
+
const activeButtonContainer = this._getActiveButtonContainer();
|
|
428
|
+
if (activeButtonContainer) {
|
|
429
|
+
throw new Error('activeButtonContainer should not be true'); // this._closeSidebarAndDeactivateButton(activeButtonContainer);
|
|
463
430
|
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
value: {
|
|
471
|
-
id,
|
|
472
|
-
appName,
|
|
473
|
-
appId: event.detail.appId,
|
|
474
|
-
instanceId: event.detail.instanceId,
|
|
475
|
-
title: event.detail.title,
|
|
476
|
-
iconClass: event.detail.iconClass,
|
|
477
|
-
iconUrl: event.detail.iconUrl,
|
|
478
|
-
hideTitleBar: event.detail.hideTitleBar,
|
|
479
|
-
el: event.target
|
|
480
|
-
}
|
|
481
|
-
});
|
|
482
|
-
this._renderThreadSidebar();
|
|
483
|
-
let threadIconArea = this._threadIconArea = companionSidebarIconContainerEl.querySelector('.sidebar_thread_iconArea');
|
|
484
|
-
if (!threadIconArea) {
|
|
485
|
-
threadIconArea = this._threadIconArea = document.createElement('div');
|
|
486
|
-
threadIconArea.className = (0, _idMap.default)('sidebar_iconArea');
|
|
487
|
-
threadIconArea.classList.add('sidebar_thread_iconArea');
|
|
488
|
-
(0, _addCompanionThreadIconArea.default)(this._driver.getLogger(), threadIconArea, companionSidebarIconContainerEl);
|
|
431
|
+
{
|
|
432
|
+
// If a gmail addon is active, close it.
|
|
433
|
+
const nativeActiveAddOnIcon = companionSidebarIconContainerEl.querySelector(ACTIVE_ADD_ON_ICON_SELECTOR);
|
|
434
|
+
if (nativeActiveAddOnIcon) {
|
|
435
|
+
simulateClick(nativeActiveAddOnIcon);
|
|
436
|
+
}
|
|
489
437
|
}
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
const
|
|
495
|
-
if (
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
appName: event.detail.appName || event.detail.title,
|
|
500
|
-
instanceId: event.detail.instanceId,
|
|
501
|
-
title: event.detail.title,
|
|
502
|
-
iconClass: event.detail.iconClass,
|
|
503
|
-
iconUrl: event.detail.iconUrl,
|
|
504
|
-
hideTitleBar: event.detail.hideTitleBar,
|
|
505
|
-
el: event.target
|
|
506
|
-
});
|
|
507
|
-
this._renderThreadSidebar();
|
|
508
|
-
});
|
|
509
|
-
_kefir.default.fromEvents(document.body, 'inboxsdkRemoveSidebarPanel').filter(e => e.detail.sidebarId === this._instanceId && !e.detail.isGlobal).takeUntilBy(this._stopper).onValue(event => {
|
|
510
|
-
const orderedItems = this._orderManager.getOrderedItems();
|
|
511
|
-
const index = (0, _findIndex.default)(orderedItems, x => x.value.instanceId === event.detail.instanceId);
|
|
512
|
-
if (index === -1) throw new Error('should not happen: failed to find orderItem');
|
|
513
|
-
this._currentIds.delete(orderedItems[index].id);
|
|
514
|
-
this._orderManager.removeItemByIndex(index);
|
|
515
|
-
this._renderThreadSidebar();
|
|
516
|
-
this._removeButton(event, this._threadButtonContainers, this._threadIconArea);
|
|
517
|
-
});
|
|
518
|
-
_kefir.default.fromEvents(document.body, 'inboxsdkSidebarPanelScrollIntoView').filter(e => e.detail.sidebarId === this._instanceId && !e.detail.isGlobal).takeUntilBy(this._stopper).onValue(event => {
|
|
519
|
-
if (this._threadSidebarComponent) this._threadSidebarComponent.scrollPanelIntoView(event.detail.instanceId);
|
|
520
|
-
});
|
|
521
|
-
_kefir.default.fromEvents(document.body, 'inboxsdkSidebarPanelClose').filter(e => e.detail.sidebarId === this._instanceId && !e.detail.isGlobal).takeUntilBy(this._stopper).onValue(event => {
|
|
522
|
-
if (this._threadSidebarComponent) this._threadSidebarComponent.closePanel(event.detail.instanceId);
|
|
523
|
-
});
|
|
524
|
-
_kefir.default.fromEvents(document.body, 'inboxsdkSidebarPanelOpen').filter(e => e.detail.sidebarId === this._instanceId && !e.detail.isGlobal).takeUntilBy(this._stopper).onValue(e => {
|
|
525
|
-
this._renderThreadSidebar().then(threadSidebarComponent => {
|
|
526
|
-
const descriptor = this._instanceIdsToDescriptors.get(e.detail.instanceId);
|
|
527
|
-
if (!descriptor) return;
|
|
528
|
-
const buttonContainer = this._threadButtonContainers.get(descriptor.appName);
|
|
529
|
-
if (!buttonContainer) {
|
|
530
|
-
throw new Error('missing button container');
|
|
531
|
-
}
|
|
532
|
-
const activeButtonContainer = this._getActiveButtonContainer();
|
|
533
|
-
if (activeButtonContainer !== buttonContainer) {
|
|
534
|
-
(0, _querySelectorOrFail.default)(buttonContainer, 'button').click();
|
|
535
|
-
}
|
|
536
|
-
});
|
|
537
|
-
});
|
|
438
|
+
buttonContainer.classList.add('sidebar_button_container_active');
|
|
439
|
+
this._companionSidebarOuterWrapper.classList.add('companion_app_sidebar_wrapper_visible');
|
|
440
|
+
this._companionSidebarContentContainerEl.classList.add('companion_app_sidebar_visible');
|
|
441
|
+
this._companionSidebarContentContainerEl.classList.remove(COMPANION_SIDEBAR_CONTENT_CLOSED_SHADOW_CLASS);
|
|
442
|
+
const contentContainer = this._companionSidebarOuterWrapper.previousElementSibling;
|
|
443
|
+
if (contentContainer)
|
|
444
|
+
contentContainer.classList.add('companion_container_app_sidebar_visible');
|
|
445
|
+
if (isGlobal)
|
|
446
|
+
this._companionSidebarContentContainerEl.classList.add('companion_global_app_sidebar_visible');
|
|
538
447
|
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
448
|
+
_setupElement() {
|
|
449
|
+
const companionSidebarIconContainerEl = GmailElementGetter.getCompanionSidebarIconContainerElement();
|
|
450
|
+
if (!companionSidebarIconContainerEl)
|
|
451
|
+
throw new Error('Could not find companion sidebar icon container element');
|
|
452
|
+
this._companionSidebarContentContainerEl.setAttribute('data-sdk-sidebar-instance-id', this._instanceId);
|
|
453
|
+
// TODO: Once the changes to the GMail DOM have been entirely ramped, drop the ternary here and
|
|
454
|
+
// always get the parentElement. (Jun 20, 2018)
|
|
455
|
+
this._companionSidebarOuterWrapper =
|
|
456
|
+
this._companionSidebarContentContainerEl.classList.contains('bq9')
|
|
457
|
+
? this._companionSidebarContentContainerEl
|
|
458
|
+
: this._companionSidebarContentContainerEl.parentElement;
|
|
459
|
+
if (!this._companionSidebarOuterWrapper) {
|
|
460
|
+
throw new Error('should not happen: failed to find companionSidebarOuterWrapper');
|
|
546
461
|
}
|
|
547
|
-
this.
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
if (!globalIconArea) {
|
|
551
|
-
globalIconArea = this._globalIconArea = document.createElement('div');
|
|
552
|
-
globalIconArea.className = (0, _idMap.default)('sidebar_iconArea');
|
|
553
|
-
globalIconArea.classList.add('sidebar_global_iconArea');
|
|
554
|
-
(0, _addCompanionGlobalIconArea.default)(this._driver.getLogger(), globalIconArea, companionSidebarIconContainerEl);
|
|
462
|
+
const contentContainer = this._companionSidebarOuterWrapper.previousElementSibling;
|
|
463
|
+
if (contentContainer) {
|
|
464
|
+
contentContainer.classList.add(idMap('companion_container_app_sidebar_in_use'));
|
|
555
465
|
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
sdkContentContainerEl.style.display = 'none';
|
|
562
|
-
this._addButton(globalIconArea, event, true);
|
|
563
|
-
});
|
|
564
|
-
_kefir.default.fromEvents(document.body, 'inboxsdkUpdateSidebarPanel').filter(e => e.detail.sidebarId === this._instanceId && e.detail.isGlobal).takeUntilBy(this._stopper).onValue(event => {
|
|
565
|
-
const buttonContainer = this._globalButtonContainers.get(event.detail.appName);
|
|
566
|
-
if (!buttonContainer) return;
|
|
567
|
-
const iconClass = event.detail.iconClass || '';
|
|
568
|
-
const iconUrl = event.detail.iconUrl || event.detail.appIconUrl;
|
|
569
|
-
const imgElement = (0, _querySelectorOrFail.default)(buttonContainer, 'img');
|
|
570
|
-
imgElement.setAttribute('src', iconUrl);
|
|
571
|
-
const button = (0, _querySelectorOrFail.default)(buttonContainer, 'button');
|
|
572
|
-
button.setAttribute('class', `inboxsdk__button_icon ${iconClass}`);
|
|
573
|
-
});
|
|
574
|
-
_kefir.default.fromEvents(document.body, 'inboxsdkRemoveSidebarPanel').filter(e => e.detail.sidebarId === this._instanceId && e.detail.isGlobal).takeUntilBy(this._stopper).onValue(event => {
|
|
575
|
-
this._currentIds.delete(event.detail.id);
|
|
576
|
-
this._removeButton(event, this._globalButtonContainers, this._globalIconArea);
|
|
577
|
-
});
|
|
578
|
-
_kefir.default.fromEvents(document.body, 'inboxsdkSidebarPanelClose').filter(e => e.detail.sidebarId === this._instanceId && e.detail.isGlobal).takeUntilBy(this._stopper).onValue(event => {
|
|
579
|
-
const descriptor = this._instanceIdsToDescriptors.get(event.detail.instanceId);
|
|
580
|
-
if (!descriptor) return;
|
|
581
|
-
const buttonContainer = this._globalButtonContainers.get(descriptor.appName);
|
|
582
|
-
if (!buttonContainer) return;
|
|
583
|
-
const activeButtonContainer = this._getActiveButtonContainer();
|
|
584
|
-
if (activeButtonContainer === buttonContainer) {
|
|
585
|
-
if (!this._closeButton) {
|
|
586
|
-
throw new Error('Expected this._closeButton');
|
|
587
|
-
}
|
|
588
|
-
this._closeButton(true);
|
|
466
|
+
this._companionSidebarContentContainerEl.classList.add(idMap('app_sidebar_in_use'));
|
|
467
|
+
if (!document.body.querySelector(sidebarWaitingPlatformSelector)) {
|
|
468
|
+
const waitingPlatform = document.createElement('div');
|
|
469
|
+
waitingPlatform.className = cx(sidebarWaitingPlatformClassName, idMap('app_sidebar_waiting_platform'));
|
|
470
|
+
document.body.appendChild(waitingPlatform);
|
|
589
471
|
}
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
472
|
+
// thread sidebar content panels
|
|
473
|
+
{
|
|
474
|
+
Kefir.fromEvents(window, 'storage')
|
|
475
|
+
.filter((e) => e.key === 'inboxsdk__sidebar_ordering')
|
|
476
|
+
.takeUntilBy(this._stopper)
|
|
477
|
+
.onValue(() => {
|
|
478
|
+
this._orderManager.reload();
|
|
479
|
+
this._renderThreadSidebarIfPresent();
|
|
480
|
+
});
|
|
481
|
+
Kefir.fromEvents(document.body, 'inboxsdkNewSidebarPanel')
|
|
482
|
+
.filter((e) => e.detail.sidebarId === this._instanceId && !e.detail.isGlobal)
|
|
483
|
+
.takeUntilBy(this._stopper)
|
|
484
|
+
.onValue((event) => {
|
|
485
|
+
this._createThreadSidebarIfNeeded();
|
|
486
|
+
let id = event.detail.id;
|
|
487
|
+
while (this._currentIds.has(id)) {
|
|
488
|
+
id = incrementName(id);
|
|
489
|
+
}
|
|
490
|
+
this._currentIds.add(id);
|
|
491
|
+
const appName = event.detail.appName;
|
|
492
|
+
this._orderManager.addItem({
|
|
493
|
+
groupId: event.detail.appId,
|
|
494
|
+
id,
|
|
495
|
+
orderHint: event.detail.orderHint,
|
|
496
|
+
value: {
|
|
497
|
+
id,
|
|
498
|
+
appName,
|
|
499
|
+
appId: event.detail.appId,
|
|
500
|
+
instanceId: event.detail.instanceId,
|
|
501
|
+
title: event.detail.title,
|
|
502
|
+
iconClass: event.detail.iconClass,
|
|
503
|
+
iconUrl: event.detail.iconUrl,
|
|
504
|
+
hideTitleBar: event.detail.hideTitleBar,
|
|
505
|
+
el: event.target,
|
|
506
|
+
},
|
|
507
|
+
});
|
|
508
|
+
this._renderThreadSidebar();
|
|
509
|
+
let threadIconArea = (this._threadIconArea =
|
|
510
|
+
companionSidebarIconContainerEl.querySelector('.sidebar_thread_iconArea'));
|
|
511
|
+
if (!threadIconArea) {
|
|
512
|
+
threadIconArea = this._threadIconArea =
|
|
513
|
+
document.createElement('div');
|
|
514
|
+
threadIconArea.className = idMap('sidebar_iconArea');
|
|
515
|
+
threadIconArea.classList.add('sidebar_thread_iconArea');
|
|
516
|
+
addCompanionThreadIconArea(this._driver.getLogger(), threadIconArea, companionSidebarIconContainerEl);
|
|
517
|
+
}
|
|
518
|
+
this._addButton(threadIconArea, event, false);
|
|
519
|
+
});
|
|
520
|
+
Kefir.fromEvents(document.body, 'inboxsdkUpdateSidebarPanel')
|
|
521
|
+
.filter((e) => e.detail.sidebarId === this._instanceId && !e.detail.isGlobal)
|
|
522
|
+
.takeUntilBy(this._stopper)
|
|
523
|
+
.onValue((event) => {
|
|
524
|
+
const orderedItems = this._orderManager.getOrderedItems();
|
|
525
|
+
const index = findIndex(orderedItems, (x) => x.value.instanceId === event.detail.instanceId);
|
|
526
|
+
if (index === -1)
|
|
527
|
+
throw new Error('should not happen: failed to find orderItem');
|
|
528
|
+
this._orderManager.updateItemValueByIndex(index, {
|
|
529
|
+
id: orderedItems[index].value.id,
|
|
530
|
+
appId: event.detail.appId,
|
|
531
|
+
appName: event.detail.appName || event.detail.title,
|
|
532
|
+
instanceId: event.detail.instanceId,
|
|
533
|
+
title: event.detail.title,
|
|
534
|
+
iconClass: event.detail.iconClass,
|
|
535
|
+
iconUrl: event.detail.iconUrl,
|
|
536
|
+
hideTitleBar: event.detail.hideTitleBar,
|
|
537
|
+
el: event.target,
|
|
538
|
+
});
|
|
539
|
+
this._renderThreadSidebar();
|
|
540
|
+
});
|
|
541
|
+
Kefir.fromEvents(document.body, 'inboxsdkRemoveSidebarPanel')
|
|
542
|
+
.filter((e) => e.detail.sidebarId === this._instanceId && !e.detail.isGlobal)
|
|
543
|
+
.takeUntilBy(this._stopper)
|
|
544
|
+
.onValue((event) => {
|
|
545
|
+
const orderedItems = this._orderManager.getOrderedItems();
|
|
546
|
+
const index = findIndex(orderedItems, (x) => x.value.instanceId === event.detail.instanceId);
|
|
547
|
+
if (index === -1)
|
|
548
|
+
throw new Error('should not happen: failed to find orderItem');
|
|
549
|
+
this._currentIds.delete(orderedItems[index].id);
|
|
550
|
+
this._orderManager.removeItemByIndex(index);
|
|
551
|
+
this._renderThreadSidebar();
|
|
552
|
+
this._removeButton(event, this._threadButtonContainers, this._threadIconArea);
|
|
553
|
+
});
|
|
554
|
+
Kefir.fromEvents(document.body, 'inboxsdkSidebarPanelScrollIntoView')
|
|
555
|
+
.filter((e) => e.detail.sidebarId === this._instanceId && !e.detail.isGlobal)
|
|
556
|
+
.takeUntilBy(this._stopper)
|
|
557
|
+
.onValue((event) => {
|
|
558
|
+
if (this._threadSidebarComponent)
|
|
559
|
+
this._threadSidebarComponent.scrollPanelIntoView(event.detail.instanceId);
|
|
560
|
+
});
|
|
561
|
+
Kefir.fromEvents(document.body, 'inboxsdkSidebarPanelClose')
|
|
562
|
+
.filter((e) => e.detail.sidebarId === this._instanceId && !e.detail.isGlobal)
|
|
563
|
+
.takeUntilBy(this._stopper)
|
|
564
|
+
.onValue((event) => {
|
|
565
|
+
if (this._threadSidebarComponent)
|
|
566
|
+
this._threadSidebarComponent.closePanel(event.detail.instanceId);
|
|
567
|
+
});
|
|
568
|
+
Kefir.fromEvents(document.body, 'inboxsdkSidebarPanelOpen')
|
|
569
|
+
.filter((e) => e.detail.sidebarId === this._instanceId && !e.detail.isGlobal)
|
|
570
|
+
.takeUntilBy(this._stopper)
|
|
571
|
+
.onValue((e) => {
|
|
572
|
+
this._renderThreadSidebar().then((threadSidebarComponent) => {
|
|
573
|
+
const descriptor = this._instanceIdsToDescriptors.get(e.detail.instanceId);
|
|
574
|
+
if (!descriptor)
|
|
575
|
+
return;
|
|
576
|
+
const buttonContainer = this._threadButtonContainers.get(descriptor.appName);
|
|
577
|
+
if (!buttonContainer) {
|
|
578
|
+
throw new Error('missing button container');
|
|
579
|
+
}
|
|
580
|
+
const activeButtonContainer = this._getActiveButtonContainer();
|
|
581
|
+
if (activeButtonContainer !== buttonContainer) {
|
|
582
|
+
querySelector(buttonContainer, 'button').click();
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
});
|
|
599
586
|
}
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
587
|
+
// global sidebar content panels
|
|
588
|
+
{
|
|
589
|
+
Kefir.fromEvents(document.body, 'inboxsdkNewSidebarPanel')
|
|
590
|
+
.filter((e) => e.detail.sidebarId === this._instanceId && e.detail.isGlobal)
|
|
591
|
+
.takeUntilBy(this._stopper)
|
|
592
|
+
.onValue((event) => {
|
|
593
|
+
let id = event.detail.id;
|
|
594
|
+
while (this._currentIds.has(id)) {
|
|
595
|
+
id = incrementName(id);
|
|
596
|
+
}
|
|
597
|
+
this._currentIds.add(id);
|
|
598
|
+
const appName = event.detail.appName;
|
|
599
|
+
let globalIconArea = (this._globalIconArea =
|
|
600
|
+
companionSidebarIconContainerEl.querySelector('.sidebar_global_iconArea'));
|
|
601
|
+
if (!globalIconArea) {
|
|
602
|
+
globalIconArea = this._globalIconArea =
|
|
603
|
+
document.createElement('div');
|
|
604
|
+
globalIconArea.className = idMap('sidebar_iconArea');
|
|
605
|
+
globalIconArea.classList.add('sidebar_global_iconArea');
|
|
606
|
+
addCompanionGlobalIconArea(this._driver.getLogger(), globalIconArea, companionSidebarIconContainerEl);
|
|
607
|
+
}
|
|
608
|
+
const sdkContentContainerEl = document.createElement('div');
|
|
609
|
+
sdkContentContainerEl.classList.add('addon_sidebar', idMap('app_sidebar_container'), 'global_app_sidebar');
|
|
610
|
+
this._companionSidebarContentContainerEl.insertAdjacentElement('afterbegin', sdkContentContainerEl);
|
|
611
|
+
this._contentContainers.set(appName, sdkContentContainerEl);
|
|
612
|
+
sdkContentContainerEl.appendChild(event.target);
|
|
613
|
+
sdkContentContainerEl.style.display = 'none';
|
|
614
|
+
this._addButton(globalIconArea, event, true);
|
|
615
|
+
});
|
|
616
|
+
Kefir.fromEvents(document.body, 'inboxsdkUpdateSidebarPanel')
|
|
617
|
+
.filter((e) => e.detail.sidebarId === this._instanceId && e.detail.isGlobal)
|
|
618
|
+
.takeUntilBy(this._stopper)
|
|
619
|
+
.onValue((event) => {
|
|
620
|
+
const buttonContainer = this._globalButtonContainers.get(event.detail.appName);
|
|
621
|
+
if (!buttonContainer)
|
|
622
|
+
return;
|
|
623
|
+
const iconClass = event.detail.iconClass || '';
|
|
624
|
+
const iconUrl = event.detail.iconUrl || event.detail.appIconUrl;
|
|
625
|
+
const imgElement = querySelector(buttonContainer, 'img');
|
|
626
|
+
imgElement.setAttribute('src', iconUrl);
|
|
627
|
+
const button = querySelector(buttonContainer, 'button');
|
|
628
|
+
button.setAttribute('class', `inboxsdk__button_icon ${iconClass}`);
|
|
629
|
+
});
|
|
630
|
+
Kefir.fromEvents(document.body, 'inboxsdkRemoveSidebarPanel')
|
|
631
|
+
.filter((e) => e.detail.sidebarId === this._instanceId && e.detail.isGlobal)
|
|
632
|
+
.takeUntilBy(this._stopper)
|
|
633
|
+
.onValue((event) => {
|
|
634
|
+
this._currentIds.delete(event.detail.id);
|
|
635
|
+
this._removeButton(event, this._globalButtonContainers, this._globalIconArea);
|
|
636
|
+
});
|
|
637
|
+
Kefir.fromEvents(document.body, 'inboxsdkSidebarPanelClose')
|
|
638
|
+
.filter((e) => e.detail.sidebarId === this._instanceId && e.detail.isGlobal)
|
|
639
|
+
.takeUntilBy(this._stopper)
|
|
640
|
+
.onValue((event) => {
|
|
641
|
+
const descriptor = this._instanceIdsToDescriptors.get(event.detail.instanceId);
|
|
642
|
+
if (!descriptor)
|
|
643
|
+
return;
|
|
644
|
+
const buttonContainer = this._globalButtonContainers.get(descriptor.appName);
|
|
645
|
+
if (!buttonContainer)
|
|
646
|
+
return;
|
|
647
|
+
const activeButtonContainer = this._getActiveButtonContainer();
|
|
648
|
+
if (activeButtonContainer === buttonContainer) {
|
|
649
|
+
if (!this._closeButton) {
|
|
650
|
+
throw new Error('Expected this._closeButton');
|
|
651
|
+
}
|
|
652
|
+
this._closeButton(true);
|
|
653
|
+
}
|
|
654
|
+
});
|
|
655
|
+
Kefir.fromEvents(document.body, 'inboxsdkSidebarPanelOpen')
|
|
656
|
+
.filter((e) => e.detail.sidebarId === this._instanceId && e.detail.isGlobal)
|
|
657
|
+
.takeUntilBy(this._stopper)
|
|
658
|
+
.onValue((event) => {
|
|
659
|
+
const descriptor = this._instanceIdsToDescriptors.get(event.detail.instanceId);
|
|
660
|
+
if (!descriptor)
|
|
661
|
+
return;
|
|
662
|
+
const buttonContainer = this._globalButtonContainers.get(descriptor.appName);
|
|
663
|
+
if (!buttonContainer)
|
|
664
|
+
return;
|
|
665
|
+
const activeButtonContainer = this._getActiveButtonContainer();
|
|
666
|
+
if (activeButtonContainer !== buttonContainer) {
|
|
667
|
+
querySelector(buttonContainer, 'button').click();
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
// instance id to descriptor management
|
|
672
|
+
{
|
|
673
|
+
Kefir.fromEvents(document.body, 'inboxsdkNewSidebarPanel')
|
|
674
|
+
.filter((e) => e.detail.sidebarId === this._instanceId)
|
|
675
|
+
.takeUntilBy(this._stopper)
|
|
676
|
+
.onValue((event) => {
|
|
677
|
+
this._instanceIdsToDescriptors.set(event.detail.instanceId, event.detail);
|
|
678
|
+
});
|
|
679
|
+
Kefir.fromEvents(document.body, 'inboxsdkRemoveSidebarPanel')
|
|
680
|
+
.filter((e) => e.detail.sidebarId === this._instanceId)
|
|
681
|
+
.takeUntilBy(this._stopper)
|
|
682
|
+
.onValue((event) => {
|
|
683
|
+
this._instanceIdsToDescriptors.delete(event.detail.instanceId);
|
|
684
|
+
});
|
|
685
|
+
Kefir.fromEvents(document.body, 'inboxsdkUpdateSidebarPanel')
|
|
686
|
+
.filter((e) => e.detail.sidebarId === this._instanceId)
|
|
687
|
+
.takeUntilBy(this._stopper)
|
|
688
|
+
.onValue((event) => {
|
|
689
|
+
this._instanceIdsToDescriptors.set(event.detail.instanceId, event.detail);
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
// at this point the companionSidebar has 2 children
|
|
693
|
+
// 1st child is global add-on content
|
|
694
|
+
// 2nd is thread add-on content (may not exist)
|
|
695
|
+
// listen for companion sidebar contents to become visible
|
|
696
|
+
// this happens when ONE of the global add-on content element
|
|
697
|
+
// or the thread add-on content element are visible
|
|
698
|
+
// if they are both display: '' or display: none then the native sidebar
|
|
699
|
+
// contents are not visible
|
|
700
|
+
const globalAddOnContentContainer = this._companionSidebarContentContainerEl
|
|
701
|
+
.children[0];
|
|
702
|
+
const threadAddOnContentContainer = this._companionSidebarContentContainerEl
|
|
703
|
+
.children[1];
|
|
704
|
+
Kefir.merge([globalAddOnContentContainer, threadAddOnContentContainer].map((addonContentEl) => makeMutationObserverChunkedStream(addonContentEl, {
|
|
705
|
+
attributes: true,
|
|
706
|
+
attributeFilter: ['style'],
|
|
707
|
+
})))
|
|
708
|
+
.filter(() => globalAddOnContentContainer.style.display !==
|
|
709
|
+
threadAddOnContentContainer.style.display)
|
|
710
|
+
.takeUntilBy(this._stopper)
|
|
711
|
+
.onValue(() => {
|
|
712
|
+
// TODO What is this block for? It closes the current section whenever
|
|
713
|
+
// one of the Gmail addons bar elements changes?
|
|
714
|
+
const activeButtonContainer = this._getActiveButtonContainer();
|
|
715
|
+
if (activeButtonContainer) {
|
|
716
|
+
querySelector(activeButtonContainer, 'button').click();
|
|
717
|
+
}
|
|
718
|
+
});
|
|
614
719
|
}
|
|
615
|
-
|
|
616
|
-
// at this point the companionSidebar has 2 children
|
|
617
|
-
// 1st child is global add-on content
|
|
618
|
-
// 2nd is thread add-on content (may not exist)
|
|
619
|
-
|
|
620
|
-
// listen for companion sidebar contents to become visible
|
|
621
|
-
// this happens when ONE of the global add-on content element
|
|
622
|
-
// or the thread add-on content element are visible
|
|
623
|
-
// if they are both display: '' or display: none then the native sidebar
|
|
624
|
-
// contents are not visible
|
|
625
|
-
const globalAddOnContentContainer = this._companionSidebarContentContainerEl.children[0];
|
|
626
|
-
const threadAddOnContentContainer = this._companionSidebarContentContainerEl.children[1];
|
|
627
|
-
_kefir.default.merge([globalAddOnContentContainer, threadAddOnContentContainer].map(addonContentEl => (0, _makeMutationObserverChunkedStream.default)(addonContentEl, {
|
|
628
|
-
attributes: true,
|
|
629
|
-
attributeFilter: ['style']
|
|
630
|
-
}))).filter(() => globalAddOnContentContainer.style.display !== threadAddOnContentContainer.style.display).takeUntilBy(this._stopper).onValue(() => {
|
|
631
|
-
// TODO What is this block for? It closes the current section whenever
|
|
632
|
-
// one of the Gmail addons bar elements changes?
|
|
633
|
-
const activeButtonContainer = this._getActiveButtonContainer();
|
|
634
|
-
if (activeButtonContainer) {
|
|
635
|
-
(0, _querySelectorOrFail.default)(activeButtonContainer, 'button').click();
|
|
636
|
-
}
|
|
637
|
-
});
|
|
638
|
-
}
|
|
639
720
|
}
|
|
640
|
-
|
|
641
|
-
exports.default = _default;
|
|
721
|
+
export default GmailAppSidebarPrimary;
|