@inboxsdk/core 0.2.28-alpha.5 → 0.2.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/inboxsdk.js +28 -62
- package/inboxsdk.js.map +1 -1
- package/package.json +1 -5
- package/pageWorld.js.map +1 -1
- package/src/build/exec.d.ts +0 -1
- package/src/build/spawn.d.ts +0 -1
- package/src/common/ajax.d.ts +0 -1
- package/src/common/cachebust-url.d.ts +0 -1
- package/src/common/censorHTMLstring.d.ts +0 -1
- package/src/common/censorHTMLtree.d.ts +0 -1
- package/src/common/censorJSONTree.d.ts +0 -1
- package/src/common/connectivity-test.d.ts +0 -1
- package/src/common/defer.d.ts +0 -1
- package/src/common/find-parent.d.ts +0 -1
- package/src/common/get-extension-id.d.ts +0 -1
- package/src/common/get-or-fail.d.ts +0 -1
- package/src/common/get-session-id.d.ts +0 -1
- package/src/common/get-stack-trace.d.ts +0 -1
- package/src/common/html-to-text.d.ts +0 -1
- package/src/common/isElementVisible.d.ts +0 -1
- package/src/common/load-script.d.ts +0 -1
- package/src/common/log-error.d.ts +0 -1
- package/src/common/quoted-split.d.ts +0 -1
- package/src/common/rate-limit-queuer.d.ts +0 -1
- package/src/common/rate-limit.d.ts +0 -1
- package/src/common/version.d.ts +0 -1
- package/src/inboxsdk-js/check-requirements.js +3 -7
- package/src/inboxsdk-js/header.js +0 -1
- package/src/inboxsdk-js/inboxsdk-NONREMOTE-INTEGRATED-PAGEWORLD.js +6 -5
- package/src/inboxsdk-js/inboxsdk-NONREMOTE.js +3 -4
- package/src/inboxsdk-js/inboxsdk-REMOTE.js +1 -3
- package/src/inboxsdk-js/inboxsdk-TEST.js +3 -4
- package/src/inboxsdk-js/inboxsdk.js +39 -33
- package/src/inboxsdk-js/loading/load-platform-implementation-DEV.js +18 -15
- package/src/inboxsdk-js/loading/platform-implementation-loader.d.ts +0 -1
- package/src/inboxsdk.d.ts +27 -10
- package/src/injected-js/gmail/constants.d.ts +0 -1
- package/src/injected-js/gmail/modify-suggestions.d.ts +0 -1
- package/src/injected-js/gmail/modify-suggestions.test.js +9 -8
- package/src/injected-js/gmail/setup-gmail-interceptor.js +579 -340
- package/src/injected-js/gmail/setup-gmonkey-handler.d.ts +0 -1
- package/src/injected-js/gmail/sync-compose-processor-20220909.d.ts +0 -1
- package/src/injected-js/gmail/sync-compose-processor.d.ts +0 -1
- package/src/injected-js/gmail/sync-compose-request-processor.d.ts +0 -1
- package/src/injected-js/gmail/sync-compose-request-processor.test.js +49 -39
- package/src/injected-js/gmail/thread-identifier/click-and-get-popup-url.js +33 -20
- package/src/injected-js/gmail/thread-identifier/index.js +93 -57
- package/src/injected-js/gmail/thread-identifier/thread-row-parser.js +31 -22
- package/src/injected-js/gmail/thread-identifier/thread-row-parser.test.js +28 -12
- package/src/injected-js/inbox/setupAjaxInterceptor.js +121 -64
- package/src/injected-js/inbox/setupClickAndGetNewIframeSrc.js +66 -53
- package/src/injected-js/inbox/setupComposeViewDraftIDFinder.js +36 -20
- package/src/injected-js/inbox/setupInboxFakeWindowResizeListener.js +13 -13
- package/src/injected-js/injected-logger.d.ts +0 -1
- package/src/injected-js/main.js +24 -11
- package/src/injected-js/message-metadata-holder.js +82 -52
- package/src/injected-js/setup-data-exposer.js +148 -89
- package/src/injected-js/setup-error-silencer.js +21 -21
- package/src/injected-js/setup-event-reemitter.js +22 -30
- package/src/injected-js/setupCustomViewEventAssassin.d.ts +0 -1
- package/src/injected-js/setupInboxCustomViewLinkFixer.js +29 -24
- package/src/injected-js/setupPushStateListener.js +11 -18
- package/src/injected-js/xhr-helper.js +65 -62
- package/src/injected-js/xhr-proxy-factory.js +445 -195
- package/src/injected-js/xhr-proxy-factory.test.js +991 -824
- package/src/platform-implementation-js/constants/nav-item-types.d.ts +0 -1
- package/src/platform-implementation-js/constants/router.js +9 -17
- package/src/platform-implementation-js/constants/toolbars.js +3 -8
- package/src/platform-implementation-js/dom-driver/gmail/custom-style.js +13 -13
- package/src/platform-implementation-js/dom-driver/gmail/gmail-butter-bar-driver.js +136 -115
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-nav-item.d.ts +2 -3
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-support-item.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-toolbar-button-for-app.js +14 -13
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/create-link.js +48 -27
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/encodeDraftUrlId.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-draft-id-for-message-id.js +42 -31
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-native-nav-item.js +40 -30
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-rfc-message-id-for-gmail-message-id.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-rfc-message-id-for-gmail-thread-id.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-url-object.js +18 -10
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadForOldGmailThreadId.js +28 -21
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadFromSyncThreadId.js +45 -33
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/gmail-load-event.js +49 -31
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/goto-view.js +65 -58
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/isIntegratedViewGmail.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/keyboard-shortcut-help-modifier.js +124 -40
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-compose-window.js +22 -17
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-draft-by-message-id.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-draft-by-message-id.test.js +11 -10
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/override-gmail-back-button.js +80 -44
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/register-search-query-rewriter.js +26 -19
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/register-search-suggestions-provider.js +147 -71
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-compose-view-driver-stream.js +148 -91
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-route-view-driver-stream.js +166 -150
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-route-view-driver-stream.test.js +120 -70
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-app-id-warning.js +15 -15
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-route-view.js +67 -44
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-thread-list.js +379 -230
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-thread-list.test.js +307 -121
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-native-route-view.js +24 -17
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/suppressAddon.js +49 -41
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/temporary-track-download-url-validity.js +40 -30
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/thread-row-identifier.js +60 -28
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-events.js +133 -61
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-gmail-styles.js +110 -83
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/user-info.js +42 -30
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/user-info.test.js +46 -52
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.d.ts +3 -13
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.js +683 -355
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter/get-main-content-element-changed-stream.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter/wait-for-gmail-mode-to-settle.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter.d.ts +0 -4
- package/src/platform-implementation-js/dom-driver/gmail/gmail-page-communicator.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-response-processor.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-sync-response-processor.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/is-compose-titlebar-light-color.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/make-xhr-interceptor.js +93 -77
- package/src/platform-implementation-js/dom-driver/gmail/makePageParserTree.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/pageParserOptions.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.js +82 -35
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.test.js +94 -44
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-companion-global-icon-area.js +19 -12
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-companion-thread-icon-area.js +29 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-to-icon-area.js +26 -26
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/index.js +797 -391
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view/monitor-top-banner-size-and-react.js +9 -7
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view.js +109 -60
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-area-view.js +135 -95
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-card-view.js +211 -103
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-card-view.test.js +61 -61
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-backdrop.js +17 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-collapsible-section-view.js +541 -188
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-button.js +135 -67
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-compose-notice.js +49 -27
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-inner-sidebar.js +13 -7
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-outer-sidebar.js +22 -9
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-recipient-row.js +63 -36
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-status-bar.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-tooltip-to-button.js +113 -38
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/detectClassicRecipientsArea.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/ensure-app-button-toolbars-are-closed.js +16 -11
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/ensure-grouping-is-open.js +17 -11
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/focus.js +11 -8
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/from-manager.js +47 -27
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-additional-action-toolbar.js +24 -11
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-address-changes-stream.js +111 -59
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-address-information-extractor.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-body-changes-stream.js +14 -15
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-formatting-area-offset-left.js +17 -11
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-minimized-stream.js +24 -18
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-recipients.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-response-type-changes-stream.js +23 -19
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/gmail-compose-button-view.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/insert-link-into-body.js +19 -11
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/manage-button-grouping.js +376 -141
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/monitor-selection-range.js +28 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/override-edit-subject.js +70 -34
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/page-parser.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/position-formatting-toolbar.js +17 -10
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/set-recipients.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/setupLinkPopovers.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/size-fixer.js +137 -83
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/update-insert-more-area-left.js +19 -10
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view.js +1190 -632
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view/attachment-icon.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view/get-updated-contact.js +38 -29
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view.js +617 -327
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-nav-item-view.d.ts +1 -34
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-processor.js +48 -29
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-view.js +380 -188
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-row-list-view.js +194 -104
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-support-item-view.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-row-view.js +811 -382
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view/add-icon-area.js +58 -34
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.js +581 -330
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.test.js +277 -123
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view/width-manager.js +35 -15
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view.js +571 -216
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-toolbar-view.js +336 -152
- package/src/platform-implementation-js/dom-driver/gmail/views/native-gmail-nav-item-view.js +211 -87
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/button-color-classes.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/button-view.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-accessory-button-view.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-parent-accessory-button-view.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/inbox-dropdown-button-view.js +11 -10
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/modal-button-view.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/more-dropdown-button-view.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/more-parent-accessory-button-view.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-action-button-view.js +29 -20
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-dropdown-view.d.ts +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-label-view.js +76 -41
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-modal-view-driver.js +99 -45
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-mole-view-driver.js +128 -76
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-tooltip-view.js +319 -128
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-top-message-bar-driver.js +78 -45
- package/src/platform-implementation-js/dom-driver/inbox/__mocks__/getSidebarClassnames.js +4 -8
- package/src/platform-implementation-js/dom-driver/inbox/addNavItem.js +54 -36
- package/src/platform-implementation-js/dom-driver/inbox/addRecipientRow.js +53 -35
- package/src/platform-implementation-js/dom-driver/inbox/createLink.js +15 -13
- package/src/platform-implementation-js/dom-driver/inbox/createLink.test.js +18 -15
- package/src/platform-implementation-js/dom-driver/inbox/custom-style.js +13 -14
- package/src/platform-implementation-js/dom-driver/inbox/detection/appToolbarLocation/parser.js +20 -14
- package/src/platform-implementation-js/dom-driver/inbox/detection/attachmentCard/parser.js +13 -14
- package/src/platform-implementation-js/dom-driver/inbox/detection/attachmentOverlay/parser.js +67 -35
- package/src/platform-implementation-js/dom-driver/inbox/detection/chatSidebar/parser.js +18 -16
- package/src/platform-implementation-js/dom-driver/inbox/detection/compose/parser.js +185 -68
- package/src/platform-implementation-js/dom-driver/inbox/detection/message/parser.js +56 -28
- package/src/platform-implementation-js/dom-driver/inbox/detection/nativeDrawer/parser.js +10 -12
- package/src/platform-implementation-js/dom-driver/inbox/detection/searchBar/parser.js +16 -16
- package/src/platform-implementation-js/dom-driver/inbox/detection/thread/parser.js +35 -24
- package/src/platform-implementation-js/dom-driver/inbox/detection/thread-row/parser.js +89 -37
- package/src/platform-implementation-js/dom-driver/inbox/getComposeViewDriverLiveSet.js +78 -56
- package/src/platform-implementation-js/dom-driver/inbox/getInboxMessageIdForInboxThreadId.js +32 -26
- package/src/platform-implementation-js/dom-driver/inbox/getSidebarClassnames.js +109 -52
- package/src/platform-implementation-js/dom-driver/inbox/getSidebarClassnames.test.js +8 -7
- package/src/platform-implementation-js/dom-driver/inbox/gotoView.js +20 -16
- package/src/platform-implementation-js/dom-driver/inbox/gotoView.test.js +16 -15
- package/src/platform-implementation-js/dom-driver/inbox/inbox-butter-bar-driver.js +83 -75
- package/src/platform-implementation-js/dom-driver/inbox/inbox-driver.js +823 -531
- package/src/platform-implementation-js/dom-driver/inbox/inbox-page-communicator.js +61 -48
- package/src/platform-implementation-js/dom-driver/inbox/inboxResponseProcessor.js +12 -9
- package/src/platform-implementation-js/dom-driver/inbox/inboxResponseProcessor.test.js +19 -12
- package/src/platform-implementation-js/dom-driver/inbox/makePageParserTree.js +33 -24
- package/src/platform-implementation-js/dom-driver/inbox/pageParserOptions.js +388 -201
- package/src/platform-implementation-js/dom-driver/inbox/registerSearchSuggestionsProvider.js +265 -249
- package/src/platform-implementation-js/dom-driver/inbox/setupCustomAutocompleteSelectionHandling.js +152 -84
- package/src/platform-implementation-js/dom-driver/inbox/setupRouteViewDriverStream.js +67 -55
- package/src/platform-implementation-js/dom-driver/inbox/setupRouteViewDriverStream.test.js +65 -43
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxLabelView.js +56 -31
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxMoleViewDriver.js +294 -191
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxToolbarButtonView.js +45 -32
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxToolbarView.js +39 -21
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-sidebar-view.js +240 -153
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-toolbar-button-view.js +150 -75
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-toolbar-tooltip-view.js +37 -20
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-attachment-card-view.js +114 -60
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-attachment-overlay-view.js +65 -47
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-backdrop.js +52 -41
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-chat-sidebar-view.js +36 -27
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-compose-button-view.js +80 -52
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-compose-view.js +649 -465
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-custom-route-view.js +58 -37
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-custom-route-view.test.js +26 -14
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-drawer-view.js +235 -118
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-dropdown-view.js +11 -10
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-dummy-route-view.js +46 -28
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-message-view.js +202 -131
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-modal-view.js +80 -40
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-route-view.js +61 -35
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-row-view.js +221 -124
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-view.js +213 -125
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-view.test.js +126 -104
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-tooltip-view.js +51 -36
- package/src/platform-implementation-js/dom-driver/inbox/views/inboxNavItemView.js +297 -158
- package/src/platform-implementation-js/dom-driver/inbox/waitForAnimationClickBlockerGone.js +35 -21
- package/src/platform-implementation-js/driver-common/compose/getDiscardStream.js +43 -24
- package/src/platform-implementation-js/driver-common/compose/getPresendingStream.js +68 -39
- package/src/platform-implementation-js/driver-common/getAccountUrlPart.d.ts +0 -1
- package/src/platform-implementation-js/driver-common/getGmailMessageIdForSyncMessageId.js +19 -14
- package/src/platform-implementation-js/driver-common/getGmailThreadIdForRfcMessageId.js +35 -27
- package/src/platform-implementation-js/driver-common/getOriginalMessagePage.d.ts +0 -1
- package/src/platform-implementation-js/driver-common/getRfcMessageIdForSyncMessageId.js +22 -16
- package/src/platform-implementation-js/driver-common/getSyncThreadsForSearch.d.ts +0 -1
- package/src/platform-implementation-js/driver-common/getThreadIdFromMessageId.js +14 -14
- package/src/platform-implementation-js/driver-common/gmailAjax.d.ts +0 -1
- package/src/platform-implementation-js/driver-common/inboxAjax.js +7 -12
- package/src/platform-implementation-js/driver-common/render-custom-icon.d.ts +0 -1
- package/src/platform-implementation-js/driver-common/requestGmailThread.js +20 -19
- package/src/platform-implementation-js/driver-common/sidebar/AppSidebar.js +306 -197
- package/src/platform-implementation-js/driver-common/sidebar/ContentPanelViewDriver.js +161 -113
- package/src/platform-implementation-js/driver-common/update-icon.d.ts +0 -1
- package/src/platform-implementation-js/driver-interfaces/compose-view-driver.js +114 -1
- package/src/platform-implementation-js/driver-interfaces/driver.d.ts +0 -5
- package/src/platform-implementation-js/driver-interfaces/driver.js +126 -1
- package/src/platform-implementation-js/driver-interfaces/message-view-driver.js +48 -4
- package/src/platform-implementation-js/driver-interfaces/mole-view-driver.js +29 -1
- package/src/platform-implementation-js/driver-interfaces/route-view-driver.js +32 -1
- package/src/platform-implementation-js/driver-interfaces/thread-row-view-driver.js +11 -1
- package/src/platform-implementation-js/lib/ErrorCollector.d.ts +0 -1
- package/src/platform-implementation-js/lib/Membrane.d.ts +0 -1
- package/src/platform-implementation-js/lib/ScrollableContainByScreen.d.ts +0 -1
- package/src/platform-implementation-js/lib/array-to-lifetimes.js +41 -43
- package/src/platform-implementation-js/lib/array-to-lifetimes.test.js +155 -139
- package/src/platform-implementation-js/lib/attemptWithRetries.d.ts +0 -1
- package/src/platform-implementation-js/lib/common-page-communicator.d.ts +0 -1
- package/src/platform-implementation-js/lib/copyAndValidateAutocompleteResults.js +38 -19
- package/src/platform-implementation-js/lib/css-selector-escape.js +3 -7
- package/src/platform-implementation-js/lib/delay-asap.d.ts +0 -1
- package/src/platform-implementation-js/lib/delay-idle.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/block-and-reemit-keyboard-events.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/element-view-mapper.js +11 -8
- package/src/platform-implementation-js/lib/dom/generic-button-view.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/get-insert-before-element.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/get-selection.js +52 -23
- package/src/platform-implementation-js/lib/dom/insert-element-in-order.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/insert-html-at-cursor.js +101 -69
- package/src/platform-implementation-js/lib/dom/is-node-in-range.js +10 -8
- package/src/platform-implementation-js/lib/dom/keyboard-shortcut-stream.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/make-element-child-stream.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/make-element-stream-merger.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/make-element-view-stream.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/make-mutation-observer-chunked-stream.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/make-mutation-observer-stream.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/on-mouse-down-and-up.js +17 -15
- package/src/platform-implementation-js/lib/dom/outsideClicksAndEscape.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/parentNodes.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/querySelectorOne.js +11 -8
- package/src/platform-implementation-js/lib/dom/querySelectorOrFail.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/reemitClickEventForReact.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/set-css.js +3 -7
- package/src/platform-implementation-js/lib/dom/set-value-and-dispatch-event.js +11 -9
- package/src/platform-implementation-js/lib/dom/simulate-drag-and-drop.js +33 -32
- package/src/platform-implementation-js/lib/dom/simulate-key.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/simulate-mouse-event.d.ts +0 -1
- package/src/platform-implementation-js/lib/dom/trigger-relay-event.d.ts +0 -1
- package/src/platform-implementation-js/lib/extract-contact-from-email-contact-string.d.ts +0 -1
- package/src/platform-implementation-js/lib/extract-contact-from-email-contact-string.test.js +26 -23
- package/src/platform-implementation-js/lib/fake-window-resize.d.ts +0 -1
- package/src/platform-implementation-js/lib/from-event-target-capture.d.ts +0 -1
- package/src/platform-implementation-js/lib/fromEventsWithOptions.d.ts +0 -1
- package/src/platform-implementation-js/lib/handle-compose-link-chips.js +149 -86
- package/src/platform-implementation-js/lib/handler-registry.d.ts +0 -1
- package/src/platform-implementation-js/lib/idMap.d.ts +0 -1
- package/src/platform-implementation-js/lib/imageRequest.d.ts +0 -1
- package/src/platform-implementation-js/lib/incrementName.d.ts +0 -1
- package/src/platform-implementation-js/lib/inject-script-EMBEDDED.d.ts +0 -1
- package/src/platform-implementation-js/lib/inject-script.d.ts +0 -1
- package/src/platform-implementation-js/lib/insert-link-chip-into-body.js +57 -42
- package/src/platform-implementation-js/lib/is-valid-app-id.d.ts +0 -1
- package/src/platform-implementation-js/lib/is-valid-email.d.ts +0 -1
- package/src/platform-implementation-js/lib/isNotNil.d.ts +0 -1
- package/src/platform-implementation-js/lib/isStreakAppId.d.ts +0 -1
- package/src/platform-implementation-js/lib/logger.d.ts +0 -1
- package/src/platform-implementation-js/lib/make-revocable-function.js +21 -19
- package/src/platform-implementation-js/lib/make-revocable-function.test.js +22 -20
- package/src/platform-implementation-js/lib/parseParamsFromRouteID.js +17 -15
- package/src/platform-implementation-js/lib/parseParamsFromRouteID.test.js +18 -9
- package/src/platform-implementation-js/lib/persistent-queue.d.ts +0 -1
- package/src/platform-implementation-js/lib/populateRouteID.js +9 -8
- package/src/platform-implementation-js/lib/populateRouteID.test.js +19 -20
- package/src/platform-implementation-js/lib/react/ElementContainer.js +20 -23
- package/src/platform-implementation-js/lib/rewriteCssWithIdMap.js +9 -10
- package/src/platform-implementation-js/lib/rewriteCssWithIdMap.test.js +20 -13
- package/src/platform-implementation-js/lib/routeIDmatchesHash.js +18 -13
- package/src/platform-implementation-js/lib/routeIDmatchesHash.test.js +17 -11
- package/src/platform-implementation-js/lib/safe-event-emitter.d.ts +0 -1
- package/src/platform-implementation-js/lib/shared-style.js +13 -14
- package/src/platform-implementation-js/lib/stopper-pool.d.ts +0 -1
- package/src/platform-implementation-js/lib/stream-wait-for.d.ts +0 -1
- package/src/platform-implementation-js/lib/toItemWithLifetimeStream.js +17 -18
- package/src/platform-implementation-js/lib/toLiveSet.js +15 -17
- package/src/platform-implementation-js/lib/wait-for.d.ts +1 -2
- package/src/platform-implementation-js/lib/waitForAsync.d.ts +0 -1
- package/src/platform-implementation-js/main-INTEGRATED-PAGEWORLD.js +5 -6
- package/src/platform-implementation-js/main.js +24 -9
- package/src/platform-implementation-js/namespaces/butter-bar.d.ts +0 -1
- package/src/platform-implementation-js/namespaces/compose.js +60 -37
- package/src/platform-implementation-js/namespaces/conversations.js +124 -52
- package/src/platform-implementation-js/namespaces/global.js +39 -27
- package/src/platform-implementation-js/namespaces/keyboard.js +33 -29
- package/src/platform-implementation-js/namespaces/lists.js +31 -25
- package/src/platform-implementation-js/namespaces/modal.js +28 -34
- package/src/platform-implementation-js/namespaces/nav-menu.js +45 -30
- package/src/platform-implementation-js/namespaces/router.js +137 -70
- package/src/platform-implementation-js/namespaces/search.js +17 -19
- package/src/platform-implementation-js/namespaces/toolbars.js +117 -71
- package/src/platform-implementation-js/namespaces/user.js +37 -36
- package/src/platform-implementation-js/namespaces/widgets.js +61 -54
- package/src/platform-implementation-js/platform-implementation.d.ts +0 -2
- package/src/platform-implementation-js/platform-implementation.js +226 -98
- package/src/platform-implementation-js/views/SimpleElementView.d.ts +0 -1
- package/src/platform-implementation-js/views/app-toolbar-button-view.js +47 -26
- package/src/platform-implementation-js/views/collapsible-section-view.js +63 -66
- package/src/platform-implementation-js/views/compose-button-view.d.ts +0 -1
- package/src/platform-implementation-js/views/compose-view.d.ts +0 -1
- package/src/platform-implementation-js/views/content-panel-view.js +30 -28
- package/src/platform-implementation-js/views/conversations/attachment-card-view.js +44 -21
- package/src/platform-implementation-js/views/conversations/custom-message-view.js +104 -44
- package/src/platform-implementation-js/views/conversations/message-view.js +202 -131
- package/src/platform-implementation-js/views/conversations/thread-view.js +127 -75
- package/src/platform-implementation-js/views/keyboard-shortcut-handle.d.ts +0 -1
- package/src/platform-implementation-js/views/native-nav-item-view.js +65 -32
- package/src/platform-implementation-js/views/nav-item-view.js +115 -51
- package/src/platform-implementation-js/views/route-view/custom-route-view.js +20 -25
- package/src/platform-implementation-js/views/route-view/dummy-route-view-driver.js +18 -18
- package/src/platform-implementation-js/views/route-view/list-route-view.js +52 -30
- package/src/platform-implementation-js/views/route-view/route-view.js +35 -24
- package/src/platform-implementation-js/views/section-view.js +52 -60
- package/src/platform-implementation-js/views/thread-row-view.js +74 -49
- package/src/platform-implementation-js/widgets/buttons/basic-button-view-controller.d.ts +0 -1
- package/src/platform-implementation-js/widgets/buttons/dropdown-button-view-controller.d.ts +0 -1
- package/src/platform-implementation-js/widgets/buttons/dropdown-view.d.ts +0 -1
- package/src/platform-implementation-js/widgets/drawer-view.js +36 -29
- package/src/platform-implementation-js/widgets/modal-view.js +68 -39
- package/src/platform-implementation-js/widgets/mole-view.js +22 -22
- package/src/platform-implementation-js/widgets/top-message-bar-view.js +10 -13
- package/src/build/exec.d.ts.map +0 -1
- package/src/build/exec.js +0 -26
- package/src/build/spawn.d.ts.map +0 -1
- package/src/build/spawn.js +0 -17
- package/src/common/ajax.d.ts.map +0 -1
- package/src/common/ajax.js +0 -90
- package/src/common/cachebust-url.d.ts.map +0 -1
- package/src/common/cachebust-url.js +0 -10
- package/src/common/censorHTMLstring.d.ts.map +0 -1
- package/src/common/censorHTMLstring.js +0 -37
- package/src/common/censorHTMLtree.d.ts.map +0 -1
- package/src/common/censorHTMLtree.js +0 -28
- package/src/common/censorJSONTree.d.ts.map +0 -1
- package/src/common/censorJSONTree.js +0 -15
- package/src/common/connectivity-test.d.ts.map +0 -1
- package/src/common/connectivity-test.js +0 -21
- package/src/common/defer.d.ts.map +0 -1
- package/src/common/defer.js +0 -11
- package/src/common/find-parent.d.ts.map +0 -1
- package/src/common/find-parent.js +0 -10
- package/src/common/get-extension-id.d.ts.map +0 -1
- package/src/common/get-extension-id.js +0 -7
- package/src/common/get-or-fail.d.ts.map +0 -1
- package/src/common/get-or-fail.js +0 -8
- package/src/common/get-session-id.d.ts.map +0 -1
- package/src/common/get-session-id.js +0 -14
- package/src/common/get-stack-trace.d.ts.map +0 -1
- package/src/common/get-stack-trace.js +0 -6
- package/src/common/html-to-text.d.ts.map +0 -1
- package/src/common/html-to-text.js +0 -7
- package/src/common/isElementVisible.d.ts.map +0 -1
- package/src/common/isElementVisible.js +0 -6
- package/src/common/load-script.d.ts.map +0 -1
- package/src/common/load-script.js +0 -127
- package/src/common/log-error.d.ts.map +0 -1
- package/src/common/log-error.js +0 -191
- package/src/common/quoted-split.d.ts.map +0 -1
- package/src/common/quoted-split.js +0 -18
- package/src/common/rate-limit-queuer.d.ts.map +0 -1
- package/src/common/rate-limit-queuer.js +0 -57
- package/src/common/rate-limit.d.ts.map +0 -1
- package/src/common/rate-limit.js +0 -14
- package/src/common/version.d.ts.map +0 -1
- package/src/common/version.js +0 -6
- package/src/inboxsdk-js/loading/platform-implementation-loader.d.ts.map +0 -1
- package/src/inboxsdk-js/loading/platform-implementation-loader.js +0 -27
- package/src/injected-js/gmail/constants.d.ts.map +0 -1
- package/src/injected-js/gmail/constants.js +0 -2
- package/src/injected-js/gmail/modify-suggestions.d.ts.map +0 -1
- package/src/injected-js/gmail/modify-suggestions.js +0 -106
- package/src/injected-js/gmail/setup-gmonkey-handler.d.ts.map +0 -1
- package/src/injected-js/gmail/setup-gmonkey-handler.js +0 -49
- package/src/injected-js/gmail/sync-compose-processor-20220909.d.ts.map +0 -1
- package/src/injected-js/gmail/sync-compose-processor-20220909.js +0 -298
- package/src/injected-js/gmail/sync-compose-processor.d.ts.map +0 -1
- package/src/injected-js/gmail/sync-compose-processor.js +0 -55
- package/src/injected-js/gmail/sync-compose-request-processor.d.ts.map +0 -1
- package/src/injected-js/gmail/sync-compose-request-processor.js +0 -110
- package/src/injected-js/injected-logger.d.ts.map +0 -1
- package/src/injected-js/injected-logger.js +0 -50
- package/src/injected-js/setupCustomViewEventAssassin.d.ts.map +0 -1
- package/src/injected-js/setupCustomViewEventAssassin.js +0 -90
- package/src/platform-implementation-js/constants/nav-item-types.d.ts.map +0 -1
- package/src/platform-implementation-js/constants/nav-item-types.js +0 -19
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-app-menu-item.d.ts +0 -5
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-app-menu-item.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-app-menu-item.js +0 -21
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-collapsible-panel.d.ts +0 -5
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-collapsible-panel.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-collapsible-panel.js +0 -28
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-nav-item.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-nav-item.js +0 -98
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-support-item.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-support-item.js +0 -4
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/encodeDraftUrlId.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/encodeDraftUrlId.js +0 -8
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-rfc-message-id-for-gmail-message-id.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-rfc-message-id-for-gmail-message-id.js +0 -12
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-rfc-message-id-for-gmail-thread-id.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-rfc-message-id-for-gmail-thread-id.js +0 -33
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/isIntegratedViewGmail.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/isIntegratedViewGmail.js +0 -4
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-draft-by-message-id.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-draft-by-message-id.js +0 -44
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-gmail-styles.d.ts +0 -2
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-gmail-styles.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter/get-main-content-element-changed-stream.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter/get-main-content-element-changed-stream.js +0 -38
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter/wait-for-gmail-mode-to-settle.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter/wait-for-gmail-mode-to-settle.js +0 -12
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter.js +0 -253
- package/src/platform-implementation-js/dom-driver/gmail/gmail-page-communicator.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-page-communicator.js +0 -200
- package/src/platform-implementation-js/dom-driver/gmail/gmail-response-processor.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-response-processor.js +0 -533
- package/src/platform-implementation-js/dom-driver/gmail/gmail-sync-response-processor.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-sync-response-processor.js +0 -289
- package/src/platform-implementation-js/dom-driver/gmail/is-compose-titlebar-light-color.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/is-compose-titlebar-light-color.js +0 -21
- package/src/platform-implementation-js/dom-driver/gmail/makePageParserTree.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/makePageParserTree.js +0 -28
- package/src/platform-implementation-js/dom-driver/gmail/pageParserOptions.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/pageParserOptions.js +0 -19
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-menu-item-view.d.ts +0 -43
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-menu-item-view.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-menu-item-view.js +0 -126
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-status-bar.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-status-bar.js +0 -101
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/detectClassicRecipientsArea.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/detectClassicRecipientsArea.js +0 -38
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-address-information-extractor.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-address-information-extractor.js +0 -28
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-recipients.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-recipients.js +0 -22
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/gmail-compose-button-view.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/gmail-compose-button-view.js +0 -233
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/page-parser.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/page-parser.js +0 -223
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/set-recipients.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/set-recipients.js +0 -157
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/setupLinkPopovers.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/setupLinkPopovers.js +0 -109
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view/attachment-icon.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view/attachment-icon.js +0 -5
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-nav-item-view.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-nav-item-view.js +0 -759
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-support-item-view.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-support-item-view.js +0 -84
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/button-color-classes.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/button-color-classes.js +0 -33
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/button-view.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/button-view.js +0 -325
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-accessory-button-view.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-accessory-button-view.js +0 -58
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-parent-accessory-button-view.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-parent-accessory-button-view.js +0 -55
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/modal-button-view.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/modal-button-view.js +0 -96
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/more-dropdown-button-view.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/more-dropdown-button-view.js +0 -30
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/more-parent-accessory-button-view.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/more-parent-accessory-button-view.js +0 -10
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-dropdown-view.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-dropdown-view.js +0 -22
- package/src/platform-implementation-js/driver-common/getAccountUrlPart.d.ts.map +0 -1
- package/src/platform-implementation-js/driver-common/getAccountUrlPart.js +0 -17
- package/src/platform-implementation-js/driver-common/getOriginalMessagePage.d.ts.map +0 -1
- package/src/platform-implementation-js/driver-common/getOriginalMessagePage.js +0 -33
- package/src/platform-implementation-js/driver-common/getSyncThreadsForSearch.d.ts.map +0 -1
- package/src/platform-implementation-js/driver-common/getSyncThreadsForSearch.js +0 -49
- package/src/platform-implementation-js/driver-common/gmailAjax.d.ts.map +0 -1
- package/src/platform-implementation-js/driver-common/gmailAjax.js +0 -65
- package/src/platform-implementation-js/driver-common/render-custom-icon.d.ts.map +0 -1
- package/src/platform-implementation-js/driver-common/render-custom-icon.js +0 -16
- package/src/platform-implementation-js/driver-common/update-icon.d.ts.map +0 -1
- package/src/platform-implementation-js/driver-common/update-icon.js +0 -90
- package/src/platform-implementation-js/lib/ErrorCollector.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/ErrorCollector.js +0 -47
- package/src/platform-implementation-js/lib/Membrane.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/Membrane.js +0 -22
- package/src/platform-implementation-js/lib/ScrollableContainByScreen.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/ScrollableContainByScreen.js +0 -30
- package/src/platform-implementation-js/lib/attemptWithRetries.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/attemptWithRetries.js +0 -16
- package/src/platform-implementation-js/lib/common-page-communicator.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/common-page-communicator.js +0 -137
- package/src/platform-implementation-js/lib/delay-asap.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/delay-asap.js +0 -12
- package/src/platform-implementation-js/lib/delay-idle.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/delay-idle.js +0 -16
- package/src/platform-implementation-js/lib/dom/block-and-reemit-keyboard-events.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/block-and-reemit-keyboard-events.js +0 -36
- package/src/platform-implementation-js/lib/dom/generic-button-view.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/generic-button-view.js +0 -39
- package/src/platform-implementation-js/lib/dom/get-insert-before-element.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/get-insert-before-element.js +0 -39
- package/src/platform-implementation-js/lib/dom/insert-element-in-order.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/insert-element-in-order.js +0 -38
- package/src/platform-implementation-js/lib/dom/keyboard-shortcut-stream.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/keyboard-shortcut-stream.js +0 -12
- package/src/platform-implementation-js/lib/dom/make-element-child-stream.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/make-element-child-stream.js +0 -79
- package/src/platform-implementation-js/lib/dom/make-element-stream-merger.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/make-element-stream-merger.js +0 -28
- package/src/platform-implementation-js/lib/dom/make-element-view-stream.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/make-element-view-stream.js +0 -15
- package/src/platform-implementation-js/lib/dom/make-mutation-observer-chunked-stream.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/make-mutation-observer-chunked-stream.js +0 -15
- package/src/platform-implementation-js/lib/dom/make-mutation-observer-stream.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/make-mutation-observer-stream.js +0 -5
- package/src/platform-implementation-js/lib/dom/outsideClicksAndEscape.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/outsideClicksAndEscape.js +0 -39
- package/src/platform-implementation-js/lib/dom/parentNodes.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/parentNodes.js +0 -8
- package/src/platform-implementation-js/lib/dom/querySelectorOrFail.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/querySelectorOrFail.js +0 -6
- package/src/platform-implementation-js/lib/dom/reemitClickEventForReact.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/reemitClickEventForReact.js +0 -22
- package/src/platform-implementation-js/lib/dom/simulate-key.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/simulate-key.js +0 -46
- package/src/platform-implementation-js/lib/dom/simulate-mouse-event.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/simulate-mouse-event.js +0 -16
- package/src/platform-implementation-js/lib/dom/trigger-relay-event.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/dom/trigger-relay-event.js +0 -7
- package/src/platform-implementation-js/lib/extract-contact-from-email-contact-string.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/extract-contact-from-email-contact-string.js +0 -25
- package/src/platform-implementation-js/lib/fake-window-resize.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/fake-window-resize.js +0 -5
- package/src/platform-implementation-js/lib/from-event-target-capture.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/from-event-target-capture.js +0 -12
- package/src/platform-implementation-js/lib/fromEventsWithOptions.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/fromEventsWithOptions.js +0 -10
- package/src/platform-implementation-js/lib/handler-registry.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/handler-registry.js +0 -67
- package/src/platform-implementation-js/lib/idMap.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/idMap.js +0 -45
- package/src/platform-implementation-js/lib/imageRequest.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/imageRequest.js +0 -8
- package/src/platform-implementation-js/lib/incrementName.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/incrementName.js +0 -7
- package/src/platform-implementation-js/lib/inject-script-EMBEDDED.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/inject-script-EMBEDDED.js +0 -14
- package/src/platform-implementation-js/lib/inject-script.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/inject-script.js +0 -33
- package/src/platform-implementation-js/lib/is-valid-app-id.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/is-valid-app-id.js +0 -27
- package/src/platform-implementation-js/lib/is-valid-email.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/is-valid-email.js +0 -14
- package/src/platform-implementation-js/lib/isNotNil.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/isNotNil.js +0 -5
- package/src/platform-implementation-js/lib/isStreakAppId.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/isStreakAppId.js +0 -11
- package/src/platform-implementation-js/lib/logger.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/logger.js +0 -441
- package/src/platform-implementation-js/lib/persistent-queue.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/persistent-queue.js +0 -107
- package/src/platform-implementation-js/lib/safe-event-emitter.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/safe-event-emitter.js +0 -17
- package/src/platform-implementation-js/lib/stopper-pool.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/stopper-pool.js +0 -41
- package/src/platform-implementation-js/lib/stream-wait-for.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/stream-wait-for.js +0 -30
- package/src/platform-implementation-js/lib/wait-for.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/wait-for.js +0 -28
- package/src/platform-implementation-js/lib/waitForAsync.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/waitForAsync.js +0 -19
- package/src/platform-implementation-js/namespaces/app-menu.d.ts +0 -38
- package/src/platform-implementation-js/namespaces/app-menu.d.ts.map +0 -1
- package/src/platform-implementation-js/namespaces/app-menu.js +0 -31
- package/src/platform-implementation-js/namespaces/butter-bar.d.ts.map +0 -1
- package/src/platform-implementation-js/namespaces/butter-bar.js +0 -163
- package/src/platform-implementation-js/views/SimpleElementView.d.ts.map +0 -1
- package/src/platform-implementation-js/views/SimpleElementView.js +0 -16
- package/src/platform-implementation-js/views/app-menu-item-view.d.ts +0 -23
- package/src/platform-implementation-js/views/app-menu-item-view.d.ts.map +0 -1
- package/src/platform-implementation-js/views/app-menu-item-view.js +0 -257
- package/src/platform-implementation-js/views/collapsible-panel-view.d.ts +0 -50
- package/src/platform-implementation-js/views/collapsible-panel-view.d.ts.map +0 -1
- package/src/platform-implementation-js/views/collapsible-panel-view.js +0 -222
- package/src/platform-implementation-js/views/compose-button-view.d.ts.map +0 -1
- package/src/platform-implementation-js/views/compose-button-view.js +0 -45
- package/src/platform-implementation-js/views/compose-view.d.ts.map +0 -1
- package/src/platform-implementation-js/views/compose-view.js +0 -312
- package/src/platform-implementation-js/views/keyboard-shortcut-handle.d.ts.map +0 -1
- package/src/platform-implementation-js/views/keyboard-shortcut-handle.js +0 -14
- package/src/platform-implementation-js/views/nav-item-view.d.ts +0 -24
- package/src/platform-implementation-js/widgets/buttons/basic-button-view-controller.d.ts.map +0 -1
- package/src/platform-implementation-js/widgets/buttons/basic-button-view-controller.js +0 -39
- package/src/platform-implementation-js/widgets/buttons/dropdown-button-view-controller.d.ts.map +0 -1
- package/src/platform-implementation-js/widgets/buttons/dropdown-button-view-controller.js +0 -98
- package/src/platform-implementation-js/widgets/buttons/dropdown-view.d.ts.map +0 -1
- package/src/platform-implementation-js/widgets/buttons/dropdown-view.js +0 -122
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
/* @flow */
|
|
2
|
+
|
|
3
|
+
import find from 'lodash/find';
|
|
4
|
+
import findIndex from 'lodash/findIndex';
|
|
5
|
+
import { defn } from 'ud';
|
|
6
|
+
import autoHtml from 'auto-html';
|
|
7
|
+
import asap from 'asap';
|
|
8
|
+
import Kefir from 'kefir';
|
|
9
|
+
import kefirBus from 'kefir-bus';
|
|
10
|
+
import type { Bus } from 'kefir-bus';
|
|
11
|
+
import kefirStopper from 'kefir-stopper';
|
|
12
|
+
import OrderManager from 'order-manager';
|
|
13
|
+
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import ReactDOM from 'react-dom';
|
|
16
|
+
|
|
17
|
+
import AppSidebar from '../../../../../driver-common/sidebar/AppSidebar';
|
|
18
|
+
import type { PanelDescriptor } from '../../../../../driver-common/sidebar/AppSidebar';
|
|
19
|
+
|
|
20
|
+
import type GmailDriver from '../../../gmail-driver';
|
|
21
|
+
import GmailElementGetter from '../../../gmail-element-getter';
|
|
22
|
+
import idMap from '../../../../../lib/idMap';
|
|
23
|
+
import incrementName from '../../../../../lib/incrementName';
|
|
24
|
+
import querySelector from '../../../../../lib/dom/querySelectorOrFail';
|
|
25
|
+
import makeMutationObserverChunkedStream from '../../../../../lib/dom/make-mutation-observer-chunked-stream';
|
|
26
|
+
import makeElementChildStream from '../../../../../lib/dom/make-element-child-stream';
|
|
27
|
+
import { simulateClick } from '../../../../../lib/dom/simulate-mouse-event';
|
|
28
|
+
import fakeWindowResize from '../../../../../lib/fake-window-resize';
|
|
29
|
+
|
|
30
|
+
import addCompanionThreadIconArea from './add-companion-thread-icon-area';
|
|
31
|
+
import addCompanionGlobalIconArea from './add-companion-global-icon-area';
|
|
32
|
+
import addToIconArea from './add-to-icon-area';
|
|
33
|
+
|
|
32
34
|
const ACTIVE_ADD_ON_ICON_SELECTOR = '.aT5-aOt-I-KO';
|
|
33
35
|
const COMPANION_SIDEBAR_CONTENT_CLOSED_SHADOW_CLASS = 'brC-brG-btc';
|
|
34
36
|
|
|
@@ -37,54 +39,75 @@ const COMPANION_SIDEBAR_CONTENT_CLOSED_SHADOW_CLASS = 'brC-brG-btc';
|
|
|
37
39
|
// instances (including from other extensions) communicate with this Primary
|
|
38
40
|
// through DOM events.
|
|
39
41
|
class GmailAppSidebarPrimary {
|
|
42
|
+
_stopper = kefirStopper();
|
|
43
|
+
|
|
44
|
+
// There could be multiple InboxSDK instances (and therefore GmailDrivers)
|
|
45
|
+
// talking to this Primary, so we shouldn't privilege the specific GmailDriver
|
|
46
|
+
// that happened to create the Primary. Only use this GmailDriver for
|
|
47
|
+
// logging-related functionality!
|
|
48
|
+
_driver: GmailDriver;
|
|
49
|
+
|
|
40
50
|
// This Primary has an identifier used by the DOM events to specify they're
|
|
41
51
|
// talking to this Primary. This leaves us some room for having multiple
|
|
42
52
|
// Primary instances (representing different visual locations in Gmail) or
|
|
43
53
|
// multiple classes that make use of the same DOM events, but we don't make
|
|
44
54
|
// use of that now. Mainly I didn't want to risk baking in the singleton
|
|
45
55
|
// nature too deeply; that always seems to bite me.
|
|
56
|
+
_instanceId: string = `${Date.now()}-${Math.random()}`;
|
|
46
57
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
(0, _defineProperty2.default)(this, "_instanceId", `${Date.now()}-${Math.random()}`);
|
|
50
|
-
(0, _defineProperty2.default)(this, "_instanceIdsToDescriptors", new Map());
|
|
51
|
-
(0, _defineProperty2.default)(this, "_threadSidebarComponent", null);
|
|
52
|
-
(0, _defineProperty2.default)(this, "_threadIconArea", null);
|
|
53
|
-
(0, _defineProperty2.default)(this, "_globalIconArea", null);
|
|
54
|
-
(0, _defineProperty2.default)(this, "_globalButtonContainers", new Map());
|
|
55
|
-
(0, _defineProperty2.default)(this, "_threadButtonContainers", new Map());
|
|
56
|
-
(0, _defineProperty2.default)(this, "_contentContainers", new Map());
|
|
57
|
-
(0, _defineProperty2.default)(this, "_threadSidebarContainerEl", null);
|
|
58
|
-
(0, _defineProperty2.default)(this, "_currentIds", new Set());
|
|
59
|
-
(0, _defineProperty2.default)(this, "_orderManager", new _orderManager.default({
|
|
60
|
-
get() {
|
|
61
|
-
try {
|
|
62
|
-
return JSON.parse(global.localStorage.getItem('inboxsdk__sidebar_ordering') || 'null');
|
|
63
|
-
} catch (err) {
|
|
64
|
-
console.error('failed to read sidebar order data', err); //eslint-disable-line no-console
|
|
65
|
-
}
|
|
66
|
-
},
|
|
58
|
+
_companionSidebarContentContainerEl: HTMLElement;
|
|
59
|
+
_instanceIdsToDescriptors: Map<string, Object> = new Map();
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
61
|
+
_threadSidebarComponent: ?AppSidebar = null;
|
|
62
|
+
|
|
63
|
+
_threadIconArea: ?HTMLElement = null;
|
|
64
|
+
_globalIconArea: ?HTMLElement = null;
|
|
65
|
+
|
|
66
|
+
_globalButtonContainers: Map<string, HTMLElement> = new Map();
|
|
67
|
+
_threadButtonContainers: Map<string, HTMLElement> = new Map();
|
|
68
|
+
_contentContainers: Map<string, HTMLElement> = new Map();
|
|
69
|
+
|
|
70
|
+
_threadSidebarContainerEl: ?HTMLElement = null;
|
|
71
|
+
_companionSidebarOuterWrapper: HTMLElement;
|
|
72
|
+
|
|
73
|
+
_currentIds: Set<string> = new Set();
|
|
74
|
+
|
|
75
|
+
_orderManager = new OrderManager<PanelDescriptor>({
|
|
76
|
+
get() {
|
|
77
|
+
try {
|
|
78
|
+
return JSON.parse(
|
|
79
|
+
global.localStorage.getItem('inboxsdk__sidebar_ordering') || 'null'
|
|
80
|
+
);
|
|
81
|
+
} catch (err) {
|
|
82
|
+
console.error('failed to read sidebar order data', err); //eslint-disable-line no-console
|
|
74
83
|
}
|
|
75
|
-
}
|
|
76
|
-
(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
84
|
+
},
|
|
85
|
+
set(data) {
|
|
86
|
+
try {
|
|
87
|
+
global.localStorage.setItem(
|
|
88
|
+
'inboxsdk__sidebar_ordering',
|
|
89
|
+
JSON.stringify(data)
|
|
90
|
+
);
|
|
91
|
+
} catch (err) {
|
|
92
|
+
console.error('failed to set sidebar order data', err); //eslint-disable-line no-console
|
|
80
93
|
}
|
|
81
|
-
}
|
|
82
|
-
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
_containerProp: () => HTMLElement;
|
|
98
|
+
_updateHighlightedAppThreadIconBus: Bus<null> = kefirBus();
|
|
99
|
+
|
|
100
|
+
constructor(
|
|
101
|
+
driver: GmailDriver,
|
|
102
|
+
companionSidebarContentContainerElement: HTMLElement
|
|
103
|
+
) {
|
|
83
104
|
this._driver = driver;
|
|
84
|
-
this._companionSidebarContentContainerEl =
|
|
105
|
+
this._companionSidebarContentContainerEl =
|
|
106
|
+
companionSidebarContentContainerElement;
|
|
85
107
|
this._setupElement();
|
|
86
108
|
}
|
|
87
|
-
|
|
109
|
+
|
|
110
|
+
getInstanceId(): string {
|
|
88
111
|
return this._instanceId;
|
|
89
112
|
}
|
|
90
113
|
|
|
@@ -98,207 +121,310 @@ class GmailAppSidebarPrimary {
|
|
|
98
121
|
// This value controls whether the app sidebar should automatically open
|
|
99
122
|
// itself when available when the chat sidebar isn't present. It's only set
|
|
100
123
|
// if the user interacts with the app sidebar button.
|
|
101
|
-
_getShouldGlobalAppSidebarOpen() {
|
|
102
|
-
return
|
|
124
|
+
_getShouldGlobalAppSidebarOpen(): boolean {
|
|
125
|
+
return (
|
|
126
|
+
global.localStorage.getItem(
|
|
127
|
+
'inboxsdk__global_app_sidebar_should_open'
|
|
128
|
+
) === 'true'
|
|
129
|
+
);
|
|
103
130
|
}
|
|
104
|
-
|
|
131
|
+
|
|
132
|
+
_setShouldGlobalAppSidebarOpen(open: boolean) {
|
|
105
133
|
try {
|
|
106
|
-
global.localStorage.setItem(
|
|
134
|
+
global.localStorage.setItem(
|
|
135
|
+
'inboxsdk__global_app_sidebar_should_open',
|
|
136
|
+
String(open)
|
|
137
|
+
);
|
|
107
138
|
} catch (err) {
|
|
108
139
|
console.error('error saving', err); //eslint-disable-line no-console
|
|
109
140
|
}
|
|
110
141
|
}
|
|
111
142
|
|
|
112
|
-
_getShouldThreadAppSidebarOpen() {
|
|
113
|
-
return
|
|
143
|
+
_getShouldThreadAppSidebarOpen(): boolean {
|
|
144
|
+
return (
|
|
145
|
+
global.localStorage.getItem(
|
|
146
|
+
'inboxsdk__thread_app_sidebar_should_open'
|
|
147
|
+
) !== 'false'
|
|
148
|
+
);
|
|
114
149
|
}
|
|
115
|
-
|
|
150
|
+
|
|
151
|
+
_setShouldThreadAppSidebarOpen(open: boolean) {
|
|
116
152
|
try {
|
|
117
|
-
global.localStorage.setItem(
|
|
153
|
+
global.localStorage.setItem(
|
|
154
|
+
'inboxsdk__thread_app_sidebar_should_open',
|
|
155
|
+
String(open)
|
|
156
|
+
);
|
|
118
157
|
} catch (err) {
|
|
119
158
|
console.error('error saving', err); //eslint-disable-line no-console
|
|
120
159
|
}
|
|
121
160
|
}
|
|
122
161
|
|
|
123
|
-
_createThreadSidebarIfNeeded() {
|
|
162
|
+
_createThreadSidebarIfNeeded(): HTMLElement {
|
|
124
163
|
if (this._threadSidebarContainerEl) return this._threadSidebarContainerEl;
|
|
125
|
-
|
|
126
|
-
threadSidebarContainerEl
|
|
127
|
-
|
|
164
|
+
|
|
165
|
+
const threadSidebarContainerEl = (this._threadSidebarContainerEl =
|
|
166
|
+
document.createElement('div'));
|
|
167
|
+
threadSidebarContainerEl.classList.add(
|
|
168
|
+
'thread_app_sidebar',
|
|
169
|
+
idMap('app_sidebar_container'),
|
|
170
|
+
'addon_sidebar'
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
this._companionSidebarContentContainerEl.insertBefore(
|
|
174
|
+
threadSidebarContainerEl,
|
|
175
|
+
this._companionSidebarContentContainerEl.firstElementChild
|
|
176
|
+
);
|
|
177
|
+
|
|
128
178
|
this._containerProp = () => threadSidebarContainerEl;
|
|
129
179
|
|
|
130
180
|
// Kefir flow type def has wrong type for bufferWithTimeOrCount
|
|
131
|
-
this._updateHighlightedAppThreadIconBus
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
181
|
+
(this._updateHighlightedAppThreadIconBus: any)
|
|
182
|
+
.bufferWithTimeOrCount(150, 100)
|
|
183
|
+
.filter((events) => events.length > 0)
|
|
184
|
+
.takeUntilBy(this._stopper)
|
|
185
|
+
.onValue(() => {
|
|
186
|
+
// Before touching this code, make sure you understand the meaning of the clientRect
|
|
187
|
+
// values and of scrollTop. In particular, make sure you understand the distinction of
|
|
188
|
+
// absolute (the scroll[Top|Bottom|Height] values) vs relative (the BoundingRect top
|
|
189
|
+
// and bottom values) scroll values.
|
|
190
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect
|
|
191
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTop
|
|
192
|
+
|
|
193
|
+
const containerBoundingBox =
|
|
194
|
+
threadSidebarContainerEl.getBoundingClientRect();
|
|
195
|
+
const titleBars = Array.from(
|
|
196
|
+
threadSidebarContainerEl.querySelectorAll(
|
|
197
|
+
`.${idMap('app_sidebar_content_panel')}.${idMap(
|
|
198
|
+
'expanded'
|
|
199
|
+
)} .${idMap('app_sidebar_content_panel_top_line')}`
|
|
200
|
+
)
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
const absoluteScrollOfViewportTop = threadSidebarContainerEl.scrollTop;
|
|
204
|
+
const absoluteScrollOfViewportMidpoint =
|
|
205
|
+
absoluteScrollOfViewportTop + containerBoundingBox.height / 2;
|
|
206
|
+
|
|
207
|
+
let titleBar = titleBars.find((t) => {
|
|
208
|
+
const tBoundingBox = t.getBoundingClientRect();
|
|
151
209
|
|
|
152
|
-
// If titleBar is falsey then there isn't a title element in the top half of the viewport.
|
|
153
|
-
// In this case, find the first title element above the viewport.
|
|
154
|
-
if (!titleBar) {
|
|
155
|
-
// We make the assumption here that ordering of the elements in titleBars matches the
|
|
156
|
-
// ordering of how they appear in the sidebar (i.e. their ordering from top to bottom).
|
|
157
|
-
let lastElementAboveViewPort;
|
|
158
|
-
for (let i = 0; i < titleBars.length; i++) {
|
|
159
|
-
const tElement = titleBars[i];
|
|
160
|
-
const tBoundingBox = tElement.getBoundingClientRect();
|
|
161
210
|
const relativeScrollOfTitleBottom = tBoundingBox.bottom;
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
211
|
+
const absoluteScrollOfTitleBottom =
|
|
212
|
+
relativeScrollOfTitleBottom + absoluteScrollOfViewportTop;
|
|
213
|
+
|
|
214
|
+
// Return true for an element that is below the top of the viewport but above its midpoint
|
|
215
|
+
return (
|
|
216
|
+
absoluteScrollOfTitleBottom > absoluteScrollOfViewportTop &&
|
|
217
|
+
absoluteScrollOfTitleBottom < absoluteScrollOfViewportMidpoint
|
|
218
|
+
);
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
// If titleBar is falsey then there isn't a title element in the top half of the viewport.
|
|
222
|
+
// In this case, find the first title element above the viewport.
|
|
223
|
+
if (!titleBar) {
|
|
224
|
+
// We make the assumption here that ordering of the elements in titleBars matches the
|
|
225
|
+
// ordering of how they appear in the sidebar (i.e. their ordering from top to bottom).
|
|
226
|
+
let lastElementAboveViewPort;
|
|
227
|
+
for (let i = 0; i < titleBars.length; i++) {
|
|
228
|
+
const tElement = titleBars[i];
|
|
229
|
+
const tBoundingBox = tElement.getBoundingClientRect();
|
|
230
|
+
|
|
231
|
+
const relativeScrollOfTitleBottom = tBoundingBox.bottom;
|
|
232
|
+
if (relativeScrollOfTitleBottom < 0) {
|
|
233
|
+
lastElementAboveViewPort = tElement;
|
|
234
|
+
} else if (relativeScrollOfTitleBottom > 0) {
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
166
237
|
}
|
|
238
|
+
|
|
239
|
+
titleBar = lastElementAboveViewPort;
|
|
167
240
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
241
|
+
|
|
242
|
+
if (titleBar) {
|
|
243
|
+
const instanceId = titleBar.getAttribute('data-instance-id');
|
|
244
|
+
const appName = titleBar.getAttribute('data-app-name');
|
|
245
|
+
if (!appName) return;
|
|
246
|
+
const appButton = this._threadButtonContainers.get(appName);
|
|
247
|
+
if (!appButton || !this._threadIconArea) return;
|
|
248
|
+
|
|
249
|
+
const activeButtonContainer = this._threadIconArea.querySelector(
|
|
250
|
+
'.sidebar_button_container_active'
|
|
251
|
+
);
|
|
252
|
+
if (activeButtonContainer) {
|
|
253
|
+
activeButtonContainer.classList.remove(
|
|
254
|
+
'sidebar_button_container_active'
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
appButton.classList.add('sidebar_button_container_active');
|
|
179
259
|
}
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
});
|
|
260
|
+
});
|
|
183
261
|
|
|
184
262
|
//listen for scroll and update active icon if needed
|
|
185
|
-
this._updateHighlightedAppThreadIconBus.plug(
|
|
263
|
+
this._updateHighlightedAppThreadIconBus.plug(
|
|
264
|
+
Kefir.fromEvents(threadSidebarContainerEl, 'scroll').map(() => null)
|
|
265
|
+
);
|
|
186
266
|
|
|
187
267
|
// handle rendering thread sidebar contents
|
|
188
268
|
this._renderThreadSidebar();
|
|
189
269
|
return threadSidebarContainerEl;
|
|
190
270
|
}
|
|
271
|
+
|
|
191
272
|
_renderThreadSidebarIfPresent() {
|
|
192
273
|
if (!this._threadSidebarContainerEl) {
|
|
193
274
|
return;
|
|
194
275
|
}
|
|
195
276
|
this._renderThreadSidebar();
|
|
196
277
|
}
|
|
197
|
-
|
|
278
|
+
|
|
279
|
+
_appSidebarRefSetter: (el: ?AppSidebar) => void = (
|
|
280
|
+
threadSidebarComponent
|
|
281
|
+
) => {
|
|
282
|
+
if (threadSidebarComponent) {
|
|
283
|
+
this._threadSidebarComponent = threadSidebarComponent;
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
_renderThreadSidebar(): Promise<AppSidebar> {
|
|
198
288
|
const threadSidebarContainerEl = this._threadSidebarContainerEl;
|
|
199
289
|
if (!threadSidebarContainerEl) {
|
|
200
|
-
throw new Error(
|
|
290
|
+
throw new Error(
|
|
291
|
+
'_renderThreadSidebar should not be called when _threadSidebarContainerEl is unset'
|
|
292
|
+
);
|
|
201
293
|
}
|
|
202
|
-
return new Promise(resolve => {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
294
|
+
return new Promise((resolve) => {
|
|
295
|
+
ReactDOM.render(
|
|
296
|
+
<AppSidebar
|
|
297
|
+
ref={this._appSidebarRefSetter}
|
|
298
|
+
panels={this._orderManager.getOrderedItems().map((x) => x.value)}
|
|
299
|
+
onMoveEnd={(newList, movedItem, oldIndex, newIndex) => {
|
|
300
|
+
this._orderManager.moveItem(oldIndex, newIndex);
|
|
301
|
+
this._renderThreadSidebar();
|
|
302
|
+
}}
|
|
303
|
+
onExpandedToggle={() => {
|
|
304
|
+
this._updateHighlightedAppThreadIconBus.emit(null);
|
|
305
|
+
}}
|
|
306
|
+
container={this._containerProp}
|
|
307
|
+
/>,
|
|
308
|
+
threadSidebarContainerEl,
|
|
309
|
+
() => {
|
|
310
|
+
if (!this._threadSidebarComponent) {
|
|
311
|
+
throw new Error('Should not happen');
|
|
312
|
+
}
|
|
313
|
+
resolve(this._threadSidebarComponent);
|
|
211
314
|
this._updateHighlightedAppThreadIconBus.emit(null);
|
|
212
|
-
},
|
|
213
|
-
container: this._containerProp
|
|
214
|
-
}), threadSidebarContainerEl, () => {
|
|
215
|
-
if (!this._threadSidebarComponent) {
|
|
216
|
-
throw new Error('Should not happen');
|
|
217
315
|
}
|
|
218
|
-
|
|
219
|
-
this._updateHighlightedAppThreadIconBus.emit(null);
|
|
220
|
-
});
|
|
316
|
+
);
|
|
221
317
|
});
|
|
222
318
|
}
|
|
223
|
-
|
|
319
|
+
|
|
320
|
+
_getActiveButtonContainer(): ?HTMLElement {
|
|
224
321
|
let activeButtonContainer;
|
|
225
322
|
if (this._globalIconArea) {
|
|
226
|
-
activeButtonContainer = this._globalIconArea.querySelector(
|
|
323
|
+
activeButtonContainer = this._globalIconArea.querySelector(
|
|
324
|
+
'.sidebar_button_container_active'
|
|
325
|
+
);
|
|
227
326
|
}
|
|
228
327
|
if (!activeButtonContainer && this._threadIconArea) {
|
|
229
|
-
activeButtonContainer = this._threadIconArea.querySelector(
|
|
328
|
+
activeButtonContainer = this._threadIconArea.querySelector(
|
|
329
|
+
'.sidebar_button_container_active'
|
|
330
|
+
);
|
|
230
331
|
}
|
|
231
332
|
return activeButtonContainer;
|
|
232
333
|
}
|
|
233
|
-
|
|
234
|
-
|
|
334
|
+
|
|
335
|
+
_closeButton: ?(userClick: boolean) => void = null;
|
|
336
|
+
|
|
337
|
+
_addButton(iconArea: HTMLElement, event: Object, isGlobal: boolean) {
|
|
235
338
|
// we put adding the content panel icon in the iconArea in an asap so that we
|
|
236
339
|
// get consistent ordering. The ordering of the icons is based on the position of the FIRST
|
|
237
340
|
// panel with that app name. This means we need to wait for all the panels for a particular appName
|
|
238
341
|
// to be added first, and then we can get the correct position
|
|
239
|
-
(
|
|
342
|
+
asap(() => {
|
|
240
343
|
if (!iconArea) throw new Error('should not happen');
|
|
344
|
+
|
|
241
345
|
const instanceId = event.detail.instanceId;
|
|
242
|
-
const iconUrl =
|
|
346
|
+
const iconUrl =
|
|
347
|
+
isGlobal && event.detail.iconUrl
|
|
348
|
+
? event.detail.iconUrl
|
|
349
|
+
: event.detail.appIconUrl;
|
|
243
350
|
const appName = event.detail.appName;
|
|
244
351
|
const iconClass = event.detail.iconClass || '';
|
|
245
352
|
|
|
246
353
|
// If there's an existing button for the app, then just increment its
|
|
247
354
|
// data-count attribute instead of adding a new button.
|
|
248
|
-
const existingButtonContainer = isGlobal
|
|
355
|
+
const existingButtonContainer = isGlobal
|
|
356
|
+
? this._globalButtonContainers.get(appName)
|
|
357
|
+
: this._threadButtonContainers.get(appName);
|
|
358
|
+
|
|
249
359
|
let buttonContainer;
|
|
250
360
|
if (existingButtonContainer) {
|
|
251
|
-
const currentCount =
|
|
252
|
-
|
|
361
|
+
const currentCount =
|
|
362
|
+
Number(existingButtonContainer.getAttribute('data-count')) || 1;
|
|
363
|
+
existingButtonContainer.setAttribute(
|
|
364
|
+
'data-count',
|
|
365
|
+
String(currentCount + 1)
|
|
366
|
+
);
|
|
253
367
|
buttonContainer = existingButtonContainer;
|
|
254
368
|
} else {
|
|
255
369
|
buttonContainer = document.createElement('div');
|
|
256
|
-
buttonContainer.className = (
|
|
370
|
+
buttonContainer.className = idMap('sidebar_button_container');
|
|
257
371
|
buttonContainer.setAttribute('data-app-name', appName);
|
|
258
|
-
buttonContainer.innerHTML =
|
|
372
|
+
buttonContainer.innerHTML = autoHtml`
|
|
259
373
|
<button class="inboxsdk__button_icon ${iconClass}" type="button" data-tooltip="${appName}">
|
|
260
374
|
<img class="inboxsdk__button_iconImg" src="${iconUrl}">
|
|
261
375
|
</button>
|
|
262
376
|
<div class="inboxsdk__button_selectedIndicator"></div>
|
|
263
377
|
`;
|
|
378
|
+
|
|
264
379
|
if (event.detail.primaryColor) {
|
|
265
|
-
(
|
|
380
|
+
querySelector(
|
|
381
|
+
buttonContainer,
|
|
382
|
+
'.inboxsdk__button_selectedIndicator'
|
|
383
|
+
).style.backgroundColor = event.detail.primaryColor;
|
|
266
384
|
}
|
|
385
|
+
|
|
267
386
|
if (isGlobal) {
|
|
268
387
|
this._globalButtonContainers.set(appName, buttonContainer);
|
|
269
388
|
} else {
|
|
270
389
|
this._threadButtonContainers.set(appName, buttonContainer);
|
|
271
390
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
const activeButtonContainer =
|
|
391
|
+
|
|
392
|
+
const activate = (dontScrollIntoView = false) => {
|
|
393
|
+
const activeButtonContainer = this._getActiveButtonContainer();
|
|
394
|
+
|
|
275
395
|
if (activeButtonContainer === buttonContainer) {
|
|
276
396
|
// button was clicked while its panel was open, so close it.
|
|
277
|
-
if (!
|
|
278
|
-
|
|
397
|
+
if (!this._closeButton) throw new Error();
|
|
398
|
+
this._closeButton(true);
|
|
279
399
|
} else {
|
|
280
400
|
// button was clicked while its own panel wasn't open, so open it.
|
|
281
401
|
|
|
282
|
-
if (
|
|
283
|
-
|
|
402
|
+
if (this._closeButton) {
|
|
403
|
+
this._closeButton(true);
|
|
284
404
|
}
|
|
285
|
-
|
|
286
|
-
|
|
405
|
+
|
|
406
|
+
if (isGlobal) this._setShouldGlobalAppSidebarOpen(true);
|
|
407
|
+
else this._setShouldThreadAppSidebarOpen(true);
|
|
408
|
+
|
|
409
|
+
this._openSidebarAndActivateButton(buttonContainer, isGlobal);
|
|
410
|
+
|
|
287
411
|
if (isGlobal) {
|
|
288
|
-
const contentEl =
|
|
412
|
+
const contentEl = this._contentContainers.get(appName);
|
|
289
413
|
if (contentEl) contentEl.style.display = '';
|
|
290
|
-
|
|
414
|
+
this._companionSidebarContentContainerEl.classList.add(
|
|
415
|
+
'companion_global_app_sidebar_visible'
|
|
416
|
+
);
|
|
291
417
|
|
|
292
418
|
// let app listen for activate event
|
|
293
|
-
document.body.dispatchEvent(
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
instanceId
|
|
298
|
-
}
|
|
299
|
-
|
|
419
|
+
((document.body: any): HTMLElement).dispatchEvent(
|
|
420
|
+
new CustomEvent('inboxsdkSidebarPanelActivated', {
|
|
421
|
+
bubbles: true,
|
|
422
|
+
cancelable: false,
|
|
423
|
+
detail: { instanceId },
|
|
424
|
+
})
|
|
425
|
+
);
|
|
300
426
|
} else {
|
|
301
|
-
const threadSidebarComponent =
|
|
427
|
+
const threadSidebarComponent = this._threadSidebarComponent;
|
|
302
428
|
if (!threadSidebarComponent) {
|
|
303
429
|
throw new Error('sidebar not mounted');
|
|
304
430
|
}
|
|
@@ -307,45 +433,58 @@ class GmailAppSidebarPrimary {
|
|
|
307
433
|
threadSidebarComponent.scrollPanelIntoView(instanceId, true);
|
|
308
434
|
}
|
|
309
435
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
436
|
+
|
|
437
|
+
this._closeButton = (userClick: boolean) => {
|
|
438
|
+
this._closeButton = null;
|
|
439
|
+
|
|
440
|
+
const activeButtonContainer = this._getActiveButtonContainer();
|
|
313
441
|
if (!activeButtonContainer) {
|
|
314
442
|
throw new Error('Expected activeButtonContainer');
|
|
315
443
|
}
|
|
316
|
-
|
|
444
|
+
this._closeSidebarAndDeactivateButton(activeButtonContainer);
|
|
445
|
+
|
|
317
446
|
if (isGlobal) {
|
|
318
|
-
if (userClick)
|
|
319
|
-
|
|
447
|
+
if (userClick) this._setShouldGlobalAppSidebarOpen(false);
|
|
448
|
+
|
|
449
|
+
const contentEl = this._contentContainers.get(appName);
|
|
320
450
|
if (contentEl) {
|
|
321
451
|
contentEl.style.display = 'none';
|
|
322
452
|
} else {
|
|
323
|
-
|
|
453
|
+
this._driver
|
|
454
|
+
.getLogger()
|
|
455
|
+
.error(new Error('Unexpected: contentEl not set'));
|
|
324
456
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
457
|
+
|
|
458
|
+
((document.body: any): HTMLElement).dispatchEvent(
|
|
459
|
+
new CustomEvent('inboxsdkSidebarPanelDeactivated', {
|
|
460
|
+
bubbles: true,
|
|
461
|
+
cancelable: false,
|
|
462
|
+
detail: { instanceId },
|
|
463
|
+
})
|
|
464
|
+
);
|
|
332
465
|
} else {
|
|
333
|
-
if (userClick)
|
|
466
|
+
if (userClick) this._setShouldThreadAppSidebarOpen(false);
|
|
334
467
|
}
|
|
335
468
|
//fake a window resize after closing so gmail fixes any heights that are messed up
|
|
336
|
-
(
|
|
469
|
+
fakeWindowResize();
|
|
337
470
|
};
|
|
338
471
|
|
|
339
472
|
//fake a window resize after opening so gmail fixes any heights that are messed up
|
|
340
|
-
(
|
|
473
|
+
fakeWindowResize();
|
|
341
474
|
}
|
|
342
475
|
};
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
476
|
+
|
|
477
|
+
querySelector(buttonContainer, 'button').addEventListener(
|
|
478
|
+
'click',
|
|
479
|
+
(event: MouseEvent) => {
|
|
480
|
+
event.stopPropagation();
|
|
481
|
+
activate();
|
|
482
|
+
},
|
|
483
|
+
true
|
|
484
|
+
);
|
|
485
|
+
|
|
347
486
|
if (iconArea) {
|
|
348
|
-
(
|
|
487
|
+
addToIconArea(this._orderManager, appName, buttonContainer, iconArea);
|
|
349
488
|
}
|
|
350
489
|
|
|
351
490
|
// if we last had an SDK sidebar open then bring up the SDK sidebar when the first
|
|
@@ -354,14 +493,20 @@ class GmailAppSidebarPrimary {
|
|
|
354
493
|
const activeButtonContainer = this._getActiveButtonContainer();
|
|
355
494
|
if (isGlobal) {
|
|
356
495
|
if (this._getShouldGlobalAppSidebarOpen()) {
|
|
357
|
-
const activeButtonContainerPresentAndIsForGlobal =
|
|
496
|
+
const activeButtonContainerPresentAndIsForGlobal =
|
|
497
|
+
this._globalIconArea &&
|
|
498
|
+
activeButtonContainer &&
|
|
499
|
+
this._globalIconArea.contains(activeButtonContainer);
|
|
358
500
|
if (!activeButtonContainerPresentAndIsForGlobal) {
|
|
359
501
|
activate(true);
|
|
360
502
|
}
|
|
361
503
|
}
|
|
362
504
|
} else {
|
|
363
505
|
if (this._getShouldThreadAppSidebarOpen()) {
|
|
364
|
-
const activeButtonContainerPresentAndIsForThread =
|
|
506
|
+
const activeButtonContainerPresentAndIsForThread =
|
|
507
|
+
this._threadIconArea &&
|
|
508
|
+
activeButtonContainer &&
|
|
509
|
+
this._threadIconArea.contains(activeButtonContainer);
|
|
365
510
|
if (!activeButtonContainerPresentAndIsForThread) {
|
|
366
511
|
activate(true);
|
|
367
512
|
}
|
|
@@ -371,22 +516,42 @@ class GmailAppSidebarPrimary {
|
|
|
371
516
|
}
|
|
372
517
|
});
|
|
373
518
|
}
|
|
374
|
-
|
|
519
|
+
|
|
520
|
+
_removeButton(
|
|
521
|
+
event: Object,
|
|
522
|
+
buttonContainers: Map<string, HTMLElement>,
|
|
523
|
+
iconArea: ?HTMLElement
|
|
524
|
+
) {
|
|
375
525
|
const appName = event.detail.appName;
|
|
526
|
+
|
|
376
527
|
const container = buttonContainers.get(appName);
|
|
377
528
|
if (!iconArea || !container) {
|
|
378
|
-
throw new Error(
|
|
529
|
+
throw new Error(
|
|
530
|
+
'should not happen: tried to remove button without container or iconArea'
|
|
531
|
+
);
|
|
379
532
|
}
|
|
533
|
+
|
|
380
534
|
const currentCount = Number(container.getAttribute('data-count'));
|
|
381
535
|
if (currentCount <= 1) {
|
|
382
|
-
const activeButtonContainer = iconArea.querySelector(
|
|
536
|
+
const activeButtonContainer = iconArea.querySelector(
|
|
537
|
+
'.sidebar_button_container_active'
|
|
538
|
+
);
|
|
383
539
|
if (container === activeButtonContainer) {
|
|
384
540
|
if (!this._closeButton) throw new Error();
|
|
385
541
|
this._closeButton(false);
|
|
386
|
-
|
|
387
|
-
this.
|
|
388
|
-
|
|
389
|
-
|
|
542
|
+
|
|
543
|
+
this._companionSidebarOuterWrapper.classList.remove(
|
|
544
|
+
'companion_app_sidebar_wrapper_visible'
|
|
545
|
+
);
|
|
546
|
+
this._companionSidebarContentContainerEl.classList.remove(
|
|
547
|
+
'companion_app_sidebar_visible'
|
|
548
|
+
);
|
|
549
|
+
const contentContainer =
|
|
550
|
+
this._companionSidebarOuterWrapper.previousElementSibling;
|
|
551
|
+
if (contentContainer)
|
|
552
|
+
contentContainer.classList.remove(
|
|
553
|
+
'companion_container_app_sidebar_visible'
|
|
554
|
+
);
|
|
390
555
|
}
|
|
391
556
|
container.remove();
|
|
392
557
|
buttonContainers.delete(appName);
|
|
@@ -396,17 +561,39 @@ class GmailAppSidebarPrimary {
|
|
|
396
561
|
container.setAttribute('data-count', String(currentCount - 1));
|
|
397
562
|
}
|
|
398
563
|
}
|
|
399
|
-
|
|
564
|
+
|
|
565
|
+
_closeSidebarAndDeactivateButton(activeButtonContainer: HTMLElement) {
|
|
400
566
|
activeButtonContainer.classList.remove('sidebar_button_container_active');
|
|
401
|
-
this._companionSidebarOuterWrapper.classList.remove(
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
567
|
+
this._companionSidebarOuterWrapper.classList.remove(
|
|
568
|
+
'companion_app_sidebar_wrapper_visible'
|
|
569
|
+
);
|
|
570
|
+
this._companionSidebarContentContainerEl.classList.add(
|
|
571
|
+
COMPANION_SIDEBAR_CONTENT_CLOSED_SHADOW_CLASS
|
|
572
|
+
);
|
|
573
|
+
this._companionSidebarContentContainerEl.classList.remove(
|
|
574
|
+
'companion_app_sidebar_visible',
|
|
575
|
+
'companion_global_app_sidebar_visible'
|
|
576
|
+
);
|
|
577
|
+
|
|
578
|
+
const contentContainer =
|
|
579
|
+
this._companionSidebarOuterWrapper.previousElementSibling;
|
|
580
|
+
if (contentContainer)
|
|
581
|
+
contentContainer.classList.remove(
|
|
582
|
+
'companion_container_app_sidebar_visible'
|
|
583
|
+
);
|
|
406
584
|
}
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
585
|
+
|
|
586
|
+
_openSidebarAndActivateButton(
|
|
587
|
+
buttonContainer: HTMLElement,
|
|
588
|
+
isGlobal: boolean
|
|
589
|
+
) {
|
|
590
|
+
const companionSidebarIconContainerEl =
|
|
591
|
+
GmailElementGetter.getCompanionSidebarIconContainerElement();
|
|
592
|
+
if (!companionSidebarIconContainerEl)
|
|
593
|
+
throw new Error(
|
|
594
|
+
'Could not find companion sidebar icon container element'
|
|
595
|
+
);
|
|
596
|
+
|
|
410
597
|
const activeButtonContainer = this._getActiveButtonContainer();
|
|
411
598
|
if (activeButtonContainer) {
|
|
412
599
|
throw new Error('activeButtonContainer should not be true');
|
|
@@ -415,203 +602,407 @@ class GmailAppSidebarPrimary {
|
|
|
415
602
|
|
|
416
603
|
{
|
|
417
604
|
// If a gmail addon is active, close it.
|
|
418
|
-
const nativeActiveAddOnIcon =
|
|
605
|
+
const nativeActiveAddOnIcon =
|
|
606
|
+
companionSidebarIconContainerEl.querySelector(
|
|
607
|
+
ACTIVE_ADD_ON_ICON_SELECTOR
|
|
608
|
+
);
|
|
419
609
|
if (nativeActiveAddOnIcon) {
|
|
420
|
-
|
|
610
|
+
simulateClick(nativeActiveAddOnIcon);
|
|
421
611
|
}
|
|
422
612
|
}
|
|
613
|
+
|
|
423
614
|
buttonContainer.classList.add('sidebar_button_container_active');
|
|
424
|
-
this._companionSidebarOuterWrapper.classList.add(
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
615
|
+
this._companionSidebarOuterWrapper.classList.add(
|
|
616
|
+
'companion_app_sidebar_wrapper_visible'
|
|
617
|
+
);
|
|
618
|
+
this._companionSidebarContentContainerEl.classList.add(
|
|
619
|
+
'companion_app_sidebar_visible'
|
|
620
|
+
);
|
|
621
|
+
this._companionSidebarContentContainerEl.classList.remove(
|
|
622
|
+
COMPANION_SIDEBAR_CONTENT_CLOSED_SHADOW_CLASS
|
|
623
|
+
);
|
|
624
|
+
|
|
625
|
+
const contentContainer =
|
|
626
|
+
this._companionSidebarOuterWrapper.previousElementSibling;
|
|
627
|
+
if (contentContainer)
|
|
628
|
+
contentContainer.classList.add('companion_container_app_sidebar_visible');
|
|
629
|
+
if (isGlobal)
|
|
630
|
+
this._companionSidebarContentContainerEl.classList.add(
|
|
631
|
+
'companion_global_app_sidebar_visible'
|
|
632
|
+
);
|
|
430
633
|
}
|
|
634
|
+
|
|
431
635
|
_setupElement() {
|
|
432
|
-
const companionSidebarIconContainerEl =
|
|
433
|
-
|
|
434
|
-
|
|
636
|
+
const companionSidebarIconContainerEl =
|
|
637
|
+
GmailElementGetter.getCompanionSidebarIconContainerElement();
|
|
638
|
+
if (!companionSidebarIconContainerEl)
|
|
639
|
+
throw new Error(
|
|
640
|
+
'Could not find companion sidebar icon container element'
|
|
641
|
+
);
|
|
642
|
+
|
|
643
|
+
this._companionSidebarContentContainerEl.setAttribute(
|
|
644
|
+
'data-sdk-sidebar-instance-id',
|
|
645
|
+
this._instanceId
|
|
646
|
+
);
|
|
435
647
|
|
|
436
648
|
// TODO: Once the changes to the GMail DOM have been entirely ramped, drop the ternary here and
|
|
437
649
|
// always get the parentElement. (Jun 20, 2018)
|
|
438
|
-
this._companionSidebarOuterWrapper =
|
|
650
|
+
this._companionSidebarOuterWrapper =
|
|
651
|
+
this._companionSidebarContentContainerEl.classList.contains('bq9')
|
|
652
|
+
? this._companionSidebarContentContainerEl
|
|
653
|
+
: (this._companionSidebarContentContainerEl.parentElement: any);
|
|
654
|
+
|
|
439
655
|
if (!this._companionSidebarOuterWrapper) {
|
|
440
|
-
throw new Error(
|
|
656
|
+
throw new Error(
|
|
657
|
+
'should not happen: failed to find companionSidebarOuterWrapper'
|
|
658
|
+
);
|
|
441
659
|
}
|
|
442
|
-
|
|
660
|
+
|
|
661
|
+
const contentContainer =
|
|
662
|
+
this._companionSidebarOuterWrapper.previousElementSibling;
|
|
443
663
|
if (contentContainer) {
|
|
444
|
-
contentContainer.classList.add(
|
|
664
|
+
contentContainer.classList.add(
|
|
665
|
+
idMap('companion_container_app_sidebar_in_use')
|
|
666
|
+
);
|
|
445
667
|
}
|
|
446
|
-
this._companionSidebarContentContainerEl.classList.add(
|
|
447
|
-
|
|
668
|
+
this._companionSidebarContentContainerEl.classList.add(
|
|
669
|
+
idMap('app_sidebar_in_use')
|
|
670
|
+
);
|
|
671
|
+
|
|
672
|
+
if (
|
|
673
|
+
!((document.body: any): HTMLElement).querySelector(
|
|
674
|
+
'.' + idMap('app_sidebar_waiting_platform')
|
|
675
|
+
)
|
|
676
|
+
) {
|
|
448
677
|
const waitingPlatform = document.createElement('div');
|
|
449
|
-
waitingPlatform.className = (
|
|
450
|
-
document.body.appendChild(waitingPlatform);
|
|
678
|
+
waitingPlatform.className = idMap('app_sidebar_waiting_platform');
|
|
679
|
+
((document.body: any): HTMLElement).appendChild(waitingPlatform);
|
|
451
680
|
}
|
|
452
681
|
|
|
453
682
|
// thread sidebar content panels
|
|
454
683
|
{
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
this.
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
this.
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
684
|
+
Kefir.fromEvents(window, 'storage')
|
|
685
|
+
.filter((e) => e.key === 'inboxsdk__sidebar_ordering')
|
|
686
|
+
.takeUntilBy(this._stopper)
|
|
687
|
+
.onValue(() => {
|
|
688
|
+
this._orderManager.reload();
|
|
689
|
+
this._renderThreadSidebarIfPresent();
|
|
690
|
+
});
|
|
691
|
+
|
|
692
|
+
Kefir.fromEvents((document.body: any), 'inboxsdkNewSidebarPanel')
|
|
693
|
+
.filter(
|
|
694
|
+
(e) => e.detail.sidebarId === this._instanceId && !e.detail.isGlobal
|
|
695
|
+
)
|
|
696
|
+
.takeUntilBy(this._stopper)
|
|
697
|
+
.onValue((event) => {
|
|
698
|
+
this._createThreadSidebarIfNeeded();
|
|
699
|
+
let id = event.detail.id;
|
|
700
|
+
while (this._currentIds.has(id)) {
|
|
701
|
+
id = incrementName(id);
|
|
702
|
+
}
|
|
703
|
+
this._currentIds.add(id);
|
|
704
|
+
|
|
705
|
+
const appName = event.detail.appName;
|
|
706
|
+
this._orderManager.addItem({
|
|
707
|
+
groupId: event.detail.appId,
|
|
472
708
|
id,
|
|
473
|
-
|
|
709
|
+
orderHint: event.detail.orderHint,
|
|
710
|
+
value: {
|
|
711
|
+
id,
|
|
712
|
+
appName,
|
|
713
|
+
appId: event.detail.appId,
|
|
714
|
+
instanceId: event.detail.instanceId,
|
|
715
|
+
title: event.detail.title,
|
|
716
|
+
iconClass: event.detail.iconClass,
|
|
717
|
+
iconUrl: event.detail.iconUrl,
|
|
718
|
+
hideTitleBar: event.detail.hideTitleBar,
|
|
719
|
+
el: event.target,
|
|
720
|
+
},
|
|
721
|
+
});
|
|
722
|
+
this._renderThreadSidebar();
|
|
723
|
+
|
|
724
|
+
let threadIconArea = (this._threadIconArea =
|
|
725
|
+
companionSidebarIconContainerEl.querySelector(
|
|
726
|
+
'.sidebar_thread_iconArea'
|
|
727
|
+
));
|
|
728
|
+
if (!threadIconArea) {
|
|
729
|
+
threadIconArea = this._threadIconArea =
|
|
730
|
+
document.createElement('div');
|
|
731
|
+
threadIconArea.className = idMap('sidebar_iconArea');
|
|
732
|
+
threadIconArea.classList.add('sidebar_thread_iconArea');
|
|
733
|
+
addCompanionThreadIconArea(
|
|
734
|
+
this._driver.getLogger(),
|
|
735
|
+
threadIconArea,
|
|
736
|
+
companionSidebarIconContainerEl
|
|
737
|
+
);
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
this._addButton(threadIconArea, event, false);
|
|
741
|
+
});
|
|
742
|
+
|
|
743
|
+
Kefir.fromEvents((document.body: any), 'inboxsdkUpdateSidebarPanel')
|
|
744
|
+
.filter(
|
|
745
|
+
(e) => e.detail.sidebarId === this._instanceId && !e.detail.isGlobal
|
|
746
|
+
)
|
|
747
|
+
.takeUntilBy(this._stopper)
|
|
748
|
+
.onValue((event) => {
|
|
749
|
+
const orderedItems = this._orderManager.getOrderedItems();
|
|
750
|
+
const index = findIndex(
|
|
751
|
+
orderedItems,
|
|
752
|
+
(x) => x.value.instanceId === event.detail.instanceId
|
|
753
|
+
);
|
|
754
|
+
if (index === -1)
|
|
755
|
+
throw new Error('should not happen: failed to find orderItem');
|
|
756
|
+
this._orderManager.updateItemValueByIndex(index, {
|
|
757
|
+
id: orderedItems[index].value.id,
|
|
474
758
|
appId: event.detail.appId,
|
|
759
|
+
appName: event.detail.appName || event.detail.title,
|
|
475
760
|
instanceId: event.detail.instanceId,
|
|
476
761
|
title: event.detail.title,
|
|
477
762
|
iconClass: event.detail.iconClass,
|
|
478
763
|
iconUrl: event.detail.iconUrl,
|
|
479
764
|
hideTitleBar: event.detail.hideTitleBar,
|
|
480
|
-
el: event.target
|
|
765
|
+
el: event.target,
|
|
766
|
+
});
|
|
767
|
+
this._renderThreadSidebar();
|
|
768
|
+
});
|
|
769
|
+
|
|
770
|
+
Kefir.fromEvents((document.body: any), 'inboxsdkRemoveSidebarPanel')
|
|
771
|
+
.filter(
|
|
772
|
+
(e) => e.detail.sidebarId === this._instanceId && !e.detail.isGlobal
|
|
773
|
+
)
|
|
774
|
+
.takeUntilBy(this._stopper)
|
|
775
|
+
.onValue((event) => {
|
|
776
|
+
const orderedItems = this._orderManager.getOrderedItems();
|
|
777
|
+
const index = findIndex(
|
|
778
|
+
orderedItems,
|
|
779
|
+
(x) => x.value.instanceId === event.detail.instanceId
|
|
780
|
+
);
|
|
781
|
+
if (index === -1)
|
|
782
|
+
throw new Error('should not happen: failed to find orderItem');
|
|
783
|
+
this._currentIds.delete(orderedItems[index].id);
|
|
784
|
+
this._orderManager.removeItemByIndex(index);
|
|
785
|
+
|
|
786
|
+
this._renderThreadSidebar();
|
|
787
|
+
this._removeButton(
|
|
788
|
+
event,
|
|
789
|
+
this._threadButtonContainers,
|
|
790
|
+
this._threadIconArea
|
|
791
|
+
);
|
|
792
|
+
});
|
|
793
|
+
|
|
794
|
+
Kefir.fromEvents(
|
|
795
|
+
(document.body: any),
|
|
796
|
+
'inboxsdkSidebarPanelScrollIntoView'
|
|
797
|
+
)
|
|
798
|
+
.filter(
|
|
799
|
+
(e) => e.detail.sidebarId === this._instanceId && !e.detail.isGlobal
|
|
800
|
+
)
|
|
801
|
+
.takeUntilBy(this._stopper)
|
|
802
|
+
.onValue((event) => {
|
|
803
|
+
if (this._threadSidebarComponent)
|
|
804
|
+
this._threadSidebarComponent.scrollPanelIntoView(
|
|
805
|
+
event.detail.instanceId
|
|
806
|
+
);
|
|
807
|
+
});
|
|
808
|
+
|
|
809
|
+
Kefir.fromEvents((document.body: any), 'inboxsdkSidebarPanelClose')
|
|
810
|
+
.filter(
|
|
811
|
+
(e) => e.detail.sidebarId === this._instanceId && !e.detail.isGlobal
|
|
812
|
+
)
|
|
813
|
+
.takeUntilBy(this._stopper)
|
|
814
|
+
.onValue((event) => {
|
|
815
|
+
if (this._threadSidebarComponent)
|
|
816
|
+
this._threadSidebarComponent.closePanel(event.detail.instanceId);
|
|
817
|
+
});
|
|
818
|
+
|
|
819
|
+
Kefir.fromEvents((document.body: any), 'inboxsdkSidebarPanelOpen')
|
|
820
|
+
.filter(
|
|
821
|
+
(e) => e.detail.sidebarId === this._instanceId && !e.detail.isGlobal
|
|
822
|
+
)
|
|
823
|
+
.takeUntilBy(this._stopper)
|
|
824
|
+
.onValue((e) => {
|
|
825
|
+
this._renderThreadSidebar().then((threadSidebarComponent) => {
|
|
826
|
+
const descriptor = this._instanceIdsToDescriptors.get(
|
|
827
|
+
e.detail.instanceId
|
|
828
|
+
);
|
|
829
|
+
if (!descriptor) return;
|
|
830
|
+
|
|
831
|
+
const buttonContainer = this._threadButtonContainers.get(
|
|
832
|
+
descriptor.appName
|
|
833
|
+
);
|
|
834
|
+
if (!buttonContainer) {
|
|
835
|
+
throw new Error('missing button container');
|
|
836
|
+
}
|
|
837
|
+
const activeButtonContainer = this._getActiveButtonContainer();
|
|
838
|
+
if (activeButtonContainer !== buttonContainer) {
|
|
839
|
+
querySelector(buttonContainer, 'button').click();
|
|
840
|
+
}
|
|
841
|
+
});
|
|
842
|
+
});
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
// global sidebar content panels
|
|
846
|
+
{
|
|
847
|
+
Kefir.fromEvents((document.body: any), 'inboxsdkNewSidebarPanel')
|
|
848
|
+
.filter(
|
|
849
|
+
(e) => e.detail.sidebarId === this._instanceId && e.detail.isGlobal
|
|
850
|
+
)
|
|
851
|
+
.takeUntilBy(this._stopper)
|
|
852
|
+
.onValue((event) => {
|
|
853
|
+
let id = event.detail.id;
|
|
854
|
+
while (this._currentIds.has(id)) {
|
|
855
|
+
id = incrementName(id);
|
|
481
856
|
}
|
|
857
|
+
this._currentIds.add(id);
|
|
858
|
+
|
|
859
|
+
const appName = event.detail.appName;
|
|
860
|
+
|
|
861
|
+
let globalIconArea = (this._globalIconArea =
|
|
862
|
+
companionSidebarIconContainerEl.querySelector(
|
|
863
|
+
'.sidebar_global_iconArea'
|
|
864
|
+
));
|
|
865
|
+
if (!globalIconArea) {
|
|
866
|
+
globalIconArea = this._globalIconArea =
|
|
867
|
+
document.createElement('div');
|
|
868
|
+
globalIconArea.className = idMap('sidebar_iconArea');
|
|
869
|
+
globalIconArea.classList.add('sidebar_global_iconArea');
|
|
870
|
+
addCompanionGlobalIconArea(
|
|
871
|
+
this._driver.getLogger(),
|
|
872
|
+
globalIconArea,
|
|
873
|
+
companionSidebarIconContainerEl
|
|
874
|
+
);
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
const sdkContentContainerEl = document.createElement('div');
|
|
878
|
+
sdkContentContainerEl.classList.add(
|
|
879
|
+
'addon_sidebar',
|
|
880
|
+
idMap('app_sidebar_container'),
|
|
881
|
+
'global_app_sidebar'
|
|
882
|
+
);
|
|
883
|
+
this._companionSidebarContentContainerEl.insertAdjacentElement(
|
|
884
|
+
'afterbegin',
|
|
885
|
+
sdkContentContainerEl
|
|
886
|
+
);
|
|
887
|
+
this._contentContainers.set(appName, sdkContentContainerEl);
|
|
888
|
+
|
|
889
|
+
sdkContentContainerEl.appendChild(event.target);
|
|
890
|
+
sdkContentContainerEl.style.display = 'none';
|
|
891
|
+
|
|
892
|
+
this._addButton(globalIconArea, event, true);
|
|
482
893
|
});
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
iconClass: event.detail.iconClass,
|
|
504
|
-
iconUrl: event.detail.iconUrl,
|
|
505
|
-
hideTitleBar: event.detail.hideTitleBar,
|
|
506
|
-
el: event.target
|
|
894
|
+
|
|
895
|
+
Kefir.fromEvents((document.body: any), 'inboxsdkUpdateSidebarPanel')
|
|
896
|
+
.filter(
|
|
897
|
+
(e) => e.detail.sidebarId === this._instanceId && e.detail.isGlobal
|
|
898
|
+
)
|
|
899
|
+
.takeUntilBy(this._stopper)
|
|
900
|
+
.onValue((event) => {
|
|
901
|
+
const buttonContainer = this._globalButtonContainers.get(
|
|
902
|
+
event.detail.appName
|
|
903
|
+
);
|
|
904
|
+
if (!buttonContainer) return;
|
|
905
|
+
|
|
906
|
+
const iconClass = event.detail.iconClass || '';
|
|
907
|
+
const iconUrl = event.detail.iconUrl || event.detail.appIconUrl;
|
|
908
|
+
|
|
909
|
+
const imgElement = querySelector(buttonContainer, 'img');
|
|
910
|
+
imgElement.setAttribute('src', iconUrl);
|
|
911
|
+
|
|
912
|
+
const button = querySelector(buttonContainer, 'button');
|
|
913
|
+
button.setAttribute('class', `inboxsdk__button_icon ${iconClass}`);
|
|
507
914
|
});
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
915
|
+
|
|
916
|
+
Kefir.fromEvents((document.body: any), 'inboxsdkRemoveSidebarPanel')
|
|
917
|
+
.filter(
|
|
918
|
+
(e) => e.detail.sidebarId === this._instanceId && e.detail.isGlobal
|
|
919
|
+
)
|
|
920
|
+
.takeUntilBy(this._stopper)
|
|
921
|
+
.onValue((event) => {
|
|
922
|
+
this._currentIds.delete(event.detail.id);
|
|
923
|
+
this._removeButton(
|
|
924
|
+
event,
|
|
925
|
+
this._globalButtonContainers,
|
|
926
|
+
this._globalIconArea
|
|
927
|
+
);
|
|
928
|
+
});
|
|
929
|
+
|
|
930
|
+
Kefir.fromEvents((document.body: any), 'inboxsdkSidebarPanelClose')
|
|
931
|
+
.filter(
|
|
932
|
+
(e) => e.detail.sidebarId === this._instanceId && e.detail.isGlobal
|
|
933
|
+
)
|
|
934
|
+
.takeUntilBy(this._stopper)
|
|
935
|
+
.onValue((event) => {
|
|
936
|
+
const descriptor = this._instanceIdsToDescriptors.get(
|
|
937
|
+
event.detail.instanceId
|
|
938
|
+
);
|
|
528
939
|
if (!descriptor) return;
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
940
|
+
|
|
941
|
+
const buttonContainer = this._globalButtonContainers.get(
|
|
942
|
+
descriptor.appName
|
|
943
|
+
);
|
|
944
|
+
if (!buttonContainer) return;
|
|
945
|
+
|
|
533
946
|
const activeButtonContainer = this._getActiveButtonContainer();
|
|
534
|
-
if (activeButtonContainer
|
|
535
|
-
(
|
|
947
|
+
if (activeButtonContainer === buttonContainer) {
|
|
948
|
+
if (!this._closeButton) {
|
|
949
|
+
throw new Error('Expected this._closeButton');
|
|
950
|
+
}
|
|
951
|
+
this._closeButton(true);
|
|
536
952
|
}
|
|
537
953
|
});
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
954
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
this._contentContainers.set(appName, sdkContentContainerEl);
|
|
561
|
-
sdkContentContainerEl.appendChild(event.target);
|
|
562
|
-
sdkContentContainerEl.style.display = 'none';
|
|
563
|
-
this._addButton(globalIconArea, event, true);
|
|
564
|
-
});
|
|
565
|
-
_kefir.default.fromEvents(document.body, 'inboxsdkUpdateSidebarPanel').filter(e => e.detail.sidebarId === this._instanceId && e.detail.isGlobal).takeUntilBy(this._stopper).onValue(event => {
|
|
566
|
-
const buttonContainer = this._globalButtonContainers.get(event.detail.appName);
|
|
567
|
-
if (!buttonContainer) return;
|
|
568
|
-
const iconClass = event.detail.iconClass || '';
|
|
569
|
-
const iconUrl = event.detail.iconUrl || event.detail.appIconUrl;
|
|
570
|
-
const imgElement = (0, _querySelectorOrFail.default)(buttonContainer, 'img');
|
|
571
|
-
imgElement.setAttribute('src', iconUrl);
|
|
572
|
-
const button = (0, _querySelectorOrFail.default)(buttonContainer, 'button');
|
|
573
|
-
button.setAttribute('class', `inboxsdk__button_icon ${iconClass}`);
|
|
574
|
-
});
|
|
575
|
-
_kefir.default.fromEvents(document.body, 'inboxsdkRemoveSidebarPanel').filter(e => e.detail.sidebarId === this._instanceId && e.detail.isGlobal).takeUntilBy(this._stopper).onValue(event => {
|
|
576
|
-
this._currentIds.delete(event.detail.id);
|
|
577
|
-
this._removeButton(event, this._globalButtonContainers, this._globalIconArea);
|
|
578
|
-
});
|
|
579
|
-
_kefir.default.fromEvents(document.body, 'inboxsdkSidebarPanelClose').filter(e => e.detail.sidebarId === this._instanceId && e.detail.isGlobal).takeUntilBy(this._stopper).onValue(event => {
|
|
580
|
-
const descriptor = this._instanceIdsToDescriptors.get(event.detail.instanceId);
|
|
581
|
-
if (!descriptor) return;
|
|
582
|
-
const buttonContainer = this._globalButtonContainers.get(descriptor.appName);
|
|
583
|
-
if (!buttonContainer) return;
|
|
584
|
-
const activeButtonContainer = this._getActiveButtonContainer();
|
|
585
|
-
if (activeButtonContainer === buttonContainer) {
|
|
586
|
-
if (!this._closeButton) {
|
|
587
|
-
throw new Error('Expected this._closeButton');
|
|
955
|
+
Kefir.fromEvents((document.body: any), 'inboxsdkSidebarPanelOpen')
|
|
956
|
+
.filter(
|
|
957
|
+
(e) => e.detail.sidebarId === this._instanceId && e.detail.isGlobal
|
|
958
|
+
)
|
|
959
|
+
.takeUntilBy(this._stopper)
|
|
960
|
+
.onValue((event) => {
|
|
961
|
+
const descriptor = this._instanceIdsToDescriptors.get(
|
|
962
|
+
event.detail.instanceId
|
|
963
|
+
);
|
|
964
|
+
if (!descriptor) return;
|
|
965
|
+
|
|
966
|
+
const buttonContainer = this._globalButtonContainers.get(
|
|
967
|
+
descriptor.appName
|
|
968
|
+
);
|
|
969
|
+
if (!buttonContainer) return;
|
|
970
|
+
|
|
971
|
+
const activeButtonContainer = this._getActiveButtonContainer();
|
|
972
|
+
if (activeButtonContainer !== buttonContainer) {
|
|
973
|
+
querySelector(buttonContainer, 'button').click();
|
|
588
974
|
}
|
|
589
|
-
|
|
590
|
-
}
|
|
591
|
-
});
|
|
592
|
-
_kefir.default.fromEvents(document.body, 'inboxsdkSidebarPanelOpen').filter(e => e.detail.sidebarId === this._instanceId && e.detail.isGlobal).takeUntilBy(this._stopper).onValue(event => {
|
|
593
|
-
const descriptor = this._instanceIdsToDescriptors.get(event.detail.instanceId);
|
|
594
|
-
if (!descriptor) return;
|
|
595
|
-
const buttonContainer = this._globalButtonContainers.get(descriptor.appName);
|
|
596
|
-
if (!buttonContainer) return;
|
|
597
|
-
const activeButtonContainer = this._getActiveButtonContainer();
|
|
598
|
-
if (activeButtonContainer !== buttonContainer) {
|
|
599
|
-
(0, _querySelectorOrFail.default)(buttonContainer, 'button').click();
|
|
600
|
-
}
|
|
601
|
-
});
|
|
975
|
+
});
|
|
602
976
|
}
|
|
603
977
|
|
|
604
978
|
// instance id to descriptor management
|
|
605
979
|
{
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
980
|
+
Kefir.fromEvents((document.body: any), 'inboxsdkNewSidebarPanel')
|
|
981
|
+
.filter((e) => e.detail.sidebarId === this._instanceId)
|
|
982
|
+
.takeUntilBy(this._stopper)
|
|
983
|
+
.onValue((event) => {
|
|
984
|
+
this._instanceIdsToDescriptors.set(
|
|
985
|
+
event.detail.instanceId,
|
|
986
|
+
event.detail
|
|
987
|
+
);
|
|
988
|
+
});
|
|
989
|
+
|
|
990
|
+
Kefir.fromEvents((document.body: any), 'inboxsdkRemoveSidebarPanel')
|
|
991
|
+
.filter((e) => e.detail.sidebarId === this._instanceId)
|
|
992
|
+
.takeUntilBy(this._stopper)
|
|
993
|
+
.onValue((event) => {
|
|
994
|
+
this._instanceIdsToDescriptors.delete(event.detail.instanceId);
|
|
995
|
+
});
|
|
996
|
+
|
|
997
|
+
Kefir.fromEvents((document.body: any), 'inboxsdkUpdateSidebarPanel')
|
|
998
|
+
.filter((e) => e.detail.sidebarId === this._instanceId)
|
|
999
|
+
.takeUntilBy(this._stopper)
|
|
1000
|
+
.onValue((event) => {
|
|
1001
|
+
this._instanceIdsToDescriptors.set(
|
|
1002
|
+
event.detail.instanceId,
|
|
1003
|
+
event.detail
|
|
1004
|
+
);
|
|
1005
|
+
});
|
|
615
1006
|
}
|
|
616
1007
|
|
|
617
1008
|
// at this point the companionSidebar has 2 children
|
|
@@ -623,20 +1014,35 @@ class GmailAppSidebarPrimary {
|
|
|
623
1014
|
// or the thread add-on content element are visible
|
|
624
1015
|
// if they are both display: '' or display: none then the native sidebar
|
|
625
1016
|
// contents are not visible
|
|
626
|
-
const globalAddOnContentContainer =
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
1017
|
+
const globalAddOnContentContainer =
|
|
1018
|
+
this._companionSidebarContentContainerEl.children[0];
|
|
1019
|
+
const threadAddOnContentContainer =
|
|
1020
|
+
this._companionSidebarContentContainerEl.children[1];
|
|
1021
|
+
|
|
1022
|
+
Kefir.merge(
|
|
1023
|
+
[globalAddOnContentContainer, threadAddOnContentContainer].map(
|
|
1024
|
+
(addonContentEl) =>
|
|
1025
|
+
makeMutationObserverChunkedStream(addonContentEl, {
|
|
1026
|
+
attributes: true,
|
|
1027
|
+
attributeFilter: ['style'],
|
|
1028
|
+
})
|
|
1029
|
+
)
|
|
1030
|
+
)
|
|
1031
|
+
.filter(
|
|
1032
|
+
() =>
|
|
1033
|
+
globalAddOnContentContainer.style.display !==
|
|
1034
|
+
threadAddOnContentContainer.style.display
|
|
1035
|
+
)
|
|
1036
|
+
.takeUntilBy(this._stopper)
|
|
1037
|
+
.onValue(() => {
|
|
1038
|
+
// TODO What is this block for? It closes the current section whenever
|
|
1039
|
+
// one of the Gmail addons bar elements changes?
|
|
1040
|
+
const activeButtonContainer = this._getActiveButtonContainer();
|
|
1041
|
+
if (activeButtonContainer) {
|
|
1042
|
+
querySelector(activeButtonContainer, 'button').click();
|
|
1043
|
+
}
|
|
1044
|
+
});
|
|
639
1045
|
}
|
|
640
1046
|
}
|
|
641
|
-
|
|
642
|
-
|
|
1047
|
+
|
|
1048
|
+
export default defn(module, GmailAppSidebarPrimary);
|