@inboxsdk/core 2.2.21 → 2.2.23

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 CHANGED
@@ -371,7 +371,7 @@ function isNotNil(value) {
371
371
 
372
372
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- SDK_VERSION is injected by webpack
373
373
  ///@ts-ignore
374
- const BUILD_VERSION = "2.2.21-1787611774146-441abed50ef7945e";
374
+ const BUILD_VERSION = "2.2.23-1788892817778-0b7ebbd328d16089";
375
375
  if (false) {}
376
376
 
377
377
  /***/ }),
@@ -2711,7 +2711,7 @@ options.insert = htmlElement => {
2711
2711
  htmlElement.setAttribute('data-inboxsdk-version',
2712
2712
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
2713
2713
  ///@ts-ignore
2714
- "2.2.21-1787611774146-441abed50ef7945e");
2714
+ "2.2.23-1788892817778-0b7ebbd328d16089");
2715
2715
  document.head.append(htmlElement);
2716
2716
  };
2717
2717
  options.domAPI = (styleDomAPI_default());
@@ -10383,7 +10383,7 @@ options.insert = htmlElement => {
10383
10383
  htmlElement.setAttribute('data-inboxsdk-version',
10384
10384
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
10385
10385
  ///@ts-ignore
10386
- "2.2.21-1787611774146-441abed50ef7945e");
10386
+ "2.2.23-1788892817778-0b7ebbd328d16089");
10387
10387
  document.head.append(htmlElement);
10388
10388
  };
10389
10389
  options.domAPI = (styleDomAPI_default());
@@ -14166,18 +14166,18 @@ class GmailToolbarView {
14166
14166
  }
14167
14167
  }
14168
14168
  _getArchiveSectionElement() {
14169
- return this._getSectionElementForButtonSelector('.ar9, .aFh, .aFj, .lR, .nN, .nX, .aFk');
14169
+ return this._getSectionElementForButtonSelectorKey('toolbar.archiveSectionButton');
14170
14170
  }
14171
14171
  _getCheckboxSectionElement() {
14172
- return this._getSectionElementForButtonSelector('.T-Jo-auh');
14172
+ return this._getSectionElementForButtonSelectorKey('toolbar.checkboxSectionButton');
14173
14173
  }
14174
14174
  _getMoveSectionElement() {
14175
- return this._getSectionElementForButtonSelector('.asb, .ase, .ns, .mw, .bq5');
14175
+ return this._getSectionElementForButtonSelectorKey('toolbar.moveSectionButton') ?? this._getSectionElementForButtonSelectorKey('toolbar.moveSectionFallbackButton');
14176
14176
  }
