sfc-utils 1.4.133 → 1.4.134

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.
Files changed (2) hide show
  1. package/accountswap.js +9 -16
  2. package/package.json +1 -1
package/accountswap.js CHANGED
@@ -12,18 +12,12 @@ const pollForAccount = async function (i, isNav) {
12
12
  i = 0;
13
13
  }
14
14
  // Safecheck for treg since it might not be global yet
15
- console.log(
16
- "treg",
17
- window.treg,
18
- window.treg.identity,
19
- window.treg.identity.id
20
- );
21
- if (
22
- window &&
23
- window.treg &&
24
- window.treg.identity &&
25
- window.treg.identity.id
26
- ) {
15
+ if (window && window.treg && window.treg.identity) {
16
+ // Now we have all the vars to know if we're logged in
17
+ if (!window.treg.identity.id) {
18
+ // If we don't have an identity, we're not logged in
19
+ return false;
20
+ }
27
21
  if (isNav) {
28
22
  // We got a valid entitlement! Let's see if the button exists and swap our new one in
29
23
  const subButton = document.querySelector("#nav2-sub-box");
@@ -49,12 +43,11 @@ const pollForAccount = async function (i, isNav) {
49
43
  return true;
50
44
  } else {
51
45
  if (i > 10) {
52
- // If we've waited 10 seconds and there's still no entitlement, assume we aren't getting one
46
+ // If we've waited 5 seconds and there's still no entitlement, assume we aren't getting one
53
47
  return false;
54
48
  }
55
- // Check again after 1 sec
56
- // Check again after 1 sec using a Promise with async/await
57
- await new Promise((resolve) => setTimeout(resolve, 1000));
49
+ // Check again after 0.5 sec using a Promise with async/await
50
+ await new Promise((resolve) => setTimeout(resolve, 500));
58
51
  return await pollForAccount(i + 1, isNav);
59
52
  }
60
53
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sfc-utils",
3
- "version": "1.4.133",
3
+ "version": "1.4.134",
4
4
  "author": "ewagstaff <evanjwagstaff@gmail.com>",
5
5
  "dependencies": {
6
6
  "archieml": "^0.4.2",