@inboxsdk/core 2.2.6 → 2.2.7

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.6-1752599126954-7ed0da58f090270c";
374
+ const BUILD_VERSION = "2.2.7-1753737313283-f941d482eba8eb97";
375
375
  if (false) {}
376
376
 
377
377
  /***/ }),
@@ -2646,7 +2646,7 @@ options.insert = htmlElement => {
2646
2646
  htmlElement.setAttribute('data-inboxsdk-version',
2647
2647
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
2648
2648
  ///@ts-ignore
2649
- "2.2.6-1752599126954-7ed0da58f090270c");
2649
+ "2.2.7-1753737313283-f941d482eba8eb97");
2650
2650
  document.head.append(htmlElement);
2651
2651
  };
2652
2652
  options.domAPI = (styleDomAPI_default());
@@ -7425,20 +7425,20 @@ var assert = __webpack_require__(1602);
7425
7425
 
7426
7426
 
7427
7427
  const cachedModificationsByRow = (0,js.defonce)(module, () => new WeakMap());
7428
+ const BUTTON_CLASS = 'inboxsdk__thread_row_button';
7428
7429
  function focusAndNoPropagation(event) {
7429
7430
  this.focus();
7430
7431
  event.stopImmediatePropagation();
7431
7432
  }
7432
- function starGroupEventInterceptor(event) {
7433
- const isOnStar = this.firstElementChild.contains(event.target);
7434
- const isOnSDKButton = !isOnStar && this !== event.target;
7435
- if (!isOnStar) {
7433
+
7434
+ /**
7435
+ * Click handler for starGroup - will stop immediate propagation if the target is one of our buttons.
7436
+ * If we don't do this, clicking our button here would open the thread.
7437
+ */
7438
+ function onClickStarGroup(event) {
7439
+ const isOnSdkButton = !!event.target?.closest(`.${BUTTON_CLASS}`);
7440
+ if (isOnSdkButton) {
7436
7441
  event.stopImmediatePropagation();
7437
- if (!isOnSDKButton || event.type == 'mouseover') {
7438
- const newEvent = document.createEvent('MouseEvents');
7439
- newEvent.initMouseEvent(event.type, event.bubbles, event.cancelable, event.view, event.detail, event.screenX, event.screenY, event.clientX, event.clientY, event.ctrlKey, event.altKey, event.shiftKey, event.metaKey, event.button, event.relatedTarget);
7440
- this.parentElement.dispatchEvent(newEvent);
7441
- }
7442
7442
  }
7443
7443
  }
7444
7444
  class GmailThreadRowView {
@@ -7528,6 +7528,14 @@ class GmailThreadRowView {
7528
7528
  getElement() {
7529
7529
  return this._elements[0];
7530
7530
  }
7531
+
7532
+ /**
7533
+ * Provides the button toolbar element.
7534
+ * Will be null when the element is not present - this happens when the "Hover actions" setting is disabled.
7535
+ */
7536
+ #getButtonToolbar() {
7537
+ return this._elements[0]?.querySelector('ul[role=toolbar]') || null;
7538
+ }
7531
7539
  _removeUnclaimedModifications() {
7532
7540
  _removeThreadRowUnclaimedModifications(this._modifications); // TODO fix column width to deal with removed buttons
7533
7541
  }
@@ -7733,8 +7741,8 @@ class GmailThreadRowView {
7733
7741
  }
7734
7742
  });
7735
7743
  this._stopper.onValue(() => {
7736
- if (buttonMod && buttonMod.buttonSpan) {
7737
- buttonMod.buttonSpan.onclick = null;
7744
+ if (buttonMod && buttonMod.buttonEl) {
7745
+ buttonMod.buttonEl.onclick = null;
7738
7746
  }
7739
7747
  });
7740
7748
  prop.combine(this._getRefresher(), (value, _ignored) => value).onValue(_buttonDescriptor => {
@@ -7751,34 +7759,28 @@ class GmailThreadRowView {
7751
7759
  buttonDescriptor.iconClass = buttonDescriptor.className;
7752
7760
  delete buttonDescriptor.className;
7753
7761
  }
7754
- let buttonSpan, iconSettings;
7755
- const buttonToolbar = this._elements[0].querySelector('ul[role=toolbar]');
7762
+ const buttonToolbar = this.#getButtonToolbar();
7763
+ let buttonEl, iconSettings;
7756
7764
  if (!buttonMod) {
7757
7765
  buttonMod = this._modifications.button.unclaimed.shift();
7758
7766
  if (!buttonMod) {
7759
7767
  if (buttonToolbar) {
7760
- buttonSpan = document.createElement('li');
7761
- buttonSpan.classList.add('bqX');
7768
+ buttonEl = document.createElement('li');
7769
+ buttonEl.classList.add('bqX');
7762
7770
  } else {
7763
- buttonSpan = document.createElement('span');
7771
+ buttonEl = document.createElement('span');
7764
7772
  // T-KT is one of the class names on the star button.
7765
- buttonSpan.classList.add('T-KT');
7766
- }
7767
- buttonSpan.classList.add('inboxsdk__thread_row_button');
7768
- if (buttonDescriptor.title) {
7769
- buttonSpan.setAttribute('title', buttonDescriptor.title);
7770
- buttonSpan.setAttribute('data-tooltip', buttonDescriptor.title);
7771
- } else {
7772
- buttonSpan.removeAttribute('title');
7773
+ buttonEl.classList.add('T-KT');
7773
7774
  }
7774
- buttonSpan.setAttribute('tabindex', '-1');
7775
- buttonSpan.setAttribute('data-order-hint', String(buttonDescriptor.orderHint || 0));
7776
- buttonSpan.addEventListener('onmousedown', focusAndNoPropagation);
7775
+ buttonEl.classList.add(BUTTON_CLASS);
7776
+ buttonEl.setAttribute('tabindex', '-1');
7777
+ buttonEl.setAttribute('data-order-hint', String(buttonDescriptor.orderHint || 0));
7778
+ buttonEl.addEventListener('onmousedown', focusAndNoPropagation);
7777
7779
  iconSettings = {};
7778
7780
  buttonMod = {
7779
- buttonSpan,
7781
+ buttonEl,
7780
7782
  iconSettings,
7781
- remove: buttonSpan.remove.bind(buttonSpan)
7783
+ remove: buttonEl.remove.bind(buttonEl)
7782
7784
  };
7783
7785
  }
7784
7786
  this._modifications.button.claimed.push(buttonMod);
@@ -7786,11 +7788,20 @@ class GmailThreadRowView {
7786
7788
 
7787
7789
  // could also be trash icon
7788
7790
  const starGroup = buttonToolbar ? null : (0,querySelectorOrFail/* default */.A)(this._elements[0], 'td.apU.xY, td.aqM.xY');
7789
- buttonSpan = buttonMod.buttonSpan;
7791
+ buttonEl = buttonMod.buttonEl;
7790
7792
  iconSettings = buttonMod.iconSettings;
7793
+
7794
+ // update title
7795
+ if (buttonDescriptor.title) {
7796
+ buttonEl.setAttribute('aria-label', buttonDescriptor.title);
7797
+ buttonEl.setAttribute('data-tooltip', buttonDescriptor.title);
7798
+ } else {
7799
+ buttonEl.removeAttribute('aria-label');
7800
+ buttonEl.removeAttribute('data-tooltip');
7801
+ }
7791
7802
  if (buttonDescriptor.onClick) {
7792
7803
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
7793
- buttonSpan.onclick = event => {
7804
+ buttonEl.onclick = event => {
7794
7805
  const appEvent = {
7795
7806
  dropdown: null,
7796
7807
  threadRowView: this._userView
@@ -7807,7 +7818,7 @@ class GmailThreadRowView {
7807
7818
  this._elements[0].classList.add('inboxsdk__dropdown_active');
7808
7819
  this._elements[0].classList.add('buL'); // gmail class to force row button toolbar to be visible
7809
7820
 
7810
- appEvent.dropdown = activeDropdown = new dropdown_view/* default */.A(new gmail_dropdown_view/* default */.A(), buttonSpan, null);
7821
+ appEvent.dropdown = activeDropdown = new dropdown_view/* default */.A(new gmail_dropdown_view/* default */.A(), buttonEl, null);
7811
7822
  activeDropdown.setPlacementOptions({
7812
7823
  position: 'bottom',
7813
7824
  hAlign: 'left',
@@ -7829,22 +7840,13 @@ class GmailThreadRowView {
7829
7840
  buttonDescriptor.onClick.call(null, appEvent);
7830
7841
  };
7831
7842
  }
7832
- (0,update_icon/* default */.A)(iconSettings, buttonSpan, false, buttonDescriptor.iconClass, buttonDescriptor.iconUrl);
7833
- if (buttonToolbar && buttonSpan.parentElement !== buttonToolbar) {
7834
- (0,insert_element_in_order/* default */.A)(buttonToolbar, buttonSpan, undefined, true);
7835
- } else if (starGroup && buttonSpan.parentElement !== starGroup) {
7836
- (0,insert_element_in_order/* default */.A)(starGroup, buttonSpan);
7843
+ (0,update_icon/* default */.A)(iconSettings, buttonEl, false, buttonDescriptor.iconClass, buttonDescriptor.iconUrl);
7844
+ if (buttonToolbar && buttonEl.parentElement !== buttonToolbar) {
7845
+ (0,insert_element_in_order/* default */.A)(buttonToolbar, buttonEl, undefined, true);
7846
+ } else if (starGroup && buttonEl.parentElement !== starGroup) {
7847
+ (0,insert_element_in_order/* default */.A)(starGroup, buttonEl);
7837
7848
  this._expandColumn('col.y5', 26 * starGroup.children.length);
7838
-
7839
- // Don't let the whole column count as the star for click and mouse over purposes.
7840
- // Click events that aren't directly on the star should be stopped.
7841
- // Mouseover events that aren't directly on the star should be stopped and
7842
- // re-emitted from the thread row, so the thread row still has the mouseover
7843
- // appearance.
7844
- // Click events that are on one of our buttons should be stopped. Click events
7845
- // that aren't on the star button or our buttons should be re-emitted from the
7846
- // thread row so it counts as clicking on the thread.
7847
- starGroup.onmouseover = starGroup.onclick = starGroupEventInterceptor;
7849
+ starGroup.onclick = onClickStarGroup;
7848
7850
  }
7849
7851
  }
7850
7852
  });
@@ -10292,7 +10294,7 @@ options.insert = htmlElement => {
10292
10294
  htmlElement.setAttribute('data-inboxsdk-version',
10293
10295
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
10294
10296
  ///@ts-ignore
10295
- "2.2.6-1752599126954-7ed0da58f090270c");
10297
+ "2.2.7-1753737313283-f941d482eba8eb97");
10296
10298
  document.head.append(htmlElement);
10297
10299
  };
10298
10300
  options.domAPI = (styleDomAPI_default());
@@ -15042,7 +15044,7 @@ options.insert = htmlElement => {
15042
15044
  htmlElement.setAttribute('data-inboxsdk-version',
15043
15045
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
15044
15046
  ///@ts-ignore
15045
- "2.2.6-1752599126954-7ed0da58f090270c");
15047
+ "2.2.7-1753737313283-f941d482eba8eb97");
15046
15048
  document.head.append(htmlElement);
15047
15049
  };
15048
15050
  options.domAPI = (styleDomAPI_default());
@@ -19802,7 +19804,7 @@ mole_view_module_options.insert = htmlElement => {
19802
19804
  htmlElement.setAttribute('data-inboxsdk-version',
19803
19805
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
19804
19806
  ///@ts-ignore
19805
- "2.2.6-1752599126954-7ed0da58f090270c");
19807
+ "2.2.7-1753737313283-f941d482eba8eb97");
19806
19808
  document.head.append(htmlElement);
19807
19809
  };
19808
19810
  mole_view_module_options.domAPI = (styleDomAPI_default());