14177
- _getSectionElementForButtonSelector(buttonSelector) {
14177
+ _getSectionElementForButtonSelectorKey(selectorKey) {
14178
14178
  const sectionElements = this._element.querySelectorAll('.G-Ni');
14179
14179
  for (let ii = 0; ii < sectionElements.length; ii++) {
14180
- if (sectionElements[ii].querySelector(buttonSelector)) {
14180
+ if (this._driver.selectors.querySelectorByKey(sectionElements[ii], selectorKey)) {
14181
14181
  return sectionElements[ii];
14182
14182
  }
14183
14183
  }
@@ -15289,7 +15289,7 @@ options.insert = htmlElement => {
15289
15289
  htmlElement.setAttribute('data-inboxsdk-version',
15290
15290
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
15291
15291
  ///@ts-ignore
15292
- "2.2.21-1787611774146-441abed50ef7945e");
15292
+ "2.2.23-1788892817778-0b7ebbd328d16089");
15293
15293
  document.head.append(htmlElement);
15294
15294
  };
15295
15295
  options.domAPI = (styleDomAPI_default());
@@ -15912,7 +15912,7 @@ var isNotNil = __webpack_require__(960);
15912
15912
 
15913
15913
 
15914
15914
 
15915
- function makePageParser(element, logger) {
15915
+ function makePageParser(element, logger, selectors) {
15916
15916
  return new (page_parser_tree_js_default())(element, {
15917
15917
  logError(err, el) {
15918
15918
  const details = {
@@ -15926,18 +15926,21 @@ function makePageParser(element, logger) {
15926
15926
  sources: [null],
15927
15927
  tag: 'rowListElementContainer',
15928
15928
  selectors: [{
15929
- $map: () => document.querySelector('.bGI.nH')?.parentElement
15929
+ $map: () => selectors.querySelectorByKey(document, 'routeView.rowListWrapper')?.parentElement
15930
15930
  }]
15931
15931
  }, {
15932
15932
  sources: ['rowListElementContainer'],
15933
15933
  tag: 'rowListElement',
15934
- selectors: [{
15934
+ selectors: [
15935
+ // `.bGI.nH` stays literal here: this is a descent path, and a
15936
+ // registry key resolves a single element rather than a path step.
15937
+ {
15935
15938
  $or: [[], ['.bGI.nH', '.bf5', '.bv9', '.bGC']]
15936
15939
  }, '.bGI[role=main]', '[gh=tl]']
15937
15940
  }],
15938
15941
  finders: {
15939
15942
  rowListElementContainer: {
15940
- fn: root => [root.querySelector('.bGI.nH')?.parentElement].filter(isNotNil/* default */.A)
15943
+ fn: root => [selectors.querySelectorByKey(root, 'routeView.rowListWrapper')?.parentElement].filter(isNotNil/* default */.A)
15941
15944
  },
15942
15945
  rowListElement: {
15943
15946
  fn: root => root.querySelectorAll('[gh=tl]')
@@ -16036,7 +16039,7 @@ class GmailRouteView {
16036
16039
  this.#driver = driver;
16037
16040
  this._eventStream = kefir_bus_default()();
16038
16041
  this._hasAddedCollapsibleSection = false;
16039
- this.#page = makePageParser(document.body, driver.getLogger());
16042
+ this.#page = makePageParser(document.body, driver.getLogger(), driver.selectors);
16040
16043
  if (this._type === 'CUSTOM') {
16041
16044
  this._setupCustomViewElement();
16042
16045
  driver.getStopper().takeUntilBy(this._stopper.delay(0)).onValue(() => {
@@ -16349,13 +16352,27 @@ class GmailRouteView {
16349
16352
  if (!sectionsContainer) {
16350
16353
  sectionsContainer = document.createElement('div');
16351
16354
  sectionsContainer.classList.add('inboxsdk__custom_sections');
16352
- main.insertBefore(sectionsContainer, main.firstChild);
16355
+ this.#insertSectionsContainer(main, sectionsContainer);
16353
16356
  } else if (sectionsContainer.classList.contains('Wc') && !this._isSearchRoute()) {
16354
16357
  sectionsContainer.classList.remove('Wc');
16355
16358
  }
16356
16359
  return sectionsContainer;
16357
16360
  }).toProperty();
16358
16361
  }
16362
+
16363
+ /**
16364
+ * Gmail nests the list toolbar inside the row list wrapper, so the top of
16365
+ * the container is above it.
16366
+ */
16367
+ #insertSectionsContainer(main, sectionsContainer) {
16368
+ const rowListWrapper = this.#driver.selectors.querySelectorByKey(main, 'routeView.rowListWrapper');
16369
+ const listToolbar = rowListWrapper && this.#driver.selectors.querySelectorByKey(rowListWrapper, 'routeView.listToolbar');
16370
+ if (listToolbar?.parentElement) {
16371
+ listToolbar.parentElement.insertBefore(sectionsContainer, listToolbar.nextSibling);
16372
+ return;
16373
+ }
16374
+ main.insertBefore(sectionsContainer, main.firstChild);
16375
+ }
16359
16376
  _getCustomParams() {
16360
16377
  var params = Object.create(null);
16361
16378
  if (!this._customRouteID) throw new Error("Should not happen, can't get custom params for non-custom view");
@@ -20052,7 +20069,7 @@ mole_view_module_options.insert = htmlElement => {
20052
20069
  htmlElement.setAttribute('data-inboxsdk-version',
20053
20070
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
20054
20071
  ///@ts-ignore
20055
- "2.2.21-1787611774146-441abed50ef7945e");
20072
+ "2.2.23-1788892817778-0b7ebbd328d16089");
20056
20073
  document.head.append(htmlElement);
20057
20074
  };
20058
20075
  mole_view_module_options.domAPI = (styleDomAPI_default());
@@ -24428,6 +24445,27 @@ const GMAIL_SELECTORS = {
24428
24445
  'composeView.titleBarColorOuter': ['.nH.Hy.aXJ .pi > .l.o'],
24429
24446
  'composeView.titleBarColorBody': ['.nH.Hy.aXJ .l.m'],
24430
24447
  'composeView.titleBarColorBodyInner': ['.nH.Hy.aXJ .l.m > .l.n'],
24448
+ /**
24449
+ * Native button used to identify the Inbox-state toolbar section.
24450
+ * Root: one `.G-Ni` section.
24451
+ */
24452
+ 'toolbar.archiveSectionButton': ['.ar9', '.aFh', '.aFj', '.lR', '.nN', '.nX', '.aFk'],
24453
+ /**
24454
+ * Native checkbox used to identify the selection toolbar section.
24455
+ * Root: one `.G-Ni` section.
24456
+ */
24457
+ 'toolbar.checkboxSectionButton': ['.T-Jo-auh'],
24458
+ /**
24459
+ * Primary native buttons or icon descendants in Gmail's Move/Label section.
24460
+ * Root: one `.G-Ni` section.
24461
+ */
24462
+ 'toolbar.moveSectionButton': ['.asb', '.ase', '.ns', '.mw', '.bq5'],
24463
+ /**
24464
+ * Gmail search threads retain `.aFj` around "Move to Inbox" when Material
24465
+ * SVG icons replace the legacy `.bq5` descendant.
24466
+ * Root: one `.G-Ni` section. Kept separate so a real Move section wins.
24467
+ */
24468
+ 'toolbar.moveSectionFallbackButton': ['.aFj'],
24431
24469
  /**
24432
24470
  * Body of an open message.
24433
24471
  * Root: message element.
@@ -24479,7 +24517,17 @@ const GMAIL_SELECTORS = {
24479
24517
  * when it contains emoji images.
24480
24518
  * Root: thread element.
24481
24519
  */
24482
- 'threadView.subject': ['.ha h2']
24520
+ 'threadView.subject': ['.ha h2'],
24521
+ /**
24522
+ * The element holding the list toolbar and the thread list.
24523
+ * Root: the row list element container.
24524
+ */
24525
+ 'routeView.rowListWrapper': ['.bGI.nH'],
24526
+ /**
24527
+ * The toolbar above the thread list.
24528
+ * Root: `routeView.rowListWrapper`.
24529
+ */
24530
+ 'routeView.listToolbar': ['[gh=tm]', '.G-atb']
24483
24531
  };
24484
24532
 
24485
24533
  /** Resolved candidates for every key. The merge builds new lists. */