@inboxsdk/core 2.2.8 → 2.2.9

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.8-1759253419228-cef53cf0a0bb0936";
374
+ const BUILD_VERSION = "2.2.9-1763675917562-0d06c36062d91c15";
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.8-1759253419228-cef53cf0a0bb0936");
2649
+ "2.2.9-1763675917562-0d06c36062d91c15");
2650
2650
  document.head.append(htmlElement);
2651
2651
  };
2652
2652
  options.domAPI = (styleDomAPI_default());
@@ -10294,7 +10294,7 @@ options.insert = htmlElement => {
10294
10294
  htmlElement.setAttribute('data-inboxsdk-version',
10295
10295
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
10296
10296
  ///@ts-ignore
10297
- "2.2.8-1759253419228-cef53cf0a0bb0936");
10297
+ "2.2.9-1763675917562-0d06c36062d91c15");
10298
10298
  document.head.append(htmlElement);
10299
10299
  };
10300
10300
  options.domAPI = (styleDomAPI_default());
@@ -12851,9 +12851,12 @@ class GmailMessageView {
12851
12851
  const threadID = this.#threadViewDriver.getInternalID();
12852
12852
  recipients = this.#recipientsFull = await this.#driver.getPageCommunicator().getMessageRecipients(threadID, this.#element);
12853
12853
  if (!recipients) {
12854
- this.#driver.getLogger().error(new Error('Failed to find message recipients from response'), {
12855
- threadID
12856
- });
12854
+ // this.#driver
12855
+ // .getLogger()
12856
+ // .error(new Error('Failed to find message recipients from response'), {
12857
+ // threadID,
12858
+ // });
12859
+
12857
12860
  recipients = this.#recipientsFull = this.getRecipients();
12858
12861
  }
12859
12862
  return recipients;
