sfc-utils 1.4.115 → 1.4.117
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/accountswap.js +30 -17
- package/components/heading.mjs +59 -23
- package/package.json +1 -1
- package/personalize.js +1 -0
package/accountswap.js
CHANGED
|
@@ -1,30 +1,43 @@
|
|
|
1
|
-
|
|
2
1
|
// Detect if there's a valid signin -- if so, swap Subscribe button to Account button
|
|
3
2
|
// Any domain + /realm/ should work for an account link
|
|
4
|
-
const accountURL = "/realm/"
|
|
3
|
+
const accountURL = "/realm/";
|
|
5
4
|
|
|
6
|
-
const pollForAccount = function(i){
|
|
5
|
+
const pollForAccount = async function (i, isNav) {
|
|
6
|
+
// Assume it's nav
|
|
7
|
+
if (isNav === undefined) {
|
|
8
|
+
isNav = true;
|
|
9
|
+
}
|
|
7
10
|
// Start the iterator
|
|
8
|
-
if (!i){
|
|
9
|
-
i = 0
|
|
11
|
+
if (!i) {
|
|
12
|
+
i = 0;
|
|
10
13
|
}
|
|
11
14
|
// Safecheck for treg since it might not be global yet
|
|
12
|
-
if (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
if (
|
|
16
|
+
window &&
|
|
17
|
+
window.treg &&
|
|
18
|
+
window.treg.identity &&
|
|
19
|
+
window.treg.identity.id
|
|
20
|
+
) {
|
|
21
|
+
if (isNav) {
|
|
22
|
+
// We got a valid entitlement! Let's see if the button exists and swap our new one in
|
|
23
|
+
const subButton = document.querySelector("#nav2-sub-box");
|
|
24
|
+
const subButtonText = document.querySelector("#nav2-sub-box div");
|
|
25
|
+
if (subButton && subButtonText) {
|
|
26
|
+
subButton.setAttribute("href", accountURL);
|
|
27
|
+
subButtonText.innerText = "Account";
|
|
28
|
+
}
|
|
19
29
|
}
|
|
30
|
+
return true;
|
|
20
31
|
} else {
|
|
21
|
-
if (i > 10){
|
|
32
|
+
if (i > 10) {
|
|
22
33
|
// If we've waited 10 seconds and there's still no entitlement, assume we aren't getting one
|
|
23
|
-
return false
|
|
34
|
+
return false;
|
|
24
35
|
}
|
|
25
36
|
// Check again after 1 sec
|
|
26
|
-
setTimeout(() => {
|
|
37
|
+
return await setTimeout(async () => {
|
|
38
|
+
return pollForAccount(i + 1);
|
|
39
|
+
}, 1000);
|
|
27
40
|
}
|
|
28
|
-
}
|
|
41
|
+
};
|
|
29
42
|
|
|
30
|
-
module.exports = { pollForAccount }
|
|
43
|
+
module.exports = { pollForAccount };
|
package/components/heading.mjs
CHANGED
|
@@ -1,33 +1,69 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from "react";
|
|
2
2
|
|
|
3
|
-
const Heading =(props) => {
|
|
4
|
-
let {level, className, text} = props
|
|
3
|
+
const Heading = (props) => {
|
|
4
|
+
let { level, className, text } = props;
|
|
5
5
|
if (!level) {
|
|
6
|
-
level = 3
|
|
6
|
+
level = 3;
|
|
7
7
|
}
|
|
8
8
|
if (!className) {
|
|
9
|
-
className = ""
|
|
9
|
+
className = "";
|
|
10
10
|
}
|
|
11
|
-
const object = {...props}
|
|
12
|
-
delete object["text"]
|
|
13
|
-
delete object["level"]
|
|
11
|
+
const object = { ...props };
|
|
12
|
+
delete object["text"];
|
|
13
|
+
delete object["level"];
|
|
14
14
|
|
|
15
|
-
level = level.toString()
|
|
15
|
+
level = level.toString();
|
|
16
16
|
|
|
17
17
|
switch (level) {
|
|
18
|
-
case
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
case
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
case "1":
|
|
19
|
+
return (
|
|
20
|
+
<h1
|
|
21
|
+
{...object}
|
|
22
|
+
className={`hed ${className}`}
|
|
23
|
+
dangerouslySetInnerHTML={{ __html: text }}
|
|
24
|
+
></h1>
|
|
25
|
+
);
|
|
26
|
+
case "2":
|
|
27
|
+
return (
|
|
28
|
+
<h2
|
|
29
|
+
{...object}
|
|
30
|
+
className={`${className}`}
|
|
31
|
+
dangerouslySetInnerHTML={{ __html: text }}
|
|
32
|
+
></h2>
|
|
33
|
+
);
|
|
34
|
+
case "3":
|
|
35
|
+
return (
|
|
36
|
+
<h3
|
|
37
|
+
{...object}
|
|
38
|
+
className={`subhead ${className}`}
|
|
39
|
+
dangerouslySetInnerHTML={{ __html: text }}
|
|
40
|
+
></h3>
|
|
41
|
+
);
|
|
42
|
+
case "4":
|
|
43
|
+
return (
|
|
44
|
+
<h4
|
|
45
|
+
{...object}
|
|
46
|
+
className={`subhead-xs ${className}`}
|
|
47
|
+
dangerouslySetInnerHTML={{ __html: text }}
|
|
48
|
+
></h4>
|
|
49
|
+
);
|
|
50
|
+
case "5":
|
|
51
|
+
return (
|
|
52
|
+
<h5
|
|
53
|
+
{...object}
|
|
54
|
+
className={`lead-in ${className}`}
|
|
55
|
+
dangerouslySetInnerHTML={{ __html: text }}
|
|
56
|
+
></h5>
|
|
57
|
+
);
|
|
58
|
+
case "6":
|
|
59
|
+
return (
|
|
60
|
+
<h6
|
|
61
|
+
{...object}
|
|
62
|
+
className={`label ${className}`}
|
|
63
|
+
dangerouslySetInnerHTML={{ __html: text }}
|
|
64
|
+
></h6>
|
|
65
|
+
);
|
|
30
66
|
}
|
|
31
|
-
}
|
|
67
|
+
};
|
|
32
68
|
|
|
33
|
-
export default Heading
|
|
69
|
+
export default Heading;
|
package/package.json
CHANGED