@inboxsdk/core 2.2.10 → 2.2.12

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.10-1763685333177-98e6efede22d933e";
374
+ const BUILD_VERSION = "2.2.12-1777580345308-37be721fe51fe009";
375
375
  if (false) {}
376
376
 
377
377
  /***/ }),
@@ -2665,7 +2665,7 @@ options.insert = htmlElement => {
2665
2665
  htmlElement.setAttribute('data-inboxsdk-version',
2666
2666
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
2667
2667
  ///@ts-ignore
2668
- "2.2.10-1763685333177-98e6efede22d933e");
2668
+ "2.2.12-1777580345308-37be721fe51fe009");
2669
2669
  document.head.append(htmlElement);
2670
2670
  };
2671
2671
  options.domAPI = (styleDomAPI_default());
@@ -10313,7 +10313,7 @@ options.insert = htmlElement => {
10313
10313
  htmlElement.setAttribute('data-inboxsdk-version',
10314
10314
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
10315
10315
  ///@ts-ignore
10316
- "2.2.10-1763685333177-98e6efede22d933e");
10316
+ "2.2.12-1777580345308-37be721fe51fe009");
10317
10317
  document.head.append(htmlElement);
10318
10318
  };
10319
10319
  options.domAPI = (styleDomAPI_default());
@@ -11558,10 +11558,11 @@ var safe_event_emitter = __webpack_require__(2788);
11558
11558
  ;// CONCATENATED MODULE: ./src/platform-implementation-js/views/keyboard-shortcut-handle.ts
11559
11559
 
