@profullstack/waitlist 0.11.0 → 0.12.0
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/package.json +1 -1
- package/src/build.js +4 -1
- package/src/community.js +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@profullstack/waitlist",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Email waitlist for any launch page: a <waitlist-form> web component, a live signup chart, and a static-site builder on @profullstack/css + @profullstack/charts.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/src/build.js
CHANGED
|
@@ -40,7 +40,10 @@ export const DEFAULT_AB = { experiment: 'waitlist-look-v1', arms: ['themed', 'cl
|
|
|
40
40
|
*/
|
|
41
41
|
export function abHeadScript(ab, themed) {
|
|
42
42
|
const cfg = JSON.stringify({ e: ab.experiment, a: ab.arms, t: themed }).replace(/</g, '\\u003c');
|
|
43
|
-
|
|
43
|
+
// The unit lives in localStorage and in a wl-unit cookie on this host, which bbs.<host> and
|
|
44
|
+
// social.<host> read too (tsbb 0.18+ board.lookAb): one visitor, one arm, across all three.
|
|
45
|
+
return `<script>(function(c){try{var L=localStorage,m=document.cookie.match(/(?:^|; )wl-unit=([a-z0-9]{6,32})/),u=(m&&m[1])||L.getItem("wl-unit");if(!u){u=Array.from(crypto.getRandomValues(new Uint8Array(12)),function(b){return(b%36).toString(36)}).join("")}L.setItem("wl-unit",u);
|
|
46
|
+
document.cookie="wl-unit="+u+"; Domain="+location.hostname.replace(/^www\\./,"")+"; Path=/; Max-Age=31536000; SameSite=Lax"+(location.protocol==="https:"?"; Secure":"");
|
|
44
47
|
function h(s){var a=3735928559,b=1103547991;for(var i=0;i<s.length;i++){var k=s.charCodeAt(i);a=Math.imul(a^k,2654435761);b=Math.imul(b^k,1597334677)}a=Math.imul(a^a>>>16,2246822507);a^=Math.imul(b^b>>>13,3266489909);b=Math.imul(b^b>>>16,2246822507);b^=Math.imul(a^a>>>13,3266489909);return 4294967296*(2097151&b)+(a>>>0)}
|
|
45
48
|
var w=L.getItem("wl-winner:"+c.e),arm=w&&c.a.indexOf(w)>=0?w:c.a[Math.floor(h(c.e+"\\0"+u)/Math.pow(2,53)*c.a.length)],d=document.documentElement;
|
|
46
49
|
d.dataset.look=arm==="themed"?c.t:arm;d.dataset.abArm=arm;window.__wlab={experiment:c.e,unit:u,arm:arm,themed:c.t,winner:!!w}}catch(x){}})(${cfg});</script>`;
|
package/src/community.js
CHANGED
|
@@ -58,6 +58,8 @@ export async function brandJson(s) {
|
|
|
58
58
|
skin: SKIN[s.look] ?? 'modern',
|
|
59
59
|
icon: `${s.url}assets/icon-192.png`,
|
|
60
60
|
community: boardUrl(s),
|
|
61
|
+
// The look A/B test the site runs, for the board and social feed to share (same wl-unit cookie).
|
|
62
|
+
ab: s.ab ? { experiment: s.ab.experiment, arms: s.ab.arms } : null,
|
|
61
63
|
};
|
|
62
64
|
}
|
|
63
65
|
|