@academy-sdk/sdk 0.1.1 → 0.2.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 (239) hide show
  1. package/dist/academy-sdk-sdk-v1.0.0.zip +0 -0
  2. package/dist/bundle.js +70 -0
  3. package/dist/manifest.json +5 -0
  4. package/dist/styles.css +3307 -0
  5. package/package.json +41 -46
  6. package/src/components/atoms/Avatar.tsx +38 -0
  7. package/src/components/atoms/Badge.tsx +32 -0
  8. package/src/components/atoms/Button.tsx +48 -0
  9. package/src/components/atoms/Card.tsx +33 -0
  10. package/src/components/atoms/Input.tsx +39 -0
  11. package/src/components/atoms/ProgressBar.tsx +52 -0
  12. package/src/components/atoms/Tabs.tsx +47 -0
  13. package/{dist/components/atoms/index.d.ts → src/components/atoms/index.ts} +0 -1
  14. package/{dist/components/index.d.ts → src/components/index.ts} +7 -1
  15. package/src/components/molecules/CourseCard.tsx +215 -0
  16. package/src/components/molecules/EmptyState.tsx +23 -0
  17. package/src/components/molecules/LoadingSpinner.tsx +27 -0
  18. package/src/components/molecules/PageHeader.tsx +22 -0
  19. package/src/components/molecules/Pagination.tsx +82 -0
  20. package/src/components/molecules/SearchInput.tsx +35 -0
  21. package/{dist/components/molecules/index.d.ts → src/components/molecules/index.ts} +0 -1
  22. package/src/components/organisms/CourseSidebar.tsx +276 -0
  23. package/src/components/organisms/LearnerNavbar.tsx +129 -0
  24. package/src/components/organisms/LearnerSidebar.tsx +148 -0
  25. package/src/components/organisms/LessonBookmarks.tsx +128 -0
  26. package/src/components/organisms/LessonNotes.tsx +153 -0
  27. package/{dist/components/organisms/index.d.ts → src/components/organisms/index.ts} +0 -1
  28. package/src/components/pages/BundleDetailPage.tsx +388 -0
  29. package/src/components/pages/CatalogBundlesPage.tsx +96 -0
  30. package/src/components/pages/CatalogCoursesPage.tsx +299 -0
  31. package/src/components/pages/CourseDetailPage.tsx +582 -0
  32. package/src/components/pages/CoursePlayerPage.tsx +481 -0
  33. package/src/components/pages/CreatorProfilePage.tsx +161 -0
  34. package/src/components/pages/LearnerSettingsPage.tsx +58 -0
  35. package/src/components/pages/ManualReviewDetailPage.tsx +254 -0
  36. package/src/components/pages/ManualReviewPage.tsx +228 -0
  37. package/src/components/pages/MessagesPage.tsx +285 -0
  38. package/src/components/pages/MyLearningPage.tsx +239 -0
  39. package/src/components/pages/PaymentCancelPage.tsx +74 -0
  40. package/src/components/pages/PaymentSuccessPage.tsx +73 -0
  41. package/{dist/components/pages/index.d.ts → src/components/pages/index.ts} +0 -1
  42. package/src/components/utils.ts +6 -0
  43. package/src/contracts/components.contract.ts +89 -0
  44. package/{dist/contracts/index.d.ts → src/contracts/index.ts} +0 -1
  45. package/src/contracts/layout.contract.ts +36 -0
  46. package/src/contracts/pages.contract.ts +275 -0
  47. package/src/contracts/template.contract.ts +100 -0
  48. package/src/default-template.tsx +52 -0
  49. package/{dist/hooks/index.d.ts → src/hooks/index.ts} +15 -1
  50. package/src/hooks/sdk-context.tsx +152 -0
  51. package/src/hooks/useAiCoach.ts +27 -0
  52. package/src/hooks/useBookmarks.ts +35 -0
  53. package/{dist/hooks/useCourseSearch.d.ts → src/hooks/useCourseSearch.ts} +8 -5
  54. package/{dist/hooks/useDebounce.d.ts → src/hooks/useDebounce.ts} +8 -2
  55. package/{dist/hooks/useMyBundles.d.ts → src/hooks/useMyBundles.ts} +8 -6
  56. package/{dist/hooks/useMyCourses.d.ts → src/hooks/useMyCourses.ts} +8 -6
  57. package/src/hooks/useNotes.ts +35 -0
  58. package/src/hooks/useNotifications.ts +16 -0
  59. package/{dist/hooks/useTheme.d.ts → src/hooks/useTheme.ts} +8 -5
  60. package/src/hooks/useToast.ts +17 -0
  61. package/{dist/hooks/useUser.d.ts → src/hooks/useUser.ts} +13 -9
  62. package/src/index.ts +33 -0
  63. package/src/layouts/DefaultLayout.tsx +58 -0
  64. package/src/manifest.json +5 -0
  65. package/src/styles.css +43 -0
  66. package/src/types/ai-coach.ts +25 -0
  67. package/src/types/bookmarks.ts +20 -0
  68. package/src/types/bundle.ts +119 -0
  69. package/src/types/common.ts +24 -0
  70. package/src/types/course.ts +135 -0
  71. package/src/types/enrollment.ts +35 -0
  72. package/{dist/types/index.d.ts → src/types/index.ts} +0 -1
  73. package/src/types/lesson.ts +106 -0
  74. package/src/types/manual-review.ts +116 -0
  75. package/src/types/messaging.ts +109 -0
  76. package/src/types/notification.ts +30 -0
  77. package/src/types/payment.ts +40 -0
  78. package/src/types/progress.ts +19 -0
  79. package/src/types/rating.ts +20 -0
  80. package/src/types/search.ts +31 -0
  81. package/src/types/user.ts +16 -0
  82. package/src/utils/formatters.ts +74 -0
  83. package/src/utils/index.ts +8 -0
  84. package/dist/components/atoms/Avatar.d.ts +0 -9
  85. package/dist/components/atoms/Avatar.d.ts.map +0 -1
  86. package/dist/components/atoms/Badge.d.ts +0 -10
  87. package/dist/components/atoms/Badge.d.ts.map +0 -1
  88. package/dist/components/atoms/Button.d.ts +0 -11
  89. package/dist/components/atoms/Button.d.ts.map +0 -1
  90. package/dist/components/atoms/Card.d.ts +0 -11
  91. package/dist/components/atoms/Card.d.ts.map +0 -1
  92. package/dist/components/atoms/Input.d.ts +0 -7
  93. package/dist/components/atoms/Input.d.ts.map +0 -1
  94. package/dist/components/atoms/ProgressBar.d.ts +0 -11
  95. package/dist/components/atoms/ProgressBar.d.ts.map +0 -1
  96. package/dist/components/atoms/Tabs.d.ts +0 -16
  97. package/dist/components/atoms/Tabs.d.ts.map +0 -1
  98. package/dist/components/atoms/index.cjs +0 -318
  99. package/dist/components/atoms/index.d.ts.map +0 -1
  100. package/dist/components/atoms/index.js +0 -288
  101. package/dist/components/index.cjs +0 -1275
  102. package/dist/components/index.d.ts.map +0 -1
  103. package/dist/components/index.js +0 -1245
  104. package/dist/components/molecules/CourseCard.d.ts +0 -25
  105. package/dist/components/molecules/CourseCard.d.ts.map +0 -1
  106. package/dist/components/molecules/EmptyState.d.ts +0 -10
  107. package/dist/components/molecules/EmptyState.d.ts.map +0 -1
  108. package/dist/components/molecules/LoadingSpinner.d.ts +0 -7
  109. package/dist/components/molecules/LoadingSpinner.d.ts.map +0 -1
  110. package/dist/components/molecules/PageHeader.d.ts +0 -8
  111. package/dist/components/molecules/PageHeader.d.ts.map +0 -1
  112. package/dist/components/molecules/Pagination.d.ts +0 -13
  113. package/dist/components/molecules/Pagination.d.ts.map +0 -1
  114. package/dist/components/molecules/SearchInput.d.ts +0 -8
  115. package/dist/components/molecules/SearchInput.d.ts.map +0 -1
  116. package/dist/components/molecules/index.cjs +0 -334
  117. package/dist/components/molecules/index.d.ts.map +0 -1
  118. package/dist/components/molecules/index.js +0 -311
  119. package/dist/components/organisms/CourseSidebar.d.ts +0 -37
  120. package/dist/components/organisms/CourseSidebar.d.ts.map +0 -1
  121. package/dist/components/organisms/LearnerNavbar.d.ts +0 -8
  122. package/dist/components/organisms/LearnerNavbar.d.ts.map +0 -1
  123. package/dist/components/organisms/LearnerSidebar.d.ts +0 -16
  124. package/dist/components/organisms/LearnerSidebar.d.ts.map +0 -1
  125. package/dist/components/organisms/LessonBookmarks.d.ts +0 -8
  126. package/dist/components/organisms/LessonBookmarks.d.ts.map +0 -1
  127. package/dist/components/organisms/LessonNotes.d.ts +0 -8
  128. package/dist/components/organisms/LessonNotes.d.ts.map +0 -1
  129. package/dist/components/organisms/index.cjs +0 -855
  130. package/dist/components/organisms/index.d.ts.map +0 -1
  131. package/dist/components/organisms/index.js +0 -825
  132. package/dist/components/pages/BundleDetailPage.d.ts +0 -3
  133. package/dist/components/pages/BundleDetailPage.d.ts.map +0 -1
  134. package/dist/components/pages/CatalogBundlesPage.d.ts +0 -3
  135. package/dist/components/pages/CatalogBundlesPage.d.ts.map +0 -1
  136. package/dist/components/pages/CatalogCoursesPage.d.ts +0 -3
  137. package/dist/components/pages/CatalogCoursesPage.d.ts.map +0 -1
  138. package/dist/components/pages/CourseDetailPage.d.ts +0 -3
  139. package/dist/components/pages/CourseDetailPage.d.ts.map +0 -1
  140. package/dist/components/pages/CoursePlayerPage.d.ts +0 -8
  141. package/dist/components/pages/CoursePlayerPage.d.ts.map +0 -1
  142. package/dist/components/pages/CreatorProfilePage.d.ts +0 -3
  143. package/dist/components/pages/CreatorProfilePage.d.ts.map +0 -1
  144. package/dist/components/pages/LearnerSettingsPage.d.ts +0 -3
  145. package/dist/components/pages/LearnerSettingsPage.d.ts.map +0 -1
  146. package/dist/components/pages/ManualReviewDetailPage.d.ts +0 -3
  147. package/dist/components/pages/ManualReviewDetailPage.d.ts.map +0 -1
  148. package/dist/components/pages/ManualReviewPage.d.ts +0 -3
  149. package/dist/components/pages/ManualReviewPage.d.ts.map +0 -1
  150. package/dist/components/pages/MessagesPage.d.ts +0 -3
  151. package/dist/components/pages/MessagesPage.d.ts.map +0 -1
  152. package/dist/components/pages/MyLearningPage.d.ts +0 -3
  153. package/dist/components/pages/MyLearningPage.d.ts.map +0 -1
  154. package/dist/components/pages/PaymentCancelPage.d.ts +0 -3
  155. package/dist/components/pages/PaymentCancelPage.d.ts.map +0 -1
  156. package/dist/components/pages/PaymentSuccessPage.d.ts +0 -3
  157. package/dist/components/pages/PaymentSuccessPage.d.ts.map +0 -1
  158. package/dist/components/pages/index.cjs +0 -3306
  159. package/dist/components/pages/index.d.ts.map +0 -1
  160. package/dist/components/pages/index.js +0 -3315
  161. package/dist/components/utils.d.ts +0 -3
  162. package/dist/components/utils.d.ts.map +0 -1
  163. package/dist/contracts/components.contract.d.ts +0 -87
  164. package/dist/contracts/components.contract.d.ts.map +0 -1
  165. package/dist/contracts/index.cjs +0 -52
  166. package/dist/contracts/index.d.ts.map +0 -1
  167. package/dist/contracts/index.js +0 -29
  168. package/dist/contracts/layout.contract.d.ts +0 -35
  169. package/dist/contracts/layout.contract.d.ts.map +0 -1
  170. package/dist/contracts/pages.contract.d.ts +0 -192
  171. package/dist/contracts/pages.contract.d.ts.map +0 -1
  172. package/dist/contracts/template.contract.d.ts +0 -49
  173. package/dist/contracts/template.contract.d.ts.map +0 -1
  174. package/dist/hooks/index.cjs +0 -165
  175. package/dist/hooks/index.d.ts.map +0 -1
  176. package/dist/hooks/index.js +0 -142
  177. package/dist/hooks/sdk-context.d.ts +0 -125
  178. package/dist/hooks/sdk-context.d.ts.map +0 -1
  179. package/dist/hooks/useAiCoach.d.ts +0 -32
  180. package/dist/hooks/useAiCoach.d.ts.map +0 -1
  181. package/dist/hooks/useBookmarks.d.ts +0 -31
  182. package/dist/hooks/useBookmarks.d.ts.map +0 -1
  183. package/dist/hooks/useCourseSearch.d.ts.map +0 -1
  184. package/dist/hooks/useDebounce.d.ts.map +0 -1
  185. package/dist/hooks/useMyBundles.d.ts.map +0 -1
  186. package/dist/hooks/useMyCourses.d.ts.map +0 -1
  187. package/dist/hooks/useNotes.d.ts +0 -31
  188. package/dist/hooks/useNotes.d.ts.map +0 -1
  189. package/dist/hooks/useNotifications.d.ts +0 -19
  190. package/dist/hooks/useNotifications.d.ts.map +0 -1
  191. package/dist/hooks/useTheme.d.ts.map +0 -1
  192. package/dist/hooks/useToast.d.ts +0 -17
  193. package/dist/hooks/useToast.d.ts.map +0 -1
  194. package/dist/hooks/useUser.d.ts.map +0 -1
  195. package/dist/index.cjs +0 -630
  196. package/dist/index.d.ts +0 -17
  197. package/dist/index.d.ts.map +0 -1
  198. package/dist/index.js +0 -600
  199. package/dist/layouts/DefaultLayout.d.ts +0 -9
  200. package/dist/layouts/DefaultLayout.d.ts.map +0 -1
  201. package/dist/types/ai-coach.d.ts +0 -22
  202. package/dist/types/ai-coach.d.ts.map +0 -1
  203. package/dist/types/bookmarks.d.ts +0 -19
  204. package/dist/types/bookmarks.d.ts.map +0 -1
  205. package/dist/types/bundle.d.ts +0 -114
  206. package/dist/types/bundle.d.ts.map +0 -1
  207. package/dist/types/common.d.ts +0 -23
  208. package/dist/types/common.d.ts.map +0 -1
  209. package/dist/types/course.d.ts +0 -127
  210. package/dist/types/course.d.ts.map +0 -1
  211. package/dist/types/enrollment.d.ts +0 -34
  212. package/dist/types/enrollment.d.ts.map +0 -1
  213. package/dist/types/index.cjs +0 -18
  214. package/dist/types/index.d.ts.map +0 -1
  215. package/dist/types/index.js +0 -0
  216. package/dist/types/lesson.d.ts +0 -105
  217. package/dist/types/lesson.d.ts.map +0 -1
  218. package/dist/types/manual-review.d.ts +0 -123
  219. package/dist/types/manual-review.d.ts.map +0 -1
  220. package/dist/types/messaging.d.ts +0 -101
  221. package/dist/types/messaging.d.ts.map +0 -1
  222. package/dist/types/notification.d.ts +0 -28
  223. package/dist/types/notification.d.ts.map +0 -1
  224. package/dist/types/payment.d.ts +0 -38
  225. package/dist/types/payment.d.ts.map +0 -1
  226. package/dist/types/progress.d.ts +0 -18
  227. package/dist/types/progress.d.ts.map +0 -1
  228. package/dist/types/rating.d.ts +0 -20
  229. package/dist/types/rating.d.ts.map +0 -1
  230. package/dist/types/search.d.ts +0 -28
  231. package/dist/types/search.d.ts.map +0 -1
  232. package/dist/types/user.d.ts +0 -15
  233. package/dist/types/user.d.ts.map +0 -1
  234. package/dist/utils/formatters.d.ts +0 -25
  235. package/dist/utils/formatters.d.ts.map +0 -1
  236. package/dist/utils/index.cjs +0 -80
  237. package/dist/utils/index.d.ts +0 -2
  238. package/dist/utils/index.d.ts.map +0 -1
  239. package/dist/utils/index.js +0 -57
