pixelplay 1.0.10 → 1.0.13
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/dist/server.d.mts +29 -1
- package/dist/server.d.ts +29 -1
- package/dist/server.js +66 -0
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +65 -0
- package/dist/server.mjs.map +1 -1
- package/package.json +74 -74
package/dist/server.mjs
CHANGED
|
@@ -1549,9 +1549,74 @@ ${globalsVars}
|
|
|
1549
1549
|
}
|
|
1550
1550
|
return blocks.join("\n\n");
|
|
1551
1551
|
}
|
|
1552
|
+
|
|
1553
|
+
// src/license.ts
|
|
1554
|
+
var POLAR_ORG_ID = "0f5f2ec4-1ce3-4e23-8099-c3d77aadb8cf";
|
|
1555
|
+
var VALIDATE_URL = "https://api.polar.sh/v1/customer-portal/license-keys/validate";
|
|
1556
|
+
var initialised = false;
|
|
1557
|
+
async function initPixelPlay(options) {
|
|
1558
|
+
if (initialised) return;
|
|
1559
|
+
initialised = true;
|
|
1560
|
+
const key = options == null ? void 0 : options.licenseKey;
|
|
1561
|
+
const isProduction = process.env.NODE_ENV === "production";
|
|
1562
|
+
if (!key) {
|
|
1563
|
+
if (isProduction) {
|
|
1564
|
+
throw new Error(
|
|
1565
|
+
"\n\n\u{1F6AB} PixelPlay UI \u2014 Build failed: No license key provided.\n Set PIXELPLAY_LICENSE_KEY in your environment variables.\n Purchase a license at https://dennisisaac.com/ui-kit/pricing\n"
|
|
1566
|
+
);
|
|
1567
|
+
}
|
|
1568
|
+
console.warn(
|
|
1569
|
+
"\n\u26A0\uFE0F PixelPlay UI \u2014 No license key provided.\n Components will work in development, but production builds require a valid key.\n Purchase a license at https://dennisisaac.com/ui-kit/pricing\n"
|
|
1570
|
+
);
|
|
1571
|
+
return;
|
|
1572
|
+
}
|
|
1573
|
+
if (!isProduction) {
|
|
1574
|
+
validateKey(key, false).catch(() => {
|
|
1575
|
+
});
|
|
1576
|
+
return;
|
|
1577
|
+
}
|
|
1578
|
+
await validateKey(key, true);
|
|
1579
|
+
}
|
|
1580
|
+
async function validateKey(key, throwOnError) {
|
|
1581
|
+
try {
|
|
1582
|
+
const res = await fetch(VALIDATE_URL, {
|
|
1583
|
+
method: "POST",
|
|
1584
|
+
headers: { "Content-Type": "application/json" },
|
|
1585
|
+
body: JSON.stringify({
|
|
1586
|
+
key,
|
|
1587
|
+
organization_id: POLAR_ORG_ID
|
|
1588
|
+
})
|
|
1589
|
+
});
|
|
1590
|
+
if (!res.ok) {
|
|
1591
|
+
const status = res.status;
|
|
1592
|
+
if (status === 404 || status === 422) {
|
|
1593
|
+
const msg = "\n\u{1F6AB} PixelPlay UI \u2014 Invalid license key.\n The provided PIXELPLAY_LICENSE_KEY could not be validated.\n Please check your key or purchase a license at\n https://dennisisaac.com/ui-kit/pricing\n";
|
|
1594
|
+
if (throwOnError) throw new Error(msg);
|
|
1595
|
+
console.warn("\u26A0\uFE0F " + msg);
|
|
1596
|
+
return;
|
|
1597
|
+
}
|
|
1598
|
+
return;
|
|
1599
|
+
}
|
|
1600
|
+
const data = await res.json();
|
|
1601
|
+
if (data.status === "revoked" || data.status === "disabled") {
|
|
1602
|
+
const msg = `
|
|
1603
|
+
\u{1F6AB} PixelPlay UI \u2014 License key has been ${data.status}.
|
|
1604
|
+
Please contact support or purchase a new license at
|
|
1605
|
+
https://dennisisaac.com/ui-kit/pricing
|
|
1606
|
+
`;
|
|
1607
|
+
if (throwOnError) throw new Error(msg);
|
|
1608
|
+
console.warn("\u26A0\uFE0F " + msg);
|
|
1609
|
+
}
|
|
1610
|
+
} catch (err) {
|
|
1611
|
+
if (err instanceof Error && err.message.includes("PixelPlay UI")) {
|
|
1612
|
+
throw err;
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1552
1616
|
export {
|
|
1553
1617
|
darkTheme,
|
|
1554
1618
|
generateThemeCSS,
|
|
1619
|
+
initPixelPlay,
|
|
1555
1620
|
lightTheme
|
|
1556
1621
|
};
|
|
1557
1622
|
//# sourceMappingURL=server.mjs.map
|