@inboxsdk/core 1.1.0 → 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 +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/injected-js/main.js +0 -9
- 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
package/src/platform-implementation-js/dom-driver/inbox/views/inbox-attachment-overlay-view.js
DELETED
|
@@ -1,83 +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 _kefir = _interopRequireDefault(require("kefir"));
|
|
10
|
-
var _kefirStopper = _interopRequireDefault(require("kefir-stopper"));
|
|
11
|
-
var _autoHtml = _interopRequireDefault(require("auto-html"));
|
|
12
|
-
var _simulateMouseEvent = require("../../../lib/dom/simulate-mouse-event");
|
|
13
|
-
var _ajax = _interopRequireDefault(require("../../../../common/ajax"));
|
|
14
|
-
class InboxAttachmentOverlayView {
|
|
15
|
-
_stopper = (0, _kefirStopper.default)();
|
|
16
|
-
constructor(driver, el, parsed, cardView) {
|
|
17
|
-
this._driver = driver;
|
|
18
|
-
this._el = el;
|
|
19
|
-
this._p = parsed;
|
|
20
|
-
this._cardView = cardView;
|
|
21
|
-
this._cardView.setOverlay(this);
|
|
22
|
-
this._cardView.getAddedButtonDescriptors().forEach(button => {
|
|
23
|
-
this.addButton(button);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
destroy() {
|
|
27
|
-
this._cardView.setOverlay(null);
|
|
28
|
-
this._stopper.destroy();
|
|
29
|
-
}
|
|
30
|
-
getStopper() {
|
|
31
|
-
return this._stopper;
|
|
32
|
-
}
|
|
33
|
-
addButton(button) {
|
|
34
|
-
const {
|
|
35
|
-
downloadButton,
|
|
36
|
-
buttonContainer
|
|
37
|
-
} = this._p.elements;
|
|
38
|
-
if (!buttonContainer) throw new Error('Missing buttonContainer, can not add button');
|
|
39
|
-
const el = document.createElement('button');
|
|
40
|
-
el.className = 'inboxsdk__attachment_overlay_button';
|
|
41
|
-
el.addEventListener('click', event => {
|
|
42
|
-
event.stopPropagation();
|
|
43
|
-
event.preventDefault();
|
|
44
|
-
if (button.onClick) {
|
|
45
|
-
button.onClick({
|
|
46
|
-
getDownloadURL: () => this.getDownloadURL()
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
el.innerHTML = (0, _autoHtml.default)`
|
|
51
|
-
<img src="${button.iconUrl}">
|
|
52
|
-
`;
|
|
53
|
-
el.setAttribute('data-tooltip-delay', '500');
|
|
54
|
-
el.setAttribute('data-tooltip-unhoverable', 'true');
|
|
55
|
-
if (downloadButton) {
|
|
56
|
-
el.setAttribute('data-tooltip-class', downloadButton.getAttribute('data-tooltip-class') || '');
|
|
57
|
-
el.setAttribute('data-tooltip-align', downloadButton.getAttribute('data-tooltip-align') || '');
|
|
58
|
-
}
|
|
59
|
-
el.setAttribute('aria-label', button.tooltip);
|
|
60
|
-
el.setAttribute('data-tooltip', button.tooltip);
|
|
61
|
-
buttonContainer.insertBefore(el, buttonContainer.lastElementChild);
|
|
62
|
-
this._stopper.onValue(() => {
|
|
63
|
-
el.remove();
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
async getDownloadURL() {
|
|
67
|
-
const {
|
|
68
|
-
downloadButton
|
|
69
|
-
} = this._p.elements;
|
|
70
|
-
if (!downloadButton) throw new Error('Could not find download button element');
|
|
71
|
-
const src = await this._driver.getPageCommunicator().clickAndGetNewIframeSrc(downloadButton);
|
|
72
|
-
const {
|
|
73
|
-
xhr
|
|
74
|
-
} = await (0, _ajax.default)({
|
|
75
|
-
url: src,
|
|
76
|
-
method: 'HEAD'
|
|
77
|
-
});
|
|
78
|
-
const url = xhr.responseURL;
|
|
79
|
-
return url;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
var _default = (0, _ud.defn)(module, InboxAttachmentOverlayView);
|
|
83
|
-
exports.default = _default;
|
|
@@ -1,45 +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 _once = _interopRequireDefault(require("lodash/once"));
|
|
10
|
-
var _kefir = _interopRequireDefault(require("kefir"));
|
|
11
|
-
var _kefirStopper = _interopRequireDefault(require("kefir-stopper"));
|
|
12
|
-
var _makeMutationObserverChunkedStream = _interopRequireDefault(require("../../../lib/dom/make-mutation-observer-chunked-stream"));
|
|
13
|
-
class InboxChatSidebarView {
|
|
14
|
-
_stopper = (0, _kefirStopper.default)();
|
|
15
|
-
constructor(el, p) {
|
|
16
|
-
this._el = el;
|
|
17
|
-
this._p = p;
|
|
18
|
-
}
|
|
19
|
-
getStopper() {
|
|
20
|
-
return this._stopper;
|
|
21
|
-
}
|
|
22
|
-
destroy() {
|
|
23
|
-
this._stopper.destroy();
|
|
24
|
-
}
|
|
25
|
-
getMode() {
|
|
26
|
-
const parent = this._el.parentElement;
|
|
27
|
-
const parentComputedStyle = window.getComputedStyle(parent);
|
|
28
|
-
if (parseInt(parentComputedStyle.bottom) === 0) {
|
|
29
|
-
return 'SIDEBAR';
|
|
30
|
-
}
|
|
31
|
-
if (parseInt(parentComputedStyle.top) > 0) {
|
|
32
|
-
return 'DROPDOWN';
|
|
33
|
-
}
|
|
34
|
-
return 'HIDDEN';
|
|
35
|
-
}
|
|
36
|
-
getModeStream = (0, _once.default)(() => {
|
|
37
|
-
const parent = this._el.parentElement;
|
|
38
|
-
return (0, _makeMutationObserverChunkedStream.default)(parent, {
|
|
39
|
-
attributes: true,
|
|
40
|
-
attributeFilter: ['class']
|
|
41
|
-
}).toProperty(() => null).map(() => this.getMode()).skipDuplicates().takeUntilBy(this._stopper);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
var _default = (0, _ud.defn)(module, InboxChatSidebarView);
|
|
45
|
-
exports.default = _default;
|
|
@@ -1,116 +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 _includes = _interopRequireDefault(require("lodash/includes"));
|
|
9
|
-
var _ud = require("ud");
|
|
10
|
-
var _kefir = _interopRequireDefault(require("kefir"));
|
|
11
|
-
var _fromEventTargetCapture = _interopRequireDefault(require("../../../lib/from-event-target-capture"));
|
|
12
|
-
var _insertElementInOrder = _interopRequireDefault(require("../../../lib/dom/insert-element-in-order"));
|
|
13
|
-
var _dropdownView = _interopRequireDefault(require("../../../widgets/buttons/dropdown-view"));
|
|
14
|
-
var _inboxDropdownView = _interopRequireDefault(require("./inbox-dropdown-view"));
|
|
15
|
-
var _inboxTooltipView = _interopRequireDefault(require("./inbox-tooltip-view"));
|
|
16
|
-
let insertionOrderHint = 0;
|
|
17
|
-
class InboxComposeButtonView {
|
|
18
|
-
constructor(composeView, buttonDescriptor, groupOrderHint, extraOnClickOptions) {
|
|
19
|
-
this._tooltip = null;
|
|
20
|
-
this._composeView = composeView;
|
|
21
|
-
const buttonEl = this._buttonEl = document.createElement('div');
|
|
22
|
-
buttonEl.setAttribute('role', 'button');
|
|
23
|
-
buttonEl.setAttribute('data-insertion-order-hint', String(insertionOrderHint++));
|
|
24
|
-
buttonEl.setAttribute('data-group-order-hint', groupOrderHint);
|
|
25
|
-
buttonEl.tabIndex = 0;
|
|
26
|
-
buttonEl.className = 'inboxsdk__button_icon';
|
|
27
|
-
const img = document.createElement('img');
|
|
28
|
-
img.className = 'inboxsdk__button_iconImg';
|
|
29
|
-
let onClick = ignored => {};
|
|
30
|
-
let hasDropdown = false;
|
|
31
|
-
let dropdown = null;
|
|
32
|
-
_kefir.default.merge([_kefir.default.fromEvents(buttonEl, 'click'), (0, _fromEventTargetCapture.default)(buttonEl, 'keyup').filter(e => (0, _includes.default)([32 /*space*/, 13 /*enter*/], e.which))]).onValue(event => {
|
|
33
|
-
event.preventDefault();
|
|
34
|
-
event.stopPropagation();
|
|
35
|
-
this.closeTooltip();
|
|
36
|
-
if (hasDropdown) {
|
|
37
|
-
if (dropdown) {
|
|
38
|
-
dropdown.close();
|
|
39
|
-
return;
|
|
40
|
-
} else {
|
|
41
|
-
this._buttonEl.classList.add('inboxsdk__active');
|
|
42
|
-
dropdown = new _dropdownView.default(new _inboxDropdownView.default(), buttonEl);
|
|
43
|
-
dropdown.setPlacementOptions({
|
|
44
|
-
position: 'top',
|
|
45
|
-
hAlign: 'left',
|
|
46
|
-
vAlign: 'bottom',
|
|
47
|
-
buffer: 5
|
|
48
|
-
});
|
|
49
|
-
dropdown.on('destroy', () => {
|
|
50
|
-
this._buttonEl.classList.remove('inboxsdk__active');
|
|
51
|
-
dropdown = null;
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
onClick(Object.assign({
|
|
56
|
-
dropdown
|
|
57
|
-
}, extraOnClickOptions));
|
|
58
|
-
});
|
|
59
|
-
let lastOrderHint = null;
|
|
60
|
-
buttonDescriptor.takeUntilBy(composeView.getStopper()).onValue(buttonDescriptor => {
|
|
61
|
-
if (!buttonDescriptor) {
|
|
62
|
-
buttonEl.remove();
|
|
63
|
-
lastOrderHint = null;
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
hasDropdown = buttonDescriptor.hasDropdown;
|
|
67
|
-
buttonEl.title = buttonDescriptor.title;
|
|
68
|
-
buttonEl.className = 'inboxsdk__button_icon ' + (buttonDescriptor.iconClass || '');
|
|
69
|
-
onClick = buttonDescriptor.onClick;
|
|
70
|
-
if (buttonDescriptor.iconUrl) {
|
|
71
|
-
img.src = buttonDescriptor.iconUrl;
|
|
72
|
-
buttonEl.appendChild(img);
|
|
73
|
-
} else {
|
|
74
|
-
img.remove();
|
|
75
|
-
}
|
|
76
|
-
const orderHint = buttonDescriptor.orderHint || 0;
|
|
77
|
-
if (lastOrderHint !== orderHint) {
|
|
78
|
-
lastOrderHint = orderHint;
|
|
79
|
-
buttonEl.setAttribute('data-order-hint', String(orderHint));
|
|
80
|
-
(0, _insertElementInOrder.default)(composeView.getModifierButtonContainer(), buttonEl);
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
composeView.getStopper().onValue(() => {
|
|
84
|
-
this.closeTooltip();
|
|
85
|
-
buttonEl.remove();
|
|
86
|
-
if (dropdown) {
|
|
87
|
-
dropdown.close();
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
showTooltip(tooltipDescriptor) {
|
|
92
|
-
if (this._composeView.isInlineReplyForm()) {
|
|
93
|
-
// In Inbox, if you haven't interacted with an inline compose yet, then
|
|
94
|
-
// it will auto-close as soon as anything else including the tooltip is
|
|
95
|
-
// interacted with. Focusing the inline compose is enough to make Inbox
|
|
96
|
-
// think it's been interacted with and to avoid that behavior.
|
|
97
|
-
this._composeView.getElement().focus();
|
|
98
|
-
}
|
|
99
|
-
if (this._tooltip) {
|
|
100
|
-
this.closeTooltip();
|
|
101
|
-
}
|
|
102
|
-
const tooltip = this._tooltip = new _inboxTooltipView.default(this._buttonEl, tooltipDescriptor);
|
|
103
|
-
tooltip.getStopper().onValue(() => {
|
|
104
|
-
if (this._tooltip === tooltip) {
|
|
105
|
-
this._tooltip = null;
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
closeTooltip() {
|
|
110
|
-
if (this._tooltip) {
|
|
111
|
-
this._tooltip.destroy();
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
var _default = (0, _ud.defn)(module, InboxComposeButtonView);
|
|
116
|
-
exports.default = _default;
|