11560
11560
  class KeyboardShortcutHandle extends safe_event_emitter/* default */.A {
11561
- constructor(chord, description) {
11561
+ constructor(chord, description, orderHint) {
11562
11562
  super();
11563
11563
  this.chord = chord;
11564
11564
  this.description = description;
11565
+ this.orderHint = orderHint;
11565
11566
  }
11566
11567
  remove() {
11567
11568
  this.emit('destroy');
@@ -11588,14 +11589,15 @@ class Keyboard {
11588
11589
  // eslint-disable-next-line prefer-const
11589
11590
  let {
11590
11591
  chord,
11591
- description
11592
+ description,
11593
+ orderHint
11592
11594
  } = shortcutDescriptor;
11593
11595
  if (!chord) throw new Error('Keyboard.createShortcutHandle chord missing');
11594
11596
  if (description == null) {
11595
11597
  console.error('Keyboard.createShortcutHandle chord missing');
11596
11598
  description = '';
11597
11599
  }
11598
- const keyboardShortcutHandle = new KeyboardShortcutHandle(chord, description);
11600
+ const keyboardShortcutHandle = new KeyboardShortcutHandle(chord, description, orderHint);
11599
11601
  members.driver.activateShortcut(keyboardShortcutHandle, members.appName, members.appIconUrl);
11600
11602
  return keyboardShortcutHandle;
11601
11603
  }
@@ -14409,14 +14411,15 @@ class GmailThreadView {
14409
14411
  // Follows a similar structure to getThreadIDAsync, but gives up if async work is needed
14410
14412
  getThreadID() {
14411
14413
  if (this.#threadID) return this.#threadID;
14412
- let threadID;
14413
- const idElement = this.#element.querySelector('[data-thread-perm-id]');
14414
+ const idElement = this.#element.querySelector('[data-legacy-thread-id]');
14414
14415
  if (!idElement) throw new Error('threadID element not found');
14415
14416
 
14416
14417
  // the string value can be 'undefined'
14417
- const attributeValue = idElement.getAttribute('data-thread-perm-id');
14418
- this.#syncThreadID = typeof attributeValue === 'string' && attributeValue !== 'undefined' ? attributeValue : null;
14419
- threadID = idElement.getAttribute('data-legacy-thread-id');
14418
+ const syncAttributeValue = idElement.getAttribute('data-thread-perm-id');
14419
+ if (!this.#syncThreadID && syncAttributeValue && syncAttributeValue !== 'undefined') {
14420
+ this.#syncThreadID = syncAttributeValue;
14421
+ }
14422
+ let threadID = idElement.getAttribute('data-legacy-thread-id');
14420
14423
  if (!threadID) {
14421
14424
  const err = new Error('Failed to get id for thread: data-legacy-thread-id attribute missing');
14422
14425
  this.#driver.getLogger().error(err); // throw err;
@@ -14430,7 +14433,7 @@ class GmailThreadView {
14430
14433
  threadID = this.#driver.getPageCommunicator().getCurrentThreadID(this.#element, true);
14431
14434
  } else {
14432
14435
  const params = this.#routeViewDriver ? this.#routeViewDriver.getParams() : null;
14433
- if (params && params.threadID) {
14436
+ if (params && typeof params.threadID === 'string') {
14434
14437
  threadID = params.threadID;
14435
14438
  } else {
14436
14439
  const err = new Error('Failed to get id for thread');
@@ -14443,16 +14446,18 @@ class GmailThreadView {
14443
14446
  return threadID;
14444
14447
  }
14445
14448
  async getThreadIDAsync() {
14446
- let threadID;
14447
- const idElement = this.#element.querySelector('[data-thread-perm-id]');
14449
+ if (this.#threadID) return this.#threadID;
14450
+ const idElement = this.#element.querySelector('[data-legacy-thread-id]');
14448
14451
  if (!idElement) throw new Error('threadID element not found');
14449
14452
 
14450
14453
  // the string value can be 'undefined'
14451
- const attributeValue = idElement.getAttribute('data-thread-perm-id');
14452
- const syncThreadID = this.#syncThreadID = typeof attributeValue === 'string' && attributeValue !== 'undefined' ? attributeValue : null;
14453
- this.#threadID = threadID = idElement.getAttribute('data-legacy-thread-id');
14454
- if (!threadID && syncThreadID) {
14455
- this.#threadID = threadID = await this.#driver.getOldGmailThreadIdFromSyncThreadId(syncThreadID);
14454
+ const syncAttributeValue = idElement.getAttribute('data-thread-perm-id');
14455
+ if (!this.#syncThreadID && syncAttributeValue && syncAttributeValue !== 'undefined') {
14456
+ this.#syncThreadID = syncAttributeValue;
14457
+ }
14458
+ this.#threadID = idElement.getAttribute('data-legacy-thread-id');
14459
+ if (!this.#threadID && this.#syncThreadID) {
14460
+ this.#threadID = await this.#driver.getOldGmailThreadIdFromSyncThreadId(this.#syncThreadID);
14456
14461
  }
14457
14462
  if (this.#threadID) return this.#threadID;else throw new Error('Failed to get id for thread');
14458
14463
  }
@@ -15070,7 +15075,7 @@ options.insert = htmlElement => {
15070
15075
  htmlElement.setAttribute('data-inboxsdk-version',
15071
15076
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
15072
15077
  ///@ts-ignore
15073
- "2.2.10-1763685333177-98e6efede22d933e");
15078
+ "2.2.12-1777580345308-37be721fe51fe009");
15074
15079
  document.head.append(htmlElement);
15075
15080
  };
15076
15081
  options.domAPI = (styleDomAPI_default());
@@ -16513,12 +16518,14 @@ class ModalView extends safe_event_emitter/* default */.A {
16513
16518
  const hideAndDestroyStream = kefir_esm["default"].merge([kefir_esm["default"].fromEvents(this, 'destroy'), hideStream.filter(modalView => modalView === this)]);
16514
16519
  document.body.appendChild(modalViewDriver.getModalContainerElement());
16515
16520
  modalViewDriver.getModalContainerElement().focus();
16516
- kefir_esm["default"].fromEvents(document.body, 'keydown').filter(domEvent => domEvent.keyCode === 27).takeUntilBy(hideAndDestroyStream).onValue(domEvent => {
16517
- domEvent.stopImmediatePropagation();
16518
- domEvent.stopPropagation();
16519
- domEvent.preventDefault();
16520
- this.close();
16521
- });
16521
+ if (modalViewDriver.getCloseOnEscape()) {
16522
+ kefir_esm["default"].fromEvents(document.body, 'keydown').filter(domEvent => domEvent.key === 'Escape').takeUntilBy(hideAndDestroyStream).onValue(domEvent => {
16523
+ domEvent.stopImmediatePropagation();
16524
+ domEvent.stopPropagation();
16525
+ domEvent.preventDefault();
16526
+ this.close();
16527
+ });
16528
+ }
16522
16529
  _replaceCurrentlyShowingModal(this, modalViewDriver);
16523
16530
  }
16524
16531
  setTitle(title) {
@@ -19702,6 +19709,7 @@ class GmailModalViewDriver {
19702
19709
  constructor(options) {
19703
19710
  this._setupModalContainerElement(options);
19704
19711
  this._processOptions(options);
19712
+ this._closeOnEscape = options.closeOnEscape ?? true;
19705
19713
  this._eventStream = kefir_bus_default()();
19706
19714
  this._setupEventStream();
19707
19715
  }
@@ -19715,6 +19723,9 @@ class GmailModalViewDriver {
19715
19723
  getEventStream() {
19716
19724
  return this._eventStream;
19717
19725
  }
19726
+ getCloseOnEscape() {
19727
+ return this._closeOnEscape;
19728
+ }
19718
19729
  _processOptions(options) {
19719
19730
  this.setTitle(options.title);
19720
19731
  this.setContentElement(options.el);
@@ -19830,7 +19841,7 @@ mole_view_module_options.insert = htmlElement => {
19830
19841
  htmlElement.setAttribute('data-inboxsdk-version',
19831
19842
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
19832
19843
  ///@ts-ignore
19833
- "2.2.10-1763685333177-98e6efede22d933e");
19844
+ "2.2.12-1777580345308-37be721fe51fe009");
19834
19845
  document.head.append(htmlElement);
19835
19846
  };
19836
19847
  mole_view_module_options.domAPI = (styleDomAPI_default());
@@ -20602,14 +20613,12 @@ class KeyboardShortcutHelpModifier {
20602
20613
  if (this._shortcuts.size === 0) {
20603
20614
  return;
20604
20615
  }
20605
- this._shortcuts.keys();
20616
+ const sortedShortcuts = Array.from(this._shortcuts).sort(sortByOrderHintAsc);
20606
20617
  var header = this._renderHeader();
20607
20618
  var table = this._renderTable();
20608
20619
  var bodies = table.querySelectorAll('tbody tbody');
20609
- var index = 0;
20610
- this._shortcuts.forEach(keyboardShortcutHandle => {
20620
+ sortedShortcuts.forEach((keyboardShortcutHandle, index) => {
20611
20621
  this._renderShortcut(bodies[index % 2], keyboardShortcutHandle);
20612
- index++;
20613
20622
  });
20614
20623
  const firstHeader = (0,querySelectorOrFail/* default */.A)(node, '.aov');
20615
20624
  const parent = firstHeader.parentElement;
@@ -20687,6 +20696,20 @@ function _getSeparatorHTML(separator) {
20687
20696
  return '';
20688
20697
  }
20689
20698
  }
20699
+
20700
+ // Sort: items with orderHint first (ascending), then items without
20701
+ function sortByOrderHintAsc(a, b) {
20702
+ if (a.orderHint == null && b.orderHint == null) {
20703
+ return 0;
20704
+ }
20705
+ if (a.orderHint == null) {
20706
+ return 1;
20707
+ }
20708
+ if (b.orderHint == null) {
20709
+ return -1;
20710
+ }
20711
+ return a.orderHint - b.orderHint;
20712
+ }
20690
20713
  // EXTERNAL MODULE: ./src/platform-implementation-js/driver-common/getSyncThreadsForSearch.ts
20691
20714
  var getSyncThreadsForSearch = __webpack_require__(6743);
20692
20715
  // EXTERNAL MODULE: ./node_modules/@macil/simple-base-converter/dist/index.js