@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
|
@@ -1,78 +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 _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
10
|
-
var _updateIcon = _interopRequireDefault(require("../../../driver-common/update-icon"));
|
|
11
|
-
var _querySelectorOrFail = _interopRequireDefault(require("../../../lib/dom/querySelectorOrFail"));
|
|
12
|
-
class InboxLabelView {
|
|
13
|
-
constructor() {
|
|
14
|
-
let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
15
|
-
this._element = document.createElement('div');
|
|
16
|
-
this._element.className = 'inboxsdk__inbox_thread_row_label ' + (opts.classes || []).join(' ');
|
|
17
|
-
this._element.innerHTML = '<span></span>';
|
|
18
|
-
this._labelDescriptor = {};
|
|
19
|
-
this._iconSettings = {};
|
|
20
|
-
}
|
|
21
|
-
getElement() {
|
|
22
|
-
return this._element;
|
|
23
|
-
}
|
|
24
|
-
updateLabelDescriptor(labelDescriptor) {
|
|
25
|
-
this._handleNewLabelDescriptor(labelDescriptor);
|
|
26
|
-
}
|
|
27
|
-
_handleNewLabelDescriptor(labelDescriptor) {
|
|
28
|
-
if (!labelDescriptor) {
|
|
29
|
-
this._labelDescriptor = {};
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
labelDescriptor = Object.assign({
|
|
33
|
-
foregroundColor: 'rgb(102, 102, 102)',
|
|
34
|
-
//dark grey
|
|
35
|
-
backgroundColor: 'rgb(221, 221, 221)' //light grey
|
|
36
|
-
}, labelDescriptor);
|
|
37
|
-
if ((0, _isEqual.default)(this._labelDescriptor, labelDescriptor)) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
(0, _updateIcon.default)(this._iconSettings, this._element, false, labelDescriptor.iconClass, labelDescriptor.iconUrl);
|
|
41
|
-
if (labelDescriptor.iconClass || labelDescriptor.iconUrl) {
|
|
42
|
-
this._element.classList.add('inboxsdk__label_has_icon');
|
|
43
|
-
} else {
|
|
44
|
-
this._element.classList.remove('inboxsdk__label_has_icon');
|
|
45
|
-
}
|
|
46
|
-
this._updateBackgroundColor(labelDescriptor.backgroundColor);
|
|
47
|
-
this._updateForegroundColor(labelDescriptor.foregroundColor);
|
|
48
|
-
this._updateIconBackgroundColor(labelDescriptor.iconBackgroundColor);
|
|
49
|
-
this._updateTitle(labelDescriptor.title);
|
|
50
|
-
this._labelDescriptor = labelDescriptor;
|
|
51
|
-
}
|
|
52
|
-
_updateBackgroundColor(backgroundColor) {
|
|
53
|
-
if (this._labelDescriptor.backgroundColor === backgroundColor) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
this._element.style.backgroundColor = backgroundColor;
|
|
57
|
-
}
|
|
58
|
-
_updateForegroundColor(foregroundColor) {
|
|
59
|
-
if (this._labelDescriptor.foregroundColor === foregroundColor) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
this._element.style.color = foregroundColor;
|
|
63
|
-
}
|
|
64
|
-
_updateIconBackgroundColor(iconBackgroundColor) {
|
|
65
|
-
const icon = this.getElement().querySelector('.inboxsdk__button_icon');
|
|
66
|
-
if (icon) {
|
|
67
|
-
icon.style.backgroundColor = iconBackgroundColor || '';
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
_updateTitle(title) {
|
|
71
|
-
if (this._labelDescriptor.title === title) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
(0, _querySelectorOrFail.default)(this._element, 'span').textContent = title;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
var _default = (0, _ud.defn)(module, InboxLabelView);
|
|
78
|
-
exports.default = _default;
|
|
@@ -1,296 +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 _asap = _interopRequireDefault(require("asap"));
|
|
9
|
-
var _ud = require("ud");
|
|
10
|
-
var _find = _interopRequireDefault(require("lodash/find"));
|
|
11
|
-
var _react = _interopRequireDefault(require("react"));
|
|
12
|
-
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
13
|
-
var _kefir = _interopRequireDefault(require("kefir"));
|
|
14
|
-
var _kefirStopper = _interopRequireDefault(require("kefir-stopper"));
|
|
15
|
-
var _makeMutationObserverChunkedStream = _interopRequireDefault(require("../../../lib/dom/make-mutation-observer-chunked-stream"));
|
|
16
|
-
var _querySelectorOrFail = _interopRequireDefault(require("../../../lib/dom/querySelectorOrFail"));
|
|
17
|
-
var _fromEventTargetCapture = _interopRequireDefault(require("../../../lib/from-event-target-capture"));
|
|
18
|
-
var _ElementContainer = _interopRequireDefault(require("../../../lib/react/ElementContainer"));
|
|
19
|
-
var _reemitClickEventForReact = _interopRequireDefault(require("../../../lib/dom/reemitClickEventForReact"));
|
|
20
|
-
var _kefirBus = _interopRequireDefault(require("kefir-bus"));
|
|
21
|
-
class InboxMoleViewDriver {
|
|
22
|
-
_stopper = (0, _kefirStopper.default)();
|
|
23
|
-
_eventStream = (0, _kefirBus.default)();
|
|
24
|
-
constructor(options, driver) {
|
|
25
|
-
this;
|
|
26
|
-
this._options = options;
|
|
27
|
-
this._driver = driver;
|
|
28
|
-
this._element = document.createElement('div');
|
|
29
|
-
this._element.className = 'inboxsdk__mole_view ' + (options.className || '');
|
|
30
|
-
this._element.setAttribute('jsaction', 'global.none');
|
|
31
|
-
this._title = String(this._options.title || '');
|
|
32
|
-
this._render();
|
|
33
|
-
this._element.firstElementChild.style.zIndex = '1';
|
|
34
|
-
_kefir.default.fromEvents(this._element, 'click').takeUntilBy(this._stopper).onValue(event => {
|
|
35
|
-
(0, _reemitClickEventForReact.default)(event);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
_render() {
|
|
39
|
-
_reactDom.default.render( /*#__PURE__*/_react.default.createElement(MoleViewContents, {
|
|
40
|
-
title: this._title,
|
|
41
|
-
titleEl: this._options.titleEl,
|
|
42
|
-
el: this._options.el,
|
|
43
|
-
chrome: this._options.chrome,
|
|
44
|
-
titleButtons: this._options.titleButtons,
|
|
45
|
-
minimized: this.getMinimized(),
|
|
46
|
-
onClose: () => {
|
|
47
|
-
// React doesn't like it when you unmount a component within a React
|
|
48
|
-
// event handler, so we do it async.
|
|
49
|
-
(0, _asap.default)(() => {
|
|
50
|
-
this.destroy();
|
|
51
|
-
});
|
|
52
|
-
},
|
|
53
|
-
onSetMinimize: minimized => this.setMinimized(minimized)
|
|
54
|
-
}), this._element);
|
|
55
|
-
}
|
|
56
|
-
show() {
|
|
57
|
-
if (this._element.parentElement) {
|
|
58
|
-
throw new Error('show was called twice');
|
|
59
|
-
}
|
|
60
|
-
const container = document.getElementById('OPOhoe');
|
|
61
|
-
if (!container) {
|
|
62
|
-
const err = new Error('could find element to insert moleview into');
|
|
63
|
-
this._driver.getLogger().error(err);
|
|
64
|
-
throw err;
|
|
65
|
-
}
|
|
66
|
-
container.insertBefore(this._element, container.firstElementChild);
|
|
67
|
-
|
|
68
|
-
// The extension might not populate the element until after creating the
|
|
69
|
-
// mole, so calculate the width after that.
|
|
70
|
-
(0, _asap.default)(() => {
|
|
71
|
-
this._setupWidth();
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
// Keep the mole as the first item in the list
|
|
75
|
-
(0, _makeMutationObserverChunkedStream.default)(container, {
|
|
76
|
-
childList: true
|
|
77
|
-
}).takeUntilBy(this._stopper).onValue(muts => {
|
|
78
|
-
const composeWasAdded = muts.some(mutation => Array.prototype.some.call(mutation.addedNodes, node => node.nodeType === 1 && !node.classList.contains('inboxsdk__mole_view')));
|
|
79
|
-
if (composeWasAdded) {
|
|
80
|
-
container.insertBefore(this._element, container.firstElementChild);
|
|
81
|
-
}
|
|
82
|
-
this._setupWidth();
|
|
83
|
-
});
|
|
84
|
-
(0, _makeMutationObserverChunkedStream.default)(this._options.el, {
|
|
85
|
-
attributes: true,
|
|
86
|
-
attributeFilter: ['class', 'style']
|
|
87
|
-
}).takeUntilBy(this._stopper).onValue(() => {
|
|
88
|
-
this._setupWidth();
|
|
89
|
-
});
|
|
90
|
-
_kefir.default.fromEvents(this._element, 'click').merge((0, _fromEventTargetCapture.default)(this._element, 'focus')).takeUntilBy(this._stopper).onValue(() => {
|
|
91
|
-
this._bringToFront();
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
_setupWidth() {
|
|
95
|
-
const naturalWidth = (0, _querySelectorOrFail.default)(this._element, '.inboxsdk__mole_view_inner').getBoundingClientRect().width;
|
|
96
|
-
|
|
97
|
-
// Actually set the width asynchronously in order to reduce thrashing when multiple moles are present
|
|
98
|
-
// and having _setupWidth called on all together.
|
|
99
|
-
(0, _asap.default)(() => {
|
|
100
|
-
this._element.style.width = naturalWidth + 'px';
|
|
101
|
-
|
|
102
|
-
// If this mole is the leftmost mole/compose element in the mole-container, give it some padding-left
|
|
103
|
-
// so it can't go off the screen's edge. Inbox does the same for its composeviews.
|
|
104
|
-
const parent = this._element.parentElement;
|
|
105
|
-
if (parent && Array.prototype.indexOf.call(parent.children, this._element) === parent.children.length - 2) {
|
|
106
|
-
this._element.style.paddingLeft = naturalWidth + 'px';
|
|
107
|
-
} else {
|
|
108
|
-
this._element.style.paddingLeft = '';
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
_bringToFront() {
|
|
113
|
-
if (this._element.classList.contains('inboxsdk__mole_at_front')) return;
|
|
114
|
-
this._element.classList.add('inboxsdk__mole_at_front');
|
|
115
|
-
const container = this._element.parentElement;
|
|
116
|
-
if (!(container instanceof HTMLElement)) throw new Error('mole not in document');
|
|
117
|
-
const selfIndex = Array.prototype.indexOf.call(container.children, this._element);
|
|
118
|
-
if (selfIndex < 0) throw new Error('should not happen');
|
|
119
|
-
const count = container.children.length;
|
|
120
|
-
const firstComposeParent = (0, _find.default)(container.children, isComposeParentElement);
|
|
121
|
-
if (firstComposeParent) {
|
|
122
|
-
// emit a fake focus event so Inbox puts this (the right-most) composeview on top
|
|
123
|
-
firstComposeParent.dispatchEvent(new FocusEvent('focus'));
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// Put all the moles into the proper order.
|
|
127
|
-
Array.prototype.forEach.call(container.children, (child, i) => {
|
|
128
|
-
if (!child.classList.contains('inboxsdk__mole_view')) return;
|
|
129
|
-
if (child !== this._element) {
|
|
130
|
-
child.classList.remove('inboxsdk__mole_at_front');
|
|
131
|
-
}
|
|
132
|
-
const zIndexedChild = (0, _find.default)(child.children, child => child.style.zIndex);
|
|
133
|
-
if (!zIndexedChild) return;
|
|
134
|
-
zIndexedChild.style.zIndex = String(i > selfIndex ? count - (i - selfIndex) : count);
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
// Wait until the next time either a compose is brought to the front or a
|
|
138
|
-
// mole is brought to the front. If a compose was brought to the front, then
|
|
139
|
-
// we need to put all the moles to the back. If a mole was brought to the
|
|
140
|
-
// front, then do nothing because that mole's _bringToFront function will
|
|
141
|
-
// handle the composes and the moles.
|
|
142
|
-
_kefir.default.merge([
|
|
143
|
-
// The user tried to focus the compose that Inbox still thinks is at the
|
|
144
|
-
// front.
|
|
145
|
-
!firstComposeParent ? null : (0, _fromEventTargetCapture.default)(firstComposeParent, 'focus'),
|
|
146
|
-
// A new compose was added.
|
|
147
|
-
(0, _makeMutationObserverChunkedStream.default)(container, {
|
|
148
|
-
childList: true
|
|
149
|
-
}).filter(mutations => mutations.some(mutation => mutation.addedNodes.length > 0))].concat(Array.prototype.map.call(container.children, el => {
|
|
150
|
-
const zIndexedChild = (0, _find.default)(el.children, child => child.style.zIndex);
|
|
151
|
-
if (!zIndexedChild) return null;
|
|
152
|
-
const currentZindex = zIndexedChild.style.zIndex;
|
|
153
|
-
return (0, _makeMutationObserverChunkedStream.default)(zIndexedChild, {
|
|
154
|
-
attributes: true,
|
|
155
|
-
attributeFilter: ['style']
|
|
156
|
-
}).filter(() => zIndexedChild.style.zIndex !== currentZindex);
|
|
157
|
-
})).filter(Boolean)).takeUntilBy(this._stopper).take(1).onValue(() => {
|
|
158
|
-
if (this._element.classList.contains('inboxsdk__mole_at_front')) {
|
|
159
|
-
this._element.classList.remove('inboxsdk__mole_at_front');
|
|
160
|
-
Array.prototype.forEach.call(container.children, child => {
|
|
161
|
-
if (isComposeParentElement(child)) return;
|
|
162
|
-
const zIndexedChild = (0, _find.default)(child.children, child => child.style.zIndex);
|
|
163
|
-
if (!zIndexedChild) return;
|
|
164
|
-
zIndexedChild.style.zIndex = '1';
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
setTitle(title) {
|
|
170
|
-
this._title = String(title);
|
|
171
|
-
this._render();
|
|
172
|
-
}
|
|
173
|
-
setMinimized(minimized) {
|
|
174
|
-
if (minimized) {
|
|
175
|
-
this._element.classList.add('inboxsdk__minimized');
|
|
176
|
-
this._render();
|
|
177
|
-
this._eventStream.emit({
|
|
178
|
-
eventName: 'minimize'
|
|
179
|
-
});
|
|
180
|
-
} else {
|
|
181
|
-
this._element.classList.remove('inboxsdk__minimized');
|
|
182
|
-
this._render();
|
|
183
|
-
this._eventStream.emit({
|
|
184
|
-
eventName: 'restore'
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
getMinimized() {
|
|
189
|
-
return this._element.classList.contains('inboxsdk__minimized');
|
|
190
|
-
}
|
|
191
|
-
getEventStream() {
|
|
192
|
-
return this._eventStream;
|
|
193
|
-
}
|
|
194
|
-
destroy() {
|
|
195
|
-
_reactDom.default.unmountComponentAtNode(this._element);
|
|
196
|
-
this._stopper.destroy();
|
|
197
|
-
this._eventStream.end();
|
|
198
|
-
this._element.remove();
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
function isComposeParentElement(el) {
|
|
202
|
-
return !el.classList.contains('inboxsdk__mole_view') && el.hasAttribute('jsaction');
|
|
203
|
-
}
|
|
204
|
-
var _default = (0, _ud.defn)(module, InboxMoleViewDriver);
|
|
205
|
-
exports.default = _default;
|
|
206
|
-
class MoleViewContents extends _react.default.Component {
|
|
207
|
-
render() {
|
|
208
|
-
let titlebar = null;
|
|
209
|
-
if (this.props.chrome !== false) {
|
|
210
|
-
let title;
|
|
211
|
-
if (this.props.minimized && this.props.minimizedTitleEl) {
|
|
212
|
-
title = /*#__PURE__*/_react.default.createElement(_ElementContainer.default, {
|
|
213
|
-
className: "inboxsdk__mole_view_title",
|
|
214
|
-
el: this.props.minimizedTitleEl
|
|
215
|
-
});
|
|
216
|
-
} else if (this.props.titleEl) {
|
|
217
|
-
title = /*#__PURE__*/_react.default.createElement(_ElementContainer.default, {
|
|
218
|
-
className: "inboxsdk__mole_view_title",
|
|
219
|
-
el: this.props.titleEl
|
|
220
|
-
});
|
|
221
|
-
} else {
|
|
222
|
-
title = /*#__PURE__*/_react.default.createElement("div", {
|
|
223
|
-
className: "inboxsdk__mole_view_title"
|
|
224
|
-
}, this.props.title);
|
|
225
|
-
}
|
|
226
|
-
const titleButtons = (this.props.titleButtons || []).map((descriptor, i) => {
|
|
227
|
-
return /*#__PURE__*/_react.default.createElement("button", {
|
|
228
|
-
type: "button",
|
|
229
|
-
key: i,
|
|
230
|
-
title: descriptor.title,
|
|
231
|
-
className: "inboxsdk__mole_custom_title_button",
|
|
232
|
-
onClick: event => {
|
|
233
|
-
event.stopPropagation();
|
|
234
|
-
descriptor.onClick();
|
|
235
|
-
}
|
|
236
|
-
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
237
|
-
className: descriptor.iconClass,
|
|
238
|
-
src: descriptor.iconUrl,
|
|
239
|
-
alt: "",
|
|
240
|
-
"aria-hidden": "true"
|
|
241
|
-
}));
|
|
242
|
-
});
|
|
243
|
-
titlebar = /*#__PURE__*/_react.default.createElement("div", {
|
|
244
|
-
className: "inboxsdk__mole_view_titlebar",
|
|
245
|
-
onClick: () => {
|
|
246
|
-
if (this.props.minimized) {
|
|
247
|
-
this.props.onSetMinimize(false);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}, title, /*#__PURE__*/_react.default.createElement("div", {
|
|
251
|
-
className: "inboxsdk__mole_title_buttons"
|
|
252
|
-
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
253
|
-
type: "button",
|
|
254
|
-
style: {
|
|
255
|
-
display: this.props.minimized ? 'none' : ''
|
|
256
|
-
},
|
|
257
|
-
title: "Minimize",
|
|
258
|
-
onClick: () => this.props.onSetMinimize(true)
|
|
259
|
-
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
260
|
-
srcSet: "//ssl.gstatic.com/bt/C3341AA7A1A076756462EE2E5CD71C11/2x/btw_ic_minimize_white_18dp_2x.png 2x",
|
|
261
|
-
alt: "",
|
|
262
|
-
"aria-hidden": "true",
|
|
263
|
-
src: "//ssl.gstatic.com/bt/C3341AA7A1A076756462EE2E5CD71C11/1x/btw_ic_minimize_white_18dp.png"
|
|
264
|
-
})), /*#__PURE__*/_react.default.createElement("button", {
|
|
265
|
-
type: "button",
|
|
266
|
-
style: {
|
|
267
|
-
display: this.props.minimized ? '' : 'none'
|
|
268
|
-
},
|
|
269
|
-
title: "Expand",
|
|
270
|
-
onClick: () => this.props.onSetMinimize(false)
|
|
271
|
-
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
272
|
-
srcSet: "//ssl.gstatic.com/bt/C3341AA7A1A076756462EE2E5CD71C11/2x/btw_ic_maximize_white_18dp_2x.png 2x",
|
|
273
|
-
alt: "",
|
|
274
|
-
"aria-hidden": "true",
|
|
275
|
-
src: "//ssl.gstatic.com/bt/C3341AA7A1A076756462EE2E5CD71C11/1x/btw_ic_maximize_white_18dp.png"
|
|
276
|
-
})), titleButtons, /*#__PURE__*/_react.default.createElement("button", {
|
|
277
|
-
type: "button",
|
|
278
|
-
title: "Close",
|
|
279
|
-
onClick: () => this.props.onClose()
|
|
280
|
-
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
281
|
-
srcSet: "//ssl.gstatic.com/bt/C3341AA7A1A076756462EE2E5CD71C11/2x/btw_ic_close_white_12dp_2x.png 2x",
|
|
282
|
-
alt: "",
|
|
283
|
-
"aria-hidden": "true",
|
|
284
|
-
src: "//ssl.gstatic.com/bt/C3341AA7A1A076756462EE2E5CD71C11/1x/btw_ic_close_white_12dp.png"
|
|
285
|
-
}))));
|
|
286
|
-
}
|
|
287
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
288
|
-
className: "inboxsdk__mole_view_mid"
|
|
289
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
290
|
-
className: "inboxsdk__mole_view_inner"
|
|
291
|
-
}, titlebar, /*#__PURE__*/_react.default.createElement(_ElementContainer.default, {
|
|
292
|
-
className: "inboxsdk__mole_view_content",
|
|
293
|
-
el: this.props.el
|
|
294
|
-
})));
|
|
295
|
-
}
|
|
296
|
-
}
|
|
@@ -1,91 +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 _includes = _interopRequireDefault(require("lodash/includes"));
|
|
10
|
-
var _kefir = _interopRequireDefault(require("kefir"));
|
|
11
|
-
var _kefirStopper = _interopRequireDefault(require("kefir-stopper"));
|
|
12
|
-
var _fromEventTargetCapture = _interopRequireDefault(require("../../../lib/from-event-target-capture"));
|
|
13
|
-
var _dropdownView = _interopRequireDefault(require("../../../widgets/buttons/dropdown-view"));
|
|
14
|
-
var _inboxDropdownView = _interopRequireDefault(require("./inbox-dropdown-view"));
|
|
15
|
-
var _insertElementInOrder = _interopRequireDefault(require("../../../lib/dom/insert-element-in-order"));
|
|
16
|
-
let insertionOrderHint = 0;
|
|
17
|
-
class InboxToolbarButtonView {
|
|
18
|
-
_stopper = (0, _kefirStopper.default)();
|
|
19
|
-
constructor(buttonDescriptor, groupOrderHint, container) {
|
|
20
|
-
const buttonEl = this._buttonEl = document.createElement('li');
|
|
21
|
-
buttonEl.setAttribute('role', 'button');
|
|
22
|
-
buttonEl.setAttribute('data-insertion-order-hint', String(insertionOrderHint++));
|
|
23
|
-
buttonEl.setAttribute('data-group-order-hint', groupOrderHint);
|
|
24
|
-
buttonEl.tabIndex = 0;
|
|
25
|
-
buttonEl.className = 'inboxsdk__button_icon';
|
|
26
|
-
const img = document.createElement('img');
|
|
27
|
-
img.className = 'inboxsdk__button_iconImg';
|
|
28
|
-
let onClick = ignored => {};
|
|
29
|
-
let hasDropdown = false;
|
|
30
|
-
let dropdown = null;
|
|
31
|
-
_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 => {
|
|
32
|
-
event.preventDefault();
|
|
33
|
-
event.stopPropagation();
|
|
34
|
-
if (hasDropdown) {
|
|
35
|
-
if (dropdown) {
|
|
36
|
-
dropdown.close();
|
|
37
|
-
return;
|
|
38
|
-
} else {
|
|
39
|
-
this._buttonEl.classList.add('inboxsdk__active');
|
|
40
|
-
dropdown = new _dropdownView.default(new _inboxDropdownView.default(), buttonEl);
|
|
41
|
-
dropdown.setPlacementOptions({
|
|
42
|
-
position: 'bottom',
|
|
43
|
-
hAlign: 'right',
|
|
44
|
-
vAlign: 'top',
|
|
45
|
-
buffer: 10
|
|
46
|
-
});
|
|
47
|
-
dropdown.on('destroy', () => {
|
|
48
|
-
this._buttonEl.classList.remove('inboxsdk__active');
|
|
49
|
-
dropdown = null;
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
onClick({
|
|
54
|
-
dropdown
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
let lastOrderHint = null;
|
|
58
|
-
{
|
|
59
|
-
hasDropdown = buttonDescriptor.hasDropdown;
|
|
60
|
-
buttonEl.title = buttonDescriptor.title;
|
|
61
|
-
buttonEl.className = 'inboxsdk__button_icon ' + (buttonDescriptor.iconClass || '');
|
|
62
|
-
onClick = buttonDescriptor.onClick;
|
|
63
|
-
if (buttonDescriptor.iconUrl) {
|
|
64
|
-
img.src = buttonDescriptor.iconUrl;
|
|
65
|
-
buttonEl.appendChild(img);
|
|
66
|
-
} else {
|
|
67
|
-
img.remove();
|
|
68
|
-
}
|
|
69
|
-
const orderHint = buttonDescriptor.orderHint || 0;
|
|
70
|
-
if (lastOrderHint !== orderHint) {
|
|
71
|
-
lastOrderHint = orderHint;
|
|
72
|
-
buttonEl.setAttribute('data-order-hint', String(orderHint));
|
|
73
|
-
(0, _insertElementInOrder.default)(container, buttonEl, undefined, true);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
this._stopper.onValue(() => {
|
|
77
|
-
buttonEl.remove();
|
|
78
|
-
if (dropdown) {
|
|
79
|
-
dropdown.close();
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
destroy() {
|
|
84
|
-
this._stopper.destroy();
|
|
85
|
-
}
|
|
86
|
-
getStopper() {
|
|
87
|
-
return this._stopper;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
var _default = (0, _ud.defn)(module, InboxToolbarButtonView);
|
|
91
|
-
exports.default = _default;
|
|
@@ -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 _ud = require("ud");
|
|
9
|
-
var _kefir = _interopRequireDefault(require("kefir"));
|
|
10
|
-
var _kefirStopper = _interopRequireDefault(require("kefir-stopper"));
|
|
11
|
-
var _InboxToolbarButtonView = _interopRequireDefault(require("./InboxToolbarButtonView"));
|
|
12
|
-
class InboxToolbarView {
|
|
13
|
-
_stopper = (0, _kefirStopper.default)();
|
|
14
|
-
constructor(el, driver, inboxThreadView) {
|
|
15
|
-
this._el = el;
|
|
16
|
-
this._driver = driver;
|
|
17
|
-
this._inboxThreadView = inboxThreadView;
|
|
18
|
-
this._el.classList.add('inboxsdk__list_toolbar');
|
|
19
|
-
}
|
|
20
|
-
getStopper() {
|
|
21
|
-
return this._stopper;
|
|
22
|
-
}
|
|
23
|
-
destroy() {
|
|
24
|
-
this._stopper.destroy();
|
|
25
|
-
}
|
|
26
|
-
getThreadRowViewDrivers() {
|
|
27
|
-
return this._driver.getThreadRowViewDriverLiveSet().values();
|
|
28
|
-
}
|
|
29
|
-
getRouteViewDriver() {
|
|
30
|
-
return this._driver.getCurrentRouteViewDriver();
|
|
31
|
-
}
|
|
32
|
-
isForRowList() {
|
|
33
|
-
return this._inboxThreadView == null;
|
|
34
|
-
}
|
|
35
|
-
isForThread() {
|
|
36
|
-
return this._inboxThreadView != null;
|
|
37
|
-
}
|
|
38
|
-
getThreadViewDriver() {
|
|
39
|
-
if (!this._inboxThreadView) {
|
|
40
|
-
throw new Error('this toolbarview is not for a thread');
|
|
41
|
-
}
|
|
42
|
-
return this._inboxThreadView;
|
|
43
|
-
}
|
|
44
|
-
addButton(buttonDescriptor, id) {
|
|
45
|
-
const button = new _InboxToolbarButtonView.default(buttonDescriptor, this._driver.getAppId(), this._el);
|
|
46
|
-
this._stopper.takeUntilBy(button.getStopper()).onValue(() => {
|
|
47
|
-
button.destroy();
|
|
48
|
-
});
|
|
49
|
-
return button;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
var _default = (0, _ud.defn)(module, InboxToolbarView);
|
|
53
|
-
exports.default = _default;
|