@inboxsdk/core 2.1.60 → 2.1.62

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/background.js CHANGED
@@ -3,8 +3,18 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
3
3
  if (message.type === 'inboxsdk__injectPageWorld' && sender.tab) {
4
4
  if (chrome.scripting) {
5
5
  // MV3
6
+ let documentIds;
7
+ let frameIds;
8
+ if (sender.documentId) {
9
+ // Protect against https://github.com/w3c/webextensions/issues/8 in
10
+ // browsers (Chrome 106+) that support the documentId property.
11
+ // Protections for other browsers happen inside the injected script.
12
+ documentIds = [sender.documentId];
13
+ } else {
14
+ frameIds = [sender.frameId];
15
+ }
6
16
  chrome.scripting.executeScript({
7
- target: { tabId: sender.tab.id, frameIds: [sender.frameId] },
17
+ target: { tabId: sender.tab.id, documentIds, frameIds },
8
18
  world: 'MAIN',
9
19
  files: ['pageWorld.js'],
10
20
  });
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.1.60-1718718023878-64aa156f6ee5ecb1";
374
+ const BUILD_VERSION = "2.1.62-1721349710708-8510fe512f666f95";
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.1.60-1718718023878-64aa156f6ee5ecb1");
2649
+ "2.1.62-1721349710708-8510fe512f666f95");
2650
2650
  document.head.append(htmlElement);
2651
2651
  };
2652
2652
  options.domAPI = (styleDomAPI_default());
@@ -10197,7 +10197,7 @@ options.insert = htmlElement => {
10197
10197
  htmlElement.setAttribute('data-inboxsdk-version',
10198
10198
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
10199
10199
  ///@ts-ignore
10200
- "2.1.60-1718718023878-64aa156f6ee5ecb1");
10200
+ "2.1.62-1721349710708-8510fe512f666f95");
10201
10201
  document.head.append(htmlElement);
10202
10202
  };
10203
10203
  options.domAPI = (styleDomAPI_default());
@@ -10347,17 +10347,35 @@ var sha256 = __webpack_require__(6049);
10347
10347
  var sha256_default = /*#__PURE__*/__webpack_require__.n(sha256);
10348
10348
  // EXTERNAL MODULE: ./src/common/ajax.ts + 1 modules
10349
10349
  var ajax = __webpack_require__(8587);
10350
+ // EXTERNAL MODULE: ./node_modules/lodash/once.js
10351
+ var once = __webpack_require__(8921);
10352
+ var once_default = /*#__PURE__*/__webpack_require__.n(once);
10350
10353
  ;// CONCATENATED MODULE: ./src/common/get-extension-id.ts
