@inboxsdk/core 1.2.4 → 1.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/inboxsdk.js +4474 -463
- package/inboxsdk.js.map +1 -1
- package/package.json +1 -1
- package/pageWorld.js +1 -1
- package/pageWorld.js.map +1 -1
- package/src/common/load-script.d.ts +0 -6
- package/src/common/load-script.d.ts.map +1 -1
- package/src/inboxsdk-js/loading/platform-implementation-loader.d.ts.map +1 -1
- package/src/inboxsdk.d.ts +29 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-nav-item.d.ts +2 -2
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-nav-item.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/isIntegratedViewGmail.d.ts +6 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/isIntegratedViewGmail.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.d.ts +2 -2
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter.d.ts +5 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-card-view.d.ts +13 -5
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-card-view.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-nav-item-view.d.ts +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-nav-item-view.d.ts.map +1 -1
- package/src/platform-implementation-js/lib/inject-script-EMBEDDED.d.ts.map +1 -1
- package/src/platform-implementation-js/namespaces/conversations.d.ts +7 -0
- package/src/platform-implementation-js/namespaces/conversations.d.ts.map +1 -1
- package/src/platform-implementation-js/namespaces/nav-menu.d.ts +4 -2
- package/src/platform-implementation-js/namespaces/nav-menu.d.ts.map +1 -1
- package/src/platform-implementation-js/views/conversations/attachment-card-view.d.ts +12 -5
- package/src/platform-implementation-js/views/conversations/attachment-card-view.d.ts.map +1 -1
- package/src/platform-implementation-js/views/native-nav-item-view.d.ts +2 -1
- package/src/platform-implementation-js/views/native-nav-item-view.d.ts.map +1 -1
- package/src/build/exec.js +0 -26
- package/src/build/spawn.js +0 -17
- package/src/common/ajax.js +0 -90
- package/src/common/cachebust-url.js +0 -10
- package/src/common/censorHTMLstring.js +0 -37
- package/src/common/censorHTMLtree.js +0 -28
- package/src/common/censorJSONTree.js +0 -15
- package/src/common/connectivity-test.js +0 -21
- package/src/common/defer.js +0 -11
- package/src/common/find-parent.js +0 -10
- package/src/common/get-extension-id.js +0 -7
- package/src/common/get-or-fail.js +0 -8
- package/src/common/get-session-id.js +0 -14
- package/src/common/get-stack-trace.js +0 -6
- package/src/common/html-to-text.js +0 -7
- package/src/common/isElementVisible.js +0 -6
- package/src/common/load-script.js +0 -128
- package/src/common/log-error.js +0 -185
- package/src/common/quoted-split.js +0 -18
- package/src/common/rate-limit-queuer.js +0 -57
- package/src/common/rate-limit.js +0 -14
- package/src/common/version.js +0 -8
- package/src/inboxsdk-js/header.js +0 -19
- package/src/inboxsdk-js/inboxsdk-NONREMOTE-INTEGRATED-PAGEWORLD.js +0 -4
- package/src/inboxsdk-js/inboxsdk-NONREMOTE.js +0 -4
- package/src/inboxsdk-js/inboxsdk-REMOTE.js +0 -2
- package/src/inboxsdk-js/inboxsdk-TEST.js +0 -5
- package/src/inboxsdk-js/inboxsdk.js +0 -23
- package/src/inboxsdk-js/loading/load-platform-implementation-DEV.js +0 -14
- package/src/inboxsdk-js/loading/platform-implementation-loader.js +0 -31
- package/src/injected-js/gmail/constants.js +0 -2
- package/src/injected-js/gmail/modify-suggestions.js +0 -106
- package/src/injected-js/gmail/setup-gmail-interceptor.js +0 -936
- package/src/injected-js/gmail/setup-gmonkey-handler.js +0 -49
- package/src/injected-js/gmail/sync-compose-processor-20220909.js +0 -298
- package/src/injected-js/gmail/sync-compose-processor.js +0 -55
- package/src/injected-js/gmail/sync-compose-request-processor.js +0 -109
- package/src/injected-js/gmail/thread-identifier/click-and-get-popup-url.js +0 -71
- package/src/injected-js/gmail/thread-identifier/index.js +0 -133
- package/src/injected-js/gmail/thread-identifier/thread-row-parser.js +0 -61
- package/src/injected-js/injected-logger.js +0 -50
- package/src/injected-js/main.js +0 -49
- package/src/injected-js/message-metadata-holder.js +0 -103
- package/src/injected-js/setup-data-exposer.js +0 -135
- package/src/injected-js/setup-error-silencer.js +0 -15
- package/src/injected-js/setup-event-reemitter.js +0 -47
- package/src/injected-js/setupCustomViewEventAssassin.js +0 -90
- package/src/injected-js/setupInboxCustomViewLinkFixer.js +0 -24
- package/src/injected-js/setupPushStateListener.js +0 -14
- package/src/injected-js/xhr-helper.js +0 -43
- package/src/injected-js/xhr-proxy-factory.js +0 -537
- package/src/platform-implementation-js/constants/nav-item-types.js +0 -19
- package/src/platform-implementation-js/constants/router.js +0 -60
- package/src/platform-implementation-js/constants/toolbars.js +0 -5
- package/src/platform-implementation-js/dom-driver/gmail/gmail-butter-bar-driver.js +0 -158
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-app-menu-item.js +0 -20
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-collapsible-panel.js +0 -38
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-nav-item.js +0 -98
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-support-item.js +0 -4
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-toolbar-button-for-app.js +0 -14
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/create-link.js +0 -60
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/encodeDraftUrlId.js +0 -8
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-draft-id-for-message-id.js +0 -47
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-native-nav-item.js +0 -31
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-rfc-message-id-for-gmail-message-id.js +0 -12
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-rfc-message-id-for-gmail-thread-id.js +0 -33
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-url-object.js +0 -22
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadForOldGmailThreadId.js +0 -18
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadFromSyncThreadId.js +0 -57
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/gmail-load-event.js +0 -40
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/goto-view.js +0 -55
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/isIntegratedViewGmail.js +0 -14
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/keyboard-shortcut-help-modifier.js +0 -177
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-compose-window.js +0 -17
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-draft-by-message-id.js +0 -44
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/override-gmail-back-button.js +0 -49
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/register-search-query-rewriter.js +0 -18
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/register-search-suggestions-provider.js +0 -138
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-compose-view-driver-stream.js +0 -112
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-route-view-driver-stream.js +0 -152
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-app-id-warning.js +0 -21
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-route-view.js +0 -48
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-thread-list.js +0 -357
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-native-route-view.js +0 -19
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/suppressAddon.js +0 -36
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/temporary-track-download-url-validity.js +0 -36
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/thread-row-identifier.js +0 -85
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-events.js +0 -142
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-gmail-styles.js +0 -115
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/user-info.js +0 -50
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.js +0 -723
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter/get-main-content-element-changed-stream.js +0 -38
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter/wait-for-gmail-mode-to-settle.js +0 -12
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter.js +0 -264
- package/src/platform-implementation-js/dom-driver/gmail/gmail-page-communicator.js +0 -201
- package/src/platform-implementation-js/dom-driver/gmail/gmail-response-processor.js +0 -532
- package/src/platform-implementation-js/dom-driver/gmail/gmail-sync-response-processor.js +0 -300
- package/src/platform-implementation-js/dom-driver/gmail/is-compose-titlebar-light-color.js +0 -21
- package/src/platform-implementation-js/dom-driver/gmail/make-xhr-interceptor.js +0 -92
- package/src/platform-implementation-js/dom-driver/gmail/makePageParserTree.js +0 -28
- package/src/platform-implementation-js/dom-driver/gmail/pageParserOptions.js +0 -19
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-menu-item-view.js +0 -129
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.js +0 -80
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-companion-global-icon-area.js +0 -23
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-companion-thread-icon-area.js +0 -26
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-to-icon-area.js +0 -16
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/index.js +0 -723
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view/monitor-top-banner-size-and-react.js +0 -24
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view.js +0 -172
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-area-view.js +0 -106
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-card-view.js +0 -328
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-backdrop.js +0 -22
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-collapsible-section-view.js +0 -720
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-button.js +0 -135
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-compose-notice.js +0 -50
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-recipient-row.js +0 -65
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-status-bar.js +0 -101
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-tooltip-to-button.js +0 -66
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/detectClassicRecipientsArea.js +0 -38
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/ensure-app-button-toolbars-are-closed.js +0 -10
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/ensure-grouping-is-open.js +0 -14
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/focus.js +0 -13
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/from-manager.js +0 -60
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-additional-action-toolbar.js +0 -54
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-address-changes-stream.js +0 -98
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-address-information-extractor.js +0 -28
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-body-changes-stream.js +0 -13
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-formatting-area-offset-left.js +0 -18
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-minimized-stream.js +0 -16
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-recipients.js +0 -22
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-response-type-changes-stream.js +0 -23
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/gmail-compose-button-view.js +0 -233
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/insert-link-into-body.js +0 -19
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/manage-button-grouping.js +0 -355
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/monitor-selection-range.js +0 -21
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/override-edit-subject.js +0 -63
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/page-parser.js +0 -223
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/position-formatting-toolbar.js +0 -19
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/set-recipients.js +0 -157
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/setupLinkPopovers.js +0 -109
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/size-fixer.js +0 -123
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/update-insert-more-area-left.js +0 -16
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view.js +0 -1542
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view/attachment-icon.js +0 -4
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view/get-updated-contact.js +0 -75
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view.js +0 -737
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-nav-item-view.js +0 -763
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-processor.js +0 -103
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-view.js +0 -508
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-row-list-view.js +0 -236
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-support-item-view.js +0 -84
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-row-view.js +0 -986
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view/width-manager.js +0 -26
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view.js +0 -658
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-toolbar-view.js +0 -459
- package/src/platform-implementation-js/dom-driver/gmail/views/native-gmail-nav-item-view.js +0 -265
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/button-color-classes.js +0 -33
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/button-view.js +0 -325
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-accessory-button-view.js +0 -61
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-parent-accessory-button-view.js +0 -58
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/inbox-dropdown-button-view.js +0 -23
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/modal-button-view.js +0 -101
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/more-dropdown-button-view.js +0 -30
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/more-parent-accessory-button-view.js +0 -10
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-action-button-view.js +0 -42
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-dropdown-view.js +0 -22
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-label-view.js +0 -112
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-modal-view-driver.js +0 -122
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-mole-view-driver.js +0 -194
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-tooltip-view.js +0 -352
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-top-message-bar-driver.js +0 -76
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-backdrop.js +0 -57
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-drawer-view.js +0 -291
- package/src/platform-implementation-js/driver-common/compose/getDiscardStream.js +0 -28
- package/src/platform-implementation-js/driver-common/compose/getPresendingStream.js +0 -46
- package/src/platform-implementation-js/driver-common/getAccountUrlPart.js +0 -17
- package/src/platform-implementation-js/driver-common/getGmailMessageIdForSyncMessageId.js +0 -17
- package/src/platform-implementation-js/driver-common/getGmailThreadIdForRfcMessageId.js +0 -44
- package/src/platform-implementation-js/driver-common/getOriginalMessagePage.js +0 -33
- package/src/platform-implementation-js/driver-common/getRfcMessageIdForSyncMessageId.js +0 -18
- package/src/platform-implementation-js/driver-common/getSyncThreadsForSearch.js +0 -49
- package/src/platform-implementation-js/driver-common/getThreadIdFromMessageId.js +0 -13
- package/src/platform-implementation-js/driver-common/gmailAjax.js +0 -65
- package/src/platform-implementation-js/driver-common/inboxAjax.js +0 -5
- package/src/platform-implementation-js/driver-common/render-custom-icon.js +0 -16
- package/src/platform-implementation-js/driver-common/requestGmailThread.js +0 -24
- package/src/platform-implementation-js/driver-common/sidebar/AppSidebar.js +0 -245
- package/src/platform-implementation-js/driver-common/sidebar/ContentPanelViewDriver.js +0 -144
- package/src/platform-implementation-js/driver-common/sidebar/constants.js +0 -26
- package/src/platform-implementation-js/driver-common/update-icon.js +0 -90
- package/src/platform-implementation-js/driver-interfaces/compose-view-driver.js +0 -1
- package/src/platform-implementation-js/driver-interfaces/driver.js +0 -1
- package/src/platform-implementation-js/driver-interfaces/mole-view-driver.js +0 -1
- package/src/platform-implementation-js/driver-interfaces/route-view-driver.js +0 -1
- package/src/platform-implementation-js/lib/ErrorCollector.js +0 -47
- package/src/platform-implementation-js/lib/Membrane.js +0 -22
- package/src/platform-implementation-js/lib/ScrollableContainByScreen.js +0 -30
- package/src/platform-implementation-js/lib/attemptWithRetries.js +0 -16
- package/src/platform-implementation-js/lib/common-page-communicator.js +0 -137
- package/src/platform-implementation-js/lib/copyAndValidateAutocompleteResults.js +0 -35
- package/src/platform-implementation-js/lib/css-selector-escape.js +0 -6
- package/src/platform-implementation-js/lib/delay-asap.js +0 -10
- package/src/platform-implementation-js/lib/delay-idle.js +0 -16
- package/src/platform-implementation-js/lib/dom/block-and-reemit-keyboard-events.js +0 -36
- package/src/platform-implementation-js/lib/dom/custom-events.js +0 -5
- package/src/platform-implementation-js/lib/dom/element-view-mapper.js +0 -9
- package/src/platform-implementation-js/lib/dom/generic-button-view.js +0 -39
- package/src/platform-implementation-js/lib/dom/get-insert-before-element.js +0 -39
- package/src/platform-implementation-js/lib/dom/get-selection.js +0 -30
- package/src/platform-implementation-js/lib/dom/insert-element-in-order.js +0 -38
- package/src/platform-implementation-js/lib/dom/insert-html-at-cursor.js +0 -83
- package/src/platform-implementation-js/lib/dom/is-node-in-range.js +0 -12
- package/src/platform-implementation-js/lib/dom/keyboard-shortcut-stream.js +0 -12
- package/src/platform-implementation-js/lib/dom/make-element-child-stream.js +0 -79
- package/src/platform-implementation-js/lib/dom/make-element-stream-merger.js +0 -27
- package/src/platform-implementation-js/lib/dom/make-element-view-stream.js +0 -15
- package/src/platform-implementation-js/lib/dom/make-mutation-observer-chunked-stream.js +0 -15
- package/src/platform-implementation-js/lib/dom/make-mutation-observer-stream.js +0 -5
- package/src/platform-implementation-js/lib/dom/on-mouse-down-and-up.js +0 -8
- package/src/platform-implementation-js/lib/dom/outsideClicksAndEscape.js +0 -38
- package/src/platform-implementation-js/lib/dom/parentNodes.js +0 -8
- package/src/platform-implementation-js/lib/dom/querySelectorOrFail.js +0 -6
- package/src/platform-implementation-js/lib/dom/reemitClickEventForReact.js +0 -22
- package/src/platform-implementation-js/lib/dom/set-css.js +0 -20
- package/src/platform-implementation-js/lib/dom/simulate-drag-and-drop.js +0 -88
- package/src/platform-implementation-js/lib/dom/simulate-key.js +0 -46
- package/src/platform-implementation-js/lib/dom/simulate-mouse-event.js +0 -16
- package/src/platform-implementation-js/lib/dom/trigger-relay-event.js +0 -7
- package/src/platform-implementation-js/lib/extract-contact-from-email-contact-string.js +0 -25
- package/src/platform-implementation-js/lib/fake-window-resize.js +0 -5
- package/src/platform-implementation-js/lib/from-event-target-capture.js +0 -12
- package/src/platform-implementation-js/lib/fromEventsWithOptions.js +0 -10
- package/src/platform-implementation-js/lib/handle-compose-link-chips.js +0 -124
- package/src/platform-implementation-js/lib/handler-registry.js +0 -67
- package/src/platform-implementation-js/lib/idMap.js +0 -40
- package/src/platform-implementation-js/lib/imageRequest.js +0 -8
- package/src/platform-implementation-js/lib/incrementName.js +0 -7
- package/src/platform-implementation-js/lib/inject-script-EMBEDDED.js +0 -8
- package/src/platform-implementation-js/lib/inject-script.js +0 -33
- package/src/platform-implementation-js/lib/insert-link-chip-into-body.js +0 -44
- package/src/platform-implementation-js/lib/is-valid-app-id.js +0 -27
- package/src/platform-implementation-js/lib/is-valid-email.js +0 -14
- package/src/platform-implementation-js/lib/isNotNil.js +0 -5
- package/src/platform-implementation-js/lib/isStreakAppId.js +0 -11
- package/src/platform-implementation-js/lib/logger.js +0 -439
- package/src/platform-implementation-js/lib/parseParamsFromRouteID.js +0 -10
- package/src/platform-implementation-js/lib/persistent-queue.js +0 -107
- package/src/platform-implementation-js/lib/populateRouteID.js +0 -17
- package/src/platform-implementation-js/lib/react/ElementContainer.js +0 -26
- package/src/platform-implementation-js/lib/routeIDmatchesHash.js +0 -8
- package/src/platform-implementation-js/lib/safe-event-emitter.js +0 -16
- package/src/platform-implementation-js/lib/stopper-pool.js +0 -41
- package/src/platform-implementation-js/lib/stream-wait-for.js +0 -30
- package/src/platform-implementation-js/lib/toItemWithLifetimeStream.js +0 -12
- package/src/platform-implementation-js/lib/toLiveSet.js +0 -22
- package/src/platform-implementation-js/lib/wait-for.js +0 -38
- package/src/platform-implementation-js/lib/waitForAsync.js +0 -18
- package/src/platform-implementation-js/main-INTEGRATED-PAGEWORLD.js +0 -5
- package/src/platform-implementation-js/main.js +0 -42
- package/src/platform-implementation-js/namespaces/app-menu.js +0 -81
- package/src/platform-implementation-js/namespaces/butter-bar.js +0 -163
- package/src/platform-implementation-js/namespaces/compose.js +0 -59
- package/src/platform-implementation-js/namespaces/conversations.js +0 -83
- package/src/platform-implementation-js/namespaces/global.js +0 -30
- package/src/platform-implementation-js/namespaces/keyboard.js +0 -30
- package/src/platform-implementation-js/namespaces/lists.js +0 -40
- package/src/platform-implementation-js/namespaces/modal.js +0 -43
- package/src/platform-implementation-js/namespaces/nav-menu.js +0 -33
- package/src/platform-implementation-js/namespaces/router.js +0 -139
- package/src/platform-implementation-js/namespaces/search.js +0 -29
- package/src/platform-implementation-js/namespaces/toolbars.js +0 -147
- package/src/platform-implementation-js/namespaces/user.js +0 -57
- package/src/platform-implementation-js/namespaces/widgets.js +0 -73
- package/src/platform-implementation-js/platform-implementation.js +0 -178
- package/src/platform-implementation-js/views/SimpleElementView.js +0 -16
- package/src/platform-implementation-js/views/app-menu-item-view.js +0 -442
- package/src/platform-implementation-js/views/app-toolbar-button-view.js +0 -43
- package/src/platform-implementation-js/views/collapsible-panel-view.js +0 -256
- package/src/platform-implementation-js/views/collapsible-section-view.js +0 -63
- package/src/platform-implementation-js/views/compose-button-view.js +0 -45
- package/src/platform-implementation-js/views/compose-view.js +0 -310
- package/src/platform-implementation-js/views/content-panel-view.js +0 -36
- package/src/platform-implementation-js/views/conversations/attachment-card-view.js +0 -41
- package/src/platform-implementation-js/views/conversations/custom-message-view.js +0 -117
- package/src/platform-implementation-js/views/conversations/message-view.js +0 -203
- package/src/platform-implementation-js/views/conversations/thread-view.js +0 -97
- package/src/platform-implementation-js/views/keyboard-shortcut-handle.js +0 -14
- package/src/platform-implementation-js/views/native-nav-item-view.js +0 -60
- package/src/platform-implementation-js/views/nav-item-view.js +0 -130
- package/src/platform-implementation-js/views/route-view/custom-route-view.js +0 -25
- package/src/platform-implementation-js/views/route-view/dummy-route-view-driver.js +0 -29
- package/src/platform-implementation-js/views/route-view/list-route-view.js +0 -46
- package/src/platform-implementation-js/views/route-view/route-view.js +0 -47
- package/src/platform-implementation-js/views/section-view.js +0 -60
- package/src/platform-implementation-js/views/thread-row-view.js +0 -90
- package/src/platform-implementation-js/widgets/buttons/basic-button-view-controller.js +0 -39
- package/src/platform-implementation-js/widgets/buttons/dropdown-button-view-controller.js +0 -98
- package/src/platform-implementation-js/widgets/buttons/dropdown-view.js +0 -121
- package/src/platform-implementation-js/widgets/drawer-view.js +0 -46
- package/src/platform-implementation-js/widgets/modal-view.js +0 -108
- package/src/platform-implementation-js/widgets/mole-view.js +0 -38
- package/src/platform-implementation-js/widgets/top-message-bar-view.js +0 -15
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import Kefir from 'kefir';
|
|
2
|
-
import get from '../../../../common/get-or-fail';
|
|
3
|
-
import GmailElementGetter from '../gmail-element-getter';
|
|
4
|
-
import GmailRouteView from '../views/gmail-route-view/gmail-route-view';
|
|
5
|
-
import getURLObject from './get-url-object';
|
|
6
|
-
import routeIDmatchesHash from '../../../lib/routeIDmatchesHash';
|
|
7
|
-
export default function setupRouteViewDriverStream(gmailRouteProcessor, driver) {
|
|
8
|
-
const customRouteIDs = driver.getCustomRouteIDs();
|
|
9
|
-
const customListRouteIDs = driver.getCustomListRouteIDs();
|
|
10
|
-
const customListSearchStringsToRouteIds = driver.getCustomListSearchStringsToRouteIds();
|
|
11
|
-
let lastNativeHash = getURLObject(document.location.href).hash;
|
|
12
|
-
let latestGmailRouteView = null;
|
|
13
|
-
driver.getStopper().onValue(() => {
|
|
14
|
-
if (latestGmailRouteView) {
|
|
15
|
-
latestGmailRouteView.destroy();
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
let lastHash = lastNativeHash;
|
|
19
|
-
let sameRouteData = {};
|
|
20
|
-
const eligibleHashChanges = Kefir.fromEvents(window, 'hashchange')
|
|
21
|
-
.filter((event) => !event.oldURL.match(/#inboxsdk-fake-no-vc$/))
|
|
22
|
-
.map((event) => ({
|
|
23
|
-
new: getURLObject(event.newURL),
|
|
24
|
-
old: getURLObject(event.oldURL),
|
|
25
|
-
}))
|
|
26
|
-
.filter((event) => event.new.hash !== event.old.hash)
|
|
27
|
-
.map((event) => event.new)
|
|
28
|
-
.map((urlObject) => {
|
|
29
|
-
const { hash, name } = urlObject;
|
|
30
|
-
for (const routeIDs of customRouteIDs) {
|
|
31
|
-
const routeID = routeIDmatchesHash(routeIDs, hash);
|
|
32
|
-
if (routeID) {
|
|
33
|
-
return { urlObject, type: 'CUSTOM', routeID };
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
for (const [routeIDs] of customListRouteIDs) {
|
|
37
|
-
const routeID = routeIDmatchesHash(routeIDs, name);
|
|
38
|
-
if (routeID) {
|
|
39
|
-
return { urlObject, type: 'CUSTOM_LIST_TRIGGER', routeID };
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
if (gmailRouteProcessor.isNativeRoute(urlObject.name)) {
|
|
43
|
-
return { urlObject, type: 'NATIVE' };
|
|
44
|
-
}
|
|
45
|
-
return { urlObject, type: 'OTHER_APP_CUSTOM' };
|
|
46
|
-
});
|
|
47
|
-
const customAndCustomListRouteHashChanges = eligibleHashChanges.filter(({ type }) => type !== 'NATIVE');
|
|
48
|
-
// If a user goes from a native route to a custom route, and then back to the
|
|
49
|
-
// same native route, we need to make a new GmailRouteView because
|
|
50
|
-
// getMainContentElementChangedStream() won't be firing, except when going from thread->custom->thread
|
|
51
|
-
const revertNativeHashChanges = eligibleHashChanges
|
|
52
|
-
.filter(({ type }) => type === 'NATIVE')
|
|
53
|
-
.filter(({ urlObject }) => {
|
|
54
|
-
const tmp = lastNativeHash;
|
|
55
|
-
lastNativeHash = urlObject.hash;
|
|
56
|
-
return tmp === urlObject.hash;
|
|
57
|
-
})
|
|
58
|
-
.filter(({ urlObject }) => {
|
|
59
|
-
return urlObject.hash !== lastHash;
|
|
60
|
-
});
|
|
61
|
-
// Merge everything that can trigger a new RouteView
|
|
62
|
-
return Kefir.merge([
|
|
63
|
-
customAndCustomListRouteHashChanges,
|
|
64
|
-
revertNativeHashChanges,
|
|
65
|
-
// when native gmail changes main view there's a div that takes on role=main.
|
|
66
|
-
// getMainContentElementChangedStream doesn't respect custom views so filter
|
|
67
|
-
// out events from it. This filter is needed if the user is already at a custom
|
|
68
|
-
// view of another InboxSDK instance while this starts up.
|
|
69
|
-
GmailElementGetter.getMainContentElementChangedStream()
|
|
70
|
-
.map((_event) => ({
|
|
71
|
-
urlObject: getURLObject(document.location.href),
|
|
72
|
-
type: 'NATIVE',
|
|
73
|
-
}))
|
|
74
|
-
.filter((options) => gmailRouteProcessor.isNativeRoute(options.urlObject.name)),
|
|
75
|
-
])
|
|
76
|
-
.map((options) => {
|
|
77
|
-
const { type, urlObject } = options;
|
|
78
|
-
if (type === 'NATIVE' && urlObject.name === 'search') {
|
|
79
|
-
const customListRouteId = customListSearchStringsToRouteIds.get(urlObject.params[0]);
|
|
80
|
-
if (customListRouteId) {
|
|
81
|
-
const searchInput = GmailElementGetter.getSearchInput();
|
|
82
|
-
if (!searchInput)
|
|
83
|
-
throw new Error('Should not happen');
|
|
84
|
-
searchInput.value = '';
|
|
85
|
-
// Only rewrite the url if it's a search query with no further
|
|
86
|
-
// parameters or it has a page parameter. Don't write URLs with thread
|
|
87
|
-
// id parameters because currently other parts of the code depend on
|
|
88
|
-
// being able to parse the URL as a normal thread URL.
|
|
89
|
-
// Additionally, we don't want to treat threads as the CUSTOM_LIST type
|
|
90
|
-
// since they're not lists.
|
|
91
|
-
if (urlObject.params.length === 1 ||
|
|
92
|
-
(urlObject.params.length === 2 && urlObject.params[1][0] === 'p')) {
|
|
93
|
-
driver.hashChangeNoViewChange('#' +
|
|
94
|
-
customListRouteId +
|
|
95
|
-
(urlObject.params[1] ? '/' + urlObject.params[1] : ''));
|
|
96
|
-
return {
|
|
97
|
-
type: 'CUSTOM_LIST',
|
|
98
|
-
urlObject,
|
|
99
|
-
routeID: customListRouteId,
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return options;
|
|
105
|
-
})
|
|
106
|
-
.map((options) => {
|
|
107
|
-
const MAX_KEY_CACHE = 50;
|
|
108
|
-
const { urlObject } = options;
|
|
109
|
-
if (!sameRouteData[urlObject.hash]) {
|
|
110
|
-
sameRouteData[urlObject.hash] = {
|
|
111
|
-
data: {},
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
sameRouteData[urlObject.hash].lastUsedTimestamp = Date.now();
|
|
115
|
-
if (Object.keys(sameRouteData).length > MAX_KEY_CACHE) {
|
|
116
|
-
sameRouteData = Object.keys(sameRouteData)
|
|
117
|
-
.sort((a, b) => sameRouteData[b].lastUsedTimestamp -
|
|
118
|
-
sameRouteData[a].lastUsedTimestamp)
|
|
119
|
-
.slice(0, MAX_KEY_CACHE / 2)
|
|
120
|
-
.reduce((acc, hash) => ({ ...acc, [hash]: sameRouteData[hash] }), {});
|
|
121
|
-
}
|
|
122
|
-
return {
|
|
123
|
-
...options,
|
|
124
|
-
cachedRouteData: sameRouteData[urlObject.hash].data,
|
|
125
|
-
};
|
|
126
|
-
})
|
|
127
|
-
.map((options) => {
|
|
128
|
-
if (options.type === 'NATIVE' || options.type === 'CUSTOM_LIST') {
|
|
129
|
-
driver.showNativeRouteView();
|
|
130
|
-
}
|
|
131
|
-
else if (options.type === 'CUSTOM_LIST_TRIGGER') {
|
|
132
|
-
driver.showCustomThreadList(options.routeID, get(customListRouteIDs, options.routeID), options.urlObject.params);
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
return new GmailRouteView(options, gmailRouteProcessor, driver);
|
|
136
|
-
})
|
|
137
|
-
.filter(Boolean)
|
|
138
|
-
.map((gmailRouteView) => {
|
|
139
|
-
if (latestGmailRouteView) {
|
|
140
|
-
latestGmailRouteView.destroy();
|
|
141
|
-
}
|
|
142
|
-
latestGmailRouteView = gmailRouteView;
|
|
143
|
-
lastHash = getURLObject(document.location.href).hash;
|
|
144
|
-
return gmailRouteView;
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
/*
|
|
148
|
-
* TODO: Split up "role=main" DOM watching and hash change watching.
|
|
149
|
-
*
|
|
150
|
-
* SDK only cares about hash change when the hash goes to a route that the app registered as custom.
|
|
151
|
-
* Otherwise it only responds to route changes when the role=main div changes.
|
|
152
|
-
*/
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import Kefir from 'kefir';
|
|
2
|
-
import kefirCast from 'kefir-cast';
|
|
3
|
-
export default function showAppIdWarning(driver) {
|
|
4
|
-
const topDiv = document.createElement('div');
|
|
5
|
-
topDiv.className = 'inboxsdk__appid_warning';
|
|
6
|
-
topDiv.innerHTML = `
|
|
7
|
-
<div class="inboxsdk__appid_warning_main">
|
|
8
|
-
<div class="topline">InboxSDK Developer Warning: Invalid AppId</div>
|
|
9
|
-
<div>You've loaded the InboxSDK with an unregistered appId. Registration is free but necessary to load the SDK.</div>
|
|
10
|
-
</div>
|
|
11
|
-
<a class="inboxsdk__appid_register" target="_blank" href="https://www.inboxsdk.com/register">Register Your App</a>
|
|
12
|
-
<input type="button" value="" title="Close" class="inboxsdk__x_close_button" />
|
|
13
|
-
`;
|
|
14
|
-
const topMessageBarDriver = driver.createTopMessageBarDriver(kefirCast(Kefir, { el: topDiv }));
|
|
15
|
-
const closeBtn = topDiv.querySelector('.inboxsdk__x_close_button');
|
|
16
|
-
if (!closeBtn)
|
|
17
|
-
throw new Error('Should not happen');
|
|
18
|
-
closeBtn.addEventListener('click', function (_e) {
|
|
19
|
-
topMessageBarDriver.remove();
|
|
20
|
-
});
|
|
21
|
-
}
|
package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-route-view.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { defn } from 'ud';
|
|
2
|
-
import GmailElementGetter from '../gmail-element-getter';
|
|
3
|
-
const ACTIVE_ADD_ON_ICON_SELECTOR = '.J-KU-KO';
|
|
4
|
-
import { simulateClick } from '../../../lib/dom/simulate-mouse-event';
|
|
5
|
-
const showCustomRouteView = defn(module, function showCustomRouteView(gmailDriver, element) {
|
|
6
|
-
const contentSectionElement = GmailElementGetter.getContentSectionElement();
|
|
7
|
-
if (!contentSectionElement) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
const selection = document.getSelection();
|
|
11
|
-
for (let i = 0; i < selection.rangeCount; i++) {
|
|
12
|
-
const range = selection.getRangeAt(i);
|
|
13
|
-
if (typeof range.intersectsNode === 'function' &&
|
|
14
|
-
range.intersectsNode(contentSectionElement)) {
|
|
15
|
-
selection.removeAllRanges();
|
|
16
|
-
break;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
const customViewContainerElement = _getCustomViewContainerElement(contentSectionElement);
|
|
20
|
-
customViewContainerElement.appendChild(element);
|
|
21
|
-
const children = contentSectionElement.children;
|
|
22
|
-
Array.prototype.forEach.call(children, (child) => {
|
|
23
|
-
if (child.classList.contains('inboxsdk__custom_view')) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
child.style.display = 'none';
|
|
27
|
-
});
|
|
28
|
-
//if any thread sidebar addons are enabled then we need to turn them off
|
|
29
|
-
const companionSidebarIconContainerEl = GmailElementGetter.getCompanionSidebarIconContainerElement();
|
|
30
|
-
if (companionSidebarIconContainerEl) {
|
|
31
|
-
const activeThreadAddOnIcon = companionSidebarIconContainerEl.querySelector(ACTIVE_ADD_ON_ICON_SELECTOR);
|
|
32
|
-
if (activeThreadAddOnIcon) {
|
|
33
|
-
simulateClick(activeThreadAddOnIcon);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
document.body.classList.add('inboxsdk__custom_view_active');
|
|
37
|
-
});
|
|
38
|
-
export default showCustomRouteView;
|
|
39
|
-
function _getCustomViewContainerElement(contentSectionElement) {
|
|
40
|
-
let customViewContainerElement = contentSectionElement.querySelector('.inboxsdk__custom_view');
|
|
41
|
-
if (customViewContainerElement) {
|
|
42
|
-
return customViewContainerElement;
|
|
43
|
-
}
|
|
44
|
-
customViewContainerElement = document.createElement('div');
|
|
45
|
-
customViewContainerElement.classList.add('inboxsdk__custom_view');
|
|
46
|
-
contentSectionElement.appendChild(customViewContainerElement);
|
|
47
|
-
return customViewContainerElement;
|
|
48
|
-
}
|
package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-thread-list.js
DELETED
|
@@ -1,357 +0,0 @@
|
|
|
1
|
-
import find from 'lodash/find';
|
|
2
|
-
import GmailElementGetter from '../gmail-element-getter';
|
|
3
|
-
import * as GRP from '../gmail-response-processor';
|
|
4
|
-
import * as SyncGRP from '../gmail-sync-response-processor';
|
|
5
|
-
import isStreakAppId from '../../../lib/isStreakAppId';
|
|
6
|
-
import update from 'immutability-helper';
|
|
7
|
-
const threadListHandlersToSearchStrings = new Map();
|
|
8
|
-
const MAX_THREADS_PER_PAGE = 50;
|
|
9
|
-
/*
|
|
10
|
-
Timeline of how a custom thread list works:
|
|
11
|
-
|
|
12
|
-
* App registers a custom list by calling sdk.Router.handleCustomListRoute(),
|
|
13
|
-
which forwards the call to the driver where the route id and handler are
|
|
14
|
-
saved.
|
|
15
|
-
|
|
16
|
-
<User eventually navigates to a custom list route>
|
|
17
|
-
|
|
18
|
-
* setup-route-view-driver-stream.js receives the hashchange event, recognizes
|
|
19
|
-
that it matched a registered custom list route id, and then calls this file's
|
|
20
|
-
showCustomThreadList function instead of creating a RouteView.
|
|
21
|
-
|
|
22
|
-
* showCustomThreadList registers a bunch of listeners to respond at the right
|
|
23
|
-
times in the coming storm.
|
|
24
|
-
|
|
25
|
-
* showCustomThreadList hides the text in the search box, so the nonsense search
|
|
26
|
-
isn't visible to the user.
|
|
27
|
-
|
|
28
|
-
* showCustomThreadList sets it all in motion by navigating the user to a search
|
|
29
|
-
for a random string.
|
|
30
|
-
|
|
31
|
-
<Gmail thinks the user has navigated to a search, and triggers an AJAX request
|
|
32
|
-
for the search>
|
|
33
|
-
|
|
34
|
-
* We intercept the search request before it goes out, call the handler function
|
|
35
|
-
the app gave us to figure out the RFC message IDs the app wants to show, and
|
|
36
|
-
then rewrite the search request to be a search for those specific messages.
|
|
37
|
-
|
|
38
|
-
* We let the request through, and then look up all of the gmail thread ids for
|
|
39
|
-
the requested messages.
|
|
40
|
-
|
|
41
|
-
<The server sends the browser the AJAX response back>
|
|
42
|
-
|
|
43
|
-
* We intercept the response, and reorder the messages in the response into the
|
|
44
|
-
order that the app wants.
|
|
45
|
-
|
|
46
|
-
<Gmail gets our rewritten AJAX response, and switches the DOM to the search
|
|
47
|
-
results>
|
|
48
|
-
|
|
49
|
-
* When the search completes and Gmail switches to the search results,
|
|
50
|
-
setup-route-view-driver-stream.js recognizes the search string in the URL,
|
|
51
|
-
clears the search box, changes the hash in the URL to look like the custom
|
|
52
|
-
list route id, and associates the new RouteView with the custom list.
|
|
53
|
-
|
|
54
|
-
*/
|
|
55
|
-
function copyAndOmitExcessThreads(ids, logger) {
|
|
56
|
-
if (ids.length > MAX_THREADS_PER_PAGE) {
|
|
57
|
-
// upgrade to deprecationWarning later
|
|
58
|
-
logger.error(new Error('Received more than the maximum number of threads specified by handler, ' +
|
|
59
|
-
'ignoring additional threads (https://www.inboxsdk.com/docs/#Router).'));
|
|
60
|
-
}
|
|
61
|
-
return ids.slice(0, MAX_THREADS_PER_PAGE);
|
|
62
|
-
}
|
|
63
|
-
function _findIdFailure(id, err) {
|
|
64
|
-
console.log('Failed to find id for thread', id, err);
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
function parseOnActivateResult(logger, start, result) {
|
|
68
|
-
if (Array.isArray(result)) {
|
|
69
|
-
logger.deprecationWarning('Returning an array from a handleCustomListRoute handler', 'a CustomListDescriptor object');
|
|
70
|
-
const threads = copyAndOmitExcessThreads(result, logger);
|
|
71
|
-
return {
|
|
72
|
-
// default to one page since arrays can't be paginated
|
|
73
|
-
total: threads.length,
|
|
74
|
-
threads,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
else if (typeof result === 'object') {
|
|
78
|
-
const { total, hasMore, threads } = result;
|
|
79
|
-
if (!Array.isArray(threads)) {
|
|
80
|
-
throw new Error('handleCustomListRoute result must contain a "threads" array ' +
|
|
81
|
-
'(https://www.inboxsdk.com/docs/#Router).');
|
|
82
|
-
}
|
|
83
|
-
if (total != null && hasMore != null) {
|
|
84
|
-
throw new Error('handleCustomListRoute result must only contain either ' +
|
|
85
|
-
'a "total" or a "hasMore" property, but not both. ' +
|
|
86
|
-
'(https://www.inboxsdk.com/docs/#Router).');
|
|
87
|
-
}
|
|
88
|
-
if (typeof total === 'number') {
|
|
89
|
-
return {
|
|
90
|
-
total,
|
|
91
|
-
threads: copyAndOmitExcessThreads(threads, logger),
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
else if (typeof hasMore === 'boolean') {
|
|
95
|
-
const threadsWithoutExcess = copyAndOmitExcessThreads(threads, logger);
|
|
96
|
-
return {
|
|
97
|
-
total: hasMore ? 'MANY' : start + threads.length,
|
|
98
|
-
threads: threadsWithoutExcess,
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
throw new Error('handleCustomListRoute result must contain either a "total" number ' +
|
|
103
|
-
'or a "hasMore" boolean (https://www.inboxsdk.com/docs/#Router).');
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
throw new Error('handleCustomListRoute result must be an array or an object ' +
|
|
108
|
-
'(https://www.inboxsdk.com/docs/#Router).');
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
function threadDescriptorToInitialIDPair(id) {
|
|
112
|
-
if (typeof id === 'string') {
|
|
113
|
-
if (id[0] == '<') {
|
|
114
|
-
return { rfcId: id };
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
return { gtid: id };
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
else if (id) {
|
|
121
|
-
const obj = {
|
|
122
|
-
gtid: typeof id.gmailThreadId === 'string' && id.gmailThreadId,
|
|
123
|
-
rfcId: typeof id.rfcMessageId === 'string' && id.rfcMessageId,
|
|
124
|
-
};
|
|
125
|
-
if (obj.gtid || obj.rfcId) {
|
|
126
|
-
return obj;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
function initialIDPairToIDPairWithRFC(driver, pair, findIdFailure) {
|
|
131
|
-
if (typeof pair.rfcId === 'string') {
|
|
132
|
-
return Promise.resolve(pair);
|
|
133
|
-
}
|
|
134
|
-
else if (typeof pair.gtid === 'string') {
|
|
135
|
-
const gtid = pair.gtid;
|
|
136
|
-
return driver.getRfcMessageIdForGmailThreadId(gtid).then((rfcId) => ({ gtid, rfcId }), (err) => findIdFailure(gtid, err));
|
|
137
|
-
}
|
|
138
|
-
throw new Error('Should not happen');
|
|
139
|
-
}
|
|
140
|
-
function idPairWithRFCToCompletedIDPair(driver, pair, findIdFailure) {
|
|
141
|
-
return typeof pair.gtid === 'string'
|
|
142
|
-
? Promise.resolve(pair)
|
|
143
|
-
: driver.getGmailThreadIdForRfcMessageId(pair.rfcId).then((gtid) => ({ gtid, rfcId: pair.rfcId }), (err) => findIdFailure(pair.rfcId, err));
|
|
144
|
-
}
|
|
145
|
-
// Returns the search string that will trigger the onActivate function.
|
|
146
|
-
const setupSearchReplacing = (driver, customRouteID, onActivate, findIdFailure) => {
|
|
147
|
-
const preexistingQuery = threadListHandlersToSearchStrings.get(onActivate);
|
|
148
|
-
if (preexistingQuery) {
|
|
149
|
-
return preexistingQuery;
|
|
150
|
-
}
|
|
151
|
-
const newQuery = Date.now() + '-' + Math.random();
|
|
152
|
-
driver.getPageCommunicator().setupCustomListResultsQuery(newQuery);
|
|
153
|
-
driver
|
|
154
|
-
.getPageCommunicator()
|
|
155
|
-
.ajaxInterceptStream.filter((e) => e.type === 'searchForReplacement' && e.query === newQuery)
|
|
156
|
-
.onValue(({ start }) => {
|
|
157
|
-
(async () => {
|
|
158
|
-
driver.signalCustomThreadListActivity(customRouteID);
|
|
159
|
-
let total;
|
|
160
|
-
let threadDescriptors;
|
|
161
|
-
try {
|
|
162
|
-
const onActivateResult = await Promise.resolve(onActivate(start, MAX_THREADS_PER_PAGE));
|
|
163
|
-
const parsed = parseOnActivateResult(driver.getLogger(), start, onActivateResult);
|
|
164
|
-
total = parsed.total;
|
|
165
|
-
threadDescriptors = parsed.threads;
|
|
166
|
-
}
|
|
167
|
-
catch (e) {
|
|
168
|
-
driver.getLogger().error(e);
|
|
169
|
-
total = 0;
|
|
170
|
-
threadDescriptors = [];
|
|
171
|
-
}
|
|
172
|
-
const initialIDPairs = threadDescriptors
|
|
173
|
-
.map(threadDescriptorToInitialIDPair)
|
|
174
|
-
.filter(Boolean);
|
|
175
|
-
const idPairsWithRFC = (await Promise.all(initialIDPairs.map((pair) => initialIDPairToIDPairWithRFC(driver, pair, findIdFailure)))).filter(Boolean);
|
|
176
|
-
const messageIDQuery = idPairsWithRFC.length > 0
|
|
177
|
-
? idPairsWithRFC
|
|
178
|
-
.map(({ rfcId }) => 'rfc822msgid:' + rfcId)
|
|
179
|
-
.join(' OR ')
|
|
180
|
-
: '' + Math.random() + Date.now(); // google doesn't like empty searches
|
|
181
|
-
// Outgoing requests for list queries always need to have a `start` of 0,
|
|
182
|
-
// because we only ever ask for 1 page-worth of threads per query.
|
|
183
|
-
// When the response comes back, we modify it to have a `start` consistent
|
|
184
|
-
// with whatever page was being loaded so Gmail's UI makes sense.
|
|
185
|
-
driver.getPageCommunicator().setCustomListNewQuery({
|
|
186
|
-
newQuery: messageIDQuery,
|
|
187
|
-
newStart: 0,
|
|
188
|
-
query: newQuery,
|
|
189
|
-
start,
|
|
190
|
-
});
|
|
191
|
-
const searchResultsResponse_promise = driver
|
|
192
|
-
.getPageCommunicator()
|
|
193
|
-
.ajaxInterceptStream.filter((e) => e.type === 'searchResultsResponse' &&
|
|
194
|
-
e.query === newQuery &&
|
|
195
|
-
e.start === start)
|
|
196
|
-
.map((x) => x.response)
|
|
197
|
-
.take(1)
|
|
198
|
-
.toPromise();
|
|
199
|
-
// Figure out any gmail thread ids we don't know yet.
|
|
200
|
-
const completedIDPairs = (await Promise.all(idPairsWithRFC.map((pair) => idPairWithRFCToCompletedIDPair(driver, pair, findIdFailure)))).filter(Boolean);
|
|
201
|
-
const response = await searchResultsResponse_promise;
|
|
202
|
-
driver.signalCustomThreadListActivity(customRouteID);
|
|
203
|
-
// override thread list response so that we show results in the same
|
|
204
|
-
// order that user passed in
|
|
205
|
-
let newResponse;
|
|
206
|
-
try {
|
|
207
|
-
if (driver.isUsingSyncAPI()) {
|
|
208
|
-
const extractedThreads = SyncGRP.extractThreadsFromSearchResponse(response);
|
|
209
|
-
const extractedThreadsInCompletedIDPairsOrder = completedIDPairs
|
|
210
|
-
.map(({ gtid }) => find(extractedThreads, (t) => t.oldGmailThreadID === gtid))
|
|
211
|
-
.filter(Boolean);
|
|
212
|
-
const doesNeedReorder = extractedThreads.length !==
|
|
213
|
-
extractedThreadsInCompletedIDPairsOrder.length ||
|
|
214
|
-
extractedThreads.some((extractedThread, index) => extractedThread !==
|
|
215
|
-
extractedThreadsInCompletedIDPairsOrder[index]);
|
|
216
|
-
let reorderedThreads;
|
|
217
|
-
if (doesNeedReorder) {
|
|
218
|
-
const now = Date.now();
|
|
219
|
-
reorderedThreads = extractedThreadsInCompletedIDPairsOrder.map((extractedThread, index) => {
|
|
220
|
-
const newFormat = Array.isArray(extractedThread.rawResponse);
|
|
221
|
-
const newTime = String(now - index);
|
|
222
|
-
let newThread = update(extractedThread, {
|
|
223
|
-
rawResponse: newFormat
|
|
224
|
-
? {
|
|
225
|
-
'0': {
|
|
226
|
-
'2': { $set: newTime },
|
|
227
|
-
'7': { $set: newTime },
|
|
228
|
-
},
|
|
229
|
-
}
|
|
230
|
-
: {
|
|
231
|
-
'1': {
|
|
232
|
-
'3': { $set: newTime },
|
|
233
|
-
'8': { $set: newTime },
|
|
234
|
-
},
|
|
235
|
-
},
|
|
236
|
-
});
|
|
237
|
-
if (newFormat
|
|
238
|
-
? extractedThread.rawResponse[0][4]
|
|
239
|
-
: extractedThread.rawResponse[1][5]) {
|
|
240
|
-
newThread = update(newThread, {
|
|
241
|
-
rawResponse: newFormat
|
|
242
|
-
? {
|
|
243
|
-
'0': {
|
|
244
|
-
'4': (oldVal) => oldVal.map((md) => update(md, {
|
|
245
|
-
'6': { $set: newTime },
|
|
246
|
-
'17': { $set: newTime },
|
|
247
|
-
'30': { $set: newTime },
|
|
248
|
-
})),
|
|
249
|
-
},
|
|
250
|
-
}
|
|
251
|
-
: {
|
|
252
|
-
'1': {
|
|
253
|
-
'5': (oldVal) => oldVal.map((md) => update(md, {
|
|
254
|
-
'7': { $set: newTime },
|
|
255
|
-
'18': { $set: newTime },
|
|
256
|
-
'31': { $set: newTime },
|
|
257
|
-
})),
|
|
258
|
-
},
|
|
259
|
-
},
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
return newThread;
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
else {
|
|
266
|
-
reorderedThreads = extractedThreads;
|
|
267
|
-
}
|
|
268
|
-
newResponse = SyncGRP.replaceThreadsInSearchResponse(response, reorderedThreads, { start, total });
|
|
269
|
-
}
|
|
270
|
-
else {
|
|
271
|
-
const extractedThreads = GRP.extractThreads(response);
|
|
272
|
-
const reorderedThreads = completedIDPairs
|
|
273
|
-
.map(({ gtid }) => find(extractedThreads, (t) => t.gmailThreadId === gtid))
|
|
274
|
-
.filter(Boolean);
|
|
275
|
-
newResponse = GRP.replaceThreadsInResponse(response, reorderedThreads, { start, total });
|
|
276
|
-
}
|
|
277
|
-
driver
|
|
278
|
-
.getPageCommunicator()
|
|
279
|
-
.setCustomListResults(newQuery, newResponse);
|
|
280
|
-
}
|
|
281
|
-
catch (e) {
|
|
282
|
-
driver.getLogger().error(e, {
|
|
283
|
-
responseReplacementFailure: true,
|
|
284
|
-
//response: isStreakAppId(driver.getAppId()) ? response : null,
|
|
285
|
-
idPairsLength: completedIDPairs.length,
|
|
286
|
-
});
|
|
287
|
-
const butterBar = driver.getButterBar();
|
|
288
|
-
if (butterBar) {
|
|
289
|
-
butterBar.showError({
|
|
290
|
-
text: 'Failed to load custom thread list',
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
try {
|
|
294
|
-
if (driver.isUsingSyncAPI()) {
|
|
295
|
-
driver.getPageCommunicator().setCustomListResults(newQuery, SyncGRP.replaceThreadsInSearchResponse(response, [], {
|
|
296
|
-
start,
|
|
297
|
-
total,
|
|
298
|
-
}));
|
|
299
|
-
}
|
|
300
|
-
else {
|
|
301
|
-
driver
|
|
302
|
-
.getPageCommunicator()
|
|
303
|
-
.setCustomListResults(newQuery, GRP.replaceThreadsInResponse(response, [], { start, total }));
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
catch (e2) {
|
|
307
|
-
driver.getLogger().error(e2);
|
|
308
|
-
// The original response will be used.
|
|
309
|
-
driver.getPageCommunicator().setCustomListResults(newQuery, null);
|
|
310
|
-
}
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
setTimeout(() => {
|
|
314
|
-
const errorBar = document.querySelector('.vY .vX.UC');
|
|
315
|
-
if (errorBar &&
|
|
316
|
-
errorBar.style.display !== 'none' &&
|
|
317
|
-
/#\d+/.test(errorBar.textContent)) {
|
|
318
|
-
const isStreak = isStreakAppId(driver.getAppId());
|
|
319
|
-
driver
|
|
320
|
-
.getLogger()
|
|
321
|
-
.error(new Error('Gmail error with custom thread list'), {
|
|
322
|
-
message: errorBar.textContent,
|
|
323
|
-
completedIDPairsLength: completedIDPairs.length,
|
|
324
|
-
response: isStreak ? response : null,
|
|
325
|
-
newResponse: isStreak ? newResponse : null,
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
}, 1000);
|
|
329
|
-
})().catch((err) => driver.getLogger().error(err));
|
|
330
|
-
});
|
|
331
|
-
driver.getCustomListSearchStringsToRouteIds().set(newQuery, customRouteID);
|
|
332
|
-
threadListHandlersToSearchStrings.set(onActivate, newQuery);
|
|
333
|
-
return newQuery;
|
|
334
|
-
};
|
|
335
|
-
export default function showCustomThreadList(driver, customRouteID, onActivate, params, findIdFailure = _findIdFailure) {
|
|
336
|
-
const uniqueSearch = setupSearchReplacing(driver, customRouteID, onActivate, findIdFailure);
|
|
337
|
-
const customHash = document.location.hash;
|
|
338
|
-
const nextMainContentElementChange = GmailElementGetter.getMainContentElementChangedStream().changes().take(1);
|
|
339
|
-
const searchInput = GmailElementGetter.getSearchInput();
|
|
340
|
-
if (!searchInput)
|
|
341
|
-
throw new Error('could not find search input');
|
|
342
|
-
searchInput.value = '';
|
|
343
|
-
searchInput.style.visibility = 'hidden';
|
|
344
|
-
nextMainContentElementChange.onValue(() => {
|
|
345
|
-
// setup-route-view-driver-stream handles clearing search again
|
|
346
|
-
searchInput.style.visibility = 'visible';
|
|
347
|
-
});
|
|
348
|
-
// Change the hash *without* making a new history entry.
|
|
349
|
-
const searchHash = '#search/' + [uniqueSearch, ...params].map(encodeURIComponent).join('/');
|
|
350
|
-
window.history.replaceState(null, null, searchHash);
|
|
351
|
-
// Create a hashchange event so setup-route-view-driver-stream sees this event.
|
|
352
|
-
const hce = new window.HashChangeEvent('hashchange', {
|
|
353
|
-
oldURL: document.location.href.replace(/#.*$/, '') + customHash,
|
|
354
|
-
newURL: document.location.href.replace(/#.*$/, '') + searchHash,
|
|
355
|
-
});
|
|
356
|
-
window.dispatchEvent(hce);
|
|
357
|
-
}
|
package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-native-route-view.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import GmailElementGetter from '../gmail-element-getter';
|
|
2
|
-
import fakeWindowResize from '../../../lib/fake-window-resize';
|
|
3
|
-
export default function showNativeRouteView(_gmailDriver) {
|
|
4
|
-
const contentSectionElement = GmailElementGetter.getContentSectionElement();
|
|
5
|
-
if (!contentSectionElement) {
|
|
6
|
-
return;
|
|
7
|
-
}
|
|
8
|
-
Array.prototype.forEach.call(contentSectionElement.children, (child) => {
|
|
9
|
-
child.style.display = '';
|
|
10
|
-
});
|
|
11
|
-
if (document.body.classList.contains('inboxsdk__custom_view_active')) {
|
|
12
|
-
document.body.classList.remove('inboxsdk__custom_view_active');
|
|
13
|
-
// Work around issue where Gmail sometimes screws up its formatting until
|
|
14
|
-
// the user resizes their screen. Reproduction steps that sometimes work:
|
|
15
|
-
// use multiple inboxes lab, with multiple inboxes set below the inbox, go
|
|
16
|
-
// to a pipeline, resize the window slightly, and then go to inbox.
|
|
17
|
-
fakeWindowResize();
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { simulateClick } from '../../../lib/dom/simulate-mouse-event';
|
|
2
|
-
import makeElementChildStream from '../../../lib/dom/make-element-child-stream';
|
|
3
|
-
import waitFor from '../../../lib/stream-wait-for';
|
|
4
|
-
import GmailElementGetter from '../gmail-element-getter';
|
|
5
|
-
export default function suppressAddon(driver, addonTitle) {
|
|
6
|
-
waitFor(() => GmailElementGetter.getCompanionSidebarIconContainerElement())
|
|
7
|
-
.map((iconContainerElement) => {
|
|
8
|
-
// .J-KU-Jg is pre-2018-07-30 element?
|
|
9
|
-
const elementToWatch = iconContainerElement.querySelector('.J-KU-Jg, [role=tablist], .brC-bsf-aT5-aOt');
|
|
10
|
-
if (!elementToWatch) {
|
|
11
|
-
driver
|
|
12
|
-
.getLogger()
|
|
13
|
-
.error(new Error('_waitForAddonTitleAndSuppress: elementToWatch not found'));
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
return elementToWatch;
|
|
17
|
-
})
|
|
18
|
-
.filter()
|
|
19
|
-
.flatMap(makeElementChildStream)
|
|
20
|
-
.filter(({ el }) => el.getAttribute('role') === 'tab' &&
|
|
21
|
-
(el.getAttribute('data-tooltip') || el.getAttribute('aria-label')) ===
|
|
22
|
-
addonTitle)
|
|
23
|
-
.takeUntilBy(driver.getStopper())
|
|
24
|
-
.onValue(({ el }) => {
|
|
25
|
-
if (el.classList.contains('J-KU-KO') || // old pre-2018-07-30 classname?
|
|
26
|
-
el.classList.contains('bse-bvF-I-KO') || // old pre-2018-10-15 classname?
|
|
27
|
-
el.classList.contains('aT5-aOt-I-KO')) {
|
|
28
|
-
// it is currently open, so let's close
|
|
29
|
-
simulateClick(el);
|
|
30
|
-
}
|
|
31
|
-
el.style.display = 'none';
|
|
32
|
-
})
|
|
33
|
-
.onError((err) => {
|
|
34
|
-
driver.getLogger().error(err, 'error in suppressAddon');
|
|
35
|
-
});
|
|
36
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
let isTrackingValidity = false;
|
|
2
|
-
export default function temporaryTrackDownloadUrlValidity(driver) {
|
|
3
|
-
if (driver.getAppId() !== 'sdk_streak_21e9788951' ||
|
|
4
|
-
!global.fetch ||
|
|
5
|
-
isTrackingValidity) {
|
|
6
|
-
return;
|
|
7
|
-
}
|
|
8
|
-
isTrackingValidity = true;
|
|
9
|
-
driver
|
|
10
|
-
.getAttachmentCardViewDriverStream()
|
|
11
|
-
.filter((cardView) => cardView.getAttachmentType() === 'FILE')
|
|
12
|
-
.filter(() => Math.random() < 0.01)
|
|
13
|
-
.onValue(async (cardView) => {
|
|
14
|
-
const downloadLinkBefore = cardView._getDownloadLink();
|
|
15
|
-
let downloadUrl;
|
|
16
|
-
try {
|
|
17
|
-
downloadUrl = await cardView.getDownloadURL();
|
|
18
|
-
}
|
|
19
|
-
catch (err) {
|
|
20
|
-
driver.getLogger().error(err, {
|
|
21
|
-
reason: 'problem getting download url',
|
|
22
|
-
downloadLinkBefore,
|
|
23
|
-
downloadLinkAfter: cardView._getDownloadLink(),
|
|
24
|
-
});
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
if (!downloadUrl) {
|
|
28
|
-
driver.getLogger().error(new Error('no download url found'), {
|
|
29
|
-
downloadLinkBefore,
|
|
30
|
-
downloadLinkAfter: cardView._getDownloadLink(),
|
|
31
|
-
});
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
driver.getLogger().eventSdkPassive('testing.getDownloadURL success');
|
|
35
|
-
});
|
|
36
|
-
}
|