@inboxsdk/core 1.1.5 → 1.1.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/background.js +1 -0
- package/inboxsdk.js +31 -36
- package/inboxsdk.js.map +1 -1
- package/package.json +1 -1
- package/pageWorld.js +1 -1
- package/pageWorld.js.map +1 -1
- package/src/inboxsdk-js/header.d.ts +19 -0
- package/src/inboxsdk-js/header.d.ts.map +1 -0
- package/src/inboxsdk-js/header.js +1 -1
- package/src/inboxsdk.d.ts +10 -10
- package/src/injected-js/gmail/constants.d.ts +1 -1
- package/src/injected-js/gmail/constants.d.ts.map +1 -1
- package/src/injected-js/gmail/setup-gmail-interceptor.d.ts +3 -4
- package/src/injected-js/gmail/setup-gmail-interceptor.d.ts.map +1 -0
- package/src/injected-js/gmail/setup-gmail-interceptor.js +896 -896
- package/src/injected-js/gmail/sync-compose-processor-20220909.d.ts +1 -1
- package/src/injected-js/gmail/sync-compose-processor-20220909.d.ts.map +1 -1
- package/src/injected-js/gmail/sync-compose-processor.d.ts +3 -3
- package/src/injected-js/gmail/sync-compose-request-processor.d.ts.map +1 -1
- package/src/injected-js/gmail/sync-compose-request-processor.js +0 -1
- package/src/injected-js/gmail/thread-identifier/click-and-get-popup-url.d.ts +2 -0
- package/src/injected-js/gmail/thread-identifier/click-and-get-popup-url.d.ts.map +1 -0
- package/src/injected-js/gmail/thread-identifier/click-and-get-popup-url.js +66 -78
- package/src/injected-js/gmail/thread-identifier/index.d.ts +3 -0
- package/src/injected-js/gmail/thread-identifier/index.d.ts.map +1 -0
- package/src/injected-js/gmail/thread-identifier/index.js +100 -98
- package/src/injected-js/gmail/thread-identifier/thread-row-parser.d.ts +7 -0
- package/src/injected-js/gmail/thread-identifier/thread-row-parser.d.ts.map +1 -0
- package/src/injected-js/gmail/thread-identifier/thread-row-parser.js +51 -61
- package/src/injected-js/main.d.ts +2 -0
- package/src/injected-js/main.d.ts.map +1 -0
- package/src/injected-js/main.js +44 -43
- package/src/injected-js/message-metadata-holder.d.ts +7 -0
- package/src/injected-js/message-metadata-holder.d.ts.map +1 -0
- package/src/injected-js/message-metadata-holder.js +89 -97
- package/src/injected-js/setup-data-exposer.d.ts +2 -0
- package/src/injected-js/setup-data-exposer.d.ts.map +1 -0
- package/src/injected-js/setup-data-exposer.js +126 -118
- package/src/injected-js/setup-error-silencer.d.ts +2 -0
- package/src/injected-js/setup-error-silencer.d.ts.map +1 -0
- package/src/injected-js/setup-error-silencer.js +16 -24
- package/src/injected-js/setup-event-reemitter.d.ts +2 -0
- package/src/injected-js/setup-event-reemitter.d.ts.map +1 -0
- package/src/injected-js/setup-event-reemitter.js +46 -59
- package/src/injected-js/setupInboxCustomViewLinkFixer.d.ts +2 -0
- package/src/injected-js/setupInboxCustomViewLinkFixer.d.ts.map +1 -0
- package/src/injected-js/setupInboxCustomViewLinkFixer.js +24 -26
- package/src/injected-js/setupPushStateListener.d.ts +2 -0
- package/src/injected-js/setupPushStateListener.d.ts.map +1 -0
- package/src/injected-js/setupPushStateListener.js +14 -23
- package/src/injected-js/xhr-helper.d.ts +2 -0
- package/src/injected-js/xhr-helper.d.ts.map +1 -0
- package/src/injected-js/xhr-helper.js +73 -83
- package/src/injected-js/xhr-proxy-factory.d.ts +97 -0
- package/src/injected-js/xhr-proxy-factory.d.ts.map +1 -0
- package/src/injected-js/xhr-proxy-factory.js +503 -451
- package/src/platform-implementation-js/constants/router.d.ts +37 -5
- package/src/platform-implementation-js/constants/router.d.ts.map +1 -0
- package/src/platform-implementation-js/constants/router.js +57 -60
- package/src/platform-implementation-js/constants/toolbars.d.ts +2 -0
- package/src/platform-implementation-js/constants/toolbars.d.ts.map +1 -0
- package/src/platform-implementation-js/constants/toolbars.js +4 -11
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-toolbar-button-for-app.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-toolbar-button-for-app.js +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-url-object.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-url-object.js +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadForOldGmailThreadId.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadForOldGmailThreadId.js +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadFromSyncThreadId.d.ts +4 -6
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadFromSyncThreadId.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadFromSyncThreadId.js +55 -62
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/gmail-load-event.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/gmail-load-event.js +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/goto-view.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/goto-view.js +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-route-view-driver-stream.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-route-view-driver-stream.js +4 -5
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/thread-row-identifier.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/thread-row-identifier.js +4 -9
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-events.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-events.js +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/user-info.d.ts +2 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/user-info.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/user-info.js +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.d.ts +4 -3
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/make-xhr-interceptor.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/make-xhr-interceptor.js +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.d.ts +19 -6
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.js +75 -80
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-companion-global-icon-area.d.ts +5 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-companion-global-icon-area.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-companion-global-icon-area.js +13 -22
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-companion-thread-icon-area.d.ts +5 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-companion-thread-icon-area.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-companion-thread-icon-area.js +18 -26
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-to-icon-area.d.ts +5 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-to-icon-area.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-to-icon-area.js +13 -30
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/index.d.ts +44 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/index.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/index.js +681 -601
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view/monitor-top-banner-size-and-react.d.ts +2 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view/monitor-top-banner-size-and-react.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view/monitor-top-banner-size-and-react.js +23 -24
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view.d.ts +19 -3
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view.js +156 -150
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-area-view.d.ts +20 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-area-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-area-view.js +101 -96
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-card-view.d.ts +40 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-card-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-card-view.js +287 -265
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-collapsible-section-view.d.ts +61 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-collapsible-section-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-collapsible-section-view.js +689 -524
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-button.d.ts +5 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-button.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-button.js +124 -118
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-compose-notice.d.ts +15 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-compose-notice.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-compose-notice.js +47 -51
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-inner-sidebar.d.ts +8 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-inner-sidebar.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-inner-sidebar.js +8 -16
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-outer-sidebar.d.ts +8 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-outer-sidebar.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-outer-sidebar.js +23 -31
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-recipient-row.d.ts +4 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-recipient-row.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-recipient-row.js +61 -66
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-tooltip-to-button.d.ts +6 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-tooltip-to-button.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-tooltip-to-button.js +64 -48
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/ensure-app-button-toolbars-are-closed.d.ts +2 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/ensure-app-button-toolbars-are-closed.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/ensure-app-button-toolbars-are-closed.js +10 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/ensure-grouping-is-open.d.ts +2 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/ensure-grouping-is-open.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/ensure-grouping-is-open.js +14 -23
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/focus.d.ts +3 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/focus.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/focus.js +13 -16
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/from-manager.d.ts +7 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/from-manager.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/from-manager.js +57 -59
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-additional-action-toolbar.d.ts +3 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-additional-action-toolbar.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-additional-action-toolbar.js +49 -49
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-address-changes-stream.d.ts +4 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-address-changes-stream.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-address-changes-stream.js +89 -89
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-address-information-extractor.d.ts +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-address-information-extractor.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-body-changes-stream.d.ts +4 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-body-changes-stream.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-body-changes-stream.js +13 -21
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-formatting-area-offset-left.d.ts +3 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-formatting-area-offset-left.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-formatting-area-offset-left.js +16 -23
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-minimized-stream.d.ts +4 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-minimized-stream.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-minimized-stream.js +14 -22
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-recipients.d.ts +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-recipients.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-response-type-changes-stream.d.ts +4 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-response-type-changes-stream.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-response-type-changes-stream.js +23 -29
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/insert-link-into-body.d.ts +3 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/insert-link-into-body.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/insert-link-into-body.js +17 -25
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/manage-button-grouping.d.ts +4 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/manage-button-grouping.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/manage-button-grouping.js +317 -252
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/monitor-selection-range.d.ts +3 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/monitor-selection-range.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/monitor-selection-range.js +22 -18
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/override-edit-subject.d.ts +4 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/override-edit-subject.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/override-edit-subject.js +57 -50
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/position-formatting-toolbar.d.ts +3 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/position-formatting-toolbar.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/position-formatting-toolbar.js +18 -20
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/size-fixer.d.ts +3 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/size-fixer.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/size-fixer.js +114 -113
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/update-insert-more-area-left.d.ts +3 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/update-insert-more-area-left.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/update-insert-more-area-left.js +15 -18
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view.d.ts +189 -118
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view.js +1480 -1333
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view/attachment-icon.d.ts +1 -2
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view/attachment-icon.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view/attachment-icon.js +1 -2
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view/get-updated-contact.d.ts +3 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view/get-updated-contact.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view/get-updated-contact.js +69 -70
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view.d.ts +67 -6
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view.js +715 -637
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-processor.d.ts +44 -6
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-processor.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-processor.js +100 -101
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-view.d.ts +72 -3
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-view.js +502 -438
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-row-list-view.d.ts +39 -8
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-row-list-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-row-list-view.js +229 -211
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-row-view.d.ts +117 -5
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-row-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-row-view.js +938 -821
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view/add-icon-area.d.ts +5 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view/add-icon-area.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view/add-icon-area.js +66 -61
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.d.ts +18 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.js +520 -457
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view/width-manager.d.ts +7 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view/width-manager.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view/width-manager.js +24 -27
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view.d.ts +69 -7
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view.js +646 -523
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-toolbar-view.d.ts +58 -11
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-toolbar-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-toolbar-view.js +436 -383
- package/src/platform-implementation-js/dom-driver/gmail/views/native-gmail-nav-item-view.d.ts +35 -7
- package/src/platform-implementation-js/dom-driver/gmail/views/native-gmail-nav-item-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/native-gmail-nav-item-view.js +265 -235
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-accessory-button-view.d.ts +2 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-accessory-button-view.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-accessory-button-view.js +4 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-parent-accessory-button-view.d.ts +2 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-parent-accessory-button-view.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/create-parent-accessory-button-view.js +4 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/inbox-dropdown-button-view.d.ts +7 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/inbox-dropdown-button-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/inbox-dropdown-button-view.js +22 -30
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/modal-button-view.d.ts +4 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/modal-button-view.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/modal-button-view.js +6 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-action-button-view.d.ts +11 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-action-button-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-action-button-view.js +35 -41
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-label-view.d.ts +18 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-label-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-label-view.js +96 -97
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-mole-view-driver.d.ts +18 -15
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-mole-view-driver.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-mole-view-driver.js +170 -170
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-tooltip-view.d.ts +47 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-tooltip-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-tooltip-view.js +325 -279
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-backdrop.d.ts +16 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-backdrop.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-backdrop.js +56 -61
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-drawer-view.d.ts +31 -3
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-drawer-view.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-drawer-view.js +275 -252
- package/src/platform-implementation-js/driver-common/compose/getDiscardStream.d.ts +6 -0
- package/src/platform-implementation-js/driver-common/compose/getDiscardStream.d.ts.map +1 -0
- package/src/platform-implementation-js/driver-common/compose/getDiscardStream.js +27 -32
- package/src/platform-implementation-js/driver-common/compose/getPresendingStream.d.ts +7 -0
- package/src/platform-implementation-js/driver-common/compose/getPresendingStream.d.ts.map +1 -0
- package/src/platform-implementation-js/driver-common/compose/getPresendingStream.js +45 -43
- package/src/platform-implementation-js/driver-common/getGmailMessageIdForSyncMessageId.d.ts +5 -6
- package/src/platform-implementation-js/driver-common/getGmailMessageIdForSyncMessageId.d.ts.map +1 -0
- package/src/platform-implementation-js/driver-common/getGmailMessageIdForSyncMessageId.js +11 -19
- package/src/platform-implementation-js/driver-common/getGmailThreadIdForRfcMessageId.d.ts +5 -6
- package/src/platform-implementation-js/driver-common/getGmailThreadIdForRfcMessageId.d.ts.map +1 -0
- package/src/platform-implementation-js/driver-common/getGmailThreadIdForRfcMessageId.js +39 -48
- package/src/platform-implementation-js/driver-common/getRfcMessageIdForSyncMessageId.d.ts +5 -0
- package/src/platform-implementation-js/driver-common/getRfcMessageIdForSyncMessageId.d.ts.map +1 -0
- package/src/platform-implementation-js/driver-common/getRfcMessageIdForSyncMessageId.js +12 -20
- package/src/platform-implementation-js/driver-common/getThreadIdFromMessageId.d.ts +5 -0
- package/src/platform-implementation-js/driver-common/getThreadIdFromMessageId.d.ts.map +1 -0
- package/src/platform-implementation-js/driver-common/getThreadIdFromMessageId.js +11 -19
- package/src/platform-implementation-js/driver-common/inboxAjax.d.ts +4 -0
- package/src/platform-implementation-js/driver-common/inboxAjax.d.ts.map +1 -0
- package/src/platform-implementation-js/driver-common/inboxAjax.js +5 -13
- package/src/platform-implementation-js/driver-common/requestGmailThread.d.ts +4 -0
- package/src/platform-implementation-js/driver-common/requestGmailThread.d.ts.map +1 -0
- package/src/platform-implementation-js/driver-common/requestGmailThread.js +22 -32
- package/src/platform-implementation-js/driver-common/sidebar/AppSidebar.d.ts +50 -0
- package/src/platform-implementation-js/driver-common/sidebar/AppSidebar.d.ts.map +1 -0
- package/src/platform-implementation-js/driver-common/sidebar/AppSidebar.js +228 -279
- package/src/platform-implementation-js/driver-common/sidebar/ContentPanelViewDriver.d.ts +25 -1
- package/src/platform-implementation-js/driver-common/sidebar/ContentPanelViewDriver.d.ts.map +1 -0
- package/src/platform-implementation-js/driver-common/sidebar/ContentPanelViewDriver.js +142 -147
- package/src/platform-implementation-js/driver-interfaces/compose-view-driver.d.ts +106 -133
- package/src/platform-implementation-js/driver-interfaces/compose-view-driver.d.ts.map +1 -0
- package/src/platform-implementation-js/driver-interfaces/compose-view-driver.js +1 -1
- package/src/platform-implementation-js/driver-interfaces/driver.d.ts +31 -139
- package/src/platform-implementation-js/driver-interfaces/driver.d.ts.map +1 -0
- package/src/platform-implementation-js/driver-interfaces/driver.js +1 -1
- package/src/platform-implementation-js/driver-interfaces/message-view-driver.d.ts +44 -0
- package/src/platform-implementation-js/driver-interfaces/message-view-driver.d.ts.map +1 -0
- package/src/platform-implementation-js/driver-interfaces/message-view-driver.js +1 -5
- package/src/platform-implementation-js/driver-interfaces/mole-view-driver.d.ts +18 -20
- package/src/platform-implementation-js/driver-interfaces/mole-view-driver.d.ts.map +1 -0
- package/src/platform-implementation-js/driver-interfaces/mole-view-driver.js +1 -1
- package/src/platform-implementation-js/driver-interfaces/route-view-driver.d.ts +19 -0
- package/src/platform-implementation-js/driver-interfaces/route-view-driver.d.ts.map +1 -0
- package/src/platform-implementation-js/driver-interfaces/route-view-driver.js +1 -1
- package/src/platform-implementation-js/driver-interfaces/thread-row-view-driver.d.ts +11 -0
- package/src/platform-implementation-js/driver-interfaces/thread-row-view-driver.d.ts.map +1 -0
- package/src/platform-implementation-js/driver-interfaces/thread-row-view-driver.js +1 -1
- package/src/platform-implementation-js/lib/css-selector-escape.d.ts +2 -0
- package/src/platform-implementation-js/lib/css-selector-escape.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/css-selector-escape.js +6 -12
- package/src/platform-implementation-js/lib/delay-asap.d.ts +1 -1
- package/src/platform-implementation-js/lib/delay-asap.d.ts.map +1 -1
- package/src/platform-implementation-js/lib/delay-asap.js +0 -2
- package/src/platform-implementation-js/lib/dom/get-selection.d.ts +3 -0
- package/src/platform-implementation-js/lib/dom/get-selection.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/dom/get-selection.js +22 -24
- package/src/platform-implementation-js/lib/dom/insert-html-at-cursor.d.ts +3 -0
- package/src/platform-implementation-js/lib/dom/insert-html-at-cursor.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/dom/insert-html-at-cursor.js +78 -75
- package/src/platform-implementation-js/lib/dom/is-node-in-range.d.ts +2 -0
- package/src/platform-implementation-js/lib/dom/is-node-in-range.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/dom/is-node-in-range.js +12 -17
- package/src/platform-implementation-js/lib/dom/make-element-stream-merger.d.ts.map +1 -1
- package/src/platform-implementation-js/lib/dom/set-css.d.ts +2 -0
- package/src/platform-implementation-js/lib/dom/set-css.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/dom/set-css.js +18 -23
- package/src/platform-implementation-js/lib/dom/set-value-and-dispatch-event.d.ts +2 -0
- package/src/platform-implementation-js/lib/dom/set-value-and-dispatch-event.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/dom/set-value-and-dispatch-event.js +6 -12
- package/src/platform-implementation-js/lib/dom/simulate-drag-and-drop.d.ts +4 -0
- package/src/platform-implementation-js/lib/dom/simulate-drag-and-drop.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/dom/simulate-drag-and-drop.js +84 -93
- package/src/platform-implementation-js/lib/extract-contact-from-email-contact-string.d.ts +1 -1
- package/src/platform-implementation-js/lib/extract-contact-from-email-contact-string.d.ts.map +1 -1
- package/src/platform-implementation-js/lib/handle-compose-link-chips.d.ts +4 -0
- package/src/platform-implementation-js/lib/handle-compose-link-chips.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/handle-compose-link-chips.js +106 -97
- package/src/platform-implementation-js/lib/inject-script-EMBEDDED.d.ts.map +1 -1
- package/src/platform-implementation-js/lib/inject-script-EMBEDDED.js +1 -1
- package/src/platform-implementation-js/lib/insert-link-chip-into-body.d.ts +4 -0
- package/src/platform-implementation-js/lib/insert-link-chip-into-body.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/insert-link-chip-into-body.js +32 -39
- package/src/platform-implementation-js/lib/logger.d.ts +1 -0
- package/src/platform-implementation-js/lib/logger.d.ts.map +1 -1
- package/src/platform-implementation-js/lib/parseParamsFromRouteID.d.ts +2 -0
- package/src/platform-implementation-js/lib/parseParamsFromRouteID.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/parseParamsFromRouteID.js +12 -18
- package/src/platform-implementation-js/lib/populateRouteID.d.ts +2 -5
- package/src/platform-implementation-js/lib/populateRouteID.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/populateRouteID.js +16 -21
- package/src/platform-implementation-js/lib/react/ElementContainer.d.ts +15 -0
- package/src/platform-implementation-js/lib/react/ElementContainer.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/react/ElementContainer.js +24 -36
- package/src/platform-implementation-js/lib/routeIDmatchesHash.d.ts +2 -4
- package/src/platform-implementation-js/lib/routeIDmatchesHash.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/routeIDmatchesHash.js +8 -15
- package/src/platform-implementation-js/lib/toItemWithLifetimeStream.d.ts +2 -4
- package/src/platform-implementation-js/lib/toItemWithLifetimeStream.d.ts.map +1 -0
- package/src/platform-implementation-js/lib/toItemWithLifetimeStream.js +12 -19
- package/src/platform-implementation-js/main-INTEGRATED-PAGEWORLD.js +1 -1
- package/src/platform-implementation-js/main.d.ts.map +1 -1
- package/src/platform-implementation-js/main.js +1 -4
- package/src/platform-implementation-js/namespaces/compose.d.ts +13 -0
- package/src/platform-implementation-js/namespaces/compose.d.ts.map +1 -0
- package/src/platform-implementation-js/namespaces/compose.js +56 -61
- package/src/platform-implementation-js/namespaces/conversations.d.ts +24 -0
- package/src/platform-implementation-js/namespaces/conversations.d.ts.map +1 -0
- package/src/platform-implementation-js/namespaces/conversations.js +79 -78
- package/src/platform-implementation-js/namespaces/global.d.ts +11 -0
- package/src/platform-implementation-js/namespaces/global.d.ts.map +1 -0
- package/src/platform-implementation-js/namespaces/global.js +28 -36
- package/src/platform-implementation-js/namespaces/keyboard.d.ts +11 -0
- package/src/platform-implementation-js/namespaces/keyboard.d.ts.map +1 -0
- package/src/platform-implementation-js/namespaces/keyboard.js +27 -40
- package/src/platform-implementation-js/namespaces/lists.d.ts +14 -0
- package/src/platform-implementation-js/namespaces/lists.d.ts.map +1 -0
- package/src/platform-implementation-js/namespaces/lists.js +38 -50
- package/src/platform-implementation-js/namespaces/modal.d.ts +10 -0
- package/src/platform-implementation-js/namespaces/modal.d.ts.map +1 -0
- package/src/platform-implementation-js/namespaces/modal.js +40 -48
- package/src/platform-implementation-js/namespaces/nav-menu.d.ts +16 -0
- package/src/platform-implementation-js/namespaces/nav-menu.d.ts.map +1 -0
- package/src/platform-implementation-js/namespaces/nav-menu.js +29 -36
- package/src/platform-implementation-js/namespaces/router.d.ts +50 -1
- package/src/platform-implementation-js/namespaces/router.d.ts.map +1 -0
- package/src/platform-implementation-js/namespaces/router.js +126 -137
- package/src/platform-implementation-js/namespaces/search.d.ts +7 -0
- package/src/platform-implementation-js/namespaces/search.d.ts.map +1 -0
- package/src/platform-implementation-js/namespaces/search.js +25 -34
- package/src/platform-implementation-js/namespaces/toolbars.d.ts +15 -0
- package/src/platform-implementation-js/namespaces/toolbars.d.ts.map +1 -0
- package/src/platform-implementation-js/namespaces/toolbars.js +138 -140
- package/src/platform-implementation-js/namespaces/user.d.ts +13 -0
- package/src/platform-implementation-js/namespaces/user.d.ts.map +1 -0
- package/src/platform-implementation-js/namespaces/user.js +53 -62
- package/src/platform-implementation-js/namespaces/widgets.d.ts +16 -0
- package/src/platform-implementation-js/namespaces/widgets.d.ts.map +1 -0
- package/src/platform-implementation-js/namespaces/widgets.js +68 -77
- package/src/platform-implementation-js/platform-implementation.d.ts +54 -126
- package/src/platform-implementation-js/platform-implementation.d.ts.map +1 -0
- package/src/platform-implementation-js/platform-implementation.js +176 -147
- package/src/platform-implementation-js/views/app-toolbar-button-view.d.ts +11 -0
- package/src/platform-implementation-js/views/app-toolbar-button-view.d.ts.map +1 -0
- package/src/platform-implementation-js/views/app-toolbar-button-view.js +42 -51
- package/src/platform-implementation-js/views/collapsible-section-view.d.ts +12 -0
- package/src/platform-implementation-js/views/collapsible-section-view.d.ts.map +1 -0
- package/src/platform-implementation-js/views/collapsible-section-view.js +58 -86
- package/src/platform-implementation-js/views/compose-view.d.ts +2 -1
- package/src/platform-implementation-js/views/compose-view.d.ts.map +1 -1
- package/src/platform-implementation-js/views/content-panel-view.d.ts +12 -0
- package/src/platform-implementation-js/views/content-panel-view.d.ts.map +1 -0
- package/src/platform-implementation-js/views/content-panel-view.js +35 -50
- package/src/platform-implementation-js/views/conversations/attachment-card-view.d.ts +18 -0
- package/src/platform-implementation-js/views/conversations/attachment-card-view.d.ts.map +1 -0
- package/src/platform-implementation-js/views/conversations/attachment-card-view.js +39 -44
- package/src/platform-implementation-js/views/conversations/custom-message-view.d.ts +28 -0
- package/src/platform-implementation-js/views/conversations/custom-message-view.d.ts.map +1 -0
- package/src/platform-implementation-js/views/conversations/custom-message-view.js +115 -103
- package/src/platform-implementation-js/views/conversations/message-view.d.ts +34 -0
- package/src/platform-implementation-js/views/conversations/message-view.d.ts.map +1 -0
- package/src/platform-implementation-js/views/conversations/message-view.js +197 -209
- package/src/platform-implementation-js/views/conversations/thread-view.d.ts +23 -0
- package/src/platform-implementation-js/views/conversations/thread-view.d.ts.map +1 -0
- package/src/platform-implementation-js/views/conversations/thread-view.js +93 -100
- package/src/platform-implementation-js/views/native-nav-item-view.d.ts +11 -0
- package/src/platform-implementation-js/views/native-nav-item-view.d.ts.map +1 -0
- package/src/platform-implementation-js/views/native-nav-item-view.js +56 -62
- package/src/platform-implementation-js/views/nav-item-view.d.ts +12 -22
- package/src/platform-implementation-js/views/nav-item-view.d.ts.map +1 -0
- package/src/platform-implementation-js/views/nav-item-view.js +123 -124
- package/src/platform-implementation-js/views/route-view/custom-route-view.d.ts +9 -0
- package/src/platform-implementation-js/views/route-view/custom-route-view.d.ts.map +1 -0
- package/src/platform-implementation-js/views/route-view/custom-route-view.js +24 -36
- package/src/platform-implementation-js/views/route-view/dummy-route-view-driver.d.ts +14 -0
- package/src/platform-implementation-js/views/route-view/dummy-route-view-driver.d.ts.map +1 -0
- package/src/platform-implementation-js/views/route-view/dummy-route-view-driver.js +27 -38
- package/src/platform-implementation-js/views/route-view/list-route-view.d.ts +13 -0
- package/src/platform-implementation-js/views/route-view/list-route-view.d.ts.map +1 -0
- package/src/platform-implementation-js/views/route-view/list-route-view.js +41 -51
- package/src/platform-implementation-js/views/route-view/route-view.d.ts +11 -0
- package/src/platform-implementation-js/views/route-view/route-view.d.ts.map +1 -0
- package/src/platform-implementation-js/views/route-view/route-view.js +41 -51
- package/src/platform-implementation-js/views/section-view.d.ts +11 -0
- package/src/platform-implementation-js/views/section-view.d.ts.map +1 -0
- package/src/platform-implementation-js/views/section-view.js +56 -81
- package/src/platform-implementation-js/views/thread-row-view.d.ts +27 -0
- package/src/platform-implementation-js/views/thread-row-view.d.ts.map +1 -0
- package/src/platform-implementation-js/views/thread-row-view.js +87 -94
- package/src/platform-implementation-js/widgets/buttons/basic-button-view-controller.d.ts +4 -0
- package/src/platform-implementation-js/widgets/buttons/basic-button-view-controller.d.ts.map +1 -1
- package/src/platform-implementation-js/widgets/drawer-view.d.ts +13 -0
- package/src/platform-implementation-js/widgets/drawer-view.d.ts.map +1 -0
- package/src/platform-implementation-js/widgets/drawer-view.js +46 -53
- package/src/platform-implementation-js/widgets/modal-view.d.ts +18 -0
- package/src/platform-implementation-js/widgets/modal-view.d.ts.map +1 -0
- package/src/platform-implementation-js/widgets/modal-view.js +95 -91
- package/src/platform-implementation-js/widgets/mole-view.d.ts +12 -0
- package/src/platform-implementation-js/widgets/mole-view.d.ts.map +1 -0
- package/src/platform-implementation-js/widgets/mole-view.js +37 -46
- package/src/platform-implementation-js/widgets/top-message-bar-view.d.ts +8 -0
- package/src/platform-implementation-js/widgets/top-message-bar-view.d.ts.map +1 -0
- package/src/platform-implementation-js/widgets/top-message-bar-view.js +13 -21
- package/src/injected-js/gmail/modify-suggestions.test.js +0 -20
- package/src/injected-js/gmail/sync-compose-request-processor.test.js +0 -80
- package/src/injected-js/gmail/thread-identifier/thread-row-parser.test.js +0 -41
- package/src/injected-js/xhr-proxy-factory.test.js +0 -1052
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-draft-by-message-id.test.js +0 -22
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.test.js +0 -125
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-card-view.test.js +0 -141
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.test.js +0 -209
- package/src/platform-implementation-js/lib/array-to-lifetimes.js +0 -69
- package/src/platform-implementation-js/lib/array-to-lifetimes.test.js +0 -155
- package/src/platform-implementation-js/lib/dom/querySelectorOne.js +0 -13
- package/src/platform-implementation-js/lib/extract-contact-from-email-contact-string.test.js +0 -39
- package/src/platform-implementation-js/lib/make-revocable-function.js +0 -38
- package/src/platform-implementation-js/lib/make-revocable-function.test.js +0 -61
- package/src/platform-implementation-js/lib/parseParamsFromRouteID.test.js +0 -19
- package/src/platform-implementation-js/lib/populateRouteID.test.js +0 -32
- package/src/platform-implementation-js/lib/routeIDmatchesHash.test.js +0 -17
|
@@ -1,939 +1,939 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var messageMetadataHolder = _interopRequireWildcard(require("../message-metadata-holder"));
|
|
21
|
-
var GmailResponseProcessor = _interopRequireWildcard(require("../../platform-implementation-js/dom-driver/gmail/gmail-response-processor"));
|
|
22
|
-
var GmailSyncResponseProcessor = _interopRequireWildcard(require("../../platform-implementation-js/dom-driver/gmail/gmail-sync-response-processor"));
|
|
23
|
-
var _quotedSplit = _interopRequireDefault(require("../../common/quoted-split"));
|
|
24
|
-
var _defer = _interopRequireDefault(require("../../common/defer"));
|
|
25
|
-
var _modifySuggestions = _interopRequireDefault(require("./modify-suggestions"));
|
|
26
|
-
var _syncComposeProcessor = require("./sync-compose-processor");
|
|
27
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
28
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
import clone from 'lodash/clone';
|
|
3
|
+
import flatten from 'lodash/flatten';
|
|
4
|
+
import find from 'lodash/find';
|
|
5
|
+
import intersection from 'lodash/intersection';
|
|
6
|
+
import includes from 'lodash/includes';
|
|
7
|
+
import BigNumber from 'bignumber.js';
|
|
8
|
+
import Kefir from 'kefir';
|
|
9
|
+
import * as logger from '../injected-logger';
|
|
10
|
+
import XHRProxyFactory from '../xhr-proxy-factory';
|
|
11
|
+
import querystring, { stringify } from 'querystring';
|
|
12
|
+
import * as threadIdentifier from './thread-identifier';
|
|
13
|
+
import * as messageMetadataHolder from '../message-metadata-holder';
|
|
14
|
+
import * as GmailResponseProcessor from '../../platform-implementation-js/dom-driver/gmail/gmail-response-processor';
|
|
15
|
+
import * as GmailSyncResponseProcessor from '../../platform-implementation-js/dom-driver/gmail/gmail-sync-response-processor';
|
|
16
|
+
import quotedSplit from '../../common/quoted-split';
|
|
17
|
+
import defer from '../../common/defer';
|
|
18
|
+
import modifySuggestions from './modify-suggestions';
|
|
19
|
+
import { parseComposeRequestBody, parseComposeResponseBody, replaceBodyContentInComposeSendRequestBody, } from './sync-compose-processor';
|
|
29
20
|
function logErrorExceptEventListeners(err, details) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
21
|
+
// Don't log Gmail's errors
|
|
22
|
+
if (details !== 'XMLHttpRequest event listener error') {
|
|
23
|
+
logger.error(err, details);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
setTimeout(function () {
|
|
27
|
+
// let window.onerror log this
|
|
28
|
+
throw err;
|
|
29
|
+
}, 1);
|
|
30
|
+
}
|
|
39
31
|
}
|
|
40
|
-
function setupGmailInterceptor() {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
32
|
+
export default function setupGmailInterceptor() {
|
|
33
|
+
let jsFrame = null;
|
|
34
|
+
const js_frame_element = top.document.getElementById('js_frame');
|
|
35
|
+
if (js_frame_element) {
|
|
36
|
+
jsFrame = js_frame_element.contentDocument.defaultView;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
logger.eventSdkPassive('noJSFrameElementFound');
|
|
40
|
+
}
|
|
41
|
+
setupGmailInterceptorOnFrames(window, jsFrame);
|
|
49
42
|
}
|
|
50
|
-
|
|
51
43
|
// Split into a separate step to make it easy for tests to use.
|
|
52
|
-
function setupGmailInterceptorOnFrames(mainFrame, jsFrame) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
logError: logErrorExceptEventListeners
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
if (jsFrame) {
|
|
62
|
-
const js_frame_originalXHR = jsFrame.XMLHttpRequest;
|
|
63
|
-
jsFrame.XMLHttpRequest = (0, _xhrProxyFactory.default)(js_frame_originalXHR, js_frame_wrappers, {
|
|
64
|
-
logError: logErrorExceptEventListeners
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
threadIdentifier.setup();
|
|
68
|
-
messageMetadataHolder.setup();
|
|
69
|
-
|
|
70
|
-
//email sending modifier/notifier
|
|
71
|
-
{
|
|
72
|
-
let modifiers = {};
|
|
73
|
-
_kefir.default.fromEvents(document, 'inboxSDKregisterComposeRequestModifier').onValue(_ref => {
|
|
74
|
-
let {
|
|
75
|
-
detail
|
|
76
|
-
} = _ref;
|
|
77
|
-
const keyId = detail.composeid || detail.draftID;
|
|
78
|
-
if (!modifiers[keyId]) {
|
|
79
|
-
modifiers[keyId] = [];
|
|
80
|
-
}
|
|
81
|
-
modifiers[keyId].push(detail.modifierId);
|
|
82
|
-
});
|
|
83
|
-
_kefir.default.fromEvents(document, 'inboxSDKunregisterComposeRequestModifier').onValue(_ref2 => {
|
|
84
|
-
let {
|
|
85
|
-
detail
|
|
86
|
-
} = _ref2;
|
|
87
|
-
const {
|
|
88
|
-
keyId,
|
|
89
|
-
modifierId
|
|
90
|
-
} = detail;
|
|
91
|
-
modifiers[keyId] = modifiers[keyId].filter(item => item !== modifierId);
|
|
92
|
-
if (modifiers[keyId].length === 0) {
|
|
93
|
-
delete modifiers[keyId];
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
js_frame_wrappers.push({
|
|
97
|
-
isRelevantTo: function (connection) {
|
|
98
|
-
return connection.params.act === 'sm';
|
|
99
|
-
},
|
|
100
|
-
originalSendBodyLogger: function (connection, body) {
|
|
101
|
-
triggerEvent({
|
|
102
|
-
type: 'emailSending',
|
|
103
|
-
body: body
|
|
104
|
-
});
|
|
105
|
-
},
|
|
106
|
-
requestChanger: async function (connection, request) {
|
|
107
|
-
let composeParams = _querystring.default.parse(request.body);
|
|
108
|
-
const composeid = composeParams.composeid;
|
|
109
|
-
const composeModifierIds = modifiers[composeParams.composeid];
|
|
110
|
-
if (!composeModifierIds || composeModifierIds.length === 0) {
|
|
111
|
-
return request;
|
|
112
|
-
}
|
|
113
|
-
for (let ii = 0; ii < composeModifierIds.length; ii++) {
|
|
114
|
-
const modifierId = composeModifierIds[ii];
|
|
115
|
-
const modificationPromise = _kefir.default.fromEvents(document, 'inboxSDKcomposeRequestModified').filter(_ref3 => {
|
|
116
|
-
let {
|
|
117
|
-
detail
|
|
118
|
-
} = _ref3;
|
|
119
|
-
return detail.composeid === composeid && detail.modifierId === modifierId;
|
|
120
|
-
}).take(1).map(_ref4 => {
|
|
121
|
-
let {
|
|
122
|
-
detail
|
|
123
|
-
} = _ref4;
|
|
124
|
-
return detail.composeParams;
|
|
125
|
-
}).toPromise(Promise);
|
|
126
|
-
triggerEvent({
|
|
127
|
-
type: 'inboxSDKmodifyComposeRequest',
|
|
128
|
-
composeid,
|
|
129
|
-
modifierId,
|
|
130
|
-
composeParams: {
|
|
131
|
-
body: composeParams.body,
|
|
132
|
-
isPlainText: composeParams.ishtml !== '1'
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
let newComposeParams = await modificationPromise;
|
|
136
|
-
composeParams = Object.assign({}, composeParams, newComposeParams);
|
|
137
|
-
}
|
|
138
|
-
return Object.assign({}, request, {
|
|
139
|
-
body: stringifyComposeParams(composeParams)
|
|
44
|
+
export function setupGmailInterceptorOnFrames(mainFrame, jsFrame) {
|
|
45
|
+
const main_wrappers = [], js_frame_wrappers = [];
|
|
46
|
+
{
|
|
47
|
+
const main_originalXHR = mainFrame.XMLHttpRequest;
|
|
48
|
+
mainFrame.XMLHttpRequest = XHRProxyFactory(main_originalXHR, main_wrappers, {
|
|
49
|
+
logError: logErrorExceptEventListeners,
|
|
140
50
|
});
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
responseText: connection.originalResponseText,
|
|
147
|
-
originalSendBody: connection.originalSendBody
|
|
148
|
-
});
|
|
149
|
-
if (connection.originalSendBody) {
|
|
150
|
-
const composeParams = _querystring.default.parse(connection.originalSendBody);
|
|
151
|
-
delete modifiers[composeParams.composeid];
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
js_frame_wrappers.push({
|
|
157
|
-
isRelevantTo: function (connection) {
|
|
158
|
-
return connection.params.act === 'sd';
|
|
159
|
-
},
|
|
160
|
-
originalSendBodyLogger: function (connection, body) {
|
|
161
|
-
triggerEvent({
|
|
162
|
-
type: 'emailDraftSaveSending',
|
|
163
|
-
body: body
|
|
51
|
+
}
|
|
52
|
+
if (jsFrame) {
|
|
53
|
+
const js_frame_originalXHR = jsFrame.XMLHttpRequest;
|
|
54
|
+
jsFrame.XMLHttpRequest = XHRProxyFactory(js_frame_originalXHR, js_frame_wrappers, {
|
|
55
|
+
logError: logErrorExceptEventListeners,
|
|
164
56
|
});
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
type: 'emailDraftReceived',
|
|
170
|
-
responseText: connection.originalResponseText,
|
|
171
|
-
originalSendBody: connection.originalSendBody,
|
|
172
|
-
connectionDetails: {
|
|
173
|
-
method: connection.method,
|
|
174
|
-
url: connection.url,
|
|
175
|
-
params: connection.params,
|
|
176
|
-
responseType: connection.responseType
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
});
|
|
57
|
+
}
|
|
58
|
+
threadIdentifier.setup();
|
|
59
|
+
messageMetadataHolder.setup();
|
|
60
|
+
//email sending modifier/notifier
|
|
182
61
|
{
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
if (
|
|
195
|
-
|
|
62
|
+
const modifiers = {};
|
|
63
|
+
Kefir.fromEvents(document, 'inboxSDKregisterComposeRequestModifier').onValue(({ detail }) => {
|
|
64
|
+
const keyId = detail.composeid || detail.draftID;
|
|
65
|
+
if (!modifiers[keyId]) {
|
|
66
|
+
modifiers[keyId] = [];
|
|
67
|
+
}
|
|
68
|
+
modifiers[keyId].push(detail.modifierId);
|
|
69
|
+
});
|
|
70
|
+
Kefir.fromEvents(document, 'inboxSDKunregisterComposeRequestModifier').onValue(({ detail }) => {
|
|
71
|
+
const { keyId, modifierId } = detail;
|
|
72
|
+
modifiers[keyId] = modifiers[keyId].filter((item) => item !== modifierId);
|
|
73
|
+
if (modifiers[keyId].length === 0) {
|
|
74
|
+
delete modifiers[keyId];
|
|
196
75
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
break;
|
|
204
|
-
case 'DRAFT_SAVE':
|
|
205
|
-
currentDraftSaveConnectionIDs.set(connection, draftID);
|
|
206
|
-
break;
|
|
207
|
-
case 'SEND':
|
|
208
|
-
currentSendConnectionIDs.set(connection, draftID);
|
|
76
|
+
});
|
|
77
|
+
js_frame_wrappers.push({
|
|
78
|
+
isRelevantTo: function (connection) {
|
|
79
|
+
return connection.params.act === 'sm';
|
|
80
|
+
},
|
|
81
|
+
originalSendBodyLogger: function (connection, body) {
|
|
209
82
|
triggerEvent({
|
|
210
|
-
|
|
211
|
-
|
|
83
|
+
type: 'emailSending',
|
|
84
|
+
body: body,
|
|
212
85
|
});
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const {
|
|
221
|
-
draftID,
|
|
222
|
-
body,
|
|
223
|
-
type
|
|
224
|
-
} = composeRequestDetails;
|
|
225
|
-
const composeModifierIds = modifiers[draftID];
|
|
226
|
-
if (!composeModifierIds || composeModifierIds.length === 0) return request;
|
|
227
|
-
let newEmailBody = composeRequestDetails.body;
|
|
228
|
-
for (let ii = 0; ii < composeModifierIds.length; ii++) {
|
|
229
|
-
const modifierId = composeModifierIds[ii];
|
|
230
|
-
const modificationPromise = _kefir.default.fromEvents(document, 'inboxSDKcomposeRequestModified').filter(_ref5 => {
|
|
231
|
-
let {
|
|
232
|
-
detail
|
|
233
|
-
} = _ref5;
|
|
234
|
-
return detail.draftID === draftID && detail.modifierId === modifierId;
|
|
235
|
-
}).take(1).map(_ref6 => {
|
|
236
|
-
let {
|
|
237
|
-
detail
|
|
238
|
-
} = _ref6;
|
|
239
|
-
return detail.composeParams;
|
|
240
|
-
}).toPromise(Promise);
|
|
241
|
-
triggerEvent({
|
|
242
|
-
type: 'inboxSDKmodifyComposeRequest',
|
|
243
|
-
draftID,
|
|
244
|
-
modifierId,
|
|
245
|
-
composeParams: {
|
|
246
|
-
body: newEmailBody,
|
|
247
|
-
isPlainText: false
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
const newComposeParams = await modificationPromise;
|
|
251
|
-
newEmailBody = newComposeParams.body;
|
|
252
|
-
}
|
|
253
|
-
return Object.assign({}, request, {
|
|
254
|
-
body: (0, _syncComposeProcessor.replaceBodyContentInComposeSendRequestBody)(request.body, newEmailBody)
|
|
255
|
-
});
|
|
256
|
-
},
|
|
257
|
-
afterListeners(connection) {
|
|
258
|
-
if (currentSendConnectionIDs.has(connection) || currentDraftSaveConnectionIDs.has(connection) || currentFirstDraftSaveConnectionIDs.has(connection)) {
|
|
259
|
-
const sendFailed = () => {
|
|
260
|
-
triggerEvent({
|
|
261
|
-
type: 'emailSendFailed',
|
|
262
|
-
draftID
|
|
263
|
-
});
|
|
264
|
-
currentSendConnectionIDs.delete(connection);
|
|
265
|
-
};
|
|
266
|
-
const draftID = currentSendConnectionIDs.get(connection) || currentDraftSaveConnectionIDs.get(connection) || currentFirstDraftSaveConnectionIDs.get(connection);
|
|
267
|
-
if (connection.status !== 200 || !connection.originalResponseText) {
|
|
268
|
-
sendFailed();
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
try {
|
|
272
|
-
const responsesParsed = (0, _syncComposeProcessor.parseComposeResponseBody)(connection.originalResponseText);
|
|
273
|
-
for (const responseParsed of responsesParsed) {
|
|
274
|
-
// If we're sending a draft, we only care about the response related to the draft we're sending.
|
|
275
|
-
if (draftID && !responseParsed.messageId.endsWith(draftID)) {
|
|
276
|
-
continue;
|
|
277
|
-
}
|
|
278
|
-
if (responseParsed.type === 'FIRST_DRAFT_SAVE' || responseParsed.type === 'DRAFT_SAVE') {
|
|
279
|
-
triggerEvent({
|
|
280
|
-
draftID: draftID,
|
|
281
|
-
type: 'emailDraftReceived',
|
|
282
|
-
rfcID: responseParsed.rfcID,
|
|
283
|
-
threadID: responseParsed.threadId,
|
|
284
|
-
messageID: responseParsed.messageId,
|
|
285
|
-
oldMessageID: responseParsed.oldMessageId,
|
|
286
|
-
oldThreadID: responseParsed.oldThreadId
|
|
287
|
-
});
|
|
288
|
-
currentSendConnectionIDs.delete(connection);
|
|
289
|
-
currentDraftSaveConnectionIDs.delete(connection);
|
|
290
|
-
currentFirstDraftSaveConnectionIDs.delete(connection);
|
|
291
|
-
return;
|
|
292
|
-
} else if (responseParsed.type === 'SEND') {
|
|
293
|
-
triggerEvent({
|
|
294
|
-
draftID: draftID,
|
|
295
|
-
type: 'emailSent',
|
|
296
|
-
rfcID: responseParsed.rfcID,
|
|
297
|
-
threadID: responseParsed.threadId,
|
|
298
|
-
messageID: responseParsed.messageId,
|
|
299
|
-
oldMessageID: responseParsed.oldMessageId,
|
|
300
|
-
oldThreadID: responseParsed.oldThreadId
|
|
301
|
-
});
|
|
302
|
-
currentSendConnectionIDs.delete(connection);
|
|
303
|
-
currentDraftSaveConnectionIDs.delete(connection);
|
|
304
|
-
currentFirstDraftSaveConnectionIDs.delete(connection);
|
|
305
|
-
return;
|
|
86
|
+
},
|
|
87
|
+
requestChanger: async function (connection, request) {
|
|
88
|
+
let composeParams = querystring.parse(request.body);
|
|
89
|
+
const composeid = composeParams.composeid;
|
|
90
|
+
const composeModifierIds = modifiers[composeParams.composeid];
|
|
91
|
+
if (!composeModifierIds || composeModifierIds.length === 0) {
|
|
92
|
+
return request;
|
|
306
93
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
// TODO this function silently fails way too easily. Need to add better logging for it!
|
|
316
|
-
|
|
317
|
-
if (currentFirstDraftSaveConnectionIDs.has(connection)) {
|
|
318
|
-
const wrapper = originalResponse[2] && originalResponse[2][6] && originalResponse[2][6][0] && originalResponse[2][6][0][1];
|
|
319
|
-
if (wrapper) {
|
|
320
|
-
const threadUpdate = wrapper[3] && wrapper[3][7] && wrapper[3][7][1];
|
|
321
|
-
const messageUpdate = threadUpdate && threadUpdate[5] && threadUpdate[5][0];
|
|
322
|
-
if (threadUpdate && messageUpdate) {
|
|
323
|
-
triggerEvent({
|
|
324
|
-
draftID: draftID,
|
|
325
|
-
type: 'emailDraftReceived',
|
|
326
|
-
rfcID: messageUpdate[14],
|
|
327
|
-
threadID: threadUpdate[4].split('|')[0],
|
|
328
|
-
messageID: messageUpdate[1],
|
|
329
|
-
oldMessageID: messageUpdate[56],
|
|
330
|
-
oldThreadID: threadUpdate[20]
|
|
331
|
-
});
|
|
332
|
-
} else {
|
|
333
|
-
logger.error(new Error('Could not parse draft save'));
|
|
334
|
-
}
|
|
335
|
-
} else {
|
|
336
|
-
// pre-2019-05-29 handling
|
|
337
|
-
logger.eventSdkPassive('old compose draft id handling hit');
|
|
338
|
-
const oldWrapper = originalResponse[2] && originalResponse[2][6] && originalResponse[2][6][1] && originalResponse[2][6][1][1];
|
|
339
|
-
if (oldWrapper) {
|
|
340
|
-
const saveUpdate = oldWrapper[3] && oldWrapper[3][1] && oldWrapper[3][1][1];
|
|
341
|
-
if (saveUpdate) {
|
|
94
|
+
for (let ii = 0; ii < composeModifierIds.length; ii++) {
|
|
95
|
+
const modifierId = composeModifierIds[ii];
|
|
96
|
+
const modificationPromise = Kefir.fromEvents(document, 'inboxSDKcomposeRequestModified')
|
|
97
|
+
.filter(({ detail }) => detail.composeid === composeid &&
|
|
98
|
+
detail.modifierId === modifierId)
|
|
99
|
+
.take(1)
|
|
100
|
+
.map(({ detail }) => detail.composeParams)
|
|
101
|
+
.toPromise( /* Promise */);
|
|
342
102
|
triggerEvent({
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
103
|
+
type: 'inboxSDKmodifyComposeRequest',
|
|
104
|
+
composeid,
|
|
105
|
+
modifierId,
|
|
106
|
+
composeParams: {
|
|
107
|
+
body: composeParams.body,
|
|
108
|
+
isPlainText: composeParams.ishtml !== '1',
|
|
109
|
+
},
|
|
349
110
|
});
|
|
350
|
-
|
|
111
|
+
const newComposeParams = await modificationPromise;
|
|
112
|
+
composeParams = Object.assign({}, composeParams, newComposeParams);
|
|
351
113
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
}
|
|
359
|
-
const sendUpdateMatch = updateList.find(update => update[1]?.[3]?.[7]?.[1]?.[5]?.[0]?.[14] && update[1][3][7][1][5].find(message => (0, _includes.default)(message[1], draftID)));
|
|
360
|
-
if (!sendUpdateMatch) {
|
|
361
|
-
if (currentSendConnectionIDs.has(connection)) {
|
|
362
|
-
const minimalSendUpdates = updateList.filter(update => update[1]?.[3]?.[5]?.[3]);
|
|
363
|
-
if (minimalSendUpdates.length > 0) {
|
|
364
|
-
const threadID = minimalSendUpdates[0][1][1] ? minimalSendUpdates[0][1][1].replace(/\|.*$/, '') : undefined;
|
|
114
|
+
return Object.assign({}, request, {
|
|
115
|
+
body: stringifyComposeParams(composeParams),
|
|
116
|
+
});
|
|
117
|
+
},
|
|
118
|
+
afterListeners: function (connection) {
|
|
119
|
+
if (connection.status === 200) {
|
|
365
120
|
triggerEvent({
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
messageID:
|
|
370
|
-
//new compose
|
|
371
|
-
minimalSendUpdates[0][1][3]?.[5]?.[5]?.[0] ||
|
|
372
|
-
//replies
|
|
373
|
-
minimalSendUpdates[0][1][3][5][3]?.[0]
|
|
121
|
+
type: 'emailSent',
|
|
122
|
+
responseText: connection.originalResponseText,
|
|
123
|
+
originalSendBody: connection.originalSendBody,
|
|
374
124
|
});
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
sendFailed();
|
|
380
|
-
}
|
|
381
|
-
return;
|
|
382
|
-
}
|
|
383
|
-
const sendUpdateWrapper = sendUpdateMatch[1]?.[3]?.[7]?.[1];
|
|
384
|
-
const sendUpdate = sendUpdateWrapper[5].find(message => message[1].includes(draftID));
|
|
385
|
-
if (!sendUpdate) {
|
|
386
|
-
sendFailed();
|
|
387
|
-
return;
|
|
388
|
-
}
|
|
389
|
-
const isEmailSentResponse = currentSendConnectionIDs.has(connection);
|
|
390
|
-
if (!Array.isArray(sendUpdate[11])) {
|
|
391
|
-
logger.error(new Error('sendUpdate[11] was not an array'));
|
|
392
|
-
} else {
|
|
393
|
-
if (isEmailSentResponse) {
|
|
394
|
-
if (sendUpdate[11].indexOf('^r') >= 0) {
|
|
395
|
-
logger.error(new Error('sendUpdate[11] unexpectedly contained "^r"'));
|
|
396
|
-
}
|
|
125
|
+
if (connection.originalSendBody) {
|
|
126
|
+
const composeParams = querystring.parse(connection.originalSendBody);
|
|
127
|
+
delete modifiers[composeParams.composeid];
|
|
128
|
+
}
|
|
397
129
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
js_frame_wrappers.push({
|
|
133
|
+
isRelevantTo: function (connection) {
|
|
134
|
+
return connection.params.act === 'sd';
|
|
135
|
+
},
|
|
136
|
+
originalSendBodyLogger: function (connection, body) {
|
|
137
|
+
triggerEvent({
|
|
138
|
+
type: 'emailDraftSaveSending',
|
|
139
|
+
body: body,
|
|
140
|
+
});
|
|
141
|
+
},
|
|
142
|
+
afterListeners: function (connection) {
|
|
143
|
+
if (connection.status === 200) {
|
|
144
|
+
triggerEvent({
|
|
145
|
+
type: 'emailDraftReceived',
|
|
146
|
+
responseText: connection.originalResponseText,
|
|
147
|
+
originalSendBody: connection.originalSendBody,
|
|
148
|
+
connectionDetails: {
|
|
149
|
+
method: connection.method,
|
|
150
|
+
url: connection.url,
|
|
151
|
+
params: connection.params,
|
|
152
|
+
responseType: connection.responseType,
|
|
153
|
+
},
|
|
154
|
+
});
|
|
404
155
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
{
|
|
159
|
+
// Sync API-based compose sending intercept
|
|
160
|
+
const currentSendConnectionIDs = new WeakMap();
|
|
161
|
+
const currentDraftSaveConnectionIDs = new WeakMap();
|
|
162
|
+
const currentFirstDraftSaveConnectionIDs = new WeakMap();
|
|
163
|
+
main_wrappers.push({
|
|
164
|
+
isRelevantTo(connection) {
|
|
165
|
+
return /sync(?:\/u\/\d+)?\/i\/s/.test(connection.url);
|
|
166
|
+
},
|
|
167
|
+
originalSendBodyLogger(connection) {
|
|
168
|
+
if (connection.originalSendBody) {
|
|
169
|
+
const composeRequestDetails = parseComposeRequestBody(connection.originalSendBody);
|
|
170
|
+
if (!composeRequestDetails) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const { draftID } = composeRequestDetails;
|
|
174
|
+
switch (composeRequestDetails.type) {
|
|
175
|
+
case 'FIRST_DRAFT_SAVE':
|
|
176
|
+
currentFirstDraftSaveConnectionIDs.set(connection, draftID);
|
|
177
|
+
break;
|
|
178
|
+
case 'DRAFT_SAVE':
|
|
179
|
+
currentDraftSaveConnectionIDs.set(connection, draftID);
|
|
180
|
+
break;
|
|
181
|
+
case 'SEND':
|
|
182
|
+
currentSendConnectionIDs.set(connection, draftID);
|
|
183
|
+
triggerEvent({
|
|
184
|
+
type: 'emailSending',
|
|
185
|
+
draftID,
|
|
186
|
+
});
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
requestChanger: async function (connection, request) {
|
|
192
|
+
const composeRequestDetails = parseComposeRequestBody(request.body);
|
|
193
|
+
if (!composeRequestDetails || composeRequestDetails.type !== 'SEND')
|
|
194
|
+
return request;
|
|
195
|
+
const { draftID, body, type } = composeRequestDetails;
|
|
196
|
+
const composeModifierIds = modifiers[draftID];
|
|
197
|
+
if (!composeModifierIds || composeModifierIds.length === 0)
|
|
198
|
+
return request;
|
|
199
|
+
let newEmailBody = composeRequestDetails.body;
|
|
200
|
+
for (let ii = 0; ii < composeModifierIds.length; ii++) {
|
|
201
|
+
const modifierId = composeModifierIds[ii];
|
|
202
|
+
const modificationPromise = Kefir.fromEvents(document, 'inboxSDKcomposeRequestModified')
|
|
203
|
+
.filter(({ detail }) => detail.draftID === draftID && detail.modifierId === modifierId)
|
|
204
|
+
.take(1)
|
|
205
|
+
.map(({ detail }) => detail.composeParams)
|
|
206
|
+
.toPromise( /* Promise */);
|
|
207
|
+
triggerEvent({
|
|
208
|
+
type: 'inboxSDKmodifyComposeRequest',
|
|
209
|
+
draftID,
|
|
210
|
+
modifierId,
|
|
211
|
+
composeParams: {
|
|
212
|
+
body: newEmailBody,
|
|
213
|
+
isPlainText: false,
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
const newComposeParams = await modificationPromise;
|
|
217
|
+
newEmailBody = newComposeParams.body;
|
|
218
|
+
}
|
|
219
|
+
return Object.assign({}, request, {
|
|
220
|
+
body: replaceBodyContentInComposeSendRequestBody(request.body, newEmailBody),
|
|
221
|
+
});
|
|
222
|
+
},
|
|
223
|
+
afterListeners(connection) {
|
|
224
|
+
if (currentSendConnectionIDs.has(connection) ||
|
|
225
|
+
currentDraftSaveConnectionIDs.has(connection) ||
|
|
226
|
+
currentFirstDraftSaveConnectionIDs.has(connection)) {
|
|
227
|
+
const sendFailed = () => {
|
|
228
|
+
triggerEvent({
|
|
229
|
+
type: 'emailSendFailed',
|
|
230
|
+
draftID,
|
|
231
|
+
});
|
|
232
|
+
currentSendConnectionIDs.delete(connection);
|
|
233
|
+
};
|
|
234
|
+
const draftID = currentSendConnectionIDs.get(connection) ||
|
|
235
|
+
currentDraftSaveConnectionIDs.get(connection) ||
|
|
236
|
+
currentFirstDraftSaveConnectionIDs.get(connection);
|
|
237
|
+
if (connection.status !== 200 || !connection.originalResponseText) {
|
|
238
|
+
sendFailed();
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
try {
|
|
242
|
+
const responsesParsed = parseComposeResponseBody(connection.originalResponseText);
|
|
243
|
+
for (const responseParsed of responsesParsed) {
|
|
244
|
+
// If we're sending a draft, we only care about the response related to the draft we're sending.
|
|
245
|
+
if (draftID && !responseParsed.messageId.endsWith(draftID)) {
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
if (responseParsed.type === 'FIRST_DRAFT_SAVE' ||
|
|
249
|
+
responseParsed.type === 'DRAFT_SAVE') {
|
|
250
|
+
triggerEvent({
|
|
251
|
+
draftID: draftID,
|
|
252
|
+
type: 'emailDraftReceived',
|
|
253
|
+
rfcID: responseParsed.rfcID,
|
|
254
|
+
threadID: responseParsed.threadId,
|
|
255
|
+
messageID: responseParsed.messageId,
|
|
256
|
+
oldMessageID: responseParsed.oldMessageId,
|
|
257
|
+
oldThreadID: responseParsed.oldThreadId,
|
|
258
|
+
});
|
|
259
|
+
currentSendConnectionIDs.delete(connection);
|
|
260
|
+
currentDraftSaveConnectionIDs.delete(connection);
|
|
261
|
+
currentFirstDraftSaveConnectionIDs.delete(connection);
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
else if (responseParsed.type === 'SEND') {
|
|
265
|
+
triggerEvent({
|
|
266
|
+
draftID: draftID,
|
|
267
|
+
type: 'emailSent',
|
|
268
|
+
rfcID: responseParsed.rfcID,
|
|
269
|
+
threadID: responseParsed.threadId,
|
|
270
|
+
messageID: responseParsed.messageId,
|
|
271
|
+
oldMessageID: responseParsed.oldMessageId,
|
|
272
|
+
oldThreadID: responseParsed.oldThreadId,
|
|
273
|
+
});
|
|
274
|
+
currentSendConnectionIDs.delete(connection);
|
|
275
|
+
currentDraftSaveConnectionIDs.delete(connection);
|
|
276
|
+
currentFirstDraftSaveConnectionIDs.delete(connection);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
catch (err) {
|
|
282
|
+
logger.eventSdkPassive('connection.requestResponseParsingFailed', {
|
|
283
|
+
responseParseError: err,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
const originalResponse = JSON.parse(connection.originalResponseText);
|
|
287
|
+
// TODO this function silently fails way too easily. Need to add better logging for it!
|
|
288
|
+
if (currentFirstDraftSaveConnectionIDs.has(connection)) {
|
|
289
|
+
const wrapper = originalResponse[2] &&
|
|
290
|
+
originalResponse[2][6] &&
|
|
291
|
+
originalResponse[2][6][0] &&
|
|
292
|
+
originalResponse[2][6][0][1];
|
|
293
|
+
if (wrapper) {
|
|
294
|
+
const threadUpdate = wrapper[3] && wrapper[3][7] && wrapper[3][7][1];
|
|
295
|
+
const messageUpdate = threadUpdate && threadUpdate[5] && threadUpdate[5][0];
|
|
296
|
+
if (threadUpdate && messageUpdate) {
|
|
297
|
+
triggerEvent({
|
|
298
|
+
draftID: draftID,
|
|
299
|
+
type: 'emailDraftReceived',
|
|
300
|
+
rfcID: messageUpdate[14],
|
|
301
|
+
threadID: threadUpdate[4].split('|')[0],
|
|
302
|
+
messageID: messageUpdate[1],
|
|
303
|
+
oldMessageID: messageUpdate[56],
|
|
304
|
+
oldThreadID: threadUpdate[20],
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
logger.error(new Error('Could not parse draft save'));
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
// pre-2019-05-29 handling
|
|
313
|
+
logger.eventSdkPassive('old compose draft id handling hit');
|
|
314
|
+
const oldWrapper = originalResponse[2] &&
|
|
315
|
+
originalResponse[2][6] &&
|
|
316
|
+
originalResponse[2][6][1] &&
|
|
317
|
+
originalResponse[2][6][1][1];
|
|
318
|
+
if (oldWrapper) {
|
|
319
|
+
const saveUpdate = oldWrapper[3] && oldWrapper[3][1] && oldWrapper[3][1][1];
|
|
320
|
+
if (saveUpdate) {
|
|
321
|
+
triggerEvent({
|
|
322
|
+
draftID: draftID,
|
|
323
|
+
type: 'emailDraftReceived',
|
|
324
|
+
rfcID: saveUpdate[14],
|
|
325
|
+
messageID: saveUpdate[1],
|
|
326
|
+
oldMessageID: saveUpdate[48]
|
|
327
|
+
? new BigNumber(saveUpdate[48]).toString(16)
|
|
328
|
+
: saveUpdate[56],
|
|
329
|
+
syncThreadID: oldWrapper[1],
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
const updateList = originalResponse[2]?.[6];
|
|
337
|
+
if (!updateList) {
|
|
338
|
+
sendFailed();
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
const sendUpdateMatch = updateList.find((update) => update[1]?.[3]?.[7]?.[1]?.[5]?.[0]?.[14] &&
|
|
342
|
+
update[1][3][7][1][5].find((message) => includes(message[1], draftID)));
|
|
343
|
+
if (!sendUpdateMatch) {
|
|
344
|
+
if (currentSendConnectionIDs.has(connection)) {
|
|
345
|
+
const minimalSendUpdates = updateList.filter((update) => update[1]?.[3]?.[5]?.[3]);
|
|
346
|
+
if (minimalSendUpdates.length > 0) {
|
|
347
|
+
const threadID = minimalSendUpdates[0][1][1]
|
|
348
|
+
? minimalSendUpdates[0][1][1].replace(/\|.*$/, '')
|
|
349
|
+
: undefined;
|
|
350
|
+
triggerEvent({
|
|
351
|
+
draftID,
|
|
352
|
+
type: 'emailSent',
|
|
353
|
+
threadID,
|
|
354
|
+
//new compose
|
|
355
|
+
messageID: minimalSendUpdates[0][1][3]?.[5]?.[5]?.[0] || //replies
|
|
356
|
+
minimalSendUpdates[0][1][3][5][3]?.[0],
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
sendFailed();
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
sendFailed();
|
|
365
|
+
}
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
const sendUpdateWrapper = sendUpdateMatch[1]?.[3]?.[7]?.[1];
|
|
369
|
+
const sendUpdate = sendUpdateWrapper[5].find((message) => message[1].includes(draftID));
|
|
370
|
+
if (!sendUpdate) {
|
|
371
|
+
sendFailed();
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
const isEmailSentResponse = currentSendConnectionIDs.has(connection);
|
|
375
|
+
if (!Array.isArray(sendUpdate[11])) {
|
|
376
|
+
logger.error(new Error('sendUpdate[11] was not an array'));
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
if (isEmailSentResponse) {
|
|
380
|
+
if (sendUpdate[11].indexOf('^r') >= 0) {
|
|
381
|
+
logger.error(new Error('sendUpdate[11] unexpectedly contained "^r"'));
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
if (isEmailSentResponse) {
|
|
386
|
+
if (sendUpdate[22] !== undefined && sendUpdate[22] !== 3) {
|
|
387
|
+
logger.error(new Error('sendUpdate[22] was not expected value'), {
|
|
388
|
+
value: sendUpdate[22],
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
const threadID = sendUpdateWrapper[4]
|
|
393
|
+
? sendUpdateWrapper[4].replace(/\|.*$/, '')
|
|
394
|
+
: undefined;
|
|
395
|
+
triggerEvent({
|
|
396
|
+
draftID: draftID,
|
|
397
|
+
type: isEmailSentResponse ? 'emailSent' : 'emailDraftReceived',
|
|
398
|
+
rfcID: sendUpdate[14],
|
|
399
|
+
messageID: sendUpdate[1],
|
|
400
|
+
oldMessageID: sendUpdate[48]
|
|
401
|
+
? new BigNumber(sendUpdate[48]).toString(16)
|
|
402
|
+
: sendUpdate[56],
|
|
403
|
+
threadID,
|
|
404
|
+
// It seems Gmail is A/B testing including gmailThreadID in response[20] and not including
|
|
405
|
+
// the encoded version of it in response[18], so pull it from [20] if [18] is not set.
|
|
406
|
+
oldThreadID: sendUpdateWrapper[18] != null
|
|
407
|
+
? new BigNumber(sendUpdateWrapper[18]).toString(16)
|
|
408
|
+
: sendUpdateWrapper[20],
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
currentSendConnectionIDs.delete(connection);
|
|
412
|
+
currentDraftSaveConnectionIDs.delete(connection);
|
|
413
|
+
currentFirstDraftSaveConnectionIDs.delete(connection);
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
});
|
|
423
417
|
}
|
|
424
|
-
});
|
|
425
418
|
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
// intercept and process thread responses
|
|
429
|
-
{
|
|
430
|
-
js_frame_wrappers.push({
|
|
431
|
-
isRelevantTo(connection) {
|
|
432
|
-
return !!connection.params.search && connection.params.view === 'tl';
|
|
433
|
-
},
|
|
434
|
-
async responseTextChanger(connection, responseText) {
|
|
435
|
-
// Presence of a responseTextChanger blocks Gmail from getting the partial
|
|
436
|
-
// values as this loads. We want our originalResponseTextLogger to run
|
|
437
|
-
// before Gmail has seen any of the response.
|
|
438
|
-
return responseText;
|
|
439
|
-
},
|
|
440
|
-
originalResponseTextLogger(connection) {
|
|
441
|
-
if (connection.status === 200) {
|
|
442
|
-
const search = connection.params.search;
|
|
443
|
-
const responseText = connection.originalResponseText;
|
|
444
|
-
threadIdentifier.processThreadListResponse(responseText);
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
});
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
// intercept and process conversation view responses to get message metadata
|
|
451
|
-
{
|
|
452
|
-
// do this for gmail v1
|
|
419
|
+
// intercept and process thread responses
|
|
453
420
|
{
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
421
|
+
js_frame_wrappers.push({
|
|
422
|
+
isRelevantTo(connection) {
|
|
423
|
+
return !!connection.params.search && connection.params.view === 'tl';
|
|
424
|
+
},
|
|
425
|
+
async responseTextChanger(connection, responseText) {
|
|
426
|
+
// Presence of a responseTextChanger blocks Gmail from getting the partial
|
|
427
|
+
// values as this loads. We want our originalResponseTextLogger to run
|
|
428
|
+
// before Gmail has seen any of the response.
|
|
429
|
+
return responseText;
|
|
430
|
+
},
|
|
431
|
+
originalResponseTextLogger(connection) {
|
|
432
|
+
if (connection.status === 200) {
|
|
433
|
+
const search = connection.params.search;
|
|
434
|
+
const responseText = connection.originalResponseText;
|
|
435
|
+
threadIdentifier.processThreadListResponse(responseText);
|
|
436
|
+
}
|
|
437
|
+
},
|
|
438
|
+
});
|
|
465
439
|
}
|
|
466
|
-
|
|
467
|
-
// sync API based
|
|
440
|
+
// intercept and process conversation view responses to get message metadata
|
|
468
441
|
{
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
}))
|
|
483
|
-
})));
|
|
484
|
-
}
|
|
442
|
+
// do this for gmail v1
|
|
443
|
+
{
|
|
444
|
+
js_frame_wrappers.push({
|
|
445
|
+
isRelevantTo(connection) {
|
|
446
|
+
return connection.params.view === 'cv';
|
|
447
|
+
},
|
|
448
|
+
originalResponseTextLogger(connection) {
|
|
449
|
+
if (connection.status === 200) {
|
|
450
|
+
const groupedMessages = GmailResponseProcessor.extractMessages(connection.originalResponseText);
|
|
451
|
+
messageMetadataHolder.add(groupedMessages);
|
|
452
|
+
}
|
|
453
|
+
},
|
|
454
|
+
});
|
|
485
455
|
}
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
456
|
+
// sync API based
|
|
457
|
+
{
|
|
458
|
+
// search response
|
|
459
|
+
main_wrappers.push({
|
|
460
|
+
isRelevantTo: function (connection) {
|
|
461
|
+
return /sync(?:\/u\/\d+)?\/i\/bv/.test(connection.url);
|
|
462
|
+
},
|
|
463
|
+
originalResponseTextLogger(connection) {
|
|
464
|
+
if (connection.status === 200) {
|
|
465
|
+
const threads = GmailSyncResponseProcessor.extractThreadsFromSearchResponse(connection.originalResponseText);
|
|
466
|
+
messageMetadataHolder.add(threads.map((syncThread) => ({
|
|
467
|
+
threadID: syncThread.syncThreadID,
|
|
468
|
+
messages: syncThread.extraMetaData.syncMessageData.map((syncMessage) => ({
|
|
469
|
+
date: syncMessage.date,
|
|
470
|
+
recipients: syncMessage.recipients,
|
|
471
|
+
})),
|
|
472
|
+
})));
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
});
|
|
476
|
+
// thread response
|
|
477
|
+
main_wrappers.push({
|
|
478
|
+
isRelevantTo: function (connection) {
|
|
479
|
+
return /sync(?:\/u\/\d+)?\/i\/fd/.test(connection.url);
|
|
480
|
+
},
|
|
481
|
+
originalResponseTextLogger(connection) {
|
|
482
|
+
if (connection.status === 200) {
|
|
483
|
+
const threads = GmailSyncResponseProcessor.extractThreadsFromThreadResponse(connection.originalResponseText);
|
|
484
|
+
messageMetadataHolder.add(threads.map((syncThread) => ({
|
|
485
|
+
threadID: syncThread.syncThreadID,
|
|
486
|
+
messages: syncThread.extraMetaData.syncMessageData.map((syncMessage) => ({
|
|
487
|
+
date: syncMessage.date,
|
|
488
|
+
recipients: syncMessage.recipients,
|
|
489
|
+
})),
|
|
490
|
+
})));
|
|
491
|
+
}
|
|
492
|
+
},
|
|
493
|
+
});
|
|
504
494
|
}
|
|
505
|
-
});
|
|
506
495
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
detail
|
|
523
|
-
} = _ref7;
|
|
524
|
-
providers[detail.providerID] = {
|
|
525
|
-
position: Object.keys(providers).length
|
|
526
|
-
};
|
|
527
|
-
});
|
|
528
|
-
document.addEventListener('inboxSDKprovideSuggestions', function (_ref8) {
|
|
529
|
-
let {
|
|
530
|
-
detail
|
|
531
|
-
} = _ref8;
|
|
532
|
-
if (detail.query === currentQuery) {
|
|
533
|
-
const provider = providers[detail.providerID];
|
|
534
|
-
if (!provider) {
|
|
535
|
-
throw new Error('provider does not exist for providerID');
|
|
536
|
-
}
|
|
537
|
-
if (suggestionModifications == null) {
|
|
538
|
-
throw new Error('tried to modified a null suggestionModifications');
|
|
539
|
-
}
|
|
540
|
-
suggestionModifications[provider.position] = detail.suggestions;
|
|
541
|
-
if (suggestionModifications.filter(Boolean).length === Object.keys(providers).length) {
|
|
542
|
-
if (currentQueryDefer == null) {
|
|
543
|
-
throw new Error('tried to resolve a null currentQueryDefer');
|
|
544
|
-
}
|
|
545
|
-
currentQueryDefer.resolve((0, _flatten.default)(suggestionModifications));
|
|
546
|
-
currentQueryDefer = currentQuery = suggestionModifications = null;
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
});
|
|
550
|
-
main_wrappers.push({
|
|
551
|
-
isRelevantTo(connection) {
|
|
552
|
-
return Object.keys(providers).length > 0 && !!connection.url.match(/^\/cloudsearch\/request\?/) && connection.params.client == 'gmail' && connection.params.gs_ri == 'gmail';
|
|
553
|
-
},
|
|
554
|
-
originalSendBodyLogger(connection, body) {
|
|
555
|
-
const parsedBody = _querystring.default.parse(body);
|
|
556
|
-
if (!parsedBody.request) {
|
|
557
|
-
return;
|
|
558
|
-
}
|
|
559
|
-
const query = JSON.parse(parsedBody.request)[2];
|
|
560
|
-
if (!query) {
|
|
561
|
-
return;
|
|
562
|
-
}
|
|
563
|
-
currentQuery = query;
|
|
564
|
-
if (currentQueryDefer) currentQueryDefer.resolve();
|
|
565
|
-
currentQueryDefer = connection._defer = (0, _defer.default)();
|
|
566
|
-
suggestionModifications = [];
|
|
567
|
-
triggerEvent({
|
|
568
|
-
type: 'suggestionsRequest',
|
|
569
|
-
query: currentQuery
|
|
496
|
+
// Search suggestions modifier
|
|
497
|
+
// The content scripts tell us when they're interested in adding
|
|
498
|
+
// modifications to future suggestion results. When we see a search
|
|
499
|
+
// suggestions request come through, we signal the query string to the content
|
|
500
|
+
// scripts, wait for the same number of responses as the number of registered
|
|
501
|
+
// suggestion modifiers, and then meld them into the query response.
|
|
502
|
+
{
|
|
503
|
+
const providers = Object.create(null);
|
|
504
|
+
let currentQuery;
|
|
505
|
+
let suggestionModifications;
|
|
506
|
+
let currentQueryDefer;
|
|
507
|
+
document.addEventListener('inboxSDKregisterSuggestionsModifier', function ({ detail }) {
|
|
508
|
+
providers[detail.providerID] = {
|
|
509
|
+
position: Object.keys(providers).length,
|
|
510
|
+
};
|
|
570
511
|
});
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
// The content script tells us search terms to watch for. Whenever we see a
|
|
590
|
-
// search query containing the term, we delay it being sent out, trigger an
|
|
591
|
-
// event containing the full query, and wait for a response event from the
|
|
592
|
-
// content script that contains a new query to substitute in.
|
|
593
|
-
const customSearchTerms = [];
|
|
594
|
-
let queryReplacement;
|
|
595
|
-
document.addEventListener('inboxSDKcreateCustomSearchTerm', function (event) {
|
|
596
|
-
customSearchTerms.push(event.detail.term);
|
|
597
|
-
});
|
|
598
|
-
document.addEventListener('inboxSDKsearchReplacementReady', function (event) {
|
|
599
|
-
if (queryReplacement.query === event.detail.query) {
|
|
600
|
-
queryReplacement.newQuery.resolve(event.detail.newQuery);
|
|
601
|
-
}
|
|
602
|
-
});
|
|
603
|
-
|
|
604
|
-
// classic Gmail API intercept
|
|
605
|
-
js_frame_wrappers.push({
|
|
606
|
-
isRelevantTo: function (connection) {
|
|
607
|
-
let customSearchTerm;
|
|
608
|
-
const params = connection.params;
|
|
609
|
-
if (connection.method === 'POST' && params.search && params.view === 'tl' && connection.url.match(/^\?/) && params.q && (customSearchTerm = (0, _intersection.default)(customSearchTerms, (0, _quotedSplit.default)(params.q))[0])) {
|
|
610
|
-
if (queryReplacement && queryReplacement.query === params.q && queryReplacement.start != params.start) {
|
|
611
|
-
// If this is the same query that was made last, but just for a
|
|
612
|
-
// different page, then re-use the replacement query we got last time.
|
|
613
|
-
// Don't wait on the extension to come up with it again (and risk it
|
|
614
|
-
// giving an inconsistent answer between pages).
|
|
615
|
-
connection._queryReplacement = queryReplacement;
|
|
616
|
-
// Mark the old queryReplacement with this page now so we can tell on
|
|
617
|
-
// a later request whether the page was changed or the list refresh
|
|
618
|
-
// button was hit.
|
|
619
|
-
queryReplacement.start = params.start;
|
|
620
|
-
} else {
|
|
621
|
-
if (queryReplacement) {
|
|
622
|
-
// Resolve the old one with something because no one else is going
|
|
623
|
-
// to after it's replaced in a moment.
|
|
624
|
-
queryReplacement.newQuery.resolve(queryReplacement.query);
|
|
512
|
+
document.addEventListener('inboxSDKprovideSuggestions', function ({ detail }) {
|
|
513
|
+
if (detail.query === currentQuery) {
|
|
514
|
+
const provider = providers[detail.providerID];
|
|
515
|
+
if (!provider) {
|
|
516
|
+
throw new Error('provider does not exist for providerID');
|
|
517
|
+
}
|
|
518
|
+
if (suggestionModifications == null) {
|
|
519
|
+
throw new Error('tried to modified a null suggestionModifications');
|
|
520
|
+
}
|
|
521
|
+
suggestionModifications[provider.position] = detail.suggestions;
|
|
522
|
+
if (suggestionModifications.filter(Boolean).length ===
|
|
523
|
+
Object.keys(providers).length) {
|
|
524
|
+
if (currentQueryDefer == null) {
|
|
525
|
+
throw new Error('tried to resolve a null currentQueryDefer');
|
|
526
|
+
}
|
|
527
|
+
currentQueryDefer.resolve(flatten(suggestionModifications));
|
|
528
|
+
currentQueryDefer = currentQuery = suggestionModifications = null;
|
|
529
|
+
}
|
|
625
530
|
}
|
|
626
|
-
queryReplacement = connection._queryReplacement = {
|
|
627
|
-
term: customSearchTerm,
|
|
628
|
-
query: params.q,
|
|
629
|
-
start: params.start,
|
|
630
|
-
newQuery: (0, _defer.default)()
|
|
631
|
-
};
|
|
632
|
-
triggerEvent({
|
|
633
|
-
type: 'searchQueryForReplacement',
|
|
634
|
-
term: customSearchTerm,
|
|
635
|
-
query: params.q
|
|
636
|
-
});
|
|
637
|
-
}
|
|
638
|
-
return true;
|
|
639
|
-
}
|
|
640
|
-
return false;
|
|
641
|
-
},
|
|
642
|
-
requestChanger: function (connection, request) {
|
|
643
|
-
return connection._queryReplacement.newQuery.promise.then(function (newQuery) {
|
|
644
|
-
let newParams = (0, _clone.default)(connection.params);
|
|
645
|
-
newParams.q = newQuery;
|
|
646
|
-
return {
|
|
647
|
-
method: request.method,
|
|
648
|
-
url: '?' + (0, _querystring.stringify)(newParams),
|
|
649
|
-
body: request.body
|
|
650
|
-
};
|
|
651
531
|
});
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
} else {
|
|
688
|
-
if (queryReplacement) {
|
|
689
|
-
// Resolve the old one with something because no one else is going
|
|
690
|
-
// to after it's replaced in a moment.
|
|
691
|
-
queryReplacement.newQuery.resolve(queryReplacement.query);
|
|
692
|
-
}
|
|
693
|
-
queryReplacement = connection._queryReplacement = {
|
|
694
|
-
term: customSearchTerm,
|
|
695
|
-
query: searchString,
|
|
696
|
-
start: pageOffset,
|
|
697
|
-
newQuery: (0, _defer.default)()
|
|
698
|
-
};
|
|
699
|
-
triggerEvent({
|
|
700
|
-
type: 'searchQueryForReplacement',
|
|
701
|
-
term: customSearchTerm,
|
|
702
|
-
query: searchString
|
|
703
|
-
});
|
|
704
|
-
}
|
|
705
|
-
return connection._queryReplacement.newQuery.promise.then(function (newQuery) {
|
|
706
|
-
if (newFormat) {
|
|
707
|
-
body[0][3] = newQuery;
|
|
708
|
-
} else {
|
|
709
|
-
body[1][4] = newQuery;
|
|
710
|
-
}
|
|
711
|
-
return {
|
|
712
|
-
method: request.method,
|
|
713
|
-
url: request.url,
|
|
714
|
-
body: JSON.stringify(body)
|
|
715
|
-
};
|
|
532
|
+
main_wrappers.push({
|
|
533
|
+
isRelevantTo(connection) {
|
|
534
|
+
return (Object.keys(providers).length > 0 &&
|
|
535
|
+
!!connection.url.match(/^\/cloudsearch\/request\?/) &&
|
|
536
|
+
connection.params.client == 'gmail' &&
|
|
537
|
+
connection.params.gs_ri == 'gmail');
|
|
538
|
+
},
|
|
539
|
+
originalSendBodyLogger(connection, body) {
|
|
540
|
+
const parsedBody = querystring.parse(body);
|
|
541
|
+
if (!parsedBody.request) {
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
const query = JSON.parse(parsedBody.request)[2];
|
|
545
|
+
if (!query) {
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
currentQuery = query;
|
|
549
|
+
if (currentQueryDefer)
|
|
550
|
+
currentQueryDefer.resolve();
|
|
551
|
+
currentQueryDefer = connection._defer = defer();
|
|
552
|
+
suggestionModifications = [];
|
|
553
|
+
triggerEvent({
|
|
554
|
+
type: 'suggestionsRequest',
|
|
555
|
+
query: currentQuery,
|
|
556
|
+
});
|
|
557
|
+
},
|
|
558
|
+
async responseTextChanger(connection, responseText) {
|
|
559
|
+
if (connection._defer && connection.status === 200) {
|
|
560
|
+
const modifications = await connection._defer.promise;
|
|
561
|
+
if (modifications) {
|
|
562
|
+
return modifySuggestions(responseText, modifications);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
return responseText;
|
|
566
|
+
},
|
|
716
567
|
});
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
document.addEventListener('inboxSDKcustomListNewQuery', event => {
|
|
732
|
-
if (customListJob.query === event.detail.query && customListJob.start === event.detail.start) {
|
|
733
|
-
const {
|
|
734
|
-
newQuery,
|
|
735
|
-
newStart
|
|
736
|
-
} = event.detail;
|
|
737
|
-
customListJob.newRequestParams.resolve({
|
|
738
|
-
query: newQuery,
|
|
739
|
-
start: newStart
|
|
568
|
+
}
|
|
569
|
+
{
|
|
570
|
+
// TODO: simplify this code
|
|
571
|
+
// the triggerEvent call should happen in the requestChanger callback
|
|
572
|
+
// and a lot of these state variables can be stored in the closure
|
|
573
|
+
// Search query replacer.
|
|
574
|
+
// The content script tells us search terms to watch for. Whenever we see a
|
|
575
|
+
// search query containing the term, we delay it being sent out, trigger an
|
|
576
|
+
// event containing the full query, and wait for a response event from the
|
|
577
|
+
// content script that contains a new query to substitute in.
|
|
578
|
+
const customSearchTerms = [];
|
|
579
|
+
let queryReplacement;
|
|
580
|
+
document.addEventListener('inboxSDKcreateCustomSearchTerm', function (event) {
|
|
581
|
+
customSearchTerms.push(event.detail.term);
|
|
740
582
|
});
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
customListJob.newResults.resolve(event.detail.newResults);
|
|
746
|
-
}
|
|
747
|
-
});
|
|
748
|
-
js_frame_wrappers.push({
|
|
749
|
-
isRelevantTo: function (connection) {
|
|
750
|
-
let customSearchQuery;
|
|
751
|
-
const params = connection.params;
|
|
752
|
-
if (connection.method === 'POST' && params.search && params.view === 'tl' && connection.url.match(/^\?/) && params.q && !params.act && (customSearchQuery = (0, _find.default)(customSearchQueries, x => x === params.q))) {
|
|
753
|
-
if (customListJob) {
|
|
754
|
-
// Resolve the old one with something because no one else is going
|
|
755
|
-
// to after it's replaced in a moment.
|
|
756
|
-
customListJob.newRequestParams.resolve({
|
|
757
|
-
query: customListJob.query,
|
|
758
|
-
start: customListJob.start
|
|
759
|
-
});
|
|
760
|
-
customListJob.newResults.resolve(null);
|
|
761
|
-
}
|
|
762
|
-
customListJob = connection._customListJob = {
|
|
763
|
-
query: params.q,
|
|
764
|
-
start: +params.start,
|
|
765
|
-
newRequestParams: (0, _defer.default)(),
|
|
766
|
-
newResults: (0, _defer.default)()
|
|
767
|
-
};
|
|
768
|
-
triggerEvent({
|
|
769
|
-
type: 'searchForReplacement',
|
|
770
|
-
query: customListJob.query,
|
|
771
|
-
start: customListJob.start
|
|
772
|
-
});
|
|
773
|
-
return true;
|
|
774
|
-
}
|
|
775
|
-
return false;
|
|
776
|
-
},
|
|
777
|
-
requestChanger: function (connection, request) {
|
|
778
|
-
return connection._customListJob.newRequestParams.promise.then(_ref9 => {
|
|
779
|
-
let {
|
|
780
|
-
query,
|
|
781
|
-
start
|
|
782
|
-
} = _ref9;
|
|
783
|
-
const newParams = (0, _clone.default)(connection.params);
|
|
784
|
-
newParams.q = query;
|
|
785
|
-
newParams.start = start;
|
|
786
|
-
return {
|
|
787
|
-
method: request.method,
|
|
788
|
-
url: '?' + (0, _querystring.stringify)(newParams),
|
|
789
|
-
body: request.body
|
|
790
|
-
};
|
|
583
|
+
document.addEventListener('inboxSDKsearchReplacementReady', function (event) {
|
|
584
|
+
if (queryReplacement.query === event.detail.query) {
|
|
585
|
+
queryReplacement.newQuery.resolve(event.detail.newQuery);
|
|
586
|
+
}
|
|
791
587
|
});
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
588
|
+
// classic Gmail API intercept
|
|
589
|
+
js_frame_wrappers.push({
|
|
590
|
+
isRelevantTo: function (connection) {
|
|
591
|
+
let customSearchTerm;
|
|
592
|
+
const params = connection.params;
|
|
593
|
+
if (connection.method === 'POST' &&
|
|
594
|
+
params.search &&
|
|
595
|
+
params.view === 'tl' &&
|
|
596
|
+
connection.url.match(/^\?/) &&
|
|
597
|
+
params.q &&
|
|
598
|
+
(customSearchTerm = intersection(customSearchTerms, quotedSplit(params.q))[0])) {
|
|
599
|
+
if (queryReplacement &&
|
|
600
|
+
queryReplacement.query === params.q &&
|
|
601
|
+
queryReplacement.start != params.start) {
|
|
602
|
+
// If this is the same query that was made last, but just for a
|
|
603
|
+
// different page, then re-use the replacement query we got last time.
|
|
604
|
+
// Don't wait on the extension to come up with it again (and risk it
|
|
605
|
+
// giving an inconsistent answer between pages).
|
|
606
|
+
connection._queryReplacement = queryReplacement;
|
|
607
|
+
// Mark the old queryReplacement with this page now so we can tell on
|
|
608
|
+
// a later request whether the page was changed or the list refresh
|
|
609
|
+
// button was hit.
|
|
610
|
+
queryReplacement.start = params.start;
|
|
611
|
+
}
|
|
612
|
+
else {
|
|
613
|
+
if (queryReplacement) {
|
|
614
|
+
// Resolve the old one with something because no one else is going
|
|
615
|
+
// to after it's replaced in a moment.
|
|
616
|
+
queryReplacement.newQuery.resolve(queryReplacement.query);
|
|
617
|
+
}
|
|
618
|
+
queryReplacement = connection._queryReplacement = {
|
|
619
|
+
term: customSearchTerm,
|
|
620
|
+
query: params.q,
|
|
621
|
+
start: params.start,
|
|
622
|
+
newQuery: defer(),
|
|
623
|
+
};
|
|
624
|
+
triggerEvent({
|
|
625
|
+
type: 'searchQueryForReplacement',
|
|
626
|
+
term: customSearchTerm,
|
|
627
|
+
query: params.q,
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
return true;
|
|
631
|
+
}
|
|
632
|
+
return false;
|
|
633
|
+
},
|
|
634
|
+
requestChanger: function (connection, request) {
|
|
635
|
+
return connection._queryReplacement.newQuery.promise.then(function (newQuery) {
|
|
636
|
+
const newParams = clone(connection.params);
|
|
637
|
+
newParams.q = newQuery;
|
|
638
|
+
return {
|
|
639
|
+
method: request.method,
|
|
640
|
+
url: '?' + stringify(newParams),
|
|
641
|
+
body: request.body,
|
|
642
|
+
};
|
|
643
|
+
});
|
|
644
|
+
},
|
|
799
645
|
});
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
646
|
+
// newer, sync API based request intercept
|
|
647
|
+
main_wrappers.push({
|
|
648
|
+
isRelevantTo: function (connection) {
|
|
649
|
+
return (connection.method === 'POST' &&
|
|
650
|
+
/sync(?:\/u\/\d+)?\/i\/bv/.test(connection.url));
|
|
651
|
+
},
|
|
652
|
+
requestChanger: function (connection, request) {
|
|
653
|
+
let customSearchTerm;
|
|
654
|
+
const body = JSON.parse(request.body);
|
|
655
|
+
let newFormat = false;
|
|
656
|
+
let payload, searchString, pageOffset;
|
|
657
|
+
if (Array.isArray(body)) {
|
|
658
|
+
newFormat = true;
|
|
659
|
+
payload = body[0];
|
|
660
|
+
searchString = payload[3];
|
|
661
|
+
pageOffset = payload[9];
|
|
662
|
+
}
|
|
663
|
+
else {
|
|
664
|
+
payload = body[1];
|
|
665
|
+
searchString = payload[4];
|
|
666
|
+
pageOffset = payload[10];
|
|
667
|
+
}
|
|
668
|
+
const isSyncAPISearchWithCustomTerm = payload[newFormat ? 0 : 1] === 79 &&
|
|
669
|
+
typeof searchString === 'string' &&
|
|
670
|
+
(customSearchTerm = intersection(customSearchTerms, quotedSplit(searchString))[0]);
|
|
671
|
+
if (!isSyncAPISearchWithCustomTerm)
|
|
672
|
+
return Promise.resolve(request);
|
|
673
|
+
if (queryReplacement &&
|
|
674
|
+
queryReplacement.query === searchString &&
|
|
675
|
+
queryReplacement.start != pageOffset) {
|
|
676
|
+
// If this is the same query that was made last, but just for a
|
|
677
|
+
// different page, then re-use the replacement query we got last time.
|
|
678
|
+
// Don't wait on the extension to come up with it again (and risk it
|
|
679
|
+
// giving an inconsistent answer between pages).
|
|
680
|
+
connection._queryReplacement = queryReplacement;
|
|
681
|
+
// Mark the old queryReplacement with this page now so we can tell on
|
|
682
|
+
// a later request whether the page was changed or the list refresh
|
|
683
|
+
// button was hit.
|
|
684
|
+
queryReplacement.start = pageOffset;
|
|
685
|
+
}
|
|
686
|
+
else {
|
|
687
|
+
if (queryReplacement) {
|
|
688
|
+
// Resolve the old one with something because no one else is going
|
|
689
|
+
// to after it's replaced in a moment.
|
|
690
|
+
queryReplacement.newQuery.resolve(queryReplacement.query);
|
|
691
|
+
}
|
|
692
|
+
queryReplacement = connection._queryReplacement = {
|
|
693
|
+
term: customSearchTerm,
|
|
694
|
+
query: searchString,
|
|
695
|
+
start: pageOffset,
|
|
696
|
+
newQuery: defer(),
|
|
697
|
+
};
|
|
698
|
+
triggerEvent({
|
|
699
|
+
type: 'searchQueryForReplacement',
|
|
700
|
+
term: customSearchTerm,
|
|
701
|
+
query: searchString,
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
return connection._queryReplacement.newQuery.promise.then(function (newQuery) {
|
|
705
|
+
if (newFormat) {
|
|
706
|
+
body[0][3] = newQuery;
|
|
707
|
+
}
|
|
708
|
+
else {
|
|
709
|
+
body[1][4] = newQuery;
|
|
710
|
+
}
|
|
711
|
+
return {
|
|
712
|
+
method: request.method,
|
|
713
|
+
url: request.url,
|
|
714
|
+
body: JSON.stringify(body),
|
|
715
|
+
};
|
|
716
|
+
});
|
|
717
|
+
},
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
{
|
|
721
|
+
// Search results replacer.
|
|
722
|
+
// The content script tells us a search query to watch for. Whenever we see
|
|
723
|
+
// the search query, trigger an event containing the query, trigger an
|
|
724
|
+
// event containing the response, and then wait for a response event from
|
|
725
|
+
// the content script that contains new results to substitute in.
|
|
726
|
+
const customSearchQueries = [];
|
|
727
|
+
let customListJob;
|
|
728
|
+
document.addEventListener('inboxSDKcustomListRegisterQuery', (event) => {
|
|
729
|
+
customSearchQueries.push(event.detail.query);
|
|
730
|
+
});
|
|
731
|
+
document.addEventListener('inboxSDKcustomListNewQuery', (event) => {
|
|
732
|
+
if (customListJob.query === event.detail.query &&
|
|
733
|
+
customListJob.start === event.detail.start) {
|
|
734
|
+
const { newQuery, newStart } = event.detail;
|
|
735
|
+
customListJob.newRequestParams.resolve({
|
|
736
|
+
query: newQuery,
|
|
737
|
+
start: newStart,
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
document.addEventListener('inboxSDKcustomListResults', (event) => {
|
|
742
|
+
if (customListJob.query === event.detail.query) {
|
|
743
|
+
customListJob.newResults.resolve(event.detail.newResults);
|
|
744
|
+
}
|
|
745
|
+
});
|
|
746
|
+
js_frame_wrappers.push({
|
|
747
|
+
isRelevantTo: function (connection) {
|
|
748
|
+
let customSearchQuery;
|
|
749
|
+
const params = connection.params;
|
|
750
|
+
if (connection.method === 'POST' &&
|
|
751
|
+
params.search &&
|
|
752
|
+
params.view === 'tl' &&
|
|
753
|
+
connection.url.match(/^\?/) &&
|
|
754
|
+
params.q &&
|
|
755
|
+
!params.act &&
|
|
756
|
+
(customSearchQuery = find(customSearchQueries, (x) => x === params.q))) {
|
|
757
|
+
if (customListJob) {
|
|
758
|
+
// Resolve the old one with something because no one else is going
|
|
759
|
+
// to after it's replaced in a moment.
|
|
760
|
+
customListJob.newRequestParams.resolve({
|
|
761
|
+
query: customListJob.query,
|
|
762
|
+
start: customListJob.start,
|
|
763
|
+
});
|
|
764
|
+
customListJob.newResults.resolve(null);
|
|
765
|
+
}
|
|
766
|
+
customListJob = connection._customListJob = {
|
|
767
|
+
query: params.q,
|
|
768
|
+
start: +params.start,
|
|
769
|
+
newRequestParams: defer(),
|
|
770
|
+
newResults: defer(),
|
|
771
|
+
};
|
|
772
|
+
triggerEvent({
|
|
773
|
+
type: 'searchForReplacement',
|
|
774
|
+
query: customListJob.query,
|
|
775
|
+
start: customListJob.start,
|
|
776
|
+
});
|
|
777
|
+
return true;
|
|
778
|
+
}
|
|
779
|
+
return false;
|
|
780
|
+
},
|
|
781
|
+
requestChanger: function (connection, request) {
|
|
782
|
+
return connection._customListJob.newRequestParams.promise.then(({ query, start }) => {
|
|
783
|
+
const newParams = clone(connection.params);
|
|
784
|
+
newParams.q = query;
|
|
785
|
+
newParams.start = start;
|
|
786
|
+
return {
|
|
787
|
+
method: request.method,
|
|
788
|
+
url: '?' + stringify(newParams),
|
|
789
|
+
body: request.body,
|
|
790
|
+
};
|
|
791
|
+
});
|
|
792
|
+
},
|
|
793
|
+
responseTextChanger: function (connection, response) {
|
|
794
|
+
triggerEvent({
|
|
795
|
+
type: 'searchResultsResponse',
|
|
796
|
+
query: connection._customListJob.query,
|
|
797
|
+
start: connection._customListJob.start,
|
|
798
|
+
response,
|
|
799
|
+
});
|
|
800
|
+
return connection._customListJob.newResults.promise.then((newResults) => (newResults === null ? response : newResults));
|
|
801
|
+
},
|
|
802
|
+
});
|
|
803
|
+
// Sync API-based custom thread list interception
|
|
804
|
+
main_wrappers.push({
|
|
805
|
+
isRelevantTo: function (connection) {
|
|
806
|
+
if (/sync(?:\/u\/\d+)?\/i\/bv/.test(connection.url)) {
|
|
807
|
+
if (customListJob) {
|
|
808
|
+
// Resolve the old one with something because no one else is going
|
|
809
|
+
// to after it's replaced in a moment.
|
|
810
|
+
customListJob.newRequestParams.resolve({
|
|
811
|
+
query: customListJob.query,
|
|
812
|
+
start: customListJob.start,
|
|
813
|
+
});
|
|
814
|
+
customListJob.newResults.resolve(null);
|
|
815
|
+
}
|
|
816
|
+
return true;
|
|
817
|
+
}
|
|
818
|
+
return false;
|
|
819
|
+
},
|
|
820
|
+
requestChanger: async function (connection, request) {
|
|
821
|
+
if (request.body) {
|
|
822
|
+
const parsedBody = JSON.parse(request.body);
|
|
823
|
+
const newFormat = Array.isArray(parsedBody);
|
|
824
|
+
// we are a search!
|
|
825
|
+
const searchQuery = (newFormat
|
|
826
|
+
? parsedBody && parsedBody[0] && parsedBody[0][3]
|
|
827
|
+
: parsedBody && parsedBody[1] && parsedBody[1][4]) || '';
|
|
828
|
+
if (find(customSearchQueries, (x) => x === searchQuery)) {
|
|
829
|
+
customListJob = connection._customListJob = {
|
|
830
|
+
query: searchQuery,
|
|
831
|
+
start: newFormat ? parsedBody[0][9] : parsedBody[1][10],
|
|
832
|
+
newRequestParams: defer(),
|
|
833
|
+
newResults: defer(),
|
|
834
|
+
};
|
|
835
|
+
triggerEvent({
|
|
836
|
+
type: 'searchForReplacement',
|
|
837
|
+
query: customListJob.query,
|
|
838
|
+
start: customListJob.start,
|
|
839
|
+
});
|
|
840
|
+
return connection._customListJob.newRequestParams.promise.then(({ query, start }) => {
|
|
841
|
+
if (newFormat) {
|
|
842
|
+
parsedBody[0][3] = query;
|
|
843
|
+
parsedBody[0][9] = start;
|
|
844
|
+
}
|
|
845
|
+
else {
|
|
846
|
+
parsedBody[1][4] = query;
|
|
847
|
+
parsedBody[1][10] = start;
|
|
848
|
+
}
|
|
849
|
+
return {
|
|
850
|
+
method: request.method,
|
|
851
|
+
url: request.url,
|
|
852
|
+
body: JSON.stringify(parsedBody),
|
|
853
|
+
};
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
return request;
|
|
858
|
+
},
|
|
859
|
+
responseTextChanger: async function (connection, response) {
|
|
860
|
+
if (connection._customListJob) {
|
|
861
|
+
triggerEvent({
|
|
862
|
+
type: 'searchResultsResponse',
|
|
863
|
+
query: connection._customListJob.query,
|
|
864
|
+
start: connection._customListJob.start,
|
|
865
|
+
response,
|
|
866
|
+
});
|
|
867
|
+
return connection._customListJob.newResults.promise.then((newResults) => (newResults === null ? response : newResults));
|
|
868
|
+
}
|
|
869
|
+
else {
|
|
870
|
+
return response;
|
|
871
|
+
}
|
|
872
|
+
},
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
// sync token savers
|
|
876
|
+
{
|
|
877
|
+
const saveBTAIHeader = (header) => {
|
|
878
|
+
document.head.setAttribute('data-inboxsdk-btai-header', header);
|
|
835
879
|
triggerEvent({
|
|
836
|
-
|
|
837
|
-
query: customListJob.query,
|
|
838
|
-
start: customListJob.start
|
|
880
|
+
type: 'btaiHeaderReceived',
|
|
839
881
|
});
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
};
|
|
882
|
+
};
|
|
883
|
+
main_wrappers.push({
|
|
884
|
+
isRelevantTo(connection) {
|
|
885
|
+
return (/sync(?:\/u\/\d+)?\//.test(connection.url) &&
|
|
886
|
+
!document.head.hasAttribute('data-inboxsdk-btai-header'));
|
|
887
|
+
},
|
|
888
|
+
originalSendBodyLogger(connection) {
|
|
889
|
+
if (connection.headers['X-Gmail-BTAI']) {
|
|
890
|
+
saveBTAIHeader(connection.headers['X-Gmail-BTAI']);
|
|
891
|
+
}
|
|
892
|
+
},
|
|
893
|
+
});
|
|
894
|
+
const saveXsrfTokenHeader = (header) => {
|
|
895
|
+
document.head.setAttribute('data-inboxsdk-xsrf-token', header);
|
|
896
|
+
triggerEvent({
|
|
897
|
+
type: 'xsrfTokenHeaderReceived',
|
|
857
898
|
});
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
} else {
|
|
872
|
-
return response;
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
});
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
// sync token savers
|
|
879
|
-
{
|
|
880
|
-
const saveBTAIHeader = header => {
|
|
881
|
-
document.head.setAttribute('data-inboxsdk-btai-header', header);
|
|
882
|
-
triggerEvent({
|
|
883
|
-
type: 'btaiHeaderReceived'
|
|
884
|
-
});
|
|
885
|
-
};
|
|
886
|
-
main_wrappers.push({
|
|
887
|
-
isRelevantTo(connection) {
|
|
888
|
-
return /sync(?:\/u\/\d+)?\//.test(connection.url) && !document.head.hasAttribute('data-inboxsdk-btai-header');
|
|
889
|
-
},
|
|
890
|
-
originalSendBodyLogger(connection) {
|
|
891
|
-
if (connection.headers['X-Gmail-BTAI']) {
|
|
892
|
-
saveBTAIHeader(connection.headers['X-Gmail-BTAI']);
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
});
|
|
896
|
-
const saveXsrfTokenHeader = header => {
|
|
897
|
-
document.head.setAttribute('data-inboxsdk-xsrf-token', header);
|
|
898
|
-
triggerEvent({
|
|
899
|
-
type: 'xsrfTokenHeaderReceived'
|
|
900
|
-
});
|
|
901
|
-
};
|
|
902
|
-
main_wrappers.push({
|
|
903
|
-
isRelevantTo(connection) {
|
|
904
|
-
return /sync(?:\/u\/\d+)?\//.test(connection.url) && !document.head.hasAttribute('data-inboxsdk-xsrf-token');
|
|
905
|
-
},
|
|
906
|
-
originalSendBodyLogger(connection) {
|
|
907
|
-
if (connection.headers['X-Framework-Xsrf-Token']) {
|
|
908
|
-
saveXsrfTokenHeader(connection.headers['X-Framework-Xsrf-Token']);
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
});
|
|
912
|
-
}
|
|
899
|
+
};
|
|
900
|
+
main_wrappers.push({
|
|
901
|
+
isRelevantTo(connection) {
|
|
902
|
+
return (/sync(?:\/u\/\d+)?\//.test(connection.url) &&
|
|
903
|
+
!document.head.hasAttribute('data-inboxsdk-xsrf-token'));
|
|
904
|
+
},
|
|
905
|
+
originalSendBodyLogger(connection) {
|
|
906
|
+
if (connection.headers['X-Framework-Xsrf-Token']) {
|
|
907
|
+
saveXsrfTokenHeader(connection.headers['X-Framework-Xsrf-Token']);
|
|
908
|
+
}
|
|
909
|
+
},
|
|
910
|
+
});
|
|
911
|
+
}
|
|
913
912
|
}
|
|
914
913
|
function triggerEvent(detail) {
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
914
|
+
document.dispatchEvent(new CustomEvent('inboxSDKajaxIntercept', {
|
|
915
|
+
bubbles: true,
|
|
916
|
+
cancelable: false,
|
|
917
|
+
detail,
|
|
918
|
+
}));
|
|
920
919
|
}
|
|
921
920
|
function stringifyComposeParams(inComposeParams) {
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
921
|
+
const composeParams = clone(inComposeParams);
|
|
922
|
+
const string = `=${stringifyComposeRecipientParam(composeParams.to, 'to')}&=${stringifyComposeRecipientParam(composeParams.cc, 'cc')}&=${stringifyComposeRecipientParam(composeParams.bcc, 'bcc')}`;
|
|
923
|
+
delete composeParams.to;
|
|
924
|
+
delete composeParams.bcc;
|
|
925
|
+
delete composeParams.cc;
|
|
926
|
+
return string + '&' + querystring.stringify(composeParams);
|
|
928
927
|
}
|
|
929
928
|
function stringifyComposeRecipientParam(value, paramType) {
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
929
|
+
let string = '';
|
|
930
|
+
if (Array.isArray(value)) {
|
|
931
|
+
for (let ii = 0; ii < value.length; ii++) {
|
|
932
|
+
string += `&${paramType}=${encodeURIComponent(value[ii])}`;
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
else {
|
|
936
|
+
string += `&${paramType}=${encodeURIComponent(value)}`;
|
|
934
937
|
}
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
}
|
|
938
|
-
return string;
|
|
939
|
-
}
|
|
938
|
+
return string;
|
|
939
|
+
}
|