@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,24 +0,0 @@
|
|
|
1
|
-
const BANNER_WIDTH_LIMIT = 900;
|
|
2
|
-
export default function monitorTopBannerSizeAndReact() {
|
|
3
|
-
const ResizeObserver = global.ResizeObserver;
|
|
4
|
-
if (!ResizeObserver)
|
|
5
|
-
return;
|
|
6
|
-
const body = document.body;
|
|
7
|
-
if (!body)
|
|
8
|
-
return;
|
|
9
|
-
const banner = body.querySelector('[role=banner]');
|
|
10
|
-
if (!banner)
|
|
11
|
-
return;
|
|
12
|
-
if (banner.hasAttribute('inboxsdk__resize_claimed'))
|
|
13
|
-
return;
|
|
14
|
-
banner.setAttribute('inboxsdk__resize_claimed', 'true');
|
|
15
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
16
|
-
if (banner.clientWidth < BANNER_WIDTH_LIMIT) {
|
|
17
|
-
body.classList.add('inboxsdk__searchIsNarrow');
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
body.classList.remove('inboxsdk__searchIsNarrow');
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
resizeObserver.observe(banner);
|
|
24
|
-
}
|
package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view.js
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import querySelector from '../../../lib/dom/querySelectorOrFail';
|
|
2
|
-
import censorHTMLtree from '../../../../common/censorHTMLtree';
|
|
3
|
-
import kefirStopper from 'kefir-stopper';
|
|
4
|
-
import updateIcon from '../../../driver-common/update-icon';
|
|
5
|
-
import GmailElementGetter from '../gmail-element-getter';
|
|
6
|
-
import GmailTooltipView from '../widgets/gmail-tooltip-view';
|
|
7
|
-
import DropdownView from '../../../widgets/buttons/dropdown-view';
|
|
8
|
-
import monitorTopBannerSizeAndReact from './gmail-app-toolbar-button-view/monitor-top-banner-size-and-react';
|
|
9
|
-
export default class GmailAppToolbarButtonView {
|
|
10
|
-
_stopper;
|
|
11
|
-
_iconSettings;
|
|
12
|
-
_element = null;
|
|
13
|
-
_activeDropdown;
|
|
14
|
-
_buttonDescriptor;
|
|
15
|
-
_driver;
|
|
16
|
-
constructor(driver, inButtonDescriptor) {
|
|
17
|
-
this._driver = driver;
|
|
18
|
-
this._stopper = kefirStopper();
|
|
19
|
-
this._iconSettings = {};
|
|
20
|
-
inButtonDescriptor
|
|
21
|
-
.takeUntilBy(this._stopper)
|
|
22
|
-
.onValue((buttonDescriptor) => {
|
|
23
|
-
try {
|
|
24
|
-
this._handleButtonDescriptor(buttonDescriptor);
|
|
25
|
-
}
|
|
26
|
-
catch (err) {
|
|
27
|
-
this._driver.getLogger().error(err);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
monitorTopBannerSizeAndReact();
|
|
31
|
-
}
|
|
32
|
-
destroy() {
|
|
33
|
-
this._stopper.destroy();
|
|
34
|
-
if (this._element) {
|
|
35
|
-
this._element.remove();
|
|
36
|
-
}
|
|
37
|
-
if (this._activeDropdown) {
|
|
38
|
-
this._activeDropdown.close();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
getStopper() {
|
|
42
|
-
return this._stopper;
|
|
43
|
-
}
|
|
44
|
-
getElement() {
|
|
45
|
-
return this._element;
|
|
46
|
-
}
|
|
47
|
-
open() {
|
|
48
|
-
try {
|
|
49
|
-
if (!this._activeDropdown) {
|
|
50
|
-
this._handleClick();
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
catch (err) {
|
|
54
|
-
this._driver.getLogger().error(err);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
close() {
|
|
58
|
-
try {
|
|
59
|
-
if (this._activeDropdown) {
|
|
60
|
-
this._handleClick();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
catch (err) {
|
|
64
|
-
this._driver.getLogger().error(err);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
_handleButtonDescriptor(buttonDescriptor) {
|
|
68
|
-
if (!buttonDescriptor) {
|
|
69
|
-
throw new Error('The application passed an invalid value for buttonDescriptor');
|
|
70
|
-
}
|
|
71
|
-
const element = (this._element =
|
|
72
|
-
this._element ||
|
|
73
|
-
_createAppButtonElement(this._driver, () => {
|
|
74
|
-
this._handleClick();
|
|
75
|
-
}));
|
|
76
|
-
this._buttonDescriptor = buttonDescriptor;
|
|
77
|
-
updateIcon(this._iconSettings, querySelector(element, 'a'), false, buttonDescriptor.iconClass, buttonDescriptor.iconUrl);
|
|
78
|
-
_updateTitle(querySelector(element, 'span'), buttonDescriptor);
|
|
79
|
-
}
|
|
80
|
-
_handleClick() {
|
|
81
|
-
const element = this._element;
|
|
82
|
-
if (!element) {
|
|
83
|
-
// We must have failed to create the element. An error would have already
|
|
84
|
-
// been logged.
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
const buttonDescriptor = this._buttonDescriptor;
|
|
88
|
-
if (!buttonDescriptor) {
|
|
89
|
-
throw new Error('app toolbar button clicked before receiving button descriptor');
|
|
90
|
-
}
|
|
91
|
-
if (this._activeDropdown) {
|
|
92
|
-
this._activeDropdown.close();
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
var appEvent = {};
|
|
96
|
-
var tooltipView = new GmailTooltipView();
|
|
97
|
-
tooltipView
|
|
98
|
-
.getContainerElement()
|
|
99
|
-
.classList.add('inboxsdk__appButton_tooltip');
|
|
100
|
-
tooltipView.getContentElement().innerHTML = '';
|
|
101
|
-
if (buttonDescriptor.arrowColor) {
|
|
102
|
-
querySelector(tooltipView.getContainerElement(), '.T-P-atC').style.borderTopColor = buttonDescriptor.arrowColor;
|
|
103
|
-
}
|
|
104
|
-
appEvent.dropdown = this._activeDropdown = new DropdownView(tooltipView, element, {
|
|
105
|
-
manualPosition: true,
|
|
106
|
-
});
|
|
107
|
-
appEvent.dropdown.on('destroy', () => {
|
|
108
|
-
this._activeDropdown = null;
|
|
109
|
-
});
|
|
110
|
-
if (buttonDescriptor.onClick) {
|
|
111
|
-
buttonDescriptor.onClick.call(null, appEvent);
|
|
112
|
-
}
|
|
113
|
-
if (this._element) {
|
|
114
|
-
tooltipView.anchor(this._element, {
|
|
115
|
-
position: 'bottom',
|
|
116
|
-
offset: {
|
|
117
|
-
top: 8,
|
|
118
|
-
},
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
function _createAppButtonElement(driver, onclick) {
|
|
125
|
-
const element = document.createElement('div');
|
|
126
|
-
element.setAttribute('class', 'inboxsdk__appButton');
|
|
127
|
-
element.innerHTML = `<a href="#">
|
|
128
|
-
<span class="inboxsdk__appButton_title"></span>
|
|
129
|
-
</a>`;
|
|
130
|
-
element.addEventListener('click', (event) => {
|
|
131
|
-
event.preventDefault();
|
|
132
|
-
onclick(event);
|
|
133
|
-
});
|
|
134
|
-
const topAccountContainer = GmailElementGetter.getTopAccountContainer();
|
|
135
|
-
if (!topAccountContainer) {
|
|
136
|
-
const err = new Error('Could not make button');
|
|
137
|
-
const banner = document.querySelector('[role=banner]');
|
|
138
|
-
driver.getLogger().error(err, {
|
|
139
|
-
type: 'failed to make appToolbarButton',
|
|
140
|
-
gbsfwPresent: !!document.getElementById('gbsfw'),
|
|
141
|
-
bannerHtml: banner && censorHTMLtree(banner),
|
|
142
|
-
});
|
|
143
|
-
throw err;
|
|
144
|
-
}
|
|
145
|
-
const insertionElement = topAccountContainer;
|
|
146
|
-
if (!insertionElement) {
|
|
147
|
-
const err = new Error('Could not make button');
|
|
148
|
-
driver.getLogger().error(err, {
|
|
149
|
-
type: 'failed to make appToolbarButton',
|
|
150
|
-
topAccountContainerHTML: censorHTMLtree(topAccountContainer),
|
|
151
|
-
});
|
|
152
|
-
throw err;
|
|
153
|
-
}
|
|
154
|
-
try {
|
|
155
|
-
if (!GmailElementGetter.isGplusEnabled()) {
|
|
156
|
-
element.classList.add('inboxsdk__appButton_noGPlus');
|
|
157
|
-
}
|
|
158
|
-
insertionElement.insertBefore(element, insertionElement.lastElementChild);
|
|
159
|
-
return element;
|
|
160
|
-
}
|
|
161
|
-
catch (err) {
|
|
162
|
-
driver.getLogger().error(err, {
|
|
163
|
-
type: 'failed to make appToolbarButton',
|
|
164
|
-
insertionElementHTML: censorHTMLtree(insertionElement),
|
|
165
|
-
});
|
|
166
|
-
throw err;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
function _updateTitle(element, descriptor) {
|
|
170
|
-
element.textContent = descriptor.title;
|
|
171
|
-
element.className = `inboxsdk__appButton_title ${descriptor.titleClass || ''}`;
|
|
172
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import GmailAttachmentCardView from './gmail-attachment-card-view';
|
|
2
|
-
import ButtonView from '../widgets/buttons/button-view';
|
|
3
|
-
import querySelector from '../../../lib/dom/querySelectorOrFail';
|
|
4
|
-
import BasicButtonViewController from '../../../widgets/buttons/basic-button-view-controller';
|
|
5
|
-
class GmailAttachmentAreaView {
|
|
6
|
-
_element;
|
|
7
|
-
_messageViewDriver;
|
|
8
|
-
_driver;
|
|
9
|
-
_elsToCardViews;
|
|
10
|
-
constructor(element, driver, messageViewDriver) {
|
|
11
|
-
this._driver = driver;
|
|
12
|
-
this._messageViewDriver = messageViewDriver;
|
|
13
|
-
this._elsToCardViews = new WeakMap();
|
|
14
|
-
if (element) {
|
|
15
|
-
this._element = element;
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
this._setupElement();
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
destroy() {
|
|
22
|
-
this.getAttachmentCardViews().forEach((view) => {
|
|
23
|
-
view.destroy();
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
getElement() {
|
|
27
|
-
return this._element;
|
|
28
|
-
}
|
|
29
|
-
getAttachmentCardViews() {
|
|
30
|
-
const attachments = this._element.querySelectorAll('.aQH > span');
|
|
31
|
-
return Array.from(attachments).map((attachment) => {
|
|
32
|
-
let cardView = this._elsToCardViews.get(attachment);
|
|
33
|
-
if (!cardView) {
|
|
34
|
-
cardView = new GmailAttachmentCardView({
|
|
35
|
-
element: attachment,
|
|
36
|
-
}, this._driver, this._messageViewDriver);
|
|
37
|
-
this._elsToCardViews.set(attachment, cardView);
|
|
38
|
-
}
|
|
39
|
-
return cardView;
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
_setupElement() {
|
|
43
|
-
this._element = document.createElement('div');
|
|
44
|
-
this._element.setAttribute('class', 'hq gt a10');
|
|
45
|
-
this._element.innerHTML = [
|
|
46
|
-
'<div class="hp"></div>',
|
|
47
|
-
'<div class="a3I">Attachments area</div>',
|
|
48
|
-
'<div></div>',
|
|
49
|
-
'<div class="aQH">',
|
|
50
|
-
'<div class="aZK"></div>',
|
|
51
|
-
'</div>',
|
|
52
|
-
].join('');
|
|
53
|
-
}
|
|
54
|
-
_createAreaToolbarIfNeeded() {
|
|
55
|
-
const preexistingToolbar = this._element.querySelector('.ho');
|
|
56
|
-
if (preexistingToolbar) {
|
|
57
|
-
return preexistingToolbar;
|
|
58
|
-
}
|
|
59
|
-
const toolbar = document.createElement('div');
|
|
60
|
-
toolbar.className = 'ho';
|
|
61
|
-
toolbar.innerHTML = `<span class="aVW"><span>${this.getAttachmentCardViews().length}</span> Attachments</span><div class="aZi J-J5-Ji"></div>`;
|
|
62
|
-
this._element.insertBefore(toolbar, this._element.lastElementChild);
|
|
63
|
-
this._element.classList.remove('a10');
|
|
64
|
-
return toolbar;
|
|
65
|
-
}
|
|
66
|
-
_updateToolbarCardCount() {
|
|
67
|
-
const cardCount = this.getAttachmentCardViews().length;
|
|
68
|
-
if (cardCount > 1) {
|
|
69
|
-
const toolbar = this._createAreaToolbarIfNeeded();
|
|
70
|
-
const counter = querySelector(toolbar, '.aVW > span');
|
|
71
|
-
counter.textContent = String(cardCount);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
addGmailAttachmentCardView(gmailAttachmentCardView) {
|
|
75
|
-
const zone = this._element.querySelector('.aXK, .aQH');
|
|
76
|
-
if (!zone) {
|
|
77
|
-
this._driver
|
|
78
|
-
.getLogger()
|
|
79
|
-
.error(new Error('Could not find attachment zone'));
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
zone.insertBefore(gmailAttachmentCardView.getElement(), zone.lastElementChild);
|
|
83
|
-
this._updateToolbarCardCount();
|
|
84
|
-
}
|
|
85
|
-
addButtonToDownloadAllArea(options) {
|
|
86
|
-
var buttonView = new ButtonView({
|
|
87
|
-
iconClass: 'T-I-J3',
|
|
88
|
-
iconUrl: options.iconUrl,
|
|
89
|
-
tooltip: options.tooltip,
|
|
90
|
-
hasButtonToLeft: true,
|
|
91
|
-
});
|
|
92
|
-
buttonView.addClass('aZj');
|
|
93
|
-
buttonView.getElement().children[0].className = 'asa';
|
|
94
|
-
new BasicButtonViewController({
|
|
95
|
-
activateFunction: () => {
|
|
96
|
-
if (options.onClick) {
|
|
97
|
-
options.onClick();
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
buttonView: buttonView,
|
|
101
|
-
});
|
|
102
|
-
const toolbar = this._createAreaToolbarIfNeeded();
|
|
103
|
-
querySelector(toolbar, '.aZi').appendChild(buttonView.getElement());
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
export default GmailAttachmentAreaView;
|
|
@@ -1,328 +0,0 @@
|
|
|
1
|
-
import find from 'lodash/find';
|
|
2
|
-
import * as Kefir from 'kefir';
|
|
3
|
-
import kefirStopper from 'kefir-stopper';
|
|
4
|
-
import autoHtml from 'auto-html';
|
|
5
|
-
import fromEventTargetCapture from '../../../lib/from-event-target-capture';
|
|
6
|
-
import querySelector from '../../../lib/dom/querySelectorOrFail';
|
|
7
|
-
import ButtonView from '../widgets/buttons/button-view';
|
|
8
|
-
import BasicButtonViewController from '../../../widgets/buttons/basic-button-view-controller';
|
|
9
|
-
import { simulateClick } from '../../../lib/dom/simulate-mouse-event';
|
|
10
|
-
import waitFor from '../../../lib/wait-for';
|
|
11
|
-
class GmailAttachmentCardView {
|
|
12
|
-
_element;
|
|
13
|
-
_driver;
|
|
14
|
-
_messageViewDriver;
|
|
15
|
-
_cachedType;
|
|
16
|
-
_stopper = kefirStopper();
|
|
17
|
-
_previewClicks = Kefir.pool();
|
|
18
|
-
constructor(options, driver, messageViewDriver) {
|
|
19
|
-
this._driver = driver;
|
|
20
|
-
this._messageViewDriver = messageViewDriver;
|
|
21
|
-
if (options.element) {
|
|
22
|
-
this._element = options.element;
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
this._createNewElement(options);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
destroy() {
|
|
29
|
-
this._stopper.destroy();
|
|
30
|
-
}
|
|
31
|
-
getElement() {
|
|
32
|
-
return this._element;
|
|
33
|
-
}
|
|
34
|
-
getMessageViewDriver() {
|
|
35
|
-
return this._messageViewDriver;
|
|
36
|
-
}
|
|
37
|
-
getStopper() {
|
|
38
|
-
return this._stopper;
|
|
39
|
-
}
|
|
40
|
-
getPreviewClicks() {
|
|
41
|
-
return this._previewClicks.takeUntilBy(this._stopper);
|
|
42
|
-
}
|
|
43
|
-
_isStandardAttachment() {
|
|
44
|
-
return this.getAttachmentType() === 'FILE';
|
|
45
|
-
}
|
|
46
|
-
getAttachmentType() {
|
|
47
|
-
if (this._cachedType) {
|
|
48
|
-
return this._cachedType;
|
|
49
|
-
}
|
|
50
|
-
const type = this._readAttachmentType();
|
|
51
|
-
if (type !== 'UNLOADED') {
|
|
52
|
-
this._cachedType = type;
|
|
53
|
-
}
|
|
54
|
-
return type;
|
|
55
|
-
}
|
|
56
|
-
_readAttachmentType() {
|
|
57
|
-
if (this._element.classList.contains('inboxsdk__attachmentCard')) {
|
|
58
|
-
return 'CUSTOM';
|
|
59
|
-
}
|
|
60
|
-
// FILE attachment cards are never in unloaded state.
|
|
61
|
-
if (this._element.children.length === 1 &&
|
|
62
|
-
this._element.children[0].children.length === 0) {
|
|
63
|
-
return 'UNLOADED';
|
|
64
|
-
}
|
|
65
|
-
const link = this._getDownloadLink();
|
|
66
|
-
if (!link || link.match(/^https?:\/\/mail\.google\.com\//)) {
|
|
67
|
-
// Only files and unloaded ever lack a link.
|
|
68
|
-
return 'FILE';
|
|
69
|
-
}
|
|
70
|
-
if (link.match(/^https?:\/\/([^/]*\.)?google(usercontent)?\.com\//)) {
|
|
71
|
-
return 'DRIVE';
|
|
72
|
-
}
|
|
73
|
-
return 'UNKNOWN';
|
|
74
|
-
}
|
|
75
|
-
addButton(options) {
|
|
76
|
-
var buttonView = new ButtonView({
|
|
77
|
-
iconUrl: options.iconUrl,
|
|
78
|
-
tooltip: options.tooltip,
|
|
79
|
-
});
|
|
80
|
-
this._addButton(buttonView);
|
|
81
|
-
}
|
|
82
|
-
getTitle() {
|
|
83
|
-
const title = this._element.querySelector('span .aV3');
|
|
84
|
-
return title ? title.textContent : '';
|
|
85
|
-
}
|
|
86
|
-
_getDownloadLink() {
|
|
87
|
-
const firstChild = this._element
|
|
88
|
-
.firstElementChild;
|
|
89
|
-
if (!firstChild)
|
|
90
|
-
throw new Error('Failed to find link');
|
|
91
|
-
if (firstChild.tagName !== 'A' || !firstChild.href) {
|
|
92
|
-
const download_url = this._element.getAttribute('download_url');
|
|
93
|
-
if (download_url) {
|
|
94
|
-
const m = /:(https:\/\/[^:]+)/.exec(download_url);
|
|
95
|
-
return m ? m[1] : null;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
const firstChildHref = firstChild.href;
|
|
100
|
-
if (firstChildHref) {
|
|
101
|
-
return firstChildHref.replace(/([?&])disp=inline(?=&|$)/, '$1disp=safe');
|
|
102
|
-
}
|
|
103
|
-
return firstChildHref;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
// Resolves the short-lived cookie-less download URL
|
|
107
|
-
async getDownloadURL() {
|
|
108
|
-
try {
|
|
109
|
-
if (this._isStandardAttachment()) {
|
|
110
|
-
const downloadUrl = await waitFor(() => this._getDownloadLink());
|
|
111
|
-
if (!downloadUrl)
|
|
112
|
-
return null;
|
|
113
|
-
const finalUrl = await this._driver.resolveUrlRedirects(downloadUrl);
|
|
114
|
-
if (!/^https:\/\/mail-attachment\.googleusercontent\.com\/attachment\//.test(finalUrl)) {
|
|
115
|
-
console.error('getDownloadURL returned unexpected url', finalUrl);
|
|
116
|
-
const err = new Error('getDownloadURL returned unexpected url');
|
|
117
|
-
this._driver.getLogger().error(err, {
|
|
118
|
-
finalUrlCensored: finalUrl.replace(/\?[^/]+$/, '?[...]'),
|
|
119
|
-
});
|
|
120
|
-
if (/^https:\/\/mail\.google\.com\//.test(finalUrl)) {
|
|
121
|
-
// This URL definitely isn't right: these URLs generally require
|
|
122
|
-
// authentication and shouldn't be returned by getDownloadURL.
|
|
123
|
-
throw err;
|
|
124
|
-
} // Otherwise, don't throw; only log. Maybe Gmail has changed the URL
|
|
125
|
-
// structure and things will just work.
|
|
126
|
-
}
|
|
127
|
-
return finalUrl;
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
const downloadButton = this._element.querySelector('[data-inboxsdk-download-url]');
|
|
131
|
-
return downloadButton
|
|
132
|
-
? downloadButton.getAttribute('data-inboxsdk-download-url')
|
|
133
|
-
: null;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
catch (err) {
|
|
137
|
-
this._driver.getLogger().error(err);
|
|
138
|
-
throw err;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
_extractFileNameFromElement() {
|
|
142
|
-
return querySelector(this._element, '.aQA > span').textContent;
|
|
143
|
-
}
|
|
144
|
-
_createNewElement(options) {
|
|
145
|
-
this._element = document.createElement('span');
|
|
146
|
-
this._element.classList.add('aZo');
|
|
147
|
-
this._element.classList.add('inboxsdk__attachmentCard');
|
|
148
|
-
var htmlArray = [
|
|
149
|
-
autoHtml `
|
|
150
|
-
<a target="_blank" role="link" class="aQy e" href="">
|
|
151
|
-
<div aria-hidden="true">
|
|
152
|
-
<div class="aSG"></div>
|
|
153
|
-
<div class="aVY aZn">
|
|
154
|
-
<div class="aZm"></div>
|
|
155
|
-
</div>
|
|
156
|
-
<div class="aSH">`,
|
|
157
|
-
];
|
|
158
|
-
if (options.iconThumbnailUrl) {
|
|
159
|
-
htmlArray = htmlArray.concat([
|
|
160
|
-
autoHtml `
|
|
161
|
-
<div class="aYv">
|
|
162
|
-
<img class="aZG aYw" src="${options.iconThumbnailUrl}">
|
|
163
|
-
</div>`,
|
|
164
|
-
]);
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
htmlArray = htmlArray.concat([
|
|
168
|
-
autoHtml `
|
|
169
|
-
<img class="aQG aYB inboxsdk__attachmentCard_previewThumbnailUrl"
|
|
170
|
-
src="${options.previewThumbnailUrl}">`,
|
|
171
|
-
]);
|
|
172
|
-
}
|
|
173
|
-
htmlArray = htmlArray.concat([
|
|
174
|
-
autoHtml `
|
|
175
|
-
<div class="aYy">
|
|
176
|
-
<div class="aYA">
|
|
177
|
-
<img class="aSM" src="${options.fileIconImageUrl}">
|
|
178
|
-
</div>
|
|
179
|
-
<div class="aYz">
|
|
180
|
-
<div class="a12">
|
|
181
|
-
<div class="aQA">
|
|
182
|
-
<span class="aV3 a6U"></span>
|
|
183
|
-
</div>
|
|
184
|
-
<div class="aYp">
|
|
185
|
-
<span class="SaH2Ve"></span>
|
|
186
|
-
</div>
|
|
187
|
-
</div>
|
|
188
|
-
</div>
|
|
189
|
-
</div>
|
|
190
|
-
</div>
|
|
191
|
-
<div class="aSI">
|
|
192
|
-
<div class="aSJ"></div>
|
|
193
|
-
</div>
|
|
194
|
-
</div>
|
|
195
|
-
</a>
|
|
196
|
-
<div class="aQw"></div>`,
|
|
197
|
-
]);
|
|
198
|
-
this._element.innerHTML = htmlArray.join('');
|
|
199
|
-
this._element.children[0].href = options.previewUrl;
|
|
200
|
-
if (options.mimeType && options.mimeType.split('/')[0] === 'image') {
|
|
201
|
-
this._element.children[0].classList.add('aZI');
|
|
202
|
-
}
|
|
203
|
-
querySelector(this._element, 'span .aV3').textContent = options.title;
|
|
204
|
-
querySelector(this._element, 'div.aYp > span').textContent =
|
|
205
|
-
options.description || '';
|
|
206
|
-
querySelector(this._element, 'div.aSJ').style.borderColor =
|
|
207
|
-
options.foldColor;
|
|
208
|
-
this._addHoverEvents();
|
|
209
|
-
if (options.buttons) {
|
|
210
|
-
const downloadButton = find(options.buttons, function (button) {
|
|
211
|
-
return button.downloadUrl;
|
|
212
|
-
});
|
|
213
|
-
if (downloadButton) {
|
|
214
|
-
this._addDownloadButton(downloadButton);
|
|
215
|
-
}
|
|
216
|
-
this._addMoreButtons(options.buttons);
|
|
217
|
-
}
|
|
218
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
219
|
-
var self = this;
|
|
220
|
-
this._previewClicks.plug(Kefir.fromEvents(this._element, 'click').map((event) => ({
|
|
221
|
-
preventDefault: () => event.preventDefault(),
|
|
222
|
-
})));
|
|
223
|
-
if (options.previewThumbnailUrl && options.failoverPreviewIconUrl) {
|
|
224
|
-
const previewThumbnailUrlImage = querySelector(this._element, '.inboxsdk__attachmentCard_previewThumbnailUrl');
|
|
225
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
226
|
-
previewThumbnailUrlImage.onerror = (e) => {
|
|
227
|
-
var iconDiv = document.createElement('div');
|
|
228
|
-
iconDiv.classList.add('aYv');
|
|
229
|
-
iconDiv.innerHTML =
|
|
230
|
-
'<img class="aZG aYw" src="' + options.failoverPreviewIconUrl + '">';
|
|
231
|
-
const parent = previewThumbnailUrlImage.parentElement;
|
|
232
|
-
if (!parent)
|
|
233
|
-
throw new Error('Could not find parent element');
|
|
234
|
-
parent.insertBefore(iconDiv, previewThumbnailUrlImage.nextElementSibling);
|
|
235
|
-
previewThumbnailUrlImage.remove();
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
_addHoverEvents() {
|
|
240
|
-
Kefir.merge([
|
|
241
|
-
Kefir.fromEvents(this._element, 'mouseenter'),
|
|
242
|
-
fromEventTargetCapture(this._element, 'focus'),
|
|
243
|
-
]).onValue(() => {
|
|
244
|
-
this._element.classList.add('aZp');
|
|
245
|
-
});
|
|
246
|
-
Kefir.merge([
|
|
247
|
-
Kefir.fromEvents(this._element, 'mouseleave'),
|
|
248
|
-
fromEventTargetCapture(this._element, 'blur'),
|
|
249
|
-
]).onValue(() => {
|
|
250
|
-
this._element.classList.remove('aZp');
|
|
251
|
-
});
|
|
252
|
-
const anchor = querySelector(this._element, 'a');
|
|
253
|
-
Kefir.fromEvents(anchor, 'focus').onValue(() => {
|
|
254
|
-
anchor.classList.add('a1U');
|
|
255
|
-
});
|
|
256
|
-
Kefir.fromEvents(anchor, 'blur').onValue(() => {
|
|
257
|
-
anchor.classList.remove('a1U');
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
_addDownloadButton(options) {
|
|
261
|
-
const buttonView = new ButtonView({
|
|
262
|
-
tooltip: 'Download',
|
|
263
|
-
iconClass: 'aSK J-J5-Ji aYr',
|
|
264
|
-
});
|
|
265
|
-
buttonView
|
|
266
|
-
.getElement()
|
|
267
|
-
.setAttribute('data-inboxsdk-download-url', options.downloadUrl);
|
|
268
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
269
|
-
const basicButtonViewController = new BasicButtonViewController({
|
|
270
|
-
activateFunction: function () {
|
|
271
|
-
let prevented = false;
|
|
272
|
-
if (options.onClick) {
|
|
273
|
-
options.onClick({
|
|
274
|
-
preventDefault: function () {
|
|
275
|
-
prevented = true;
|
|
276
|
-
},
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
if (prevented) {
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
const downloadLink = document.createElement('a');
|
|
283
|
-
downloadLink.href = options.downloadUrl;
|
|
284
|
-
if (options.downloadFilename) {
|
|
285
|
-
downloadLink.download = options.downloadFilename;
|
|
286
|
-
}
|
|
287
|
-
downloadLink.addEventListener('click', function (e) {
|
|
288
|
-
e.stopPropagation();
|
|
289
|
-
}, true);
|
|
290
|
-
if (options.openInNewTab) {
|
|
291
|
-
downloadLink.setAttribute('target', '_blank');
|
|
292
|
-
}
|
|
293
|
-
document.body.appendChild(downloadLink);
|
|
294
|
-
simulateClick(downloadLink);
|
|
295
|
-
downloadLink.remove();
|
|
296
|
-
},
|
|
297
|
-
buttonView: buttonView,
|
|
298
|
-
});
|
|
299
|
-
this._addButton(buttonView);
|
|
300
|
-
}
|
|
301
|
-
_addMoreButtons(buttonDescriptors) {
|
|
302
|
-
(buttonDescriptors || [])
|
|
303
|
-
.filter(function (buttonDescriptor) {
|
|
304
|
-
return !buttonDescriptor.downloadUrl;
|
|
305
|
-
})
|
|
306
|
-
.forEach((desc) => {
|
|
307
|
-
this.addButton(desc);
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
_addButton(buttonView) {
|
|
311
|
-
buttonView.addClass('aQv');
|
|
312
|
-
this._getButtonContainerElement().appendChild(buttonView.getElement());
|
|
313
|
-
}
|
|
314
|
-
_getPreviewImageUrl() {
|
|
315
|
-
var previewImage = this._getPreviewImage();
|
|
316
|
-
if (!previewImage) {
|
|
317
|
-
return null;
|
|
318
|
-
}
|
|
319
|
-
return previewImage.src;
|
|
320
|
-
}
|
|
321
|
-
_getPreviewImage() {
|
|
322
|
-
return this._element.querySelector('img.aQG');
|
|
323
|
-
}
|
|
324
|
-
_getButtonContainerElement() {
|
|
325
|
-
return querySelector(this._element, '.aQw');
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
export default GmailAttachmentCardView;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import kefirStopper from 'kefir-stopper';
|
|
2
|
-
class GmailBackdrop {
|
|
3
|
-
_stopper = kefirStopper();
|
|
4
|
-
constructor(zIndex = 500, target = document.body) {
|
|
5
|
-
const el = document.createElement('div');
|
|
6
|
-
el.className = 'Kj-JD-Jh inboxsdk__modal_overlay';
|
|
7
|
-
el.style.zIndex = String(zIndex);
|
|
8
|
-
if (!target)
|
|
9
|
-
throw new Error('no target');
|
|
10
|
-
target.appendChild(el);
|
|
11
|
-
this._stopper.onValue(() => {
|
|
12
|
-
el.remove();
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
getStopper() {
|
|
16
|
-
return this._stopper;
|
|
17
|
-
}
|
|
18
|
-
destroy() {
|
|
19
|
-
this._stopper.destroy();
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export default GmailBackdrop;
|