@inboxsdk/core 0.2.28-alpha.0 → 0.2.28-alpha.1
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.d.ts +1 -0
- package/inboxsdk.js +299 -56
- package/inboxsdk.js.map +1 -1
- package/package.json +3 -1
- package/pageWorld.js +46 -12
- package/pageWorld.js.map +1 -1
- package/src/build/exec.d.ts +1 -0
- package/src/build/exec.d.ts.map +1 -0
- package/src/build/spawn.d.ts +1 -0
- package/src/build/spawn.d.ts.map +1 -0
- package/src/common/ajax.d.ts +1 -0
- package/src/common/ajax.d.ts.map +1 -0
- package/src/common/cachebust-url.d.ts +1 -0
- package/src/common/cachebust-url.d.ts.map +1 -0
- package/src/common/censorHTMLstring.d.ts +1 -0
- package/src/common/censorHTMLstring.d.ts.map +1 -0
- package/src/common/censorHTMLtree.d.ts +1 -0
- package/src/common/censorHTMLtree.d.ts.map +1 -0
- package/src/common/censorJSONTree.d.ts +1 -0
- package/src/common/censorJSONTree.d.ts.map +1 -0
- package/src/common/connectivity-test.d.ts +1 -0
- package/src/common/connectivity-test.d.ts.map +1 -0
- package/src/common/defer.d.ts +1 -0
- package/src/common/defer.d.ts.map +1 -0
- package/src/common/find-parent.d.ts +1 -0
- package/src/common/find-parent.d.ts.map +1 -0
- package/src/common/get-extension-id.d.ts +1 -0
- package/src/common/get-extension-id.d.ts.map +1 -0
- package/src/common/get-or-fail.d.ts +1 -0
- package/src/common/get-or-fail.d.ts.map +1 -0
- package/src/common/get-session-id.d.ts +1 -0
- package/src/common/get-session-id.d.ts.map +1 -0
- package/src/common/get-stack-trace.d.ts +1 -0
- package/src/common/get-stack-trace.d.ts.map +1 -0
- package/src/common/html-to-text.d.ts +1 -0
- package/src/common/html-to-text.d.ts.map +1 -0
- package/src/common/isElementVisible.d.ts +1 -0
- package/src/common/isElementVisible.d.ts.map +1 -0
- package/src/common/load-script.d.ts +1 -0
- package/src/common/load-script.d.ts.map +1 -0
- package/src/common/log-error.d.ts +1 -0
- package/src/common/log-error.d.ts.map +1 -0
- package/src/common/quoted-split.d.ts +1 -0
- package/src/common/quoted-split.d.ts.map +1 -0
- package/src/common/rate-limit-queuer.d.ts +1 -0
- package/src/common/rate-limit-queuer.d.ts.map +1 -0
- package/src/common/rate-limit.d.ts +1 -0
- package/src/common/rate-limit.d.ts.map +1 -0
- package/src/common/version.d.ts +1 -0
- package/src/common/version.d.ts.map +1 -0
- package/src/inboxsdk-js/check-requirements.js +7 -0
- package/src/inboxsdk-js/header.js +18 -0
- package/src/inboxsdk-js/inboxsdk-NONREMOTE-INTEGRATED-PAGEWORLD.js +10 -0
- package/src/inboxsdk-js/inboxsdk-NONREMOTE.js +5 -0
- package/src/inboxsdk-js/inboxsdk-REMOTE.js +3 -0
- package/src/inboxsdk-js/inboxsdk-TEST.js +5 -0
- package/src/inboxsdk-js/inboxsdk.js +41 -0
- package/src/inboxsdk-js/loading/load-platform-implementation-DEV.js +19 -0
- package/src/inboxsdk-js/loading/platform-implementation-loader.d.ts +1 -0
- package/src/inboxsdk-js/loading/platform-implementation-loader.d.ts.map +1 -0
- package/src/inboxsdk.d.ts +9 -28
- package/src/injected-js/gmail/constants.d.ts +1 -0
- package/src/injected-js/gmail/constants.d.ts.map +1 -0
- package/src/injected-js/gmail/modify-suggestions.d.ts +1 -0
- package/src/injected-js/gmail/modify-suggestions.d.ts.map +1 -0
- package/src/injected-js/gmail/modify-suggestions.test.js +21 -0
- package/src/injected-js/gmail/setup-gmail-interceptor.d.ts +4 -0
- package/src/injected-js/gmail/setup-gmail-interceptor.js +1185 -0
- package/src/injected-js/gmail/setup-gmonkey-handler.d.ts +1 -0
- package/src/injected-js/gmail/setup-gmonkey-handler.d.ts.map +1 -0
- package/src/injected-js/gmail/sync-compose-processor-20220909.d.ts +1 -0
- package/src/injected-js/gmail/sync-compose-processor-20220909.d.ts.map +1 -0
- package/src/injected-js/gmail/sync-compose-processor.d.ts +1 -0
- package/src/injected-js/gmail/sync-compose-processor.d.ts.map +1 -0
- package/src/injected-js/gmail/sync-compose-request-processor.d.ts +1 -0
- package/src/injected-js/gmail/sync-compose-request-processor.d.ts.map +1 -0
- package/src/injected-js/gmail/sync-compose-request-processor.test.js +90 -0
- package/src/injected-js/gmail/thread-identifier/click-and-get-popup-url.js +96 -0
- package/src/injected-js/gmail/thread-identifier/index.js +157 -0
- package/src/injected-js/gmail/thread-identifier/thread-row-parser.js +72 -0
- package/src/injected-js/gmail/thread-identifier/thread-row-parser.test.js +57 -0
- package/src/injected-js/inbox/setupAjaxInterceptor.js +268 -0
- package/src/injected-js/inbox/setupClickAndGetNewIframeSrc.js +80 -0
- package/src/injected-js/inbox/setupComposeViewDraftIDFinder.js +51 -0
- package/src/injected-js/inbox/setupInboxFakeWindowResizeListener.js +29 -0
- package/src/injected-js/injected-logger.d.ts +1 -0
- package/src/injected-js/injected-logger.d.ts.map +1 -0
- package/src/injected-js/main.js +70 -0
- package/src/injected-js/message-metadata-holder.js +141 -0
- package/src/injected-js/setup-data-exposer.js +187 -0
- package/src/injected-js/setup-error-silencer.js +25 -0
- package/src/injected-js/setup-event-reemitter.js +52 -0
- package/src/injected-js/setupCustomViewEventAssassin.d.ts +1 -0
- package/src/injected-js/setupCustomViewEventAssassin.d.ts.map +1 -0
- package/src/injected-js/setupInboxCustomViewLinkFixer.js +31 -0
- package/src/injected-js/setupPushStateListener.js +16 -0
- package/src/injected-js/xhr-helper.js +86 -0
- package/src/injected-js/xhr-proxy-factory.js +739 -0
- package/src/injected-js/xhr-proxy-factory.test.js +1219 -0
- package/src/platform-implementation-js/constants/nav-item-types.d.ts +1 -0
- package/src/platform-implementation-js/constants/nav-item-types.d.ts.map +1 -0
- package/src/platform-implementation-js/constants/router.js +53 -0
- package/src/platform-implementation-js/constants/toolbars.js +7 -0
- package/src/platform-implementation-js/dom-driver/gmail/custom-style.js +22 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-butter-bar-driver.js +214 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-app-menu-item.d.ts +5 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-app-menu-item.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-collapsible-panel.d.ts +5 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-collapsible-panel.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-nav-item.d.ts +3 -2
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-nav-item.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-support-item.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-support-item.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-toolbar-button-for-app.js +21 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/create-link.js +78 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/encodeDraftUrlId.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/encodeDraftUrlId.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-draft-id-for-message-id.js +70 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-native-nav-item.js +43 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-rfc-message-id-for-gmail-message-id.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-rfc-message-id-for-gmail-message-id.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-rfc-message-id-for-gmail-thread-id.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-rfc-message-id-for-gmail-thread-id.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-url-object.js +33 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadForOldGmailThreadId.js +38 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadFromSyncThreadId.js +76 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/gmail-load-event.js +61 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/goto-view.js +72 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/isIntegratedViewGmail.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/isIntegratedViewGmail.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/keyboard-shortcut-help-modifier.js +226 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-compose-window.js +27 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-draft-by-message-id.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-draft-by-message-id.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-draft-by-message-id.test.js +23 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/override-gmail-back-button.js +92 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/register-search-query-rewriter.js +30 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/register-search-suggestions-provider.js +207 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-compose-view-driver-stream.js +162 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-route-view-driver-stream.js +194 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-route-view-driver-stream.test.js +233 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-app-id-warning.js +30 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-route-view.js +79 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-thread-list.js +516 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-thread-list.test.js +404 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-native-route-view.js +33 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/suppressAddon.js +50 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/temporary-track-download-url-validity.js +45 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/thread-row-identifier.js +123 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-events.js +171 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-gmail-styles.d.ts +2 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-gmail-styles.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/user-info.js +69 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/user-info.test.js +79 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.d.ts +108 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.js +1001 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter/get-main-content-element-changed-stream.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter/get-main-content-element-changed-stream.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter/wait-for-gmail-mode-to-settle.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter/wait-for-gmail-mode-to-settle.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter.d.ts +4 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-page-communicator.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-page-communicator.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-response-processor.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-response-processor.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-sync-response-processor.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-sync-response-processor.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/is-compose-titlebar-light-color.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/is-compose-titlebar-light-color.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/make-xhr-interceptor.js +98 -0
- package/src/platform-implementation-js/dom-driver/gmail/makePageParserTree.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/makePageParserTree.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/pageParserOptions.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/pageParserOptions.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-menu-item-view.d.ts +43 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-menu-item-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.js +133 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.test.js +162 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-companion-global-icon-area.js +39 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-companion-thread-icon-area.js +47 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-to-icon-area.js +33 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/index.js +1048 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view/monitor-top-banner-size-and-react.js +27 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view.js +215 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-area-view.js +141 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-card-view.js +422 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-card-view.test.js +141 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-backdrop.js +34 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-collapsible-section-view.js +909 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-button.js +197 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-compose-notice.js +76 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-inner-sidebar.js +34 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-outer-sidebar.js +46 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-recipient-row.js +97 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-status-bar.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-status-bar.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-tooltip-to-button.js +125 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/detectClassicRecipientsArea.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/detectClassicRecipientsArea.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/ensure-app-button-toolbars-are-closed.js +22 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/ensure-grouping-is-open.js +29 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/focus.js +19 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/from-manager.js +82 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-additional-action-toolbar.js +67 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-address-changes-stream.js +151 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-address-information-extractor.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-address-information-extractor.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-body-changes-stream.js +20 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-formatting-area-offset-left.js +31 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-minimized-stream.js +30 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-recipients.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-recipients.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-response-type-changes-stream.js +33 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/gmail-compose-button-view.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/gmail-compose-button-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/insert-link-into-body.js +35 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/manage-button-grouping.js +533 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/monitor-selection-range.js +29 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/override-edit-subject.js +92 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/page-parser.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/page-parser.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/position-formatting-toolbar.js +28 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/set-recipients.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/set-recipients.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/setupLinkPopovers.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/setupLinkPopovers.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/size-fixer.js +177 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/update-insert-more-area-left.js +28 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view.d.ts +119 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view.js +1938 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view/attachment-icon.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view/attachment-icon.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view/get-updated-contact.js +85 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view.js +950 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-nav-item-view.d.ts +38 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-nav-item-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-processor.js +125 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-view.js +601 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-row-list-view.js +309 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-support-item-view.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-support-item-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-row-view.js +1287 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view/add-icon-area.js +127 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.js +744 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.test.js +349 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view/width-manager.js +49 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view.js +893 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-toolbar-view.js +591 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/native-gmail-nav-item-view.js +360 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/button-color-classes.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/button-color-classes.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/button-view.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/button-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-accessory-button-view.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-accessory-button-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-parent-accessory-button-view.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-parent-accessory-button-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/inbox-dropdown-button-view.js +32 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/modal-button-view.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/modal-button-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/more-dropdown-button-view.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/more-dropdown-button-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/more-parent-accessory-button-view.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/more-parent-accessory-button-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-action-button-view.js +57 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-dropdown-view.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-dropdown-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-label-view.js +148 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-modal-view-driver.js +179 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-mole-view-driver.js +246 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-tooltip-view.js +504 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-top-message-bar-driver.js +109 -0
- package/src/platform-implementation-js/dom-driver/inbox/__mocks__/getSidebarClassnames.js +9 -0
- package/src/platform-implementation-js/dom-driver/inbox/addNavItem.js +56 -0
- package/src/platform-implementation-js/dom-driver/inbox/addRecipientRow.js +73 -0
- package/src/platform-implementation-js/dom-driver/inbox/createLink.js +21 -0
- package/src/platform-implementation-js/dom-driver/inbox/createLink.test.js +30 -0
- package/src/platform-implementation-js/dom-driver/inbox/custom-style.js +22 -0
- package/src/platform-implementation-js/dom-driver/inbox/detection/appToolbarLocation/parser.js +49 -0
- package/src/platform-implementation-js/dom-driver/inbox/detection/attachmentCard/parser.js +33 -0
- package/src/platform-implementation-js/dom-driver/inbox/detection/attachmentOverlay/parser.js +85 -0
- package/src/platform-implementation-js/dom-driver/inbox/detection/chatSidebar/parser.js +33 -0
- package/src/platform-implementation-js/dom-driver/inbox/detection/compose/parser.js +220 -0
- package/src/platform-implementation-js/dom-driver/inbox/detection/message/parser.js +97 -0
- package/src/platform-implementation-js/dom-driver/inbox/detection/nativeDrawer/parser.js +30 -0
- package/src/platform-implementation-js/dom-driver/inbox/detection/searchBar/parser.js +28 -0
- package/src/platform-implementation-js/dom-driver/inbox/detection/thread/parser.js +60 -0
- package/src/platform-implementation-js/dom-driver/inbox/detection/thread-row/parser.js +152 -0
- package/src/platform-implementation-js/dom-driver/inbox/getComposeViewDriverLiveSet.js +121 -0
- package/src/platform-implementation-js/dom-driver/inbox/getInboxMessageIdForInboxThreadId.js +42 -0
- package/src/platform-implementation-js/dom-driver/inbox/getSidebarClassnames.js +171 -0
- package/src/platform-implementation-js/dom-driver/inbox/getSidebarClassnames.test.js +74 -0
- package/src/platform-implementation-js/dom-driver/inbox/gotoView.js +43 -0
- package/src/platform-implementation-js/dom-driver/inbox/gotoView.test.js +29 -0
- package/src/platform-implementation-js/dom-driver/inbox/inbox-butter-bar-driver.js +156 -0
- package/src/platform-implementation-js/dom-driver/inbox/inbox-driver.js +1164 -0
- package/src/platform-implementation-js/dom-driver/inbox/inbox-page-communicator.js +75 -0
- package/src/platform-implementation-js/dom-driver/inbox/inboxResponseProcessor.js +15 -0
- package/src/platform-implementation-js/dom-driver/inbox/inboxResponseProcessor.test.js +25 -0
- package/src/platform-implementation-js/dom-driver/inbox/makePageParserTree.js +42 -0
- package/src/platform-implementation-js/dom-driver/inbox/pageParserOptions.js +452 -0
- package/src/platform-implementation-js/dom-driver/inbox/registerSearchSuggestionsProvider.js +317 -0
- package/src/platform-implementation-js/dom-driver/inbox/setupCustomAutocompleteSelectionHandling.js +251 -0
- package/src/platform-implementation-js/dom-driver/inbox/setupRouteViewDriverStream.js +76 -0
- package/src/platform-implementation-js/dom-driver/inbox/setupRouteViewDriverStream.test.js +94 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxLabelView.js +103 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxMoleViewDriver.js +400 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxToolbarButtonView.js +105 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxToolbarView.js +72 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-sidebar-view.js +362 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-toolbar-button-view.js +236 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-toolbar-tooltip-view.js +75 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-attachment-card-view.js +252 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-attachment-overlay-view.js +108 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-backdrop.js +74 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-chat-sidebar-view.js +55 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-compose-button-view.js +144 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-compose-view.js +1027 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-custom-route-view.js +97 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-custom-route-view.test.js +43 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-drawer-view.js +386 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-dropdown-view.js +26 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-dummy-route-view.js +82 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-message-view.js +348 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-modal-view.js +153 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-route-view.js +123 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-row-view.js +413 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-view.js +308 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-view.test.js +193 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-tooltip-view.js +143 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inboxNavItemView.js +452 -0
- package/src/platform-implementation-js/dom-driver/inbox/waitForAnimationClickBlockerGone.js +40 -0
- package/src/platform-implementation-js/driver-common/compose/getDiscardStream.js +52 -0
- package/src/platform-implementation-js/driver-common/compose/getPresendingStream.js +73 -0
- package/src/platform-implementation-js/driver-common/getAccountUrlPart.d.ts +1 -0
- package/src/platform-implementation-js/driver-common/getAccountUrlPart.d.ts.map +1 -0
- package/src/platform-implementation-js/driver-common/getGmailMessageIdForSyncMessageId.js +30 -0
- package/src/platform-implementation-js/driver-common/getGmailThreadIdForRfcMessageId.js +61 -0
- package/src/platform-implementation-js/driver-common/getOriginalMessagePage.d.ts +1 -0
- package/src/platform-implementation-js/driver-common/getOriginalMessagePage.d.ts.map +1 -0
- package/src/platform-implementation-js/driver-common/getRfcMessageIdForSyncMessageId.js +32 -0
- package/src/platform-implementation-js/driver-common/getSyncThreadsForSearch.d.ts +1 -0
- package/src/platform-implementation-js/driver-common/getSyncThreadsForSearch.d.ts.map +1 -0
- package/src/platform-implementation-js/driver-common/getThreadIdFromMessageId.js +21 -0
- package/src/platform-implementation-js/driver-common/gmailAjax.d.ts +1 -0
- package/src/platform-implementation-js/driver-common/gmailAjax.d.ts.map +1 -0
- package/src/platform-implementation-js/driver-common/inboxAjax.js +8 -0
- package/src/platform-implementation-js/driver-common/render-custom-icon.d.ts +1 -0
- package/src/platform-implementation-js/driver-common/render-custom-icon.d.ts.map +1 -0
- package/src/platform-implementation-js/driver-common/requestGmailThread.js +35 -0
- package/src/platform-implementation-js/driver-common/sidebar/AppSidebar.js +408 -0
- package/src/platform-implementation-js/driver-common/sidebar/ContentPanelViewDriver.js +197 -0
- package/src/platform-implementation-js/driver-common/update-icon.d.ts +1 -0
- package/src/platform-implementation-js/driver-common/update-icon.d.ts.map +1 -0
- package/src/platform-implementation-js/driver-interfaces/compose-view-driver.d.ts +133 -0
- package/src/platform-implementation-js/driver-interfaces/compose-view-driver.js +114 -0
- package/src/platform-implementation-js/driver-interfaces/driver.d.ts +142 -0
- package/src/platform-implementation-js/driver-interfaces/driver.js +131 -0
- package/src/platform-implementation-js/driver-interfaces/message-view-driver.js +49 -0
- package/src/platform-implementation-js/driver-interfaces/mole-view-driver.js +29 -0
- package/src/platform-implementation-js/driver-interfaces/route-view-driver.js +32 -0
- package/src/platform-implementation-js/driver-interfaces/thread-row-view-driver.js +11 -0
- package/src/platform-implementation-js/lib/ErrorCollector.d.ts +1 -0
- package/src/platform-implementation-js/lib/ErrorCollector.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/Membrane.d.ts +1 -0
- package/src/platform-implementation-js/lib/Membrane.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/ScrollableContainByScreen.d.ts +1 -0
- package/src/platform-implementation-js/lib/ScrollableContainByScreen.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/array-to-lifetimes.js +67 -0
- package/src/platform-implementation-js/lib/array-to-lifetimes.test.js +171 -0
- package/src/platform-implementation-js/lib/attemptWithRetries.d.ts +1 -0
- package/src/platform-implementation-js/lib/attemptWithRetries.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/common-page-communicator.d.ts +1 -0
- package/src/platform-implementation-js/lib/common-page-communicator.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/copyAndValidateAutocompleteResults.js +55 -0
- package/src/platform-implementation-js/lib/css-selector-escape.js +8 -0
- package/src/platform-implementation-js/lib/delay-asap.d.ts +1 -0
- package/src/platform-implementation-js/lib/delay-asap.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/delay-idle.d.ts +1 -0
- package/src/platform-implementation-js/lib/delay-idle.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/dom/block-and-reemit-keyboard-events.d.ts +1 -0
- package/src/platform-implementation-js/lib/dom/block-and-reemit-keyboard-events.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/dom/element-view-mapper.js +20 -0
- package/src/platform-implementation-js/lib/dom/generic-button-view.d.ts +1 -0
- package/src/platform-implementation-js/lib/dom/generic-button-view.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/dom/get-insert-before-element.d.ts +1 -0
- package/src/platform-implementation-js/lib/dom/get-insert-before-element.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/dom/get-selection.js +61 -0
- package/src/platform-implementation-js/lib/dom/insert-element-in-order.d.ts +1 -0
- package/src/platform-implementation-js/lib/dom/insert-element-in-order.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/dom/insert-html-at-cursor.js +113 -0
- package/src/platform-implementation-js/lib/dom/is-node-in-range.js +19 -0
- package/src/platform-implementation-js/lib/dom/keyboard-shortcut-stream.d.ts +1 -0
- package/src/platform-implementation-js/lib/dom/keyboard-shortcut-stream.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/dom/make-element-child-stream.d.ts +1 -0
- package/src/platform-implementation-js/lib/dom/make-element-child-stream.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/dom/make-element-stream-merger.d.ts +1 -0
- package/src/platform-implementation-js/lib/dom/make-element-stream-merger.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/dom/make-element-view-stream.d.ts +1 -0
- package/src/platform-implementation-js/lib/dom/make-element-view-stream.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/dom/make-mutation-observer-chunked-stream.d.ts +1 -0
- package/src/platform-implementation-js/lib/dom/make-mutation-observer-chunked-stream.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/dom/make-mutation-observer-stream.d.ts +1 -0
- package/src/platform-implementation-js/lib/dom/make-mutation-observer-stream.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/dom/on-mouse-down-and-up.js +19 -0
- package/src/platform-implementation-js/lib/dom/outsideClicksAndEscape.d.ts +1 -0
- package/src/platform-implementation-js/lib/dom/outsideClicksAndEscape.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/dom/parentNodes.d.ts +1 -0
- package/src/platform-implementation-js/lib/dom/parentNodes.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/dom/querySelectorOne.js +16 -0
- package/src/platform-implementation-js/lib/dom/querySelectorOrFail.d.ts +1 -0
- package/src/platform-implementation-js/lib/dom/querySelectorOrFail.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/dom/reemitClickEventForReact.d.ts +1 -0
- package/src/platform-implementation-js/lib/dom/reemitClickEventForReact.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/dom/set-css.js +21 -0
- package/src/platform-implementation-js/lib/dom/set-value-and-dispatch-event.js +14 -0
- package/src/platform-implementation-js/lib/dom/simulate-drag-and-drop.js +98 -0
- package/src/platform-implementation-js/lib/dom/simulate-key.d.ts +1 -0
- package/src/platform-implementation-js/lib/dom/simulate-key.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/dom/simulate-mouse-event.d.ts +1 -0
- package/src/platform-implementation-js/lib/dom/simulate-mouse-event.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/dom/trigger-relay-event.d.ts +1 -0
- package/src/platform-implementation-js/lib/dom/trigger-relay-event.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/extract-contact-from-email-contact-string.d.ts +1 -0
- package/src/platform-implementation-js/lib/extract-contact-from-email-contact-string.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/extract-contact-from-email-contact-string.test.js +42 -0
- package/src/platform-implementation-js/lib/fake-window-resize.d.ts +1 -0
- package/src/platform-implementation-js/lib/fake-window-resize.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/from-event-target-capture.d.ts +1 -0
- package/src/platform-implementation-js/lib/from-event-target-capture.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/fromEventsWithOptions.d.ts +1 -0
- package/src/platform-implementation-js/lib/fromEventsWithOptions.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/handle-compose-link-chips.js +179 -0
- package/src/platform-implementation-js/lib/handler-registry.d.ts +1 -0
- package/src/platform-implementation-js/lib/handler-registry.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/idMap.d.ts +1 -0
- package/src/platform-implementation-js/lib/idMap.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/imageRequest.d.ts +1 -0
- package/src/platform-implementation-js/lib/imageRequest.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/incrementName.d.ts +1 -0
- package/src/platform-implementation-js/lib/incrementName.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/inject-script-EMBEDDED.d.ts +1 -0
- package/src/platform-implementation-js/lib/inject-script-EMBEDDED.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/inject-script.d.ts +1 -0
- package/src/platform-implementation-js/lib/inject-script.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/insert-link-chip-into-body.js +66 -0
- package/src/platform-implementation-js/lib/is-valid-app-id.d.ts +1 -0
- package/src/platform-implementation-js/lib/is-valid-app-id.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/is-valid-email.d.ts +1 -0
- package/src/platform-implementation-js/lib/is-valid-email.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/isNotNil.d.ts +1 -0
- package/src/platform-implementation-js/lib/isNotNil.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/isStreakAppId.d.ts +1 -0
- package/src/platform-implementation-js/lib/isStreakAppId.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/logger.d.ts +1 -0
- package/src/platform-implementation-js/lib/logger.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/make-revocable-function.js +40 -0
- package/src/platform-implementation-js/lib/make-revocable-function.test.js +63 -0
- package/src/platform-implementation-js/lib/parseParamsFromRouteID.js +20 -0
- package/src/platform-implementation-js/lib/parseParamsFromRouteID.test.js +28 -0
- package/src/platform-implementation-js/lib/persistent-queue.d.ts +1 -0
- package/src/platform-implementation-js/lib/persistent-queue.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/populateRouteID.js +23 -0
- package/src/platform-implementation-js/lib/populateRouteID.test.js +31 -0
- package/src/platform-implementation-js/lib/react/ElementContainer.js +35 -0
- package/src/platform-implementation-js/lib/rewriteCssWithIdMap.js +10 -0
- package/src/platform-implementation-js/lib/rewriteCssWithIdMap.test.js +50 -0
- package/src/platform-implementation-js/lib/routeIDmatchesHash.js +20 -0
- package/src/platform-implementation-js/lib/routeIDmatchesHash.test.js +23 -0
- package/src/platform-implementation-js/lib/safe-event-emitter.d.ts +1 -0
- package/src/platform-implementation-js/lib/safe-event-emitter.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/shared-style.js +22 -0
- package/src/platform-implementation-js/lib/stopper-pool.d.ts +1 -0
- package/src/platform-implementation-js/lib/stopper-pool.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/stream-wait-for.d.ts +1 -0
- package/src/platform-implementation-js/lib/stream-wait-for.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/toItemWithLifetimeStream.d.ts +7 -0
- package/src/platform-implementation-js/lib/toItemWithLifetimeStream.js +18 -0
- package/src/platform-implementation-js/lib/toLiveSet.js +31 -0
- package/src/platform-implementation-js/lib/wait-for.d.ts +2 -1
- package/src/platform-implementation-js/lib/wait-for.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/waitForAsync.d.ts +1 -0
- package/src/platform-implementation-js/lib/waitForAsync.d.ts.map +1 -0
- package/src/platform-implementation-js/main-INTEGRATED-PAGEWORLD.js +8 -0
- package/src/platform-implementation-js/main.js +83 -0
- package/src/platform-implementation-js/namespaces/app-menu.d.ts +38 -0
- package/src/platform-implementation-js/namespaces/app-menu.d.ts.map +1 -0
- package/src/platform-implementation-js/namespaces/butter-bar.d.ts +1 -0
- package/src/platform-implementation-js/namespaces/butter-bar.d.ts.map +1 -0
- package/src/platform-implementation-js/namespaces/compose.js +88 -0
- package/src/platform-implementation-js/namespaces/conversations.js +156 -0
- package/src/platform-implementation-js/namespaces/global.js +51 -0
- package/src/platform-implementation-js/namespaces/keyboard.js +48 -0
- package/src/platform-implementation-js/namespaces/lists.js +58 -0
- package/src/platform-implementation-js/namespaces/modal.js +45 -0
- package/src/platform-implementation-js/namespaces/nav-menu.js +55 -0
- package/src/platform-implementation-js/namespaces/router.js +217 -0
- package/src/platform-implementation-js/namespaces/search.js +36 -0
- package/src/platform-implementation-js/namespaces/toolbars.js +195 -0
- package/src/platform-implementation-js/namespaces/user.js +67 -0
- package/src/platform-implementation-js/namespaces/widgets.js +89 -0
- package/src/platform-implementation-js/platform-implementation.d.ts +133 -0
- package/src/platform-implementation-js/platform-implementation.js +309 -0
- package/src/platform-implementation-js/views/SimpleElementView.d.ts +1 -0
- package/src/platform-implementation-js/views/SimpleElementView.d.ts.map +1 -0
- package/src/platform-implementation-js/views/app-menu-item-view.d.ts +23 -0
- package/src/platform-implementation-js/views/app-menu-item-view.d.ts.map +1 -0
- package/src/platform-implementation-js/views/app-toolbar-button-view.js +73 -0
- package/src/platform-implementation-js/views/collapsible-panel-view.d.ts +50 -0
- package/src/platform-implementation-js/views/collapsible-panel-view.d.ts.map +1 -0
- package/src/platform-implementation-js/views/collapsible-section-view.js +88 -0
- package/src/platform-implementation-js/views/compose-button-view.d.ts +1 -0
- package/src/platform-implementation-js/views/compose-button-view.d.ts.map +1 -0
- package/src/platform-implementation-js/views/compose-view.d.ts +1 -0
- package/src/platform-implementation-js/views/compose-view.d.ts.map +1 -0
- package/src/platform-implementation-js/views/content-panel-view.js +53 -0
- package/src/platform-implementation-js/views/conversations/attachment-card-view.js +69 -0
- package/src/platform-implementation-js/views/conversations/custom-message-view.js +165 -0
- package/src/platform-implementation-js/views/conversations/message-view.js +288 -0
- package/src/platform-implementation-js/views/conversations/thread-view.js +156 -0
- package/src/platform-implementation-js/views/keyboard-shortcut-handle.d.ts +1 -0
- package/src/platform-implementation-js/views/keyboard-shortcut-handle.d.ts.map +1 -0
- package/src/platform-implementation-js/views/native-nav-item-view.js +98 -0
- package/src/platform-implementation-js/views/nav-item-view.d.ts +24 -0
- package/src/platform-implementation-js/views/nav-item-view.js +191 -0
- package/src/platform-implementation-js/views/route-view/custom-route-view.js +32 -0
- package/src/platform-implementation-js/views/route-view/dummy-route-view-driver.js +40 -0
- package/src/platform-implementation-js/views/route-view/list-route-view.js +78 -0
- package/src/platform-implementation-js/views/route-view/route-view.js +68 -0
- package/src/platform-implementation-js/views/section-view.js +77 -0
- package/src/platform-implementation-js/views/thread-row-view.js +117 -0
- package/src/platform-implementation-js/widgets/buttons/basic-button-view-controller.d.ts +1 -0
- package/src/platform-implementation-js/widgets/buttons/basic-button-view-controller.d.ts.map +1 -0
- package/src/platform-implementation-js/widgets/buttons/dropdown-button-view-controller.d.ts +1 -0
- package/src/platform-implementation-js/widgets/buttons/dropdown-button-view-controller.d.ts.map +1 -0
- package/src/platform-implementation-js/widgets/buttons/dropdown-view.d.ts +1 -0
- package/src/platform-implementation-js/widgets/buttons/dropdown-view.d.ts.map +1 -0
- package/src/platform-implementation-js/widgets/drawer-view.js +61 -0
- package/src/platform-implementation-js/widgets/modal-view.js +134 -0
- package/src/platform-implementation-js/widgets/mole-view.js +47 -0
- package/src/platform-implementation-js/widgets/top-message-bar-view.js +20 -0
- package/src/types/combokeys-capture.d.ts +1 -0
- package/src/types/gulp-add-src.d.ts +7 -0
- package/src/types/gulp-dest-atomic.d.ts +4 -0
- package/src/types/gulp-streamify.d.ts +1 -0
- package/src/types/gulp-terser.d.ts +4 -0
- package/src/types/jest-puppeteer.d.ts +11 -0
- package/src/types/notp.d.ts +8 -0
- package/src/types/sha.d.ts +36 -0
- package/src/types/stdio.d.ts +6 -0
- package/src/types/thirty-two.d.ts +6 -0
|
@@ -0,0 +1,1185 @@
|
|
|
1
|
+
/* @flow */
|
|
2
|
+
|
|
3
|
+
import clone from 'lodash/clone';
|
|
4
|
+
import flatten from 'lodash/flatten';
|
|
5
|
+
import find from 'lodash/find';
|
|
6
|
+
import intersection from 'lodash/intersection';
|
|
7
|
+
import includes from 'lodash/includes';
|
|
8
|
+
import BigNumber from 'bignumber.js';
|
|
9
|
+
|
|
10
|
+
import Kefir from 'kefir';
|
|
11
|
+
import * as logger from '../injected-logger';
|
|
12
|
+
import XHRProxyFactory from '../xhr-proxy-factory';
|
|
13
|
+
import querystring, { stringify } from 'querystring';
|
|
14
|
+
import * as threadIdentifier from './thread-identifier';
|
|
15
|
+
import * as messageMetadataHolder from '../message-metadata-holder';
|
|
16
|
+
import * as GmailResponseProcessor from '../../platform-implementation-js/dom-driver/gmail/gmail-response-processor';
|
|
17
|
+
import * as GmailSyncResponseProcessor from '../../platform-implementation-js/dom-driver/gmail/gmail-sync-response-processor';
|
|
18
|
+
import quotedSplit from '../../common/quoted-split';
|
|
19
|
+
import defer from '../../common/defer';
|
|
20
|
+
import modifySuggestions from './modify-suggestions';
|
|
21
|
+
|
|
22
|
+
import {
|
|
23
|
+
parseComposeRequestBody,
|
|
24
|
+
parseComposeResponseBody,
|
|
25
|
+
replaceBodyContentInComposeSendRequestBody,
|
|
26
|
+
} from './sync-compose-processor';
|
|
27
|
+
|
|
28
|
+
import type { XHRProxyConnectionDetails } from '../xhr-proxy-factory';
|
|
29
|
+
|
|
30
|
+
function logErrorExceptEventListeners(err, details) {
|
|
31
|
+
// Don't log Gmail's errors
|
|
32
|
+
if (details !== 'XMLHttpRequest event listener error') {
|
|
33
|
+
logger.error(err, details);
|
|
34
|
+
} else {
|
|
35
|
+
setTimeout(function () {
|
|
36
|
+
// let window.onerror log this
|
|
37
|
+
throw err;
|
|
38
|
+
}, 1);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default function setupGmailInterceptor() {
|
|
43
|
+
let jsFrame: ?WindowProxy = null;
|
|
44
|
+
|
|
45
|
+
const js_frame_element = top.document.getElementById('js_frame');
|
|
46
|
+
if (js_frame_element) {
|
|
47
|
+
jsFrame = js_frame_element.contentDocument.defaultView;
|
|
48
|
+
} else {
|
|
49
|
+
logger.eventSdkPassive('noJSFrameElementFound');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
setupGmailInterceptorOnFrames(window, jsFrame);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Split into a separate step to make it easy for tests to use.
|
|
56
|
+
export function setupGmailInterceptorOnFrames(
|
|
57
|
+
mainFrame: WindowProxy,
|
|
58
|
+
jsFrame: ?WindowProxy
|
|
59
|
+
) {
|
|
60
|
+
const main_wrappers = [],
|
|
61
|
+
js_frame_wrappers = [];
|
|
62
|
+
|
|
63
|
+
{
|
|
64
|
+
const main_originalXHR = mainFrame.XMLHttpRequest;
|
|
65
|
+
mainFrame.XMLHttpRequest = XHRProxyFactory(
|
|
66
|
+
main_originalXHR,
|
|
67
|
+
main_wrappers,
|
|
68
|
+
{
|
|
69
|
+
logError: logErrorExceptEventListeners,
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (jsFrame) {
|
|
75
|
+
const js_frame_originalXHR = jsFrame.XMLHttpRequest;
|
|
76
|
+
jsFrame.XMLHttpRequest = XHRProxyFactory(
|
|
77
|
+
js_frame_originalXHR,
|
|
78
|
+
js_frame_wrappers,
|
|
79
|
+
{ logError: logErrorExceptEventListeners }
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
threadIdentifier.setup();
|
|
84
|
+
messageMetadataHolder.setup();
|
|
85
|
+
|
|
86
|
+
//email sending modifier/notifier
|
|
87
|
+
{
|
|
88
|
+
let modifiers: { [key: string]: Array<string> } = {};
|
|
89
|
+
|
|
90
|
+
Kefir.fromEvents(
|
|
91
|
+
document,
|
|
92
|
+
'inboxSDKregisterComposeRequestModifier'
|
|
93
|
+
).onValue(({ detail }) => {
|
|
94
|
+
const keyId = detail.composeid || detail.draftID;
|
|
95
|
+
if (!modifiers[keyId]) {
|
|
96
|
+
modifiers[keyId] = [];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
modifiers[keyId].push(detail.modifierId);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
Kefir.fromEvents(
|
|
103
|
+
document,
|
|
104
|
+
'inboxSDKunregisterComposeRequestModifier'
|
|
105
|
+
).onValue(({ detail }) => {
|
|
106
|
+
const { keyId, modifierId } = detail;
|
|
107
|
+
modifiers[keyId] = modifiers[keyId].filter((item) => item !== modifierId);
|
|
108
|
+
if (modifiers[keyId].length === 0) {
|
|
109
|
+
delete modifiers[keyId];
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
js_frame_wrappers.push({
|
|
114
|
+
isRelevantTo: function (connection) {
|
|
115
|
+
return connection.params.act === 'sm';
|
|
116
|
+
},
|
|
117
|
+
originalSendBodyLogger: function (connection, body) {
|
|
118
|
+
triggerEvent({
|
|
119
|
+
type: 'emailSending',
|
|
120
|
+
body: body,
|
|
121
|
+
});
|
|
122
|
+
},
|
|
123
|
+
requestChanger: async function (connection, request) {
|
|
124
|
+
let composeParams = querystring.parse(request.body);
|
|
125
|
+
const composeid = composeParams.composeid;
|
|
126
|
+
const composeModifierIds = modifiers[composeParams.composeid];
|
|
127
|
+
|
|
128
|
+
if (!composeModifierIds || composeModifierIds.length === 0) {
|
|
129
|
+
return request;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
for (let ii = 0; ii < composeModifierIds.length; ii++) {
|
|
133
|
+
const modifierId = composeModifierIds[ii];
|
|
134
|
+
|
|
135
|
+
const modificationPromise = Kefir.fromEvents(
|
|
136
|
+
document,
|
|
137
|
+
'inboxSDKcomposeRequestModified'
|
|
138
|
+
)
|
|
139
|
+
.filter(
|
|
140
|
+
({ detail }) =>
|
|
141
|
+
detail.composeid === composeid &&
|
|
142
|
+
detail.modifierId === modifierId
|
|
143
|
+
)
|
|
144
|
+
.take(1)
|
|
145
|
+
.map(({ detail }) => detail.composeParams)
|
|
146
|
+
.toPromise(Promise);
|
|
147
|
+
|
|
148
|
+
triggerEvent({
|
|
149
|
+
type: 'inboxSDKmodifyComposeRequest',
|
|
150
|
+
composeid,
|
|
151
|
+
modifierId,
|
|
152
|
+
composeParams: {
|
|
153
|
+
body: composeParams.body,
|
|
154
|
+
isPlainText: composeParams.ishtml !== '1',
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
let newComposeParams = await modificationPromise;
|
|
159
|
+
composeParams = Object.assign({}, composeParams, newComposeParams);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return Object.assign({}, request, {
|
|
163
|
+
body: stringifyComposeParams(composeParams),
|
|
164
|
+
});
|
|
165
|
+
},
|
|
166
|
+
afterListeners: function (connection) {
|
|
167
|
+
if (connection.status === 200) {
|
|
168
|
+
triggerEvent({
|
|
169
|
+
type: 'emailSent',
|
|
170
|
+
responseText: connection.originalResponseText,
|
|
171
|
+
originalSendBody: connection.originalSendBody,
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
if (connection.originalSendBody) {
|
|
175
|
+
const composeParams = querystring.parse(
|
|
176
|
+
connection.originalSendBody
|
|
177
|
+
);
|
|
178
|
+
delete modifiers[composeParams.composeid];
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
js_frame_wrappers.push({
|
|
185
|
+
isRelevantTo: function (connection) {
|
|
186
|
+
return connection.params.act === 'sd';
|
|
187
|
+
},
|
|
188
|
+
originalSendBodyLogger: function (connection, body) {
|
|
189
|
+
triggerEvent({
|
|
190
|
+
type: 'emailDraftSaveSending',
|
|
191
|
+
body: body,
|
|
192
|
+
});
|
|
193
|
+
},
|
|
194
|
+
afterListeners: function (connection) {
|
|
195
|
+
if (connection.status === 200) {
|
|
196
|
+
triggerEvent({
|
|
197
|
+
type: 'emailDraftReceived',
|
|
198
|
+
responseText: connection.originalResponseText,
|
|
199
|
+
originalSendBody: connection.originalSendBody,
|
|
200
|
+
connectionDetails: {
|
|
201
|
+
method: connection.method,
|
|
202
|
+
url: connection.url,
|
|
203
|
+
params: connection.params,
|
|
204
|
+
responseType: connection.responseType,
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
{
|
|
212
|
+
// Sync API-based compose sending intercept
|
|
213
|
+
const currentSendConnectionIDs: WeakMap<
|
|
214
|
+
XHRProxyConnectionDetails,
|
|
215
|
+
string
|
|
216
|
+
> = new WeakMap();
|
|
217
|
+
const currentDraftSaveConnectionIDs: WeakMap<
|
|
218
|
+
XHRProxyConnectionDetails,
|
|
219
|
+
string
|
|
220
|
+
> = new WeakMap();
|
|
221
|
+
const currentFirstDraftSaveConnectionIDs: WeakMap<
|
|
222
|
+
XHRProxyConnectionDetails,
|
|
223
|
+
string
|
|
224
|
+
> = new WeakMap();
|
|
225
|
+
main_wrappers.push({
|
|
226
|
+
isRelevantTo(connection) {
|
|
227
|
+
return /sync(?:\/u\/\d+)?\/i\/s/.test(connection.url);
|
|
228
|
+
},
|
|
229
|
+
originalSendBodyLogger(connection) {
|
|
230
|
+
if (connection.originalSendBody) {
|
|
231
|
+
const composeRequestDetails = parseComposeRequestBody(
|
|
232
|
+
connection.originalSendBody
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
if (!composeRequestDetails) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const { draftID } = composeRequestDetails;
|
|
240
|
+
|
|
241
|
+
switch (composeRequestDetails.type) {
|
|
242
|
+
case 'FIRST_DRAFT_SAVE':
|
|
243
|
+
currentFirstDraftSaveConnectionIDs.set(connection, draftID);
|
|
244
|
+
break;
|
|
245
|
+
case 'DRAFT_SAVE':
|
|
246
|
+
currentDraftSaveConnectionIDs.set(connection, draftID);
|
|
247
|
+
break;
|
|
248
|
+
case 'SEND':
|
|
249
|
+
currentSendConnectionIDs.set(connection, draftID);
|
|
250
|
+
triggerEvent({ type: 'emailSending', draftID });
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
requestChanger: async function (connection, request) {
|
|
256
|
+
const composeRequestDetails = parseComposeRequestBody(request.body);
|
|
257
|
+
if (!composeRequestDetails || composeRequestDetails.type !== 'SEND')
|
|
258
|
+
return request;
|
|
259
|
+
|
|
260
|
+
const { draftID, body, type } = composeRequestDetails;
|
|
261
|
+
|
|
262
|
+
const composeModifierIds = modifiers[draftID];
|
|
263
|
+
if (!composeModifierIds || composeModifierIds.length === 0)
|
|
264
|
+
return request;
|
|
265
|
+
|
|
266
|
+
let newEmailBody = composeRequestDetails.body;
|
|
267
|
+
for (let ii = 0; ii < composeModifierIds.length; ii++) {
|
|
268
|
+
const modifierId = composeModifierIds[ii];
|
|
269
|
+
|
|
270
|
+
const modificationPromise = Kefir.fromEvents(
|
|
271
|
+
document,
|
|
272
|
+
'inboxSDKcomposeRequestModified'
|
|
273
|
+
)
|
|
274
|
+
.filter(
|
|
275
|
+
({ detail }) =>
|
|
276
|
+
detail.draftID === draftID && detail.modifierId === modifierId
|
|
277
|
+
)
|
|
278
|
+
.take(1)
|
|
279
|
+
.map(({ detail }) => detail.composeParams)
|
|
280
|
+
.toPromise(Promise);
|
|
281
|
+
|
|
282
|
+
triggerEvent({
|
|
283
|
+
type: 'inboxSDKmodifyComposeRequest',
|
|
284
|
+
draftID,
|
|
285
|
+
modifierId,
|
|
286
|
+
composeParams: {
|
|
287
|
+
body: newEmailBody,
|
|
288
|
+
isPlainText: false,
|
|
289
|
+
},
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
const newComposeParams = await modificationPromise;
|
|
293
|
+
newEmailBody = newComposeParams.body;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
return Object.assign({}, request, {
|
|
297
|
+
body: replaceBodyContentInComposeSendRequestBody(
|
|
298
|
+
request.body,
|
|
299
|
+
newEmailBody
|
|
300
|
+
),
|
|
301
|
+
});
|
|
302
|
+
},
|
|
303
|
+
afterListeners(connection) {
|
|
304
|
+
if (
|
|
305
|
+
currentSendConnectionIDs.has(connection) ||
|
|
306
|
+
currentDraftSaveConnectionIDs.has(connection) ||
|
|
307
|
+
currentFirstDraftSaveConnectionIDs.has(connection)
|
|
308
|
+
) {
|
|
309
|
+
const sendFailed = () => {
|
|
310
|
+
triggerEvent({ type: 'emailSendFailed', draftID });
|
|
311
|
+
currentSendConnectionIDs.delete(connection);
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
const draftID =
|
|
315
|
+
currentSendConnectionIDs.get(connection) ||
|
|
316
|
+
currentDraftSaveConnectionIDs.get(connection) ||
|
|
317
|
+
currentFirstDraftSaveConnectionIDs.get(connection);
|
|
318
|
+
|
|
319
|
+
if (connection.status !== 200 || !connection.originalResponseText) {
|
|
320
|
+
sendFailed();
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
try {
|
|
325
|
+
const responsesParsed = parseComposeResponseBody(
|
|
326
|
+
connection.originalResponseText
|
|
327
|
+
);
|
|
328
|
+
|
|
329
|
+
for (const responseParsed of responsesParsed) {
|
|
330
|
+
// If we're sending a draft, we only care about the response related to the draft we're sending.
|
|
331
|
+
if (draftID && !responseParsed.messageId.endsWith(draftID)) {
|
|
332
|
+
continue;
|
|
333
|
+
}
|
|
334
|
+
if (
|
|
335
|
+
responseParsed.type === 'FIRST_DRAFT_SAVE' ||
|
|
336
|
+
responseParsed.type === 'DRAFT_SAVE'
|
|
337
|
+
) {
|
|
338
|
+
triggerEvent({
|
|
339
|
+
draftID: draftID,
|
|
340
|
+
type: 'emailDraftReceived',
|
|
341
|
+
rfcID: responseParsed.rfcID,
|
|
342
|
+
threadID: responseParsed.threadId,
|
|
343
|
+
messageID: responseParsed.messageId,
|
|
344
|
+
oldMessageID: responseParsed.oldMessageId,
|
|
345
|
+
oldThreadID: responseParsed.oldThreadId,
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
currentSendConnectionIDs.delete(connection);
|
|
349
|
+
currentDraftSaveConnectionIDs.delete(connection);
|
|
350
|
+
currentFirstDraftSaveConnectionIDs.delete(connection);
|
|
351
|
+
|
|
352
|
+
return;
|
|
353
|
+
} else if (responseParsed.type === 'SEND') {
|
|
354
|
+
triggerEvent({
|
|
355
|
+
draftID: draftID,
|
|
356
|
+
type: 'emailSent',
|
|
357
|
+
rfcID: responseParsed.rfcID,
|
|
358
|
+
threadID: responseParsed.threadId,
|
|
359
|
+
messageID: responseParsed.messageId,
|
|
360
|
+
oldMessageID: responseParsed.oldMessageId,
|
|
361
|
+
oldThreadID: responseParsed.oldThreadId,
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
currentSendConnectionIDs.delete(connection);
|
|
365
|
+
currentDraftSaveConnectionIDs.delete(connection);
|
|
366
|
+
currentFirstDraftSaveConnectionIDs.delete(connection);
|
|
367
|
+
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
} catch (err) {
|
|
372
|
+
logger.eventSdkPassive(
|
|
373
|
+
'connection.requestResponseParsingFailed',
|
|
374
|
+
{
|
|
375
|
+
responseParseError: err,
|
|
376
|
+
}
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
const originalResponse = JSON.parse(
|
|
381
|
+
connection.originalResponseText
|
|
382
|
+
);
|
|
383
|
+
|
|
384
|
+
// TODO this function silently fails way too easily. Need to add better logging for it!
|
|
385
|
+
|
|
386
|
+
if (currentFirstDraftSaveConnectionIDs.has(connection)) {
|
|
387
|
+
const wrapper =
|
|
388
|
+
originalResponse[2] &&
|
|
389
|
+
originalResponse[2][6] &&
|
|
390
|
+
originalResponse[2][6][0] &&
|
|
391
|
+
originalResponse[2][6][0][1];
|
|
392
|
+
|
|
393
|
+
if (wrapper) {
|
|
394
|
+
const threadUpdate =
|
|
395
|
+
wrapper[3] && wrapper[3][7] && wrapper[3][7][1];
|
|
396
|
+
|
|
397
|
+
const messageUpdate =
|
|
398
|
+
threadUpdate && threadUpdate[5] && threadUpdate[5][0];
|
|
399
|
+
if (threadUpdate && messageUpdate) {
|
|
400
|
+
triggerEvent({
|
|
401
|
+
draftID: draftID,
|
|
402
|
+
type: 'emailDraftReceived',
|
|
403
|
+
rfcID: messageUpdate[14],
|
|
404
|
+
threadID: threadUpdate[4].split('|')[0],
|
|
405
|
+
messageID: messageUpdate[1],
|
|
406
|
+
oldMessageID: messageUpdate[56],
|
|
407
|
+
oldThreadID: threadUpdate[20],
|
|
408
|
+
});
|
|
409
|
+
} else {
|
|
410
|
+
logger.error(new Error('Could not parse draft save'));
|
|
411
|
+
}
|
|
412
|
+
} else {
|
|
413
|
+
// pre-2019-05-29 handling
|
|
414
|
+
logger.eventSdkPassive('old compose draft id handling hit');
|
|
415
|
+
const oldWrapper =
|
|
416
|
+
originalResponse[2] &&
|
|
417
|
+
originalResponse[2][6] &&
|
|
418
|
+
originalResponse[2][6][1] &&
|
|
419
|
+
originalResponse[2][6][1][1];
|
|
420
|
+
|
|
421
|
+
if (oldWrapper) {
|
|
422
|
+
const saveUpdate =
|
|
423
|
+
oldWrapper[3] && oldWrapper[3][1] && oldWrapper[3][1][1];
|
|
424
|
+
|
|
425
|
+
if (saveUpdate) {
|
|
426
|
+
triggerEvent({
|
|
427
|
+
draftID: draftID,
|
|
428
|
+
type: 'emailDraftReceived',
|
|
429
|
+
rfcID: saveUpdate[14],
|
|
430
|
+
messageID: saveUpdate[1],
|
|
431
|
+
oldMessageID: saveUpdate[48]
|
|
432
|
+
? new BigNumber(saveUpdate[48]).toString(16)
|
|
433
|
+
: saveUpdate[56],
|
|
434
|
+
syncThreadID: oldWrapper[1],
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
} else {
|
|
440
|
+
const updateList = originalResponse[2]?.[6];
|
|
441
|
+
if (!updateList) {
|
|
442
|
+
sendFailed();
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
const sendUpdateMatch = updateList.find(
|
|
447
|
+
(update) =>
|
|
448
|
+
update[1]?.[3]?.[7]?.[1]?.[5]?.[0]?.[14] &&
|
|
449
|
+
update[1][3][7][1][5].find((message) =>
|
|
450
|
+
includes(message[1], draftID)
|
|
451
|
+
)
|
|
452
|
+
);
|
|
453
|
+
|
|
454
|
+
if (!sendUpdateMatch) {
|
|
455
|
+
if (currentSendConnectionIDs.has(connection)) {
|
|
456
|
+
const minimalSendUpdates = updateList.filter(
|
|
457
|
+
(update) => update[1]?.[3]?.[5]?.[3]
|
|
458
|
+
);
|
|
459
|
+
|
|
460
|
+
if (minimalSendUpdates.length > 0) {
|
|
461
|
+
const threadID = minimalSendUpdates[0][1][1]
|
|
462
|
+
? minimalSendUpdates[0][1][1].replace(/\|.*$/, '')
|
|
463
|
+
: undefined;
|
|
464
|
+
triggerEvent({
|
|
465
|
+
draftID,
|
|
466
|
+
type: 'emailSent',
|
|
467
|
+
threadID,
|
|
468
|
+
messageID:
|
|
469
|
+
//new compose
|
|
470
|
+
minimalSendUpdates[0][1][3]?.[5]?.[5]?.[0] || //replies
|
|
471
|
+
minimalSendUpdates[0][1][3][5][3]?.[0],
|
|
472
|
+
});
|
|
473
|
+
} else {
|
|
474
|
+
sendFailed();
|
|
475
|
+
}
|
|
476
|
+
} else {
|
|
477
|
+
sendFailed();
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
const sendUpdateWrapper = sendUpdateMatch[1]?.[3]?.[7]?.[1];
|
|
484
|
+
|
|
485
|
+
const sendUpdate = sendUpdateWrapper[5].find((message) =>
|
|
486
|
+
message[1].includes(draftID)
|
|
487
|
+
);
|
|
488
|
+
|
|
489
|
+
if (!sendUpdate) {
|
|
490
|
+
sendFailed();
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
const isEmailSentResponse =
|
|
495
|
+
currentSendConnectionIDs.has(connection);
|
|
496
|
+
|
|
497
|
+
if (!Array.isArray(sendUpdate[11])) {
|
|
498
|
+
logger.error(new Error('sendUpdate[11] was not an array'));
|
|
499
|
+
} else {
|
|
500
|
+
if (isEmailSentResponse) {
|
|
501
|
+
if (sendUpdate[11].indexOf('^r') >= 0) {
|
|
502
|
+
logger.error(
|
|
503
|
+
new Error('sendUpdate[11] unexpectedly contained "^r"')
|
|
504
|
+
);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
if (isEmailSentResponse) {
|
|
510
|
+
if (sendUpdate[22] !== undefined && sendUpdate[22] !== 3) {
|
|
511
|
+
logger.error(
|
|
512
|
+
new Error('sendUpdate[22] was not expected value'),
|
|
513
|
+
{ value: sendUpdate[22] }
|
|
514
|
+
);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
const threadID = sendUpdateWrapper[4]
|
|
519
|
+
? sendUpdateWrapper[4].replace(/\|.*$/, '')
|
|
520
|
+
: undefined;
|
|
521
|
+
|
|
522
|
+
triggerEvent({
|
|
523
|
+
draftID: draftID,
|
|
524
|
+
type: isEmailSentResponse ? 'emailSent' : 'emailDraftReceived',
|
|
525
|
+
rfcID: sendUpdate[14],
|
|
526
|
+
messageID: sendUpdate[1],
|
|
527
|
+
oldMessageID: sendUpdate[48]
|
|
528
|
+
? new BigNumber(sendUpdate[48]).toString(16)
|
|
529
|
+
: sendUpdate[56],
|
|
530
|
+
threadID,
|
|
531
|
+
// It seems Gmail is A/B testing including gmailThreadID in response[20] and not including
|
|
532
|
+
// the encoded version of it in response[18], so pull it from [20] if [18] is not set.
|
|
533
|
+
oldThreadID:
|
|
534
|
+
sendUpdateWrapper[18] != null
|
|
535
|
+
? new BigNumber(sendUpdateWrapper[18]).toString(16)
|
|
536
|
+
: sendUpdateWrapper[20],
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
currentSendConnectionIDs.delete(connection);
|
|
541
|
+
currentDraftSaveConnectionIDs.delete(connection);
|
|
542
|
+
currentFirstDraftSaveConnectionIDs.delete(connection);
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
// intercept and process thread responses
|
|
550
|
+
{
|
|
551
|
+
js_frame_wrappers.push({
|
|
552
|
+
isRelevantTo(connection) {
|
|
553
|
+
return !!connection.params.search && connection.params.view === 'tl';
|
|
554
|
+
},
|
|
555
|
+
async responseTextChanger(connection, responseText) {
|
|
556
|
+
// Presence of a responseTextChanger blocks Gmail from getting the partial
|
|
557
|
+
// values as this loads. We want our originalResponseTextLogger to run
|
|
558
|
+
// before Gmail has seen any of the response.
|
|
559
|
+
return responseText;
|
|
560
|
+
},
|
|
561
|
+
originalResponseTextLogger(connection) {
|
|
562
|
+
if (connection.status === 200) {
|
|
563
|
+
const search = connection.params.search;
|
|
564
|
+
const responseText = connection.originalResponseText;
|
|
565
|
+
|
|
566
|
+
threadIdentifier.processThreadListResponse(responseText);
|
|
567
|
+
}
|
|
568
|
+
},
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
// intercept and process conversation view responses to get message metadata
|
|
573
|
+
{
|
|
574
|
+
// do this for gmail v1
|
|
575
|
+
{
|
|
576
|
+
js_frame_wrappers.push({
|
|
577
|
+
isRelevantTo(connection) {
|
|
578
|
+
return connection.params.view === 'cv';
|
|
579
|
+
},
|
|
580
|
+
|
|
581
|
+
originalResponseTextLogger(connection) {
|
|
582
|
+
if (connection.status === 200) {
|
|
583
|
+
const groupedMessages = GmailResponseProcessor.extractMessages(
|
|
584
|
+
connection.originalResponseText
|
|
585
|
+
);
|
|
586
|
+
messageMetadataHolder.add(groupedMessages);
|
|
587
|
+
}
|
|
588
|
+
},
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
// sync API based
|
|
593
|
+
{
|
|
594
|
+
// search response
|
|
595
|
+
main_wrappers.push({
|
|
596
|
+
isRelevantTo: function (connection) {
|
|
597
|
+
return /sync(?:\/u\/\d+)?\/i\/bv/.test(connection.url);
|
|
598
|
+
},
|
|
599
|
+
|
|
600
|
+
originalResponseTextLogger(connection) {
|
|
601
|
+
if (connection.status === 200) {
|
|
602
|
+
const threads =
|
|
603
|
+
GmailSyncResponseProcessor.extractThreadsFromSearchResponse(
|
|
604
|
+
connection.originalResponseText
|
|
605
|
+
);
|
|
606
|
+
messageMetadataHolder.add(
|
|
607
|
+
threads.map((syncThread) => ({
|
|
608
|
+
threadID: syncThread.syncThreadID,
|
|
609
|
+
messages: syncThread.extraMetaData.syncMessageData.map(
|
|
610
|
+
(syncMessage) => ({
|
|
611
|
+
date: syncMessage.date,
|
|
612
|
+
recipients: syncMessage.recipients,
|
|
613
|
+
})
|
|
614
|
+
),
|
|
615
|
+
}))
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
},
|
|
619
|
+
});
|
|
620
|
+
|
|
621
|
+
// thread response
|
|
622
|
+
main_wrappers.push({
|
|
623
|
+
isRelevantTo: function (connection) {
|
|
624
|
+
return /sync(?:\/u\/\d+)?\/i\/fd/.test(connection.url);
|
|
625
|
+
},
|
|
626
|
+
|
|
627
|
+
originalResponseTextLogger(connection) {
|
|
628
|
+
if (connection.status === 200) {
|
|
629
|
+
const threads =
|
|
630
|
+
GmailSyncResponseProcessor.extractThreadsFromThreadResponse(
|
|
631
|
+
connection.originalResponseText
|
|
632
|
+
);
|
|
633
|
+
messageMetadataHolder.add(
|
|
634
|
+
threads.map((syncThread) => ({
|
|
635
|
+
threadID: syncThread.syncThreadID,
|
|
636
|
+
messages: syncThread.extraMetaData.syncMessageData.map(
|
|
637
|
+
(syncMessage) => ({
|
|
638
|
+
date: syncMessage.date,
|
|
639
|
+
recipients: syncMessage.recipients,
|
|
640
|
+
})
|
|
641
|
+
),
|
|
642
|
+
}))
|
|
643
|
+
);
|
|
644
|
+
}
|
|
645
|
+
},
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
// Search suggestions modifier
|
|
651
|
+
// The content scripts tell us when they're interested in adding
|
|
652
|
+
// modifications to future suggestion results. When we see a search
|
|
653
|
+
// suggestions request come through, we signal the query string to the content
|
|
654
|
+
// scripts, wait for the same number of responses as the number of registered
|
|
655
|
+
// suggestion modifiers, and then meld them into the query response.
|
|
656
|
+
{
|
|
657
|
+
const providers = Object.create(null);
|
|
658
|
+
let currentQuery;
|
|
659
|
+
let suggestionModifications;
|
|
660
|
+
let currentQueryDefer;
|
|
661
|
+
|
|
662
|
+
document.addEventListener(
|
|
663
|
+
'inboxSDKregisterSuggestionsModifier',
|
|
664
|
+
function ({ detail }: any) {
|
|
665
|
+
providers[detail.providerID] = {
|
|
666
|
+
position: Object.keys(providers).length,
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
);
|
|
670
|
+
|
|
671
|
+
document.addEventListener(
|
|
672
|
+
'inboxSDKprovideSuggestions',
|
|
673
|
+
function ({ detail }: any) {
|
|
674
|
+
if (detail.query === currentQuery) {
|
|
675
|
+
const provider = providers[detail.providerID];
|
|
676
|
+
if (!provider) {
|
|
677
|
+
throw new Error('provider does not exist for providerID');
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
if (suggestionModifications == null) {
|
|
681
|
+
throw new Error('tried to modified a null suggestionModifications');
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
suggestionModifications[provider.position] = detail.suggestions;
|
|
685
|
+
if (
|
|
686
|
+
suggestionModifications.filter(Boolean).length ===
|
|
687
|
+
Object.keys(providers).length
|
|
688
|
+
) {
|
|
689
|
+
if (currentQueryDefer == null) {
|
|
690
|
+
throw new Error('tried to resolve a null currentQueryDefer');
|
|
691
|
+
}
|
|
692
|
+
currentQueryDefer.resolve(flatten(suggestionModifications));
|
|
693
|
+
currentQueryDefer = currentQuery = suggestionModifications = null;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
);
|
|
698
|
+
|
|
699
|
+
main_wrappers.push({
|
|
700
|
+
isRelevantTo(connection) {
|
|
701
|
+
return (
|
|
702
|
+
Object.keys(providers).length > 0 &&
|
|
703
|
+
!!connection.url.match(/^\/cloudsearch\/request\?/) &&
|
|
704
|
+
connection.params.client == 'gmail' &&
|
|
705
|
+
connection.params.gs_ri == 'gmail'
|
|
706
|
+
);
|
|
707
|
+
},
|
|
708
|
+
originalSendBodyLogger(connection, body) {
|
|
709
|
+
const parsedBody = querystring.parse(body);
|
|
710
|
+
if (!parsedBody.request) {
|
|
711
|
+
return;
|
|
712
|
+
}
|
|
713
|
+
const query = JSON.parse(parsedBody.request)[2];
|
|
714
|
+
if (!query) {
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
currentQuery = query;
|
|
718
|
+
if (currentQueryDefer) currentQueryDefer.resolve();
|
|
719
|
+
currentQueryDefer = (connection: any)._defer = defer();
|
|
720
|
+
suggestionModifications = [];
|
|
721
|
+
triggerEvent({
|
|
722
|
+
type: 'suggestionsRequest',
|
|
723
|
+
query: currentQuery,
|
|
724
|
+
});
|
|
725
|
+
},
|
|
726
|
+
async responseTextChanger(connection, responseText) {
|
|
727
|
+
if ((connection: any)._defer && connection.status === 200) {
|
|
728
|
+
const modifications = await (connection: any)._defer.promise;
|
|
729
|
+
if (modifications) {
|
|
730
|
+
return modifySuggestions(responseText, modifications);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
return responseText;
|
|
734
|
+
},
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
{
|
|
739
|
+
// TODO: simplify this code
|
|
740
|
+
// the triggerEvent call should happen in the requestChanger callback
|
|
741
|
+
// and a lot of these state variables can be stored in the closure
|
|
742
|
+
|
|
743
|
+
// Search query replacer.
|
|
744
|
+
// The content script tells us search terms to watch for. Whenever we see a
|
|
745
|
+
// search query containing the term, we delay it being sent out, trigger an
|
|
746
|
+
// event containing the full query, and wait for a response event from the
|
|
747
|
+
// content script that contains a new query to substitute in.
|
|
748
|
+
const customSearchTerms = [];
|
|
749
|
+
let queryReplacement;
|
|
750
|
+
|
|
751
|
+
document.addEventListener(
|
|
752
|
+
'inboxSDKcreateCustomSearchTerm',
|
|
753
|
+
function (event: any) {
|
|
754
|
+
customSearchTerms.push(event.detail.term);
|
|
755
|
+
}
|
|
756
|
+
);
|
|
757
|
+
|
|
758
|
+
document.addEventListener(
|
|
759
|
+
'inboxSDKsearchReplacementReady',
|
|
760
|
+
function (event: any) {
|
|
761
|
+
if (queryReplacement.query === event.detail.query) {
|
|
762
|
+
queryReplacement.newQuery.resolve(event.detail.newQuery);
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
);
|
|
766
|
+
|
|
767
|
+
// classic Gmail API intercept
|
|
768
|
+
js_frame_wrappers.push({
|
|
769
|
+
isRelevantTo: function (connection) {
|
|
770
|
+
let customSearchTerm;
|
|
771
|
+
const params = connection.params;
|
|
772
|
+
if (
|
|
773
|
+
connection.method === 'POST' &&
|
|
774
|
+
params.search &&
|
|
775
|
+
params.view === 'tl' &&
|
|
776
|
+
connection.url.match(/^\?/) &&
|
|
777
|
+
params.q &&
|
|
778
|
+
(customSearchTerm = intersection(
|
|
779
|
+
customSearchTerms,
|
|
780
|
+
quotedSplit(params.q)
|
|
781
|
+
)[0])
|
|
782
|
+
) {
|
|
783
|
+
if (
|
|
784
|
+
queryReplacement &&
|
|
785
|
+
queryReplacement.query === params.q &&
|
|
786
|
+
queryReplacement.start != params.start
|
|
787
|
+
) {
|
|
788
|
+
// If this is the same query that was made last, but just for a
|
|
789
|
+
// different page, then re-use the replacement query we got last time.
|
|
790
|
+
// Don't wait on the extension to come up with it again (and risk it
|
|
791
|
+
// giving an inconsistent answer between pages).
|
|
792
|
+
(connection: any)._queryReplacement = queryReplacement;
|
|
793
|
+
// Mark the old queryReplacement with this page now so we can tell on
|
|
794
|
+
// a later request whether the page was changed or the list refresh
|
|
795
|
+
// button was hit.
|
|
796
|
+
queryReplacement.start = params.start;
|
|
797
|
+
} else {
|
|
798
|
+
if (queryReplacement) {
|
|
799
|
+
// Resolve the old one with something because no one else is going
|
|
800
|
+
// to after it's replaced in a moment.
|
|
801
|
+
queryReplacement.newQuery.resolve(queryReplacement.query);
|
|
802
|
+
}
|
|
803
|
+
queryReplacement = (connection: any)._queryReplacement = {
|
|
804
|
+
term: customSearchTerm,
|
|
805
|
+
query: params.q,
|
|
806
|
+
start: params.start,
|
|
807
|
+
newQuery: defer(),
|
|
808
|
+
};
|
|
809
|
+
|
|
810
|
+
triggerEvent({
|
|
811
|
+
type: 'searchQueryForReplacement',
|
|
812
|
+
term: customSearchTerm,
|
|
813
|
+
query: params.q,
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
return true;
|
|
817
|
+
}
|
|
818
|
+
return false;
|
|
819
|
+
},
|
|
820
|
+
requestChanger: function (connection, request) {
|
|
821
|
+
return (connection: any)._queryReplacement.newQuery.promise.then(
|
|
822
|
+
function (newQuery) {
|
|
823
|
+
let newParams = clone(connection.params);
|
|
824
|
+
newParams.q = newQuery;
|
|
825
|
+
return {
|
|
826
|
+
method: request.method,
|
|
827
|
+
url: '?' + stringify(newParams),
|
|
828
|
+
body: request.body,
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
);
|
|
832
|
+
},
|
|
833
|
+
});
|
|
834
|
+
|
|
835
|
+
// newer, sync API based request intercept
|
|
836
|
+
main_wrappers.push({
|
|
837
|
+
isRelevantTo: function (connection) {
|
|
838
|
+
return (
|
|
839
|
+
connection.method === 'POST' &&
|
|
840
|
+
/sync(?:\/u\/\d+)?\/i\/bv/.test(connection.url)
|
|
841
|
+
);
|
|
842
|
+
},
|
|
843
|
+
requestChanger: function (connection, request) {
|
|
844
|
+
let customSearchTerm;
|
|
845
|
+
const body = JSON.parse(request.body);
|
|
846
|
+
|
|
847
|
+
let newFormat = false;
|
|
848
|
+
let payload, searchString, pageOffset;
|
|
849
|
+
|
|
850
|
+
if (Array.isArray(body)) {
|
|
851
|
+
newFormat = true;
|
|
852
|
+
|
|
853
|
+
payload = body[0];
|
|
854
|
+
searchString = payload[3];
|
|
855
|
+
pageOffset = payload[9];
|
|
856
|
+
} else {
|
|
857
|
+
payload = body[1];
|
|
858
|
+
searchString = payload[4];
|
|
859
|
+
pageOffset = payload[10];
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
const isSyncAPISearchWithCustomTerm =
|
|
863
|
+
payload[newFormat ? 0 : 1] === 79 &&
|
|
864
|
+
typeof searchString === 'string' &&
|
|
865
|
+
(customSearchTerm = intersection(
|
|
866
|
+
customSearchTerms,
|
|
867
|
+
quotedSplit(searchString)
|
|
868
|
+
)[0]);
|
|
869
|
+
if (!isSyncAPISearchWithCustomTerm) return Promise.resolve(request);
|
|
870
|
+
|
|
871
|
+
if (
|
|
872
|
+
queryReplacement &&
|
|
873
|
+
queryReplacement.query === searchString &&
|
|
874
|
+
queryReplacement.start != pageOffset
|
|
875
|
+
) {
|
|
876
|
+
// If this is the same query that was made last, but just for a
|
|
877
|
+
// different page, then re-use the replacement query we got last time.
|
|
878
|
+
// Don't wait on the extension to come up with it again (and risk it
|
|
879
|
+
// giving an inconsistent answer between pages).
|
|
880
|
+
(connection: any)._queryReplacement = queryReplacement;
|
|
881
|
+
// Mark the old queryReplacement with this page now so we can tell on
|
|
882
|
+
// a later request whether the page was changed or the list refresh
|
|
883
|
+
// button was hit.
|
|
884
|
+
queryReplacement.start = pageOffset;
|
|
885
|
+
} else {
|
|
886
|
+
if (queryReplacement) {
|
|
887
|
+
// Resolve the old one with something because no one else is going
|
|
888
|
+
// to after it's replaced in a moment.
|
|
889
|
+
queryReplacement.newQuery.resolve(queryReplacement.query);
|
|
890
|
+
}
|
|
891
|
+
queryReplacement = (connection: any)._queryReplacement = {
|
|
892
|
+
term: customSearchTerm,
|
|
893
|
+
query: searchString,
|
|
894
|
+
start: pageOffset,
|
|
895
|
+
newQuery: defer(),
|
|
896
|
+
};
|
|
897
|
+
|
|
898
|
+
triggerEvent({
|
|
899
|
+
type: 'searchQueryForReplacement',
|
|
900
|
+
term: customSearchTerm,
|
|
901
|
+
query: searchString,
|
|
902
|
+
});
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
return (connection: any)._queryReplacement.newQuery.promise.then(
|
|
906
|
+
function (newQuery) {
|
|
907
|
+
if (newFormat) {
|
|
908
|
+
body[0][3] = newQuery;
|
|
909
|
+
} else {
|
|
910
|
+
body[1][4] = newQuery;
|
|
911
|
+
}
|
|
912
|
+
return {
|
|
913
|
+
method: request.method,
|
|
914
|
+
url: request.url,
|
|
915
|
+
body: JSON.stringify(body),
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
);
|
|
919
|
+
},
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
{
|
|
924
|
+
// Search results replacer.
|
|
925
|
+
// The content script tells us a search query to watch for. Whenever we see
|
|
926
|
+
// the search query, trigger an event containing the query, trigger an
|
|
927
|
+
// event containing the response, and then wait for a response event from
|
|
928
|
+
// the content script that contains new results to substitute in.
|
|
929
|
+
const customSearchQueries = [];
|
|
930
|
+
let customListJob;
|
|
931
|
+
|
|
932
|
+
document.addEventListener(
|
|
933
|
+
'inboxSDKcustomListRegisterQuery',
|
|
934
|
+
(event: any) => {
|
|
935
|
+
customSearchQueries.push(event.detail.query);
|
|
936
|
+
}
|
|
937
|
+
);
|
|
938
|
+
|
|
939
|
+
document.addEventListener('inboxSDKcustomListNewQuery', (event: any) => {
|
|
940
|
+
if (
|
|
941
|
+
customListJob.query === event.detail.query &&
|
|
942
|
+
customListJob.start === event.detail.start
|
|
943
|
+
) {
|
|
944
|
+
const { newQuery, newStart } = event.detail;
|
|
945
|
+
|
|
946
|
+
customListJob.newRequestParams.resolve({
|
|
947
|
+
query: newQuery,
|
|
948
|
+
start: newStart,
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
});
|
|
952
|
+
|
|
953
|
+
document.addEventListener('inboxSDKcustomListResults', (event: any) => {
|
|
954
|
+
if (customListJob.query === event.detail.query) {
|
|
955
|
+
customListJob.newResults.resolve(event.detail.newResults);
|
|
956
|
+
}
|
|
957
|
+
});
|
|
958
|
+
|
|
959
|
+
js_frame_wrappers.push({
|
|
960
|
+
isRelevantTo: function (connection) {
|
|
961
|
+
let customSearchQuery;
|
|
962
|
+
const params = connection.params;
|
|
963
|
+
if (
|
|
964
|
+
connection.method === 'POST' &&
|
|
965
|
+
params.search &&
|
|
966
|
+
params.view === 'tl' &&
|
|
967
|
+
connection.url.match(/^\?/) &&
|
|
968
|
+
params.q &&
|
|
969
|
+
!params.act &&
|
|
970
|
+
(customSearchQuery = find(customSearchQueries, (x) => x === params.q))
|
|
971
|
+
) {
|
|
972
|
+
if (customListJob) {
|
|
973
|
+
// Resolve the old one with something because no one else is going
|
|
974
|
+
// to after it's replaced in a moment.
|
|
975
|
+
customListJob.newRequestParams.resolve({
|
|
976
|
+
query: customListJob.query,
|
|
977
|
+
start: customListJob.start,
|
|
978
|
+
});
|
|
979
|
+
customListJob.newResults.resolve(null);
|
|
980
|
+
}
|
|
981
|
+
customListJob = (connection: any)._customListJob = {
|
|
982
|
+
query: params.q,
|
|
983
|
+
start: +params.start,
|
|
984
|
+
newRequestParams: defer(),
|
|
985
|
+
newResults: defer(),
|
|
986
|
+
};
|
|
987
|
+
triggerEvent({
|
|
988
|
+
type: 'searchForReplacement',
|
|
989
|
+
query: customListJob.query,
|
|
990
|
+
start: customListJob.start,
|
|
991
|
+
});
|
|
992
|
+
return true;
|
|
993
|
+
}
|
|
994
|
+
return false;
|
|
995
|
+
},
|
|
996
|
+
requestChanger: function (connection, request) {
|
|
997
|
+
return (connection: any)._customListJob.newRequestParams.promise.then(
|
|
998
|
+
({ query, start }) => {
|
|
999
|
+
const newParams = clone(connection.params);
|
|
1000
|
+
newParams.q = query;
|
|
1001
|
+
newParams.start = start;
|
|
1002
|
+
return {
|
|
1003
|
+
method: request.method,
|
|
1004
|
+
url: '?' + stringify(newParams),
|
|
1005
|
+
body: request.body,
|
|
1006
|
+
};
|
|
1007
|
+
}
|
|
1008
|
+
);
|
|
1009
|
+
},
|
|
1010
|
+
responseTextChanger: function (connection, response) {
|
|
1011
|
+
triggerEvent({
|
|
1012
|
+
type: 'searchResultsResponse',
|
|
1013
|
+
query: (connection: any)._customListJob.query,
|
|
1014
|
+
start: (connection: any)._customListJob.start,
|
|
1015
|
+
response,
|
|
1016
|
+
});
|
|
1017
|
+
return (connection: any)._customListJob.newResults.promise.then(
|
|
1018
|
+
(newResults) => (newResults === null ? response : newResults)
|
|
1019
|
+
);
|
|
1020
|
+
},
|
|
1021
|
+
});
|
|
1022
|
+
|
|
1023
|
+
// Sync API-based custom thread list interception
|
|
1024
|
+
main_wrappers.push({
|
|
1025
|
+
isRelevantTo: function (connection) {
|
|
1026
|
+
if (/sync(?:\/u\/\d+)?\/i\/bv/.test(connection.url)) {
|
|
1027
|
+
if (customListJob) {
|
|
1028
|
+
// Resolve the old one with something because no one else is going
|
|
1029
|
+
// to after it's replaced in a moment.
|
|
1030
|
+
customListJob.newRequestParams.resolve({
|
|
1031
|
+
query: customListJob.query,
|
|
1032
|
+
start: customListJob.start,
|
|
1033
|
+
});
|
|
1034
|
+
customListJob.newResults.resolve(null);
|
|
1035
|
+
}
|
|
1036
|
+
return true;
|
|
1037
|
+
}
|
|
1038
|
+
return false;
|
|
1039
|
+
},
|
|
1040
|
+
requestChanger: async function (connection, request) {
|
|
1041
|
+
if (request.body) {
|
|
1042
|
+
const parsedBody = JSON.parse(request.body);
|
|
1043
|
+
|
|
1044
|
+
const newFormat = Array.isArray(parsedBody);
|
|
1045
|
+
|
|
1046
|
+
// we are a search!
|
|
1047
|
+
const searchQuery =
|
|
1048
|
+
(newFormat
|
|
1049
|
+
? parsedBody && parsedBody[0] && parsedBody[0][3]
|
|
1050
|
+
: parsedBody && parsedBody[1] && parsedBody[1][4]) || '';
|
|
1051
|
+
|
|
1052
|
+
if (find(customSearchQueries, (x) => x === searchQuery)) {
|
|
1053
|
+
customListJob = (connection: any)._customListJob = {
|
|
1054
|
+
query: searchQuery,
|
|
1055
|
+
start: newFormat ? parsedBody[0][9] : parsedBody[1][10],
|
|
1056
|
+
newRequestParams: defer(),
|
|
1057
|
+
newResults: defer(),
|
|
1058
|
+
};
|
|
1059
|
+
triggerEvent({
|
|
1060
|
+
type: 'searchForReplacement',
|
|
1061
|
+
query: customListJob.query,
|
|
1062
|
+
start: customListJob.start,
|
|
1063
|
+
});
|
|
1064
|
+
|
|
1065
|
+
return (connection: any)._customListJob.newRequestParams.promise.then(
|
|
1066
|
+
({ query, start }) => {
|
|
1067
|
+
if (newFormat) {
|
|
1068
|
+
parsedBody[0][3] = query;
|
|
1069
|
+
parsedBody[0][9] = start;
|
|
1070
|
+
} else {
|
|
1071
|
+
parsedBody[1][4] = query;
|
|
1072
|
+
parsedBody[1][10] = start;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
return {
|
|
1076
|
+
method: request.method,
|
|
1077
|
+
url: request.url,
|
|
1078
|
+
body: JSON.stringify(parsedBody),
|
|
1079
|
+
};
|
|
1080
|
+
}
|
|
1081
|
+
);
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
return request;
|
|
1086
|
+
},
|
|
1087
|
+
responseTextChanger: async function (connection, response) {
|
|
1088
|
+
if ((connection: any)._customListJob) {
|
|
1089
|
+
triggerEvent({
|
|
1090
|
+
type: 'searchResultsResponse',
|
|
1091
|
+
query: (connection: any)._customListJob.query,
|
|
1092
|
+
start: (connection: any)._customListJob.start,
|
|
1093
|
+
response,
|
|
1094
|
+
});
|
|
1095
|
+
|
|
1096
|
+
return (connection: any)._customListJob.newResults.promise.then(
|
|
1097
|
+
(newResults) => (newResults === null ? response : newResults)
|
|
1098
|
+
);
|
|
1099
|
+
} else {
|
|
1100
|
+
return response;
|
|
1101
|
+
}
|
|
1102
|
+
},
|
|
1103
|
+
});
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
// sync token savers
|
|
1107
|
+
{
|
|
1108
|
+
const saveBTAIHeader = (header) => {
|
|
1109
|
+
(document.head: any).setAttribute('data-inboxsdk-btai-header', header);
|
|
1110
|
+
triggerEvent({ type: 'btaiHeaderReceived' });
|
|
1111
|
+
};
|
|
1112
|
+
main_wrappers.push({
|
|
1113
|
+
isRelevantTo(connection) {
|
|
1114
|
+
return (
|
|
1115
|
+
/sync(?:\/u\/\d+)?\//.test(connection.url) &&
|
|
1116
|
+
!(document.head: any).hasAttribute('data-inboxsdk-btai-header')
|
|
1117
|
+
);
|
|
1118
|
+
},
|
|
1119
|
+
originalSendBodyLogger(connection) {
|
|
1120
|
+
if (connection.headers['X-Gmail-BTAI']) {
|
|
1121
|
+
saveBTAIHeader(connection.headers['X-Gmail-BTAI']);
|
|
1122
|
+
}
|
|
1123
|
+
},
|
|
1124
|
+
});
|
|
1125
|
+
|
|
1126
|
+
const saveXsrfTokenHeader = (header) => {
|
|
1127
|
+
(document.head: any).setAttribute('data-inboxsdk-xsrf-token', header);
|
|
1128
|
+
triggerEvent({ type: 'xsrfTokenHeaderReceived' });
|
|
1129
|
+
};
|
|
1130
|
+
main_wrappers.push({
|
|
1131
|
+
isRelevantTo(connection) {
|
|
1132
|
+
return (
|
|
1133
|
+
/sync(?:\/u\/\d+)?\//.test(connection.url) &&
|
|
1134
|
+
!(document.head: any).hasAttribute('data-inboxsdk-xsrf-token')
|
|
1135
|
+
);
|
|
1136
|
+
},
|
|
1137
|
+
originalSendBodyLogger(connection) {
|
|
1138
|
+
if (connection.headers['X-Framework-Xsrf-Token']) {
|
|
1139
|
+
saveXsrfTokenHeader(connection.headers['X-Framework-Xsrf-Token']);
|
|
1140
|
+
}
|
|
1141
|
+
},
|
|
1142
|
+
});
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
function triggerEvent(detail) {
|
|
1147
|
+
document.dispatchEvent(
|
|
1148
|
+
new CustomEvent('inboxSDKajaxIntercept', {
|
|
1149
|
+
bubbles: true,
|
|
1150
|
+
cancelable: false,
|
|
1151
|
+
detail,
|
|
1152
|
+
})
|
|
1153
|
+
);
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
function stringifyComposeParams(inComposeParams) {
|
|
1157
|
+
const composeParams = clone(inComposeParams);
|
|
1158
|
+
const string = `=${stringifyComposeRecipientParam(
|
|
1159
|
+
composeParams.to,
|
|
1160
|
+
'to'
|
|
1161
|
+
)}&=${stringifyComposeRecipientParam(
|
|
1162
|
+
composeParams.cc,
|
|
1163
|
+
'cc'
|
|
1164
|
+
)}&=${stringifyComposeRecipientParam(composeParams.bcc, 'bcc')}`;
|
|
1165
|
+
|
|
1166
|
+
delete composeParams.to;
|
|
1167
|
+
delete composeParams.bcc;
|
|
1168
|
+
delete composeParams.cc;
|
|
1169
|
+
|
|
1170
|
+
return string + '&' + querystring.stringify(composeParams);
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
function stringifyComposeRecipientParam(value, paramType) {
|
|
1174
|
+
let string = '';
|
|
1175
|
+
|
|
1176
|
+
if (Array.isArray(value)) {
|
|
1177
|
+
for (let ii = 0; ii < value.length; ii++) {
|
|
1178
|
+
string += `&${paramType}=${encodeURIComponent(value[ii])}`;
|
|
1179
|
+
}
|
|
1180
|
+
} else {
|
|
1181
|
+
string += `&${paramType}=${encodeURIComponent(value)}`;
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
return string;
|
|
1185
|
+
}
|