sfc-utils 1.4.169 → 1.4.171

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 +13 -4
  2. package/package.json +1 -1
package/accountswap.js CHANGED
@@ -2,25 +2,34 @@
2
2
  // Any domain + /realm/ should work for an account link
3
3
  const accountURL = "/realm/";
4
4
 
5
- const pollForAccount = async function (i, isNav) {
5
+ const pollForAccount = async function (i, isNav, attachedRealm) {
6
6
  // Assume it's nav
7
7
  if (isNav === undefined) {
8
8
  isNav = true;
9
9
  }
10
+ if (attachedRealm === undefined) {
11
+ attachedRealm = false;
12
+ }
10
13
  // Start the iterator
11
14
  if (!i) {
12
15
  i = 0;
13
16
  }
14
17
  // Add a click event to signin
15
- if (isNav) {
18
+ if (isNav && !attachedRealm) {
16
19
  const signinButton = document.querySelector(".hnp-signin");
20
+ console.log("Signin button, looking for .hnp-signin");
17
21
  if (signinButton) {
22
+ console.log("Found signin button");
18
23
  // Add event listener to signin button
24
+ attachedRealm = true;
19
25
  signinButton.onclick = function (e) {
20
- treg.realm.core.login();
26
+ console.log("Clicked signin button");
27
+ window.treg.realm.core.login();
21
28
  e.preventDefault();
22
29
  e.stopPropagation();
23
30
  };
31
+ } else {
32
+ console.log("Didn't find signin button this time");
24
33
  }
25
34
  }
26
35
  // Safecheck for treg since it might not be global yet
@@ -61,7 +70,7 @@ const pollForAccount = async function (i, isNav) {
61
70
  }
62
71
  // Check again after 0.5 sec using a Promise with async/await
63
72
  await new Promise((resolve) => setTimeout(resolve, 500));
64
- return await pollForAccount(i + 1, isNav);
73
+ return await pollForAccount(i + 1, isNav, attachedRealm);
65
74
  }
66
75
  };
67
76
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sfc-utils",
3
- "version": "1.4.169",
3
+ "version": "1.4.171",
4
4
  "author": "ewagstaff <evanjwagstaff@gmail.com>",
5
5
  "dependencies": {
6
6
  "archieml": "^0.4.2",