nazar-salary 3.5.1 → 3.5.3

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 (3) hide show
  1. package/index.d.ts +61 -0
  2. package/index.js +25 -0
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -849,6 +849,65 @@ declare module 'nazar-salary' {
849
849
  history: ProgressHistoryEntry[];
850
850
  }
851
851
 
852
+ export interface AkcentCertificate {
853
+ number: string | null;
854
+ /** epoch ms */
855
+ issuedAt: number;
856
+ verifyUrl: string | null;
857
+ /** public PDF link, supports ?lang=ru|kk|en */
858
+ downloadUrl: string | null;
859
+ }
860
+
861
+ export interface AkcentCourse {
862
+ courseId: number;
863
+ title: string;
864
+ cover_image_url: string | null;
865
+ /** percent 0–100, null until graded */
866
+ totalGrade: number | null;
867
+ /** A1…C2, shown on the certificate check page; 'B2' until set */
868
+ languageLevel: AkcentLanguageLevel | string;
869
+ /** lessons with a teacher the student had; 12 until set */
870
+ lessonsDone: number;
871
+ /** lessons in the course; 12 until set */
872
+ lessonsTotal: number;
873
+ /** null while the course is not completed */
874
+ certificate: AkcentCertificate | null;
875
+ }
876
+
877
+ export type AkcentLanguageLevel = 'A1' | 'A2' | 'B1' | 'B2' | 'C1' | 'C2';
878
+
879
+ /** Send only what changes; null puts the default back (B2, 12, 12). */
880
+ export interface UpdateAkcentCourseData {
881
+ languageLevel?: AkcentLanguageLevel | null;
882
+ /** 0–1000, not more than lessonsTotal */
883
+ lessonsDone?: number | null;
884
+ /** 1–1000 */
885
+ lessonsTotal?: number | null;
886
+ }
887
+
888
+ export interface UpdateAkcentCourseResponse {
889
+ userId: string;
890
+ courseId: number;
891
+ languageLevel: AkcentLanguageLevel | string;
892
+ lessonsDone: number;
893
+ lessonsTotal: number;
894
+ }
895
+
896
+ export interface AkcentStudent {
897
+ userId: string;
898
+ firstName: string | null;
899
+ lastName: string | null;
900
+ logo_url: string | null;
901
+ phone: string | null;
902
+ courses: AkcentCourse[];
903
+ }
904
+
905
+ export interface StudentCertificatesResponse {
906
+ /** false — no Akcent student with this phone */
907
+ found: boolean;
908
+ student: AkcentStudent | null;
909
+ }
910
+
852
911
  export type StopReason = 'student_quit' | 'moved_away' | 'health_issues' | 'financial' | 'other' | 'refund';
853
912
 
854
913
  export interface StopStudentData {
@@ -1816,6 +1875,8 @@ declare module 'nazar-salary' {
1816
1875
  resumeStudent(studentId: number, data?: ResumeStudentData): Promise<ResumeStudentResponse>;
1817
1876
  resumeMyStudent(studentId: number, data?: ResumeStudentData): Promise<ResumeStudentResponse>;
1818
1877
  getStudent(studentId: number): Promise<StudentDetail>;
1878
+ getStudentCertificates(studentId: number): Promise<StudentCertificatesResponse>;
1879
+ updateStudentCertificateCourse(studentId: number, courseId: number, data: UpdateAkcentCourseData): Promise<UpdateAkcentCourseResponse>;
1819
1880
  searchStudents(params: SearchStudentsParams): Promise<SearchStudentsResponse>;
1820
1881
  getStoppedStudents(params?: StoppedStudentsParams): Promise<StoppedStudentsResponse>;
1821
1882
  getMyStoppedStudents(params?: MyStoppedStudentsParams): Promise<MyStoppedStudentsResponse>;
package/index.js CHANGED
@@ -755,6 +755,31 @@ class SalaryAPI {
755
755
  return await this.client.get(`/api/v1/student/${studentId}`);
756
756
  }
757
757
 
758
+ /**
759
+ * Get student's Akcent Online courses and certificates (requireAuth: admin or owner manager)
760
+ * The backend finds the student in Akcent by phone.
761
+ * @param {number} studentId - Student ID
762
+ * @returns {Promise<StudentCertificatesResponse>}
763
+ */
764
+ async getStudentCertificates(studentId) {
765
+ return await this.client.get(`/api/v1/student/${studentId}/certificates`);
766
+ }
767
+
768
+ /**
769
+ * Set language level and lessons held for one Akcent course (requireAuth: admin or owner manager)
770
+ * Shown on the certificate check page (verifyUrl). Send only what changes; null = default.
771
+ * @param {number} studentId - Student ID
772
+ * @param {number} courseId - Akcent course ID
773
+ * @param {object} data - { languageLevel?, lessonsDone?, lessonsTotal? }
774
+ * @returns {Promise<UpdateAkcentCourseResponse>}
775
+ */
776
+ async updateStudentCertificateCourse(studentId, courseId, data) {
777
+ return await this.client.put(
778
+ `/api/v1/student/${studentId}/certificates/courses/${courseId}`,
779
+ data,
780
+ );
781
+ }
782
+
758
783
  /**
759
784
  * Search students globally (Admin only)
760
785
  * By default returns only active records; pass is_active=false for stopped.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nazar-salary",
3
- "version": "3.5.1",
3
+ "version": "3.5.3",
4
4
  "description": "Frontend library for Nazar Salary API",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",