@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,271 +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 _findIndex = _interopRequireDefault(require("lodash/findIndex"));
|
|
9
|
-
var _ud = require("ud");
|
|
10
|
-
var _autoHtml = _interopRequireDefault(require("auto-html"));
|
|
11
|
-
var _kefir = _interopRequireDefault(require("kefir"));
|
|
12
|
-
var _kefirStopper = _interopRequireDefault(require("kefir-stopper"));
|
|
13
|
-
var _react = _interopRequireDefault(require("react"));
|
|
14
|
-
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
15
|
-
var _fakeWindowResize = _interopRequireDefault(require("../../../lib/fake-window-resize"));
|
|
16
|
-
var _findParent = _interopRequireDefault(require("../../../../common/find-parent"));
|
|
17
|
-
var _getSidebarClassnames = _interopRequireDefault(require("../getSidebarClassnames"));
|
|
18
|
-
var _delayAsap = _interopRequireDefault(require("../../../lib/delay-asap"));
|
|
19
|
-
var _waitForAnimationClickBlockerGone = _interopRequireDefault(require("../waitForAnimationClickBlockerGone"));
|
|
20
|
-
var _makeMutationObserverChunkedStream = _interopRequireDefault(require("../../../lib/dom/make-mutation-observer-chunked-stream"));
|
|
21
|
-
var _fromEventTargetCapture = _interopRequireDefault(require("../../../lib/from-event-target-capture"));
|
|
22
|
-
var _orderManager = _interopRequireDefault(require("order-manager"));
|
|
23
|
-
var _idMap = _interopRequireDefault(require("../../../lib/idMap"));
|
|
24
|
-
var _querySelectorOrFail = _interopRequireDefault(require("../../../lib/dom/querySelectorOrFail"));
|
|
25
|
-
var _incrementName = _interopRequireDefault(require("../../../lib/incrementName"));
|
|
26
|
-
var _AppSidebar = _interopRequireDefault(require("../../../driver-common/sidebar/AppSidebar"));
|
|
27
|
-
var _ContentPanelViewDriver = _interopRequireDefault(require("../../../driver-common/sidebar/ContentPanelViewDriver"));
|
|
28
|
-
class InboxAppSidebarView {
|
|
29
|
-
_stopper = (0, _kefirStopper.default)();
|
|
30
|
-
constructor(driver) {
|
|
31
|
-
this._driver = driver;
|
|
32
|
-
|
|
33
|
-
// We need to be able to cooperate with other apps/extensions that are
|
|
34
|
-
// sharing the app sidebar. We store some properties as attributes in the
|
|
35
|
-
// shared DOM instead of as class properties; class properties are mostly
|
|
36
|
-
// restricted to being used for references to DOM nodes. When
|
|
37
|
-
// InboxAppSidebarView is instantiated, we check to see if the element
|
|
38
|
-
// already exists and create it if it doesn't.
|
|
39
|
-
const el = document.querySelector('.' + (0, _idMap.default)('app_sidebar_container'));
|
|
40
|
-
if (el) {
|
|
41
|
-
this._el = el;
|
|
42
|
-
} else {
|
|
43
|
-
this._createElement();
|
|
44
|
-
}
|
|
45
|
-
const mainParent = (0, _findParent.default)((0, _querySelectorOrFail.default)(document, '[role=application]'), el => el.parentElement === document.body);
|
|
46
|
-
if (!mainParent) {
|
|
47
|
-
const err = new Error('Failed to find main parent');
|
|
48
|
-
this._driver.getLogger().errorSite(err);
|
|
49
|
-
throw err;
|
|
50
|
-
}
|
|
51
|
-
this._mainParent = mainParent;
|
|
52
|
-
this._openOrOpeningProp = (0, _makeMutationObserverChunkedStream.default)(this._el, {
|
|
53
|
-
attributes: true,
|
|
54
|
-
attributeFilter: ['data-open', 'data-is-opening']
|
|
55
|
-
}).toProperty(() => null).map(() => this._el.getAttribute('data-open') === 'true' || this._el.getAttribute('data-is-opening') === 'true').skipDuplicates();
|
|
56
|
-
}
|
|
57
|
-
destroy() {
|
|
58
|
-
this._stopper.destroy();
|
|
59
|
-
}
|
|
60
|
-
open() {
|
|
61
|
-
this._setShouldAppSidebarOpen(true);
|
|
62
|
-
this._setOpenedNow(true);
|
|
63
|
-
}
|
|
64
|
-
close() {
|
|
65
|
-
this._setShouldAppSidebarOpen(false);
|
|
66
|
-
this._setOpenedNow(false);
|
|
67
|
-
}
|
|
68
|
-
getOpenOrOpeningStream() {
|
|
69
|
-
return this._openOrOpeningProp;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// This value controls whether the app sidebar should automatically open
|
|
73
|
-
// itself when available when the chat sidebar isn't present. It's only set
|
|
74
|
-
// if the user interacts with the app sidebar button.
|
|
75
|
-
_getShouldAppSidebarOpen() {
|
|
76
|
-
return localStorage.getItem('inboxsdk__app_sidebar_should_open') === 'true';
|
|
77
|
-
}
|
|
78
|
-
_setShouldAppSidebarOpen(open) {
|
|
79
|
-
try {
|
|
80
|
-
localStorage.setItem('inboxsdk__app_sidebar_should_open', String(open));
|
|
81
|
-
} catch (err) {
|
|
82
|
-
console.error('error saving', err);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
_createElement() {
|
|
86
|
-
const el = this._el = document.createElement('div');
|
|
87
|
-
el.className = (0, _idMap.default)('app_sidebar_container');
|
|
88
|
-
// Store the open state in the DOM rather than a class property because
|
|
89
|
-
// multiple instances of InboxAppSidebarView from different apps need to
|
|
90
|
-
// share the value.
|
|
91
|
-
el.setAttribute('data-open', 'false');
|
|
92
|
-
el.setAttribute('data-is-opening', 'false');
|
|
93
|
-
document.body.appendChild(el);
|
|
94
|
-
if (!document.body.querySelector('.' + (0, _idMap.default)('app_sidebar_waiting_platform'))) {
|
|
95
|
-
const waitingPlatform = document.createElement('div');
|
|
96
|
-
waitingPlatform.className = (0, _idMap.default)('app_sidebar_waiting_platform');
|
|
97
|
-
document.body.appendChild(waitingPlatform);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// If the user clicks the chat button while the chat sidebar and app
|
|
101
|
-
// sidebar are both open, then we want the chat sidebar to become visible.
|
|
102
|
-
// We block Inbox from closing the chat sidebar, and we close the app sidebar.
|
|
103
|
-
(0, _fromEventTargetCapture.default)(this._driver.getChatSidebarButton(), 'click').filter(() => el.getAttribute('data-open') === 'true' && this._driver.getCurrentChatSidebarView().getMode() === 'SIDEBAR').takeUntilBy(this._stopper).onValue(event => {
|
|
104
|
-
event.stopImmediatePropagation();
|
|
105
|
-
this._setShouldAppSidebarOpen(false);
|
|
106
|
-
this._setOpenedNow(false);
|
|
107
|
-
});
|
|
108
|
-
this._driver.getCurrentChatSidebarView().getModeStream().changes().takeUntilBy(this._stopper).onValue(mode => {
|
|
109
|
-
if (mode === 'SIDEBAR') {
|
|
110
|
-
// If the user clicks the chat button while the chat sidebar is
|
|
111
|
-
// closed and the app sidebar is open, and Inbox opens the chat
|
|
112
|
-
// sidebar, then we want the chat sidebar to become visible. We just
|
|
113
|
-
// hide the app sidebar after Inbox brings up the chat sidebar.
|
|
114
|
-
this._setShouldAppSidebarOpen(false);
|
|
115
|
-
this._setOpenedNow(false);
|
|
116
|
-
} else {
|
|
117
|
-
// If the chat sidebar changes in any other way
|
|
118
|
-
// (ie. HIDDEN<->DROPDOWN) while the app sidebar is open, then we
|
|
119
|
-
// might need to fix up some class changes that Inbox might have
|
|
120
|
-
// made.
|
|
121
|
-
if (el.getAttribute('data-open') === 'true') {
|
|
122
|
-
this._setOpenedNow(true);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
const currentIds = new Set();
|
|
127
|
-
const orderManager = new _orderManager.default({
|
|
128
|
-
get() {
|
|
129
|
-
try {
|
|
130
|
-
return JSON.parse(localStorage.getItem('inboxsdk__sidebar_ordering') || 'null');
|
|
131
|
-
} catch (err) {
|
|
132
|
-
console.error('failed to read sidebar order data', err);
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
set(data) {
|
|
136
|
-
try {
|
|
137
|
-
localStorage.setItem('inboxsdk__sidebar_ordering', JSON.stringify(data));
|
|
138
|
-
} catch (err) {
|
|
139
|
-
console.error('failed to set sidebar order data', err);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
let component;
|
|
144
|
-
const _appSidebarRefSetter = threadSidebarComponent => {
|
|
145
|
-
if (threadSidebarComponent) {
|
|
146
|
-
component = threadSidebarComponent;
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
const render = () => {
|
|
150
|
-
_reactDom.default.render( /*#__PURE__*/_react.default.createElement(_AppSidebar.default, {
|
|
151
|
-
ref: _appSidebarRefSetter,
|
|
152
|
-
panels: orderManager.getOrderedItems().map(x => x.value),
|
|
153
|
-
onClose: () => {
|
|
154
|
-
this._setShouldAppSidebarOpen(false);
|
|
155
|
-
this._setOpenedNow(false);
|
|
156
|
-
},
|
|
157
|
-
onOutsideClick: () => {
|
|
158
|
-
this._driver.closeOpenThread();
|
|
159
|
-
},
|
|
160
|
-
onMoveEnd: (newList, movedItem, oldIndex, newIndex) => {
|
|
161
|
-
orderManager.moveItem(oldIndex, newIndex);
|
|
162
|
-
render();
|
|
163
|
-
}
|
|
164
|
-
}), el);
|
|
165
|
-
};
|
|
166
|
-
render();
|
|
167
|
-
_kefir.default.fromEvents(window, 'storage').filter(e => e.key === 'inboxsdk__sidebar_ordering').takeUntilBy(this._stopper).onValue(() => {
|
|
168
|
-
orderManager.reload();
|
|
169
|
-
render();
|
|
170
|
-
});
|
|
171
|
-
this._stopper.onValue(() => {
|
|
172
|
-
_reactDom.default.unmountComponentAtNode(el);
|
|
173
|
-
el.remove();
|
|
174
|
-
});
|
|
175
|
-
_kefir.default.fromEvents(document.body, 'inboxsdkNewSidebarPanel').takeUntilBy(this._stopper).onValue(event => {
|
|
176
|
-
let id = event.detail.id;
|
|
177
|
-
while (currentIds.has(id)) {
|
|
178
|
-
id = (0, _incrementName.default)(id);
|
|
179
|
-
}
|
|
180
|
-
currentIds.add(id);
|
|
181
|
-
orderManager.addItem({
|
|
182
|
-
groupId: event.detail.appId,
|
|
183
|
-
id,
|
|
184
|
-
orderHint: event.detail.orderHint,
|
|
185
|
-
value: {
|
|
186
|
-
id,
|
|
187
|
-
appId: event.detail.appId,
|
|
188
|
-
instanceId: event.detail.instanceId,
|
|
189
|
-
title: event.detail.title,
|
|
190
|
-
iconClass: event.detail.iconClass,
|
|
191
|
-
iconUrl: event.detail.iconUrl,
|
|
192
|
-
hideTitleBar: event.detail.hideTitleBar,
|
|
193
|
-
el: event.target
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
render();
|
|
197
|
-
});
|
|
198
|
-
_kefir.default.fromEvents(document.body, 'inboxsdkUpdateSidebarPanel').takeUntilBy(this._stopper).onValue(event => {
|
|
199
|
-
const orderedItems = orderManager.getOrderedItems();
|
|
200
|
-
const index = (0, _findIndex.default)(orderedItems, x => x.value.instanceId === event.detail.instanceId);
|
|
201
|
-
if (index === -1) throw new Error('should not happen: failed to find orderItem');
|
|
202
|
-
orderManager.updateItemValueByIndex(index, {
|
|
203
|
-
id: orderedItems[index].value.id,
|
|
204
|
-
appId: event.detail.appId,
|
|
205
|
-
instanceId: event.detail.instanceId,
|
|
206
|
-
title: event.detail.title,
|
|
207
|
-
iconClass: event.detail.iconClass,
|
|
208
|
-
iconUrl: event.detail.iconUrl,
|
|
209
|
-
hideTitleBar: event.detail.hideTitleBar,
|
|
210
|
-
el: event.target
|
|
211
|
-
});
|
|
212
|
-
render();
|
|
213
|
-
});
|
|
214
|
-
_kefir.default.fromEvents(document.body, 'inboxsdkRemoveSidebarPanel').takeUntilBy(this._stopper).onValue(event => {
|
|
215
|
-
const orderedItems = orderManager.getOrderedItems();
|
|
216
|
-
const index = (0, _findIndex.default)(orderedItems, x => x.value.instanceId === event.detail.instanceId);
|
|
217
|
-
if (index === -1) throw new Error('should not happen: failed to find orderItem');
|
|
218
|
-
currentIds.delete(orderedItems[index].id);
|
|
219
|
-
orderManager.removeItemByIndex(index);
|
|
220
|
-
if (orderManager.getOrderedItems().length === 0) {
|
|
221
|
-
this._setOpenedNow(false);
|
|
222
|
-
}
|
|
223
|
-
render();
|
|
224
|
-
});
|
|
225
|
-
_kefir.default.fromEvents(document.body, 'inboxsdkSidebarPanelScrollIntoView').takeUntilBy(this._stopper).onValue(event => {
|
|
226
|
-
component.scrollPanelIntoView(event.detail.instanceId);
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
_setOpenedNow(open) {
|
|
230
|
-
this._el.setAttribute('data-open', String(open));
|
|
231
|
-
const {
|
|
232
|
-
chat
|
|
233
|
-
} = (0, _getSidebarClassnames.default)();
|
|
234
|
-
if (!chat) return;
|
|
235
|
-
if (!open) {
|
|
236
|
-
if (this._driver.getCurrentChatSidebarView().getMode() !== 'SIDEBAR' && this._mainParent.classList.contains(chat)) {
|
|
237
|
-
this._mainParent.classList.remove(chat);
|
|
238
|
-
this._driver.getPageCommunicator().fakeWindowResize();
|
|
239
|
-
}
|
|
240
|
-
} else {
|
|
241
|
-
if (this._driver.getCurrentChatSidebarView().getMode() !== 'SIDEBAR' && !this._mainParent.classList.contains(chat)) {
|
|
242
|
-
this._mainParent.classList.add(chat);
|
|
243
|
-
this._driver.getPageCommunicator().fakeWindowResize();
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
_setOpenedAfterAnimation(open) {
|
|
248
|
-
this._el.setAttribute('data-is-opening', 'true');
|
|
249
|
-
(0, _waitForAnimationClickBlockerGone.default)().takeUntilBy(this._stopper).takeUntilBy((0, _makeMutationObserverChunkedStream.default)(this._el, {
|
|
250
|
-
attributes: true,
|
|
251
|
-
attributeFilter: ['data-open']
|
|
252
|
-
})).onValue(() => {
|
|
253
|
-
this._setOpenedNow(open);
|
|
254
|
-
}).onEnd(() => {
|
|
255
|
-
this._el.setAttribute('data-is-opening', 'false');
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
addSidebarContentPanel(descriptor) {
|
|
259
|
-
// There's only up to one sidebar in Inbox, so the ID doesn't really matter.
|
|
260
|
-
const view = new _ContentPanelViewDriver.default(this._driver, descriptor, 'inbox');
|
|
261
|
-
if (this._driver.getCurrentChatSidebarView().getMode() === 'SIDEBAR' || this._getShouldAppSidebarOpen()) {
|
|
262
|
-
this._setOpenedAfterAnimation(true);
|
|
263
|
-
}
|
|
264
|
-
this._stopper.takeUntilBy(view.getStopper()).onValue(() => {
|
|
265
|
-
view.remove();
|
|
266
|
-
});
|
|
267
|
-
return view;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
var _default = (0, _ud.defn)(module, InboxAppSidebarView);
|
|
271
|
-
exports.default = _default;
|
package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-toolbar-button-view.js
DELETED
|
@@ -1,160 +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 _find = _interopRequireDefault(require("lodash/find"));
|
|
9
|
-
var _includes = _interopRequireDefault(require("lodash/includes"));
|
|
10
|
-
var _ud = require("ud");
|
|
11
|
-
var _kefir = _interopRequireDefault(require("kefir"));
|
|
12
|
-
var _kefirStopper = _interopRequireDefault(require("kefir-stopper"));
|
|
13
|
-
var _dropdownView = _interopRequireDefault(require("../../../widgets/buttons/dropdown-view"));
|
|
14
|
-
var _inboxAppToolbarTooltipView = _interopRequireDefault(require("./inbox-app-toolbar-tooltip-view"));
|
|
15
|
-
var _toItemWithLifetimeStream = _interopRequireDefault(require("../../../lib/toItemWithLifetimeStream"));
|
|
16
|
-
var _setCss = _interopRequireDefault(require("../../../lib/dom/set-css"));
|
|
17
|
-
class InboxAppToolbarButtonView {
|
|
18
|
-
_buttonDescriptor = null;
|
|
19
|
-
_buttonEl = null;
|
|
20
|
-
_activeDropdown = null;
|
|
21
|
-
_stopper = (0, _kefirStopper.default)();
|
|
22
|
-
_ready = (0, _kefirStopper.default)();
|
|
23
|
-
constructor(buttonDescriptor, appToolbarLocationLiveSet, searchBarLiveSet) {
|
|
24
|
-
this._buttonDescriptorStream = buttonDescriptor.toProperty().takeUntilBy(this._stopper);
|
|
25
|
-
_kefir.default.combine([(0, _toItemWithLifetimeStream.default)(searchBarLiveSet).take(1), (0, _toItemWithLifetimeStream.default)(appToolbarLocationLiveSet).take(1)], [], searchBar => searchBar).map(_ref => {
|
|
26
|
-
let {
|
|
27
|
-
el: node
|
|
28
|
-
} = _ref;
|
|
29
|
-
return node.getValue();
|
|
30
|
-
}).takeUntilBy(this._stopper).onValue(el => this._adjustSearchBarMargin(el));
|
|
31
|
-
(0, _toItemWithLifetimeStream.default)(appToolbarLocationLiveSet).take(1).map(_ref2 => {
|
|
32
|
-
let {
|
|
33
|
-
el: node
|
|
34
|
-
} = _ref2;
|
|
35
|
-
return node.getValue();
|
|
36
|
-
}).takeUntilBy(this._stopper).onValue(el => this._setupButton(el));
|
|
37
|
-
}
|
|
38
|
-
_setupButton(appToolbarLocation) {
|
|
39
|
-
let appToolbarButtonContainer = (0, _find.default)(appToolbarLocation.children, el => el.classList.contains('inboxsdk__appButton_container'));
|
|
40
|
-
if (!appToolbarButtonContainer) {
|
|
41
|
-
appToolbarButtonContainer = document.createElement('div');
|
|
42
|
-
appToolbarButtonContainer.className = 'inboxsdk__appButton_container';
|
|
43
|
-
appToolbarLocation.insertBefore(appToolbarButtonContainer, appToolbarLocation.firstChild);
|
|
44
|
-
}
|
|
45
|
-
const button = document.createElement('div');
|
|
46
|
-
button.tabIndex = 0;
|
|
47
|
-
button.setAttribute('role', 'button');
|
|
48
|
-
button.className = 'inboxsdk__appButton inboxsdk__button_icon';
|
|
49
|
-
const buttonImg = document.createElement('img');
|
|
50
|
-
buttonImg.className = 'inboxsdk__button_iconImg';
|
|
51
|
-
button.appendChild(buttonImg);
|
|
52
|
-
this._buttonDescriptorStream.onValue(buttonDescriptor => {
|
|
53
|
-
button.title = buttonDescriptor.title;
|
|
54
|
-
buttonImg.src = buttonDescriptor.iconUrl;
|
|
55
|
-
buttonImg.className = `inboxsdk__button_iconImg ${buttonDescriptor.iconClass || ''}`;
|
|
56
|
-
this._buttonDescriptor = buttonDescriptor;
|
|
57
|
-
});
|
|
58
|
-
_kefir.default.merge([_kefir.default.fromEvents(button, 'click'), _kefir.default.fromEvents(button, 'keypress').filter(e => (0, _includes.default)([32 /*space*/, 13 /*enter*/], e.which))]).takeUntilBy(this._stopper).onValue(event => {
|
|
59
|
-
event.preventDefault();
|
|
60
|
-
event.stopPropagation();
|
|
61
|
-
if (this._activeDropdown) {
|
|
62
|
-
this.close();
|
|
63
|
-
} else {
|
|
64
|
-
if (!this._buttonDescriptor || this._buttonDescriptor.hasDropdown !== false) {
|
|
65
|
-
this.open();
|
|
66
|
-
} else {
|
|
67
|
-
if (this._buttonDescriptor && this._buttonDescriptor.onClick) {
|
|
68
|
-
this._buttonDescriptor.onClick();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
appToolbarButtonContainer.insertBefore(button, appToolbarButtonContainer.firstChild);
|
|
74
|
-
this._buttonEl = button;
|
|
75
|
-
this._ready.destroy();
|
|
76
|
-
this._stopper.onValue(() => {
|
|
77
|
-
button.remove();
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
_adjustSearchBarMargin(searchBar) {
|
|
81
|
-
const buttonWidth = 40;
|
|
82
|
-
const defaultMarginRight = 70;
|
|
83
|
-
const ATTR_NAME = 'data-inboxsdk-searchbar-min-margin-right';
|
|
84
|
-
const newMarginRight = buttonWidth + parseInt(document.documentElement.getAttribute(ATTR_NAME) || '0');
|
|
85
|
-
const ruleClassName = 'inboxsdk__dynamic_resize_searchbar';
|
|
86
|
-
function setSheetRules(minMarginRight) {
|
|
87
|
-
document.documentElement.setAttribute(ATTR_NAME, String(minMarginRight));
|
|
88
|
-
if (minMarginRight <= 0) {
|
|
89
|
-
(0, _setCss.default)('dynamic_resize_searchbar', '');
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
const important = minMarginRight > defaultMarginRight ? '!important' : '';
|
|
93
|
-
|
|
94
|
-
// When the page gets wider than this number, stop applying our override
|
|
95
|
-
// so that Inbox's margin:auto takes over.
|
|
96
|
-
const applyWhenPageWidthUnder = 1394 + 3.575 * minMarginRight;
|
|
97
|
-
|
|
98
|
-
// @media-scoped rule is for adjusting gmail stuff. Last rule is for
|
|
99
|
-
// adjusting icons from non-SDK extensions including Mixmax.
|
|
100
|
-
const rule = `
|
|
101
|
-
@media (max-width: ${applyWhenPageWidthUnder}px) {
|
|
102
|
-
.${ruleClassName} {
|
|
103
|
-
margin-right: ${minMarginRight}px${important};
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
.inboxsdk__appButton_container + * + * ~ *:not(.inboxsdk_escape_mod) {
|
|
107
|
-
margin-right: ${minMarginRight}px${important};
|
|
108
|
-
}
|
|
109
|
-
`;
|
|
110
|
-
(0, _setCss.default)('dynamic_resize_searchbar', rule);
|
|
111
|
-
}
|
|
112
|
-
setSheetRules(newMarginRight);
|
|
113
|
-
searchBar.classList.add(ruleClassName);
|
|
114
|
-
const {
|
|
115
|
-
nextElementSibling
|
|
116
|
-
} = searchBar;
|
|
117
|
-
if (nextElementSibling) {
|
|
118
|
-
nextElementSibling.classList.add(ruleClassName);
|
|
119
|
-
}
|
|
120
|
-
this._stopper.onValue(() => {
|
|
121
|
-
const newMarginRight = parseInt(document.documentElement.getAttribute(ATTR_NAME) || '0') - buttonWidth;
|
|
122
|
-
setSheetRules(newMarginRight);
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
open() {
|
|
126
|
-
if (this._activeDropdown) return;
|
|
127
|
-
const button = this._buttonEl;
|
|
128
|
-
if (!button) throw new Error('should not happen');
|
|
129
|
-
button.classList.add('inboxsdk__active');
|
|
130
|
-
const {
|
|
131
|
-
arrowColor
|
|
132
|
-
} = this._buttonDescriptor || {};
|
|
133
|
-
const dropdown = this._activeDropdown = new _dropdownView.default(new _inboxAppToolbarTooltipView.default(button, arrowColor), button);
|
|
134
|
-
dropdown.once('destroy', () => {
|
|
135
|
-
this._activeDropdown = null;
|
|
136
|
-
button.classList.remove('inboxsdk__active');
|
|
137
|
-
});
|
|
138
|
-
const appEvent = {
|
|
139
|
-
dropdown
|
|
140
|
-
};
|
|
141
|
-
if (this._buttonDescriptor && this._buttonDescriptor.onClick) {
|
|
142
|
-
this._buttonDescriptor.onClick.call(null, appEvent);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
close() {
|
|
146
|
-
if (!this._activeDropdown) return;
|
|
147
|
-
this._activeDropdown.close();
|
|
148
|
-
}
|
|
149
|
-
waitForReady() {
|
|
150
|
-
return this._ready.map(() => this).merge(this._stopper.flatMap(() => _kefir.default.constantError(new Error('InboxAppToolbarButtonView was destroyed early')))).take(1).takeErrors(1).toPromise(Promise);
|
|
151
|
-
}
|
|
152
|
-
getStopper() {
|
|
153
|
-
return this._stopper;
|
|
154
|
-
}
|
|
155
|
-
destroy() {
|
|
156
|
-
this._stopper.destroy();
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
var _default = (0, _ud.defn)(module, InboxAppToolbarButtonView);
|
|
160
|
-
exports.default = _default;
|
package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-toolbar-tooltip-view.js
DELETED
|
@@ -1,57 +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
|
-
class InboxAppToolbarTooltipView {
|
|
12
|
-
_stopper = (0, _kefirStopper.default)();
|
|
13
|
-
constructor(anchorElement, arrowColor) {
|
|
14
|
-
this._anchorElement = anchorElement;
|
|
15
|
-
this._arrowEl = document.createElement('div');
|
|
16
|
-
this._arrowEl.className = 'inboxsdk__tooltip_arrow inboxsdk__bottom';
|
|
17
|
-
document.body.appendChild(this._arrowEl);
|
|
18
|
-
if (arrowColor) {
|
|
19
|
-
this._arrowEl.style.borderColor = arrowColor;
|
|
20
|
-
}
|
|
21
|
-
this._containerEl = document.createElement('div');
|
|
22
|
-
this._containerEl.className = 'inboxsdk__appButton_tooltip_container';
|
|
23
|
-
this._el = document.createElement('div');
|
|
24
|
-
this._el.className = 'inboxsdk__appButton_tooltip';
|
|
25
|
-
this._el.setAttribute('role', 'region');
|
|
26
|
-
this._containerEl.appendChild(this._el);
|
|
27
|
-
document.body.appendChild(this._containerEl);
|
|
28
|
-
this._reposition();
|
|
29
|
-
}
|
|
30
|
-
_reposition() {
|
|
31
|
-
const buttonPos = this._anchorElement.getBoundingClientRect();
|
|
32
|
-
const buttonCenter = buttonPos.left + buttonPos.width / 2;
|
|
33
|
-
this._arrowEl.style.top = `${buttonPos.bottom + 18}px`;
|
|
34
|
-
this._arrowEl.style.right = `${window.innerWidth - buttonPos.right + buttonPos.width / 2 - this._arrowEl.offsetWidth / 2 - 1}px`;
|
|
35
|
-
this._containerEl.style.top = `${buttonPos.bottom + 17}px`;
|
|
36
|
-
this._containerEl.style.minWidth = `${(window.innerWidth - buttonCenter - 30) * 2}px`;
|
|
37
|
-
}
|
|
38
|
-
getDropdownOptions() {
|
|
39
|
-
return {
|
|
40
|
-
manualPosition: true,
|
|
41
|
-
extraElementsToIgnore: [this._arrowEl]
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
getContentElement() {
|
|
45
|
-
return this._el;
|
|
46
|
-
}
|
|
47
|
-
getContainerElement() {
|
|
48
|
-
return this._containerEl;
|
|
49
|
-
}
|
|
50
|
-
destroy() {
|
|
51
|
-
this._containerEl.remove();
|
|
52
|
-
this._arrowEl.remove();
|
|
53
|
-
this._stopper.destroy();
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
var _default = (0, _ud.defn)(module, InboxAppToolbarTooltipView);
|
|
57
|
-
exports.default = _default;
|
|
@@ -1,197 +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 _autoHtml = _interopRequireDefault(require("auto-html"));
|
|
11
|
-
var _kefir = _interopRequireDefault(require("kefir"));
|
|
12
|
-
var _kefirBus = _interopRequireDefault(require("kefir-bus"));
|
|
13
|
-
var _kefirStopper = _interopRequireDefault(require("kefir-stopper"));
|
|
14
|
-
var _findParent = _interopRequireDefault(require("../../../../common/find-parent"));
|
|
15
|
-
var _querySelectorOrFail = _interopRequireDefault(require("../../../lib/dom/querySelectorOrFail"));
|
|
16
|
-
class InboxAttachmentCardView {
|
|
17
|
-
_stopper = (0, _kefirStopper.default)();
|
|
18
|
-
_previewClicks = _kefir.default.pool();
|
|
19
|
-
_addedButtonDescriptors = [];
|
|
20
|
-
_overlayView = null;
|
|
21
|
-
constructor(options, driver) {
|
|
22
|
-
this._driver = driver;
|
|
23
|
-
if (options.element) {
|
|
24
|
-
this._element = options.element;
|
|
25
|
-
this._p = options.parsed;
|
|
26
|
-
this._type = options.parsed.attributes.type;
|
|
27
|
-
_kefir.default.merge([_kefir.default.fromEvents(this._element, 'click'), _kefir.default.fromEvents(this._element, 'keydown')]).takeUntilBy(this._stopper).onValue(() => {
|
|
28
|
-
this._driver.setLastInteractedAttachmentCardView(this);
|
|
29
|
-
});
|
|
30
|
-
} else {
|
|
31
|
-
this._type = 'CUSTOM';
|
|
32
|
-
this._createNewElement(options);
|
|
33
|
-
}
|
|
34
|
-
this._messageViewDriver = this._findMessageView();
|
|
35
|
-
if (this._messageViewDriver) {
|
|
36
|
-
this._messageViewDriver.addAttachmentCardViewDriver(this);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
destroy() {
|
|
40
|
-
if (!this._p) {
|
|
41
|
-
this._element.remove();
|
|
42
|
-
}
|
|
43
|
-
this._stopper.destroy();
|
|
44
|
-
}
|
|
45
|
-
_findMessageView() {
|
|
46
|
-
const map = this._driver.getMessageViewElementsMap();
|
|
47
|
-
const messageViewElement = (0, _findParent.default)(this._element, el => map.has(el));
|
|
48
|
-
if (!messageViewElement) return null;
|
|
49
|
-
return map.get(messageViewElement);
|
|
50
|
-
}
|
|
51
|
-
_createNewElement(options) {
|
|
52
|
-
if (options.previewUrl) {
|
|
53
|
-
this._element = document.createElement('a');
|
|
54
|
-
this._element.href = options.previewUrl;
|
|
55
|
-
} else {
|
|
56
|
-
this._element = document.createElement('div');
|
|
57
|
-
this._element.tabIndex = 0;
|
|
58
|
-
}
|
|
59
|
-
this._element.title = options.title;
|
|
60
|
-
const setupInnerHtml = options => {
|
|
61
|
-
if (options.previewThumbnailUrl) {
|
|
62
|
-
this._element.className = 'inboxsdk__attachment_card inboxsdk__attachment_card_with_preview';
|
|
63
|
-
this._element.innerHTML = (0, _autoHtml.default)`
|
|
64
|
-
<img alt="" aria-hidden="true"
|
|
65
|
-
style="width: 100%"
|
|
66
|
-
src="${options.previewThumbnailUrl}"
|
|
67
|
-
>
|
|
68
|
-
<div class="inboxsdk__attachment_card_hover_overlay">
|
|
69
|
-
<div class="inboxsdk__attachment_card_title">${options.title}</div>
|
|
70
|
-
<div class="inboxsdk__attachment_card_buttons"></div>
|
|
71
|
-
</div>
|
|
72
|
-
`;
|
|
73
|
-
if (options.failoverPreviewIconUrl) {
|
|
74
|
-
_kefir.default.fromEvents((0, _querySelectorOrFail.default)(this._element, 'img'), 'error').take(1).takeUntilBy(this._stopper).onValue(() => {
|
|
75
|
-
setupInnerHtml({
|
|
76
|
-
...options,
|
|
77
|
-
previewThumbnailUrl: null,
|
|
78
|
-
iconThumbnailUrl: options.failoverPreviewIconUrl
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
} else {
|
|
83
|
-
this._element.className = 'inboxsdk__attachment_card';
|
|
84
|
-
this._element.innerHTML = (0, _autoHtml.default)`
|
|
85
|
-
<div class="inboxsdk__attachment_card_nohover">
|
|
86
|
-
<div class="inboxsdk__attachment_card_title">${options.title}</div>
|
|
87
|
-
<div class="inboxsdk__attachment_card_description">
|
|
88
|
-
<img alt="" aria-hidden="true" src="${options.fileIconImageUrl}">
|
|
89
|
-
<span>${options.description || ''}</span>
|
|
90
|
-
</div>
|
|
91
|
-
</div>
|
|
92
|
-
<div class="inboxsdk__attachment_card_hover_overlay">
|
|
93
|
-
<div class="inboxsdk__attachment_card_title">${options.title}</div>
|
|
94
|
-
<div class="inboxsdk__attachment_card_buttons"></div>
|
|
95
|
-
</div>
|
|
96
|
-
`;
|
|
97
|
-
}
|
|
98
|
-
options.buttons.forEach(button => {
|
|
99
|
-
this.addButton(button);
|
|
100
|
-
});
|
|
101
|
-
};
|
|
102
|
-
setupInnerHtml(options);
|
|
103
|
-
this._previewClicks.plug(_kefir.default.merge([_kefir.default.fromEvents(this._element, 'click'), _kefir.default.fromEvents(this._element, 'keypress').filter(e => (0, _includes.default)([32 /*space*/, 13 /*enter*/], e.which))]));
|
|
104
|
-
options.container.appendChild(this._element);
|
|
105
|
-
}
|
|
106
|
-
getElement() {
|
|
107
|
-
return this._element;
|
|
108
|
-
}
|
|
109
|
-
getMessageViewDriver() {
|
|
110
|
-
return this._messageViewDriver;
|
|
111
|
-
}
|
|
112
|
-
getStopper() {
|
|
113
|
-
return this._stopper;
|
|
114
|
-
}
|
|
115
|
-
getPreviewClicks() {
|
|
116
|
-
return this._previewClicks.takeUntilBy(this._stopper);
|
|
117
|
-
}
|
|
118
|
-
getAttachmentType() {
|
|
119
|
-
return this._type;
|
|
120
|
-
}
|
|
121
|
-
getAddedButtonDescriptors() {
|
|
122
|
-
return this._addedButtonDescriptors;
|
|
123
|
-
}
|
|
124
|
-
addButton(button) {
|
|
125
|
-
this._addedButtonDescriptors.push(button);
|
|
126
|
-
if (!this._p) {
|
|
127
|
-
// artificial SDK-added card. Native cards don't have their added buttons
|
|
128
|
-
// processed here. They're added in InboxAttachmentOverlayView.
|
|
129
|
-
const buttonContainer = (0, _querySelectorOrFail.default)(this._element, '.inboxsdk__attachment_card_buttons');
|
|
130
|
-
const el = document.createElement('button');
|
|
131
|
-
el.className = 'inboxsdk__attachment_card_button';
|
|
132
|
-
if (button.downloadUrl) {
|
|
133
|
-
el.setAttribute('data-inboxsdk-download-url', button.downloadUrl);
|
|
134
|
-
el.addEventListener('click', event => {
|
|
135
|
-
event.stopPropagation();
|
|
136
|
-
event.preventDefault();
|
|
137
|
-
let prevented = false;
|
|
138
|
-
if (button.onClick) {
|
|
139
|
-
button.onClick({
|
|
140
|
-
preventDefault() {
|
|
141
|
-
prevented = true;
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
if (prevented) return;
|
|
146
|
-
const downloadLink = document.createElement('a');
|
|
147
|
-
downloadLink.href = button.downloadUrl;
|
|
148
|
-
if (button.downloadFilename) {
|
|
149
|
-
downloadLink.download = button.downloadFilename;
|
|
150
|
-
}
|
|
151
|
-
downloadLink.addEventListener('click', function (e) {
|
|
152
|
-
e.stopPropagation();
|
|
153
|
-
}, true);
|
|
154
|
-
if (button.openInNewTab) {
|
|
155
|
-
downloadLink.setAttribute('target', '_blank');
|
|
156
|
-
}
|
|
157
|
-
document.body.appendChild(downloadLink);
|
|
158
|
-
downloadLink.click();
|
|
159
|
-
downloadLink.remove();
|
|
160
|
-
});
|
|
161
|
-
el.innerHTML = `
|
|
162
|
-
<div style="background: no-repeat url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAYElEQVQ4y+2UMQ6AQAgEwfhQnnJP4adjc4UxB0ehhXqbULE7BRAUkLu1yQP6OXQveEab1DXTD0O9b53kIui+QReicnJ5lM2gArQA2LLcDCqAXYA2y1SgZ7BV/Lr+6TugB0K2GxxDXjEZAAAAAElFTkSuQmCC)"></div>
|
|
163
|
-
`;
|
|
164
|
-
} else {
|
|
165
|
-
el.addEventListener('click', event => {
|
|
166
|
-
event.stopPropagation();
|
|
167
|
-
event.preventDefault();
|
|
168
|
-
if (button.onClick) {
|
|
169
|
-
button.onClick({
|
|
170
|
-
getDownloadURL() {
|
|
171
|
-
throw new Error('not implemented for artificial sdk-added cardViews!');
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
el.innerHTML = (0, _autoHtml.default)`
|
|
177
|
-
<img src="${button.iconUrl}">
|
|
178
|
-
`;
|
|
179
|
-
el.title = button.tooltip;
|
|
180
|
-
}
|
|
181
|
-
buttonContainer.appendChild(el);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
getTitle() {
|
|
185
|
-
return this._element.title;
|
|
186
|
-
}
|
|
187
|
-
async getDownloadURL() {
|
|
188
|
-
const overlayView = this._overlayView;
|
|
189
|
-
if (!overlayView) throw new Error('This method only works during a button onClick callback in Inbox');
|
|
190
|
-
return overlayView.getDownloadURL();
|
|
191
|
-
}
|
|
192
|
-
setOverlay(overlayView) {
|
|
193
|
-
this._overlayView = overlayView;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
var _default = (0, _ud.defn)(module, InboxAttachmentCardView);
|
|
197
|
-
exports.default = _default;
|