@hydralms/components 0.3.0 → 0.3.1

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 (47) hide show
  1. package/dist/StudentProfile-BPsZBaJj.cjs +1 -0
  2. package/dist/{StudentProfile-DeMxdrL3.js → StudentProfile-Cw2p-RZn.js} +577 -579
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.js +172 -166
  5. package/dist/license/index.d.ts +2 -2
  6. package/dist/license/tiers.d.ts +3 -0
  7. package/dist/modules.cjs +1 -1
  8. package/dist/modules.js +111 -110
  9. package/dist/sections/AdaptiveLearningPath/AdaptiveLearningPath.d.ts +5 -0
  10. package/dist/sections/AdaptiveLearningPath/path-connector.d.ts +8 -0
  11. package/dist/sections/AdaptiveLearningPath/path-milestone-marker.d.ts +7 -0
  12. package/dist/sections/AdaptiveLearningPath/path-node-card.d.ts +10 -0
  13. package/dist/sections/AdaptiveLearningPath/path-skill-bar.d.ts +8 -0
  14. package/dist/sections/AdaptiveLearningPath/types.d.ts +136 -0
  15. package/dist/sections/ContentAuthoringStudio/ContentAuthoringStudio.d.ts +5 -0
  16. package/dist/sections/ContentAuthoringStudio/block-editor-item.d.ts +14 -0
  17. package/dist/sections/ContentAuthoringStudio/block-type-picker.d.ts +12 -0
  18. package/dist/sections/ContentAuthoringStudio/types.d.ts +67 -0
  19. package/dist/sections/index.d.ts +4 -0
  20. package/dist/sections.cjs +1 -1
  21. package/dist/sections.js +1325 -232
  22. package/dist/withProGate-BJdu1T9Y.cjs +2 -0
  23. package/dist/withProGate-BvFc7Jwy.js +4975 -0
  24. package/package.json +24 -7
  25. package/src/license/index.ts +2 -2
  26. package/src/license/tiers.ts +12 -2
  27. package/src/modules/CoursePlayer/CoursePlayer.tsx +3 -1
  28. package/src/progress/stat-card.tsx +10 -5
  29. package/src/sections/AdaptiveLearningPath/AdaptiveLearningPath.tsx +251 -0
  30. package/src/sections/AdaptiveLearningPath/path-connector.tsx +27 -0
  31. package/src/sections/AdaptiveLearningPath/path-milestone-marker.tsx +50 -0
  32. package/src/sections/AdaptiveLearningPath/path-node-card.tsx +166 -0
  33. package/src/sections/AdaptiveLearningPath/path-skill-bar.tsx +49 -0
  34. package/src/sections/AdaptiveLearningPath/types.ts +159 -0
  35. package/src/sections/ContentAuthoringStudio/ContentAuthoringStudio.tsx +289 -0
  36. package/src/sections/ContentAuthoringStudio/block-editor-item.tsx +487 -0
  37. package/src/sections/ContentAuthoringStudio/block-type-picker.tsx +123 -0
  38. package/src/sections/ContentAuthoringStudio/types.ts +67 -0
  39. package/src/sections/ForumBoard/ForumBoard.tsx +8 -6
  40. package/src/sections/LessonPage/LessonPage.tsx +4 -7
  41. package/src/sections/index.ts +18 -0
  42. package/src/video/video-player.tsx +14 -5
  43. package/dist/StudentProfile-BVfZMbnV.cjs +0 -1
  44. package/dist/tabs-BsfVo2Bl.cjs +0 -173
  45. package/dist/tabs-BuY1iNJE.js +0 -22305
  46. package/dist/withProGate-BWqcKdPM.js +0 -137
  47. package/dist/withProGate-DX6XqKLp.cjs +0 -1
@@ -1,137 +0,0 @@
1
- import { jsx as a, jsxs as c } from "react/jsx-runtime";
2
- import { createContext as f, useState as p, useEffect as h, useContext as y } from "react";
3
- const s = "hydra_key_v", g = 300 * 1e3;
4
- function k(e) {
5
- try {
6
- const t = sessionStorage.getItem(s);
7
- if (t) {
8
- const { result: n, ts: r, key: o } = JSON.parse(t);
9
- if (o === e && Date.now() - r < g) return n;
10
- }
11
- } catch {
12
- }
13
- return null;
14
- }
15
- function m(e, t) {
16
- try {
17
- sessionStorage.setItem(s, JSON.stringify({ result: t, ts: Date.now(), key: e }));
18
- } catch {
19
- }
20
- }
21
- function l(e) {
22
- try {
23
- const t = sessionStorage.getItem(s);
24
- if (t) {
25
- const { result: n, key: r } = JSON.parse(t);
26
- if (r === e && n === "valid-pro") return "valid-pro";
27
- }
28
- } catch {
29
- }
30
- return "invalid";
31
- }
32
- async function v(e, t) {
33
- if (!t) return "skip";
34
- if (!e) return "no-key";
35
- const n = k(e);
36
- if (n) return n;
37
- try {
38
- const r = await fetch(`${t}?key=${encodeURIComponent(e)}`, {
39
- method: "GET",
40
- signal: AbortSignal.timeout(4e3)
41
- });
42
- if (!r.ok) return l(e);
43
- const o = await r.json();
44
- let i;
45
- return o.valid ? o.plan === "pro" || o.plan === "enterprise" ? i = "valid-pro" : i = "valid-free" : i = "invalid", m(e, i), i;
46
- } catch {
47
- return l(e);
48
- }
49
- }
50
- const u = f({
51
- plan: "free",
52
- isPro: !1
53
- });
54
- function x(e) {
55
- switch (e) {
56
- case "valid-pro":
57
- case "skip":
58
- return "pro";
59
- case "valid-free":
60
- case "no-key":
61
- return "free";
62
- case "invalid":
63
- return "invalid";
64
- }
65
- }
66
- function H({ licenseKey: e, validateUrl: t = "", children: n }) {
67
- const [r, o] = p(() => t ? e ? "validating" : "free" : "pro");
68
- return h(() => {
69
- if (!t) {
70
- o("pro");
71
- return;
72
- }
73
- let i = !1;
74
- return v(e ?? null, t).then((d) => {
75
- i || o(x(d));
76
- }), () => {
77
- i = !0;
78
- };
79
- }, [e, t]), /* @__PURE__ */ a(u.Provider, { value: { plan: r, isPro: r === "pro" }, children: n });
80
- }
81
- function P() {
82
- return y(u);
83
- }
84
- function S({ children: e, feature: t }) {
85
- return /* @__PURE__ */ c("div", { style: { position: "relative" }, children: [
86
- e,
87
- /* @__PURE__ */ c(
88
- "a",
89
- {
90
- href: "https://hydralms.com/pro",
91
- target: "_blank",
92
- rel: "noopener noreferrer",
93
- style: {
94
- position: "absolute",
95
- bottom: 14,
96
- right: 16,
97
- zIndex: 9999,
98
- display: "flex",
99
- alignItems: "center",
100
- gap: 5,
101
- padding: "4px 10px 4px 8px",
102
- background: "rgba(0,0,0,0.5)",
103
- backdropFilter: "blur(6px)",
104
- borderRadius: 20,
105
- fontFamily: "system-ui, -apple-system, sans-serif",
106
- fontSize: 11,
107
- fontWeight: 500,
108
- color: "rgba(255,255,255,0.85)",
109
- letterSpacing: "0.01em",
110
- whiteSpace: "nowrap",
111
- lineHeight: 1,
112
- pointerEvents: "auto",
113
- textDecoration: "none"
114
- },
115
- title: t ? `"${t}" is a HydraLMS Pro module` : "Upgrade to HydraLMS Pro",
116
- children: [
117
- /* @__PURE__ */ a("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", style: { opacity: 0.8 }, children: /* @__PURE__ */ a("path", { d: "M12 2.69l5.66 5.66a8 8 0 1 1-11.31 0z" }) }),
118
- "HydraLMS Pro"
119
- ]
120
- }
121
- )
122
- ] });
123
- }
124
- function L(e, t) {
125
- const n = (r) => {
126
- const { isPro: o } = P();
127
- return o ? /* @__PURE__ */ a(e, { ...r }) : /* @__PURE__ */ a(S, { feature: t, children: /* @__PURE__ */ a(e, { ...r }) });
128
- };
129
- return n.displayName = `ProGated(${t})`, n;
130
- }
131
- export {
132
- H,
133
- S as P,
134
- u as a,
135
- P as u,
136
- L as w
137
- };
@@ -1 +0,0 @@
1
- "use strict";const s=require("react/jsx-runtime"),a=require("react"),c="hydra_key_v",h=300*1e3;function y(e){try{const t=sessionStorage.getItem(c);if(t){const{result:n,ts:r,key:i}=JSON.parse(t);if(i===e&&Date.now()-r<h)return n}}catch{}return null}function g(e,t){try{sessionStorage.setItem(c,JSON.stringify({result:t,ts:Date.now(),key:e}))}catch{}}function l(e){try{const t=sessionStorage.getItem(c);if(t){const{result:n,key:r}=JSON.parse(t);if(r===e&&n==="valid-pro")return"valid-pro"}}catch{}return"invalid"}async function x(e,t){if(!t)return"skip";if(!e)return"no-key";const n=y(e);if(n)return n;try{const r=await fetch(`${t}?key=${encodeURIComponent(e)}`,{method:"GET",signal:AbortSignal.timeout(4e3)});if(!r.ok)return l(e);const i=await r.json();let o;return i.valid?i.plan==="pro"||i.plan==="enterprise"?o="valid-pro":o="valid-free":o="invalid",g(e,o),o}catch{return l(e)}}const u=a.createContext({plan:"free",isPro:!1});function k(e){switch(e){case"valid-pro":case"skip":return"pro";case"valid-free":case"no-key":return"free";case"invalid":return"invalid"}}function v({licenseKey:e,validateUrl:t="",children:n}){const[r,i]=a.useState(()=>t?e?"validating":"free":"pro");return a.useEffect(()=>{if(!t){i("pro");return}let o=!1;return x(e??null,t).then(p=>{o||i(k(p))}),()=>{o=!0}},[e,t]),s.jsx(u.Provider,{value:{plan:r,isPro:r==="pro"},children:n})}function d(){return a.useContext(u)}function f({children:e,feature:t}){return s.jsxs("div",{style:{position:"relative"},children:[e,s.jsxs("a",{href:"https://hydralms.com/pro",target:"_blank",rel:"noopener noreferrer",style:{position:"absolute",bottom:14,right:16,zIndex:9999,display:"flex",alignItems:"center",gap:5,padding:"4px 10px 4px 8px",background:"rgba(0,0,0,0.5)",backdropFilter:"blur(6px)",borderRadius:20,fontFamily:"system-ui, -apple-system, sans-serif",fontSize:11,fontWeight:500,color:"rgba(255,255,255,0.85)",letterSpacing:"0.01em",whiteSpace:"nowrap",lineHeight:1,pointerEvents:"auto",textDecoration:"none"},title:t?`"${t}" is a HydraLMS Pro module`:"Upgrade to HydraLMS Pro",children:[s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{opacity:.8},children:s.jsx("path",{d:"M12 2.69l5.66 5.66a8 8 0 1 1-11.31 0z"})}),"HydraLMS Pro"]})]})}function P(e,t){const n=r=>{const{isPro:i}=d();return i?s.jsx(e,{...r}):s.jsx(f,{feature:t,children:s.jsx(e,{...r})})};return n.displayName=`ProGated(${t})`,n}exports.HydraLicenseContext=u;exports.HydraLicenseProvider=v;exports.ProBadge=f;exports.useHydraLicense=d;exports.withProGate=P;