@inboxsdk/core 2.1.3 → 2.1.5
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 +579 -507
- package/inboxsdk.js.map +1 -1
- package/package.json +1 -1
- package/pageWorld.js.map +1 -1
- package/src/inboxsdk.d.ts +2 -6
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/gmail-load-event.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/isIntegratedViewGmail.d.ts +6 -6
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/isIntegratedViewGmail.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.d.ts +12 -57
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.d.ts +4 -7
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/index.d.ts +10 -36
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/index.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-mole-view-driver.d.ts +1 -8
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-mole-view-driver.d.ts.map +1 -1
- package/src/platform-implementation-js/driver-common/sidebar/ContentPanelViewDriver.d.ts +4 -12
- package/src/platform-implementation-js/driver-common/sidebar/ContentPanelViewDriver.d.ts.map +1 -1
- package/src/platform-implementation-js/lib/logger.d.ts +7 -2
- package/src/platform-implementation-js/lib/logger.d.ts.map +1 -1
- package/src/platform-implementation-js/views/content-panel-view.d.ts +9 -3
- package/src/platform-implementation-js/views/content-panel-view.d.ts.map +1 -1
package/inboxsdk.js
CHANGED
|
@@ -832,7 +832,7 @@ function isElementVisible(el) {
|
|
|
832
832
|
|
|
833
833
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- SDK_VERSION is injected by webpack
|
|
834
834
|
///@ts-ignore
|
|
835
|
-
const BUILD_VERSION = "2.1.
|
|
835
|
+
const BUILD_VERSION = "2.1.5-1696881387401-5c0ff20cfc735daf";
|
|
836
836
|
if (false) {}
|
|
837
837
|
|
|
838
838
|
/***/ }),
|
|
@@ -1052,23 +1052,20 @@ const gotoView = ud__WEBPACK_IMPORTED_MODULE_2__.defn(module, async function got
|
|
|
1052
1052
|
|
|
1053
1053
|
"use strict";
|
|
1054
1054
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1055
|
-
/* harmony export */ "
|
|
1056
|
-
/* harmony export */ "
|
|
1055
|
+
/* harmony export */ "Jv": () => (/* binding */ isGoogleChatEnabled),
|
|
1056
|
+
/* harmony export */ "ZP": () => (/* binding */ isIntegratedViewGmail),
|
|
1057
|
+
/* harmony export */ "ky": () => (/* binding */ isCollapsiblePanelHidden)
|
|
1057
1058
|
/* harmony export */ });
|
|
1058
1059
|
/**
|
|
1059
|
-
*
|
|
1060
|
-
- The user is in a pre-Google-Chat Hangouts-only version of Gmail (the Gmail Settings ->
|
|
1061
|
-
Chat and Meet -> Chat menu only has the options "Hangouts On" and "Hangouts Off").
|
|
1062
|
-
- The user has "Classic Hangouts" picked in Gmail Settings -> Chat and Meet -> Chat.
|
|
1063
|
-
- Integrated view gmail.
|
|
1060
|
+
* As of writing, @returns true when either Google Chat or Google Meet or both are enabled.
|
|
1064
1061
|
* @see https://support.google.com/mail/answer/11555490
|
|
1065
1062
|
*/
|
|
1066
1063
|
function isIntegratedViewGmail() {
|
|
1067
|
-
const nav = document.querySelector('div[role=navigation]');
|
|
1068
|
-
return
|
|
1064
|
+
const nav = document.querySelector('div[role=navigation] > :nth-child(1).Xa');
|
|
1065
|
+
return nav != null;
|
|
1069
1066
|
}
|
|
1070
1067
|
|
|
1071
|
-
/** @returns null if the app menu is configured off */
|
|
1068
|
+
/** @returns null if the app menu (left side menu containing Mail, Chat/Spaces, and Meet) is configured off */
|
|
1072
1069
|
function isCollapsiblePanelHidden() {
|
|
1073
1070
|
if (!isIntegratedViewGmail()) {
|
|
1074
1071
|
return null;
|
|
@@ -1076,6 +1073,13 @@ function isCollapsiblePanelHidden() {
|
|
|
1076
1073
|
return document.querySelector('div[role=navigation].aBA') != null;
|
|
1077
1074
|
}
|
|
1078
1075
|
|
|
1076
|
+
/**
|
|
1077
|
+
* @note only able to @return true when @see {isIntegratedViewGmail} returns true
|
|
1078
|
+
*/
|
|
1079
|
+
function isGoogleChatEnabled() {
|
|
1080
|
+
return document.querySelector('div[role=navigation] > .ao4') != null;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1079
1083
|
/***/ }),
|
|
1080
1084
|
|
|
1081
1085
|
/***/ 86844:
|
|
@@ -1536,7 +1540,7 @@ const GmailElementGetter = {
|
|
|
1536
1540
|
return document.querySelector('.brC-aT5-aOt-Jw');
|
|
1537
1541
|
},
|
|
1538
1542
|
getComposeButton() {
|
|
1539
|
-
if ((0,isIntegratedViewGmail/* default */.
|
|
1543
|
+
if ((0,isIntegratedViewGmail/* default */.ZP)()) {
|
|
1540
1544
|
return document.querySelector('.aIH .aic div[role=button].L3');
|
|
1541
1545
|
}
|
|
1542
1546
|
return document.querySelector('[gh=cm]');
|
|
@@ -1551,7 +1555,7 @@ const GmailElementGetter = {
|
|
|
1551
1555
|
// finds something different than the old method, so that way we can
|
|
1552
1556
|
// figure out if it's okay to swap over.
|
|
1553
1557
|
const el = document.querySelector('div.nH.bkK > .nH');
|
|
1554
|
-
if ((0,isIntegratedViewGmail/* default */.
|
|
1558
|
+
if ((0,isIntegratedViewGmail/* default */.ZP)()) {
|
|
1555
1559
|
return el;
|
|
1556
1560
|
} else {
|
|
1557
1561
|
const leftNavContainer = GmailElementGetter.getLeftNavContainerElement();
|
|
@@ -1605,7 +1609,7 @@ const GmailElementGetter = {
|
|
|
1605
1609
|
if (this.getAppMenu()) {
|
|
1606
1610
|
return this.getAppMenuContainer()?.querySelector('.aqn.aIH') ?? null;
|
|
1607
1611
|
}
|
|
1608
|
-
if ((0,isIntegratedViewGmail/* default */.
|
|
1612
|
+
if ((0,isIntegratedViewGmail/* default */.ZP)()) {
|
|
1609
1613
|
return document.querySelector('div[role=navigation] + div.aqn');
|
|
1610
1614
|
}
|
|
1611
1615
|
return document.querySelector('.aeN');
|
|
@@ -1634,7 +1638,7 @@ const GmailElementGetter = {
|
|
|
1634
1638
|
* in their own sections at the bottom of the leftnav).
|
|
1635
1639
|
*/
|
|
1636
1640
|
shouldAddNavItemsInline() {
|
|
1637
|
-
if ((0,isIntegratedViewGmail/* default */.
|
|
1641
|
+
if ((0,isIntegratedViewGmail/* default */.ZP)()) {
|
|
1638
1642
|
return true;
|
|
1639
1643
|
}
|
|
1640
1644
|
const leftNavElement = document.querySelector('.aeN[role=navigation], .aeN [role=navigation]');
|
|
@@ -1689,7 +1693,7 @@ const GmailElementGetter = {
|
|
|
1689
1693
|
return document.querySelector('.aeN');
|
|
1690
1694
|
},
|
|
1691
1695
|
getSameSectionNavItemMenuInjectionContainer() {
|
|
1692
|
-
if ((0,isIntegratedViewGmail/* default */.
|
|
1696
|
+
if ((0,isIntegratedViewGmail/* default */.ZP)()) {
|
|
1693
1697
|
return document.querySelector('.yJ .wT > .n3');
|
|
1694
1698
|
} else {
|
|
1695
1699
|
return document.querySelector('.aeN .n3');
|
|
@@ -3108,35 +3112,42 @@ const sidebarWaitingPlatformClassName = classnames_default()(cssGlobal, "inboxsd
|
|
|
3108
3112
|
|
|
3109
3113
|
|
|
3110
3114
|
const ACTIVE_ADD_ON_ICON_SELECTOR = '.aT5-aOt-I-KO';
|
|
3111
|
-
const COMPANION_SIDEBAR_CONTENT_CLOSED_SHADOW_CLASS = 'brC-brG-btc';
|
|
3112
|
-
// there are multiple InboxSDK instances and/or extensions. All other InboxSDK
|
|
3113
|
-
// instances (including from other extensions) communicate with this Primary
|
|
3114
|
-
// through DOM events.
|
|
3115
|
+
const COMPANION_SIDEBAR_CONTENT_CLOSED_SHADOW_CLASS = 'brC-brG-btc';
|
|
3115
3116
|
|
|
3117
|
+
/** Only one instance of this Primary is ever created within a page, even if
|
|
3118
|
+
* there are multiple InboxSDK instances and/or extensions. All other InboxSDK
|
|
3119
|
+
* instances (including from other extensions) communicate with this Primary
|
|
3120
|
+
* through DOM events. */
|
|
3116
3121
|
class GmailAppSidebarPrimary {
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3122
|
+
#stopper = kefir_stopper_js_default()();
|
|
3123
|
+
/**
|
|
3124
|
+
* There could be multiple InboxSDK instances (and therefore GmailDrivers)
|
|
3125
|
+
* talking to this Primary, so we shouldn't privilege the specific GmailDriver
|
|
3126
|
+
* that happened to create the Primary. Only use this GmailDriver for
|
|
3127
|
+
* logging-related functionality!
|
|
3128
|
+
*/
|
|
3129
|
+
#driver;
|
|
3130
|
+
/**
|
|
3131
|
+
* This Primary has an identifier used by the DOM events to specify they're
|
|
3132
|
+
* talking to this Primary. This leaves us some room for having multiple
|
|
3133
|
+
* Primary instances (representing different visual locations in Gmail) or
|
|
3134
|
+
* multiple classes that make use of the same DOM events, but we don't make
|
|
3135
|
+
* use of that now. Mainly I didn't want to risk baking in the singleton
|
|
3136
|
+
* nature too deeply; that always seems to bite me.
|
|
3137
|
+
*/
|
|
3138
|
+
#instanceId = `${Date.now()}-${Math.random()}`;
|
|
3139
|
+
#companionSidebarContentContainerEl;
|
|
3140
|
+
#instanceIdsToDescriptors = new Map();
|
|
3141
|
+
#threadSidebarComponent = null;
|
|
3142
|
+
#threadIconArea = null;
|
|
3143
|
+
#globalIconArea = null;
|
|
3144
|
+
#globalButtonContainers = new Map();
|
|
3145
|
+
#threadButtonContainers = new Map();
|
|
3146
|
+
#contentContainers = new Map();
|
|
3147
|
+
#threadSidebarContainerEl = null;
|
|
3148
|
+
#companionSidebarOuterWrapper;
|
|
3149
|
+
#currentIds = new Set();
|
|
3150
|
+
#orderManager = new (order_manager_js_default())({
|
|
3140
3151
|
get() {
|
|
3141
3152
|
try {
|
|
3142
3153
|
return JSON.parse(__webpack_require__.g.localStorage.getItem('inboxsdk__sidebar_ordering') || 'null');
|
|
@@ -3152,53 +3163,58 @@ class GmailAppSidebarPrimary {
|
|
|
3152
3163
|
}
|
|
3153
3164
|
}
|
|
3154
3165
|
});
|
|
3155
|
-
|
|
3166
|
+
#containerProp;
|
|
3167
|
+
#updateHighlightedAppThreadIconBus = kefir_bus_default()();
|
|
3156
3168
|
constructor(driver, companionSidebarContentContainerElement) {
|
|
3157
|
-
this
|
|
3158
|
-
this
|
|
3159
|
-
this
|
|
3169
|
+
this.#driver = driver;
|
|
3170
|
+
this.#companionSidebarContentContainerEl = companionSidebarContentContainerElement;
|
|
3171
|
+
this.#setupElement();
|
|
3160
3172
|
}
|
|
3161
3173
|
getInstanceId() {
|
|
3162
|
-
return this
|
|
3174
|
+
return this.#instanceId;
|
|
3163
3175
|
}
|
|
3164
3176
|
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3177
|
+
/**
|
|
3178
|
+
* Only use this if a different Primary needs to take over this one's elements.
|
|
3179
|
+
* Currently this is only done when hot-reloading in dev. Don't use this when
|
|
3180
|
+
* a threadview exits, the sdk.destroy() is called, etc.
|
|
3181
|
+
*/
|
|
3168
3182
|
destroy() {
|
|
3169
|
-
this.
|
|
3183
|
+
this.#stopper.destroy();
|
|
3170
3184
|
}
|
|
3171
3185
|
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3186
|
+
/**
|
|
3187
|
+
* This value controls whether the app sidebar should automatically open
|
|
3188
|
+
* itself when available when the chat sidebar isn't present. It's only set
|
|
3189
|
+
* if the user interacts with the app sidebar button.
|
|
3190
|
+
*/
|
|
3191
|
+
#getShouldGlobalAppSidebarOpen() {
|
|
3176
3192
|
return __webpack_require__.g.localStorage.getItem('inboxsdk__global_app_sidebar_should_open') === 'true';
|
|
3177
3193
|
}
|
|
3178
|
-
|
|
3194
|
+
#setShouldGlobalAppSidebarOpen(open) {
|
|
3179
3195
|
try {
|
|
3180
3196
|
__webpack_require__.g.localStorage.setItem('inboxsdk__global_app_sidebar_should_open', String(open));
|
|
3181
3197
|
} catch (err) {
|
|
3182
3198
|
console.error('error saving', err);
|
|
3183
3199
|
}
|
|
3184
3200
|
}
|
|
3185
|
-
|
|
3201
|
+
#getShouldThreadAppSidebarOpen() {
|
|
3186
3202
|
return __webpack_require__.g.localStorage.getItem('inboxsdk__thread_app_sidebar_should_open') !== 'false';
|
|
3187
3203
|
}
|
|
3188
|
-
|
|
3204
|
+
#setShouldThreadAppSidebarOpen(open) {
|
|
3189
3205
|
try {
|
|
3190
3206
|
__webpack_require__.g.localStorage.setItem('inboxsdk__thread_app_sidebar_should_open', String(open));
|
|
3191
3207
|
} catch (err) {
|
|
3192
3208
|
console.error('error saving', err);
|
|
3193
3209
|
}
|
|
3194
3210
|
}
|
|
3195
|
-
|
|
3196
|
-
if (this
|
|
3197
|
-
const threadSidebarContainerEl = this
|
|
3211
|
+
#createThreadSidebarIfNeeded() {
|
|
3212
|
+
if (this.#threadSidebarContainerEl) return this.#threadSidebarContainerEl;
|
|
3213
|
+
const threadSidebarContainerEl = this.#threadSidebarContainerEl = document.createElement('div');
|
|
3198
3214
|
threadSidebarContainerEl.classList.add('thread_app_sidebar', (0,idMap/* default */.Z)('app_sidebar_container'), 'addon_sidebar');
|
|
3199
|
-
this.
|
|
3200
|
-
this
|
|
3201
|
-
this.
|
|
3215
|
+
this.#companionSidebarContentContainerEl.insertBefore(threadSidebarContainerEl, this.#companionSidebarContentContainerEl.firstElementChild);
|
|
3216
|
+
this.#containerProp = () => threadSidebarContainerEl;
|
|
3217
|
+
this.#updateHighlightedAppThreadIconBus.bufferWithTimeOrCount(150, 100).filter(events => events.length > 0).takeUntilBy(this.#stopper).onValue(() => {
|
|
3202
3218
|
// Before touching this code, make sure you understand the meaning of the clientRect
|
|
3203
3219
|
// values and of scrollTop. In particular, make sure you understand the distinction of
|
|
3204
3220
|
// absolute (the scroll[Top|Bottom|Height] values) vs relative (the BoundingRect top
|
|
@@ -3240,9 +3256,9 @@ class GmailAppSidebarPrimary {
|
|
|
3240
3256
|
const instanceId = titleBar.getAttribute('data-instance-id');
|
|
3241
3257
|
const appName = titleBar.getAttribute('data-app-name');
|
|
3242
3258
|
if (!appName) return;
|
|
3243
|
-
const appButton = this.
|
|
3244
|
-
if (!appButton || !this
|
|
3245
|
-
const activeButtonContainer = this.
|
|
3259
|
+
const appButton = this.#threadButtonContainers.get(appName);
|
|
3260
|
+
if (!appButton || !this.#threadIconArea) return;
|
|
3261
|
+
const activeButtonContainer = this.#threadIconArea.querySelector('.sidebar_button_container_active');
|
|
3246
3262
|
if (activeButtonContainer) {
|
|
3247
3263
|
activeButtonContainer.classList.remove('sidebar_button_container_active');
|
|
3248
3264
|
}
|
|
@@ -3251,61 +3267,61 @@ class GmailAppSidebarPrimary {
|
|
|
3251
3267
|
});
|
|
3252
3268
|
|
|
3253
3269
|
//listen for scroll and update active icon if needed
|
|
3254
|
-
this.
|
|
3270
|
+
this.#updateHighlightedAppThreadIconBus.plug(kefir_esm.fromEvents(threadSidebarContainerEl, 'scroll').map(() => null));
|
|
3255
3271
|
|
|
3256
3272
|
// handle rendering thread sidebar contents
|
|
3257
|
-
this
|
|
3273
|
+
this.#renderThreadSidebar();
|
|
3258
3274
|
return threadSidebarContainerEl;
|
|
3259
3275
|
}
|
|
3260
|
-
|
|
3261
|
-
if (!this
|
|
3276
|
+
#renderThreadSidebarIfPresent() {
|
|
3277
|
+
if (!this.#threadSidebarContainerEl) {
|
|
3262
3278
|
return;
|
|
3263
3279
|
}
|
|
3264
|
-
this
|
|
3280
|
+
this.#renderThreadSidebar();
|
|
3265
3281
|
}
|
|
3266
|
-
|
|
3282
|
+
#appSidebarRefSetter = threadSidebarComponent => {
|
|
3267
3283
|
if (threadSidebarComponent) {
|
|
3268
|
-
this
|
|
3284
|
+
this.#threadSidebarComponent = threadSidebarComponent;
|
|
3269
3285
|
}
|
|
3270
3286
|
};
|
|
3271
|
-
|
|
3272
|
-
const threadSidebarContainerEl = this
|
|
3287
|
+
#renderThreadSidebar() {
|
|
3288
|
+
const threadSidebarContainerEl = this.#threadSidebarContainerEl;
|
|
3273
3289
|
if (!threadSidebarContainerEl) {
|
|
3274
3290
|
throw new Error('_renderThreadSidebar should not be called when _threadSidebarContainerEl is unset');
|
|
3275
3291
|
}
|
|
3276
3292
|
return new Promise(resolve => {
|
|
3277
3293
|
react_dom.render( /*#__PURE__*/react.createElement(AppSidebar, {
|
|
3278
|
-
ref: this
|
|
3279
|
-
panels: this.
|
|
3294
|
+
ref: this.#appSidebarRefSetter,
|
|
3295
|
+
panels: this.#orderManager.getOrderedItems().map(x => x.value),
|
|
3280
3296
|
onMoveEnd: (newList, movedItem, oldIndex, newIndex) => {
|
|
3281
|
-
this.
|
|
3282
|
-
this
|
|
3297
|
+
this.#orderManager.moveItem(oldIndex, newIndex);
|
|
3298
|
+
this.#renderThreadSidebar();
|
|
3283
3299
|
},
|
|
3284
3300
|
onExpandedToggle: () => {
|
|
3285
|
-
this.
|
|
3301
|
+
this.#updateHighlightedAppThreadIconBus.emit(null);
|
|
3286
3302
|
},
|
|
3287
|
-
container: this
|
|
3303
|
+
container: this.#containerProp
|
|
3288
3304
|
}), threadSidebarContainerEl, () => {
|
|
3289
|
-
if (!this
|
|
3305
|
+
if (!this.#threadSidebarComponent) {
|
|
3290
3306
|
throw new Error('Should not happen');
|
|
3291
3307
|
}
|
|
3292
|
-
resolve(this
|
|
3293
|
-
this.
|
|
3308
|
+
resolve(this.#threadSidebarComponent);
|
|
3309
|
+
this.#updateHighlightedAppThreadIconBus.emit(null);
|
|
3294
3310
|
});
|
|
3295
3311
|
});
|
|
3296
3312
|
}
|
|
3297
|
-
|
|
3313
|
+
#getActiveButtonContainer() {
|
|
3298
3314
|
let activeButtonContainer;
|
|
3299
|
-
if (this
|
|
3300
|
-
activeButtonContainer = this.
|
|
3315
|
+
if (this.#globalIconArea) {
|
|
3316
|
+
activeButtonContainer = this.#globalIconArea.querySelector('.sidebar_button_container_active');
|
|
3301
3317
|
}
|
|
3302
|
-
if (!activeButtonContainer && this
|
|
3303
|
-
activeButtonContainer = this.
|
|
3318
|
+
if (!activeButtonContainer && this.#threadIconArea) {
|
|
3319
|
+
activeButtonContainer = this.#threadIconArea.querySelector('.sidebar_button_container_active');
|
|
3304
3320
|
}
|
|
3305
3321
|
return activeButtonContainer;
|
|
3306
3322
|
}
|
|
3307
|
-
|
|
3308
|
-
|
|
3323
|
+
#closeButton = null;
|
|
3324
|
+
#addButton(iconArea, event, isGlobal) {
|
|
3309
3325
|
var _this = this;
|
|
3310
3326
|
// we put adding the content panel icon in the iconArea in an asap so that we
|
|
3311
3327
|
// get consistent ordering. The ordering of the icons is based on the position of the FIRST
|
|
@@ -3319,7 +3335,7 @@ class GmailAppSidebarPrimary {
|
|
|
3319
3335
|
const iconClass = event.detail.iconClass || '';
|
|
3320
3336
|
// If there's an existing button for the app, then just increment its
|
|
3321
3337
|
// data-count attribute instead of adding a new button.
|
|
3322
|
-
const existingButtonContainer = isGlobal ? this.
|
|
3338
|
+
const existingButtonContainer = isGlobal ? this.#globalButtonContainers.get(appName) : this.#threadButtonContainers.get(appName);
|
|
3323
3339
|
let buttonContainer;
|
|
3324
3340
|
if (existingButtonContainer) {
|
|
3325
3341
|
const currentCount = Number(existingButtonContainer.getAttribute('data-count')) || 1;
|
|
@@ -3339,28 +3355,28 @@ class GmailAppSidebarPrimary {
|
|
|
3339
3355
|
(0,querySelectorOrFail/* default */.Z)(buttonContainer, '.inboxsdk__button_selectedIndicator').style.backgroundColor = event.detail.primaryColor;
|
|
3340
3356
|
}
|
|
3341
3357
|
if (isGlobal) {
|
|
3342
|
-
this.
|
|
3358
|
+
this.#globalButtonContainers.set(appName, buttonContainer);
|
|
3343
3359
|
} else {
|
|
3344
|
-
this.
|
|
3360
|
+
this.#threadButtonContainers.set(appName, buttonContainer);
|
|
3345
3361
|
}
|
|
3346
3362
|
const activate = function () {
|
|
3347
3363
|
let dontScrollIntoView = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
3348
|
-
const activeButtonContainer = _this
|
|
3364
|
+
const activeButtonContainer = _this.#getActiveButtonContainer();
|
|
3349
3365
|
if (activeButtonContainer === buttonContainer) {
|
|
3350
3366
|
// button was clicked while its panel was open, so close it.
|
|
3351
|
-
if (!_this
|
|
3352
|
-
_this
|
|
3367
|
+
if (!_this.#closeButton) throw new Error();
|
|
3368
|
+
_this.#closeButton(true);
|
|
3353
3369
|
} else {
|
|
3354
3370
|
// button was clicked while its own panel wasn't open, so open it.
|
|
3355
|
-
if (_this
|
|
3356
|
-
_this
|
|
3371
|
+
if (_this.#closeButton) {
|
|
3372
|
+
_this.#closeButton(true);
|
|
3357
3373
|
}
|
|
3358
|
-
if (isGlobal) _this
|
|
3359
|
-
_this
|
|
3374
|
+
if (isGlobal) _this.#setShouldGlobalAppSidebarOpen(true);else _this.#setShouldThreadAppSidebarOpen(true);
|
|
3375
|
+
_this.#openSidebarAndActivateButton(buttonContainer, isGlobal);
|
|
3360
3376
|
if (isGlobal) {
|
|
3361
|
-
const contentEl = _this.
|
|
3377
|
+
const contentEl = _this.#contentContainers.get(appName);
|
|
3362
3378
|
if (contentEl) contentEl.style.display = '';
|
|
3363
|
-
_this.
|
|
3379
|
+
_this.#companionSidebarContentContainerEl.classList.add('companion_global_app_sidebar_visible');
|
|
3364
3380
|
|
|
3365
3381
|
// let app listen for activate event
|
|
3366
3382
|
document.body.dispatchEvent(new CustomEvent('inboxsdkSidebarPanelActivated', {
|
|
@@ -3371,7 +3387,7 @@ class GmailAppSidebarPrimary {
|
|
|
3371
3387
|
}
|
|
3372
3388
|
}));
|
|
3373
3389
|
} else {
|
|
3374
|
-
const threadSidebarComponent = _this
|
|
3390
|
+
const threadSidebarComponent = _this.#threadSidebarComponent;
|
|
3375
3391
|
if (!threadSidebarComponent) {
|
|
3376
3392
|
throw new Error('sidebar not mounted');
|
|
3377
3393
|
}
|
|
@@ -3380,20 +3396,20 @@ class GmailAppSidebarPrimary {
|
|
|
3380
3396
|
threadSidebarComponent.scrollPanelIntoView(instanceId, true);
|
|
3381
3397
|
}
|
|
3382
3398
|
}
|
|
3383
|
-
_this
|
|
3384
|
-
_this
|
|
3385
|
-
const activeButtonContainer = _this
|
|
3399
|
+
_this.#closeButton = userClick => {
|
|
3400
|
+
_this.#closeButton = null;
|
|
3401
|
+
const activeButtonContainer = _this.#getActiveButtonContainer();
|
|
3386
3402
|
if (!activeButtonContainer) {
|
|
3387
3403
|
throw new Error('Expected activeButtonContainer');
|
|
3388
3404
|
}
|
|
3389
|
-
_this
|
|
3405
|
+
_this.#closeSidebarAndDeactivateButton(activeButtonContainer);
|
|
3390
3406
|
if (isGlobal) {
|
|
3391
|
-
if (userClick) _this
|
|
3392
|
-
const contentEl = _this.
|
|
3407
|
+
if (userClick) _this.#setShouldGlobalAppSidebarOpen(false);
|
|
3408
|
+
const contentEl = _this.#contentContainers.get(appName);
|
|
3393
3409
|
if (contentEl) {
|
|
3394
3410
|
contentEl.style.display = 'none';
|
|
3395
3411
|
} else {
|
|
3396
|
-
_this.
|
|
3412
|
+
_this.#driver.getLogger().error(new Error('Unexpected: contentEl not set'));
|
|
3397
3413
|
}
|
|
3398
3414
|
document.body.dispatchEvent(new CustomEvent('inboxsdkSidebarPanelDeactivated', {
|
|
3399
3415
|
bubbles: true,
|
|
@@ -3403,7 +3419,7 @@ class GmailAppSidebarPrimary {
|
|
|
3403
3419
|
}
|
|
3404
3420
|
}));
|
|
3405
3421
|
} else {
|
|
3406
|
-
if (userClick) _this
|
|
3422
|
+
if (userClick) _this.#setShouldThreadAppSidebarOpen(false);
|
|
3407
3423
|
}
|
|
3408
3424
|
|
|
3409
3425
|
//fake a window resize after closing so gmail fixes any heights that are messed up
|
|
@@ -3419,23 +3435,23 @@ class GmailAppSidebarPrimary {
|
|
|
3419
3435
|
activate();
|
|
3420
3436
|
}, true);
|
|
3421
3437
|
if (iconArea) {
|
|
3422
|
-
(0,add_to_icon_area/* default */.Z)(this
|
|
3438
|
+
(0,add_to_icon_area/* default */.Z)(this.#orderManager, appName, buttonContainer, iconArea);
|
|
3423
3439
|
}
|
|
3424
3440
|
|
|
3425
3441
|
// if we last had an SDK sidebar open then bring up the SDK sidebar when the first
|
|
3426
3442
|
// panel gets added
|
|
3427
3443
|
{
|
|
3428
|
-
const activeButtonContainer = this
|
|
3444
|
+
const activeButtonContainer = this.#getActiveButtonContainer();
|
|
3429
3445
|
if (isGlobal) {
|
|
3430
|
-
if (this
|
|
3431
|
-
const activeButtonContainerPresentAndIsForGlobal = this
|
|
3446
|
+
if (this.#getShouldGlobalAppSidebarOpen()) {
|
|
3447
|
+
const activeButtonContainerPresentAndIsForGlobal = this.#globalIconArea && activeButtonContainer && this.#globalIconArea.contains(activeButtonContainer);
|
|
3432
3448
|
if (!activeButtonContainerPresentAndIsForGlobal) {
|
|
3433
3449
|
activate(true);
|
|
3434
3450
|
}
|
|
3435
3451
|
}
|
|
3436
3452
|
} else {
|
|
3437
|
-
if (this
|
|
3438
|
-
const activeButtonContainerPresentAndIsForThread = this
|
|
3453
|
+
if (this.#getShouldThreadAppSidebarOpen()) {
|
|
3454
|
+
const activeButtonContainerPresentAndIsForThread = this.#threadIconArea && activeButtonContainer && this.#threadIconArea.contains(activeButtonContainer);
|
|
3439
3455
|
if (!activeButtonContainerPresentAndIsForThread) {
|
|
3440
3456
|
activate(true);
|
|
3441
3457
|
}
|
|
@@ -3445,7 +3461,7 @@ class GmailAppSidebarPrimary {
|
|
|
3445
3461
|
}
|
|
3446
3462
|
});
|
|
3447
3463
|
}
|
|
3448
|
-
|
|
3464
|
+
#removeButton(event, buttonContainers, iconArea) {
|
|
3449
3465
|
const appName = event.detail.appName;
|
|
3450
3466
|
const container = buttonContainers.get(appName);
|
|
3451
3467
|
if (!iconArea || !container) {
|
|
@@ -3455,11 +3471,11 @@ class GmailAppSidebarPrimary {
|
|
|
3455
3471
|
if (currentCount <= 1) {
|
|
3456
3472
|
const activeButtonContainer = iconArea.querySelector('.sidebar_button_container_active');
|
|
3457
3473
|
if (container === activeButtonContainer) {
|
|
3458
|
-
if (!this
|
|
3459
|
-
this
|
|
3460
|
-
this.
|
|
3461
|
-
this.
|
|
3462
|
-
const contentContainer = this.
|
|
3474
|
+
if (!this.#closeButton) throw new Error();
|
|
3475
|
+
this.#closeButton(false);
|
|
3476
|
+
this.#companionSidebarOuterWrapper.classList.remove('companion_app_sidebar_wrapper_visible');
|
|
3477
|
+
this.#companionSidebarContentContainerEl.classList.remove('companion_app_sidebar_visible');
|
|
3478
|
+
const contentContainer = this.#companionSidebarOuterWrapper.previousElementSibling;
|
|
3463
3479
|
if (contentContainer) contentContainer.classList.remove('companion_container_app_sidebar_visible');
|
|
3464
3480
|
}
|
|
3465
3481
|
container.remove();
|
|
@@ -3470,18 +3486,18 @@ class GmailAppSidebarPrimary {
|
|
|
3470
3486
|
container.setAttribute('data-count', String(currentCount - 1));
|
|
3471
3487
|
}
|
|
3472
3488
|
}
|
|
3473
|
-
|
|
3489
|
+
#closeSidebarAndDeactivateButton(activeButtonContainer) {
|
|
3474
3490
|
activeButtonContainer.classList.remove('sidebar_button_container_active');
|
|
3475
|
-
this.
|
|
3476
|
-
this.
|
|
3477
|
-
this.
|
|
3478
|
-
const contentContainer = this.
|
|
3491
|
+
this.#companionSidebarOuterWrapper.classList.remove('companion_app_sidebar_wrapper_visible');
|
|
3492
|
+
this.#companionSidebarContentContainerEl.classList.add(COMPANION_SIDEBAR_CONTENT_CLOSED_SHADOW_CLASS);
|
|
3493
|
+
this.#companionSidebarContentContainerEl.classList.remove('companion_app_sidebar_visible', 'companion_global_app_sidebar_visible');
|
|
3494
|
+
const contentContainer = this.#companionSidebarOuterWrapper.previousElementSibling;
|
|
3479
3495
|
if (contentContainer) contentContainer.classList.remove('companion_container_app_sidebar_visible');
|
|
3480
3496
|
}
|
|
3481
|
-
|
|
3497
|
+
#openSidebarAndActivateButton(buttonContainer, isGlobal) {
|
|
3482
3498
|
const companionSidebarIconContainerEl = gmail_element_getter/* default.getCompanionSidebarIconContainerElement */.Z.getCompanionSidebarIconContainerElement();
|
|
3483
3499
|
if (!companionSidebarIconContainerEl) throw new Error('Could not find companion sidebar icon container element');
|
|
3484
|
-
const activeButtonContainer = this
|
|
3500
|
+
const activeButtonContainer = this.#getActiveButtonContainer();
|
|
3485
3501
|
if (activeButtonContainer) {
|
|
3486
3502
|
throw new Error('activeButtonContainer should not be true'); // this._closeSidebarAndDeactivateButton(activeButtonContainer);
|
|
3487
3503
|
}
|
|
@@ -3494,29 +3510,29 @@ class GmailAppSidebarPrimary {
|
|
|
3494
3510
|
}
|
|
3495
3511
|
}
|
|
3496
3512
|
buttonContainer.classList.add('sidebar_button_container_active');
|
|
3497
|
-
this.
|
|
3498
|
-
this.
|
|
3499
|
-
this.
|
|
3500
|
-
const contentContainer = this.
|
|
3513
|
+
this.#companionSidebarOuterWrapper.classList.add('companion_app_sidebar_wrapper_visible');
|
|
3514
|
+
this.#companionSidebarContentContainerEl.classList.add('companion_app_sidebar_visible');
|
|
3515
|
+
this.#companionSidebarContentContainerEl.classList.remove(COMPANION_SIDEBAR_CONTENT_CLOSED_SHADOW_CLASS);
|
|
3516
|
+
const contentContainer = this.#companionSidebarOuterWrapper.previousElementSibling;
|
|
3501
3517
|
if (contentContainer) contentContainer.classList.add('companion_container_app_sidebar_visible');
|
|
3502
|
-
if (isGlobal) this.
|
|
3518
|
+
if (isGlobal) this.#companionSidebarContentContainerEl.classList.add('companion_global_app_sidebar_visible');
|
|
3503
3519
|
}
|
|
3504
|
-
|
|
3520
|
+
#setupElement() {
|
|
3505
3521
|
const companionSidebarIconContainerEl = gmail_element_getter/* default.getCompanionSidebarIconContainerElement */.Z.getCompanionSidebarIconContainerElement();
|
|
3506
3522
|
if (!companionSidebarIconContainerEl) throw new Error('Could not find companion sidebar icon container element');
|
|
3507
|
-
this.
|
|
3523
|
+
this.#companionSidebarContentContainerEl.setAttribute('data-sdk-sidebar-instance-id', this.#instanceId);
|
|
3508
3524
|
|
|
3509
3525
|
// TODO: Once the changes to the GMail DOM have been entirely ramped, drop the ternary here and
|
|
3510
3526
|
// always get the parentElement. (Jun 20, 2018)
|
|
3511
|
-
this
|
|
3512
|
-
if (!this
|
|
3527
|
+
this.#companionSidebarOuterWrapper = this.#companionSidebarContentContainerEl.classList.contains('bq9') ? this.#companionSidebarContentContainerEl : this.#companionSidebarContentContainerEl.parentElement;
|
|
3528
|
+
if (!this.#companionSidebarOuterWrapper) {
|
|
3513
3529
|
throw new Error('should not happen: failed to find companionSidebarOuterWrapper');
|
|
3514
3530
|
}
|
|
3515
|
-
const contentContainer = this.
|
|
3531
|
+
const contentContainer = this.#companionSidebarOuterWrapper.previousElementSibling;
|
|
3516
3532
|
if (contentContainer) {
|
|
3517
3533
|
contentContainer.classList.add((0,idMap/* default */.Z)('companion_container_app_sidebar_in_use'));
|
|
3518
3534
|
}
|
|
3519
|
-
this.
|
|
3535
|
+
this.#companionSidebarContentContainerEl.classList.add((0,idMap/* default */.Z)('app_sidebar_in_use'));
|
|
3520
3536
|
if (!document.body.querySelector(sidebarWaitingPlatformSelector)) {
|
|
3521
3537
|
const waitingPlatform = document.createElement('div');
|
|
3522
3538
|
waitingPlatform.className = classnames_default()(sidebarWaitingPlatformClassName, (0,idMap/* default */.Z)('app_sidebar_waiting_platform'));
|
|
@@ -3525,19 +3541,19 @@ class GmailAppSidebarPrimary {
|
|
|
3525
3541
|
|
|
3526
3542
|
// thread sidebar content panels
|
|
3527
3543
|
{
|
|
3528
|
-
kefir_esm.fromEvents(window, 'storage').filter(e => e.key === 'inboxsdk__sidebar_ordering').takeUntilBy(this
|
|
3529
|
-
this.
|
|
3530
|
-
this
|
|
3544
|
+
kefir_esm.fromEvents(window, 'storage').filter(e => e.key === 'inboxsdk__sidebar_ordering').takeUntilBy(this.#stopper).onValue(() => {
|
|
3545
|
+
this.#orderManager.reload();
|
|
3546
|
+
this.#renderThreadSidebarIfPresent();
|
|
3531
3547
|
});
|
|
3532
|
-
kefir_esm.fromEvents(document.body, 'inboxsdkNewSidebarPanel').filter(e => e.detail.sidebarId === this
|
|
3533
|
-
this
|
|
3548
|
+
kefir_esm.fromEvents(document.body, 'inboxsdkNewSidebarPanel').filter(e => e.detail.sidebarId === this.#instanceId && !e.detail.isGlobal).takeUntilBy(this.#stopper).onValue(event => {
|
|
3549
|
+
this.#createThreadSidebarIfNeeded();
|
|
3534
3550
|
let id = event.detail.id;
|
|
3535
|
-
while (this.
|
|
3551
|
+
while (this.#currentIds.has(id)) {
|
|
3536
3552
|
id = incrementName(id);
|
|
3537
3553
|
}
|
|
3538
|
-
this.
|
|
3554
|
+
this.#currentIds.add(id);
|
|
3539
3555
|
const appName = event.detail.appName;
|
|
3540
|
-
this.
|
|
3556
|
+
this.#orderManager.addItem({
|
|
3541
3557
|
groupId: event.detail.appId,
|
|
3542
3558
|
id,
|
|
3543
3559
|
orderHint: event.detail.orderHint,
|
|
@@ -3553,21 +3569,21 @@ class GmailAppSidebarPrimary {
|
|
|
3553
3569
|
el: event.target
|
|
3554
3570
|
}
|
|
3555
3571
|
});
|
|
3556
|
-
this
|
|
3557
|
-
let threadIconArea = this
|
|
3572
|
+
this.#renderThreadSidebar();
|
|
3573
|
+
let threadIconArea = this.#threadIconArea = companionSidebarIconContainerEl.querySelector('.sidebar_thread_iconArea');
|
|
3558
3574
|
if (!threadIconArea) {
|
|
3559
|
-
threadIconArea = this
|
|
3575
|
+
threadIconArea = this.#threadIconArea = document.createElement('div');
|
|
3560
3576
|
threadIconArea.className = (0,idMap/* default */.Z)('sidebar_iconArea');
|
|
3561
3577
|
threadIconArea.classList.add('sidebar_thread_iconArea');
|
|
3562
|
-
(0,add_companion_thread_icon_area/* default */.Z)(this.
|
|
3578
|
+
(0,add_companion_thread_icon_area/* default */.Z)(this.#driver.getLogger(), threadIconArea, companionSidebarIconContainerEl);
|
|
3563
3579
|
}
|
|
3564
|
-
this
|
|
3580
|
+
this.#addButton(threadIconArea, event, false);
|
|
3565
3581
|
});
|
|
3566
|
-
kefir_esm.fromEvents(document.body, 'inboxsdkUpdateSidebarPanel').filter(e => e.detail.sidebarId === this
|
|
3567
|
-
const orderedItems = this.
|
|
3582
|
+
kefir_esm.fromEvents(document.body, 'inboxsdkUpdateSidebarPanel').filter(e => e.detail.sidebarId === this.#instanceId && !e.detail.isGlobal).takeUntilBy(this.#stopper).onValue(event => {
|
|
3583
|
+
const orderedItems = this.#orderManager.getOrderedItems();
|
|
3568
3584
|
const index = findIndex_default()(orderedItems, x => x.value.instanceId === event.detail.instanceId);
|
|
3569
3585
|
if (index === -1) throw new Error('should not happen: failed to find orderItem');
|
|
3570
|
-
this.
|
|
3586
|
+
this.#orderManager.updateItemValueByIndex(index, {
|
|
3571
3587
|
id: orderedItems[index].value.id,
|
|
3572
3588
|
appId: event.detail.appId,
|
|
3573
3589
|
appName: event.detail.appName || event.detail.title,
|
|
@@ -3578,33 +3594,33 @@ class GmailAppSidebarPrimary {
|
|
|
3578
3594
|
hideTitleBar: event.detail.hideTitleBar,
|
|
3579
3595
|
el: event.target
|
|
3580
3596
|
});
|
|
3581
|
-
this
|
|
3597
|
+
this.#renderThreadSidebar();
|
|
3582
3598
|
});
|
|
3583
|
-
kefir_esm.fromEvents(document.body, 'inboxsdkRemoveSidebarPanel').filter(e => e.detail.sidebarId === this
|
|
3584
|
-
const orderedItems = this.
|
|
3599
|
+
kefir_esm.fromEvents(document.body, 'inboxsdkRemoveSidebarPanel').filter(e => e.detail.sidebarId === this.#instanceId && !e.detail.isGlobal).takeUntilBy(this.#stopper).onValue(event => {
|
|
3600
|
+
const orderedItems = this.#orderManager.getOrderedItems();
|
|
3585
3601
|
const index = findIndex_default()(orderedItems, x => x.value.instanceId === event.detail.instanceId);
|
|
3586
3602
|
if (index === -1) throw new Error('should not happen: failed to find orderItem');
|
|
3587
|
-
this.
|
|
3588
|
-
this.
|
|
3589
|
-
this
|
|
3590
|
-
this
|
|
3603
|
+
this.#currentIds.delete(orderedItems[index].id);
|
|
3604
|
+
this.#orderManager.removeItemByIndex(index);
|
|
3605
|
+
this.#renderThreadSidebar();
|
|
3606
|
+
this.#removeButton(event, this.#threadButtonContainers, this.#threadIconArea);
|
|
3591
3607
|
});
|
|
3592
|
-
kefir_esm.fromEvents(document.body, 'inboxsdkSidebarPanelScrollIntoView').filter(e => e.detail.sidebarId === this
|
|
3593
|
-
if (this
|
|
3608
|
+
kefir_esm.fromEvents(document.body, 'inboxsdkSidebarPanelScrollIntoView').filter(e => e.detail.sidebarId === this.#instanceId && !e.detail.isGlobal).takeUntilBy(this.#stopper).onValue(event => {
|
|
3609
|
+
if (this.#threadSidebarComponent) this.#threadSidebarComponent.scrollPanelIntoView(event.detail.instanceId);
|
|
3594
3610
|
});
|
|
3595
|
-
kefir_esm.fromEvents(document.body, 'inboxsdkSidebarPanelClose').filter(e => e.detail.sidebarId === this
|
|
3596
|
-
if (this
|
|
3611
|
+
kefir_esm.fromEvents(document.body, 'inboxsdkSidebarPanelClose').filter(e => e.detail.sidebarId === this.#instanceId && !e.detail.isGlobal).takeUntilBy(this.#stopper).onValue(event => {
|
|
3612
|
+
if (this.#threadSidebarComponent) this.#threadSidebarComponent.closePanel(event.detail.instanceId);
|
|
3597
3613
|
});
|
|
3598
|
-
kefir_esm.fromEvents(document.body, 'inboxsdkSidebarPanelOpen').filter(e => e.detail.sidebarId === this
|
|
3614
|
+
kefir_esm.fromEvents(document.body, 'inboxsdkSidebarPanelOpen').filter(e => e.detail.sidebarId === this.#instanceId && !e.detail.isGlobal).takeUntilBy(this.#stopper).onValue(e => {
|
|
3599
3615
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3600
|
-
this
|
|
3601
|
-
const descriptor = this.
|
|
3616
|
+
this.#renderThreadSidebar().then(threadSidebarComponent => {
|
|
3617
|
+
const descriptor = this.#instanceIdsToDescriptors.get(e.detail.instanceId);
|
|
3602
3618
|
if (!descriptor) return;
|
|
3603
|
-
const buttonContainer = this.
|
|
3619
|
+
const buttonContainer = this.#threadButtonContainers.get(descriptor.appName);
|
|
3604
3620
|
if (!buttonContainer) {
|
|
3605
3621
|
throw new Error('missing button container');
|
|
3606
3622
|
}
|
|
3607
|
-
const activeButtonContainer = this
|
|
3623
|
+
const activeButtonContainer = this.#getActiveButtonContainer();
|
|
3608
3624
|
if (activeButtonContainer !== buttonContainer) {
|
|
3609
3625
|
(0,querySelectorOrFail/* default */.Z)(buttonContainer, 'button').click();
|
|
3610
3626
|
}
|
|
@@ -3613,30 +3629,30 @@ class GmailAppSidebarPrimary {
|
|
|
3613
3629
|
}
|
|
3614
3630
|
// global sidebar content panels
|
|
3615
3631
|
{
|
|
3616
|
-
kefir_esm.fromEvents(document.body, 'inboxsdkNewSidebarPanel').filter(e => e.detail.sidebarId === this
|
|
3632
|
+
kefir_esm.fromEvents(document.body, 'inboxsdkNewSidebarPanel').filter(e => e.detail.sidebarId === this.#instanceId && e.detail.isGlobal).takeUntilBy(this.#stopper).onValue(event => {
|
|
3617
3633
|
let id = event.detail.id;
|
|
3618
|
-
while (this.
|
|
3634
|
+
while (this.#currentIds.has(id)) {
|
|
3619
3635
|
id = incrementName(id);
|
|
3620
3636
|
}
|
|
3621
|
-
this.
|
|
3637
|
+
this.#currentIds.add(id);
|
|
3622
3638
|
const appName = event.detail.appName;
|
|
3623
|
-
let globalIconArea = this
|
|
3639
|
+
let globalIconArea = this.#globalIconArea = companionSidebarIconContainerEl.querySelector('.sidebar_global_iconArea');
|
|
3624
3640
|
if (!globalIconArea) {
|
|
3625
|
-
globalIconArea = this
|
|
3641
|
+
globalIconArea = this.#globalIconArea = document.createElement('div');
|
|
3626
3642
|
globalIconArea.className = (0,idMap/* default */.Z)('sidebar_iconArea');
|
|
3627
3643
|
globalIconArea.classList.add('sidebar_global_iconArea');
|
|
3628
|
-
(0,add_companion_global_icon_area/* default */.Z)(this.
|
|
3644
|
+
(0,add_companion_global_icon_area/* default */.Z)(this.#driver.getLogger(), globalIconArea, companionSidebarIconContainerEl);
|
|
3629
3645
|
}
|
|
3630
3646
|
const sdkContentContainerEl = document.createElement('div');
|
|
3631
3647
|
sdkContentContainerEl.classList.add('addon_sidebar', (0,idMap/* default */.Z)('app_sidebar_container'), 'global_app_sidebar');
|
|
3632
|
-
this.
|
|
3633
|
-
this.
|
|
3648
|
+
this.#companionSidebarContentContainerEl.insertAdjacentElement('afterbegin', sdkContentContainerEl);
|
|
3649
|
+
this.#contentContainers.set(appName, sdkContentContainerEl);
|
|
3634
3650
|
sdkContentContainerEl.appendChild(event.target);
|
|
3635
3651
|
sdkContentContainerEl.style.display = 'none';
|
|
3636
|
-
this
|
|
3652
|
+
this.#addButton(globalIconArea, event, true);
|
|
3637
3653
|
});
|
|
3638
|
-
kefir_esm.fromEvents(document.body, 'inboxsdkUpdateSidebarPanel').filter(e => e.detail.sidebarId === this
|
|
3639
|
-
const buttonContainer = this.
|
|
3654
|
+
kefir_esm.fromEvents(document.body, 'inboxsdkUpdateSidebarPanel').filter(e => e.detail.sidebarId === this.#instanceId && e.detail.isGlobal).takeUntilBy(this.#stopper).onValue(event => {
|
|
3655
|
+
const buttonContainer = this.#globalButtonContainers.get(event.detail.appName);
|
|
3640
3656
|
if (!buttonContainer) return;
|
|
3641
3657
|
const iconClass = event.detail.iconClass || '';
|
|
3642
3658
|
const iconUrl = event.detail.iconUrl || event.detail.appIconUrl;
|
|
@@ -3645,29 +3661,29 @@ class GmailAppSidebarPrimary {
|
|
|
3645
3661
|
const button = (0,querySelectorOrFail/* default */.Z)(buttonContainer, 'button');
|
|
3646
3662
|
button.setAttribute('class', `inboxsdk__button_icon ${iconClass}`);
|
|
3647
3663
|
});
|
|
3648
|
-
kefir_esm.fromEvents(document.body, 'inboxsdkRemoveSidebarPanel').filter(e => e.detail.sidebarId === this
|
|
3649
|
-
this.
|
|
3650
|
-
this
|
|
3664
|
+
kefir_esm.fromEvents(document.body, 'inboxsdkRemoveSidebarPanel').filter(e => e.detail.sidebarId === this.#instanceId && e.detail.isGlobal).takeUntilBy(this.#stopper).onValue(event => {
|
|
3665
|
+
this.#currentIds.delete(event.detail.id);
|
|
3666
|
+
this.#removeButton(event, this.#globalButtonContainers, this.#globalIconArea);
|
|
3651
3667
|
});
|
|
3652
|
-
kefir_esm.fromEvents(document.body, 'inboxsdkSidebarPanelClose').filter(e => e.detail.sidebarId === this
|
|
3653
|
-
const descriptor = this.
|
|
3668
|
+
kefir_esm.fromEvents(document.body, 'inboxsdkSidebarPanelClose').filter(e => e.detail.sidebarId === this.#instanceId && e.detail.isGlobal).takeUntilBy(this.#stopper).onValue(event => {
|
|
3669
|
+
const descriptor = this.#instanceIdsToDescriptors.get(event.detail.instanceId);
|
|
3654
3670
|
if (!descriptor) return;
|
|
3655
|
-
const buttonContainer = this.
|
|
3671
|
+
const buttonContainer = this.#globalButtonContainers.get(descriptor.appName);
|
|
3656
3672
|
if (!buttonContainer) return;
|
|
3657
|
-
const activeButtonContainer = this
|
|
3673
|
+
const activeButtonContainer = this.#getActiveButtonContainer();
|
|
3658
3674
|
if (activeButtonContainer === buttonContainer) {
|
|
3659
|
-
if (!this
|
|
3675
|
+
if (!this.#closeButton) {
|
|
3660
3676
|
throw new Error('Expected this._closeButton');
|
|
3661
3677
|
}
|
|
3662
|
-
this
|
|
3678
|
+
this.#closeButton(true);
|
|
3663
3679
|
}
|
|
3664
3680
|
});
|
|
3665
|
-
kefir_esm.fromEvents(document.body, 'inboxsdkSidebarPanelOpen').filter(e => e.detail.sidebarId === this
|
|
3666
|
-
const descriptor = this.
|
|
3681
|
+
kefir_esm.fromEvents(document.body, 'inboxsdkSidebarPanelOpen').filter(e => e.detail.sidebarId === this.#instanceId && e.detail.isGlobal).takeUntilBy(this.#stopper).onValue(event => {
|
|
3682
|
+
const descriptor = this.#instanceIdsToDescriptors.get(event.detail.instanceId);
|
|
3667
3683
|
if (!descriptor) return;
|
|
3668
|
-
const buttonContainer = this.
|
|
3684
|
+
const buttonContainer = this.#globalButtonContainers.get(descriptor.appName);
|
|
3669
3685
|
if (!buttonContainer) return;
|
|
3670
|
-
const activeButtonContainer = this
|
|
3686
|
+
const activeButtonContainer = this.#getActiveButtonContainer();
|
|
3671
3687
|
if (activeButtonContainer !== buttonContainer) {
|
|
3672
3688
|
(0,querySelectorOrFail/* default */.Z)(buttonContainer, 'button').click();
|
|
3673
3689
|
}
|
|
@@ -3675,14 +3691,14 @@ class GmailAppSidebarPrimary {
|
|
|
3675
3691
|
}
|
|
3676
3692
|
// instance id to descriptor management
|
|
3677
3693
|
{
|
|
3678
|
-
kefir_esm.fromEvents(document.body, 'inboxsdkNewSidebarPanel').filter(e => e.detail.sidebarId === this
|
|
3679
|
-
this.
|
|
3694
|
+
kefir_esm.fromEvents(document.body, 'inboxsdkNewSidebarPanel').filter(e => e.detail.sidebarId === this.#instanceId).takeUntilBy(this.#stopper).onValue(event => {
|
|
3695
|
+
this.#instanceIdsToDescriptors.set(event.detail.instanceId, event.detail);
|
|
3680
3696
|
});
|
|
3681
|
-
kefir_esm.fromEvents(document.body, 'inboxsdkRemoveSidebarPanel').filter(e => e.detail.sidebarId === this
|
|
3682
|
-
this.
|
|
3697
|
+
kefir_esm.fromEvents(document.body, 'inboxsdkRemoveSidebarPanel').filter(e => e.detail.sidebarId === this.#instanceId).takeUntilBy(this.#stopper).onValue(event => {
|
|
3698
|
+
this.#instanceIdsToDescriptors.delete(event.detail.instanceId);
|
|
3683
3699
|
});
|
|
3684
|
-
kefir_esm.fromEvents(document.body, 'inboxsdkUpdateSidebarPanel').filter(e => e.detail.sidebarId === this
|
|
3685
|
-
this.
|
|
3700
|
+
kefir_esm.fromEvents(document.body, 'inboxsdkUpdateSidebarPanel').filter(e => e.detail.sidebarId === this.#instanceId).takeUntilBy(this.#stopper).onValue(event => {
|
|
3701
|
+
this.#instanceIdsToDescriptors.set(event.detail.instanceId, event.detail);
|
|
3686
3702
|
});
|
|
3687
3703
|
}
|
|
3688
3704
|
// at this point the companionSidebar has 2 children
|
|
@@ -3693,15 +3709,15 @@ class GmailAppSidebarPrimary {
|
|
|
3693
3709
|
// or the thread add-on content element are visible
|
|
3694
3710
|
// if they are both display: '' or display: none then the native sidebar
|
|
3695
3711
|
// contents are not visible
|
|
3696
|
-
const globalAddOnContentContainer = this.
|
|
3697
|
-
const threadAddOnContentContainer = this.
|
|
3712
|
+
const globalAddOnContentContainer = this.#companionSidebarContentContainerEl.children[0];
|
|
3713
|
+
const threadAddOnContentContainer = this.#companionSidebarContentContainerEl.children[1];
|
|
3698
3714
|
kefir_esm.merge([globalAddOnContentContainer, threadAddOnContentContainer].map(addonContentEl => (0,make_mutation_observer_chunked_stream/* default */.Z)(addonContentEl, {
|
|
3699
3715
|
attributes: true,
|
|
3700
3716
|
attributeFilter: ['style']
|
|
3701
|
-
}))).filter(() => globalAddOnContentContainer.style.display !== threadAddOnContentContainer.style.display).takeUntilBy(this
|
|
3717
|
+
}))).filter(() => globalAddOnContentContainer.style.display !== threadAddOnContentContainer.style.display).takeUntilBy(this.#stopper).onValue(() => {
|
|
3702
3718
|
// TODO What is this block for? It closes the current section whenever
|
|
3703
3719
|
// one of the Gmail addons bar elements changes?
|
|
3704
|
-
const activeButtonContainer = this
|
|
3720
|
+
const activeButtonContainer = this.#getActiveButtonContainer();
|
|
3705
3721
|
if (activeButtonContainer) {
|
|
3706
3722
|
(0,querySelectorOrFail/* default */.Z)(activeButtonContainer, 'button').click();
|
|
3707
3723
|
}
|
|
@@ -3718,26 +3734,30 @@ var delay_asap = __webpack_require__(75610);
|
|
|
3718
3734
|
|
|
3719
3735
|
|
|
3720
3736
|
class ContentPanelViewDriver {
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3737
|
+
#driver;
|
|
3738
|
+
#stopper;
|
|
3739
|
+
#eventStream = kefir_bus_default()();
|
|
3740
|
+
#isActive = false;
|
|
3741
|
+
/**
|
|
3742
|
+
* This is not the `id` property passed by the application, but a random
|
|
3743
|
+
* unique identifier used to manage a specific instance.
|
|
3744
|
+
* */
|
|
3745
|
+
#instanceId = `${Date.now()}-${Math.random()}`;
|
|
3746
|
+
#sidebarId;
|
|
3747
|
+
#isGlobal;
|
|
3726
3748
|
constructor(driver, descriptor, sidebarId, isGlobal) {
|
|
3727
|
-
this
|
|
3728
|
-
this
|
|
3729
|
-
this
|
|
3730
|
-
this
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
this._eventStream.plug(kefir_esm.fromEvents(document.body, 'inboxsdkSidebarPanelActivated').filter(e => e.detail.instanceId === this._instanceId).map(() => {
|
|
3734
|
-
this._isActive = true;
|
|
3749
|
+
this.#driver = driver;
|
|
3750
|
+
this.#sidebarId = sidebarId;
|
|
3751
|
+
this.#isGlobal = Boolean(isGlobal);
|
|
3752
|
+
this.#stopper = this.#eventStream.ignoreValues().beforeEnd(() => null).toProperty();
|
|
3753
|
+
this.#eventStream.plug(kefir_esm.fromEvents(document.body, 'inboxsdkSidebarPanelActivated').filter(e => e.detail.instanceId === this.#instanceId).map(() => {
|
|
3754
|
+
this.#isActive = true;
|
|
3735
3755
|
return {
|
|
3736
3756
|
eventName: 'activate'
|
|
3737
3757
|
};
|
|
3738
3758
|
}));
|
|
3739
|
-
this.
|
|
3740
|
-
this
|
|
3759
|
+
this.#eventStream.plug(kefir_esm.fromEvents(document.body, 'inboxsdkSidebarPanelDeactivated').filter(e => e.detail.instanceId === this.#instanceId).map(() => {
|
|
3760
|
+
this.#isActive = false;
|
|
3741
3761
|
return {
|
|
3742
3762
|
eventName: 'deactivate'
|
|
3743
3763
|
};
|
|
@@ -3752,7 +3772,7 @@ class ContentPanelViewDriver {
|
|
|
3752
3772
|
let hasPlacedAlready = false;
|
|
3753
3773
|
let appName;
|
|
3754
3774
|
const waitingPlatform = (0,querySelectorOrFail/* default */.Z)(document.body, sidebarWaitingPlatformSelector);
|
|
3755
|
-
descriptor.flatMap(x => afterAsap.map(() => x)).takeUntilBy(this
|
|
3775
|
+
descriptor.flatMap(x => afterAsap.map(() => x)).takeUntilBy(this.#stopper).onValue(descriptor => {
|
|
3756
3776
|
const {
|
|
3757
3777
|
el,
|
|
3758
3778
|
iconUrl,
|
|
@@ -3775,49 +3795,51 @@ class ContentPanelViewDriver {
|
|
|
3775
3795
|
bubbles: true,
|
|
3776
3796
|
cancelable: false,
|
|
3777
3797
|
detail: {
|
|
3778
|
-
appIconUrl: appIconUrl || this.
|
|
3779
|
-
appId: this.
|
|
3798
|
+
appIconUrl: appIconUrl || this.#driver.getOpts().appIconUrl || iconUrl,
|
|
3799
|
+
appId: this.#driver.getAppId(),
|
|
3780
3800
|
appName,
|
|
3781
3801
|
hideTitleBar: Boolean(hideTitleBar),
|
|
3782
3802
|
iconClass,
|
|
3783
3803
|
iconUrl,
|
|
3784
3804
|
id: String(id || title),
|
|
3785
|
-
instanceId: this
|
|
3805
|
+
instanceId: this.#instanceId,
|
|
3786
3806
|
isGlobal,
|
|
3787
3807
|
orderHint: typeof orderHint === 'number' ? orderHint : 0,
|
|
3788
|
-
primaryColor: primaryColor || this.
|
|
3789
|
-
secondaryColor: secondaryColor || this.
|
|
3790
|
-
sidebarId: this
|
|
3808
|
+
primaryColor: primaryColor || this.#driver.getOpts().primaryColor,
|
|
3809
|
+
secondaryColor: secondaryColor || this.#driver.getOpts().secondaryColor,
|
|
3810
|
+
sidebarId: this.#sidebarId,
|
|
3791
3811
|
title
|
|
3792
3812
|
}
|
|
3793
3813
|
}));
|
|
3794
3814
|
});
|
|
3795
|
-
this.
|
|
3815
|
+
this.#stopper.onValue(() => {
|
|
3796
3816
|
if (!hasPlacedAlready) return;
|
|
3797
3817
|
document.body.dispatchEvent(new CustomEvent('inboxsdkRemoveSidebarPanel', {
|
|
3798
3818
|
bubbles: true,
|
|
3799
3819
|
cancelable: false,
|
|
3800
3820
|
detail: {
|
|
3801
3821
|
appName,
|
|
3802
|
-
sidebarId: this
|
|
3803
|
-
instanceId: this
|
|
3822
|
+
sidebarId: this.#sidebarId,
|
|
3823
|
+
instanceId: this.#instanceId
|
|
3804
3824
|
}
|
|
3805
3825
|
}));
|
|
3806
3826
|
});
|
|
3807
3827
|
}
|
|
3808
3828
|
getStopper() {
|
|
3809
|
-
return this
|
|
3829
|
+
return this.#stopper;
|
|
3810
3830
|
}
|
|
3811
3831
|
getEventStream() {
|
|
3812
|
-
return this
|
|
3832
|
+
return this.#eventStream;
|
|
3813
3833
|
}
|
|
3834
|
+
|
|
3835
|
+
// TODO: is this used?
|
|
3814
3836
|
scrollIntoView() {
|
|
3815
3837
|
document.body.dispatchEvent(new CustomEvent('inboxsdkSidebarPanelScrollIntoView', {
|
|
3816
3838
|
bubbles: true,
|
|
3817
3839
|
cancelable: false,
|
|
3818
3840
|
detail: {
|
|
3819
|
-
instanceId: this
|
|
3820
|
-
sidebarId: this
|
|
3841
|
+
instanceId: this.#instanceId,
|
|
3842
|
+
sidebarId: this.#sidebarId
|
|
3821
3843
|
}
|
|
3822
3844
|
}));
|
|
3823
3845
|
}
|
|
@@ -3826,9 +3848,9 @@ class ContentPanelViewDriver {
|
|
|
3826
3848
|
bubbles: true,
|
|
3827
3849
|
cancelable: false,
|
|
3828
3850
|
detail: {
|
|
3829
|
-
instanceId: this
|
|
3830
|
-
isGlobal: this
|
|
3831
|
-
sidebarId: this
|
|
3851
|
+
instanceId: this.#instanceId,
|
|
3852
|
+
isGlobal: this.#isGlobal,
|
|
3853
|
+
sidebarId: this.#sidebarId
|
|
3832
3854
|
}
|
|
3833
3855
|
}));
|
|
3834
3856
|
}
|
|
@@ -3837,17 +3859,17 @@ class ContentPanelViewDriver {
|
|
|
3837
3859
|
bubbles: true,
|
|
3838
3860
|
cancelable: false,
|
|
3839
3861
|
detail: {
|
|
3840
|
-
instanceId: this
|
|
3841
|
-
isGlobal: this
|
|
3842
|
-
sidebarId: this
|
|
3862
|
+
instanceId: this.#instanceId,
|
|
3863
|
+
isGlobal: this.#isGlobal,
|
|
3864
|
+
sidebarId: this.#sidebarId
|
|
3843
3865
|
}
|
|
3844
3866
|
}));
|
|
3845
3867
|
}
|
|
3846
3868
|
isActive() {
|
|
3847
|
-
return this
|
|
3869
|
+
return this.#isActive;
|
|
3848
3870
|
}
|
|
3849
3871
|
remove() {
|
|
3850
|
-
this.
|
|
3872
|
+
this.#eventStream.end();
|
|
3851
3873
|
}
|
|
3852
3874
|
}
|
|
3853
3875
|
/* harmony default export */ const sidebar_ContentPanelViewDriver = (ContentPanelViewDriver);
|
|
@@ -3859,69 +3881,53 @@ class ContentPanelViewDriver {
|
|
|
3859
3881
|
|
|
3860
3882
|
|
|
3861
3883
|
const updates = js_default()(module, null);
|
|
3884
|
+
|
|
3885
|
+
/**
|
|
3886
|
+
* @internal
|
|
3887
|
+
*/
|
|
3862
3888
|
class GmailAppSidebarView {
|
|
3863
|
-
|
|
3889
|
+
#stopper = kefir_stopper_js_default()();
|
|
3890
|
+
#driver;
|
|
3891
|
+
#instanceId;
|
|
3864
3892
|
constructor(driver, companionSidebarContentContainerElement) {
|
|
3865
|
-
this
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3893
|
+
this.#driver = driver;
|
|
3894
|
+
/**
|
|
3895
|
+
* We need to be able to cooperate with other apps/extensions that are
|
|
3896
|
+
* sharing the app sidebar. We store some properties as attributes in the
|
|
3897
|
+
* shared DOM instead of as class properties; class properties are mostly
|
|
3898
|
+
* restricted to being used for references to DOM nodes. When
|
|
3899
|
+
* GmailAppSidebarView is instantiated, we check the element for an
|
|
3900
|
+
* attribute to see whether a previous extension's GmailAppSidebarView has
|
|
3901
|
+
* already set up the sidebar or not.
|
|
3902
|
+
*/
|
|
3873
3903
|
const instanceId = companionSidebarContentContainerElement.getAttribute('data-sdk-sidebar-instance-id');
|
|
3874
3904
|
if (instanceId != null) {
|
|
3875
|
-
this
|
|
3905
|
+
this.#instanceId = instanceId;
|
|
3876
3906
|
} else {
|
|
3877
3907
|
let primary = new gmail_app_sidebar_view_primary(driver, companionSidebarContentContainerElement);
|
|
3878
|
-
this
|
|
3908
|
+
this.#instanceId = primary.getInstanceId();
|
|
3879
3909
|
// hot reloading support. Not perfect; this will break any existing panels.
|
|
3880
3910
|
updates.changes().onValue(() => {
|
|
3881
3911
|
primary.destroy();
|
|
3882
3912
|
primary = new gmail_app_sidebar_view_primary(driver, companionSidebarContentContainerElement);
|
|
3883
|
-
this
|
|
3913
|
+
this.#instanceId = primary.getInstanceId();
|
|
3884
3914
|
});
|
|
3885
3915
|
}
|
|
3886
3916
|
}
|
|
3887
3917
|
destroy() {
|
|
3888
|
-
this.
|
|
3918
|
+
this.#stopper.destroy();
|
|
3889
3919
|
}
|
|
3890
3920
|
getStopper() {
|
|
3891
|
-
return this
|
|
3892
|
-
}
|
|
3893
|
-
_getShouldThreadAppSidebarOpen() {
|
|
3894
|
-
return __webpack_require__.g.localStorage.getItem('inboxsdk__thread_app_sidebar_should_open') !== 'false';
|
|
3895
|
-
}
|
|
3896
|
-
_setShouldThreadAppSidebarOpen(open) {
|
|
3897
|
-
try {
|
|
3898
|
-
__webpack_require__.g.localStorage.setItem('inboxsdk__thread_app_sidebar_should_open', String(open));
|
|
3899
|
-
} catch (err) {
|
|
3900
|
-
console.error('error saving', err);
|
|
3901
|
-
}
|
|
3902
|
-
}
|
|
3903
|
-
|
|
3904
|
-
// This value controls whether the app sidebar should automatically open
|
|
3905
|
-
// itself when available when the chat sidebar isn't present. It's only set
|
|
3906
|
-
// if the user interacts with the app sidebar button.
|
|
3907
|
-
_getShouldGlobalAppSidebarOpen() {
|
|
3908
|
-
return __webpack_require__.g.localStorage.getItem('inboxsdk__global_app_sidebar_should_open') === 'true';
|
|
3909
|
-
}
|
|
3910
|
-
_setShouldGlobalAppSidebarOpen(open) {
|
|
3911
|
-
try {
|
|
3912
|
-
__webpack_require__.g.localStorage.setItem('inboxsdk__global_app_sidebar_should_open', String(open));
|
|
3913
|
-
} catch (err) {
|
|
3914
|
-
console.error('error saving', err);
|
|
3915
|
-
}
|
|
3921
|
+
return this.#stopper;
|
|
3916
3922
|
}
|
|
3917
3923
|
addThreadSidebarContentPanel(descriptor, threadView) {
|
|
3918
|
-
const panel = new sidebar_ContentPanelViewDriver(this
|
|
3919
|
-
kefir_esm.merge([threadView.getStopper(), this
|
|
3924
|
+
const panel = new sidebar_ContentPanelViewDriver(this.#driver, descriptor, this.#instanceId);
|
|
3925
|
+
kefir_esm.merge([threadView.getStopper(), this.#stopper]).take(1).takeUntilBy(panel.getStopper()).onValue(() => panel.remove());
|
|
3920
3926
|
return panel;
|
|
3921
3927
|
}
|
|
3922
3928
|
addGlobalSidebarContentPanel(descriptor) {
|
|
3923
|
-
const panel = new sidebar_ContentPanelViewDriver(this
|
|
3924
|
-
this.
|
|
3929
|
+
const panel = new sidebar_ContentPanelViewDriver(this.#driver, descriptor, this.#instanceId, true);
|
|
3930
|
+
this.#stopper.takeUntilBy(panel.getStopper()).onValue(() => panel.remove());
|
|
3925
3931
|
return panel;
|
|
3926
3932
|
}
|
|
3927
3933
|
}
|
|
@@ -10833,7 +10839,7 @@ options.insert = htmlElement => {
|
|
|
10833
10839
|
htmlElement.setAttribute('data-inboxsdk-version',
|
|
10834
10840
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
|
|
10835
10841
|
///@ts-ignore
|
|
10836
|
-
"2.1.
|
|
10842
|
+
"2.1.5-1696881387401-5c0ff20cfc735daf");
|
|
10837
10843
|
document.head.append(htmlElement);
|
|
10838
10844
|
};
|
|
10839
10845
|
options.domAPI = (styleDomAPI_default());
|
|
@@ -11388,10 +11394,12 @@ function getAllAppIds() {
|
|
|
11388
11394
|
const _trackedEventsQueue = new PersistentQueue('events');
|
|
11389
11395
|
const FIRST_LOADED_TIME = Date.now();
|
|
11390
11396
|
class Logger {
|
|
11397
|
+
#appId;
|
|
11398
|
+
#isMaster;
|
|
11391
11399
|
constructor(appId, opts, loaderVersion, implVersion) {
|
|
11392
11400
|
_extensionLoggerSetup(appId, opts, loaderVersion, implVersion);
|
|
11393
|
-
this
|
|
11394
|
-
this
|
|
11401
|
+
this.#appId = appId;
|
|
11402
|
+
this.#isMaster = (() => {
|
|
11395
11403
|
if (!_extensionUseEventTracking || typeof document !== 'undefined' && document.documentElement.hasAttribute('data-inboxsdk-app-logger-master-chosen')) {
|
|
11396
11404
|
return false;
|
|
11397
11405
|
} else {
|
|
@@ -11399,7 +11407,7 @@ class Logger {
|
|
|
11399
11407
|
return true;
|
|
11400
11408
|
}
|
|
11401
11409
|
})();
|
|
11402
|
-
if (this
|
|
11410
|
+
if (this.#isMaster && typeof document !== 'undefined') {
|
|
11403
11411
|
document.addEventListener('inboxSDKinjectedError', event => {
|
|
11404
11412
|
if (!(event instanceof CustomEvent && event?.detail)) {
|
|
11405
11413
|
this.error(new Error('Invalid inboxSDKinjectedError event'), event);
|
|
@@ -11445,51 +11453,54 @@ class Logger {
|
|
|
11445
11453
|
_logError(err, details, undefined, false);
|
|
11446
11454
|
}
|
|
11447
11455
|
error(err, details) {
|
|
11448
|
-
_logError(err, details, this
|
|
11456
|
+
_logError(err, details, this.#appId, false);
|
|
11449
11457
|
}
|
|
11450
11458
|
errorApp(err, details) {
|
|
11451
|
-
_logError(err, details, this
|
|
11459
|
+
_logError(err, details, this.#appId, true);
|
|
11452
11460
|
}
|
|
11461
|
+
|
|
11462
|
+
/** Only the first logger instance reports Site errors. */
|
|
11453
11463
|
errorSite(err, details) {
|
|
11454
|
-
|
|
11455
|
-
if (!this._isMaster) {
|
|
11464
|
+
if (!this.#isMaster) {
|
|
11456
11465
|
return;
|
|
11457
11466
|
}
|
|
11458
11467
|
this.error(err, details);
|
|
11459
11468
|
}
|
|
11460
11469
|
|
|
11461
|
-
|
|
11470
|
+
/** Should only be used by the InboxSDK users for their own app events. */
|
|
11462
11471
|
eventApp(name, details) {
|
|
11463
|
-
_trackEvent(this
|
|
11472
|
+
_trackEvent(this.#appId, 'app', name, details);
|
|
11464
11473
|
}
|
|
11465
11474
|
|
|
11466
|
-
|
|
11467
|
-
|
|
11475
|
+
/**
|
|
11476
|
+
* For tracking app events that are possibly triggered by the user. Extensions
|
|
11477
|
+
* can opt out of this with a flag passed to InboxSDK.load().
|
|
11478
|
+
*/
|
|
11468
11479
|
eventSdkActive(name, details) {
|
|
11469
11480
|
if (!_extensionUseEventTracking) {
|
|
11470
11481
|
return;
|
|
11471
11482
|
}
|
|
11472
|
-
_trackEvent(this
|
|
11483
|
+
_trackEvent(this.#appId, 'sdkActive', name, details);
|
|
11473
11484
|
}
|
|
11474
11485
|
|
|
11475
11486
|
// Track events unrelated to user activity about how the app uses the SDK.
|
|
11476
11487
|
// Examples include the app being initialized, and calls to any of the
|
|
11477
11488
|
// register___ViewHandler functions.
|
|
11478
11489
|
eventSdkPassive(name, details, sensitive) {
|
|
11479
|
-
if (sensitive && !(0,isStreakAppId/* default */.Z)(this
|
|
11490
|
+
if (sensitive && !(0,isStreakAppId/* default */.Z)(this.#appId)) {
|
|
11480
11491
|
// do not log events if they were marked as sensitive
|
|
11481
11492
|
return;
|
|
11482
11493
|
}
|
|
11483
|
-
_trackEvent(this
|
|
11494
|
+
_trackEvent(this.#appId, 'sdkPassive', name, details);
|
|
11484
11495
|
}
|
|
11485
11496
|
|
|
11486
11497
|
// Track Site events.
|
|
11487
11498
|
eventSite(name, details) {
|
|
11488
11499
|
// Only the first logger instance reports Site events.
|
|
11489
|
-
if (!this
|
|
11500
|
+
if (!this.#isMaster) {
|
|
11490
11501
|
return;
|
|
11491
11502
|
}
|
|
11492
|
-
_trackEvent(this
|
|
11503
|
+
_trackEvent(this.#appId, 'gmail', name, details);
|
|
11493
11504
|
}
|
|
11494
11505
|
deprecationWarning(name, suggestion) {
|
|
11495
11506
|
console.warn(`InboxSDK: ${name} is deprecated.` + (suggestion ? ` Please use ${suggestion} instead.` : ''));
|
|
@@ -11506,7 +11517,7 @@ class Logger {
|
|
|
11506
11517
|
};
|
|
11507
11518
|
}
|
|
11508
11519
|
trackFunctionPerformance(fn, sampleRate, details) {
|
|
11509
|
-
if (Math.random() < sampleRate && document.visibilityState === 'visible' && this
|
|
11520
|
+
if (Math.random() < sampleRate && document.visibilityState === 'visible' && this.#isMaster) {
|
|
11510
11521
|
const start = Date.now();
|
|
11511
11522
|
fn();
|
|
11512
11523
|
setTimeout(() => {
|
|
@@ -19331,7 +19342,7 @@ options.insert = htmlElement => {
|
|
|
19331
19342
|
htmlElement.setAttribute('data-inboxsdk-version',
|
|
19332
19343
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
|
|
19333
19344
|
///@ts-ignore
|
|
19334
|
-
"2.1.
|
|
19345
|
+
"2.1.5-1696881387401-5c0ff20cfc735daf");
|
|
19335
19346
|
document.head.append(htmlElement);
|
|
19336
19347
|
};
|
|
19337
19348
|
options.domAPI = (styleDomAPI_default());
|
|
@@ -19356,51 +19367,53 @@ var update = injectStylesIntoStyleTag_default()(mole_view_module/* default */.Z,
|
|
|
19356
19367
|
|
|
19357
19368
|
|
|
19358
19369
|
class GmailMoleViewDriver {
|
|
19359
|
-
|
|
19360
|
-
|
|
19370
|
+
#driver;
|
|
19371
|
+
#eventStream = kefir_bus_default()();
|
|
19372
|
+
#stopper = js_default()();
|
|
19373
|
+
#element;
|
|
19361
19374
|
constructor(driver, options) {
|
|
19362
|
-
this
|
|
19363
|
-
this
|
|
19375
|
+
this.#driver = driver;
|
|
19376
|
+
this.#element = Object.assign(document.createElement('div'), {
|
|
19364
19377
|
className: 'inboxsdk__mole_view ' + (options.className || ''),
|
|
19365
19378
|
innerHTML: getHTMLString(options)
|
|
19366
19379
|
});
|
|
19367
19380
|
if (options.chrome === false) {
|
|
19368
|
-
this.
|
|
19381
|
+
this.#element.classList.add('inboxsdk__mole_view_chromeless');
|
|
19369
19382
|
} else {
|
|
19370
|
-
(0,querySelectorOrFail/* default */.Z)(this
|
|
19383
|
+
(0,querySelectorOrFail/* default */.Z)(this.#element, '.inboxsdk__mole_view_titlebar').addEventListener('click', e => {
|
|
19371
19384
|
this.setMinimized(!this.getMinimized());
|
|
19372
19385
|
e.preventDefault();
|
|
19373
19386
|
e.stopPropagation();
|
|
19374
19387
|
});
|
|
19375
|
-
const minimizeBtn = (0,querySelectorOrFail/* default */.Z)(this
|
|
19388
|
+
const minimizeBtn = (0,querySelectorOrFail/* default */.Z)(this.#element, '.Hl');
|
|
19376
19389
|
minimizeBtn.addEventListener('click', e => {
|
|
19377
19390
|
this.setMinimized(true);
|
|
19378
19391
|
e.preventDefault();
|
|
19379
19392
|
e.stopPropagation();
|
|
19380
19393
|
});
|
|
19381
|
-
const maximizeBtn = (0,querySelectorOrFail/* default */.Z)(this
|
|
19394
|
+
const maximizeBtn = (0,querySelectorOrFail/* default */.Z)(this.#element, '.Hk');
|
|
19382
19395
|
maximizeBtn.addEventListener('click', e => {
|
|
19383
19396
|
this.setMinimized(false);
|
|
19384
19397
|
e.preventDefault();
|
|
19385
19398
|
e.stopPropagation();
|
|
19386
19399
|
});
|
|
19387
|
-
const closeBtn = (0,querySelectorOrFail/* default */.Z)(this
|
|
19400
|
+
const closeBtn = (0,querySelectorOrFail/* default */.Z)(this.#element, '.Ha');
|
|
19388
19401
|
closeBtn.addEventListener('click', e => {
|
|
19389
19402
|
this.destroy();
|
|
19390
19403
|
e.preventDefault();
|
|
19391
19404
|
e.stopPropagation();
|
|
19392
19405
|
});
|
|
19393
19406
|
if (options.titleEl) {
|
|
19394
|
-
this
|
|
19407
|
+
this.#setTitleEl(options.titleEl);
|
|
19395
19408
|
} else {
|
|
19396
19409
|
this.setTitle(options.title || '');
|
|
19397
19410
|
}
|
|
19398
19411
|
if (options.minimizedTitleEl) {
|
|
19399
|
-
this
|
|
19412
|
+
this.#setMinimizedTitleEl(options.minimizedTitleEl);
|
|
19400
19413
|
}
|
|
19401
19414
|
const titleButtons = options.titleButtons;
|
|
19402
19415
|
if (titleButtons) {
|
|
19403
|
-
const titleButtonContainer = (0,querySelectorOrFail/* default */.Z)(this
|
|
19416
|
+
const titleButtonContainer = (0,querySelectorOrFail/* default */.Z)(this.#element, '.inboxsdk__mole_title_buttons');
|
|
19404
19417
|
const lastChild = titleButtonContainer.lastElementChild;
|
|
19405
19418
|
titleButtons.forEach(titleButton => {
|
|
19406
19419
|
const img = document.createElement('img');
|
|
@@ -19418,11 +19431,11 @@ class GmailMoleViewDriver {
|
|
|
19418
19431
|
});
|
|
19419
19432
|
}
|
|
19420
19433
|
}
|
|
19421
|
-
(0,querySelectorOrFail/* default */.Z)(this
|
|
19434
|
+
(0,querySelectorOrFail/* default */.Z)(this.#element, '.inboxsdk__mole_view_content').appendChild(options.el);
|
|
19422
19435
|
}
|
|
19423
19436
|
show() {
|
|
19424
19437
|
const doShow = moleParent => {
|
|
19425
|
-
moleParent.insertBefore(this
|
|
19438
|
+
moleParent.insertBefore(this.#element, last_default()(moleParent.children));
|
|
19426
19439
|
const dw = findParent(moleParent, el => el.nodeName === 'DIV' && el.classList.contains('dw'));
|
|
19427
19440
|
if (dw) {
|
|
19428
19441
|
dw.classList.add('inboxsdk__moles_in_use', mole_view_module/* inboxsdkMolesInUse */.Y);
|
|
@@ -19432,7 +19445,7 @@ class GmailMoleViewDriver {
|
|
|
19432
19445
|
if (moleParent) {
|
|
19433
19446
|
doShow(moleParent);
|
|
19434
19447
|
} else {
|
|
19435
|
-
const moleParentReadyEvent = (0,stream_wait_for/* default */.Z)(() => gmail_element_getter/* default.getMoleParent */.Z.getMoleParent()).takeUntilBy(this
|
|
19448
|
+
const moleParentReadyEvent = (0,stream_wait_for/* default */.Z)(() => gmail_element_getter/* default.getMoleParent */.Z.getMoleParent()).takeUntilBy(this.#stopper).onValue(doShow);
|
|
19436
19449
|
// For some users, the mole parent element seems to be lazily loaded by
|
|
19437
19450
|
// Gmail only once the user has used a compose view or a thread view.
|
|
19438
19451
|
// If the gmail mode has settled, we've been loaded for 10 seconds, and
|
|
@@ -19440,10 +19453,10 @@ class GmailMoleViewDriver {
|
|
|
19440
19453
|
// by opening a compose view and then closing it.
|
|
19441
19454
|
kefir_esm.fromPromise(gmail_element_getter/* default.waitForGmailModeToSettle */.Z.waitForGmailModeToSettle()).flatMap(() => {
|
|
19442
19455
|
// delay until we've passed TimestampOnReady + 10 seconds
|
|
19443
|
-
return this.
|
|
19444
|
-
}).takeUntilBy(moleParentReadyEvent).takeUntilBy(this
|
|
19445
|
-
this.
|
|
19446
|
-
this.
|
|
19456
|
+
return this.#driver.delayToTimeAfterReady(10 * 1000);
|
|
19457
|
+
}).takeUntilBy(moleParentReadyEvent).takeUntilBy(this.#stopper).onValue(() => {
|
|
19458
|
+
this.#driver.getLogger().eventSdkActive('mole parent force load');
|
|
19459
|
+
this.#driver.openNewComposeViewDriver().then(gmailComposeView => {
|
|
19447
19460
|
gmailComposeView.close();
|
|
19448
19461
|
});
|
|
19449
19462
|
});
|
|
@@ -19451,55 +19464,55 @@ class GmailMoleViewDriver {
|
|
|
19451
19464
|
}
|
|
19452
19465
|
setMinimized(minimized) {
|
|
19453
19466
|
if (minimized) {
|
|
19454
|
-
this.
|
|
19455
|
-
this.
|
|
19467
|
+
this.#element.classList.add('inboxsdk__minimized');
|
|
19468
|
+
this.#eventStream.emit({
|
|
19456
19469
|
eventName: 'minimize'
|
|
19457
19470
|
});
|
|
19458
19471
|
} else {
|
|
19459
|
-
this.
|
|
19472
|
+
this.#element.classList.remove('inboxsdk__minimized');
|
|
19460
19473
|
|
|
19461
19474
|
// If the mole is off the left edge of the screen, then move it to the
|
|
19462
19475
|
// right.
|
|
19463
|
-
const moleParent = this.
|
|
19464
|
-
if (moleParent && this.
|
|
19465
|
-
moleParent.insertBefore(this
|
|
19476
|
+
const moleParent = this.#element.parentElement;
|
|
19477
|
+
if (moleParent && this.#element.getBoundingClientRect().left < 0) {
|
|
19478
|
+
moleParent.insertBefore(this.#element, last_default()(moleParent.children));
|
|
19466
19479
|
}
|
|
19467
|
-
this.
|
|
19480
|
+
this.#eventStream.emit({
|
|
19468
19481
|
eventName: 'restore'
|
|
19469
19482
|
});
|
|
19470
19483
|
}
|
|
19471
19484
|
}
|
|
19472
19485
|
getMinimized() {
|
|
19473
|
-
return this.
|
|
19486
|
+
return this.#element.classList.contains('inboxsdk__minimized');
|
|
19474
19487
|
}
|
|
19475
19488
|
setTitle(text) {
|
|
19476
|
-
const titleElement = this.
|
|
19489
|
+
const titleElement = this.#element.querySelector('.inboxsdk__mole_view_titlebar h2.inboxsdk__mole_default');
|
|
19477
19490
|
if (titleElement) {
|
|
19478
19491
|
titleElement.textContent = text;
|
|
19479
19492
|
}
|
|
19480
19493
|
}
|
|
19481
|
-
|
|
19482
|
-
const container = this.
|
|
19494
|
+
#setTitleEl(el) {
|
|
19495
|
+
const container = this.#element.querySelector('.inboxsdk__mole_view_titlebar h2.inboxsdk__mole_default');
|
|
19483
19496
|
if (container) {
|
|
19484
19497
|
container.textContent = '';
|
|
19485
19498
|
container.appendChild(el);
|
|
19486
19499
|
}
|
|
19487
19500
|
}
|
|
19488
|
-
|
|
19489
|
-
const container = this.
|
|
19501
|
+
#setMinimizedTitleEl(el) {
|
|
19502
|
+
const container = this.#element.querySelector('.inboxsdk__mole_view_titlebar h2.inboxsdk__mole_minimized');
|
|
19490
19503
|
if (container) {
|
|
19491
|
-
this.
|
|
19504
|
+
this.#element.classList.add('inboxsdk__mole_use_minimize_title');
|
|
19492
19505
|
container.textContent = '';
|
|
19493
19506
|
container.appendChild(el);
|
|
19494
19507
|
}
|
|
19495
19508
|
}
|
|
19496
19509
|
getEventStream() {
|
|
19497
|
-
return this
|
|
19510
|
+
return this.#eventStream;
|
|
19498
19511
|
}
|
|
19499
19512
|
destroy() {
|
|
19500
|
-
this.
|
|
19501
|
-
this.
|
|
19502
|
-
this.
|
|
19513
|
+
this.#element.remove();
|
|
19514
|
+
this.#eventStream.end();
|
|
19515
|
+
this.#stopper.destroy();
|
|
19503
19516
|
}
|
|
19504
19517
|
}
|
|
19505
19518
|
/* harmony default export */ const gmail_mole_view_driver = (GmailMoleViewDriver);
|
|
@@ -22162,14 +22175,42 @@ var isIntegratedViewGmail = __webpack_require__(98884);
|
|
|
22162
22175
|
|
|
22163
22176
|
|
|
22164
22177
|
|
|
22178
|
+
|
|
22179
|
+
async function isSidePanelCollapsed() {
|
|
22180
|
+
const sidePanelSelector = '.brC-aT5-aOt-Jw[role=complementary]';
|
|
22181
|
+
try {
|
|
22182
|
+
await (0,wait_for/* default */.Z)(() => document.querySelector(sidePanelSelector), 10_000);
|
|
22183
|
+
// Wait for the collapse button to appear too. Otherwise, the side panel will initially appear without a display style set for collapsed.
|
|
22184
|
+
await (0,wait_for/* default */.Z)(() => document.querySelector('.aT5-aOt-I[role=button]'));
|
|
22185
|
+
} catch (e) {
|
|
22186
|
+
if (e instanceof wait_for/* WaitForError */.p) {
|
|
22187
|
+
return null;
|
|
22188
|
+
}
|
|
22189
|
+
throw e;
|
|
22190
|
+
}
|
|
22191
|
+
const maybeCollapsedSidePanel = document.querySelector(`${sidePanelSelector}[style*="display: none;"]`);
|
|
22192
|
+
|
|
22193
|
+
// If the sidePanel is collapsed, it will have a style attribute with display: none
|
|
22194
|
+
return maybeCollapsedSidePanel != null;
|
|
22195
|
+
}
|
|
22165
22196
|
async function gmailLoadEvent(driver) {
|
|
22166
22197
|
const pageCommunicator = driver.getPageCommunicator();
|
|
22167
22198
|
const isConversationViewDisabled = await pageCommunicator.isConversationViewDisabled();
|
|
22168
22199
|
await waitForMenuReady();
|
|
22169
22200
|
const isUsingDarkTheme = await checkForDarkThemeSafe();
|
|
22170
|
-
|
|
22171
|
-
|
|
22172
|
-
|
|
22201
|
+
const sidePanelCollapsed = await isSidePanelCollapsed();
|
|
22202
|
+
const timing = performance?.timing;
|
|
22203
|
+
driver.logger.eventSite('gmailSettings', {
|
|
22204
|
+
isGmailIntegratedView: (0,isIntegratedViewGmail/* default */.ZP)(),
|
|
22205
|
+
/**
|
|
22206
|
+
* This is the panel on the left side of the screen. If the top left burger of Gmail is collapsed, then this is true.
|
|
22207
|
+
*/
|
|
22208
|
+
isCollapsiblePanelHidden: (0,isIntegratedViewGmail/* isCollapsiblePanelHidden */.ky)(),
|
|
22209
|
+
isGoogleChatEnabled: (0,isIntegratedViewGmail/* isGoogleChatEnabled */.Jv)(),
|
|
22210
|
+
/**
|
|
22211
|
+
* This is the sidePanel on the right side of the screen. The collapse button is at the bottom right corner of the screen.
|
|
22212
|
+
*/
|
|
22213
|
+
isSidePanelCollapsed: sidePanelCollapsed,
|
|
22173
22214
|
isDarkTheme: isUsingDarkTheme,
|
|
22174
22215
|
screenWidth: window.screen?.width,
|
|
22175
22216
|
screenHeight: window.screen?.height,
|
|
@@ -22181,20 +22222,20 @@ async function gmailLoadEvent(driver) {
|
|
|
22181
22222
|
isConversationViewDisabled,
|
|
22182
22223
|
wasAccountSwitcherReadyAtStart: driver.getEnvData().wasAccountSwitcherReadyAtStart,
|
|
22183
22224
|
timings: {
|
|
22184
|
-
responseStart:
|
|
22185
|
-
responseEnd:
|
|
22186
|
-
domLoading:
|
|
22187
|
-
domInteractive:
|
|
22188
|
-
domComplete:
|
|
22189
|
-
domContentLoadedEventStart:
|
|
22190
|
-
domContentLoadedEventEnd:
|
|
22191
|
-
domainLookupEnd:
|
|
22192
|
-
domainLookupStart:
|
|
22193
|
-
fetchStart:
|
|
22194
|
-
loadEventStart:
|
|
22195
|
-
loadEventEnd:
|
|
22196
|
-
navigationStart:
|
|
22197
|
-
requestStart:
|
|
22225
|
+
responseStart: timing?.responseStart,
|
|
22226
|
+
responseEnd: timing?.responseEnd,
|
|
22227
|
+
domLoading: timing?.domLoading,
|
|
22228
|
+
domInteractive: timing?.domInteractive,
|
|
22229
|
+
domComplete: timing?.domComplete,
|
|
22230
|
+
domContentLoadedEventStart: timing?.domContentLoadedEventStart,
|
|
22231
|
+
domContentLoadedEventEnd: timing?.domContentLoadedEventEnd,
|
|
22232
|
+
domainLookupEnd: timing?.domainLookupEnd,
|
|
22233
|
+
domainLookupStart: timing?.domainLookupStart,
|
|
22234
|
+
fetchStart: timing?.fetchStart,
|
|
22235
|
+
loadEventStart: timing?.loadEventStart,
|
|
22236
|
+
loadEventEnd: timing?.loadEventEnd,
|
|
22237
|
+
navigationStart: timing?.navigationStart,
|
|
22238
|
+
requestStart: timing?.requestStart,
|
|
22198
22239
|
...driver.getTimings()
|
|
22199
22240
|
}
|
|
22200
22241
|
});
|
|
@@ -23288,22 +23329,51 @@ function parseListPeopleByKnownIdResponse(data) {
|
|
|
23288
23329
|
|
|
23289
23330
|
|
|
23290
23331
|
|
|
23332
|
+
/**
|
|
23333
|
+
* @internal
|
|
23334
|
+
*/
|
|
23291
23335
|
class GmailDriver {
|
|
23292
|
-
|
|
23293
|
-
|
|
23294
|
-
|
|
23295
|
-
|
|
23296
|
-
|
|
23297
|
-
|
|
23298
|
-
|
|
23299
|
-
|
|
23336
|
+
#appId;
|
|
23337
|
+
#logger;
|
|
23338
|
+
#opts;
|
|
23339
|
+
#envData;
|
|
23340
|
+
#customRouteIDs = new Set();
|
|
23341
|
+
#customListRouteIDs = new Map();
|
|
23342
|
+
#customListSearchStringsToRouteIds = new Map();
|
|
23343
|
+
#messageIDsToThreadIDs = new Map();
|
|
23344
|
+
#threadRowIdentifier;
|
|
23345
|
+
#gmailRouteProcessor;
|
|
23346
|
+
#keyboardShortcutHelpModifier;
|
|
23347
|
+
#page;
|
|
23348
|
+
#pageCommunicator;
|
|
23349
|
+
#pageCommunicatorPromise;
|
|
23350
|
+
#butterBar;
|
|
23351
|
+
#butterBarDriver;
|
|
23352
|
+
#routeViewDriverStream;
|
|
23353
|
+
#rowListViewDriverStream;
|
|
23354
|
+
#threadRowViewDriverKefirStream;
|
|
23355
|
+
#threadViewDriverLiveSet;
|
|
23356
|
+
#toolbarViewDriverLiveSet;
|
|
23357
|
+
#composeViewDriverStream;
|
|
23358
|
+
#xhrInterceptorStream;
|
|
23359
|
+
#messageViewDriverStream;
|
|
23360
|
+
#stopper = js_default()();
|
|
23361
|
+
#navMarkerHiddenChanged = kefir_bus_default()();
|
|
23362
|
+
#addonSidebarHiddenChanged = kefir_bus_default()();
|
|
23363
|
+
#userInfo;
|
|
23364
|
+
#timestampAccountSwitcherReady;
|
|
23365
|
+
#timestampGlobalsFound;
|
|
23366
|
+
#timestampOnready;
|
|
23367
|
+
#lastCustomThreadListActivity;
|
|
23368
|
+
#currentRouteViewDriver;
|
|
23369
|
+
#appSidebarView = null;
|
|
23300
23370
|
constructor(appId, LOADER_VERSION, IMPL_VERSION, logger, opts, envData) {
|
|
23301
|
-
this
|
|
23302
|
-
this
|
|
23303
|
-
this
|
|
23304
|
-
this
|
|
23305
|
-
this
|
|
23306
|
-
this.
|
|
23371
|
+
this.#appId = appId;
|
|
23372
|
+
this.#logger = logger;
|
|
23373
|
+
this.#opts = opts;
|
|
23374
|
+
this.#envData = envData;
|
|
23375
|
+
this.#page = (0,makePageParserTree/* default */.Z)(this, document);
|
|
23376
|
+
this.#stopper.onValue(() => this.#page.dump());
|
|
23307
23377
|
|
|
23308
23378
|
// Manages the mapping between RFC Message Ids and Gmail Message Ids. Caches to
|
|
23309
23379
|
// localStorage. Used for custom thread lists.
|
|
@@ -23364,85 +23434,88 @@ class GmailDriver {
|
|
|
23364
23434
|
// sent. It doesn't really need to be cached so it's not here.
|
|
23365
23435
|
this.getGmailMessageIdForSyncDraftId = syncDraftId => (0,getGmailMessageIdForSyncMessageId/* default */.Z)(this, syncDraftId);
|
|
23366
23436
|
}
|
|
23367
|
-
this
|
|
23368
|
-
this
|
|
23369
|
-
this
|
|
23370
|
-
kefir_esm.later(45 * 1000, undefined).takeUntilBy((0,toItemWithLifetimeStream/* default */.Z)(this.
|
|
23371
|
-
this.
|
|
23437
|
+
this.#gmailRouteProcessor = new GmailRouteProcessor();
|
|
23438
|
+
this.#keyboardShortcutHelpModifier = new KeyboardShortcutHelpModifier();
|
|
23439
|
+
this.#butterBarDriver = new GmailButterBarDriver();
|
|
23440
|
+
kefir_esm.later(45 * 1000, undefined).takeUntilBy((0,toItemWithLifetimeStream/* default */.Z)(this.#page.tree.getAllByTag('supportMenu'))).onValue(() => {
|
|
23441
|
+
this.#logger.errorSite(new Error('Failed to find gmail supportMenu'));
|
|
23372
23442
|
});
|
|
23373
|
-
this
|
|
23443
|
+
this.#setupEventStreams();
|
|
23374
23444
|
this.onready.then(() => {
|
|
23375
23445
|
trackEvents(this);
|
|
23376
23446
|
gmailLoadEvent(this);
|
|
23377
|
-
(0,override_gmail_back_button/* default */.Z)(this, this
|
|
23447
|
+
(0,override_gmail_back_button/* default */.Z)(this, this.#gmailRouteProcessor);
|
|
23378
23448
|
trackGmailStyles();
|
|
23379
23449
|
temporaryTrackDownloadUrlValidity(this);
|
|
23380
23450
|
if (opts.suppressAddonTitle != null) {
|
|
23381
23451
|
suppressAddon(this, opts.suppressAddonTitle);
|
|
23382
23452
|
}
|
|
23383
23453
|
}).catch(err => {
|
|
23384
|
-
this.
|
|
23454
|
+
this.#logger.error(err);
|
|
23385
23455
|
});
|
|
23386
23456
|
}
|
|
23387
23457
|
destroy() {
|
|
23388
|
-
this.
|
|
23389
|
-
this.
|
|
23390
|
-
this.
|
|
23458
|
+
this.#threadRowViewSelectionChanges.end();
|
|
23459
|
+
this.#keyboardShortcutHelpModifier.destroy();
|
|
23460
|
+
this.#stopper.destroy();
|
|
23391
23461
|
(0,gmail_thread_row_view/* removeAllThreadRowUnclaimedModifications */.c)();
|
|
23392
23462
|
}
|
|
23393
23463
|
getAppId() {
|
|
23394
|
-
return this
|
|
23464
|
+
return this.#appId;
|
|
23395
23465
|
}
|
|
23396
23466
|
getOpts() {
|
|
23397
|
-
return this
|
|
23467
|
+
return this.#opts;
|
|
23398
23468
|
}
|
|
23399
23469
|
getPageCommunicator() {
|
|
23400
|
-
return this
|
|
23470
|
+
return this.#pageCommunicator;
|
|
23401
23471
|
}
|
|
23402
23472
|
getPageCommunicatorPromise() {
|
|
23403
|
-
return this
|
|
23473
|
+
return this.#pageCommunicatorPromise;
|
|
23474
|
+
}
|
|
23475
|
+
get logger() {
|
|
23476
|
+
return this.#logger;
|
|
23404
23477
|
}
|
|
23405
23478
|
getLogger() {
|
|
23406
|
-
return this
|
|
23479
|
+
return this.#logger;
|
|
23407
23480
|
}
|
|
23408
23481
|
getTagTree() {
|
|
23409
|
-
return this.
|
|
23482
|
+
return this.#page.tree;
|
|
23410
23483
|
}
|
|
23411
23484
|
getCustomListSearchStringsToRouteIds() {
|
|
23412
|
-
return this
|
|
23485
|
+
return this.#customListSearchStringsToRouteIds;
|
|
23413
23486
|
}
|
|
23414
23487
|
getThreadRowIdentifier() {
|
|
23415
|
-
return this
|
|
23488
|
+
return this.#threadRowIdentifier;
|
|
23416
23489
|
}
|
|
23417
23490
|
getButterBarDriver() {
|
|
23418
|
-
return this
|
|
23491
|
+
return this.#butterBarDriver;
|
|
23419
23492
|
}
|
|
23420
23493
|
getButterBar() {
|
|
23421
|
-
return this
|
|
23494
|
+
return this.#butterBar;
|
|
23422
23495
|
}
|
|
23423
23496
|
setButterBar(bb) {
|
|
23424
|
-
this
|
|
23497
|
+
this.#butterBar = bb;
|
|
23425
23498
|
}
|
|
23426
23499
|
getCustomRouteIDs() {
|
|
23427
|
-
return this
|
|
23500
|
+
return this.#customRouteIDs;
|
|
23428
23501
|
}
|
|
23429
23502
|
getCustomListRouteIDs() {
|
|
23430
|
-
return this
|
|
23503
|
+
return this.#customListRouteIDs;
|
|
23431
23504
|
}
|
|
23432
23505
|
getKeyboardShortcutHelpModifier() {
|
|
23433
|
-
return this
|
|
23506
|
+
return this.#keyboardShortcutHelpModifier;
|
|
23434
23507
|
}
|
|
23435
23508
|
getRouteViewDriverStream() {
|
|
23436
|
-
return this
|
|
23509
|
+
return this.#routeViewDriverStream;
|
|
23437
23510
|
}
|
|
23438
23511
|
getRowListViewDriverStream() {
|
|
23439
|
-
return this
|
|
23512
|
+
return this.#rowListViewDriverStream;
|
|
23440
23513
|
}
|
|
23441
23514
|
getThreadRowViewDriverStream() {
|
|
23442
|
-
return this
|
|
23515
|
+
return this.#threadRowViewDriverKefirStream;
|
|
23443
23516
|
}
|
|
23444
23517
|
getThreadViewDriverStream() {
|
|
23445
|
-
return (0,toItemWithLifetimeStream/* default */.Z)(this
|
|
23518
|
+
return (0,toItemWithLifetimeStream/* default */.Z)(this.#threadViewDriverLiveSet).map(_ref2 => {
|
|
23446
23519
|
let {
|
|
23447
23520
|
el
|
|
23448
23521
|
} = _ref2;
|
|
@@ -23450,29 +23523,29 @@ class GmailDriver {
|
|
|
23450
23523
|
});
|
|
23451
23524
|
}
|
|
23452
23525
|
getAttachmentCardViewDriverStream() {
|
|
23453
|
-
return this.
|
|
23526
|
+
return this.#messageViewDriverStream.flatMap(messageViewDriver => messageViewDriver.isLoaded() ? kefir_esm.constant(messageViewDriver) : messageViewDriver.getEventStream().filter(event => event.eventName === 'messageLoad').map(() => messageViewDriver).take(1)).map(messageView => messageView.getAttachmentCardViewDrivers()).flatten();
|
|
23454
23527
|
}
|
|
23455
23528
|
getComposeViewDriverStream() {
|
|
23456
|
-
return this
|
|
23529
|
+
return this.#composeViewDriverStream;
|
|
23457
23530
|
}
|
|
23458
23531
|
getXhrInterceptorStream() {
|
|
23459
|
-
return this
|
|
23532
|
+
return this.#xhrInterceptorStream;
|
|
23460
23533
|
}
|
|
23461
23534
|
getMessageViewDriverStream() {
|
|
23462
|
-
return this
|
|
23535
|
+
return this.#messageViewDriverStream;
|
|
23463
23536
|
}
|
|
23464
23537
|
getStopper() {
|
|
23465
|
-
return this
|
|
23538
|
+
return this.#stopper;
|
|
23466
23539
|
}
|
|
23467
23540
|
getEnvData() {
|
|
23468
|
-
return this
|
|
23541
|
+
return this.#envData;
|
|
23469
23542
|
}
|
|
23470
23543
|
getTimestampOnReady() {
|
|
23471
|
-
if (this
|
|
23472
|
-
this.
|
|
23544
|
+
if (this.#timestampOnready == null) {
|
|
23545
|
+
this.#logger.error(new Error('getTimestampOnReady called before ready'));
|
|
23473
23546
|
return Date.now();
|
|
23474
23547
|
}
|
|
23475
|
-
return this
|
|
23548
|
+
return this.#timestampOnready;
|
|
23476
23549
|
}
|
|
23477
23550
|
|
|
23478
23551
|
// Returns a stream that emits an event once at least `time` milliseconds has
|
|
@@ -23484,11 +23557,11 @@ class GmailDriver {
|
|
|
23484
23557
|
}
|
|
23485
23558
|
getTimings() {
|
|
23486
23559
|
return {
|
|
23487
|
-
piMainStarted: this.
|
|
23488
|
-
piLoadStarted: this.
|
|
23489
|
-
globalsFound: this
|
|
23490
|
-
accountSwitcherReady: this
|
|
23491
|
-
onready: this
|
|
23560
|
+
piMainStarted: this.#envData.piMainStarted,
|
|
23561
|
+
piLoadStarted: this.#envData.piLoadStarted,
|
|
23562
|
+
globalsFound: this.#timestampGlobalsFound,
|
|
23563
|
+
accountSwitcherReady: this.#timestampAccountSwitcherReady,
|
|
23564
|
+
onready: this.#timestampOnready
|
|
23492
23565
|
};
|
|
23493
23566
|
}
|
|
23494
23567
|
registerThreadButton(options) {
|
|
@@ -23498,7 +23571,7 @@ class GmailDriver {
|
|
|
23498
23571
|
button.destroy();
|
|
23499
23572
|
});
|
|
23500
23573
|
};
|
|
23501
|
-
const toolbarViewSub = toValueObservable_default()(this
|
|
23574
|
+
const toolbarViewSub = toValueObservable_default()(this.#toolbarViewDriverLiveSet).subscribe(_ref3 => {
|
|
23502
23575
|
let {
|
|
23503
23576
|
value: gmailToolbarView
|
|
23504
23577
|
} = _ref3;
|
|
@@ -23557,12 +23630,12 @@ class GmailDriver {
|
|
|
23557
23630
|
}
|
|
23558
23631
|
}).merge(unregister));
|
|
23559
23632
|
};
|
|
23560
|
-
if (this
|
|
23561
|
-
this.
|
|
23633
|
+
if (this.#currentRouteViewDriver) {
|
|
23634
|
+
this.#currentRouteViewDriver.getRowListViews().forEach(gmailRowListView => {
|
|
23562
23635
|
gmailRowListView.getThreadRowViewDrivers().forEach(perThreadRow);
|
|
23563
23636
|
});
|
|
23564
23637
|
}
|
|
23565
|
-
const threadRowViewSub = this.
|
|
23638
|
+
const threadRowViewSub = this.#threadRowViewDriverKefirStream.observe({
|
|
23566
23639
|
value: perThreadRow
|
|
23567
23640
|
});
|
|
23568
23641
|
unregister.onValue(() => {
|
|
@@ -23585,21 +23658,21 @@ class GmailDriver {
|
|
|
23585
23658
|
window.dispatchEvent(hce);
|
|
23586
23659
|
}
|
|
23587
23660
|
addCustomRouteID(routeID) {
|
|
23588
|
-
this.
|
|
23589
|
-
this.
|
|
23661
|
+
this.#customRouteIDs.add(routeID);
|
|
23662
|
+
this.#pageCommunicator.registerAllowedHashLinkStartTerm(routeID.split('/')[0]);
|
|
23590
23663
|
return () => {
|
|
23591
|
-
this.
|
|
23664
|
+
this.#customRouteIDs.delete(routeID);
|
|
23592
23665
|
};
|
|
23593
23666
|
}
|
|
23594
23667
|
addCustomListRouteID(routeID, handler) {
|
|
23595
|
-
this.
|
|
23596
|
-
this.
|
|
23668
|
+
this.#customListRouteIDs.set(routeID, handler);
|
|
23669
|
+
this.#pageCommunicator.registerAllowedHashLinkStartTerm(routeID.split('/')[0]);
|
|
23597
23670
|
return () => {
|
|
23598
|
-
this.
|
|
23671
|
+
this.#customListRouteIDs.delete(routeID);
|
|
23599
23672
|
};
|
|
23600
23673
|
}
|
|
23601
23674
|
signalCustomThreadListActivity(customRouteID) {
|
|
23602
|
-
this
|
|
23675
|
+
this.#lastCustomThreadListActivity = {
|
|
23603
23676
|
customRouteID,
|
|
23604
23677
|
timestamp: new Date()
|
|
23605
23678
|
};
|
|
@@ -23608,7 +23681,7 @@ class GmailDriver {
|
|
|
23608
23681
|
// Returns the last time a request for a custom thread list search has gone
|
|
23609
23682
|
// out or we got a response, and the customRouteID for that.
|
|
23610
23683
|
getLastCustomThreadListActivity() {
|
|
23611
|
-
return this
|
|
23684
|
+
return this.#lastCustomThreadListActivity;
|
|
23612
23685
|
}
|
|
23613
23686
|
showCustomThreadList(customRouteID, onActivate, params) {
|
|
23614
23687
|
showCustomThreadList(this, customRouteID, onActivate, params);
|
|
@@ -23620,19 +23693,19 @@ class GmailDriver {
|
|
|
23620
23693
|
showNativeRouteView(this);
|
|
23621
23694
|
}
|
|
23622
23695
|
createLink(routeID, params) {
|
|
23623
|
-
return createLink(this
|
|
23696
|
+
return createLink(this.#gmailRouteProcessor, routeID, params);
|
|
23624
23697
|
}
|
|
23625
23698
|
goto(routeID, params) {
|
|
23626
23699
|
return (0,goto_view/* default */.Z)(this, routeID, params);
|
|
23627
23700
|
}
|
|
23628
23701
|
resolveUrlRedirects(url) {
|
|
23629
|
-
return this.
|
|
23702
|
+
return this.#pageCommunicatorPromise.then(pageCommunicator => pageCommunicator.resolveUrlRedirects(url));
|
|
23630
23703
|
}
|
|
23631
23704
|
registerSearchSuggestionsProvider(handler) {
|
|
23632
23705
|
registerSearchSuggestionsProvider(this, handler);
|
|
23633
23706
|
}
|
|
23634
23707
|
registerSearchQueryRewriter(obj) {
|
|
23635
|
-
registerSearchQueryRewriter(this
|
|
23708
|
+
registerSearchQueryRewriter(this.#pageCommunicator, obj);
|
|
23636
23709
|
}
|
|
23637
23710
|
addToolbarButtonForApp(buttonDescriptor) {
|
|
23638
23711
|
return addToolbarButtonForApp(this, buttonDescriptor);
|
|
@@ -23644,13 +23717,13 @@ class GmailDriver {
|
|
|
23644
23717
|
const composeViewDriver = await composeViewDriverPromise;
|
|
23645
23718
|
return composeViewDriver;
|
|
23646
23719
|
} catch (err) {
|
|
23647
|
-
this.
|
|
23720
|
+
this.#logger.error(err);
|
|
23648
23721
|
throw err;
|
|
23649
23722
|
}
|
|
23650
23723
|
}
|
|
23651
23724
|
getNextComposeViewDriver() {
|
|
23652
23725
|
let timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10 * 1000;
|
|
23653
|
-
return this.
|
|
23726
|
+
return this.#composeViewDriverStream.merge(kefir_esm.later(timeout, new Error('Reached timeout while waiting for getNextComposeViewDriver'))).beforeEnd(() => new Error('Driver was shut down before a new compose was found')).flatMap(x => x instanceof Error ? kefir_esm.constantError(x) : kefir_esm.constant(x)).take(1).takeErrors(1).toPromise();
|
|
23654
23727
|
}
|
|
23655
23728
|
openDraftByMessageID(messageID) {
|
|
23656
23729
|
return openDraftByMessageID(this, messageID);
|
|
@@ -23678,25 +23751,25 @@ class GmailDriver {
|
|
|
23678
23751
|
}
|
|
23679
23752
|
getSentMailNativeNavItem() {
|
|
23680
23753
|
const p = getNativeNavItem(this, 'sent');
|
|
23681
|
-
p.catch(err => this.
|
|
23754
|
+
p.catch(err => this.#logger.error(err));
|
|
23682
23755
|
return p;
|
|
23683
23756
|
}
|
|
23684
23757
|
setShowNativeNavMarker(isNative) {
|
|
23685
|
-
this.
|
|
23758
|
+
this.#navMarkerHiddenChanged.emit(null);
|
|
23686
23759
|
const leftNavContainerElement = gmail_element_getter/* default.getLeftNavContainerElement */.Z.getLeftNavContainerElement();
|
|
23687
23760
|
if (leftNavContainerElement) {
|
|
23688
23761
|
if (isNative) {
|
|
23689
23762
|
leftNavContainerElement.classList.remove('inboxsdk__hide_native_marker');
|
|
23690
23763
|
} else {
|
|
23691
23764
|
leftNavContainerElement.classList.add('inboxsdk__hide_native_marker');
|
|
23692
|
-
this.
|
|
23765
|
+
this.#stopper.takeUntilBy(this.#navMarkerHiddenChanged).onValue(() => {
|
|
23693
23766
|
leftNavContainerElement.classList.remove('inboxsdk__hide_native_marker');
|
|
23694
23767
|
});
|
|
23695
23768
|
}
|
|
23696
23769
|
}
|
|
23697
23770
|
}
|
|
23698
23771
|
setShowNativeAddonSidebar(isNative) {
|
|
23699
|
-
this.
|
|
23772
|
+
this.#addonSidebarHiddenChanged.emit(null);
|
|
23700
23773
|
const addonContainerElement = gmail_element_getter/* default.getAddonSidebarContainerElement */.Z.getAddonSidebarContainerElement();
|
|
23701
23774
|
const mainContentBodyContainerElement = gmail_element_getter/* default.getMainContentBodyContainerElement */.Z.getMainContentBodyContainerElement();
|
|
23702
23775
|
if (addonContainerElement && mainContentBodyContainerElement) {
|
|
@@ -23706,90 +23779,90 @@ class GmailDriver {
|
|
|
23706
23779
|
parent.classList.remove('inboxsdk__hide_addon_container');
|
|
23707
23780
|
} else {
|
|
23708
23781
|
parent.classList.add('inboxsdk__hide_addon_container');
|
|
23709
|
-
this.
|
|
23782
|
+
this.#stopper.takeUntilBy(this.#addonSidebarHiddenChanged).onValue(() => {
|
|
23710
23783
|
parent.classList.remove('inboxsdk__hide_addon_container');
|
|
23711
23784
|
});
|
|
23712
23785
|
}
|
|
23713
23786
|
}
|
|
23714
23787
|
}
|
|
23715
23788
|
async getGmailActionToken() {
|
|
23716
|
-
return this.
|
|
23789
|
+
return this.#pageCommunicator.getActionTokenValue();
|
|
23717
23790
|
}
|
|
23718
23791
|
getUserEmailAddress() {
|
|
23719
|
-
return this.
|
|
23792
|
+
return this.#pageCommunicator.getUserEmailAddress();
|
|
23720
23793
|
}
|
|
23721
23794
|
isConversationViewDisabled() {
|
|
23722
|
-
return this.
|
|
23795
|
+
return this.#pageCommunicator.isConversationViewDisabled();
|
|
23723
23796
|
}
|
|
23724
23797
|
getUserLanguage() {
|
|
23725
|
-
return this.
|
|
23798
|
+
return this.#pageCommunicator.getUserLanguage();
|
|
23726
23799
|
}
|
|
23727
23800
|
getUserContact() {
|
|
23728
23801
|
return {
|
|
23729
23802
|
emailAddress: this.getUserEmailAddress(),
|
|
23730
|
-
name: this.
|
|
23803
|
+
name: this.#userInfo.getUserName()
|
|
23731
23804
|
};
|
|
23732
23805
|
}
|
|
23733
23806
|
getAccountSwitcherContactList() {
|
|
23734
|
-
return this.
|
|
23807
|
+
return this.#userInfo.getAccountSwitcherContactList();
|
|
23735
23808
|
}
|
|
23736
23809
|
activateShortcut(keyboardShortcutHandle, appName, appIconUrl) {
|
|
23737
|
-
this.getKeyboardShortcutHelpModifier().set(keyboardShortcutHandle, this
|
|
23810
|
+
this.getKeyboardShortcutHelpModifier().set(keyboardShortcutHandle, this.#appId, appName, appIconUrl);
|
|
23738
23811
|
keyboardShortcutHandle.once('destroy', () => {
|
|
23739
23812
|
this.getKeyboardShortcutHelpModifier().delete(keyboardShortcutHandle);
|
|
23740
23813
|
});
|
|
23741
23814
|
}
|
|
23742
|
-
|
|
23815
|
+
#setupEventStreams() {
|
|
23743
23816
|
var result = makeXhrInterceptor();
|
|
23744
|
-
this
|
|
23745
|
-
this
|
|
23746
|
-
this.onready = this.
|
|
23747
|
-
this
|
|
23748
|
-
this
|
|
23749
|
-
this.
|
|
23750
|
-
this.
|
|
23751
|
-
this
|
|
23752
|
-
this
|
|
23753
|
-
this
|
|
23754
|
-
this.
|
|
23755
|
-
this
|
|
23817
|
+
this.#xhrInterceptorStream = result.xhrInterceptStream.takeUntilBy(this.#stopper);
|
|
23818
|
+
this.#pageCommunicatorPromise = result.pageCommunicatorPromise;
|
|
23819
|
+
this.onready = this.#pageCommunicatorPromise.then(pageCommunicator => {
|
|
23820
|
+
this.#timestampGlobalsFound = Date.now();
|
|
23821
|
+
this.#pageCommunicator = pageCommunicator;
|
|
23822
|
+
this.#logger.setUserEmailAddress(this.getUserEmailAddress());
|
|
23823
|
+
this.#logger.setIsUsingSyncAPI(pageCommunicator.isUsingSyncAPI());
|
|
23824
|
+
this.#userInfo = new UserInfo(this);
|
|
23825
|
+
this.#timestampAccountSwitcherReady = Date.now();
|
|
23826
|
+
this.#routeViewDriverStream = setupRouteViewDriverStream(this.#gmailRouteProcessor, this).takeUntilBy(this.#stopper).toProperty();
|
|
23827
|
+
this.#routeViewDriverStream.onValue(gmailRouteView => {
|
|
23828
|
+
this.#currentRouteViewDriver = gmailRouteView;
|
|
23756
23829
|
});
|
|
23757
|
-
this
|
|
23758
|
-
this
|
|
23759
|
-
this
|
|
23830
|
+
this.#rowListViewDriverStream = this.#setupRouteSubViewDriver('newGmailRowListView').takeUntilBy(this.#stopper);
|
|
23831
|
+
this.#setupThreadRowViewDriverKefirStream();
|
|
23832
|
+
this.#threadViewDriverLiveSet = toLiveSet(this.#setupRouteSubViewDriver('newGmailThreadView').takeUntilBy(this.#stopper).flatMap(gmailThreadView => gmailThreadView.getReadyStream().map(() => gmailThreadView)).map(gmailThreadView => ({
|
|
23760
23833
|
el: gmailThreadView,
|
|
23761
23834
|
removalStream: gmailThreadView.getStopper()
|
|
23762
23835
|
})));
|
|
23763
|
-
this
|
|
23764
|
-
this
|
|
23765
|
-
this
|
|
23766
|
-
this
|
|
23767
|
-
this
|
|
23836
|
+
this.#setupToolbarViewDriverStream();
|
|
23837
|
+
this.#setupMessageViewDriverStream();
|
|
23838
|
+
this.#setupComposeViewDriverStream();
|
|
23839
|
+
this.#threadRowIdentifier = new thread_row_identifier(this);
|
|
23840
|
+
this.#timestampOnready = Date.now();
|
|
23768
23841
|
});
|
|
23769
23842
|
}
|
|
23770
|
-
|
|
23771
|
-
this
|
|
23843
|
+
#setupComposeViewDriverStream() {
|
|
23844
|
+
this.#composeViewDriverStream = (0,setup_compose_view_driver_stream/* default */.Z)(this, this.#messageViewDriverStream, this.#xhrInterceptorStream).takeUntilBy(this.#stopper);
|
|
23772
23845
|
}
|
|
23773
|
-
|
|
23774
|
-
return this.
|
|
23846
|
+
#setupRouteSubViewDriver(viewName) {
|
|
23847
|
+
return this.#routeViewDriverStream.flatMap(gmailRouteView => {
|
|
23775
23848
|
return gmailRouteView.getEventStream().filter(event => event.eventName === viewName).map(event => event.view);
|
|
23776
23849
|
});
|
|
23777
23850
|
}
|
|
23778
|
-
|
|
23779
|
-
this
|
|
23851
|
+
#setupThreadRowViewDriverKefirStream() {
|
|
23852
|
+
this.#threadRowViewDriverKefirStream = this.#rowListViewDriverStream.flatMap(rowListViewDriver => rowListViewDriver.getRowViewDriverStream()).takeUntilBy(this.#stopper);
|
|
23780
23853
|
}
|
|
23781
|
-
|
|
23782
|
-
this
|
|
23854
|
+
#setupToolbarViewDriverStream() {
|
|
23855
|
+
this.#toolbarViewDriverLiveSet = toLiveSet(kefir_esm.merge([this.#rowListViewDriverStream.map(gmailRowListView => gmailRowListView.getToolbarView()), this.getThreadViewDriverStream().map(gmailThreadView => gmailThreadView.getToolbarView())]).filter(Boolean).flatMap(gmailToolbarView => gmailToolbarView.waitForReady()).map(gmailToolbarView => ({
|
|
23783
23856
|
el: gmailToolbarView,
|
|
23784
23857
|
removalStream: gmailToolbarView.getStopper()
|
|
23785
|
-
})).takeUntilBy(this
|
|
23786
|
-
this.
|
|
23858
|
+
})).takeUntilBy(this.#stopper));
|
|
23859
|
+
this.#toolbarViewDriverLiveSet.subscribe({});
|
|
23787
23860
|
}
|
|
23788
|
-
|
|
23789
|
-
this
|
|
23861
|
+
#setupMessageViewDriverStream() {
|
|
23862
|
+
this.#messageViewDriverStream = this.getThreadViewDriverStream().flatMap(gmailThreadView => gmailThreadView.getMessageViewDriverStream()).takeUntilBy(this.#stopper);
|
|
23790
23863
|
}
|
|
23791
23864
|
async addGlobalSidebarContentPanel(descriptor) {
|
|
23792
|
-
await this.waitForGlobalSidebarReady().merge(this.
|
|
23865
|
+
await this.waitForGlobalSidebarReady().merge(this.#stopper.flatMap(() => kefir_esm.constantError(new Error('Driver instance was destroyed early')))).take(1).takeErrors(1).toPromise();
|
|
23793
23866
|
const appSidebar = this.getGlobalSidebar();
|
|
23794
23867
|
return appSidebar.addGlobalSidebarContentPanel(descriptor);
|
|
23795
23868
|
}
|
|
@@ -23801,11 +23874,11 @@ class GmailDriver {
|
|
|
23801
23874
|
return (0,stream_wait_for/* default */.Z)(condition).map(() => undefined);
|
|
23802
23875
|
}
|
|
23803
23876
|
getGlobalSidebar() {
|
|
23804
|
-
let appSidebarView = this
|
|
23877
|
+
let appSidebarView = this.#appSidebarView;
|
|
23805
23878
|
if (!appSidebarView) {
|
|
23806
23879
|
const companionSidebarContentContainerEl = gmail_element_getter/* default.getCompanionSidebarContentContainerElement */.Z.getCompanionSidebarContentContainerElement();
|
|
23807
23880
|
if (!companionSidebarContentContainerEl) throw new Error('did not find companionSidebarContentContainerEl');
|
|
23808
|
-
appSidebarView = this
|
|
23881
|
+
appSidebarView = this.#appSidebarView = new gmail_app_sidebar_view/* default */.Z(this, companionSidebarContentContainerEl);
|
|
23809
23882
|
}
|
|
23810
23883
|
return appSidebarView;
|
|
23811
23884
|
}
|
|
@@ -23813,7 +23886,7 @@ class GmailDriver {
|
|
|
23813
23886
|
return !!(__webpack_require__.g.GLOBALS && __webpack_require__.g._GM_main);
|
|
23814
23887
|
}
|
|
23815
23888
|
isUsingSyncAPI() {
|
|
23816
|
-
return this.
|
|
23889
|
+
return this.#pageCommunicator.isUsingSyncAPI();
|
|
23817
23890
|
}
|
|
23818
23891
|
showAppIdWarning() {
|
|
23819
23892
|
showAppIdWarning(this);
|
|
@@ -23822,58 +23895,58 @@ class GmailDriver {
|
|
|
23822
23895
|
return new GmailTopMessageBarDriver(optionStream);
|
|
23823
23896
|
}
|
|
23824
23897
|
associateThreadAndMessageIDs(threadID, messageID) {
|
|
23825
|
-
this.
|
|
23898
|
+
this.#messageIDsToThreadIDs.set(messageID, threadID);
|
|
23826
23899
|
}
|
|
23827
23900
|
getThreadIDForMessageID(messageID) {
|
|
23828
|
-
return (0,get_or_fail/* default */.Z)(this
|
|
23901
|
+
return (0,get_or_fail/* default */.Z)(this.#messageIDsToThreadIDs, messageID);
|
|
23829
23902
|
}
|
|
23830
23903
|
getDraftIDForMessageID(messageID) {
|
|
23831
23904
|
let skipCache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
23832
23905
|
return (0,get_draft_id_for_message_id/* default */.Z)(this, messageID, skipCache);
|
|
23833
23906
|
}
|
|
23834
|
-
|
|
23907
|
+
#recentSyncDraftIds = new Map();
|
|
23835
23908
|
reportRecentSyncDraftId(syncDraftId) {
|
|
23836
|
-
const count = this.
|
|
23909
|
+
const count = this.#recentSyncDraftIds.get(syncDraftId);
|
|
23837
23910
|
const newCount = (count ?? 0) + 1;
|
|
23838
|
-
this.
|
|
23911
|
+
this.#recentSyncDraftIds.set(syncDraftId, newCount);
|
|
23839
23912
|
}
|
|
23840
23913
|
reportDraftClosed(syncDraftId) {
|
|
23841
|
-
kefir_esm.later(30 * 1000, undefined).takeUntilBy(this
|
|
23842
|
-
const count = this.
|
|
23914
|
+
kefir_esm.later(30 * 1000, undefined).takeUntilBy(this.#stopper).onValue(() => {
|
|
23915
|
+
const count = this.#recentSyncDraftIds.get(syncDraftId);
|
|
23843
23916
|
let newCount;
|
|
23844
23917
|
if (count == null || count < 1) {
|
|
23845
23918
|
newCount = 0;
|
|
23846
|
-
this.
|
|
23919
|
+
this.#logger.error(new Error('_recentSyncDraftIds count had unexpected value'), {
|
|
23847
23920
|
count
|
|
23848
23921
|
});
|
|
23849
23922
|
} else {
|
|
23850
23923
|
newCount = count - 1;
|
|
23851
23924
|
}
|
|
23852
23925
|
if (newCount === 0) {
|
|
23853
|
-
this.
|
|
23926
|
+
this.#recentSyncDraftIds.delete(syncDraftId);
|
|
23854
23927
|
} else {
|
|
23855
|
-
this.
|
|
23928
|
+
this.#recentSyncDraftIds.set(syncDraftId, newCount);
|
|
23856
23929
|
}
|
|
23857
23930
|
});
|
|
23858
23931
|
}
|
|
23859
23932
|
isRecentSyncDraftId(syncMessageId) {
|
|
23860
|
-
return this.
|
|
23933
|
+
return this.#recentSyncDraftIds.has(syncMessageId);
|
|
23861
23934
|
}
|
|
23862
|
-
|
|
23935
|
+
#selectedThreadRows = transducers_default().mapcat(gmailRowListView => gmailRowListView.getSelectedThreadRowViewDrivers());
|
|
23863
23936
|
getSelectedThreadRowViewDrivers() {
|
|
23864
|
-
if (!this
|
|
23937
|
+
if (!this.#currentRouteViewDriver) {
|
|
23865
23938
|
return [];
|
|
23866
23939
|
}
|
|
23867
|
-
return transducers_default().toArray(this.
|
|
23940
|
+
return transducers_default().toArray(this.#currentRouteViewDriver.getRowListViews(), this.#selectedThreadRows);
|
|
23868
23941
|
}
|
|
23869
|
-
|
|
23942
|
+
#threadRowViewSelectionChanges = kefir_bus_default()();
|
|
23870
23943
|
signalThreadRowViewSelectionChange() {
|
|
23871
|
-
this.
|
|
23944
|
+
this.#threadRowViewSelectionChanges.value(undefined);
|
|
23872
23945
|
}
|
|
23873
23946
|
registerThreadRowViewSelectionHandler(handler) {
|
|
23874
|
-
this.
|
|
23947
|
+
this.#threadRowViewSelectionChanges.onValue(handler);
|
|
23875
23948
|
return () => {
|
|
23876
|
-
this.
|
|
23949
|
+
this.#threadRowViewSelectionChanges.offValue(handler);
|
|
23877
23950
|
};
|
|
23878
23951
|
}
|
|
23879
23952
|
getPersonDetails(emailAddress) {
|
|
@@ -24499,8 +24572,7 @@ class ComposeView extends safe_event_emitter/* default */.Z {
|
|
|
24499
24572
|
/* harmony import */ var _common_get_or_fail__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7791);
|
|
24500
24573
|
|
|
24501
24574
|
|
|
24502
|
-
const membersMap = new WeakMap();
|
|
24503
|
-
|
|
24575
|
+
const membersMap = new WeakMap();
|
|
24504
24576
|
class ContentPanelView extends _lib_safe_event_emitter__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
24505
24577
|
destroyed = false;
|
|
24506
24578
|
constructor(contentPanelViewImplementation) {
|
|
@@ -24509,7 +24581,7 @@ class ContentPanelView extends _lib_safe_event_emitter__WEBPACK_IMPORTED_MODULE_
|
|
|
24509
24581
|
contentPanelViewImplementation
|
|
24510
24582
|
};
|
|
24511
24583
|
membersMap.set(this, members);
|
|
24512
|
-
this
|
|
24584
|
+
this.#bindToStreamEvents();
|
|
24513
24585
|
}
|
|
24514
24586
|
remove() {
|
|
24515
24587
|
(0,_common_get_or_fail__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(membersMap, this).contentPanelViewImplementation.remove();
|
|
@@ -24523,7 +24595,7 @@ class ContentPanelView extends _lib_safe_event_emitter__WEBPACK_IMPORTED_MODULE_
|
|
|
24523
24595
|
isActive() {
|
|
24524
24596
|
return (0,_common_get_or_fail__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(membersMap, this).contentPanelViewImplementation.isActive();
|
|
24525
24597
|
}
|
|
24526
|
-
|
|
24598
|
+
#bindToStreamEvents() {
|
|
24527
24599
|
const stream = (0,_common_get_or_fail__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(membersMap, this).contentPanelViewImplementation.getEventStream();
|
|
24528
24600
|
stream.onValue(_ref => {
|
|
24529
24601
|
let {
|