@inboxsdk/core 2.1.10 → 2.1.11

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
@@ -831,7 +831,7 @@ function isElementVisible(el) {
831
831
 
832
832
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- SDK_VERSION is injected by webpack
833
833
  ///@ts-ignore
834
- const BUILD_VERSION = "2.1.10-1698689204956-73cb5711525b05a3";
834
+ const BUILD_VERSION = "2.1.11-1698862155990-e5612abaef09a181";
835
835
  if (false) {}
836
836
 
837
837
  /***/ }),
@@ -1624,9 +1624,6 @@ const GmailElementGetter = {
1624
1624
  getMainContentElementChangedStream: once_default()(function () {
1625
1625
  return getMainContentElementChangedStream(this);
1626
1626
  }),
1627
- getMoleParent() {
1628
- return document.body.querySelector('.dw .nH > .nH > .no');
1629
- },
1630
1627
  /**
1631
1628
  * This method checks whether we should use the old InboxSDK style of adding nav items
1632
1629
  * inline among Gmail's nav items (as opposed to the newer style where we put our nav items
@@ -10842,7 +10839,7 @@ options.insert = htmlElement => {
10842
10839
  htmlElement.setAttribute('data-inboxsdk-version',
10843
10840
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
10844
10841
  ///@ts-ignore
10845
- "2.1.10-1698689204956-73cb5711525b05a3");
10842
+ "2.1.11-1698862155990-e5612abaef09a181");
10846
10843
  document.head.append(htmlElement);
10847
10844
  };
10848
10845
  options.domAPI = (styleDomAPI_default());
@@ -19415,7 +19412,7 @@ options.insert = htmlElement => {
19415
19412
  htmlElement.setAttribute('data-inboxsdk-version',
19416
19413
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
19417
19414
  ///@ts-ignore
19418
- "2.1.10-1698689204956-73cb5711525b05a3");
19415
+ "2.1.11-1698862155990-e5612abaef09a181");
19419
19416
  document.head.append(htmlElement);
19420
19417
  };
19421
19418
  options.domAPI = (styleDomAPI_default());
@@ -19440,10 +19437,11 @@ var update = injectStylesIntoStyleTag_default()(mole_view_module/* default */.ZP
19440
19437
 
19441
19438
 
19442
19439
 
19443
-
19444
19440
  const gmail_mole_view_driver_INBOXSDK_CLASS = 'inboxsdk__mole_view';
19445
19441
  class GmailMoleViewDriver {
19446
19442
  static #page;
19443
+ static #moleParentReadyEvent = kefir_bus_default()();
19444
+ static #moleParent;
19447
19445
  static #_ = (() => {
19448
19446
  this.#page = new (page_parser_tree_js_default())(document, {
19449
19447
  logError(err, el) {
@@ -19475,7 +19473,7 @@ class GmailMoleViewDriver {
19475
19473
  ["moleParent"]: {
19476
19474
  fn: root => [root.querySelector(".dw .nH > .nH > .no")].filter(isNotNil/* default */.Z),
19477
19475
  interval(elementCount, timeRunning) {
19478
- return timeRunning <= 5_000 && elementCount === 0 ? 100 : 5_000;
19476
+ return timeRunning <= 15_000 && elementCount === 0 ? 100 : 5_000;
19479
19477
  }
19480
19478
  },
19481
19479
  ["mole"]: {
@@ -19491,6 +19489,20 @@ class GmailMoleViewDriver {
19491
19489
  }
19492
19490
  }
19493
19491
  });
19492
+ const moleParent = this.#page.tree.getAllByTag("moleParent");
19493
+ const moleParentLiveSet = moleParent.subscribe(changes => {
19494
+ for (const change of changes) {
19495
+ switch (change.type) {
19496
+ case 'add':
19497
+ {
19498
+ const el = change.value.getValue();
19499
+ this.#moleParent = el;
19500
+ this.#moleParentReadyEvent.emit(el);
19501
+ moleParentLiveSet.unsubscribe();
19502
+ }
19503
+ }
19504
+ }
19505
+ });
19494
19506
  const moles = this.#page.tree.getAllByTag("mole");
19495
19507
  moles.subscribe(changes => {
19496
19508
  for (const change of changes) {
@@ -19585,40 +19597,45 @@ class GmailMoleViewDriver {
19585
19597
  }
19586
19598
  (0,querySelectorOrFail/* default */.Z)(this.#element, '.inboxsdk__mole_view_content').appendChild(options.el);
19587
19599
  }
19600
+ #doShow = moleParent => {
19601
+ const insertBefore = moleParent.lastElementChild;
19602
+ if (insertBefore instanceof HTMLElement) {
19603
+ moleParent.insertBefore(this.#element, insertBefore);
19604
+ } else {
19605
+ this.#driver.logger.error(new Error('Mole show invariant violated. `lastMole` is not an HTMLElement'));
19606
+ return;
19607
+ }
19608
+ const dw = moleParent.closest('div.dw');
19609
+ if (dw) {
19610
+ dw.classList.add('inboxsdk__moles_in_use', mole_view_module/* inboxsdkMolesInUse */.Yy);
19611
+ }
19612
+ };
19588
19613
  show() {
19589
- const doShow = moleParent => {
19590
- const insertBefore = moleParent.lastElementChild;
19591
- if (insertBefore instanceof HTMLElement) {
19592
- moleParent.insertBefore(this.#element, insertBefore);
19593
- } else {
19594
- this.#driver.logger.error(new Error('Mole show invariant violated. `lastMole` is not an HTMLElement'));
19595
- return;
19596
- }
19597
- const dw = moleParent.closest('div.dw');
19598
- if (dw) {
19599
- dw.classList.add('inboxsdk__moles_in_use', mole_view_module/* inboxsdkMolesInUse */.Yy);
19600
- }
19601
- };
19602
- const moleParent = gmail_element_getter/* default.getMoleParent */.Z.getMoleParent();
19614
+ const moleParent = GmailMoleViewDriver.#moleParent;
19603
19615
  if (moleParent) {
19604
- doShow(moleParent);
19605
- } else {
19606
- const moleParentReadyEvent = (0,stream_wait_for/* default */.Z)(() => gmail_element_getter/* default.getMoleParent */.Z.getMoleParent()).takeUntilBy(this.#stopper).onValue(doShow);
19607
- // For some users, the mole parent element seems to be lazily loaded by
19608
- // Gmail only once the user has used a compose view or a thread view.
19609
- // If the gmail mode has settled, we've been loaded for 10 seconds, and
19610
- // we don't have the mole parent yet, then force the mole parent to load
19611
- // by opening a compose view and then closing it.
19612
- kefir_esm.fromPromise(gmail_element_getter/* default.waitForGmailModeToSettle */.Z.waitForGmailModeToSettle()).flatMap(() => {
19613
- // delay until we've passed TimestampOnReady + 10 seconds
19614
- return this.#driver.delayToTimeAfterReady(10 * 1000);
19615
- }).takeUntilBy(moleParentReadyEvent).takeUntilBy(this.#stopper).onValue(() => {
19616
- this.#driver.getLogger().eventSdkActive('mole parent force load');
19617
- this.#driver.openNewComposeViewDriver().then(gmailComposeView => {
19618
- gmailComposeView.close();
19619
- });
19620
- });
19616
+ this.#doShow(moleParent);
19617
+ return;
19621
19618
  }
19619
+ const moleParentReadyEvent = GmailMoleViewDriver.#moleParentReadyEvent.takeUntilBy(this.#stopper).onValue(this.#doShow);
19620
+
19621
+ // The mole parent element is lazily loaded by
19622
+ // Gmail only once the user has used a compose view or a thread view.
19623
+ // If the gmail mode has settled, we've been loaded for 10 seconds, and
19624
+ // we don't have the mole parent yet, then force the mole parent to load
19625
+ // by opening a compose view and then closing it.
19626
+ kefir_esm.fromPromise(gmail_element_getter/* default.waitForGmailModeToSettle */.Z.waitForGmailModeToSettle()).flatMap(() => {
19627
+ // delay until we've passed TimestampOnReady + 5 seconds
19628
+ return this.#driver.delayToTimeAfterReady(5_000);
19629
+ }).takeUntilBy(moleParentReadyEvent).takeUntilBy(this.#stopper).onValue(async () => {
19630
+ this.#driver.getLogger().eventSdkActive('mole parent force load');
19631
+ try {
19632
+ document.body.classList.add(mole_view_module/* hideComposes */.Pn);
19633
+ const gmailComposeView = await this.#driver.openNewComposeViewDriver();
19634
+ gmailComposeView.discard();
19635
+ } finally {
19636
+ document.body.classList.remove(mole_view_module/* hideComposes */.Pn);
19637
+ }
19638
+ });
19622
19639
  }
19623
19640
 
19624
19641
  /**
@@ -32854,6 +32871,7 @@ module.exports["default"] = exports.default;
32854
32871
  "use strict";
32855
32872
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32856
32873
  /* harmony export */ "DH": () => (/* binding */ main),
32874
+ /* harmony export */ "Pn": () => (/* binding */ hideComposes),
32857
32875
  /* harmony export */ "Yy": () => (/* binding */ inboxsdkMolesInUse),
32858
32876
  /* harmony export */ "ZP": () => (__WEBPACK_DEFAULT_EXPORT__)
32859
32877
  /* harmony export */ });
@@ -32866,10 +32884,11 @@ module.exports["default"] = exports.default;
32866
32884
 
32867
32885
  var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
32868
32886
  // Module
32869
- ___CSS_LOADER_EXPORT___.push([module.id, ".inboxsdk___CVI_XgzMBSxR6kVfDAg{order:1}.inboxsdk__UJYCuevuXZxfTgEf23lV .aDj.ahe{position:static!important}", ""]);
32887
+ ___CSS_LOADER_EXPORT___.push([module.id, ".inboxsdk___CVI_XgzMBSxR6kVfDAg{order:1}.inboxsdk__UJYCuevuXZxfTgEf23lV .aDj.ahe{position:static!important}.inboxsdk__cZb1_NDJIxsKMlBKVLgD .dw\n .nH\n > .nH\n > .no\n > *:not([style*='order: 0;'], [style*='order: 2147483647;'], .aJl).nn.nH{display:none!important}", ""]);
32870
32888
  // Exports
32871
32889
  var main = "inboxsdk___CVI_XgzMBSxR6kVfDAg";
32872
32890
  var inboxsdkMolesInUse = "inboxsdk__UJYCuevuXZxfTgEf23lV";
32891
+ var hideComposes = "inboxsdk__cZb1_NDJIxsKMlBKVLgD";
32873
32892
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
32874
32893
 
32875
32894
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inboxsdk/core",
3
- "version": "2.1.10",
3
+ "version": "2.1.11",
4
4
  "description": "Library for building browser extensions for Gmail",
5
5
  "main": "inboxsdk.js",
6
6
  "author": "Streak",
@@ -16,7 +16,6 @@ declare const GmailElementGetter: {
16
16
  getMainContentBodyContainerElement(): HTMLElement | null;
17
17
  getMainContentContainer(): HTMLElement | null;
18
18
  getMainContentElementChangedStream: (this: any) => Kefir.Observable<HTMLElement, never>;
19
- getMoleParent(): HTMLElement | null;
20
19
  /**
21
20
  * This method checks whether we should use the old InboxSDK style of adding nav items
22
21
  * inline among Gmail's nav items (as opposed to the newer style where we put our nav items
@@ -1 +1 @@
1
- {"version":3,"file":"gmail-element-getter.d.ts","sourceRoot":"","sources":["../../../../../../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ver.d.ts","sourceRoot":"","sources":["../../../../../../../src/platform-implementation-js/dom-driver/gmail/widgets/gmail-mole-view-driver.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,WAAW,MAAM,iBAAiB,CAAC;AAQ/C,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,gBAAgB,CAAC,EAAE,WAAW,CAAC;IAC/B,YAAY,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AA2BF,cAAM,mBAAmB;;gBAwGX,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW;IA+ErD,IAAI;IAwEJ,YAAY,CAAC,SAAS,EAAE,OAAO;IAkB/B,YAAY,IAAI,OAAO;IAIvB,QAAQ,CAAC,IAAI,EAAE,MAAM;IAkCrB,cAAc;;;IAId,OAAO;CAOR;AAED,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"gmail-mole-view-driver.d.ts","sourceRoot":"","sources":["../../../../../../../src/platform-implementation-js/dom-driver/gmail/widgets/gmail-mole-view-driver.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,WAAW,MAAM,iBAAiB,CAAC;AAQ/C,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,gBAAgB,CAAC,EAAE,WAAW,CAAC;IAC/B,YAAY,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AA2BF,cAAM,mBAAmB;;gBA2HX,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW;IAoGrD,IAAI;IAwDJ,YAAY,CAAC,SAAS,EAAE,OAAO;IAkB/B,YAAY,IAAI,OAAO;IAIvB,QAAQ,CAAC,IAAI,EAAE,MAAM;IAkCrB,cAAc;;;IAId,OAAO;CAOR;AAED,eAAe,mBAAmB,CAAC"}