10351
- function getExtensionId() {
10352
- const chrome = __webpack_require__.g.chrome;
10353
- if (chrome?.runtime?.getURL) {
10354
- return chrome.runtime.getURL('');
10355
- }
10356
- if (chrome?.extension?.getURL) {
10357
- return chrome.extension.getURL('');
10354
+
10355
+ const getExtensionId = once_default()(() => {
10356
+ try {
10357
+ const chrome = globalThis.chrome;
10358
+ if (chrome?.runtime?.getURL) {
10359
+ return chrome.runtime.getURL('');
10360
+ }
10361
+ // MV2
10362
+ if (chrome?.extension?.getURL) {
10363
+ return chrome.extension.getURL('');
10364
+ }
10365
+ } catch (e) {
10366
+ // When an extension is reloaded or removed, then Chrome APIs in any of its
10367
+ // pre-existing content scripts start throwing "Extension context
10368
+ // invalidated" errors. We only use extension IDs for logging, so we
10369
+ // shouldn't treat this as fatal.
10370
+ console.error('Failed to read extension ID:', e);
10358
10371
  }
10359
10372
  return null;
10360
- }
10373
+ });
10374
+
10375
+ // pre-cache the extension ID so we still know it inside this content script if
10376
+ // the extension is reloaded or removed later.
10377
+ getExtensionId();
10378
+ /* harmony default export */ const get_extension_id = (getExtensionId);
10361
10379
  ;// CONCATENATED MODULE: ./src/common/get-session-id.ts
10362
10380
  function getSessionId() {
10363
10381
  const attrValue = typeof document !== 'undefined' && document.documentElement.getAttribute('data-inboxsdk-session-id');
@@ -10463,19 +10481,16 @@ function logError(err, details, context) {
10463
10481
  // our own current stack just in case.
10464
10482
  const nowStack = getStackTrace();
10465
10483
  const stuffToLog = ['Error logged:', err];
10466
- if (err && err.stack) {
10467
- stuffToLog.push('\n\nOriginal error stack:\n' + err.stack);
10468
- }
10469
- stuffToLog.push('\n\nError logged from:\n' + nowStack);
10470
10484
  if (details) {
10471
10485
  stuffToLog.push('\n\nError details:', details);
10472
10486
  }
10473
- stuffToLog.push('\n\nExtension App Ids:', JSON.stringify(appIds, null, 2));
10474
- stuffToLog.push('\nSent by App:', sentByApp);
10475
- stuffToLog.push('\nSession Id:', sessionId);
10476
- stuffToLog.push('\nExtension Id:', getExtensionId());
10477
- stuffToLog.push('\nInboxSDK Loader Version:', loaderVersion);
10478
- stuffToLog.push('\nInboxSDK Implementation Version:', implVersion);
10487
+ stuffToLog.push(`\
10488
+ \n\nExtension App Ids: ${JSON.stringify(appIds, null, 2)}
10489
+ Sent by App: ${sentByApp}
10490
+ Session Id: ${sessionId}
10491
+ Extension Id: ${get_extension_id()}
10492
+ InboxSDK Loader Version: ${loaderVersion}
10493
+ InboxSDK Implementation Version: ${implVersion}`);
10479
10494
  console.error(...stuffToLog);
10480
10495
  const report = {
10481
10496
  message: err && err.message || err,
@@ -10486,7 +10501,7 @@ function logError(err, details, context) {
10486
10501
  sentByApp,
10487
10502
  sessionId,
10488
10503
  emailHash: userEmailHash,
10489
- extensionId: getExtensionId(),
10504
+ extensionId: get_extension_id(),
10490
10505
  loaderVersion: loaderVersion,
10491
10506
  implementationVersion: implVersion,
10492
10507
  origin: document.location.origin,
@@ -11053,7 +11068,7 @@ function _trackEvent(appId, type, eventName, properties) {
11053
11068
  };
11054
11069
  if (type != 'gmail') {
11055
11070
  Object.assign(event, {
11056
- extensionId: getExtensionId(),
11071
+ extensionId: get_extension_id(),
11057
11072
  appIds: getAppIdsProperty(appId)
11058
11073
  });
11059
11074
  } else {
@@ -14926,7 +14941,7 @@ options.insert = htmlElement => {
14926
14941
  htmlElement.setAttribute('data-inboxsdk-version',
14927
14942
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
14928
14943
  ///@ts-ignore
14929
- "2.1.60-1718718023878-64aa156f6ee5ecb1");
14944
+ "2.1.62-1721349710708-8510fe512f666f95");
14930
14945
  document.head.append(htmlElement);
14931
14946
  };
14932
14947
  options.domAPI = (styleDomAPI_default());
@@ -19655,7 +19670,7 @@ mole_view_module_options.insert = htmlElement => {
19655
19670
  htmlElement.setAttribute('data-inboxsdk-version',
19656
19671
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
19657
19672
  ///@ts-ignore
19658
- "2.1.60-1718718023878-64aa156f6ee5ecb1");
19673
+ "2.1.62-1721349710708-8510fe512f666f95");
19659
19674
  document.head.append(htmlElement);
19660
19675
  };
19661
19676
  mole_view_module_options.domAPI = (styleDomAPI_default());
@@ -21388,13 +21403,11 @@ class GmailNavItemView {
21388
21403
  };
21389
21404
  const accessoryViewController = new dropdown_button_view_controller/* default */.A(buttonOptions);
21390
21405
  this._accessoryViewController = accessoryViewController;
21391
- const accessoryEl = (0,querySelectorOrFail/* default */.A)(this._element, '.Yh');
21392
- const parentNode = accessoryEl.parentNode;
21393
- if (parentNode) {
21394
- buttonOptions.buttonView.getElement().classList.add(...accessoryEl.classList);
21395
- parentNode.replaceChild(buttonOptions.buttonView.getElement(), accessoryEl);
21396
- this._iconSettings.iconElement = null;
21397
- }
21406
+ const accessoryEl = (0,querySelectorOrFail/* default */.A)(this._element, '.Yh:not(.inboxsdk__navItem_parent_accessory_button)');
21407
+ buttonOptions.buttonView.getElement().classList.add(...accessoryEl.classList);
21408
+ accessoryEl.style.display = 'none';
21409
+ accessoryEl.parentNode.appendChild(buttonOptions.buttonView.getElement());
21410
+ this._iconSettings.iconElement = null;
21398
21411
  return;
21399
21412
  }
21400
21413
 
@@ -21536,13 +21549,11 @@ class GmailNavItemView {
21536
21549
  // };
21537
21550
 
21538
21551
  this._accessoryViewController = new basic_button_view_controller/* default */.A(buttonOptions);
21539
- const accessoryEl = (0,querySelectorOrFail/* default */.A)(this._element, '.Yh');
21540
- const parentNode = accessoryEl.parentNode;
21541
- if (parentNode) {
21542
- buttonOptions.buttonView.getElement().classList.add(...accessoryEl.classList);
21543
- parentNode.replaceChild(buttonOptions.buttonView.getElement(), accessoryEl);
21544
- this._iconSettings.iconElement = null;
21545
- }
21552
+ const accessoryEl = (0,querySelectorOrFail/* default */.A)(this._element, '.Yh:not(.inboxsdk__navItem_parent_accessory_button)');
21553
+ buttonOptions.buttonView.getElement().classList.add(...accessoryEl.classList);
21554
+ accessoryEl.style.display = 'none';
21555
+ accessoryEl.parentNode.appendChild(buttonOptions.buttonView.getElement());
21556
+ this._iconSettings.iconElement = null;
21546
21557
  return;
21547
21558
  }
21548
21559
 
@@ -21819,7 +21830,11 @@ class GmailNavItemView {
21819
21830
  if (this._type === type) {
21820
21831
  return;
21821
21832
  }
21822
- const nameElement = this._element.querySelector('.inboxsdk__navItem_name');
21833
+ let nameElement = this._element.querySelector('.inboxsdk__navItem_name');
21834
+ if (nameElement && nameElement.closest('.inboxsdk__navItem') !== this._element) {
21835
+ // ignore the name element if it belongs to a child nav item
21836
+ nameElement = null;
21837
+ }
21823
21838
  switch (type) {
21824
21839
  case nav_item_types.GROUPER:
21825
21840
  case nav_item_types.NAVIGATION: