@inboxsdk/core 0.2.28-alpha.4 → 0.2.28-alpha.6
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 +1 -1
- package/package.json +5 -1
- package/src/inboxsdk-js/check-requirements.js +7 -3
- package/src/inboxsdk-js/header.js +1 -0
- package/src/inboxsdk-js/inboxsdk-NONREMOTE-INTEGRATED-PAGEWORLD.js +5 -6
- package/src/inboxsdk-js/inboxsdk-NONREMOTE.js +4 -3
- package/src/inboxsdk-js/inboxsdk-REMOTE.js +3 -1
- package/src/inboxsdk-js/inboxsdk-TEST.js +4 -3
- package/src/inboxsdk-js/inboxsdk.js +33 -39
- package/src/inboxsdk-js/loading/load-platform-implementation-DEV.js +15 -18
- package/src/inboxsdk.d.ts +2 -0
- package/src/injected-js/gmail/modify-suggestions.test.js +8 -9
- package/src/injected-js/gmail/setup-gmail-interceptor.js +340 -579
- package/src/injected-js/gmail/sync-compose-request-processor.test.js +39 -49
- package/src/injected-js/gmail/thread-identifier/click-and-get-popup-url.js +20 -33
- package/src/injected-js/gmail/thread-identifier/index.js +57 -93
- package/src/injected-js/gmail/thread-identifier/thread-row-parser.js +22 -31
- package/src/injected-js/gmail/thread-identifier/thread-row-parser.test.js +12 -28
- package/src/injected-js/inbox/setupAjaxInterceptor.js +64 -121
- package/src/injected-js/inbox/setupClickAndGetNewIframeSrc.js +53 -66
- package/src/injected-js/inbox/setupComposeViewDraftIDFinder.js +20 -36
- package/src/injected-js/inbox/setupInboxFakeWindowResizeListener.js +13 -13
- package/src/injected-js/main.js +11 -24
- package/src/injected-js/message-metadata-holder.js +52 -82
- package/src/injected-js/setup-data-exposer.js +89 -148
- package/src/injected-js/setup-error-silencer.js +21 -21
- package/src/injected-js/setup-event-reemitter.js +30 -22
- package/src/injected-js/setupInboxCustomViewLinkFixer.js +24 -29
- package/src/injected-js/setupPushStateListener.js +18 -11
- package/src/injected-js/xhr-helper.js +62 -65
- package/src/injected-js/xhr-proxy-factory.js +195 -445
- package/src/injected-js/xhr-proxy-factory.test.js +824 -991
- package/src/platform-implementation-js/constants/router.js +14 -9
- package/src/platform-implementation-js/constants/toolbars.js +8 -3
- 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 +115 -136
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-toolbar-button-for-app.js +13 -14
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/create-link.js +27 -48
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-draft-id-for-message-id.js +31 -42
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-native-nav-item.js +30 -40
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-url-object.js +10 -18
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadForOldGmailThreadId.js +21 -28
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadFromSyncThreadId.js +33 -45
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/gmail-load-event.js +31 -49
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/goto-view.js +58 -65
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/keyboard-shortcut-help-modifier.js +40 -124
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-compose-window.js +17 -22
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-draft-by-message-id.test.js +10 -11
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/override-gmail-back-button.js +44 -80
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/register-search-query-rewriter.js +19 -26
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/register-search-suggestions-provider.js +71 -147
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-compose-view-driver-stream.js +91 -148
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-route-view-driver-stream.js +150 -166
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-route-view-driver-stream.test.js +70 -120
- 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 +44 -67
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-thread-list.js +230 -379
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-thread-list.test.js +121 -307
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-native-route-view.js +17 -24
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/suppressAddon.js +41 -49
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/temporary-track-download-url-validity.js +30 -40
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/thread-row-identifier.js +28 -60
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-events.js +61 -133
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/user-info.js +30 -42
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/user-info.test.js +52 -46
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.js +354 -694
- package/src/platform-implementation-js/dom-driver/gmail/make-xhr-interceptor.js +77 -93
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.js +35 -82
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.test.js +44 -94
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-companion-global-icon-area.js +12 -19
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-companion-thread-icon-area.js +17 -29
- 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 +391 -797
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view/monitor-top-banner-size-and-react.js +7 -9
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view.js +60 -109
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-area-view.js +95 -135
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-card-view.js +103 -211
- 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 +188 -541
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-button.js +67 -135
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-compose-notice.js +27 -49
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-inner-sidebar.js +7 -13
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-outer-sidebar.js +9 -22
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-recipient-row.js +36 -63
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-tooltip-to-button.js +38 -113
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/ensure-app-button-toolbars-are-closed.js +11 -16
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/ensure-grouping-is-open.js +11 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/focus.js +8 -11
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/from-manager.js +27 -47
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-additional-action-toolbar.js +11 -24
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-address-changes-stream.js +59 -111
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-body-changes-stream.js +15 -14
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-formatting-area-offset-left.js +11 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-minimized-stream.js +18 -24
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-response-type-changes-stream.js +19 -23
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/insert-link-into-body.js +11 -19
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/manage-button-grouping.js +141 -376
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/monitor-selection-range.js +17 -28
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/override-edit-subject.js +34 -70
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/position-formatting-toolbar.js +10 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/size-fixer.js +83 -137
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/update-insert-more-area-left.js +10 -19
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view.js +632 -1190
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view/get-updated-contact.js +29 -38
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view.js +327 -617
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-processor.js +26 -49
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-view.js +188 -380
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-row-list-view.js +104 -194
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-row-view.js +382 -811
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view/add-icon-area.js +34 -58
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.js +330 -581
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.test.js +123 -277
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view/width-manager.js +15 -35
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view.js +216 -571
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-toolbar-view.js +152 -336
- package/src/platform-implementation-js/dom-driver/gmail/views/native-gmail-nav-item-view.js +87 -211
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/inbox-dropdown-button-view.js +10 -11
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-action-button-view.js +20 -29
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-label-view.js +41 -76
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-modal-view-driver.js +45 -99
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-mole-view-driver.js +76 -128
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-tooltip-view.js +128 -319
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-top-message-bar-driver.js +45 -78
- package/src/platform-implementation-js/dom-driver/inbox/__mocks__/getSidebarClassnames.js +8 -4
- package/src/platform-implementation-js/dom-driver/inbox/addNavItem.js +36 -54
- package/src/platform-implementation-js/dom-driver/inbox/addRecipientRow.js +35 -53
- package/src/platform-implementation-js/dom-driver/inbox/createLink.js +13 -15
- package/src/platform-implementation-js/dom-driver/inbox/createLink.test.js +15 -18
- package/src/platform-implementation-js/dom-driver/inbox/custom-style.js +14 -13
- package/src/platform-implementation-js/dom-driver/inbox/detection/appToolbarLocation/parser.js +14 -20
- package/src/platform-implementation-js/dom-driver/inbox/detection/attachmentCard/parser.js +14 -13
- package/src/platform-implementation-js/dom-driver/inbox/detection/attachmentOverlay/parser.js +35 -67
- package/src/platform-implementation-js/dom-driver/inbox/detection/chatSidebar/parser.js +16 -18
- package/src/platform-implementation-js/dom-driver/inbox/detection/compose/parser.js +68 -185
- package/src/platform-implementation-js/dom-driver/inbox/detection/message/parser.js +28 -56
- package/src/platform-implementation-js/dom-driver/inbox/detection/nativeDrawer/parser.js +12 -10
- 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 +24 -35
- package/src/platform-implementation-js/dom-driver/inbox/detection/thread-row/parser.js +37 -89
- package/src/platform-implementation-js/dom-driver/inbox/getComposeViewDriverLiveSet.js +56 -78
- package/src/platform-implementation-js/dom-driver/inbox/getInboxMessageIdForInboxThreadId.js +26 -32
- package/src/platform-implementation-js/dom-driver/inbox/getSidebarClassnames.js +52 -109
- package/src/platform-implementation-js/dom-driver/inbox/getSidebarClassnames.test.js +7 -8
- package/src/platform-implementation-js/dom-driver/inbox/gotoView.js +16 -20
- package/src/platform-implementation-js/dom-driver/inbox/gotoView.test.js +15 -16
- package/src/platform-implementation-js/dom-driver/inbox/inbox-butter-bar-driver.js +75 -83
- package/src/platform-implementation-js/dom-driver/inbox/inbox-driver.js +530 -822
- package/src/platform-implementation-js/dom-driver/inbox/inbox-page-communicator.js +48 -61
- package/src/platform-implementation-js/dom-driver/inbox/inboxResponseProcessor.js +9 -12
- package/src/platform-implementation-js/dom-driver/inbox/inboxResponseProcessor.test.js +12 -19
- package/src/platform-implementation-js/dom-driver/inbox/makePageParserTree.js +24 -33
- package/src/platform-implementation-js/dom-driver/inbox/pageParserOptions.js +201 -388
- package/src/platform-implementation-js/dom-driver/inbox/registerSearchSuggestionsProvider.js +249 -265
- package/src/platform-implementation-js/dom-driver/inbox/setupCustomAutocompleteSelectionHandling.js +84 -152
- package/src/platform-implementation-js/dom-driver/inbox/setupRouteViewDriverStream.js +55 -67
- package/src/platform-implementation-js/dom-driver/inbox/setupRouteViewDriverStream.test.js +43 -65
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxLabelView.js +31 -56
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxMoleViewDriver.js +191 -294
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxToolbarButtonView.js +32 -45
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxToolbarView.js +21 -39
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-sidebar-view.js +153 -240
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-toolbar-button-view.js +75 -150
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-toolbar-tooltip-view.js +20 -37
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-attachment-card-view.js +60 -114
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-attachment-overlay-view.js +47 -65
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-backdrop.js +41 -52
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-chat-sidebar-view.js +27 -36
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-compose-button-view.js +52 -80
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-compose-view.js +465 -649
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-custom-route-view.js +37 -58
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-custom-route-view.test.js +14 -26
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-drawer-view.js +118 -235
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-dropdown-view.js +10 -11
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-dummy-route-view.js +28 -46
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-message-view.js +131 -202
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-modal-view.js +40 -80
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-route-view.js +35 -61
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-row-view.js +124 -221
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-view.js +125 -213
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-view.test.js +104 -126
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-tooltip-view.js +36 -51
- package/src/platform-implementation-js/dom-driver/inbox/views/inboxNavItemView.js +158 -297
- package/src/platform-implementation-js/dom-driver/inbox/waitForAnimationClickBlockerGone.js +21 -35
- package/src/platform-implementation-js/driver-common/compose/getDiscardStream.js +24 -43
- package/src/platform-implementation-js/driver-common/compose/getPresendingStream.js +39 -68
- package/src/platform-implementation-js/driver-common/getGmailMessageIdForSyncMessageId.js +14 -19
- package/src/platform-implementation-js/driver-common/getGmailThreadIdForRfcMessageId.js +27 -35
- package/src/platform-implementation-js/driver-common/getRfcMessageIdForSyncMessageId.js +16 -22
- package/src/platform-implementation-js/driver-common/getThreadIdFromMessageId.js +14 -14
- package/src/platform-implementation-js/driver-common/inboxAjax.js +12 -7
- package/src/platform-implementation-js/driver-common/requestGmailThread.js +19 -20
- package/src/platform-implementation-js/driver-common/sidebar/AppSidebar.js +197 -306
- package/src/platform-implementation-js/driver-common/sidebar/ContentPanelViewDriver.js +113 -161
- package/src/platform-implementation-js/driver-interfaces/compose-view-driver.js +1 -114
- package/src/platform-implementation-js/driver-interfaces/driver.js +1 -131
- package/src/platform-implementation-js/driver-interfaces/message-view-driver.js +4 -48
- package/src/platform-implementation-js/driver-interfaces/mole-view-driver.js +1 -29
- package/src/platform-implementation-js/driver-interfaces/route-view-driver.js +1 -32
- package/src/platform-implementation-js/driver-interfaces/thread-row-view-driver.js +1 -11
- package/src/platform-implementation-js/lib/array-to-lifetimes.js +43 -41
- package/src/platform-implementation-js/lib/array-to-lifetimes.test.js +139 -155
- package/src/platform-implementation-js/lib/copyAndValidateAutocompleteResults.js +19 -38
- package/src/platform-implementation-js/lib/css-selector-escape.js +7 -3
- package/src/platform-implementation-js/lib/dom/element-view-mapper.js +8 -11
- package/src/platform-implementation-js/lib/dom/get-selection.js +23 -52
- package/src/platform-implementation-js/lib/dom/insert-html-at-cursor.js +69 -101
- package/src/platform-implementation-js/lib/dom/is-node-in-range.js +8 -10
- package/src/platform-implementation-js/lib/dom/on-mouse-down-and-up.js +15 -17
- package/src/platform-implementation-js/lib/dom/querySelectorOne.js +8 -11
- package/src/platform-implementation-js/lib/dom/set-css.js +7 -3
- package/src/platform-implementation-js/lib/dom/set-value-and-dispatch-event.js +9 -11
- package/src/platform-implementation-js/lib/dom/simulate-drag-and-drop.js +32 -33
- package/src/platform-implementation-js/lib/extract-contact-from-email-contact-string.test.js +23 -26
- package/src/platform-implementation-js/lib/handle-compose-link-chips.js +86 -149
- package/src/platform-implementation-js/lib/insert-link-chip-into-body.js +42 -57
- package/src/platform-implementation-js/lib/make-revocable-function.js +19 -21
- package/src/platform-implementation-js/lib/make-revocable-function.test.js +20 -22
- package/src/platform-implementation-js/lib/parseParamsFromRouteID.js +15 -17
- package/src/platform-implementation-js/lib/parseParamsFromRouteID.test.js +9 -18
- package/src/platform-implementation-js/lib/populateRouteID.js +8 -9
- package/src/platform-implementation-js/lib/populateRouteID.test.js +20 -19
- package/src/platform-implementation-js/lib/react/ElementContainer.js +23 -20
- package/src/platform-implementation-js/lib/rewriteCssWithIdMap.js +10 -9
- package/src/platform-implementation-js/lib/rewriteCssWithIdMap.test.js +13 -20
- package/src/platform-implementation-js/lib/routeIDmatchesHash.js +13 -18
- package/src/platform-implementation-js/lib/routeIDmatchesHash.test.js +11 -17
- package/src/platform-implementation-js/lib/shared-style.js +14 -13
- package/src/platform-implementation-js/lib/toItemWithLifetimeStream.js +18 -17
- package/src/platform-implementation-js/lib/toLiveSet.js +17 -15
- package/src/platform-implementation-js/main-INTEGRATED-PAGEWORLD.js +6 -5
- package/src/platform-implementation-js/main.js +9 -24
- package/src/platform-implementation-js/namespaces/compose.js +37 -60
- package/src/platform-implementation-js/namespaces/conversations.js +52 -124
- package/src/platform-implementation-js/namespaces/global.js +27 -39
- package/src/platform-implementation-js/namespaces/keyboard.js +29 -33
- package/src/platform-implementation-js/namespaces/lists.js +25 -31
- package/src/platform-implementation-js/namespaces/modal.js +34 -28
- package/src/platform-implementation-js/namespaces/nav-menu.js +30 -45
- package/src/platform-implementation-js/namespaces/router.js +70 -137
- package/src/platform-implementation-js/namespaces/search.js +19 -17
- package/src/platform-implementation-js/namespaces/toolbars.js +71 -117
- package/src/platform-implementation-js/namespaces/user.js +36 -37
- package/src/platform-implementation-js/namespaces/widgets.js +54 -61
- package/src/platform-implementation-js/platform-implementation.js +98 -229
- package/src/platform-implementation-js/views/app-toolbar-button-view.js +26 -47
- package/src/platform-implementation-js/views/collapsible-section-view.js +66 -63
- package/src/platform-implementation-js/views/content-panel-view.js +28 -30
- package/src/platform-implementation-js/views/conversations/attachment-card-view.js +21 -44
- package/src/platform-implementation-js/views/conversations/custom-message-view.js +44 -104
- package/src/platform-implementation-js/views/conversations/message-view.js +131 -202
- package/src/platform-implementation-js/views/conversations/thread-view.js +75 -127
- package/src/platform-implementation-js/views/native-nav-item-view.js +32 -65
- package/src/platform-implementation-js/views/nav-item-view.js +51 -115
- package/src/platform-implementation-js/views/route-view/custom-route-view.js +25 -20
- 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 +30 -52
- package/src/platform-implementation-js/views/route-view/route-view.js +24 -35
- package/src/platform-implementation-js/views/section-view.js +60 -52
- package/src/platform-implementation-js/views/thread-row-view.js +49 -74
- package/src/platform-implementation-js/widgets/drawer-view.js +29 -36
- package/src/platform-implementation-js/widgets/modal-view.js +39 -68
- package/src/platform-implementation-js/widgets/mole-view.js +22 -22
- package/src/platform-implementation-js/widgets/top-message-bar-view.js +13 -10
|
@@ -1,57 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _findIndex = _interopRequireDefault(require("lodash/findIndex"));
|
|
10
|
+
var _asap = _interopRequireDefault(require("asap"));
|
|
11
|
+
var _ud = require("ud");
|
|
12
|
+
var _autoHtml = _interopRequireDefault(require("auto-html"));
|
|
13
|
+
var _kefir = _interopRequireDefault(require("kefir"));
|
|
14
|
+
var _kefirStopper = _interopRequireDefault(require("kefir-stopper"));
|
|
15
|
+
var _kefirBus = _interopRequireDefault(require("kefir-bus"));
|
|
16
|
+
var _react = _interopRequireDefault(require("react"));
|
|
17
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
18
|
+
var _findParent = _interopRequireDefault(require("../../../../common/find-parent"));
|
|
19
|
+
var _delayAsap = _interopRequireDefault(require("../../../lib/delay-asap"));
|
|
20
|
+
var _fromEventTargetCapture = _interopRequireDefault(require("../../../lib/from-event-target-capture"));
|
|
21
|
+
var _orderManager = _interopRequireDefault(require("order-manager"));
|
|
22
|
+
var _idMap = _interopRequireDefault(require("../../../lib/idMap"));
|
|
23
|
+
var _incrementName = _interopRequireDefault(require("../../../lib/incrementName"));
|
|
24
|
+
var _querySelectorOrFail = _interopRequireDefault(require("../../../lib/dom/querySelectorOrFail"));
|
|
25
|
+
var _makeMutationObserverChunkedStream = _interopRequireDefault(require("../../../lib/dom/make-mutation-observer-chunked-stream"));
|
|
26
|
+
var _makeElementChildStream = _interopRequireDefault(require("../../../lib/dom/make-element-child-stream"));
|
|
27
|
+
var _simulateMouseEvent = require("../../../lib/dom/simulate-mouse-event");
|
|
28
|
+
var _fakeWindowResize = _interopRequireDefault(require("../../../lib/fake-window-resize"));
|
|
29
|
+
var _AppSidebar = _interopRequireDefault(require("../../../driver-common/sidebar/AppSidebar"));
|
|
30
|
+
var _ContentPanelViewDriver = _interopRequireDefault(require("../../../driver-common/sidebar/ContentPanelViewDriver"));
|
|
31
|
+
var _gmailElementGetter = _interopRequireDefault(require("../gmail-element-getter"));
|
|
32
|
+
var _addIconArea = _interopRequireDefault(require("./gmail-thread-sidebar-view/add-icon-area"));
|
|
33
|
+
var _addToIconArea = _interopRequireDefault(require("./gmail-app-sidebar-view/primary/add-to-icon-area"));
|
|
3
34
|
/*
|
|
4
35
|
This is used for PRE MATERIAL GMAIL, when sidebar only existed on threads.
|
|
5
36
|
If you're reading this in the future, do you remember a time when there wasn't a global sidebar?
|
|
6
37
|
It was a strange world, can you believe who the President of the United States was?
|
|
7
38
|
|
|
8
39
|
*/
|
|
9
|
-
|
|
10
|
-
import findIndex from 'lodash/findIndex';
|
|
11
|
-
import asap from 'asap';
|
|
12
|
-
import { defn } from 'ud';
|
|
13
|
-
import autoHtml from 'auto-html';
|
|
14
|
-
import Kefir from 'kefir';
|
|
15
|
-
import kefirStopper from 'kefir-stopper';
|
|
16
|
-
import kefirBus from 'kefir-bus';
|
|
17
|
-
import React from 'react';
|
|
18
|
-
import ReactDOM from 'react-dom';
|
|
19
|
-
import findParent from '../../../../common/find-parent';
|
|
20
|
-
import delayAsap from '../../../lib/delay-asap';
|
|
21
|
-
import fromEventTargetCapture from '../../../lib/from-event-target-capture';
|
|
22
|
-
import OrderManager from 'order-manager';
|
|
23
|
-
import idMap from '../../../lib/idMap';
|
|
24
|
-
import incrementName from '../../../lib/incrementName';
|
|
25
|
-
import querySelector from '../../../lib/dom/querySelectorOrFail';
|
|
26
|
-
import makeMutationObserverChunkedStream from '../../../lib/dom/make-mutation-observer-chunked-stream';
|
|
27
|
-
import makeElementChildStream from '../../../lib/dom/make-element-child-stream';
|
|
28
|
-
import { simulateClick } from '../../../lib/dom/simulate-mouse-event';
|
|
29
|
-
import fakeWindowResize from '../../../lib/fake-window-resize';
|
|
30
|
-
import type GmailDriver from '../gmail-driver';
|
|
31
|
-
|
|
32
|
-
import AppSidebar from '../../../driver-common/sidebar/AppSidebar';
|
|
33
|
-
import ContentPanelViewDriver from '../../../driver-common/sidebar/ContentPanelViewDriver';
|
|
34
|
-
import GmailElementGetter from '../gmail-element-getter';
|
|
35
|
-
|
|
36
|
-
import addIconArea from './gmail-thread-sidebar-view/add-icon-area';
|
|
37
|
-
import addToIconArea from './gmail-app-sidebar-view/primary/add-to-icon-area';
|
|
38
|
-
|
|
39
40
|
const ADD_ON_SIDEBAR_CONTENT_SELECTOR = '.J-KU-Jz';
|
|
40
41
|
const ACTIVE_ADD_ON_ICON_SELECTOR = '.J-KU-KO';
|
|
41
|
-
|
|
42
|
-
import type WidthManager from './gmail-thread-view/width-manager';
|
|
43
|
-
|
|
44
42
|
class GmailAppSidebarView {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
_instanceId: string;
|
|
48
|
-
|
|
49
|
-
constructor(
|
|
50
|
-
driver: GmailDriver,
|
|
51
|
-
sidebarContainerEl?: ?HTMLElement,
|
|
52
|
-
addonSidebarElement: ?HTMLElement,
|
|
53
|
-
widthManager: ?WidthManager
|
|
54
|
-
) {
|
|
43
|
+
constructor(driver, sidebarContainerEl, addonSidebarElement, widthManager) {
|
|
44
|
+
(0, _defineProperty2.default)(this, "_stopper", (0, _kefirStopper.default)());
|
|
55
45
|
this._driver = driver;
|
|
56
46
|
|
|
57
47
|
// We need to be able to cooperate with other apps/extensions that are
|
|
@@ -67,53 +57,34 @@ class GmailAppSidebarView {
|
|
|
67
57
|
if (instanceId != null) {
|
|
68
58
|
this._instanceId = instanceId;
|
|
69
59
|
} else {
|
|
70
|
-
this._createElement(
|
|
71
|
-
sidebarContainerEl,
|
|
72
|
-
addonSidebarElement,
|
|
73
|
-
widthManager
|
|
74
|
-
);
|
|
60
|
+
this._createElement(sidebarContainerEl, addonSidebarElement, widthManager);
|
|
75
61
|
}
|
|
76
62
|
}
|
|
77
|
-
|
|
78
63
|
destroy() {
|
|
79
64
|
this._stopper.destroy();
|
|
80
65
|
}
|
|
81
|
-
|
|
82
|
-
getStopper(): Kefir.Observable<*> {
|
|
66
|
+
getStopper() {
|
|
83
67
|
return this._stopper;
|
|
84
68
|
}
|
|
85
69
|
|
|
86
70
|
// This value controls whether the app sidebar should automatically open
|
|
87
71
|
// itself when available when the chat sidebar isn't present. It's only set
|
|
88
72
|
// if the user interacts with the app sidebar button.
|
|
89
|
-
_getShouldAppSidebarOpen()
|
|
90
|
-
return (
|
|
91
|
-
global.localStorage.getItem('inboxsdk__app_sidebar_should_open') !==
|
|
92
|
-
'false'
|
|
93
|
-
);
|
|
73
|
+
_getShouldAppSidebarOpen() {
|
|
74
|
+
return global.localStorage.getItem('inboxsdk__app_sidebar_should_open') !== 'false';
|
|
94
75
|
}
|
|
95
|
-
|
|
96
|
-
_setShouldAppSidebarOpen(open: boolean) {
|
|
76
|
+
_setShouldAppSidebarOpen(open) {
|
|
97
77
|
try {
|
|
98
|
-
global.localStorage.setItem(
|
|
99
|
-
'inboxsdk__app_sidebar_should_open',
|
|
100
|
-
String(open)
|
|
101
|
-
);
|
|
78
|
+
global.localStorage.setItem('inboxsdk__app_sidebar_should_open', String(open));
|
|
102
79
|
} catch (err) {
|
|
103
80
|
console.error('error saving', err); //eslint-disable-line no-console
|
|
104
81
|
}
|
|
105
82
|
}
|
|
106
83
|
|
|
107
|
-
_createElement(
|
|
108
|
-
_sidebarContainerEl: ?HTMLElement,
|
|
109
|
-
_addonSidebarContainerEl: ?HTMLElement,
|
|
110
|
-
widthManager: ?WidthManager
|
|
111
|
-
) {
|
|
84
|
+
_createElement(_sidebarContainerEl, _addonSidebarContainerEl, widthManager) {
|
|
112
85
|
let container, iconArea;
|
|
113
|
-
let component
|
|
114
|
-
|
|
86
|
+
let component;
|
|
115
87
|
this._instanceId = `${Date.now()}-${Math.random()}`;
|
|
116
|
-
|
|
117
88
|
{
|
|
118
89
|
const idElement = _addonSidebarContainerEl || _sidebarContainerEl;
|
|
119
90
|
if (!idElement) throw new Error('should not happen');
|
|
@@ -122,237 +93,154 @@ class GmailAppSidebarView {
|
|
|
122
93
|
idElement.removeAttribute('data-sdk-sidebar-instance-id');
|
|
123
94
|
});
|
|
124
95
|
}
|
|
125
|
-
|
|
126
96
|
const el = document.createElement('div');
|
|
127
|
-
el.className =
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
let activatedWhileLoading: boolean = false;
|
|
131
|
-
|
|
97
|
+
el.className = (0, _idMap.default)('app_sidebar_container');
|
|
98
|
+
const buttonContainers = new Map();
|
|
99
|
+
let activatedWhileLoading = false;
|
|
132
100
|
let contentContainer;
|
|
133
101
|
let usedAddonsSidebar = false;
|
|
134
|
-
|
|
135
|
-
const updateHighlightedAppIconBus = kefirBus();
|
|
102
|
+
const updateHighlightedAppIconBus = (0, _kefirBus.default)();
|
|
136
103
|
this._stopper.onEnd(() => {
|
|
137
104
|
updateHighlightedAppIconBus.end();
|
|
138
105
|
});
|
|
139
|
-
|
|
140
106
|
if (_addonSidebarContainerEl) {
|
|
141
|
-
const mainContentBodyContainerElement =
|
|
142
|
-
GmailElementGetter.getMainContentBodyContainerElement();
|
|
107
|
+
const mainContentBodyContainerElement = _gmailElementGetter.default.getMainContentBodyContainerElement();
|
|
143
108
|
if (mainContentBodyContainerElement) {
|
|
144
109
|
contentContainer = mainContentBodyContainerElement.parentElement;
|
|
145
110
|
if (!contentContainer) throw new Error('should not happen');
|
|
146
111
|
contentContainer.classList.add('container_app_sidebar_in_use');
|
|
147
|
-
|
|
148
|
-
_addonSidebarContainerEl,
|
|
149
|
-
ADD_ON_SIDEBAR_CONTENT_SELECTOR
|
|
150
|
-
).insertAdjacentElement('beforebegin', el);
|
|
112
|
+
(0, _querySelectorOrFail.default)(_addonSidebarContainerEl, ADD_ON_SIDEBAR_CONTENT_SELECTOR).insertAdjacentElement('beforebegin', el);
|
|
151
113
|
|
|
152
114
|
// See if the element is visible.
|
|
153
115
|
// Give it some content temporarily to check if it becomes sized to show it.
|
|
154
116
|
_addonSidebarContainerEl.classList.add('app_sidebar_visible');
|
|
155
|
-
_addonSidebarContainerEl.classList.add(
|
|
117
|
+
_addonSidebarContainerEl.classList.add((0, _idMap.default)('app_sidebar_in_use'));
|
|
156
118
|
contentContainer.classList.add('container_app_sidebar_visible');
|
|
157
|
-
|
|
158
119
|
el.textContent = 'x';
|
|
159
120
|
const elRect = el.getBoundingClientRect();
|
|
160
121
|
el.textContent = '';
|
|
161
122
|
// This gets re-added later once the panel has some content to show
|
|
162
123
|
_addonSidebarContainerEl.classList.remove('app_sidebar_visible');
|
|
163
124
|
contentContainer.classList.remove('container_app_sidebar_visible');
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
rect: {
|
|
182
|
-
// rect's properties aren't enumerable so we have to do this
|
|
183
|
-
top: elRect.top,
|
|
184
|
-
bottom: elRect.bottom,
|
|
185
|
-
left: elRect.left,
|
|
186
|
-
right: elRect.right,
|
|
187
|
-
width: elRect.width,
|
|
188
|
-
height: elRect.height,
|
|
189
|
-
},
|
|
190
|
-
window: {
|
|
191
|
-
innerWidth: window.innerWidth,
|
|
192
|
-
innerHeight: window.innerHeight,
|
|
193
|
-
},
|
|
194
|
-
}
|
|
195
|
-
);
|
|
125
|
+
const supportedScreenSize = window.innerWidth >= 1024 && window.innerHeight >= 600;
|
|
126
|
+
if (!global._APP_SIDEBAR_TEST && (elRect.width == 0 || elRect.height == 0 || supportedScreenSize && Math.floor(elRect.right) > Math.floor(window.innerWidth))) {
|
|
127
|
+
this._driver.getLogger().error(new Error('SDK sidebar inserted into add-ons sidebar was not visible'), {
|
|
128
|
+
rect: {
|
|
129
|
+
// rect's properties aren't enumerable so we have to do this
|
|
130
|
+
top: elRect.top,
|
|
131
|
+
bottom: elRect.bottom,
|
|
132
|
+
left: elRect.left,
|
|
133
|
+
right: elRect.right,
|
|
134
|
+
width: elRect.width,
|
|
135
|
+
height: elRect.height
|
|
136
|
+
},
|
|
137
|
+
window: {
|
|
138
|
+
innerWidth: window.innerWidth,
|
|
139
|
+
innerHeight: window.innerHeight
|
|
140
|
+
}
|
|
141
|
+
});
|
|
196
142
|
} else {
|
|
197
143
|
usedAddonsSidebar = true;
|
|
198
144
|
}
|
|
199
|
-
|
|
200
145
|
if (!usedAddonsSidebar) {
|
|
201
|
-
if (contentContainer)
|
|
202
|
-
|
|
203
|
-
_addonSidebarContainerEl.classList.remove(
|
|
204
|
-
idMap('app_sidebar_in_use')
|
|
205
|
-
);
|
|
146
|
+
if (contentContainer) contentContainer.classList.remove('container_app_sidebar_in_use');
|
|
147
|
+
_addonSidebarContainerEl.classList.remove((0, _idMap.default)('app_sidebar_in_use'));
|
|
206
148
|
}
|
|
207
149
|
}
|
|
208
150
|
}
|
|
209
|
-
|
|
210
|
-
const
|
|
211
|
-
? _addonSidebarContainerEl
|
|
212
|
-
: null;
|
|
213
|
-
const sidebarContainerEl = usedAddonsSidebar
|
|
214
|
-
? _addonSidebarContainerEl
|
|
215
|
-
: _sidebarContainerEl;
|
|
151
|
+
const addonSidebarContainerEl = usedAddonsSidebar ? _addonSidebarContainerEl : null;
|
|
152
|
+
const sidebarContainerEl = usedAddonsSidebar ? _addonSidebarContainerEl : _sidebarContainerEl;
|
|
216
153
|
if (!sidebarContainerEl) throw new Error('should not happen');
|
|
217
154
|
if (!usedAddonsSidebar) {
|
|
218
155
|
sidebarContainerEl.insertBefore(el, sidebarContainerEl.firstElementChild);
|
|
219
|
-
sidebarContainerEl.classList.add(
|
|
156
|
+
sidebarContainerEl.classList.add((0, _idMap.default)('app_sidebar_in_use'));
|
|
220
157
|
}
|
|
221
|
-
|
|
222
|
-
if (
|
|
223
|
-
!((document.body: any): HTMLElement).querySelector(
|
|
224
|
-
'.' + idMap('app_sidebar_waiting_platform')
|
|
225
|
-
)
|
|
226
|
-
) {
|
|
158
|
+
if (!document.body.querySelector('.' + (0, _idMap.default)('app_sidebar_waiting_platform'))) {
|
|
227
159
|
const waitingPlatform = document.createElement('div');
|
|
228
|
-
waitingPlatform.className =
|
|
229
|
-
|
|
160
|
+
waitingPlatform.className = (0, _idMap.default)('app_sidebar_waiting_platform');
|
|
161
|
+
document.body.appendChild(waitingPlatform);
|
|
230
162
|
}
|
|
231
|
-
|
|
232
163
|
if (addonSidebarContainerEl) {
|
|
233
164
|
container = () => el;
|
|
234
165
|
el.classList.add('addon_sidebar');
|
|
235
166
|
} else {
|
|
236
|
-
const containerEl =
|
|
237
|
-
sidebarContainerEl,
|
|
238
|
-
(el) => window.getComputedStyle(el).overflowY !== 'visible'
|
|
239
|
-
);
|
|
167
|
+
const containerEl = (0, _findParent.default)(sidebarContainerEl, el => window.getComputedStyle(el).overflowY !== 'visible');
|
|
240
168
|
container = containerEl ? () => containerEl : undefined;
|
|
241
169
|
}
|
|
242
|
-
|
|
243
170
|
const currentIds = new Set();
|
|
244
|
-
const orderManager = new
|
|
171
|
+
const orderManager = new _orderManager.default({
|
|
245
172
|
get() {
|
|
246
173
|
try {
|
|
247
|
-
return JSON.parse(
|
|
248
|
-
global.localStorage.getItem('inboxsdk__sidebar_ordering') || 'null'
|
|
249
|
-
);
|
|
174
|
+
return JSON.parse(global.localStorage.getItem('inboxsdk__sidebar_ordering') || 'null');
|
|
250
175
|
} catch (err) {
|
|
251
176
|
console.error('failed to read sidebar order data', err); //eslint-disable-line no-console
|
|
252
177
|
}
|
|
253
178
|
},
|
|
179
|
+
|
|
254
180
|
set(data) {
|
|
255
181
|
try {
|
|
256
|
-
global.localStorage.setItem(
|
|
257
|
-
'inboxsdk__sidebar_ordering',
|
|
258
|
-
JSON.stringify(data)
|
|
259
|
-
);
|
|
182
|
+
global.localStorage.setItem('inboxsdk__sidebar_ordering', JSON.stringify(data));
|
|
260
183
|
} catch (err) {
|
|
261
184
|
console.error('failed to set sidebar order data', err); //eslint-disable-line no-console
|
|
262
185
|
}
|
|
263
|
-
}
|
|
186
|
+
}
|
|
264
187
|
});
|
|
265
188
|
|
|
266
|
-
updateHighlightedAppIconBus
|
|
267
|
-
.
|
|
268
|
-
|
|
269
|
-
.
|
|
270
|
-
.
|
|
271
|
-
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
const titleBars = Array.from(
|
|
276
|
-
el.querySelectorAll(
|
|
277
|
-
`.${idMap('app_sidebar_content_panel')}.${idMap(
|
|
278
|
-
'expanded'
|
|
279
|
-
)} .${idMap('app_sidebar_content_panel_top_line')}`
|
|
280
|
-
)
|
|
281
|
-
);
|
|
282
|
-
|
|
283
|
-
const titleBar = titleBars.find((t) => {
|
|
284
|
-
const tBoundingBox = t.getBoundingClientRect();
|
|
285
|
-
return (
|
|
286
|
-
tBoundingBox.bottom > boundingTop &&
|
|
287
|
-
tBoundingBox.bottom < boundingBottom
|
|
288
|
-
);
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
if (titleBar) {
|
|
292
|
-
const instanceId = titleBar.getAttribute('data-instance-id');
|
|
293
|
-
const appName = titleBar.getAttribute('data-app-name');
|
|
294
|
-
if (!appName) return;
|
|
295
|
-
const appButton = buttonContainers.get(appName);
|
|
296
|
-
if (!appButton || !iconArea) return;
|
|
297
|
-
|
|
298
|
-
const activeButtonContainer = iconArea.querySelector(
|
|
299
|
-
'.sidebar_button_container_active'
|
|
300
|
-
);
|
|
301
|
-
if (activeButtonContainer) {
|
|
302
|
-
activeButtonContainer.classList.remove(
|
|
303
|
-
'sidebar_button_container_active'
|
|
304
|
-
);
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
appButton.classList.add('sidebar_button_container_active');
|
|
308
|
-
}
|
|
189
|
+
updateHighlightedAppIconBus.bufferWithTimeOrCount(150, 100).filter(events => events.length > 0).takeUntilBy(this._stopper).onValue(() => {
|
|
190
|
+
const elBoundingBox = el.getBoundingClientRect();
|
|
191
|
+
const boundingTop = elBoundingBox.top + el.scrollTop;
|
|
192
|
+
const boundingBottom = boundingTop + elBoundingBox.height;
|
|
193
|
+
const titleBars = Array.from(el.querySelectorAll(`.${(0, _idMap.default)('app_sidebar_content_panel')}.${(0, _idMap.default)('expanded')} .${(0, _idMap.default)('app_sidebar_content_panel_top_line')}`));
|
|
194
|
+
const titleBar = titleBars.find(t => {
|
|
195
|
+
const tBoundingBox = t.getBoundingClientRect();
|
|
196
|
+
return tBoundingBox.bottom > boundingTop && tBoundingBox.bottom < boundingBottom;
|
|
309
197
|
});
|
|
310
|
-
|
|
311
|
-
|
|
198
|
+
if (titleBar) {
|
|
199
|
+
const instanceId = titleBar.getAttribute('data-instance-id');
|
|
200
|
+
const appName = titleBar.getAttribute('data-app-name');
|
|
201
|
+
if (!appName) return;
|
|
202
|
+
const appButton = buttonContainers.get(appName);
|
|
203
|
+
if (!appButton || !iconArea) return;
|
|
204
|
+
const activeButtonContainer = iconArea.querySelector('.sidebar_button_container_active');
|
|
205
|
+
if (activeButtonContainer) {
|
|
206
|
+
activeButtonContainer.classList.remove('sidebar_button_container_active');
|
|
207
|
+
}
|
|
208
|
+
appButton.classList.add('sidebar_button_container_active');
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
const _appSidebarRefSetter = threadSidebarComponent => {
|
|
312
212
|
if (threadSidebarComponent) {
|
|
313
213
|
component = threadSidebarComponent;
|
|
314
214
|
}
|
|
315
215
|
};
|
|
316
|
-
|
|
317
216
|
const render = () => {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
onExpandedToggle={() => {
|
|
327
|
-
updateHighlightedAppIconBus.emit(null);
|
|
328
|
-
}}
|
|
329
|
-
container={container}
|
|
330
|
-
/>,
|
|
331
|
-
el,
|
|
332
|
-
() => {
|
|
217
|
+
_reactDom.default.render( /*#__PURE__*/_react.default.createElement(_AppSidebar.default, {
|
|
218
|
+
ref: _appSidebarRefSetter,
|
|
219
|
+
panels: orderManager.getOrderedItems().map(x => x.value),
|
|
220
|
+
onMoveEnd: (newList, movedItem, oldIndex, newIndex) => {
|
|
221
|
+
orderManager.moveItem(oldIndex, newIndex);
|
|
222
|
+
render();
|
|
223
|
+
},
|
|
224
|
+
onExpandedToggle: () => {
|
|
333
225
|
updateHighlightedAppIconBus.emit(null);
|
|
334
|
-
}
|
|
335
|
-
|
|
226
|
+
},
|
|
227
|
+
container: container
|
|
228
|
+
}), el, () => {
|
|
229
|
+
updateHighlightedAppIconBus.emit(null);
|
|
230
|
+
});
|
|
336
231
|
};
|
|
337
232
|
render();
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
.onValue(() => {
|
|
343
|
-
orderManager.reload();
|
|
344
|
-
render();
|
|
345
|
-
});
|
|
346
|
-
|
|
233
|
+
_kefir.default.fromEvents(window, 'storage').filter(e => e.key === 'inboxsdk__sidebar_ordering').takeUntilBy(this._stopper).onValue(() => {
|
|
234
|
+
orderManager.reload();
|
|
235
|
+
render();
|
|
236
|
+
});
|
|
347
237
|
this._stopper.onValue(() => {
|
|
348
|
-
|
|
238
|
+
_reactDom.default.unmountComponentAtNode(el);
|
|
349
239
|
el.remove();
|
|
350
|
-
sidebarContainerEl.classList.remove(
|
|
240
|
+
sidebarContainerEl.classList.remove((0, _idMap.default)('app_sidebar_in_use'));
|
|
351
241
|
sidebarContainerEl.classList.remove('app_sidebar_visible');
|
|
352
242
|
if (iconArea) iconArea.remove();
|
|
353
|
-
|
|
354
|
-
const mainContentBodyContainerElement =
|
|
355
|
-
GmailElementGetter.getMainContentBodyContainerElement();
|
|
243
|
+
const mainContentBodyContainerElement = _gmailElementGetter.default.getMainContentBodyContainerElement();
|
|
356
244
|
if (mainContentBodyContainerElement) {
|
|
357
245
|
contentContainer = mainContentBodyContainerElement.parentElement;
|
|
358
246
|
if (contentContainer) {
|
|
@@ -361,384 +249,245 @@ class GmailAppSidebarView {
|
|
|
361
249
|
}
|
|
362
250
|
}
|
|
363
251
|
});
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
.
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
orderManager.addItem({
|
|
377
|
-
groupId: event.detail.appId,
|
|
252
|
+
_kefir.default.fromEvents(document.body, 'inboxsdkNewSidebarPanel').filter(e => e.detail.sidebarId === this._instanceId).takeUntilBy(this._stopper).onValue(event => {
|
|
253
|
+
let id = event.detail.id;
|
|
254
|
+
while (currentIds.has(id)) {
|
|
255
|
+
id = (0, _incrementName.default)(id);
|
|
256
|
+
}
|
|
257
|
+
currentIds.add(id);
|
|
258
|
+
const appName = event.detail.appName;
|
|
259
|
+
orderManager.addItem({
|
|
260
|
+
groupId: event.detail.appId,
|
|
261
|
+
id,
|
|
262
|
+
orderHint: event.detail.orderHint,
|
|
263
|
+
value: {
|
|
378
264
|
id,
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
iconUrl: event.detail.iconUrl,
|
|
388
|
-
hideTitleBar: event.detail.hideTitleBar,
|
|
389
|
-
el: event.target,
|
|
390
|
-
},
|
|
391
|
-
});
|
|
392
|
-
render();
|
|
393
|
-
|
|
394
|
-
if (!addonSidebarContainerEl) return;
|
|
395
|
-
|
|
396
|
-
iconArea = addonSidebarContainerEl.querySelector(
|
|
397
|
-
'.' + idMap('sidebar_iconArea')
|
|
398
|
-
);
|
|
399
|
-
if (!iconArea) {
|
|
400
|
-
iconArea = document.createElement('div');
|
|
401
|
-
iconArea.className = idMap('sidebar_iconArea');
|
|
402
|
-
addIconArea(iconArea, addonSidebarContainerEl, this._stopper);
|
|
265
|
+
appName,
|
|
266
|
+
appId: event.detail.appId,
|
|
267
|
+
instanceId: event.detail.instanceId,
|
|
268
|
+
title: event.detail.title,
|
|
269
|
+
iconClass: event.detail.iconClass,
|
|
270
|
+
iconUrl: event.detail.iconUrl,
|
|
271
|
+
hideTitleBar: event.detail.hideTitleBar,
|
|
272
|
+
el: event.target
|
|
403
273
|
}
|
|
274
|
+
});
|
|
275
|
+
render();
|
|
276
|
+
if (!addonSidebarContainerEl) return;
|
|
277
|
+
iconArea = addonSidebarContainerEl.querySelector('.' + (0, _idMap.default)('sidebar_iconArea'));
|
|
278
|
+
if (!iconArea) {
|
|
279
|
+
iconArea = document.createElement('div');
|
|
280
|
+
iconArea.className = (0, _idMap.default)('sidebar_iconArea');
|
|
281
|
+
(0, _addIconArea.default)(iconArea, addonSidebarContainerEl, this._stopper);
|
|
282
|
+
}
|
|
404
283
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
buttonContainer = document.createElement('div');
|
|
429
|
-
buttonContainer.className = idMap('sidebar_button_container');
|
|
430
|
-
buttonContainer.setAttribute('data-app-name', appName);
|
|
431
|
-
buttonContainer.setAttribute('data-count', String(1));
|
|
432
|
-
buttonContainer.innerHTML = autoHtml`
|
|
284
|
+
// we put adding the content panel icon in the iconArea in an asap so that we
|
|
285
|
+
// get consistent ordering. The ordering of the icons is based on the position of the FIRST
|
|
286
|
+
// panel with that app name. This means we need to wait for all the panels for a particular appName
|
|
287
|
+
// to be added first, and then we can get the correct position
|
|
288
|
+
(0, _asap.default)(() => {
|
|
289
|
+
if (!iconArea) throw new Error('should not happen');
|
|
290
|
+
const instanceId = event.detail.instanceId;
|
|
291
|
+
const appIconUrl = event.detail.appIconUrl;
|
|
292
|
+
|
|
293
|
+
// If there's an existing button for the app, then just increment its
|
|
294
|
+
// data-count attribute instead of adding a new button.
|
|
295
|
+
const existingButtonContainer = buttonContainers.get(appName);
|
|
296
|
+
let buttonContainer;
|
|
297
|
+
if (existingButtonContainer) {
|
|
298
|
+
const currentCount = Number(existingButtonContainer.getAttribute('data-count')) || 1;
|
|
299
|
+
existingButtonContainer.setAttribute('data-count', String(currentCount + 1));
|
|
300
|
+
buttonContainer = existingButtonContainer;
|
|
301
|
+
} else {
|
|
302
|
+
buttonContainer = document.createElement('div');
|
|
303
|
+
buttonContainer.className = (0, _idMap.default)('sidebar_button_container');
|
|
304
|
+
buttonContainer.setAttribute('data-app-name', appName);
|
|
305
|
+
buttonContainer.setAttribute('data-count', String(1));
|
|
306
|
+
buttonContainer.innerHTML = (0, _autoHtml.default)`
|
|
433
307
|
<button class="inboxsdk__button_icon" type="button" data-tooltip="${appName}">
|
|
434
308
|
<img class="inboxsdk__button_iconImg" src="${appIconUrl}">
|
|
435
309
|
</button>
|
|
436
310
|
<div class="inboxsdk__button_selectedIndicator"></div>
|
|
437
311
|
`;
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
312
|
+
if (event.detail.primaryColor) {
|
|
313
|
+
(0, _querySelectorOrFail.default)(buttonContainer, '.inboxsdk__button_selectedIndicator').style.backgroundColor = event.detail.primaryColor;
|
|
314
|
+
}
|
|
315
|
+
buttonContainers.set(appName, buttonContainer);
|
|
316
|
+
(0, _querySelectorOrFail.default)(buttonContainer, 'button').addEventListener('click', event => {
|
|
317
|
+
event.stopPropagation();
|
|
318
|
+
const activeButtonContainer = iconArea ? iconArea.querySelector('.sidebar_button_container_active') : null;
|
|
319
|
+
if (activeButtonContainer) {
|
|
320
|
+
activeButtonContainer.classList.remove('sidebar_button_container_active');
|
|
444
321
|
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
(
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
'sidebar_button_container_active'
|
|
459
|
-
);
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
if (activeButtonContainer === buttonContainer) {
|
|
463
|
-
if (addonSidebarContainerEl)
|
|
464
|
-
addonSidebarContainerEl.classList.remove(
|
|
465
|
-
'app_sidebar_visible'
|
|
466
|
-
);
|
|
467
|
-
if (contentContainer)
|
|
468
|
-
contentContainer.classList.remove(
|
|
469
|
-
'container_app_sidebar_visible'
|
|
470
|
-
);
|
|
471
|
-
|
|
472
|
-
this._setShouldAppSidebarOpen(false);
|
|
473
|
-
} else {
|
|
474
|
-
if (addonSidebarContainerEl)
|
|
475
|
-
addonSidebarContainerEl.classList.add(
|
|
476
|
-
'app_sidebar_visible'
|
|
477
|
-
);
|
|
478
|
-
buttonContainer.classList.add(
|
|
479
|
-
'sidebar_button_container_active'
|
|
480
|
-
);
|
|
481
|
-
if (contentContainer)
|
|
482
|
-
contentContainer.classList.add(
|
|
483
|
-
'container_app_sidebar_visible'
|
|
484
|
-
);
|
|
485
|
-
|
|
486
|
-
this._setShouldAppSidebarOpen(true);
|
|
487
|
-
|
|
488
|
-
if (addonSidebarContainerEl) {
|
|
489
|
-
// check and deactivate add-on sidebar
|
|
490
|
-
const activeAddOnIcon =
|
|
491
|
-
addonSidebarContainerEl.querySelector(
|
|
492
|
-
ACTIVE_ADD_ON_ICON_SELECTOR
|
|
493
|
-
);
|
|
494
|
-
if (activeAddOnIcon) simulateClick(activeAddOnIcon);
|
|
495
|
-
|
|
496
|
-
//fake resize to get gmail to fix any heights that are messed up
|
|
497
|
-
fakeWindowResize();
|
|
498
|
-
|
|
499
|
-
// if the tabList is still loading then handle the case where the user
|
|
500
|
-
// clicks on an SDK icon to bring up an SDK app when Gmail thinks that it needs
|
|
501
|
-
// to bring up an Add-On sidebar (since that was last visible from Gmail's perspective)
|
|
502
|
-
// so we need to suppress Gmail bringing up their sidebar. This handles the flag of if we
|
|
503
|
-
// need to suppress
|
|
504
|
-
const nativeIconArea =
|
|
505
|
-
addonSidebarContainerEl.firstElementChild;
|
|
506
|
-
if (!nativeIconArea) return;
|
|
507
|
-
const loadingHolderAsAny: any =
|
|
508
|
-
nativeIconArea.firstElementChild;
|
|
509
|
-
const loadingHolder = (loadingHolderAsAny: ?HTMLElement);
|
|
510
|
-
if (!loadingHolder) return;
|
|
511
|
-
|
|
512
|
-
if (loadingHolder.style.display !== 'none') {
|
|
513
|
-
activatedWhileLoading = true;
|
|
514
|
-
makeMutationObserverChunkedStream(loadingHolder, {
|
|
515
|
-
attributes: true,
|
|
516
|
-
attributeFilter: ['style'],
|
|
517
|
-
})
|
|
518
|
-
.toProperty(() => null)
|
|
519
|
-
.map(() => loadingHolder.style.display === 'none')
|
|
520
|
-
.filter(Boolean)
|
|
521
|
-
.take(1)
|
|
522
|
-
.delay(150)
|
|
523
|
-
.takeUntilBy(this._stopper)
|
|
524
|
-
.onValue(() => {
|
|
525
|
-
activatedWhileLoading = false;
|
|
526
|
-
});
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
component.openPanel(instanceId);
|
|
531
|
-
component.scrollPanelIntoView(instanceId, true);
|
|
532
|
-
}
|
|
533
|
-
},
|
|
534
|
-
true
|
|
535
|
-
);
|
|
536
|
-
|
|
537
|
-
if (iconArea)
|
|
538
|
-
addToIconArea(orderManager, appName, buttonContainer, iconArea);
|
|
539
|
-
|
|
540
|
-
if (widthManager) widthManager.fixWidths();
|
|
541
|
-
|
|
542
|
-
if (this._getShouldAppSidebarOpen()) {
|
|
543
|
-
// if we last had an SDK sidebar open then bring up the SDK sidebar when the first
|
|
544
|
-
// panel gets added
|
|
545
|
-
const activeButtonContainer = iconArea.querySelector(
|
|
546
|
-
'.sidebar_button_container_active'
|
|
547
|
-
);
|
|
548
|
-
if (!activeButtonContainer) {
|
|
549
|
-
buttonContainer.classList.add(
|
|
550
|
-
'sidebar_button_container_active'
|
|
551
|
-
);
|
|
552
|
-
|
|
553
|
-
if (addonSidebarContainerEl)
|
|
554
|
-
addonSidebarContainerEl.classList.add('app_sidebar_visible');
|
|
555
|
-
if (contentContainer)
|
|
556
|
-
contentContainer.classList.add(
|
|
557
|
-
'container_app_sidebar_visible'
|
|
558
|
-
);
|
|
322
|
+
if (activeButtonContainer === buttonContainer) {
|
|
323
|
+
if (addonSidebarContainerEl) addonSidebarContainerEl.classList.remove('app_sidebar_visible');
|
|
324
|
+
if (contentContainer) contentContainer.classList.remove('container_app_sidebar_visible');
|
|
325
|
+
this._setShouldAppSidebarOpen(false);
|
|
326
|
+
} else {
|
|
327
|
+
if (addonSidebarContainerEl) addonSidebarContainerEl.classList.add('app_sidebar_visible');
|
|
328
|
+
buttonContainer.classList.add('sidebar_button_container_active');
|
|
329
|
+
if (contentContainer) contentContainer.classList.add('container_app_sidebar_visible');
|
|
330
|
+
this._setShouldAppSidebarOpen(true);
|
|
331
|
+
if (addonSidebarContainerEl) {
|
|
332
|
+
// check and deactivate add-on sidebar
|
|
333
|
+
const activeAddOnIcon = addonSidebarContainerEl.querySelector(ACTIVE_ADD_ON_ICON_SELECTOR);
|
|
334
|
+
if (activeAddOnIcon) (0, _simulateMouseEvent.simulateClick)(activeAddOnIcon);
|
|
559
335
|
|
|
560
336
|
//fake resize to get gmail to fix any heights that are messed up
|
|
561
|
-
|
|
337
|
+
(0, _fakeWindowResize.default)();
|
|
338
|
+
|
|
339
|
+
// if the tabList is still loading then handle the case where the user
|
|
340
|
+
// clicks on an SDK icon to bring up an SDK app when Gmail thinks that it needs
|
|
341
|
+
// to bring up an Add-On sidebar (since that was last visible from Gmail's perspective)
|
|
342
|
+
// so we need to suppress Gmail bringing up their sidebar. This handles the flag of if we
|
|
343
|
+
// need to suppress
|
|
344
|
+
const nativeIconArea = addonSidebarContainerEl.firstElementChild;
|
|
345
|
+
if (!nativeIconArea) return;
|
|
346
|
+
const loadingHolderAsAny = nativeIconArea.firstElementChild;
|
|
347
|
+
const loadingHolder = loadingHolderAsAny;
|
|
348
|
+
if (!loadingHolder) return;
|
|
349
|
+
if (loadingHolder.style.display !== 'none') {
|
|
350
|
+
activatedWhileLoading = true;
|
|
351
|
+
(0, _makeMutationObserverChunkedStream.default)(loadingHolder, {
|
|
352
|
+
attributes: true,
|
|
353
|
+
attributeFilter: ['style']
|
|
354
|
+
}).toProperty(() => null).map(() => loadingHolder.style.display === 'none').filter(Boolean).take(1).delay(150).takeUntilBy(this._stopper).onValue(() => {
|
|
355
|
+
activatedWhileLoading = false;
|
|
356
|
+
});
|
|
357
|
+
}
|
|
562
358
|
}
|
|
359
|
+
component.openPanel(instanceId);
|
|
360
|
+
component.scrollPanelIntoView(instanceId, true);
|
|
361
|
+
}
|
|
362
|
+
}, true);
|
|
363
|
+
if (iconArea) (0, _addToIconArea.default)(orderManager, appName, buttonContainer, iconArea);
|
|
364
|
+
if (widthManager) widthManager.fixWidths();
|
|
365
|
+
if (this._getShouldAppSidebarOpen()) {
|
|
366
|
+
// if we last had an SDK sidebar open then bring up the SDK sidebar when the first
|
|
367
|
+
// panel gets added
|
|
368
|
+
const activeButtonContainer = iconArea.querySelector('.sidebar_button_container_active');
|
|
369
|
+
if (!activeButtonContainer) {
|
|
370
|
+
buttonContainer.classList.add('sidebar_button_container_active');
|
|
371
|
+
if (addonSidebarContainerEl) addonSidebarContainerEl.classList.add('app_sidebar_visible');
|
|
372
|
+
if (contentContainer) contentContainer.classList.add('container_app_sidebar_visible');
|
|
373
|
+
|
|
374
|
+
//fake resize to get gmail to fix any heights that are messed up
|
|
375
|
+
(0, _fakeWindowResize.default)();
|
|
563
376
|
}
|
|
564
377
|
}
|
|
565
|
-
}
|
|
378
|
+
}
|
|
566
379
|
});
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
.
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
appName: event.detail.appName || event.detail.title,
|
|
583
|
-
instanceId: event.detail.instanceId,
|
|
584
|
-
title: event.detail.title,
|
|
585
|
-
iconClass: event.detail.iconClass,
|
|
586
|
-
iconUrl: event.detail.iconUrl,
|
|
587
|
-
hideTitleBar: event.detail.hideTitleBar,
|
|
588
|
-
el: event.target,
|
|
589
|
-
});
|
|
590
|
-
render();
|
|
380
|
+
});
|
|
381
|
+
_kefir.default.fromEvents(document.body, 'inboxsdkUpdateSidebarPanel').filter(e => e.detail.sidebarId === this._instanceId).takeUntilBy(this._stopper).onValue(event => {
|
|
382
|
+
const orderedItems = orderManager.getOrderedItems();
|
|
383
|
+
const index = (0, _findIndex.default)(orderedItems, x => x.value.instanceId === event.detail.instanceId);
|
|
384
|
+
if (index === -1) throw new Error('should not happen: failed to find orderItem');
|
|
385
|
+
orderManager.updateItemValueByIndex(index, {
|
|
386
|
+
id: orderedItems[index].value.id,
|
|
387
|
+
appId: event.detail.appId,
|
|
388
|
+
appName: event.detail.appName || event.detail.title,
|
|
389
|
+
instanceId: event.detail.instanceId,
|
|
390
|
+
title: event.detail.title,
|
|
391
|
+
iconClass: event.detail.iconClass,
|
|
392
|
+
iconUrl: event.detail.iconUrl,
|
|
393
|
+
hideTitleBar: event.detail.hideTitleBar,
|
|
394
|
+
el: event.target
|
|
591
395
|
});
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
.
|
|
596
|
-
.
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
);
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
const appName = event.detail.appName;
|
|
622
|
-
|
|
623
|
-
const container = buttonContainers.get(appName);
|
|
624
|
-
if (container) {
|
|
625
|
-
const currentCount = Number(container.getAttribute('data-count'));
|
|
626
|
-
if (currentCount <= 1) {
|
|
627
|
-
const activeButtonContainer = el.querySelector(
|
|
628
|
-
'.sidebar_button_container_active'
|
|
629
|
-
);
|
|
630
|
-
container.remove();
|
|
631
|
-
buttonContainers.delete(appName);
|
|
632
|
-
if (container === activeButtonContainer) {
|
|
633
|
-
if (addonSidebarContainerEl) {
|
|
634
|
-
addonSidebarContainerEl.classList.remove('app_sidebar_visible');
|
|
635
|
-
if (contentContainer)
|
|
636
|
-
contentContainer.classList.remove(
|
|
637
|
-
'container_app_sidebar_visible'
|
|
638
|
-
);
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
this._setShouldAppSidebarOpen(false);
|
|
396
|
+
render();
|
|
397
|
+
});
|
|
398
|
+
_kefir.default.fromEvents(document.body, 'inboxsdkRemoveSidebarPanel').filter(e => e.detail.sidebarId === this._instanceId).takeUntilBy(this._stopper).onValue(event => {
|
|
399
|
+
const orderedItems = orderManager.getOrderedItems();
|
|
400
|
+
const index = (0, _findIndex.default)(orderedItems, x => x.value.instanceId === event.detail.instanceId);
|
|
401
|
+
if (index === -1) throw new Error('should not happen: failed to find orderItem');
|
|
402
|
+
currentIds.delete(orderedItems[index].id);
|
|
403
|
+
orderManager.removeItemByIndex(index);
|
|
404
|
+
if (orderManager.getOrderedItems().length === 0) {
|
|
405
|
+
this.destroy();
|
|
406
|
+
} else {
|
|
407
|
+
render();
|
|
408
|
+
}
|
|
409
|
+
if (!addonSidebarContainerEl) return;
|
|
410
|
+
iconArea = addonSidebarContainerEl.querySelector('.' + (0, _idMap.default)('sidebar_iconArea'));
|
|
411
|
+
if (!iconArea) return;
|
|
412
|
+
if (widthManager) widthManager.fixWidths();
|
|
413
|
+
const appName = event.detail.appName;
|
|
414
|
+
const container = buttonContainers.get(appName);
|
|
415
|
+
if (container) {
|
|
416
|
+
const currentCount = Number(container.getAttribute('data-count'));
|
|
417
|
+
if (currentCount <= 1) {
|
|
418
|
+
const activeButtonContainer = el.querySelector('.sidebar_button_container_active');
|
|
419
|
+
container.remove();
|
|
420
|
+
buttonContainers.delete(appName);
|
|
421
|
+
if (container === activeButtonContainer) {
|
|
422
|
+
if (addonSidebarContainerEl) {
|
|
423
|
+
addonSidebarContainerEl.classList.remove('app_sidebar_visible');
|
|
424
|
+
if (contentContainer) contentContainer.classList.remove('container_app_sidebar_visible');
|
|
642
425
|
}
|
|
643
|
-
|
|
644
|
-
container.removeAttribute('data-count');
|
|
645
|
-
} else {
|
|
646
|
-
container.setAttribute('data-count', String(currentCount - 1));
|
|
426
|
+
this._setShouldAppSidebarOpen(false);
|
|
647
427
|
}
|
|
428
|
+
} else if (currentCount === 2) {
|
|
429
|
+
container.removeAttribute('data-count');
|
|
430
|
+
} else {
|
|
431
|
+
container.setAttribute('data-count', String(currentCount - 1));
|
|
648
432
|
}
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
.
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
Kefir.fromEvents((document.body: any), 'inboxsdkSidebarPanelClose')
|
|
658
|
-
.takeUntilBy(this._stopper)
|
|
659
|
-
.onValue((event) => {
|
|
660
|
-
component.closePanel(event.detail.instanceId);
|
|
661
|
-
});
|
|
662
|
-
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
_kefir.default.fromEvents(document.body, 'inboxsdkSidebarPanelScrollIntoView').takeUntilBy(this._stopper).onValue(event => {
|
|
436
|
+
component.scrollPanelIntoView(event.detail.instanceId);
|
|
437
|
+
});
|
|
438
|
+
_kefir.default.fromEvents(document.body, 'inboxsdkSidebarPanelClose').takeUntilBy(this._stopper).onValue(event => {
|
|
439
|
+
component.closePanel(event.detail.instanceId);
|
|
440
|
+
});
|
|
663
441
|
if (addonSidebarContainerEl) {
|
|
664
442
|
// listen for add-on sidebar contents to become visible which can happen in 1 of two cases
|
|
665
443
|
// 1. user clicks on an Add-Icon icon
|
|
666
444
|
// 2. Gmail automatically opens an Add-on sidebar because it was last open in previous thread
|
|
667
|
-
const addonSidebarContentContainerElement =
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
if (
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
// we need to suppress this sidebar from loading
|
|
687
|
-
if (activatedWhileLoading) {
|
|
688
|
-
const activeAddOnIcon = addonSidebarContainerEl.querySelector(
|
|
689
|
-
ACTIVE_ADD_ON_ICON_SELECTOR
|
|
690
|
-
);
|
|
691
|
-
if (activeAddOnIcon) simulateClick(activeAddOnIcon);
|
|
692
|
-
return;
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
this._setShouldAppSidebarOpen(false);
|
|
696
|
-
|
|
697
|
-
const activeButtonContainer = iconArea
|
|
698
|
-
? iconArea.querySelector('.sidebar_button_container_active')
|
|
699
|
-
: null;
|
|
700
|
-
if (activeButtonContainer) {
|
|
701
|
-
addonSidebarContainerEl.classList.remove('app_sidebar_visible');
|
|
702
|
-
activeButtonContainer.classList.remove(
|
|
703
|
-
'sidebar_button_container_active'
|
|
704
|
-
);
|
|
705
|
-
if (contentContainer)
|
|
706
|
-
contentContainer.classList.remove(
|
|
707
|
-
'container_app_sidebar_visible'
|
|
708
|
-
);
|
|
709
|
-
}
|
|
710
|
-
} else {
|
|
711
|
-
if (contentContainer)
|
|
712
|
-
contentContainer.classList.remove(
|
|
713
|
-
'container_addon_sidebar_visible'
|
|
714
|
-
);
|
|
445
|
+
const addonSidebarContentContainerElement = (0, _querySelectorOrFail.default)(addonSidebarContainerEl, ADD_ON_SIDEBAR_CONTENT_SELECTOR);
|
|
446
|
+
(0, _makeElementChildStream.default)(addonSidebarContentContainerElement).flatMap(_ref => {
|
|
447
|
+
let {
|
|
448
|
+
el,
|
|
449
|
+
removalStream
|
|
450
|
+
} = _ref;
|
|
451
|
+
return (0, _makeMutationObserverChunkedStream.default)(el, {
|
|
452
|
+
attributes: true,
|
|
453
|
+
attributeFilter: ['style']
|
|
454
|
+
}).toProperty(() => null).map(() => el.style.display !== 'none');
|
|
455
|
+
}).takeUntilBy(this._stopper).onValue(isDisplayingGmailAddonSidebar => {
|
|
456
|
+
if (isDisplayingGmailAddonSidebar) {
|
|
457
|
+
if (contentContainer) contentContainer.classList.add('container_addon_sidebar_visible');
|
|
458
|
+
|
|
459
|
+
// we need to suppress this sidebar from loading
|
|
460
|
+
if (activatedWhileLoading) {
|
|
461
|
+
const activeAddOnIcon = addonSidebarContainerEl.querySelector(ACTIVE_ADD_ON_ICON_SELECTOR);
|
|
462
|
+
if (activeAddOnIcon) (0, _simulateMouseEvent.simulateClick)(activeAddOnIcon);
|
|
463
|
+
return;
|
|
715
464
|
}
|
|
716
|
-
|
|
465
|
+
this._setShouldAppSidebarOpen(false);
|
|
466
|
+
const activeButtonContainer = iconArea ? iconArea.querySelector('.sidebar_button_container_active') : null;
|
|
467
|
+
if (activeButtonContainer) {
|
|
468
|
+
addonSidebarContainerEl.classList.remove('app_sidebar_visible');
|
|
469
|
+
activeButtonContainer.classList.remove('sidebar_button_container_active');
|
|
470
|
+
if (contentContainer) contentContainer.classList.remove('container_app_sidebar_visible');
|
|
471
|
+
}
|
|
472
|
+
} else {
|
|
473
|
+
if (contentContainer) contentContainer.classList.remove('container_addon_sidebar_visible');
|
|
474
|
+
}
|
|
475
|
+
});
|
|
717
476
|
}
|
|
718
|
-
|
|
719
477
|
if (addonSidebarContainerEl) {
|
|
720
478
|
//listen for scroll and update active icon if needed
|
|
721
|
-
|
|
722
|
-
.
|
|
723
|
-
|
|
724
|
-
updateHighlightedAppIconBus.emit(null);
|
|
725
|
-
});
|
|
479
|
+
_kefir.default.fromEvents(el, 'scroll').takeUntilBy(this._stopper).onValue(() => {
|
|
480
|
+
updateHighlightedAppIconBus.emit(null);
|
|
481
|
+
});
|
|
726
482
|
}
|
|
727
483
|
}
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
const panel = new ContentPanelViewDriver(
|
|
731
|
-
this._driver,
|
|
732
|
-
descriptor,
|
|
733
|
-
this._instanceId
|
|
734
|
-
);
|
|
735
|
-
|
|
484
|
+
addSidebarContentPanel(descriptor) {
|
|
485
|
+
const panel = new _ContentPanelViewDriver.default(this._driver, descriptor, this._instanceId);
|
|
736
486
|
this._stopper.takeUntilBy(panel.getStopper()).onValue(() => {
|
|
737
487
|
panel.remove();
|
|
738
488
|
});
|
|
739
|
-
|
|
740
489
|
return panel;
|
|
741
490
|
}
|
|
742
491
|
}
|
|
743
|
-
|
|
744
|
-
|
|
492
|
+
var _default = (0, _ud.defn)(module, GmailAppSidebarView);
|
|
493
|
+
exports.default = _default;
|