@inboxsdk/core 1.0.5 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/inboxsdk.js +25 -192
- package/inboxsdk.js.map +1 -1
- package/package.json +1 -1
- package/pageWorld.js +3 -47
- package/pageWorld.js.map +1 -1
- package/src/inboxsdk-js/inboxsdk-NONREMOTE-INTEGRATED-PAGEWORLD.d.ts +3 -0
- package/src/inboxsdk-js/inboxsdk-NONREMOTE-INTEGRATED-PAGEWORLD.d.ts.map +1 -0
- package/src/inboxsdk-js/inboxsdk-NONREMOTE-INTEGRATED-PAGEWORLD.js +3 -8
- package/src/inboxsdk-js/inboxsdk-NONREMOTE.d.ts +3 -0
- package/src/inboxsdk-js/inboxsdk-NONREMOTE.d.ts.map +1 -0
- package/src/inboxsdk-js/inboxsdk-NONREMOTE.js +4 -6
- package/src/inboxsdk-js/inboxsdk-REMOTE.d.ts +3 -0
- package/src/inboxsdk-js/inboxsdk-REMOTE.d.ts.map +1 -0
- package/src/inboxsdk-js/inboxsdk-REMOTE.js +2 -5
- package/src/inboxsdk-js/inboxsdk-TEST.d.ts +3 -0
- package/src/inboxsdk-js/inboxsdk-TEST.d.ts.map +1 -0
- package/src/inboxsdk-js/inboxsdk-TEST.js +5 -6
- package/src/inboxsdk-js/inboxsdk.d.ts +8 -0
- package/src/inboxsdk-js/inboxsdk.d.ts.map +1 -0
- package/src/inboxsdk-js/inboxsdk.js +22 -32
- package/src/inboxsdk-js/loading/load-platform-implementation-DEV.d.ts +2 -0
- package/src/inboxsdk-js/loading/load-platform-implementation-DEV.d.ts.map +1 -0
- package/src/inboxsdk-js/loading/load-platform-implementation-DEV.js +14 -16
- package/src/inboxsdk-js/loading/platform-implementation-loader.d.ts +1 -1
- package/src/inboxsdk-js/loading/platform-implementation-loader.d.ts.map +1 -1
- package/src/injected-js/gmail/setup-gmail-interceptor.js +7 -14
- package/src/injected-js/main.js +0 -9
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.js +0 -2
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-menu-item-view.js +2 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.js +1 -2
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.test.js +10 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/index.js +39 -35
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view.js +1 -2
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-card-view.js +2 -3
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-collapsible-section-view.js +13 -14
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-compose-notice.js +1 -2
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/size-fixer.js +2 -2
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view.js +3 -4
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view.js +7 -8
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-view.js +28 -31
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-row-list-view.js +4 -5
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-row-view.js +2 -3
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.js +1 -2
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.test.js +10 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view.js +10 -11
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-toolbar-view.js +4 -5
- package/src/platform-implementation-js/dom-driver/gmail/views/native-gmail-nav-item-view.js +3 -4
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-mole-view-driver.js +2 -3
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-tooltip-view.js +2 -3
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-backdrop.js +2 -3
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-drawer-view.js +5 -6
- package/src/platform-implementation-js/driver-common/sidebar/AppSidebar.js +1 -2
- package/src/platform-implementation-js/driver-common/sidebar/ContentPanelViewDriver.js +4 -5
- package/src/platform-implementation-js/lib/idMap.d.ts +1 -2
- package/src/platform-implementation-js/lib/idMap.d.ts.map +1 -1
- package/src/platform-implementation-js/lib/idMap.js +4 -44
- package/src/platform-implementation-js/lib/inject-script-EMBEDDED.d.ts.map +1 -1
- package/src/platform-implementation-js/lib/inject-script-EMBEDDED.js +3 -4
- package/src/platform-implementation-js/lib/react/ElementContainer.js +3 -7
- package/src/platform-implementation-js/main-INTEGRATED-PAGEWORLD.d.ts +3 -0
- package/src/platform-implementation-js/main-INTEGRATED-PAGEWORLD.d.ts.map +1 -0
- package/src/platform-implementation-js/main-INTEGRATED-PAGEWORLD.js +5 -9
- package/src/platform-implementation-js/main.d.ts +5 -0
- package/src/platform-implementation-js/main.d.ts.map +1 -0
- package/src/platform-implementation-js/main.js +38 -61
- package/src/platform-implementation-js/namespaces/conversations.js +2 -3
- package/src/platform-implementation-js/namespaces/lists.js +1 -2
- package/src/platform-implementation-js/namespaces/nav-menu.js +2 -3
- package/src/platform-implementation-js/namespaces/router.js +3 -4
- package/src/platform-implementation-js/namespaces/toolbars.js +1 -2
- package/src/platform-implementation-js/platform-implementation.d.ts +0 -3
- package/src/platform-implementation-js/platform-implementation.js +1 -11
- package/src/platform-implementation-js/views/app-menu-item-view.js +2 -1
- package/src/platform-implementation-js/views/collapsible-panel-view.js +2 -1
- package/src/platform-implementation-js/views/content-panel-view.js +1 -2
- package/src/platform-implementation-js/views/conversations/custom-message-view.js +3 -4
- package/src/platform-implementation-js/views/conversations/message-view.js +1 -2
- package/src/platform-implementation-js/views/conversations/thread-view.js +1 -2
- package/src/platform-implementation-js/views/nav-item-view.js +1 -2
- package/src/platform-implementation-js/views/route-view/dummy-route-view-driver.js +2 -3
- package/src/platform-implementation-js/widgets/drawer-view.js +1 -2
- package/src/platform-implementation-js/widgets/modal-view.js +1 -2
- package/src/platform-implementation-js/widgets/mole-view.js +1 -2
- package/src/injected-js/inbox/setupAjaxInterceptor.js +0 -211
- package/src/injected-js/inbox/setupClickAndGetNewIframeSrc.js +0 -67
- package/src/injected-js/inbox/setupComposeViewDraftIDFinder.js +0 -35
- package/src/injected-js/inbox/setupInboxFakeWindowResizeListener.js +0 -29
- package/src/platform-implementation-js/dom-driver/gmail/custom-style.d.ts +0 -2
- package/src/platform-implementation-js/dom-driver/gmail/custom-style.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/custom-style.js +0 -17
- package/src/platform-implementation-js/dom-driver/inbox/__mocks__/getSidebarClassnames.js +0 -13
- package/src/platform-implementation-js/dom-driver/inbox/addNavItem.js +0 -38
- package/src/platform-implementation-js/dom-driver/inbox/addRecipientRow.js +0 -55
- package/src/platform-implementation-js/dom-driver/inbox/createLink.js +0 -19
- package/src/platform-implementation-js/dom-driver/inbox/createLink.test.js +0 -27
- package/src/platform-implementation-js/dom-driver/inbox/custom-style.js +0 -23
- package/src/platform-implementation-js/dom-driver/inbox/detection/appToolbarLocation/parser.js +0 -43
- package/src/platform-implementation-js/dom-driver/inbox/detection/attachmentCard/parser.js +0 -34
- package/src/platform-implementation-js/dom-driver/inbox/detection/attachmentOverlay/parser.js +0 -53
- package/src/platform-implementation-js/dom-driver/inbox/detection/chatSidebar/parser.js +0 -31
- package/src/platform-implementation-js/dom-driver/inbox/detection/compose/parser.js +0 -103
- package/src/platform-implementation-js/dom-driver/inbox/detection/message/parser.js +0 -69
- package/src/platform-implementation-js/dom-driver/inbox/detection/nativeDrawer/parser.js +0 -32
- package/src/platform-implementation-js/dom-driver/inbox/detection/searchBar/parser.js +0 -28
- package/src/platform-implementation-js/dom-driver/inbox/detection/thread/parser.js +0 -49
- package/src/platform-implementation-js/dom-driver/inbox/detection/thread-row/parser.js +0 -100
- package/src/platform-implementation-js/dom-driver/inbox/getComposeViewDriverLiveSet.js +0 -99
- package/src/platform-implementation-js/dom-driver/inbox/getInboxMessageIdForInboxThreadId.js +0 -36
- package/src/platform-implementation-js/dom-driver/inbox/getSidebarClassnames.js +0 -114
- package/src/platform-implementation-js/dom-driver/inbox/getSidebarClassnames.test.js +0 -73
- package/src/platform-implementation-js/dom-driver/inbox/gotoView.js +0 -39
- package/src/platform-implementation-js/dom-driver/inbox/gotoView.test.js +0 -28
- package/src/platform-implementation-js/dom-driver/inbox/inbox-butter-bar-driver.js +0 -148
- package/src/platform-implementation-js/dom-driver/inbox/inbox-driver.js +0 -866
- package/src/platform-implementation-js/dom-driver/inbox/inbox-page-communicator.js +0 -62
- package/src/platform-implementation-js/dom-driver/inbox/inboxResponseProcessor.js +0 -12
- package/src/platform-implementation-js/dom-driver/inbox/inboxResponseProcessor.test.js +0 -18
- package/src/platform-implementation-js/dom-driver/inbox/makePageParserTree.js +0 -33
- package/src/platform-implementation-js/dom-driver/inbox/pageParserOptions.js +0 -265
- package/src/platform-implementation-js/dom-driver/inbox/registerSearchSuggestionsProvider.js +0 -301
- package/src/platform-implementation-js/dom-driver/inbox/setupCustomAutocompleteSelectionHandling.js +0 -183
- package/src/platform-implementation-js/dom-driver/inbox/setupRouteViewDriverStream.js +0 -64
- package/src/platform-implementation-js/dom-driver/inbox/setupRouteViewDriverStream.test.js +0 -72
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxLabelView.js +0 -78
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxMoleViewDriver.js +0 -297
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxToolbarButtonView.js +0 -92
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxToolbarView.js +0 -54
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-sidebar-view.js +0 -272
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-toolbar-button-view.js +0 -161
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-toolbar-tooltip-view.js +0 -58
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-attachment-card-view.js +0 -198
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-attachment-overlay-view.js +0 -90
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-chat-sidebar-view.js +0 -46
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-compose-button-view.js +0 -116
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-compose-view.js +0 -843
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-custom-route-view.js +0 -76
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-custom-route-view.test.js +0 -31
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-dropdown-view.js +0 -25
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-dummy-route-view.js +0 -64
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-message-view.js +0 -275
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-modal-view.js +0 -113
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-route-view.js +0 -97
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-row-view.js +0 -316
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-view.js +0 -219
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-view.test.js +0 -171
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-tooltip-view.js +0 -128
- package/src/platform-implementation-js/dom-driver/inbox/views/inboxNavItemView.js +0 -312
- package/src/platform-implementation-js/dom-driver/inbox/waitForAnimationClickBlockerGone.js +0 -26
- package/src/platform-implementation-js/lib/rewriteCssWithIdMap.d.ts +0 -2
- package/src/platform-implementation-js/lib/rewriteCssWithIdMap.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/rewriteCssWithIdMap.js +0 -4
- package/src/platform-implementation-js/lib/shared-style.js +0 -23
- package/src/types/gulp-add-src.d.ts +0 -7
package/src/platform-implementation-js/dom-driver/inbox/detection/attachmentOverlay/parser.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _transducers = _interopRequireDefault(require("transducers.js"));
|
|
9
|
-
var _ErrorCollector = _interopRequireDefault(require("../../../../lib/ErrorCollector"));
|
|
10
|
-
var _querySelectorOne = _interopRequireDefault(require("../../../../lib/dom/querySelectorOne"));
|
|
11
|
-
var _ud = require("ud");
|
|
12
|
-
function parser(el) {
|
|
13
|
-
const ec = new _ErrorCollector.default('attachmentOverlay');
|
|
14
|
-
ec.run('tabindex', () => {
|
|
15
|
-
if (!el.hasAttribute('tabindex')) throw new Error('expected tabindex');
|
|
16
|
-
});
|
|
17
|
-
const downloadButton = ec.run('downloadButton', () => {
|
|
18
|
-
const candidate = _transducers.default.toArray(Array.prototype.slice.call(el.querySelectorAll('div[role=button][tabindex][data-tooltip]:not([aria-disabled=true]):not([aria-pressed]):not([aria-expanded])')), _transducers.default.compose(_transducers.default.filter(el => el.childElementCount === 1 && el.firstElementChild.childElementCount === 0), _transducers.default.filter(el => {
|
|
19
|
-
if (global.document) {
|
|
20
|
-
const rect = el.getBoundingClientRect();
|
|
21
|
-
if (rect.top > 100) return false;
|
|
22
|
-
return true;
|
|
23
|
-
} else {
|
|
24
|
-
// Can't use screen position logic in unit tests so we're cheating a
|
|
25
|
-
// little and depending on an exact class name.
|
|
26
|
-
return el.parentElement.classList.contains('ndfHFb-c4YZDc-Wrql6b-C7uZwb-b0t70b');
|
|
27
|
-
}
|
|
28
|
-
}), _transducers.default.filter(el => {
|
|
29
|
-
const elIx = Array.prototype.indexOf.call(el.parentElement.children, el);
|
|
30
|
-
const nextDivSibling = Array.prototype.filter.call(el.parentElement.children, (el, i) => i > elIx && el.nodeName === 'DIV')[0];
|
|
31
|
-
return nextDivSibling && nextDivSibling.getAttribute('aria-haspopup') === 'true';
|
|
32
|
-
}), _transducers.default.take(1)))[0];
|
|
33
|
-
if (!candidate) throw new Error('Failed to find element');
|
|
34
|
-
if (candidate.getAttribute('aria-label') === 'Print') throw new Error('Found print button instead');
|
|
35
|
-
return candidate;
|
|
36
|
-
});
|
|
37
|
-
const buttonContainer = downloadButton ? downloadButton.parentElement : null;
|
|
38
|
-
const elements = {
|
|
39
|
-
downloadButton,
|
|
40
|
-
buttonContainer
|
|
41
|
-
};
|
|
42
|
-
const score = 1 - ec.errorCount() / ec.runCount();
|
|
43
|
-
return {
|
|
44
|
-
elements,
|
|
45
|
-
attributes: {},
|
|
46
|
-
score,
|
|
47
|
-
errors: ec.getErrorLogs()
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/*:: const x = parser(({}:any)); */
|
|
52
|
-
var _default = (0, _ud.defn)(module, parser);
|
|
53
|
-
exports.default = _default;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _ErrorCollector = _interopRequireDefault(require("../../../../lib/ErrorCollector"));
|
|
9
|
-
var _querySelectorOne = _interopRequireDefault(require("../../../../lib/dom/querySelectorOne"));
|
|
10
|
-
var _ud = require("ud");
|
|
11
|
-
function parser(el) {
|
|
12
|
-
const ec = new _ErrorCollector.default('chatSidebar');
|
|
13
|
-
ec.run('position:fixed', () => {
|
|
14
|
-
if (getComputedStyle(el.parentElement).position !== 'fixed') throw new Error('expected position:fixed in parent');
|
|
15
|
-
});
|
|
16
|
-
ec.run('id', () => {
|
|
17
|
-
if (!el.id) throw new Error('expected id');
|
|
18
|
-
});
|
|
19
|
-
const elements = {};
|
|
20
|
-
const score = 1 - ec.errorCount() / ec.runCount();
|
|
21
|
-
return {
|
|
22
|
-
elements,
|
|
23
|
-
attributes: {},
|
|
24
|
-
score,
|
|
25
|
-
errors: ec.getErrorLogs()
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/*:: const x = parser(({}:any)); */
|
|
30
|
-
var _default = (0, _ud.defn)(module, parser);
|
|
31
|
-
exports.default = _default;
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _ErrorCollector = _interopRequireDefault(require("../../../../lib/ErrorCollector"));
|
|
9
|
-
var _querySelectorOne = _interopRequireDefault(require("../../../../lib/dom/querySelectorOne"));
|
|
10
|
-
var _closestNg = _interopRequireDefault(require("closest-ng"));
|
|
11
|
-
var _ud = require("ud");
|
|
12
|
-
function parser(el) {
|
|
13
|
-
const ec = new _ErrorCollector.default('compose');
|
|
14
|
-
const isInline = el.getAttribute('role') !== 'dialog';
|
|
15
|
-
const sendBtn = ec.run('send button', () => (0, _querySelectorOne.default)(el, 'div[jstcache] > div[role=button][jsaction$=".send"], ' + 'div[jstcache] > div[role=button][disabled]:not([title]):not([data-tooltip])'));
|
|
16
|
-
const attachBtn = ec.run('attach button', () => (0, _querySelectorOne.default)(el, 'div[role=button][jsaction$=".attach"]'));
|
|
17
|
-
const body = ec.run('body', () => (0, _querySelectorOne.default)(el, 'div[contenteditable][g_editable], div[id][tabindex][aria-label][jsaction*=".quick_compose_handle_input"]'));
|
|
18
|
-
const subject = isInline ? null : ec.run('subject', () => {
|
|
19
|
-
const subject = (0, _querySelectorOne.default)(el, 'div[jstcache][jsan] > div > input[type=text][title][placeholder][jsaction*="input:"]');
|
|
20
|
-
if (!(subject instanceof HTMLInputElement)) throw new Error('Wrong type');
|
|
21
|
-
return subject;
|
|
22
|
-
});
|
|
23
|
-
const popOutBtn = isInline ? ec.run('pop-out button', () => (0, _querySelectorOne.default)(el, 'button[jsaction$=".quick_compose_popout_mole"]')) : null;
|
|
24
|
-
const discardBtn = ec.run('discard button', () => (0, _querySelectorOne.default)(el, 'button[jsaction$=".discard_draft"]'));
|
|
25
|
-
const titleBar = isInline ? null : ec.run('title bar', () => (0, _querySelectorOne.default)(el, 'div[jsaction$=".focus_mole"]'));
|
|
26
|
-
const toggleFullscreenButton = isInline ? null : ec.run('fullscreen button', () => (0, _querySelectorOne.default)(el, 'button[jsaction$=".toggle_full_screen"]'));
|
|
27
|
-
const toggleFullscreenButtonImage = isInline ? null : ec.run('fullscreen button image', () => (0, _querySelectorOne.default)(el, 'button[jsaction$=".toggle_full_screen"] img'));
|
|
28
|
-
const closeBtn = isInline ? null : ec.run('close button', () => (0, _querySelectorOne.default)(el, 'div[jstcache][jsan][jsaction] > button[jsaction$=".close_mole"]'));
|
|
29
|
-
const minimizeBtn = isInline ? null : ec.run('minimize button', () => (0, _querySelectorOne.default)(el, 'div[jstcache][jsan][jsaction] > button[jsaction$=".minimize_mole"]'));
|
|
30
|
-
const minimizeBtnImage = isInline ? null : ec.run('minimize button image', () => (0, _querySelectorOne.default)(el, 'div[jstcache][jsan][jsaction] > button[jsaction$=".minimize_mole"] img'));
|
|
31
|
-
const bodyPlaceholder = isInline ? null : ec.run('body placeholder', () => {
|
|
32
|
-
const el = body && body.previousElementSibling;
|
|
33
|
-
if (!(el instanceof HTMLElement) || el.nodeName !== 'LABEL') throw new Error(`compose body placeholder wrong type ${el ? el.nodeName : 'undefined'}`);
|
|
34
|
-
return el;
|
|
35
|
-
});
|
|
36
|
-
const fromPicker = el.querySelector('div[role=button][jsaction*=toggle_custom_from_menu]');
|
|
37
|
-
const fromPickerEmailSpan = fromPicker ? ec.run('from picker email span', () => (0, _querySelectorOne.default)(fromPicker, 'span')) : null;
|
|
38
|
-
const recipientFields = isInline ? null : ec.run('recipient fields', () => {
|
|
39
|
-
const recipientFields = el.querySelectorAll('input[type=text][role=combobox]');
|
|
40
|
-
if (recipientFields.length != 3) throw new Error(`Found ${recipientFields.length} recipient fields, expected 3`);
|
|
41
|
-
return recipientFields;
|
|
42
|
-
});
|
|
43
|
-
const [toInput, ccInput, bccInput] = recipientFields || [];
|
|
44
|
-
const toggleCcBccButton = isInline ? null : ec.run('toggle cc/bcc button', () => (0, _querySelectorOne.default)(el, 'button[jsaction*=".toggle_cc_bcc"]'));
|
|
45
|
-
const toRow = isInline ? null : ec.run('to row', () => {
|
|
46
|
-
if (!toInput) throw new Error('Could not locate To input');
|
|
47
|
-
const toInputAncestor = (0, _closestNg.default)(toInput, 'div > button[jsaction$=".toggle_cc_bcc"] + div');
|
|
48
|
-
const toRow = toInputAncestor && toInputAncestor.parentElement;
|
|
49
|
-
if (!(toRow instanceof HTMLElement)) throw new Error('Could not locate To row');
|
|
50
|
-
return toRow;
|
|
51
|
-
});
|
|
52
|
-
const ccRow = isInline ? null : ec.run('cc row', () => {
|
|
53
|
-
if (!ccInput) throw new Error('Could not locate CC input');
|
|
54
|
-
const ccInputAncestor = (0, _closestNg.default)(ccInput, 'div[class] > label + div');
|
|
55
|
-
const ccRow = ccInputAncestor && ccInputAncestor.parentElement;
|
|
56
|
-
if (!(ccRow instanceof HTMLElement)) throw new Error('Could not locate CC row');
|
|
57
|
-
return ccRow;
|
|
58
|
-
});
|
|
59
|
-
const bccRow = isInline ? null : ec.run('bcc row', () => {
|
|
60
|
-
if (!bccInput) throw new Error('Could not locate BCC input');
|
|
61
|
-
const bccInputAncestor = (0, _closestNg.default)(bccInput, 'div[class] > label + div');
|
|
62
|
-
const bccRow = bccInputAncestor && bccInputAncestor.parentElement;
|
|
63
|
-
if (!(bccRow instanceof HTMLElement)) throw new Error('Could not locate BCC row');
|
|
64
|
-
return bccRow;
|
|
65
|
-
});
|
|
66
|
-
const elements = {
|
|
67
|
-
sendBtn,
|
|
68
|
-
attachBtn,
|
|
69
|
-
body,
|
|
70
|
-
subject,
|
|
71
|
-
popOutBtn,
|
|
72
|
-
discardBtn,
|
|
73
|
-
titleBar,
|
|
74
|
-
toggleFullscreenButton,
|
|
75
|
-
toggleFullscreenButtonImage,
|
|
76
|
-
closeBtn,
|
|
77
|
-
minimizeBtn,
|
|
78
|
-
minimizeBtnImage,
|
|
79
|
-
bodyPlaceholder,
|
|
80
|
-
fromPicker,
|
|
81
|
-
fromPickerEmailSpan,
|
|
82
|
-
toInput,
|
|
83
|
-
ccInput,
|
|
84
|
-
bccInput,
|
|
85
|
-
toRow,
|
|
86
|
-
ccRow,
|
|
87
|
-
bccRow,
|
|
88
|
-
toggleCcBccButton
|
|
89
|
-
};
|
|
90
|
-
const score = 1 - ec.errorCount() / ec.runCount();
|
|
91
|
-
return {
|
|
92
|
-
elements,
|
|
93
|
-
attributes: {
|
|
94
|
-
isInline
|
|
95
|
-
},
|
|
96
|
-
score,
|
|
97
|
-
errors: ec.getErrorLogs()
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/*:: const x = parser(({}:any)); */
|
|
102
|
-
var _default = (0, _ud.defn)(module, parser);
|
|
103
|
-
exports.default = _default;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = parser;
|
|
8
|
-
var _last = _interopRequireDefault(require("lodash/last"));
|
|
9
|
-
var _ErrorCollector = _interopRequireDefault(require("../../../../lib/ErrorCollector"));
|
|
10
|
-
var _querySelectorOne = _interopRequireDefault(require("../../../../lib/dom/querySelectorOne"));
|
|
11
|
-
function parser(el) {
|
|
12
|
-
const ec = new _ErrorCollector.default('compose');
|
|
13
|
-
ec.run('tabindex', () => {
|
|
14
|
-
if (!el.hasAttribute('tabindex')) throw new Error('expected tabindex');
|
|
15
|
-
});
|
|
16
|
-
const inboxMessageId = ec.run('message id', () => {
|
|
17
|
-
const m = /msg-[^:]+:[^:\d]*\d+/.exec(el.getAttribute('data-msg-id') || '');
|
|
18
|
-
if (!m) {
|
|
19
|
-
throw new Error('message id regex failed');
|
|
20
|
-
}
|
|
21
|
-
return m[0];
|
|
22
|
-
});
|
|
23
|
-
const heading = ec.run('heading', () => {
|
|
24
|
-
const heading = el.querySelector('div[role=heading]');
|
|
25
|
-
if (!heading) throw new Error('failed to find heading');
|
|
26
|
-
return heading;
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
// Super-collapsed/HIDDEN messages don't have a body.
|
|
30
|
-
const body = el.querySelector('div[role=heading] ~ div:not(:empty)');
|
|
31
|
-
|
|
32
|
-
// The last message in a thread is always loaded and doesn't have the toggle
|
|
33
|
-
// collapse button.
|
|
34
|
-
const toggleCollapse = el.querySelector('div[jsaction$=".message_toggle_collapse"]');
|
|
35
|
-
const loaded = body != null && (toggleCollapse == null || toggleCollapse.getAttribute('role') === 'heading');
|
|
36
|
-
const viewState = loaded ? 'EXPANDED' : body != null ? 'COLLAPSED' : 'HIDDEN';
|
|
37
|
-
const isDraft = loaded && heading && !heading.querySelector('span[email]');
|
|
38
|
-
const sender = isDraft || !heading || !body ? null : ec.run('sender', () => (0, _querySelectorOne.default)(heading, '[email]:first-child'));
|
|
39
|
-
const recipientElements = isDraft ? null : el.querySelectorAll('[role=heading] [email]:not(:first-child), [role=heading] + div [email]');
|
|
40
|
-
const attachmentsArea = isDraft || !body || viewState !== 'EXPANDED' ? null : ec.run('attachments area', () => {
|
|
41
|
-
const lastSection = (0, _last.default)(body.parentElement.querySelectorAll('section:last-child'));
|
|
42
|
-
if (!lastSection) {
|
|
43
|
-
throw new Error('element not found');
|
|
44
|
-
}
|
|
45
|
-
return lastSection;
|
|
46
|
-
});
|
|
47
|
-
const elements = {
|
|
48
|
-
heading,
|
|
49
|
-
body,
|
|
50
|
-
sender,
|
|
51
|
-
toggleCollapse,
|
|
52
|
-
attachmentsArea
|
|
53
|
-
};
|
|
54
|
-
const score = 1 - ec.errorCount() / ec.runCount();
|
|
55
|
-
return {
|
|
56
|
-
elements,
|
|
57
|
-
attributes: {
|
|
58
|
-
loaded,
|
|
59
|
-
viewState,
|
|
60
|
-
inboxMessageId,
|
|
61
|
-
recipientElements,
|
|
62
|
-
isDraft
|
|
63
|
-
},
|
|
64
|
-
score,
|
|
65
|
-
errors: ec.getErrorLogs()
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/*:: const x = parser(({}:any)); */
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = parser;
|
|
8
|
-
var _ErrorCollector = _interopRequireDefault(require("../../../../lib/ErrorCollector"));
|
|
9
|
-
var _querySelectorOne = _interopRequireDefault(require("../../../../lib/dom/querySelectorOne"));
|
|
10
|
-
function parser(el) {
|
|
11
|
-
const errors = [];
|
|
12
|
-
if (el.childElementCount < 2) {
|
|
13
|
-
errors.push('expected more children');
|
|
14
|
-
}
|
|
15
|
-
const rect = el.getBoundingClientRect();
|
|
16
|
-
if (rect.top > 100) {
|
|
17
|
-
errors.push('expected element to border top of screen');
|
|
18
|
-
}
|
|
19
|
-
if (window.innerWidth - rect.right > 100) {
|
|
20
|
-
errors.push('expected element to border right side of screen');
|
|
21
|
-
}
|
|
22
|
-
if (window.innerHeight - rect.bottom > 100) {
|
|
23
|
-
errors.push('expected element to border bottom side of screen');
|
|
24
|
-
}
|
|
25
|
-
return {
|
|
26
|
-
elements: {},
|
|
27
|
-
score: errors.length === 0 ? 1 : 0,
|
|
28
|
-
errors
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/*:: const x = parser(({}:any)); */
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = parser;
|
|
8
|
-
var _ErrorCollector = _interopRequireDefault(require("../../../../lib/ErrorCollector"));
|
|
9
|
-
var _querySelectorOne = _interopRequireDefault(require("../../../../lib/dom/querySelectorOne"));
|
|
10
|
-
function parser(el) {
|
|
11
|
-
const collector = new _ErrorCollector.default('searchBar');
|
|
12
|
-
const rect = el.getBoundingClientRect();
|
|
13
|
-
collector.run('position check', () => {
|
|
14
|
-
if (rect.top > 100) {
|
|
15
|
-
throw new Error('expected element to border top of screen');
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
const searchInput = collector.run('searchInput', () => (0, _querySelectorOne.default)(el, 'div[role=search] input[role=combobox]'));
|
|
19
|
-
return {
|
|
20
|
-
elements: {
|
|
21
|
-
searchInput
|
|
22
|
-
},
|
|
23
|
-
score: 1 - collector.errorCount() / collector.runCount(),
|
|
24
|
-
errors: collector.getErrorLogs()
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/*:: const x = parser(({}:any)); */
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = parser;
|
|
8
|
-
var _ErrorCollector = _interopRequireDefault(require("../../../../lib/ErrorCollector"));
|
|
9
|
-
var _querySelectorOne = _interopRequireDefault(require("../../../../lib/dom/querySelectorOne"));
|
|
10
|
-
function parser(el) {
|
|
11
|
-
const ec = new _ErrorCollector.default('thread');
|
|
12
|
-
const inBundle = !el.hasAttribute('aria-multiselectable');
|
|
13
|
-
ec.run('tabindex', () => {
|
|
14
|
-
if (!el.hasAttribute('tabindex')) throw new Error('expected tabindex');
|
|
15
|
-
});
|
|
16
|
-
const inboxThreadId = ec.run('thread id', () => {
|
|
17
|
-
const m = /thread-[^:]+:[^:\d]*(\d+)/.exec(el.getAttribute('data-item-id') || '');
|
|
18
|
-
if (!m) {
|
|
19
|
-
throw new Error('thread id regex failed');
|
|
20
|
-
}
|
|
21
|
-
return m[0];
|
|
22
|
-
});
|
|
23
|
-
const heading = ec.run('heading', () => el.querySelector('div[role=heading]'));
|
|
24
|
-
const stickyHeading = !heading ? null : ec.run('stickyHeading', () => {
|
|
25
|
-
const el = heading.firstElementChild;
|
|
26
|
-
if (el instanceof HTMLDivElement) return el;
|
|
27
|
-
throw new Error('child missing');
|
|
28
|
-
});
|
|
29
|
-
const toolbar = !stickyHeading ? null : ec.run('toolbar', () => (0, _querySelectorOne.default)(stickyHeading, 'ul'));
|
|
30
|
-
|
|
31
|
-
// This will be null for threads that are still loading.
|
|
32
|
-
const list = ec.run('list', () => el.querySelector('div[role=list]'));
|
|
33
|
-
const elements = {
|
|
34
|
-
heading,
|
|
35
|
-
stickyHeading,
|
|
36
|
-
toolbar,
|
|
37
|
-
list
|
|
38
|
-
};
|
|
39
|
-
const score = 1 - ec.errorCount() / ec.runCount();
|
|
40
|
-
return {
|
|
41
|
-
elements,
|
|
42
|
-
attributes: {
|
|
43
|
-
inBundle,
|
|
44
|
-
inboxThreadId
|
|
45
|
-
},
|
|
46
|
-
score,
|
|
47
|
-
errors: ec.getErrorLogs()
|
|
48
|
-
};
|
|
49
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = parser;
|
|
8
|
-
var _ErrorCollector = _interopRequireDefault(require("../../../../lib/ErrorCollector"));
|
|
9
|
-
var _querySelectorOne = _interopRequireDefault(require("../../../../lib/dom/querySelectorOne"));
|
|
10
|
-
const RGB_REGEX = /^rgb\s*\(\s*(\d+),\s*(\d+),\s*(\d+)\s*\)/;
|
|
11
|
-
function parser(el) {
|
|
12
|
-
const ec = new _ErrorCollector.default('threadRow');
|
|
13
|
-
const inBundle = !el.hasAttribute('aria-multiselectable');
|
|
14
|
-
ec.run('tabindex', () => {
|
|
15
|
-
if (!el.hasAttribute('tabindex')) throw new Error('expected tabindex');
|
|
16
|
-
});
|
|
17
|
-
const subject = ec.run('subject', () => (0, _querySelectorOne.default)(el, 'div[jsaction][jslog] > div:not(:first-child):not(:last-child) > div > div[class]:not([style]):not(:first-child) > div:not(:first-child):not(:last-child) > div:not([style]):not(:first-child):not(:last-child):not([class*="inboxsdk"])'));
|
|
18
|
-
const checkbox = ec.run('checkbox', () => (0, _querySelectorOne.default)(el, 'div[jsaction] > div > div[jsaction] > div[role=checkbox]'));
|
|
19
|
-
const recipients = ec.run('recipients', () => el.querySelectorAll('div[jsaction] > div:not(:first-child):not(:last-child) > div > div > span[email]'));
|
|
20
|
-
const isOnlyDraft = ec.run('isOnlyDraft', () => !(recipients && recipients.length > 0));
|
|
21
|
-
const draftLabels = ec.run('draftLabels', () => {
|
|
22
|
-
const recipientCandidates = el.querySelectorAll('div[jsaction] > div:not(:first-child):not(:last-child) > div > div > span');
|
|
23
|
-
|
|
24
|
-
// We have to locate draft labels via text color because it's impossible
|
|
25
|
-
// to locate them with reliable CSS selectors
|
|
26
|
-
return Array.from(recipientCandidates).filter(candidate => {
|
|
27
|
-
const colorString = getComputedStyle(candidate).getPropertyValue('color');
|
|
28
|
-
const colorMatch = RGB_REGEX.exec(colorString);
|
|
29
|
-
if (!colorMatch) throw new Error('Failed to read color string');
|
|
30
|
-
const r = +colorMatch[1],
|
|
31
|
-
g = +colorMatch[2],
|
|
32
|
-
b = +colorMatch[3];
|
|
33
|
-
return r > 200 && g < 100 && b < 100; // Draft labels are red
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const recipientParent = ec.run('recipientParent', () => {
|
|
38
|
-
if (recipients && recipients.length > 0) return recipients[0].parentElement;
|
|
39
|
-
|
|
40
|
-
// There are no recipient elements with an email attr, which means this
|
|
41
|
-
// thread only has drafts. In order to find the recipient parent we need
|
|
42
|
-
// to work from a draft label upwards.
|
|
43
|
-
if (!(draftLabels && draftLabels.length > 0)) throw new Error('Could not locate draft labels');
|
|
44
|
-
return draftLabels[0].parentElement;
|
|
45
|
-
});
|
|
46
|
-
const inboxThreadId = ec.run('thread id', () => {
|
|
47
|
-
const m = /thread-[^:]+:[^:\d]*(\d+)/.exec(el.getAttribute('data-item-id') || '');
|
|
48
|
-
if (!m) {
|
|
49
|
-
throw new Error('thread row id regex failed');
|
|
50
|
-
}
|
|
51
|
-
return m[0];
|
|
52
|
-
});
|
|
53
|
-
const messageCountParent = ec.run('messageCountParent', () => recipientParent && recipientParent.nextElementSibling);
|
|
54
|
-
const visibleMessageCount = ec.run('visibleMessageCount', () => {
|
|
55
|
-
const messageCountEl = messageCountParent && messageCountParent.querySelector('span');
|
|
56
|
-
const match = messageCountEl && /^\((\d+)\)$/.exec(messageCountEl.textContent);
|
|
57
|
-
if (!match) return 1;
|
|
58
|
-
return parseInt(match[1]);
|
|
59
|
-
});
|
|
60
|
-
const visibleDraftCount = ec.run('visibleDraftCount', () => {
|
|
61
|
-
if (isOnlyDraft && visibleMessageCount) return visibleMessageCount;
|
|
62
|
-
if (!draftLabels) throw new Error('Could not locate draft labels');
|
|
63
|
-
return draftLabels.length;
|
|
64
|
-
});
|
|
65
|
-
const contacts = ec.run('contacts', () => {
|
|
66
|
-
if (!recipients) return null;
|
|
67
|
-
return Array.from(recipients).map(recipientEl => {
|
|
68
|
-
const emailAddress = recipientEl.getAttribute('email');
|
|
69
|
-
if (!emailAddress) return null;
|
|
70
|
-
return {
|
|
71
|
-
name: null,
|
|
72
|
-
emailAddress
|
|
73
|
-
};
|
|
74
|
-
}).filter(Boolean);
|
|
75
|
-
});
|
|
76
|
-
const labelParent = ec.run('labelParent', () => (0, _querySelectorOne.default)(el, 'div[jsaction][jslog] > div:not(:first-child):not(:last-child) > div > div[class]:not([style]):not(:first-child) > div:not(:first-child):not(:last-child)'));
|
|
77
|
-
const toolbar = ec.run('toolbar', () => (0, _querySelectorOne.default)(el, 'div[jsaction] div[jsaction] > ul[aria-label]'));
|
|
78
|
-
const elements = {
|
|
79
|
-
subject,
|
|
80
|
-
checkbox,
|
|
81
|
-
labelParent,
|
|
82
|
-
toolbar,
|
|
83
|
-
recipientParent,
|
|
84
|
-
messageCountParent
|
|
85
|
-
};
|
|
86
|
-
const score = 1 - ec.errorCount() / ec.runCount();
|
|
87
|
-
return {
|
|
88
|
-
elements,
|
|
89
|
-
attributes: {
|
|
90
|
-
isOnlyDraft,
|
|
91
|
-
inBundle,
|
|
92
|
-
inboxThreadId,
|
|
93
|
-
visibleMessageCount,
|
|
94
|
-
visibleDraftCount,
|
|
95
|
-
contacts
|
|
96
|
-
},
|
|
97
|
-
score,
|
|
98
|
-
errors: ec.getErrorLogs()
|
|
99
|
-
};
|
|
100
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = getComposeViewDriverLiveSet;
|
|
8
|
-
var _kefir = _interopRequireDefault(require("kefir"));
|
|
9
|
-
var _liveSet = _interopRequireDefault(require("live-set"));
|
|
10
|
-
var _censorHTMLtree = _interopRequireDefault(require("../../../common/censorHTMLtree"));
|
|
11
|
-
var _inboxComposeView = _interopRequireDefault(require("./views/inbox-compose-view"));
|
|
12
|
-
var _toItemWithLifetimeStream = _interopRequireDefault(require("../../lib/toItemWithLifetimeStream"));
|
|
13
|
-
var _makeElementStreamMerger = _interopRequireDefault(require("../../lib/dom/make-element-stream-merger"));
|
|
14
|
-
var _parser = _interopRequireDefault(require("./detection/compose/parser"));
|
|
15
|
-
function getComposeViewDriverLiveSet(driver, tree) {
|
|
16
|
-
const denodeify = _ref => {
|
|
17
|
-
let {
|
|
18
|
-
el,
|
|
19
|
-
removalStream
|
|
20
|
-
} = _ref;
|
|
21
|
-
return {
|
|
22
|
-
el: el.getValue(),
|
|
23
|
-
removalStream
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
const inlineCompose = (0, _toItemWithLifetimeStream.default)(tree.getAllByTag('inlineCompose')).map(denodeify);
|
|
27
|
-
const regularCompose = (0, _toItemWithLifetimeStream.default)(tree.getAllByTag('regularCompose')).map(denodeify);
|
|
28
|
-
const fullscreenCompose = (0, _toItemWithLifetimeStream.default)(tree.getAllByTag('fullscreenCompose')).map(denodeify);
|
|
29
|
-
const compose = _kefir.default.merge([inlineCompose, regularCompose.merge(fullscreenCompose).flatMap((0, _makeElementStreamMerger.default)())]);
|
|
30
|
-
const composeViewDriverStream = compose.map(_ref2 => {
|
|
31
|
-
let {
|
|
32
|
-
el,
|
|
33
|
-
removalStream
|
|
34
|
-
} = _ref2;
|
|
35
|
-
const parsed = (0, _parser.default)(el);
|
|
36
|
-
if (parsed.errors.length) {
|
|
37
|
-
driver.getLogger().errorSite(new Error('parse errors (compose)'), {
|
|
38
|
-
score: parsed.score,
|
|
39
|
-
errors: parsed.errors,
|
|
40
|
-
html: (0, _censorHTMLtree.default)(el)
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
const view = new _inboxComposeView.default(driver, el, parsed);
|
|
44
|
-
removalStream.take(1).onValue(() => view.removedFromDOM());
|
|
45
|
-
return view;
|
|
46
|
-
});
|
|
47
|
-
return new _liveSet.default({
|
|
48
|
-
scheduler: tree.getAllByTag('inlineCompose').getScheduler(),
|
|
49
|
-
read() {
|
|
50
|
-
return new Set();
|
|
51
|
-
},
|
|
52
|
-
listen(setValues, controller) {
|
|
53
|
-
setValues(new Set());
|
|
54
|
-
const sub = composeViewDriverStream.observe({
|
|
55
|
-
value(composeViewDriver) {
|
|
56
|
-
controller.add(composeViewDriver);
|
|
57
|
-
composeViewDriver.getStopper().onValue(() => {
|
|
58
|
-
controller.remove(composeViewDriver);
|
|
59
|
-
});
|
|
60
|
-
},
|
|
61
|
-
error(err) {
|
|
62
|
-
// If we get here, it's probably because of a waitFor timeout caused by
|
|
63
|
-
// us failing to find the compose parent. Let's log the results of a few
|
|
64
|
-
// similar selectors to see if our selector was maybe slightly wrong.
|
|
65
|
-
function getStatus() {
|
|
66
|
-
return {
|
|
67
|
-
mainLength: document.querySelectorAll('[role=main]').length,
|
|
68
|
-
regularLength: document.querySelectorAll('body > div[id][jsaction] > div[id][class]:not([role]) > div[class] > div[id]').length,
|
|
69
|
-
noJsActionLength: document.querySelectorAll('body > div[id] > div[id][class]:not([role]) > div[class] > div[id]').length,
|
|
70
|
-
noNotLength: document.querySelectorAll('body > div[id][jsaction] > div[id][class] > div[class] > div[id]').length,
|
|
71
|
-
noBodyDirectChildLength: document.querySelectorAll('body div[id][jsaction] > div[id][class]:not([role]) > div[class] > div[id]').length,
|
|
72
|
-
noBodyLength: document.querySelectorAll('div[id][jsaction] > div[id][class]:not([role]) > div[class] > div[id]').length,
|
|
73
|
-
// We can use class names for logging heuristics. Don't want to use
|
|
74
|
-
// them anywhere else.
|
|
75
|
-
classLength: document.querySelectorAll('div.ek div.md > div').length,
|
|
76
|
-
classEkLength: document.querySelectorAll('.ek').length,
|
|
77
|
-
classMdLength: document.querySelectorAll('.md').length,
|
|
78
|
-
composeHtml: Array.from(document.querySelectorAll('body > div[id][jsaction] > div[id][class]:not([role]) > div[class] > div[id], div.ek div.md > div')).map(el => (0, _censorHTMLtree.default)(el))
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
const startStatus = getStatus();
|
|
82
|
-
const waitTime = 180 * 1000;
|
|
83
|
-
driver.getLogger().error(err, startStatus);
|
|
84
|
-
setTimeout(() => {
|
|
85
|
-
const laterStatus = getStatus();
|
|
86
|
-
driver.getLogger().eventSdkPassive('waitfor compose data', {
|
|
87
|
-
startStatus,
|
|
88
|
-
waitTime,
|
|
89
|
-
laterStatus
|
|
90
|
-
});
|
|
91
|
-
}, waitTime);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
return () => {
|
|
95
|
-
sub.unsubscribe();
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
}
|
package/src/platform-implementation-js/dom-driver/inbox/getInboxMessageIdForInboxThreadId.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _ud = require("ud");
|
|
9
|
-
var _inboxAjax = _interopRequireDefault(require("../../driver-common/inboxAjax"));
|
|
10
|
-
var _getAccountUrlPart = _interopRequireDefault(require("../../driver-common/getAccountUrlPart"));
|
|
11
|
-
var _inboxResponseProcessor = require("./inboxResponseProcessor");
|
|
12
|
-
async function getInboxMessageIdForInboxThreadId(driver, inboxThreadId) {
|
|
13
|
-
const {
|
|
14
|
-
text
|
|
15
|
-
} = await (0, _inboxAjax.default)({
|
|
16
|
-
method: 'POST',
|
|
17
|
-
url: `https://inbox.google.com/sync${(0, _getAccountUrlPart.default)()}/i/fd`,
|
|
18
|
-
headers: {
|
|
19
|
-
'Content-Type': 'application/json',
|
|
20
|
-
'X-Framework-Xsrf-Token': await driver.getPageCommunicator().getXsrfToken(),
|
|
21
|
-
'X-Gmail-BTAI': await driver.getPageCommunicator().getBtaiHeader(),
|
|
22
|
-
'X-Google-BTD': '1'
|
|
23
|
-
},
|
|
24
|
-
data: JSON.stringify({
|
|
25
|
-
'1': [{
|
|
26
|
-
'1': inboxThreadId,
|
|
27
|
-
'3': []
|
|
28
|
-
}]
|
|
29
|
-
})
|
|
30
|
-
});
|
|
31
|
-
const [firstMessageId] = (0, _inboxResponseProcessor.extractMessageIdsFromThreadResponse)(text);
|
|
32
|
-
if (!firstMessageId) throw new Error('Failed to find inbox message ID for thread');
|
|
33
|
-
return firstMessageId;
|
|
34
|
-
}
|
|
35
|
-
var _default = (0, _ud.defn)(module, getInboxMessageIdForInboxThreadId);
|
|
36
|
-
exports.default = _default;
|