@inboxsdk/core 1.1.0 → 1.1.2
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 +7 -34
- package/inboxsdk.js.map +1 -1
- package/package.json +1 -1
- package/pageWorld.js +1 -1
- package/pageWorld.js.map +1 -1
- package/src/common/version.d.ts.map +1 -1
- package/src/common/version.js +3 -1
- package/src/injected-js/main.js +0 -9
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.test.js +6 -2
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/index.js +4 -2
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.js +4 -2
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.test.js +6 -2
- package/src/platform-implementation-js/driver-common/sidebar/ContentPanelViewDriver.js +2 -2
- package/src/platform-implementation-js/driver-common/sidebar/constants.d.ts +9 -0
- package/src/platform-implementation-js/driver-common/sidebar/constants.d.ts.map +1 -0
- package/src/platform-implementation-js/driver-common/sidebar/constants.js +26 -0
- package/src/platform-implementation-js/lib/idMap.d.ts +7 -0
- package/src/platform-implementation-js/lib/idMap.d.ts.map +1 -1
- package/src/platform-implementation-js/lib/idMap.js +35 -0
- package/src/platform-implementation-js/platform-implementation.d.ts +0 -3
- package/src/platform-implementation-js/platform-implementation.js +1 -9
- 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/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/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 -863
- 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 -296
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxToolbarButtonView.js +0 -91
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxToolbarView.js +0 -53
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-sidebar-view.js +0 -271
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-toolbar-button-view.js +0 -160
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-toolbar-tooltip-view.js +0 -57
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-attachment-card-view.js +0 -197
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-attachment-overlay-view.js +0 -83
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-chat-sidebar-view.js +0 -45
- 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 -842
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-custom-route-view.js +0 -75
- 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 -63
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-message-view.js +0 -274
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-modal-view.js +0 -112
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-route-view.js +0 -96
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-row-view.js +0 -315
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-view.js +0 -218
- 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 -127
- package/src/platform-implementation-js/dom-driver/inbox/views/inboxNavItemView.js +0 -311
- package/src/platform-implementation-js/dom-driver/inbox/waitForAnimationClickBlockerGone.js +0 -26
|
@@ -1,38 +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 = addNavItem;
|
|
8
|
-
var _kefir = _interopRequireDefault(require("kefir"));
|
|
9
|
-
var _inboxNavItemView = _interopRequireDefault(require("./views/inboxNavItemView"));
|
|
10
|
-
var _insertElementInOrder = _interopRequireDefault(require("../../lib/dom/insert-element-in-order"));
|
|
11
|
-
var _querySelectorOrFail = _interopRequireDefault(require("../../lib/dom/querySelectorOrFail"));
|
|
12
|
-
var _toItemWithLifetimeStream = _interopRequireDefault(require("../../lib/toItemWithLifetimeStream"));
|
|
13
|
-
function addNavItem(navItemDescriptor, leftNavLiveSet, containerEl) {
|
|
14
|
-
const inboxNavItemView = new _inboxNavItemView.default(navItemDescriptor, 0);
|
|
15
|
-
(0, _toItemWithLifetimeStream.default)(leftNavLiveSet).take(1).map(_ref => {
|
|
16
|
-
let {
|
|
17
|
-
el: node
|
|
18
|
-
} = _ref;
|
|
19
|
-
return node.getValue();
|
|
20
|
-
}).onValue(el => {
|
|
21
|
-
inboxNavItemView.getEventStream().filter(event => event.eventName === 'orderChanged').onValue(() => (0, _insertElementInOrder.default)(containerEl, inboxNavItemView.getElement()));
|
|
22
|
-
if (!el.contains(containerEl)) {
|
|
23
|
-
const existingCustomSections = el.querySelectorAll('.inboxsdk__navItem_appContainer');
|
|
24
|
-
if (existingCustomSections.length > 0) {
|
|
25
|
-
const lastCustomSection = existingCustomSections[existingCustomSections.length - 1];
|
|
26
|
-
lastCustomSection.insertAdjacentElement('afterend', containerEl);
|
|
27
|
-
} else {
|
|
28
|
-
// Locate <ul> with native folders by finding draft icon image
|
|
29
|
-
const draftsImg = (0, _querySelectorOrFail.default)(el, 'ul > li > img[src*="ic_draft"]');
|
|
30
|
-
const nativeFolderSection = draftsImg.parentElement && draftsImg.parentElement.parentElement;
|
|
31
|
-
if (!nativeFolderSection) throw new Error('could not locate insertion point');
|
|
32
|
-
nativeFolderSection.insertAdjacentElement('afterend', containerEl);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
(0, _insertElementInOrder.default)(containerEl, inboxNavItemView.getElement());
|
|
36
|
-
});
|
|
37
|
-
return inboxNavItemView;
|
|
38
|
-
}
|
|
@@ -1,55 +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 = addRecipientRow;
|
|
8
|
-
var _closestNg = _interopRequireDefault(require("closest-ng"));
|
|
9
|
-
var _kefir = _interopRequireDefault(require("kefir"));
|
|
10
|
-
var _kefirStopper = _interopRequireDefault(require("kefir-stopper"));
|
|
11
|
-
const createRowElement = _ref => {
|
|
12
|
-
let {
|
|
13
|
-
labelText,
|
|
14
|
-
el
|
|
15
|
-
} = _ref;
|
|
16
|
-
const row = document.createElement('div');
|
|
17
|
-
const label = document.createElement('span');
|
|
18
|
-
const content = document.createElement('div');
|
|
19
|
-
row.classList.add('inboxsdk__recipient_row');
|
|
20
|
-
label.classList.add('inboxsdk__recipient_label');
|
|
21
|
-
content.classList.add('inboxsdk__recipient_content');
|
|
22
|
-
if (labelText) {
|
|
23
|
-
label.textContent = labelText;
|
|
24
|
-
row.appendChild(label);
|
|
25
|
-
}
|
|
26
|
-
if (el) {
|
|
27
|
-
content.appendChild(el);
|
|
28
|
-
row.appendChild(content);
|
|
29
|
-
}
|
|
30
|
-
return row;
|
|
31
|
-
};
|
|
32
|
-
function addRecipientRow(inboxComposeView, recipientRowOptionStream) {
|
|
33
|
-
let row = null;
|
|
34
|
-
const insertionPoint = inboxComposeView.getBCCRow();
|
|
35
|
-
const destroyStopper = (0, _kefirStopper.default)();
|
|
36
|
-
recipientRowOptionStream.takeUntilBy(inboxComposeView.getStopper()).takeUntilBy(destroyStopper).onValue(options => {
|
|
37
|
-
if (row) {
|
|
38
|
-
row.remove();
|
|
39
|
-
row = null;
|
|
40
|
-
}
|
|
41
|
-
if (options) {
|
|
42
|
-
row = createRowElement(options);
|
|
43
|
-
insertionPoint.insertAdjacentElement('afterend', row);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
destroyStopper.merge(inboxComposeView.getStopper()).take(1).onValue(() => {
|
|
47
|
-
if (row) {
|
|
48
|
-
row.remove();
|
|
49
|
-
row = null;
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
return () => {
|
|
53
|
-
destroyStopper.destroy();
|
|
54
|
-
};
|
|
55
|
-
}
|
|
@@ -1,19 +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 = createLink;
|
|
8
|
-
var _includes = _interopRequireDefault(require("lodash/includes"));
|
|
9
|
-
var _populateRouteID = _interopRequireDefault(require("../../lib/populateRouteID"));
|
|
10
|
-
var _router = require("../../constants/router");
|
|
11
|
-
function createLink(driver, routeID, params) {
|
|
12
|
-
if ((0, _includes.default)(Object.values(_router.NATIVE_ROUTE_IDS), routeID)) {
|
|
13
|
-
throw new Error('NativeRouteIDs are not currently supported in Inbox');
|
|
14
|
-
}
|
|
15
|
-
if (!driver.getCustomRouteIDs().has(routeID)) {
|
|
16
|
-
throw new Error(`Invalid routeID: ${routeID}`);
|
|
17
|
-
}
|
|
18
|
-
return '#' + (0, _populateRouteID.default)(routeID, params);
|
|
19
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _createLink = _interopRequireDefault(require("./createLink"));
|
|
5
|
-
function makeDriver() {
|
|
6
|
-
const customRouteIDs = new Set();
|
|
7
|
-
return {
|
|
8
|
-
getCustomRouteIDs: () => customRouteIDs
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
test('works for custom view', () => {
|
|
12
|
-
const driver = makeDriver();
|
|
13
|
-
driver.getCustomRouteIDs().add('example/:bar');
|
|
14
|
-
expect((0, _createLink.default)(driver, 'example/:bar', {
|
|
15
|
-
bar: 'foo'
|
|
16
|
-
})).toBe('#example/foo');
|
|
17
|
-
});
|
|
18
|
-
test('fails for unknown route id', () => {
|
|
19
|
-
expect(() => (0, _createLink.default)(makeDriver(), 'example/:bar', {
|
|
20
|
-
bar: 'foo'
|
|
21
|
-
})).toThrowError('Invalid routeID: example/:bar');
|
|
22
|
-
});
|
|
23
|
-
test('fails for native route ids', () => {
|
|
24
|
-
expect(() => (0, _createLink.default)(makeDriver(), 'inbox/:threadID', {
|
|
25
|
-
threadID: 'abc'
|
|
26
|
-
})).toThrowError('NativeRouteIDs are not currently supported in Inbox');
|
|
27
|
-
});
|
package/src/platform-implementation-js/dom-driver/inbox/detection/appToolbarLocation/parser.js
DELETED
|
@@ -1,43 +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('appToolbarLocation');
|
|
12
|
-
ec.run('children check', () => {
|
|
13
|
-
if (el.childElementCount < 2) {
|
|
14
|
-
throw new Error('expected more children');
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
ec.run('position check', () => {
|
|
18
|
-
const rect = el.getBoundingClientRect();
|
|
19
|
-
if (rect.top > 100) {
|
|
20
|
-
throw new Error('expected element to border top of screen');
|
|
21
|
-
}
|
|
22
|
-
if (window.innerWidth - rect.right > 100) {
|
|
23
|
-
throw new Error('expected element to border right side of screen');
|
|
24
|
-
}
|
|
25
|
-
if (rect.width > 500) {
|
|
26
|
-
throw new Error('expected element to span only the right of the screen');
|
|
27
|
-
}
|
|
28
|
-
if (rect.height > 150) {
|
|
29
|
-
throw new Error('expected element to span only the right of the screen');
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
const chatSidebarButton = ec.run('chatSidebarButton', () => (0, _querySelectorOne.default)(el, 'div[role=button][jsaction*="global.toggle_chat_roster"]'));
|
|
33
|
-
const score = 1 - ec.errorCount() / ec.runCount();
|
|
34
|
-
return {
|
|
35
|
-
elements: {
|
|
36
|
-
chatSidebarButton
|
|
37
|
-
},
|
|
38
|
-
score,
|
|
39
|
-
errors: ec.getErrorLogs()
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/*:: const x = parser(({}:any)); */
|
|
@@ -1,34 +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
|
-
var _bignumber = _interopRequireDefault(require("bignumber.js"));
|
|
11
|
-
function parser(el) {
|
|
12
|
-
const ec = new _ErrorCollector.default('attachmentCard');
|
|
13
|
-
ec.run('tabindex', () => {
|
|
14
|
-
if (!el.hasAttribute('tabindex')) throw new Error('expected tabindex');
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
// Very different cards like those for youtube links aren't detected by the
|
|
18
|
-
// watcher/finder. Google drive cards aren't distinguishable from attachment
|
|
19
|
-
// cards in the html, so we just expose them as FILE cards. The only issue
|
|
20
|
-
// for applications is that cardView.addButton() is a no-op on drive cards.
|
|
21
|
-
const type = 'FILE';
|
|
22
|
-
const elements = {};
|
|
23
|
-
const score = 1 - ec.errorCount() / ec.runCount();
|
|
24
|
-
return {
|
|
25
|
-
elements,
|
|
26
|
-
attributes: {
|
|
27
|
-
type
|
|
28
|
-
},
|
|
29
|
-
score,
|
|
30
|
-
errors: ec.getErrorLogs()
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/*:: const x = parser(({}:any)); */
|
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
|
-
}
|