package/dist/index.js DELETED
@@ -1,600 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
- var __hasOwnProp = Object.prototype.hasOwnProperty;
4
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __spreadValues = (a, b) => {
7
- for (var prop in b || (b = {}))
8
- if (__hasOwnProp.call(b, prop))
9
- __defNormalProp(a, prop, b[prop]);
10
- if (__getOwnPropSymbols)
11
- for (var prop of __getOwnPropSymbols(b)) {
12
- if (__propIsEnum.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- }
15
- return a;
16
- };
17
- var __objRest = (source, exclude) => {
18
- var target = {};
19
- for (var prop in source)
20
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
21
- target[prop] = source[prop];
22
- if (source != null && __getOwnPropSymbols)
23
- for (var prop of __getOwnPropSymbols(source)) {
24
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
25
- target[prop] = source[prop];
26
- }
27
- return target;
28
- };
29
-
30
- // src/hooks/sdk-context.tsx
31
- import { createContext, useContext } from "react";
32
- import { jsx } from "react/jsx-runtime";
33
- var SDKContext = createContext(null);
34
- function SDKProvider({ implementations, children }) {
35
- return /* @__PURE__ */ jsx(SDKContext.Provider, { value: implementations, children });
36
- }
37
- function useSDK() {
38
- const ctx = useContext(SDKContext);
39
- if (!ctx) {
40
- throw new Error(
41
- "useSDK must be used within an SDKProvider. Make sure your learner routes are wrapped with <SDKProvider>."
42
- );
43
- }
44
- return ctx;
45
- }
46
-
47
- // src/hooks/useUser.ts
48
- function useUser() {
49
- const sdk = useSDK();
50
- return sdk.useUser();
51
- }
52
- function useLogout() {
53
- const sdk = useSDK();
54
- return sdk.useLogout();
55
- }
56
-
57
- // src/hooks/useMyCourses.ts
58
- function useMyCourses(status, page, limit) {
59
- const sdk = useSDK();
60
- return sdk.useMyCourses(status, page, limit);
61
- }
62
-
63
- // src/hooks/useMyBundles.ts
64
- function useMyBundles(status, page, limit, search) {
65
- const sdk = useSDK();
66
- return sdk.useMyBundles(status, page, limit, search);
67
- }
68
-
69
- // src/hooks/useCourseSearch.ts
70
- function useCourseSearch(query) {
71
- const sdk = useSDK();
72
- return sdk.useCourseSearch(query);
73
- }
74
-
75
- // src/hooks/useNotes.ts
76
- function useLessonNotes(activityId) {
77
- const sdk = useSDK();
78
- return sdk.useLessonNotes(activityId);
79
- }
80
- function useCreateNote() {
81
- const sdk = useSDK();
82
- return sdk.useCreateNote();
83
- }
84
- function useUpdateNote() {
85
- const sdk = useSDK();
86
- return sdk.useUpdateNote();
87
- }
88
- function useDeleteNote() {
89
- const sdk = useSDK();
90
- return sdk.useDeleteNote();
91
- }
92
-
93
- // src/hooks/useBookmarks.ts
94
- function useLessonBookmarks(activityId) {
95
- const sdk = useSDK();
96
- return sdk.useLessonBookmarks(activityId);
97
- }
98
- function useCreateBookmark() {
99
- const sdk = useSDK();
100
- return sdk.useCreateBookmark();
101
- }
102
- function useUpdateBookmark() {
103
- const sdk = useSDK();
104
- return sdk.useUpdateBookmark();
105
- }
106
- function useDeleteBookmark() {
107
- const sdk = useSDK();
108
- return sdk.useDeleteBookmark();
109
- }
110
-
111
- // src/hooks/useAiCoach.ts
112
- function useAiCoachAvailability(courseId) {
113
- const sdk = useSDK();
114
- return sdk.useAiCoachAvailability(courseId);
115
- }
116
- function useAiCoachChat(courseId) {
117
- const sdk = useSDK();
118
- return sdk.useAiCoachChat(courseId);
119
- }
120
- function useAiCoachHistory(courseId, enabled) {
121
- const sdk = useSDK();
122
- return sdk.useAiCoachHistory(courseId, enabled);
123
- }
124
-
125
- // src/hooks/useNotifications.ts
126
- function useNotifications() {
127
- const sdk = useSDK();
128
- return sdk.useNotifications();
129
- }
130
-
131
- // src/hooks/useTheme.ts
132
- function useTheme() {
133
- const sdk = useSDK();
134
- return sdk.useTheme();
135
- }
136
-
137
- // src/hooks/useDebounce.ts
138
- function useDebounce(value, delay) {
139
- const sdk = useSDK();
140
- return sdk.useDebounce(value, delay);
141
- }
142
-
143
- // src/hooks/useToast.ts
144
- function useToast() {
145
- const sdk = useSDK();
146
- return sdk.useToast();
147
- }
148
-
149
- // src/contracts/template.contract.ts
150
- function validateTemplateManifest(manifest) {
151
- if (!manifest.name) throw new Error("Template manifest must have a name");
152
- if (!manifest.version) throw new Error("Template manifest must have a version");
153
- if (!manifest.LearnerLayout) throw new Error("Template must provide LearnerLayout");
154
- const requiredPages = [
155
- "MyLearningPage",
156
- "CatalogCoursesPage",
157
- "CatalogBundlesPage",
158
- "CourseDetailPage",
159
- "BundleDetailPage",
160
- "CoursePlayerPage",
161
- "MessagesPage",
162
- "ManualReviewPage",
163
- "ManualReviewDetailPage",
164
- "LearnerSettingsPage",
165
- "PaymentSuccessPage",
166
- "PaymentCancelPage",
167
- "CreatorProfilePage"
168
- ];
169
- for (const page of requiredPages) {
170
- if (!manifest.pages[page]) {
171
- throw new Error(`Template must provide pages.${page}`);
172
- }
173
- }
174
- }
175
-
176
- // src/utils/formatters.ts
177
- function formatDuration(seconds) {
178
- if (!seconds || seconds < 0) return "0:00";
179
- const hours = Math.floor(seconds / 3600);
180
- const minutes = Math.floor(seconds % 3600 / 60);
181
- const secs = Math.floor(seconds % 60);
182
- if (hours > 0) {
183
- return `${hours}:${minutes.toString().padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
184
- }
185
- return `${minutes}:${secs.toString().padStart(2, "0")}`;
186
- }
187
- function formatPrice(amount, currency = "USD") {
188
- return new Intl.NumberFormat("en-US", {
189
- style: "currency",
190
- currency,
191
- minimumFractionDigits: 0,
192
- maximumFractionDigits: 2
193
- }).format(amount);
194
- }
195
- function formatDate(dateString, options) {
196
- const date = new Date(dateString);
197
- return date.toLocaleDateString("en-US", options != null ? options : {
198
- year: "numeric",
199
- month: "short",
200
- day: "numeric"
201
- });
202
- }
203
- function formatRelativeTime(dateString) {
204
- const date = new Date(dateString);
205
- const now = /* @__PURE__ */ new Date();
206
- const diffMs = now.getTime() - date.getTime();
207
- const diffSecs = Math.floor(diffMs / 1e3);
208
- const diffMins = Math.floor(diffSecs / 60);
209
- const diffHours = Math.floor(diffMins / 60);
210
- const diffDays = Math.floor(diffHours / 24);
211
- if (diffSecs < 60) return "just now";
212
- if (diffMins < 60) return `${diffMins}m ago`;
213
- if (diffHours < 24) return `${diffHours}h ago`;
214
- if (diffDays < 7) return `${diffDays}d ago`;
215
- return formatDate(dateString);
216
- }
217
- function calculateProgress(completed, total) {
218
- if (total === 0) return 0;
219
- return Math.round(completed / total * 100);
220
- }
221
- function truncateText(text, maxLength) {
222
- if (text.length <= maxLength) return text;
223
- return text.slice(0, maxLength).trimEnd() + "...";
224
- }
225
-
226
- // src/layouts/DefaultLayout.tsx
227
- import { useState as useState2 } from "react";
228
-
229
- // src/components/organisms/LearnerNavbar.tsx
230
- import { useEffect, useRef, useState } from "react";
231
- import { User, Menu, ChevronDown, LogOut } from "lucide-react";
232
-
233
- // src/components/utils.ts
234
- import { clsx } from "clsx";
235
- import { twMerge } from "tailwind-merge";
236
- function cn(...inputs) {
237
- return twMerge(clsx(inputs));
238
- }
239
-
240
- // src/components/organisms/LearnerNavbar.tsx
241
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
242
- function LearnerNavbar({ hideMenuButton = false, onMenuClick, onProfileClick, onLogoClick }) {
243
- var _a;
244
- const sdk = useSDK();
245
- const { user } = sdk.useUser();
246
- const { logout } = sdk.useLogout();
247
- const [profileDropdownOpen, setProfileDropdownOpen] = useState(false);
248
- const closeTimeoutRef = useRef(null);
249
- useEffect(() => {
250
- return () => {
251
- if (closeTimeoutRef.current) clearTimeout(closeTimeoutRef.current);
252
- };
253
- }, []);
254
- const openDropdown = () => {
255
- if (closeTimeoutRef.current) {
256
- clearTimeout(closeTimeoutRef.current);
257
- closeTimeoutRef.current = null;
258
- }
259
- setProfileDropdownOpen(true);
260
- };
261
- const closeDropdownWithDelay = () => {
262
- if (closeTimeoutRef.current) clearTimeout(closeTimeoutRef.current);
263
- closeTimeoutRef.current = setTimeout(() => {
264
- setProfileDropdownOpen(false);
265
- closeTimeoutRef.current = null;
266
- }, 150);
267
- };
268
- return /* @__PURE__ */ jsx2("header", { style: { top: "var(--preview-toolbar-h, 0px)" }, className: "fixed left-0 right-0 z-30 h-20 border-b border-theme-border-primary bg-theme-bg-secondary", children: /* @__PURE__ */ jsxs("div", { className: "flex h-full items-center justify-between px-4 sm:px-6 lg:px-10 xl:px-12 2xl:px-16", children: [
269
- /* @__PURE__ */ jsx2("div", { className: "flex items-center gap-4", children: !hideMenuButton && /* @__PURE__ */ jsx2(
270
- "button",
271
- {
272
- onClick: onMenuClick,
273
- className: "rounded-lg p-2 hover:bg-theme-bg-tertiary lg:hidden",
274
- children: /* @__PURE__ */ jsx2(Menu, { className: "h-5 w-5 text-theme-text-primary" })
275
- }
276
- ) }),
277
- /* @__PURE__ */ jsx2("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ jsxs(
278
- "div",
279
- {
280
- className: "relative group ml-2 sm:ml-4 border-l border-theme-border-primary pl-3 sm:pl-5",
281
- onMouseEnter: openDropdown,
282
- onMouseLeave: closeDropdownWithDelay,
283
- children: [
284
- /* @__PURE__ */ jsxs(
285
- "button",
286
- {
287
- onClick: () => setProfileDropdownOpen((o) => !o),
288
- className: "flex items-center gap-2 sm:gap-3 hover:opacity-80 cursor-pointer transition-opacity",
289
- children: [
290
- /* @__PURE__ */ jsx2("div", { className: "relative flex h-8 w-8 sm:h-10 sm:w-10 items-center justify-center rounded-full bg-theme-accent-primary text-sm font-semibold text-white overflow-hidden", children: (user == null ? void 0 : user.profileImage) ? /* @__PURE__ */ jsx2("img", { src: user.profileImage, alt: "Profile", className: "w-full h-full object-cover" }) : ((_a = user == null ? void 0 : user.name) == null ? void 0 : _a.charAt(0)) || "S" }),
291
- user && /* @__PURE__ */ jsxs("div", { className: "hidden md:flex items-center gap-3", children: [
292
- /* @__PURE__ */ jsx2("div", { className: "text-sm font-medium text-theme-text-primary", children: user.name }),
293
- /* @__PURE__ */ jsx2(
294
- ChevronDown,
295
- {
296
- className: cn(
297
- "h-4 w-4 text-theme-text-secondary transition-transform group-hover:rotate-180",
298
- profileDropdownOpen && "rotate-180"
299
- )
300
- }
301
- )
302
- ] })
303
- ]
304
- }
305
- ),
306
- profileDropdownOpen && /* @__PURE__ */ jsxs(
307
- "div",
308
- {
309
- className: "absolute right-0 top-full z-50 mt-2 w-56 rounded-lg border border-theme-border-primary bg-theme-bg-secondary shadow-lg",
310
- onMouseEnter: openDropdown,
311
- onMouseLeave: closeDropdownWithDelay,
312
- children: [
313
- /* @__PURE__ */ jsxs("div", { className: "border-b border-theme-border-primary p-3", children: [
314
- /* @__PURE__ */ jsx2("p", { className: "text-sm font-medium text-theme-text-primary", children: user == null ? void 0 : user.name }),
315
- /* @__PURE__ */ jsx2("p", { className: "text-xs text-theme-text-muted", children: user == null ? void 0 : user.email })
316
- ] }),
317
- /* @__PURE__ */ jsx2("div", { className: "p-2", children: /* @__PURE__ */ jsxs(
318
- "button",
319
- {
320
- onClick: () => {
321
- onProfileClick == null ? void 0 : onProfileClick();
322
- setProfileDropdownOpen(false);
323
- },
324
- className: "flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm text-theme-text-secondary transition-colors hover:bg-[rgb(var(--accent-primary))]/15 hover:text-[rgb(var(--accent-primary))] cursor-pointer",
325
- children: [
326
- /* @__PURE__ */ jsx2(User, { className: "h-4 w-4" }),
327
- "My Profile"
328
- ]
329
- }
330
- ) }),
331
- /* @__PURE__ */ jsx2("div", { className: "border-t border-theme-border-primary p-2", children: /* @__PURE__ */ jsxs(
332
- "button",
333
- {
334
- onClick: () => {
335
- logout();
336
- setProfileDropdownOpen(false);
337
- },
338
- className: "flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm text-theme-text-secondary transition-colors hover:bg-[rgb(var(--accent-primary))]/15 hover:text-[rgb(var(--accent-primary))] cursor-pointer",
339
- children: [
340
- /* @__PURE__ */ jsx2(LogOut, { className: "h-4 w-4" }),
341
- "Logout"
342
- ]
343
- }
344
- ) })
345
- ]
346
- }
347
- )
348
- ]
349
- }
350
- ) })
351
- ] }) });
352
- }
353
-
354
- // src/components/organisms/LearnerSidebar.tsx
355
- import { BookOpen as BookOpen2, GraduationCap, MessageSquare, ClipboardCheck, UserCircle, Settings, LogOut as LogOut2, ChevronLeft, ChevronRight } from "lucide-react";
356
-
357
- // src/components/atoms/Button.tsx
358
- import * as React from "react";
359
- import { cva } from "class-variance-authority";
360
- import { jsx as jsx3 } from "react/jsx-runtime";
361
- var buttonVariants = cva(
362
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 cursor-pointer",
363
- {
364
- variants: {
365
- variant: {
366
- default: "bg-theme-accent-primary text-white hover:opacity-90",
367
- destructive: "bg-red-600 text-white hover:bg-red-700",
368
- outline: "border border-theme-border-primary bg-theme-bg-secondary hover:bg-theme-bg-tertiary text-theme-text-primary",
369
- secondary: "bg-theme-bg-tertiary text-theme-text-primary hover:opacity-80",
370
- ghost: "hover:bg-theme-bg-tertiary text-theme-text-primary",
371
- link: "text-[rgb(var(--accent-primary))] underline-offset-4 hover:underline"
372
- },
373
- size: {
374
- default: "h-10 px-4 py-2",
375
- sm: "h-9 rounded-md px-3",
376
- lg: "h-11 rounded-md px-8",
377
- icon: "h-10 w-10"
378
- }
379
- },
380
- defaultVariants: {
381
- variant: "default",
382
- size: "default"
383
- }
384
- }
385
- );
386
- var Button = React.forwardRef(
387
- (_a, ref) => {
388
- var _b = _a, { className, variant, size } = _b, props = __objRest(_b, ["className", "variant", "size"]);
389
- return /* @__PURE__ */ jsx3(
390
- "button",
391
- __spreadValues({
392
- className: cn(buttonVariants({ variant, size, className })),
393
- ref
394
- }, props)
395
- );
396
- }
397
- );
398
- Button.displayName = "Button";
399
-
400
- // src/components/organisms/LearnerSidebar.tsx
401
- import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
402
- var defaultItems = [
403
- { label: "My Learning", href: "/my-learning", icon: BookOpen2 },
404
- { label: "Catalog", href: "/catalog/courses", icon: GraduationCap },
405
- { label: "Messages", href: "/messages", icon: MessageSquare },
406
- { label: "Manual Review", href: "/manual-review", icon: ClipboardCheck },
407
- { label: "Account", href: "/account", icon: UserCircle }
408
- ];
409
- function LearnerSidebar({
410
- isOpen,
411
- isCollapsed,
412
- onClose,
413
- onToggle,
414
- currentPath,
415
- onNavigate,
416
- items = defaultItems
417
- }) {
418
- const sdk = useSDK();
419
- const { user } = sdk.useUser();
420
- const { logout } = sdk.useLogout();
421
- const isActive = (href, label) => {
422
- if (label === "Catalog" && currentPath.startsWith("/catalog")) return true;
423
- return currentPath === href || currentPath.startsWith(href + "/");
424
- };
425
- const handleNav = (href) => {
426
- onNavigate(href);
427
- onClose();
428
- };
429
- return /* @__PURE__ */ jsxs2(Fragment, { children: [
430
- /* @__PURE__ */ jsxs2(
431
- "aside",
432
- {
433
- style: { top: "var(--preview-toolbar-h, 0px)", height: "calc(100vh - var(--preview-toolbar-h, 0px))" },
434
- className: cn(
435
- "fixed left-0 z-40 border-r border-theme-border-primary bg-theme-bg-secondary transition-all duration-300 flex flex-col",
436
- isOpen ? "translate-x-0" : "-translate-x-full lg:translate-x-0",
437
- isCollapsed ? "w-16" : "w-64"
438
- ),
439
- children: [
440
- /* @__PURE__ */ jsxs2("div", { className: "flex h-20 items-center justify-between border-b border-theme-border-primary px-4 bg-theme-bg-secondary/50 backdrop-blur-sm", children: [
441
- !isCollapsed && /* @__PURE__ */ jsxs2(
442
- "button",
443
- {
444
- onClick: () => handleNav("/my-learning"),
445
- className: "flex items-center gap-2 sm:gap-3 hover:opacity-80 transition-opacity cursor-pointer",
446
- children: [
447
- /* @__PURE__ */ jsx4("div", { className: "flex h-8 w-8 items-center justify-center rounded bg-theme-accent-primary", children: /* @__PURE__ */ jsx4(BookOpen2, { className: "h-5 w-5 text-white" }) }),
448
- /* @__PURE__ */ jsx4("span", { className: "text-xl font-bold text-theme-text-primary leading-none whitespace-nowrap", children: "Academy" })
449
- ]
450
- }
451
- ),
452
- /* @__PURE__ */ jsx4(
453
- Button,
454
- {
455
- variant: "ghost",
456
- size: "icon",
457
- onClick: onToggle,
458
- className: cn("hover:bg-theme-bg-tertiary rounded-lg transition-colors", isCollapsed && "mx-auto"),
459
- children: isCollapsed ? /* @__PURE__ */ jsx4(ChevronRight, { className: "h-5 w-5" }) : /* @__PURE__ */ jsx4(ChevronLeft, { className: "h-5 w-5" })
460
- }
461
- )
462
- ] }),
463
- /* @__PURE__ */ jsx4("nav", { className: "flex-1 overflow-y-auto p-4 space-y-1", children: items.map((item) => {
464
- const Icon = item.icon;
465
- const active = isActive(item.href, item.label);
466
- return /* @__PURE__ */ jsxs2(
467
- "button",
468
- {
469
- onClick: () => handleNav(item.href),
470
- className: cn(
471
- "flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors cursor-pointer",
472
- active ? "bg-theme-accent-primary text-white hover:opacity-90" : "text-theme-text-secondary hover:bg-theme-bg-tertiary hover:text-theme-text-primary",
473
- isCollapsed && "justify-center"
474
- ),
475
- title: isCollapsed ? item.label : void 0,
476
- children: [
477
- /* @__PURE__ */ jsx4(Icon, { className: "h-5 w-5 shrink-0" }),
478
- !isCollapsed && /* @__PURE__ */ jsx4("span", { className: "whitespace-nowrap", children: item.label })
479
- ]
480
- },
481
- item.href
482
- );
483
- }) }),
484
- user && /* @__PURE__ */ jsx4("div", { className: "border-t border-theme-border-primary p-4", children: /* @__PURE__ */ jsxs2("div", { className: "space-y-1", children: [
485
- /* @__PURE__ */ jsxs2(
486
- "button",
487
- {
488
- onClick: () => handleNav("/learner-settings"),
489
- className: cn(
490
- "flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors cursor-pointer",
491
- currentPath === "/learner-settings" ? "bg-theme-accent-primary text-white" : "text-theme-text-secondary hover:bg-theme-bg-tertiary hover:text-theme-text-primary",
492
- isCollapsed && "justify-center"
493
- ),
494
- title: isCollapsed ? "Settings" : void 0,
495
- children: [
496
- /* @__PURE__ */ jsx4(Settings, { className: "h-5 w-5 shrink-0" }),
497
- !isCollapsed && /* @__PURE__ */ jsx4("span", { className: "whitespace-nowrap", children: "Settings" })
498
- ]
499
- }
500
- ),
501
- /* @__PURE__ */ jsxs2(
502
- "button",
503
- {
504
- onClick: logout,
505
- className: cn(
506
- "flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors hover:bg-red-50 hover:text-red-600 text-theme-text-secondary cursor-pointer",
507
- isCollapsed && "justify-center"
508
- ),
509
- children: [
510
- /* @__PURE__ */ jsx4(LogOut2, { className: "h-5 w-5 shrink-0" }),
511
- !isCollapsed && /* @__PURE__ */ jsx4("span", { className: "whitespace-nowrap", children: "Logout" })
512
- ]
513
- }
514
- )
515
- ] }) })
516
- ]
517
- }
518
- ),
519
- isOpen && /* @__PURE__ */ jsx4("div", { className: "fixed inset-0 z-30 bg-black/50 lg:hidden", onClick: onClose })
520
- ] });
521
- }
522
-
523
- // src/layouts/DefaultLayout.tsx
524
- import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
525
- function DefaultLayout({ children, currentPath = "/my-learning", onNavigate }) {
526
- const [sidebarCollapsed, setSidebarCollapsed] = useState2(false);
527
- const [sidebarOpen, setSidebarOpen] = useState2(false);
528
- return /* @__PURE__ */ jsxs3("div", { className: "min-h-screen bg-theme-bg-primary", children: [
529
- /* @__PURE__ */ jsx5("div", { style: { position: "fixed", top: "var(--preview-toolbar-h, 0px)", left: 0, right: 0, zIndex: 40 }, children: /* @__PURE__ */ jsx5(
530
- LearnerNavbar,
531
- {
532
- onMenuClick: () => {
533
- if (typeof window !== "undefined" && window.innerWidth >= 1024) {
534
- setSidebarCollapsed((c) => !c);
535
- } else {
536
- setSidebarOpen((o) => !o);
537
- }
538
- }
539
- }
540
- ) }),
541
- /* @__PURE__ */ jsxs3("div", { style: { paddingTop: "calc(80px + var(--preview-toolbar-h, 0px))", display: "flex", minHeight: "100vh" }, children: [
542
- /* @__PURE__ */ jsx5(
543
- LearnerSidebar,
544
- {
545
- currentPath,
546
- isCollapsed: sidebarCollapsed,
547
- isOpen: sidebarOpen,
548
- onClose: () => setSidebarOpen(false),
549
- onToggle: () => setSidebarCollapsed((c) => !c),
550
- onNavigate: onNavigate != null ? onNavigate : () => {
551
- }
552
- }
553
- ),
554
- /* @__PURE__ */ jsx5(
555
- "main",
556
- {
557
- style: {
558
- flex: 1,
559
- minWidth: 0,
560
- transition: "margin-left 0.3s"
561
- },
562
- className: "px-4 sm:px-6 lg:px-8 py-6",
563
- children
564
- }
565
- )
566
- ] })
567
- ] });
568
- }
569
- export {
570
- DefaultLayout,
571
- SDKProvider,
572
- calculateProgress,
573
- formatDate,
574
- formatDuration,
575
- formatPrice,
576
- formatRelativeTime,
577
- truncateText,
578
- useAiCoachAvailability,
579
- useAiCoachChat,
580
- useAiCoachHistory,
581
- useCourseSearch,
582
- useCreateBookmark,
583
- useCreateNote,
584
- useDebounce,
585
- useDeleteBookmark,
586
- useDeleteNote,
587
- useLessonBookmarks,
588
- useLessonNotes,
589
- useLogout,
590
- useMyBundles,
591
- useMyCourses,
592
- useNotifications,
593
- useSDK,
594
- useTheme,
595
- useToast,
596
- useUpdateBookmark,
597
- useUpdateNote,
598
- useUser,
599
- validateTemplateManifest
600
- };
@@ -1,9 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- interface DefaultLayoutProps {
3
- children: ReactNode;
4
- currentPath?: string;
5
- onNavigate?: (path: string) => void;
6
- }
7
- export declare function DefaultLayout({ children, currentPath, onNavigate }: DefaultLayoutProps): import("react/jsx-runtime").JSX.Element;
8
- export {};
9
- //# sourceMappingURL=DefaultLayout.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DefaultLayout.d.ts","sourceRoot":"","sources":["../../src/layouts/DefaultLayout.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIjD,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,SAAS,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,WAA4B,EAAE,UAAU,EAAE,EAAE,kBAAkB,2CA6CvG"}
@@ -1,22 +0,0 @@
1
- export type ChatRole = 'user' | 'assistant';
2
- export interface ChatMessage {
3
- id: string;
4
- role: ChatRole;
5
- content: string;
6
- createdAt: number;
7
- isStreaming?: boolean;
8
- sources?: unknown[];
9
- }
10
- export interface AICoachInfo {
11
- id: string;
12
- name: string;
13
- }
14
- export interface AICoachAvailability {
15
- active: boolean;
16
- coach: AICoachInfo | null;
17
- }
18
- export interface AICoachHistoryGroup {
19
- date: string;
20
- messages: ChatMessage[];
21
- }
22
- //# sourceMappingURL=ai-coach.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ai-coach.d.ts","sourceRoot":"","sources":["../../src/types/ai-coach.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;AAE5C,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,WAAW,EAAE,CAAC;CACzB"}
@@ -1,19 +0,0 @@
1
- export interface Bookmark {
2
- id: string;
3
- activityId: string;
4
- userId: string;
5
- second: number;
6
- label?: string;
7
- createdAt: string;
8
- updatedAt: string;
9
- }
10
- export interface CreateBookmarkPayload {
11
- activityId: string;
12
- second: number;
13
- label?: string;
14
- }
15
- export interface UpdateBookmarkPayload {
16
- second?: number;
17
- label?: string;
18
- }
19
- //# sourceMappingURL=bookmarks.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bookmarks.d.ts","sourceRoot":"","sources":["../../src/types/bookmarks.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}