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