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