@inboxsdk/core 1.0.5 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/inboxsdk.js +25 -192
- package/inboxsdk.js.map +1 -1
- package/package.json +1 -1
- package/pageWorld.js +3 -47
- package/pageWorld.js.map +1 -1
- package/src/inboxsdk-js/inboxsdk-NONREMOTE-INTEGRATED-PAGEWORLD.d.ts +3 -0
- package/src/inboxsdk-js/inboxsdk-NONREMOTE-INTEGRATED-PAGEWORLD.d.ts.map +1 -0
- package/src/inboxsdk-js/inboxsdk-NONREMOTE-INTEGRATED-PAGEWORLD.js +3 -8
- package/src/inboxsdk-js/inboxsdk-NONREMOTE.d.ts +3 -0
- package/src/inboxsdk-js/inboxsdk-NONREMOTE.d.ts.map +1 -0
- package/src/inboxsdk-js/inboxsdk-NONREMOTE.js +4 -6
- package/src/inboxsdk-js/inboxsdk-REMOTE.d.ts +3 -0
- package/src/inboxsdk-js/inboxsdk-REMOTE.d.ts.map +1 -0
- package/src/inboxsdk-js/inboxsdk-REMOTE.js +2 -5
- package/src/inboxsdk-js/inboxsdk-TEST.d.ts +3 -0
- package/src/inboxsdk-js/inboxsdk-TEST.d.ts.map +1 -0
- package/src/inboxsdk-js/inboxsdk-TEST.js +5 -6
- package/src/inboxsdk-js/inboxsdk.d.ts +8 -0
- package/src/inboxsdk-js/inboxsdk.d.ts.map +1 -0
- package/src/inboxsdk-js/inboxsdk.js +22 -32
- package/src/inboxsdk-js/loading/load-platform-implementation-DEV.d.ts +2 -0
- package/src/inboxsdk-js/loading/load-platform-implementation-DEV.d.ts.map +1 -0
- package/src/inboxsdk-js/loading/load-platform-implementation-DEV.js +14 -16
- package/src/inboxsdk-js/loading/platform-implementation-loader.d.ts +1 -1
- package/src/inboxsdk-js/loading/platform-implementation-loader.d.ts.map +1 -1
- package/src/injected-js/gmail/setup-gmail-interceptor.js +7 -14
- package/src/injected-js/main.js +0 -9
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.js +0 -2
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-menu-item-view.js +2 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.js +1 -2
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.test.js +10 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/index.js +39 -35
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view.js +1 -2
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-card-view.js +2 -3
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-collapsible-section-view.js +13 -14
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-compose-notice.js +1 -2
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/size-fixer.js +2 -2
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view.js +3 -4
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view.js +7 -8
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-view.js +28 -31
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-row-list-view.js +4 -5
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-row-view.js +2 -3
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.js +1 -2
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.test.js +10 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view.js +10 -11
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-toolbar-view.js +4 -5
- package/src/platform-implementation-js/dom-driver/gmail/views/native-gmail-nav-item-view.js +3 -4
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-mole-view-driver.js +2 -3
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-tooltip-view.js +2 -3
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-backdrop.js +2 -3
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-drawer-view.js +5 -6
- package/src/platform-implementation-js/driver-common/sidebar/AppSidebar.js +1 -2
- package/src/platform-implementation-js/driver-common/sidebar/ContentPanelViewDriver.js +4 -5
- package/src/platform-implementation-js/lib/idMap.d.ts +1 -2
- package/src/platform-implementation-js/lib/idMap.d.ts.map +1 -1
- package/src/platform-implementation-js/lib/idMap.js +4 -44
- package/src/platform-implementation-js/lib/inject-script-EMBEDDED.d.ts.map +1 -1
- package/src/platform-implementation-js/lib/inject-script-EMBEDDED.js +3 -4
- package/src/platform-implementation-js/lib/react/ElementContainer.js +3 -7
- package/src/platform-implementation-js/main-INTEGRATED-PAGEWORLD.d.ts +3 -0
- package/src/platform-implementation-js/main-INTEGRATED-PAGEWORLD.d.ts.map +1 -0
- package/src/platform-implementation-js/main-INTEGRATED-PAGEWORLD.js +5 -9
- package/src/platform-implementation-js/main.d.ts +5 -0
- package/src/platform-implementation-js/main.d.ts.map +1 -0
- package/src/platform-implementation-js/main.js +38 -61
- package/src/platform-implementation-js/namespaces/conversations.js +2 -3
- package/src/platform-implementation-js/namespaces/lists.js +1 -2
- package/src/platform-implementation-js/namespaces/nav-menu.js +2 -3
- package/src/platform-implementation-js/namespaces/router.js +3 -4
- package/src/platform-implementation-js/namespaces/toolbars.js +1 -2
- package/src/platform-implementation-js/platform-implementation.d.ts +0 -3
- package/src/platform-implementation-js/platform-implementation.js +1 -11
- package/src/platform-implementation-js/views/app-menu-item-view.js +2 -1
- package/src/platform-implementation-js/views/collapsible-panel-view.js +2 -1
- package/src/platform-implementation-js/views/content-panel-view.js +1 -2
- package/src/platform-implementation-js/views/conversations/custom-message-view.js +3 -4
- package/src/platform-implementation-js/views/conversations/message-view.js +1 -2
- package/src/platform-implementation-js/views/conversations/thread-view.js +1 -2
- package/src/platform-implementation-js/views/nav-item-view.js +1 -2
- package/src/platform-implementation-js/views/route-view/dummy-route-view-driver.js +2 -3
- package/src/platform-implementation-js/widgets/drawer-view.js +1 -2
- package/src/platform-implementation-js/widgets/modal-view.js +1 -2
- package/src/platform-implementation-js/widgets/mole-view.js +1 -2
- package/src/injected-js/inbox/setupAjaxInterceptor.js +0 -211
- package/src/injected-js/inbox/setupClickAndGetNewIframeSrc.js +0 -67
- package/src/injected-js/inbox/setupComposeViewDraftIDFinder.js +0 -35
- package/src/injected-js/inbox/setupInboxFakeWindowResizeListener.js +0 -29
- package/src/platform-implementation-js/dom-driver/gmail/custom-style.d.ts +0 -2
- package/src/platform-implementation-js/dom-driver/gmail/custom-style.d.ts.map +0 -1
- package/src/platform-implementation-js/dom-driver/gmail/custom-style.js +0 -17
- package/src/platform-implementation-js/dom-driver/inbox/__mocks__/getSidebarClassnames.js +0 -13
- package/src/platform-implementation-js/dom-driver/inbox/addNavItem.js +0 -38
- package/src/platform-implementation-js/dom-driver/inbox/addRecipientRow.js +0 -55
- package/src/platform-implementation-js/dom-driver/inbox/createLink.js +0 -19
- package/src/platform-implementation-js/dom-driver/inbox/createLink.test.js +0 -27
- package/src/platform-implementation-js/dom-driver/inbox/custom-style.js +0 -23
- package/src/platform-implementation-js/dom-driver/inbox/detection/appToolbarLocation/parser.js +0 -43
- package/src/platform-implementation-js/dom-driver/inbox/detection/attachmentCard/parser.js +0 -34
- package/src/platform-implementation-js/dom-driver/inbox/detection/attachmentOverlay/parser.js +0 -53
- package/src/platform-implementation-js/dom-driver/inbox/detection/chatSidebar/parser.js +0 -31
- package/src/platform-implementation-js/dom-driver/inbox/detection/compose/parser.js +0 -103
- package/src/platform-implementation-js/dom-driver/inbox/detection/message/parser.js +0 -69
- package/src/platform-implementation-js/dom-driver/inbox/detection/nativeDrawer/parser.js +0 -32
- package/src/platform-implementation-js/dom-driver/inbox/detection/searchBar/parser.js +0 -28
- package/src/platform-implementation-js/dom-driver/inbox/detection/thread/parser.js +0 -49
- package/src/platform-implementation-js/dom-driver/inbox/detection/thread-row/parser.js +0 -100
- package/src/platform-implementation-js/dom-driver/inbox/getComposeViewDriverLiveSet.js +0 -99
- package/src/platform-implementation-js/dom-driver/inbox/getInboxMessageIdForInboxThreadId.js +0 -36
- package/src/platform-implementation-js/dom-driver/inbox/getSidebarClassnames.js +0 -114
- package/src/platform-implementation-js/dom-driver/inbox/getSidebarClassnames.test.js +0 -73
- package/src/platform-implementation-js/dom-driver/inbox/gotoView.js +0 -39
- package/src/platform-implementation-js/dom-driver/inbox/gotoView.test.js +0 -28
- package/src/platform-implementation-js/dom-driver/inbox/inbox-butter-bar-driver.js +0 -148
- package/src/platform-implementation-js/dom-driver/inbox/inbox-driver.js +0 -866
- package/src/platform-implementation-js/dom-driver/inbox/inbox-page-communicator.js +0 -62
- package/src/platform-implementation-js/dom-driver/inbox/inboxResponseProcessor.js +0 -12
- package/src/platform-implementation-js/dom-driver/inbox/inboxResponseProcessor.test.js +0 -18
- package/src/platform-implementation-js/dom-driver/inbox/makePageParserTree.js +0 -33
- package/src/platform-implementation-js/dom-driver/inbox/pageParserOptions.js +0 -265
- package/src/platform-implementation-js/dom-driver/inbox/registerSearchSuggestionsProvider.js +0 -301
- package/src/platform-implementation-js/dom-driver/inbox/setupCustomAutocompleteSelectionHandling.js +0 -183
- package/src/platform-implementation-js/dom-driver/inbox/setupRouteViewDriverStream.js +0 -64
- package/src/platform-implementation-js/dom-driver/inbox/setupRouteViewDriverStream.test.js +0 -72
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxLabelView.js +0 -78
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxMoleViewDriver.js +0 -297
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxToolbarButtonView.js +0 -92
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxToolbarView.js +0 -54
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-sidebar-view.js +0 -272
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-toolbar-button-view.js +0 -161
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-toolbar-tooltip-view.js +0 -58
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-attachment-card-view.js +0 -198
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-attachment-overlay-view.js +0 -90
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-chat-sidebar-view.js +0 -46
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-compose-button-view.js +0 -116
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-compose-view.js +0 -843
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-custom-route-view.js +0 -76
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-custom-route-view.test.js +0 -31
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-dropdown-view.js +0 -25
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-dummy-route-view.js +0 -64
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-message-view.js +0 -275
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-modal-view.js +0 -113
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-route-view.js +0 -97
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-row-view.js +0 -316
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-view.js +0 -219
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-view.test.js +0 -171
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-tooltip-view.js +0 -128
- package/src/platform-implementation-js/dom-driver/inbox/views/inboxNavItemView.js +0 -312
- package/src/platform-implementation-js/dom-driver/inbox/waitForAnimationClickBlockerGone.js +0 -26
- package/src/platform-implementation-js/lib/rewriteCssWithIdMap.d.ts +0 -2
- package/src/platform-implementation-js/lib/rewriteCssWithIdMap.d.ts.map +0 -1
- package/src/platform-implementation-js/lib/rewriteCssWithIdMap.js +0 -4
- package/src/platform-implementation-js/lib/shared-style.js +0 -23
- package/src/types/gulp-add-src.d.ts +0 -7
|
@@ -1,76 +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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _kefir = _interopRequireDefault(require("kefir"));
|
|
10
|
-
var _kefirStopper = _interopRequireDefault(require("kefir-stopper"));
|
|
11
|
-
var _kefirBus = _interopRequireDefault(require("kefir-bus"));
|
|
12
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
var _idMap = _interopRequireDefault(require("../../../lib/idMap"));
|
|
14
|
-
var _parseParamsFromRouteID = _interopRequireDefault(require("../../../lib/parseParamsFromRouteID"));
|
|
15
|
-
var _getSidebarClassnames = _interopRequireDefault(require("../getSidebarClassnames"));
|
|
16
|
-
class InboxCustomRouteView {
|
|
17
|
-
constructor(routeID, hash) {
|
|
18
|
-
(0, _defineProperty2.default)(this, "_eventStream", (0, _kefirBus.default)());
|
|
19
|
-
(0, _defineProperty2.default)(this, "_stopper", (0, _kefirStopper.default)());
|
|
20
|
-
// Check we implement interface
|
|
21
|
-
this;
|
|
22
|
-
this._routeID = routeID;
|
|
23
|
-
this._params = (0, _parseParamsFromRouteID.default)(routeID, hash);
|
|
24
|
-
this._customViewElement = document.createElement('div');
|
|
25
|
-
this.setFullWidth(true);
|
|
26
|
-
}
|
|
27
|
-
setFullWidth(fullWidth) {
|
|
28
|
-
const centerListClassName = (0, _getSidebarClassnames.default)().centerList || 'UNKNOWN_centerList';
|
|
29
|
-
this._customViewElement.className = (0, _classnames.default)((0, _idMap.default)('custom_view_container'), {
|
|
30
|
-
[(0, _idMap.default)('custom_view_min_margins')]: fullWidth,
|
|
31
|
-
[centerListClassName]: !fullWidth
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
getStopper() {
|
|
35
|
-
return this._stopper;
|
|
36
|
-
}
|
|
37
|
-
destroy() {
|
|
38
|
-
this._eventStream.end();
|
|
39
|
-
this._stopper.destroy();
|
|
40
|
-
this._customViewElement.remove();
|
|
41
|
-
}
|
|
42
|
-
getElement() {
|
|
43
|
-
throw new Error('should not happen');
|
|
44
|
-
}
|
|
45
|
-
getType() {
|
|
46
|
-
return 'CUSTOM';
|
|
47
|
-
}
|
|
48
|
-
getRouteType() {
|
|
49
|
-
return 'CUSTOM';
|
|
50
|
-
}
|
|
51
|
-
getRouteID() {
|
|
52
|
-
return this._routeID;
|
|
53
|
-
}
|
|
54
|
-
getParams() {
|
|
55
|
-
return this._params;
|
|
56
|
-
}
|
|
57
|
-
getEventStream() {
|
|
58
|
-
return this._eventStream;
|
|
59
|
-
}
|
|
60
|
-
getCustomViewElement() {
|
|
61
|
-
return this._customViewElement;
|
|
62
|
-
}
|
|
63
|
-
refresh() {
|
|
64
|
-
throw new Error('should not happen');
|
|
65
|
-
}
|
|
66
|
-
getHash() {
|
|
67
|
-
throw new Error('should not happen');
|
|
68
|
-
}
|
|
69
|
-
addCollapsibleSection(sectionDescriptorProperty, groupOrderHint) {
|
|
70
|
-
throw new Error('should not happen');
|
|
71
|
-
}
|
|
72
|
-
addSection(sectionDescriptorProperty, groupOrderHint) {
|
|
73
|
-
throw new Error('should not happen');
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
exports.default = InboxCustomRouteView;
|
package/src/platform-implementation-js/dom-driver/inbox/views/inbox-custom-route-view.test.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _getSidebarClassnames = _interopRequireDefault(require("../getSidebarClassnames"));
|
|
5
|
-
var _idMap = _interopRequireDefault(require("../../../lib/idMap"));
|
|
6
|
-
var _inboxCustomRouteView = _interopRequireDefault(require("./inbox-custom-route-view"));
|
|
7
|
-
jest.mock('../getSidebarClassnames');
|
|
8
|
-
test('works', () => {
|
|
9
|
-
const view = new _inboxCustomRouteView.default('test/:id', 'test/456');
|
|
10
|
-
const stopperFn = jest.fn();
|
|
11
|
-
view.getStopper().onValue(stopperFn);
|
|
12
|
-
expect(view.getType()).toBe('CUSTOM');
|
|
13
|
-
expect(view.getRouteType()).toBe('CUSTOM');
|
|
14
|
-
expect(view.getRouteID()).toBe('test/:id');
|
|
15
|
-
expect(view.getParams()).toEqual({
|
|
16
|
-
id: '456'
|
|
17
|
-
});
|
|
18
|
-
const el = view.getCustomViewElement();
|
|
19
|
-
if (!el) throw new Error('should not happen');
|
|
20
|
-
document.body.appendChild(el);
|
|
21
|
-
expect(Array.from(el.classList).sort()).toEqual([(0, _idMap.default)('custom_view_container'), (0, _idMap.default)('custom_view_min_margins')].sort());
|
|
22
|
-
view.setFullWidth(false);
|
|
23
|
-
expect(Array.from(el.classList).sort()).toEqual([(0, _idMap.default)('custom_view_container'), (0, _getSidebarClassnames.default)().centerList].sort());
|
|
24
|
-
view.setFullWidth(true);
|
|
25
|
-
expect(Array.from(el.classList).sort()).toEqual([(0, _idMap.default)('custom_view_container'), (0, _idMap.default)('custom_view_min_margins')].sort());
|
|
26
|
-
expect(stopperFn).toHaveBeenCalledTimes(0);
|
|
27
|
-
expect(document.contains(el)).toBe(true);
|
|
28
|
-
view.destroy();
|
|
29
|
-
expect(stopperFn).toHaveBeenCalledTimes(1);
|
|
30
|
-
expect(document.contains(el)).toBe(false);
|
|
31
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
class InboxDropdownView {
|
|
8
|
-
constructor(className) {
|
|
9
|
-
this._containerEl = document.createElement('div');
|
|
10
|
-
this._containerEl.className = 'inboxsdk__dropdown ' + (className || '');
|
|
11
|
-
this._contentEl = document.createElement('div');
|
|
12
|
-
this._contentEl.className = 'inboxsdk__dropdown_content';
|
|
13
|
-
this._containerEl.appendChild(this._contentEl);
|
|
14
|
-
}
|
|
15
|
-
getContentElement() {
|
|
16
|
-
return this._contentEl;
|
|
17
|
-
}
|
|
18
|
-
getContainerElement() {
|
|
19
|
-
return this._containerEl;
|
|
20
|
-
}
|
|
21
|
-
destroy() {
|
|
22
|
-
this._containerEl.remove();
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.default = InboxDropdownView;
|
|
@@ -1,64 +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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _kefir = _interopRequireDefault(require("kefir"));
|
|
10
|
-
var _kefirStopper = _interopRequireDefault(require("kefir-stopper"));
|
|
11
|
-
var _kefirBus = _interopRequireDefault(require("kefir-bus"));
|
|
12
|
-
class InboxDummyRouteView {
|
|
13
|
-
constructor(type) {
|
|
14
|
-
(0, _defineProperty2.default)(this, "_eventStream", (0, _kefirBus.default)());
|
|
15
|
-
(0, _defineProperty2.default)(this, "_stopper", (0, _kefirStopper.default)());
|
|
16
|
-
// Check we implement interface
|
|
17
|
-
this;
|
|
18
|
-
this._type = type;
|
|
19
|
-
}
|
|
20
|
-
getStopper() {
|
|
21
|
-
return this._stopper;
|
|
22
|
-
}
|
|
23
|
-
destroy() {
|
|
24
|
-
this._eventStream.end();
|
|
25
|
-
this._stopper.destroy();
|
|
26
|
-
}
|
|
27
|
-
getElement() {
|
|
28
|
-
throw new Error('Should not happen');
|
|
29
|
-
}
|
|
30
|
-
getType() {
|
|
31
|
-
return this._type;
|
|
32
|
-
}
|
|
33
|
-
getRouteType() {
|
|
34
|
-
return 'UNKNOWN';
|
|
35
|
-
}
|
|
36
|
-
getRouteID() {
|
|
37
|
-
return 'UNKNOWN';
|
|
38
|
-
}
|
|
39
|
-
getParams() {
|
|
40
|
-
return {};
|
|
41
|
-
}
|
|
42
|
-
getEventStream() {
|
|
43
|
-
return this._eventStream;
|
|
44
|
-
}
|
|
45
|
-
getCustomViewElement() {
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
refresh() {
|
|
49
|
-
// stub
|
|
50
|
-
}
|
|
51
|
-
getHash() {
|
|
52
|
-
throw new Error('should not happen');
|
|
53
|
-
}
|
|
54
|
-
addCollapsibleSection(sectionDescriptorProperty, groupOrderHint) {
|
|
55
|
-
throw new Error('should not happen');
|
|
56
|
-
}
|
|
57
|
-
addSection(sectionDescriptorProperty, groupOrderHint) {
|
|
58
|
-
throw new Error('should not happen');
|
|
59
|
-
}
|
|
60
|
-
setFullWidth(fullWidth) {
|
|
61
|
-
throw new Error('should not happen');
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
exports.default = InboxDummyRouteView;
|
|
@@ -1,275 +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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _ud = require("ud");
|
|
10
|
-
var _asap = _interopRequireDefault(require("asap"));
|
|
11
|
-
var _kefir = _interopRequireDefault(require("kefir"));
|
|
12
|
-
var _kefirBus = _interopRequireDefault(require("kefir-bus"));
|
|
13
|
-
var _bignumber = _interopRequireDefault(require("bignumber.js"));
|
|
14
|
-
var _delayAsap = _interopRequireDefault(require("../../../lib/delay-asap"));
|
|
15
|
-
var _censorHTMLtree = _interopRequireDefault(require("../../../../common/censorHTMLtree"));
|
|
16
|
-
var _makeMutationObserverChunkedStream = _interopRequireDefault(require("../../../lib/dom/make-mutation-observer-chunked-stream"));
|
|
17
|
-
var _inboxAttachmentCardView = _interopRequireDefault(require("./inbox-attachment-card-view"));
|
|
18
|
-
var _findParent = _interopRequireDefault(require("../../../../common/find-parent"));
|
|
19
|
-
var _parser = _interopRequireDefault(require("../detection/message/parser"));
|
|
20
|
-
var _safeEventEmitter = _interopRequireDefault(require("../../../lib/safe-event-emitter"));
|
|
21
|
-
class AttachmentIcon extends _safeEventEmitter.default {}
|
|
22
|
-
class InboxMessageView {
|
|
23
|
-
constructor(element, driver, parsed) {
|
|
24
|
-
(0, _defineProperty2.default)(this, "_eventStream", (0, _kefirBus.default)());
|
|
25
|
-
(0, _defineProperty2.default)(this, "_attachmentCardViews", []);
|
|
26
|
-
this; // interface check
|
|
27
|
-
this._element = element;
|
|
28
|
-
this._driver = driver;
|
|
29
|
-
this._p = parsed;
|
|
30
|
-
this._stopper = this._eventStream.ignoreValues().beforeEnd(() => null);
|
|
31
|
-
|
|
32
|
-
// If our id changes, then destroy this view.
|
|
33
|
-
// getMessageViewDriverStream() will create a new view for this element.
|
|
34
|
-
(0, _makeMutationObserverChunkedStream.default)(this._element, {
|
|
35
|
-
attributes: true,
|
|
36
|
-
attributeFilter: ['data-msg-id']
|
|
37
|
-
}).toProperty(() => null).map(() => this._element.getAttribute('data-msg-id')).skipDuplicates().changes().onValue(() => {
|
|
38
|
-
this.destroy();
|
|
39
|
-
});
|
|
40
|
-
(0, _makeMutationObserverChunkedStream.default)(this._element, {
|
|
41
|
-
attributes: true,
|
|
42
|
-
attributeFilter: ['aria-expanded']
|
|
43
|
-
}).toProperty(() => null).map(() => this._element.getAttribute('aria-expanded') === 'true').skipDuplicates().changes().takeUntilBy(this._stopper).onValue(expanded => {
|
|
44
|
-
if (expanded) {
|
|
45
|
-
this._reparse();
|
|
46
|
-
} else {
|
|
47
|
-
// Destroy on collapse so that when it's uncollapsed again, the app
|
|
48
|
-
// can re-do its modifications.
|
|
49
|
-
this.destroy();
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
this._threadViewDriver = this._findThreadView();
|
|
53
|
-
if (this._threadViewDriver) {
|
|
54
|
-
this._threadViewDriver.addMessageViewDriver(this);
|
|
55
|
-
}
|
|
56
|
-
this._driver.getMessageViewElementsMap().set(this._element, this);
|
|
57
|
-
this._monitorEmailAddressHovering();
|
|
58
|
-
}
|
|
59
|
-
_findThreadView() {
|
|
60
|
-
const map = this._driver.getThreadViewElementsMap();
|
|
61
|
-
const threadViewElement = (0, _findParent.default)(this._element, el => map.has(el));
|
|
62
|
-
if (!threadViewElement) return null;
|
|
63
|
-
return map.get(threadViewElement);
|
|
64
|
-
}
|
|
65
|
-
_reparse() {
|
|
66
|
-
const oldParsed = this._p;
|
|
67
|
-
this._p = (0, _parser.default)(this._element);
|
|
68
|
-
if (this._p.errors.length > 0) {
|
|
69
|
-
this._driver.getLogger().errorSite(new Error('message reparse errors'), {
|
|
70
|
-
score: this._p.score,
|
|
71
|
-
errors: this._p.errors,
|
|
72
|
-
html: (0, _censorHTMLtree.default)(this._element)
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
if (!oldParsed.attributes.loaded && this._p.attributes.loaded) {
|
|
76
|
-
this._eventStream.emit({
|
|
77
|
-
type: 'internal',
|
|
78
|
-
eventName: 'messageLoad'
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
if (oldParsed.attributes.viewState !== this._p.attributes.viewState) {
|
|
82
|
-
this._eventStream.emit({
|
|
83
|
-
eventName: 'viewStateChange',
|
|
84
|
-
oldValue: oldParsed.attributes.viewState,
|
|
85
|
-
newValue: this._p.attributes.viewState
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
_monitorEmailAddressHovering() {
|
|
90
|
-
this._eventStream.plug(_kefir.default.fromEvents(this._element, 'mouseover').map(e => e.target).filter(element => element && element.getAttribute('email')).map(element => {
|
|
91
|
-
const contact = {
|
|
92
|
-
name: element.textContent,
|
|
93
|
-
emailAddress: element.getAttribute('email')
|
|
94
|
-
};
|
|
95
|
-
let contactType;
|
|
96
|
-
if (this._p.elements.sender && this._p.elements.sender.contains(element)) {
|
|
97
|
-
contactType = 'sender';
|
|
98
|
-
} else if (this._p.attributes.recipientElements && Array.from(this._p.attributes.recipientElements).some(el => el.contains(element))) {
|
|
99
|
-
contactType = 'recipient';
|
|
100
|
-
} else {
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
return {
|
|
104
|
-
eventName: 'contactHover',
|
|
105
|
-
messageViewDriver: this,
|
|
106
|
-
contact,
|
|
107
|
-
contactType
|
|
108
|
-
};
|
|
109
|
-
}).filter());
|
|
110
|
-
}
|
|
111
|
-
addAttachmentCardViewDriver(card) {
|
|
112
|
-
this._attachmentCardViews.push(card);
|
|
113
|
-
card.getStopper().takeUntilBy(this._stopper).onValue(() => {
|
|
114
|
-
this._attachmentCardViews = this._attachmentCardViews.filter(v => v !== card);
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
getStopper() {
|
|
118
|
-
return this._stopper;
|
|
119
|
-
}
|
|
120
|
-
getEventStream() {
|
|
121
|
-
return this._eventStream;
|
|
122
|
-
}
|
|
123
|
-
isLoaded() {
|
|
124
|
-
return this._p.attributes.loaded;
|
|
125
|
-
}
|
|
126
|
-
hasOpenReply() {
|
|
127
|
-
// Inbox associates inline replies with threads, not messages.
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
getMessageID() {
|
|
131
|
-
const {
|
|
132
|
-
inboxMessageId
|
|
133
|
-
} = this._p.attributes;
|
|
134
|
-
if (!inboxMessageId) {
|
|
135
|
-
throw new Error('Failed to find message id');
|
|
136
|
-
}
|
|
137
|
-
if (/^msg-a:/.test(inboxMessageId)) {
|
|
138
|
-
console.warn('MessageView.getMessageID() returned an incorrect message ID. This method will be deprecated soon. Use getMessageIDAsync() instead which does not have this problem.');
|
|
139
|
-
}
|
|
140
|
-
const m = /\d+$/.exec(inboxMessageId);
|
|
141
|
-
if (!m) throw new Error('Should not happen');
|
|
142
|
-
return new _bignumber.default(m[0]).toString(16);
|
|
143
|
-
}
|
|
144
|
-
async getMessageIDAsync() {
|
|
145
|
-
const {
|
|
146
|
-
inboxMessageId
|
|
147
|
-
} = this._p.attributes;
|
|
148
|
-
if (!inboxMessageId) {
|
|
149
|
-
throw new Error('Failed to find message id');
|
|
150
|
-
}
|
|
151
|
-
if (/^msg-a:/.test(inboxMessageId)) {
|
|
152
|
-
// If there's a composeView with the same id as this message, then that
|
|
153
|
-
// means this message hasn't been sent as a real email yet, and we need
|
|
154
|
-
// to wait for the send to complete before we can look up this message's
|
|
155
|
-
// id.
|
|
156
|
-
for (let inboxComposeView of this._driver.getComposeViewDriverLiveSet().values()) {
|
|
157
|
-
const draftId = await inboxComposeView.getDraftID();
|
|
158
|
-
if (draftId && `msg-a:${draftId}` === inboxMessageId) {
|
|
159
|
-
await inboxComposeView.getStopper().take(1).toPromise();
|
|
160
|
-
break;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
return await this._driver.getGmailMessageIdForSyncMessageId(inboxMessageId);
|
|
164
|
-
} else {
|
|
165
|
-
const m = /\d+$/.exec(inboxMessageId);
|
|
166
|
-
if (!m) throw new Error('Should not happen');
|
|
167
|
-
return new _bignumber.default(m[0]).toString(16);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
getContentsElement() {
|
|
171
|
-
if (!this._p.elements.body) throw new Error('Could not find body element');
|
|
172
|
-
return this._p.elements.body;
|
|
173
|
-
}
|
|
174
|
-
getLinks() {
|
|
175
|
-
throw new Error('not implemented yet');
|
|
176
|
-
}
|
|
177
|
-
isElementInQuotedArea(el) {
|
|
178
|
-
const quotedArea = (0, _findParent.default)(el, el => el.classList.contains('gmail_extra'));
|
|
179
|
-
return quotedArea != null;
|
|
180
|
-
}
|
|
181
|
-
addMoreMenuItem(options) {
|
|
182
|
-
throw new Error('not implemented yet');
|
|
183
|
-
}
|
|
184
|
-
addAttachmentIcon(options) {
|
|
185
|
-
console.warn('MessageView.addAttachmentIcon is not implemented yet in Inbox');
|
|
186
|
-
return new AttachmentIcon();
|
|
187
|
-
}
|
|
188
|
-
getAttachmentCardViewDrivers() {
|
|
189
|
-
return this._attachmentCardViews;
|
|
190
|
-
}
|
|
191
|
-
addAttachmentCard(options) {
|
|
192
|
-
const {
|
|
193
|
-
attachmentsArea
|
|
194
|
-
} = this._p.elements;
|
|
195
|
-
if (!attachmentsArea) throw new Error('Could not find attachments area');
|
|
196
|
-
let container = attachmentsArea.lastElementChild;
|
|
197
|
-
if (!container) {
|
|
198
|
-
attachmentsArea.style.display = '';
|
|
199
|
-
attachmentsArea.style.margin = '16px 0 0';
|
|
200
|
-
attachmentsArea.style.paddingTop = '16px';
|
|
201
|
-
container = document.createElement('div');
|
|
202
|
-
attachmentsArea.appendChild(container);
|
|
203
|
-
}
|
|
204
|
-
return new _inboxAttachmentCardView.default({
|
|
205
|
-
...options,
|
|
206
|
-
element: null,
|
|
207
|
-
container
|
|
208
|
-
}, this._driver);
|
|
209
|
-
}
|
|
210
|
-
addButtonToDownloadAllArea(options) {
|
|
211
|
-
// no-op in Inbox
|
|
212
|
-
}
|
|
213
|
-
getViewState() {
|
|
214
|
-
return this._p.attributes.viewState;
|
|
215
|
-
}
|
|
216
|
-
getDateString() {
|
|
217
|
-
throw new Error('not implemented yet');
|
|
218
|
-
}
|
|
219
|
-
getSender() {
|
|
220
|
-
const {
|
|
221
|
-
sender
|
|
222
|
-
} = this._p.elements;
|
|
223
|
-
if (!sender) throw new Error('could not find sender element');
|
|
224
|
-
const emailAddress = sender.getAttribute('email');
|
|
225
|
-
if (!emailAddress) throw new Error('could not find email address');
|
|
226
|
-
return {
|
|
227
|
-
emailAddress,
|
|
228
|
-
name: sender.textContent
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
getRecipients() {
|
|
232
|
-
const userContact = this._driver.getUserContact();
|
|
233
|
-
return Array.prototype.map.call(this._p.attributes.recipientElements, el => {
|
|
234
|
-
const emailAddress = el.getAttribute('email');
|
|
235
|
-
if (emailAddress === userContact.emailAddress) {
|
|
236
|
-
return userContact;
|
|
237
|
-
}
|
|
238
|
-
return {
|
|
239
|
-
emailAddress,
|
|
240
|
-
name: el.textContent
|
|
241
|
-
};
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
getRecipientEmailAddresses() {
|
|
245
|
-
return this.getRecipients().map(_ref => {
|
|
246
|
-
let {
|
|
247
|
-
emailAddress
|
|
248
|
-
} = _ref;
|
|
249
|
-
return emailAddress;
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
async getRecipientsFull() {
|
|
253
|
-
return this.getRecipients();
|
|
254
|
-
}
|
|
255
|
-
getThreadViewDriver() {
|
|
256
|
-
if (!this._threadViewDriver) throw new Error('failed to find threadView');
|
|
257
|
-
return this._threadViewDriver;
|
|
258
|
-
}
|
|
259
|
-
getReadyStream() {
|
|
260
|
-
// Needs to emit after any attachment cards have been added in order for
|
|
261
|
-
// an app calling getFileAttachmentCardViews() immediately to see the cards.
|
|
262
|
-
// The cards are emitted several microtasks after the message, so we delay
|
|
263
|
-
// by about 10 microtasks here. An integration test tests this at least.
|
|
264
|
-
// TODO something else.
|
|
265
|
-
return _kefir.default.repeat(i => i > 10 ? null : (0, _delayAsap.default)(null)).ignoreValues().beforeEnd(() => null);
|
|
266
|
-
}
|
|
267
|
-
destroy() {
|
|
268
|
-
this._eventStream.end();
|
|
269
|
-
this._attachmentCardViews.slice().forEach(card => {
|
|
270
|
-
card.destroy();
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
var _default = (0, _ud.defn)(module, InboxMessageView);
|
|
275
|
-
exports.default = _default;
|
|
@@ -1,113 +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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _ud = require("ud");
|
|
10
|
-
var _sortBy = _interopRequireDefault(require("lodash/sortBy"));
|
|
11
|
-
var _kefir = _interopRequireDefault(require("kefir"));
|
|
12
|
-
var _kefirBus = _interopRequireDefault(require("kefir-bus"));
|
|
13
|
-
var _insertElementInOrder = _interopRequireDefault(require("../../../lib/dom/insert-element-in-order"));
|
|
14
|
-
var _querySelectorOrFail = _interopRequireDefault(require("../../../lib/dom/querySelectorOrFail"));
|
|
15
|
-
class InboxModalView {
|
|
16
|
-
constructor(options) {
|
|
17
|
-
(0, _defineProperty2.default)(this, "_eventStream", (0, _kefirBus.default)());
|
|
18
|
-
this._setupModalContainerElement(options);
|
|
19
|
-
this._processOptions(options);
|
|
20
|
-
const closeElement = (0, _querySelectorOrFail.default)(this._modalContainerElement, '.inboxsdk__close_button');
|
|
21
|
-
closeElement.addEventListener('click', event => {
|
|
22
|
-
this._eventStream.emit({
|
|
23
|
-
eventName: 'closeClick',
|
|
24
|
-
domEvent: event
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
destroy() {
|
|
29
|
-
this._modalContainerElement.remove();
|
|
30
|
-
this._eventStream.end();
|
|
31
|
-
}
|
|
32
|
-
getModalContainerElement() {
|
|
33
|
-
return this._modalContainerElement;
|
|
34
|
-
}
|
|
35
|
-
getEventStream() {
|
|
36
|
-
return this._eventStream;
|
|
37
|
-
}
|
|
38
|
-
_processOptions(options) {
|
|
39
|
-
this.setTitle(options.title);
|
|
40
|
-
this.setContentElement(options.el);
|
|
41
|
-
this.setButtons(options.buttons || []);
|
|
42
|
-
this.setChromeClasses(options.chrome, options.showCloseButton);
|
|
43
|
-
}
|
|
44
|
-
setTitle(title) {
|
|
45
|
-
const heading = (0, _querySelectorOrFail.default)(this._modalContainerElement, '[role=heading]');
|
|
46
|
-
if (!title) {
|
|
47
|
-
heading.style.display = 'none';
|
|
48
|
-
} else {
|
|
49
|
-
heading.style.display = '';
|
|
50
|
-
heading.textContent = title;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
setContentElement(element) {
|
|
54
|
-
const content = (0, _querySelectorOrFail.default)(this._modalContainerElement, '.inboxsdk__modal_content');
|
|
55
|
-
content.innerHTML = '';
|
|
56
|
-
if (typeof element === 'string') {
|
|
57
|
-
content.innerHTML = element;
|
|
58
|
-
} else if (element instanceof Element) {
|
|
59
|
-
content.appendChild(element);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
setButtons(buttons) {
|
|
63
|
-
const buttonContainer = (0, _querySelectorOrFail.default)(this._modalContainerElement, '.inboxsdk__modal_buttons');
|
|
64
|
-
if (buttons.length > 0) {
|
|
65
|
-
this._modalContainerElement.classList.add('inboxsdk__modal_hasButtons');
|
|
66
|
-
} else {
|
|
67
|
-
this._modalContainerElement.classList.remove('inboxsdk__modal_hasButtons');
|
|
68
|
-
}
|
|
69
|
-
buttonContainer.innerHTML = '';
|
|
70
|
-
(0, _sortBy.default)(buttons, [button => button.type === 'PRIMARY_ACTION' ? 0 : 1, button => button.orderHint || 0]).forEach(buttonDescriptor => {
|
|
71
|
-
var buttonEl = document.createElement('input');
|
|
72
|
-
buttonEl.className = buttonDescriptor.type === 'PRIMARY_ACTION' ? 'inboxsdk__primary' : '';
|
|
73
|
-
buttonEl.type = 'button';
|
|
74
|
-
buttonEl.value = buttonDescriptor.text;
|
|
75
|
-
buttonEl.addEventListener('click', event => {
|
|
76
|
-
event.preventDefault();
|
|
77
|
-
buttonDescriptor.onClick.call(null);
|
|
78
|
-
});
|
|
79
|
-
buttonContainer.appendChild(buttonEl);
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
setChromeClasses(chrome, showCloseButton) {
|
|
83
|
-
if (chrome === false) {
|
|
84
|
-
this._modalContainerElement.classList.add('inboxsdk__modal_chromeless');
|
|
85
|
-
} else {
|
|
86
|
-
this._modalContainerElement.classList.remove('inboxsdk__modal_chromeless');
|
|
87
|
-
}
|
|
88
|
-
if (showCloseButton) {
|
|
89
|
-
this._modalContainerElement.classList.add('inboxsdk__modal_showCloseButton');
|
|
90
|
-
} else {
|
|
91
|
-
this._modalContainerElement.classList.remove('inboxsdk__modal_showCloseButton');
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
_setupModalContainerElement(options) {
|
|
95
|
-
const constrainTitleWidthTopRowClass = options.constrainTitleWidth ? 'inboxsdk__modal_toprow--constrain-title-width' : '';
|
|
96
|
-
this._modalContainerElement = document.createElement('div');
|
|
97
|
-
this._modalContainerElement.className = 'inboxsdk__modal_fullscreen';
|
|
98
|
-
var htmlString = `
|
|
99
|
-
<div class="inboxsdk__modal_container" tabindex="0" role="alertdialog">
|
|
100
|
-
<div class="inboxsdk__modal_toprow ${constrainTitleWidthTopRowClass}">
|
|
101
|
-
<span role="heading"></span>
|
|
102
|
-
<button title="Close" class="inboxsdk__close_button"></button>
|
|
103
|
-
</div>
|
|
104
|
-
<div class="inboxsdk__modal_content">
|
|
105
|
-
</div>
|
|
106
|
-
<div class="inboxsdk__modal_buttons"></div>
|
|
107
|
-
</div>
|
|
108
|
-
`;
|
|
109
|
-
this._modalContainerElement.innerHTML = htmlString;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
var _default = (0, _ud.defn)(module, InboxModalView);
|
|
113
|
-
exports.default = _default;
|
|
@@ -1,97 +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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _includes = _interopRequireDefault(require("lodash/includes"));
|
|
10
|
-
var _kefir = _interopRequireDefault(require("kefir"));
|
|
11
|
-
var _kefirStopper = _interopRequireDefault(require("kefir-stopper"));
|
|
12
|
-
var _kefirBus = _interopRequireDefault(require("kefir-bus"));
|
|
13
|
-
var _router = require("../../../constants/router");
|
|
14
|
-
function getRouteID(path) {
|
|
15
|
-
if (path === '') {
|
|
16
|
-
return _router.NATIVE_ROUTE_IDS.INBOX;
|
|
17
|
-
}
|
|
18
|
-
if ((0, _includes.default)(['snoozed', 'reminders', 'done', 'spam', 'trash'], path)) {
|
|
19
|
-
return _router.NATIVE_ROUTE_IDS[path.toUpperCase()];
|
|
20
|
-
}
|
|
21
|
-
if (/search\//.test(path)) {
|
|
22
|
-
return _router.NATIVE_ROUTE_IDS.SEARCH;
|
|
23
|
-
}
|
|
24
|
-
return 'UNKNOWN';
|
|
25
|
-
}
|
|
26
|
-
function getParams(path) {
|
|
27
|
-
const parts = path.split('/');
|
|
28
|
-
if (parts.length < 2) {
|
|
29
|
-
return {};
|
|
30
|
-
}
|
|
31
|
-
return {
|
|
32
|
-
query: decodeURIComponent(parts[1])
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
class InboxRouteView {
|
|
36
|
-
constructor(el, type) {
|
|
37
|
-
(0, _defineProperty2.default)(this, "_eventStream", (0, _kefirBus.default)());
|
|
38
|
-
(0, _defineProperty2.default)(this, "_stopper", (0, _kefirStopper.default)());
|
|
39
|
-
// Check we implement interface
|
|
40
|
-
this;
|
|
41
|
-
this._element = el;
|
|
42
|
-
this._type = type;
|
|
43
|
-
const path = document.location.pathname.slice(1);
|
|
44
|
-
this._routeID = getRouteID(path);
|
|
45
|
-
this._params = getParams(path);
|
|
46
|
-
this._routeType = this._routeID === 'UNKNOWN' ? 'UNKNOWN' : 'LIST';
|
|
47
|
-
|
|
48
|
-
// console.log('el jsan', el.getAttribute('jsan'));
|
|
49
|
-
// if (this._type === 'CUSTOM') {
|
|
50
|
-
// }
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
getStopper() {
|
|
54
|
-
return this._stopper;
|
|
55
|
-
}
|
|
56
|
-
destroy() {
|
|
57
|
-
this._eventStream.end();
|
|
58
|
-
this._stopper.destroy();
|
|
59
|
-
}
|
|
60
|
-
getElement() {
|
|
61
|
-
return this._element;
|
|
62
|
-
}
|
|
63
|
-
getType() {
|
|
64
|
-
return this._type;
|
|
65
|
-
}
|
|
66
|
-
getRouteType() {
|
|
67
|
-
return this._routeType;
|
|
68
|
-
}
|
|
69
|
-
getRouteID() {
|
|
70
|
-
return this._routeID;
|
|
71
|
-
}
|
|
72
|
-
getParams() {
|
|
73
|
-
return this._params;
|
|
74
|
-
}
|
|
75
|
-
getEventStream() {
|
|
76
|
-
return this._eventStream;
|
|
77
|
-
}
|
|
78
|
-
refresh() {
|
|
79
|
-
// stub
|
|
80
|
-
}
|
|
81
|
-
getHash() {
|
|
82
|
-
throw new Error('should not happen');
|
|
83
|
-
}
|
|
84
|
-
getCustomViewElement() {
|
|
85
|
-
throw new Error('should not happen');
|
|
86
|
-
}
|
|
87
|
-
addCollapsibleSection(sectionDescriptorProperty, groupOrderHint) {
|
|
88
|
-
throw new Error('not implemented yet');
|
|
89
|
-
}
|
|
90
|
-
addSection(sectionDescriptorProperty, groupOrderHint) {
|
|
91
|
-
throw new Error('not implemented yet');
|
|
92
|
-
}
|
|
93
|
-
setFullWidth(fullWidth) {
|
|
94
|
-
throw new Error('should not happen');
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
exports.default = InboxRouteView;
|