@@ -14390,8 +14393,10 @@ class GmailThreadView {
14390
14393
  let threadID;
14391
14394
  const idElement = this.#element.querySelector('[data-thread-perm-id]');
14392
14395
  if (!idElement) throw new Error('threadID element not found');
14393
- const syncThreadID = this.#syncThreadID = idElement.getAttribute('data-thread-perm-id');
14394
- if (!syncThreadID) throw new Error('syncThreadID attribute with no value');
14396
+
14397
+ // the string value can be 'undefined'
14398
+ const attributeValue = idElement.getAttribute('data-thread-perm-id');
14399
+ this.#syncThreadID = typeof attributeValue === 'string' && attributeValue !== 'undefined' ? attributeValue : null;
14395
14400
  threadID = idElement.getAttribute('data-legacy-thread-id');
14396
14401
  if (!threadID) {
14397
14402
  const err = new Error('Failed to get id for thread: data-legacy-thread-id attribute missing');
@@ -14422,10 +14427,12 @@ class GmailThreadView {
14422
14427
  let threadID;
14423
14428
  const idElement = this.#element.querySelector('[data-thread-perm-id]');
14424
14429
  if (!idElement) throw new Error('threadID element not found');
14425
- const syncThreadID = this.#syncThreadID = idElement.getAttribute('data-thread-perm-id');
14426
- if (!syncThreadID) throw new Error('syncThreadID attribute with no value');
14430
+
14431
+ // the string value can be 'undefined'
14432
+ const attributeValue = idElement.getAttribute('data-thread-perm-id');
14433
+ const syncThreadID = this.#syncThreadID = typeof attributeValue === 'string' && attributeValue !== 'undefined' ? attributeValue : null;
14427
14434
  this.#threadID = threadID = idElement.getAttribute('data-legacy-thread-id');
14428
- if (!threadID) {
14435
+ if (!threadID && syncThreadID) {
14429
14436
  this.#threadID = threadID = await this.#driver.getOldGmailThreadIdFromSyncThreadId(syncThreadID);
14430
14437
  }
14431
14438
  if (this.#threadID) return this.#threadID;else throw new Error('Failed to get id for thread');
@@ -14510,18 +14517,10 @@ class GmailThreadView {
14510
14517
  onClick: button.onClick
14511
14518
  };
14512
14519
  const buttonElement = buttonOptions.buttonView.getElement();
14513
- const spacer = document.createElement('span');
14514
- const spacerID = 'inboxsdk__thread_view_footer_button_spacer';
14515
- spacer.style.width = '8px';
14516
- spacer.id = spacerID;
14517
14520
 
14518
14521
  // Sometimes it is there right away
14519
14522
  const subjectToolbarElement = this.#findBottomReplyToolbarElement();
14520
14523
  if (subjectToolbarElement) {
14521
- const reactionButton = this.#element.querySelector('.amn .wrsVRe');
14522
- if (reactionButton && !this.#element.querySelector(`#${spacerID}`)) {
14523
- subjectToolbarElement.appendChild(spacer);
14524
- }
14525
14524
  subjectToolbarElement.appendChild(buttonElement);
14526
14525
  }
14527
14526
 
@@ -14530,10 +14529,6 @@ class GmailThreadView {
14530
14529
  if (mutationsList.some(mutation => mutation.type === 'childList')) {
14531
14530
  const subjectToolbarElement = this.#findBottomReplyToolbarElement();
14532
14531
  if (subjectToolbarElement && !subjectToolbarElement.contains(buttonElement)) {
14533
- const reactionButton = this.#element.querySelector('.amn .wrsVRe');
14534
- if (reactionButton && !this.#element.querySelector(`#${spacerID}`)) {
14535
- subjectToolbarElement.appendChild(spacer);
14536
- }
14537
14532
  subjectToolbarElement.appendChild(buttonElement);
14538
14533
  }
14539
14534
  }
@@ -14592,8 +14587,20 @@ class GmailThreadView {
14592
14587
  return toolbarContainerElement;
14593
14588
  }
14594
14589
  #findBottomReplyToolbarElement() {
14595
- var toolbarContainerElements = this.#element.querySelectorAll('table .amn');
14596
- return toolbarContainerElements[0];
14590
+ // Get all .amn elements (may exist in multiple locations due to A/B testing)
14591
+ var allAmnElements = this.#element.querySelectorAll('.amn');
14592
+
14593
+ // Find the visible .amn element (handles A/B testing where one might be hidden)
14594
+ for (const element of allAmnElements) {
14595
+ const isInsideTable = element.closest('table') !== null;
14596
+ const isHidden = window.getComputedStyle(element).display === 'none';
14597
+ if (!isInsideTable && !isHidden) {
14598
+ return element;
14599
+ }
14600
+ }
14601
+
14602
+ // Fallback to the first one if no visible element found
14603
+ return allAmnElements[0] || null;
14597
14604
  }
14598
14605
  #isToolbarContainerRelevant(toolbarContainerElement) {
14599
14606
  if (toolbarContainerElement.parentElement.parentElement === this.#element.parentElement.parentElement) {
@@ -15044,7 +15051,7 @@ options.insert = htmlElement => {
15044
15051
  htmlElement.setAttribute('data-inboxsdk-version',
15045
15052
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
15046
15053
  ///@ts-ignore
15047
- "2.2.8-1759253419228-cef53cf0a0bb0936");
15054
+ "2.2.9-1763675917562-0d06c36062d91c15");
15048
15055
  document.head.append(htmlElement);
15049
15056
  };
15050
15057
  options.domAPI = (styleDomAPI_default());
@@ -19804,7 +19811,7 @@ mole_view_module_options.insert = htmlElement => {
19804
19811
  htmlElement.setAttribute('data-inboxsdk-version',
19805
19812
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
19806
19813
  ///@ts-ignore
19807
- "2.2.8-1759253419228-cef53cf0a0bb0936");
19814
+ "2.2.9-1763675917562-0d06c36062d91c15");
19808
19815
  document.head.append(htmlElement);
19809
19816
  };
19810
19817
  mole_view_module_options.domAPI = (styleDomAPI_default());