@memberjunction/actions-bizapps-lms 2.55.0 → 2.57.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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +26 -0
- package/README.md +321 -0
- package/dist/providers/learnworlds/actions/create-user.action.d.ts +20 -0
- package/dist/providers/learnworlds/actions/create-user.action.d.ts.map +1 -0
- package/dist/providers/learnworlds/actions/create-user.action.js +243 -0
- package/dist/providers/learnworlds/actions/create-user.action.js.map +1 -0
- package/dist/providers/learnworlds/actions/enroll-user.action.d.ts +20 -0
- package/dist/providers/learnworlds/actions/enroll-user.action.d.ts.map +1 -0
- package/dist/providers/learnworlds/actions/enroll-user.action.js +208 -0
- package/dist/providers/learnworlds/actions/enroll-user.action.js.map +1 -0
- package/dist/providers/learnworlds/actions/get-certificates.action.d.ts +20 -0
- package/dist/providers/learnworlds/actions/get-certificates.action.d.ts.map +1 -0
- package/dist/providers/learnworlds/actions/get-certificates.action.js +301 -0
- package/dist/providers/learnworlds/actions/get-certificates.action.js.map +1 -0
- package/dist/providers/learnworlds/actions/get-course-analytics.action.d.ts +36 -0
- package/dist/providers/learnworlds/actions/get-course-analytics.action.d.ts.map +1 -0
- package/dist/providers/learnworlds/actions/get-course-analytics.action.js +333 -0
- package/dist/providers/learnworlds/actions/get-course-analytics.action.js.map +1 -0
- package/dist/providers/learnworlds/actions/get-course-details.action.d.ts +28 -0
- package/dist/providers/learnworlds/actions/get-course-details.action.d.ts.map +1 -0
- package/dist/providers/learnworlds/actions/get-course-details.action.js +237 -0
- package/dist/providers/learnworlds/actions/get-course-details.action.js.map +1 -0
- package/dist/providers/learnworlds/actions/get-quiz-results.action.d.ts +28 -0
- package/dist/providers/learnworlds/actions/get-quiz-results.action.d.ts.map +1 -0
- package/dist/providers/learnworlds/actions/get-quiz-results.action.js +368 -0
- package/dist/providers/learnworlds/actions/get-quiz-results.action.js.map +1 -0
- package/dist/providers/learnworlds/actions/get-user-enrollments.action.d.ts +20 -0
- package/dist/providers/learnworlds/actions/get-user-enrollments.action.d.ts.map +1 -0
- package/dist/providers/learnworlds/actions/get-user-enrollments.action.js +228 -0
- package/dist/providers/learnworlds/actions/get-user-enrollments.action.js.map +1 -0
- package/dist/providers/learnworlds/actions/index.d.ts +8 -0
- package/dist/providers/learnworlds/actions/index.d.ts.map +1 -1
- package/dist/providers/learnworlds/actions/index.js +8 -0
- package/dist/providers/learnworlds/actions/index.js.map +1 -1
- package/dist/providers/learnworlds/actions/update-user-progress.action.d.ts +20 -0
- package/dist/providers/learnworlds/actions/update-user-progress.action.d.ts.map +1 -0
- package/dist/providers/learnworlds/actions/update-user-progress.action.js +254 -0
- package/dist/providers/learnworlds/actions/update-user-progress.action.js.map +1 -0
- package/package.json +6 -6
- package/src/providers/learnworlds/actions/create-user.action.ts +249 -0
- package/src/providers/learnworlds/actions/enroll-user.action.ts +233 -0
- package/src/providers/learnworlds/actions/get-certificates.action.ts +332 -0
- package/src/providers/learnworlds/actions/get-course-analytics.action.ts +359 -0
- package/src/providers/learnworlds/actions/get-course-details.action.ts +267 -0
- package/src/providers/learnworlds/actions/get-quiz-results.action.ts +399 -0
- package/src/providers/learnworlds/actions/get-user-enrollments.action.ts +242 -0
- package/src/providers/learnworlds/actions/index.ts +9 -1
- package/src/providers/learnworlds/actions/update-user-progress.action.ts +277 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.EnrollUserAction = void 0;
|
|
10
|
+
const global_1 = require("@memberjunction/global");
|
|
11
|
+
const learnworlds_base_action_1 = require("../learnworlds-base.action");
|
|
12
|
+
/**
|
|
13
|
+
* Action to enroll a user in a LearnWorlds course
|
|
14
|
+
*/
|
|
15
|
+
let EnrollUserAction = class EnrollUserAction extends learnworlds_base_action_1.LearnWorldsBaseAction {
|
|
16
|
+
/**
|
|
17
|
+
* Enroll a user in a course
|
|
18
|
+
*/
|
|
19
|
+
async InternalRunAction(params) {
|
|
20
|
+
const { Params, ContextUser } = params;
|
|
21
|
+
this.params = Params;
|
|
22
|
+
try {
|
|
23
|
+
// Extract and validate parameters
|
|
24
|
+
const userId = this.getParamValue(Params, 'UserID');
|
|
25
|
+
const courseId = this.getParamValue(Params, 'CourseID');
|
|
26
|
+
const price = this.getParamValue(Params, 'Price') || 0;
|
|
27
|
+
const justification = this.getParamValue(Params, 'Justification') || 'API Enrollment';
|
|
28
|
+
const notifyUser = this.getParamValue(Params, 'NotifyUser') !== false;
|
|
29
|
+
const startDate = this.getParamValue(Params, 'StartDate');
|
|
30
|
+
const expiryDate = this.getParamValue(Params, 'ExpiryDate');
|
|
31
|
+
if (!userId) {
|
|
32
|
+
return {
|
|
33
|
+
Success: false,
|
|
34
|
+
ResultCode: 'VALIDATION_ERROR',
|
|
35
|
+
Message: 'UserID is required',
|
|
36
|
+
Params
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (!courseId) {
|
|
40
|
+
return {
|
|
41
|
+
Success: false,
|
|
42
|
+
ResultCode: 'VALIDATION_ERROR',
|
|
43
|
+
Message: 'CourseID is required',
|
|
44
|
+
Params
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
// Prepare enrollment data
|
|
48
|
+
const enrollmentData = {
|
|
49
|
+
user_id: userId,
|
|
50
|
+
justification: justification,
|
|
51
|
+
price: price,
|
|
52
|
+
notify_user: notifyUser
|
|
53
|
+
};
|
|
54
|
+
if (startDate) {
|
|
55
|
+
enrollmentData.starts_at = new Date(startDate).toISOString();
|
|
56
|
+
}
|
|
57
|
+
if (expiryDate) {
|
|
58
|
+
enrollmentData.expires_at = new Date(expiryDate).toISOString();
|
|
59
|
+
}
|
|
60
|
+
// Create enrollment
|
|
61
|
+
const enrollmentResponse = await this.makeLearnWorldsRequest(`/courses/${courseId}/enrollments`, 'POST', enrollmentData, ContextUser);
|
|
62
|
+
if (!enrollmentResponse.success) {
|
|
63
|
+
return {
|
|
64
|
+
Success: false,
|
|
65
|
+
ResultCode: 'API_ERROR',
|
|
66
|
+
Message: enrollmentResponse.message || 'Failed to enroll user',
|
|
67
|
+
Params
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const enrollment = enrollmentResponse.data;
|
|
71
|
+
// Format enrollment details
|
|
72
|
+
const enrollmentDetails = {
|
|
73
|
+
id: enrollment.id,
|
|
74
|
+
userId: enrollment.user_id || userId,
|
|
75
|
+
courseId: enrollment.course_id || courseId,
|
|
76
|
+
enrolledAt: enrollment.enrolled_at || enrollment.created_at,
|
|
77
|
+
startsAt: enrollment.starts_at,
|
|
78
|
+
expiresAt: enrollment.expires_at,
|
|
79
|
+
status: enrollment.status || 'active',
|
|
80
|
+
price: enrollment.price || price,
|
|
81
|
+
progress: {
|
|
82
|
+
percentage: enrollment.progress_percentage || 0,
|
|
83
|
+
completedUnits: enrollment.completed_units || 0,
|
|
84
|
+
totalUnits: enrollment.total_units || 0,
|
|
85
|
+
lastAccessedAt: enrollment.last_accessed_at
|
|
86
|
+
},
|
|
87
|
+
certificateEligible: enrollment.certificate_eligible || false,
|
|
88
|
+
certificateIssuedAt: enrollment.certificate_issued_at
|
|
89
|
+
};
|
|
90
|
+
// Get course and user details for summary
|
|
91
|
+
let courseTitle = 'Unknown Course';
|
|
92
|
+
let userName = 'Unknown User';
|
|
93
|
+
// Try to get course details
|
|
94
|
+
const courseResponse = await this.makeLearnWorldsRequest(`/courses/${courseId}`, 'GET', null, ContextUser);
|
|
95
|
+
if (courseResponse.success && courseResponse.data) {
|
|
96
|
+
courseTitle = courseResponse.data.title || courseTitle;
|
|
97
|
+
}
|
|
98
|
+
// Try to get user details
|
|
99
|
+
const userResponse = await this.makeLearnWorldsRequest(`/users/${userId}`, 'GET', null, ContextUser);
|
|
100
|
+
if (userResponse.success && userResponse.data) {
|
|
101
|
+
const user = userResponse.data;
|
|
102
|
+
userName = user.email || user.username || userName;
|
|
103
|
+
}
|
|
104
|
+
// Create summary
|
|
105
|
+
const summary = {
|
|
106
|
+
enrollmentId: enrollmentDetails.id,
|
|
107
|
+
userId: userId,
|
|
108
|
+
userName: userName,
|
|
109
|
+
courseId: courseId,
|
|
110
|
+
courseTitle: courseTitle,
|
|
111
|
+
enrolledAt: enrollmentDetails.enrolledAt,
|
|
112
|
+
status: enrollmentDetails.status,
|
|
113
|
+
price: enrollmentDetails.price,
|
|
114
|
+
notificationSent: notifyUser
|
|
115
|
+
};
|
|
116
|
+
// Update output parameters
|
|
117
|
+
const outputParams = [...Params];
|
|
118
|
+
const enrollmentDetailsParam = outputParams.find(p => p.Name === 'EnrollmentDetails');
|
|
119
|
+
if (enrollmentDetailsParam) {
|
|
120
|
+
enrollmentDetailsParam.Value = enrollmentDetails;
|
|
121
|
+
}
|
|
122
|
+
const summaryParam = outputParams.find(p => p.Name === 'Summary');
|
|
123
|
+
if (summaryParam) {
|
|
124
|
+
summaryParam.Value = summary;
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
Success: true,
|
|
128
|
+
ResultCode: 'SUCCESS',
|
|
129
|
+
Message: `Successfully enrolled user ${userName} in course ${courseTitle}`,
|
|
130
|
+
Params: outputParams
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
135
|
+
return {
|
|
136
|
+
Success: false,
|
|
137
|
+
ResultCode: 'EXECUTION_ERROR',
|
|
138
|
+
Message: `Error enrolling user: ${errorMessage}`,
|
|
139
|
+
Params
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Define the parameters this action expects
|
|
145
|
+
*/
|
|
146
|
+
get Params() {
|
|
147
|
+
const baseParams = this.getCommonLMSParams();
|
|
148
|
+
const specificParams = [
|
|
149
|
+
{
|
|
150
|
+
Name: 'UserID',
|
|
151
|
+
Type: 'Input',
|
|
152
|
+
Value: null
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
Name: 'CourseID',
|
|
156
|
+
Type: 'Input',
|
|
157
|
+
Value: null
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
Name: 'Price',
|
|
161
|
+
Type: 'Input',
|
|
162
|
+
Value: 0
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
Name: 'Justification',
|
|
166
|
+
Type: 'Input',
|
|
167
|
+
Value: 'API Enrollment'
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
Name: 'NotifyUser',
|
|
171
|
+
Type: 'Input',
|
|
172
|
+
Value: true
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
Name: 'StartDate',
|
|
176
|
+
Type: 'Input',
|
|
177
|
+
Value: null
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
Name: 'ExpiryDate',
|
|
181
|
+
Type: 'Input',
|
|
182
|
+
Value: null
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
Name: 'EnrollmentDetails',
|
|
186
|
+
Type: 'Output',
|
|
187
|
+
Value: null
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
Name: 'Summary',
|
|
191
|
+
Type: 'Output',
|
|
192
|
+
Value: null
|
|
193
|
+
}
|
|
194
|
+
];
|
|
195
|
+
return [...baseParams, ...specificParams];
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Metadata about this action
|
|
199
|
+
*/
|
|
200
|
+
get Description() {
|
|
201
|
+
return 'Enrolls a user in a LearnWorlds course with optional pricing and notification settings';
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
exports.EnrollUserAction = EnrollUserAction;
|
|
205
|
+
exports.EnrollUserAction = EnrollUserAction = __decorate([
|
|
206
|
+
(0, global_1.RegisterClass)(learnworlds_base_action_1.LearnWorldsBaseAction, 'EnrollUserAction')
|
|
207
|
+
], EnrollUserAction);
|
|
208
|
+
//# sourceMappingURL=enroll-user.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enroll-user.action.js","sourceRoot":"","sources":["../../../../src/providers/learnworlds/actions/enroll-user.action.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mDAAuD;AACvD,wEAAmE;AAGnE;;GAEG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,+CAAqB;IACvD;;OAEG;IACI,KAAK,CAAC,iBAAiB,CAAC,MAAuB;QAClD,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,CAAC;YACD,kCAAkC;YAClC,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YACpD,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;YACxD,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;YACvD,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,eAAe,CAAC,IAAI,gBAAgB,CAAC;YACtF,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,YAAY,CAAC,KAAK,KAAK,CAAC;YACtE,MAAM,SAAS,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E,GAAG,cAAc,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,IAAW,WAAW;QAClB,OAAO,wFAAwF,CAAC;IACpG,CAAC;CACJ,CAAA;AAhOY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,sBAAa,EAAC,+CAAqB,EAAE,kBAAkB,CAAC;GAC5C,gBAAgB,CAgO5B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LearnWorldsBaseAction } from '../learnworlds-base.action';
|
|
2
|
+
import { ActionParam, ActionResultSimple, RunActionParams } from '@memberjunction/actions-base';
|
|
3
|
+
/**
|
|
4
|
+
* Action to retrieve certificates earned by users in LearnWorlds
|
|
5
|
+
*/
|
|
6
|
+
export declare class GetCertificatesAction extends LearnWorldsBaseAction {
|
|
7
|
+
/**
|
|
8
|
+
* Get certificates for a user or course
|
|
9
|
+
*/
|
|
10
|
+
InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
11
|
+
/**
|
|
12
|
+
* Define the parameters this action expects
|
|
13
|
+
*/
|
|
14
|
+
get Params(): ActionParam[];
|
|
15
|
+
/**
|
|
16
|
+
* Metadata about this action
|
|
17
|
+
*/
|
|
18
|
+
get Description(): string;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=get-certificates.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-certificates.action.d.ts","sourceRoot":"","sources":["../../../../src/providers/learnworlds/actions/get-certificates.action.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEhG;;GAEG;AACH,qBACa,qBAAsB,SAAQ,qBAAqB;IAC5D;;OAEG;IACU,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAwPpF;;OAEG;IACH,IAAW,MAAM,IAAI,WAAW,EAAE,CA4DjC;IAED;;OAEG;IACH,IAAW,WAAW,IAAI,MAAM,CAE/B;CACJ"}
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.GetCertificatesAction = void 0;
|
|
10
|
+
const global_1 = require("@memberjunction/global");
|
|
11
|
+
const learnworlds_base_action_1 = require("../learnworlds-base.action");
|
|
12
|
+
/**
|
|
13
|
+
* Action to retrieve certificates earned by users in LearnWorlds
|
|
14
|
+
*/
|
|
15
|
+
let GetCertificatesAction = class GetCertificatesAction extends learnworlds_base_action_1.LearnWorldsBaseAction {
|
|
16
|
+
/**
|
|
17
|
+
* Get certificates for a user or course
|
|
18
|
+
*/
|
|
19
|
+
async InternalRunAction(params) {
|
|
20
|
+
const { Params, ContextUser } = params;
|
|
21
|
+
this.params = Params;
|
|
22
|
+
try {
|
|
23
|
+
// Extract and validate parameters
|
|
24
|
+
const userId = this.getParamValue(Params, 'UserID');
|
|
25
|
+
const courseId = this.getParamValue(Params, 'CourseID');
|
|
26
|
+
const dateFrom = this.getParamValue(Params, 'DateFrom');
|
|
27
|
+
const dateTo = this.getParamValue(Params, 'DateTo');
|
|
28
|
+
const includeDownloadLinks = this.getParamValue(Params, 'IncludeDownloadLinks') !== false;
|
|
29
|
+
const sortBy = this.getParamValue(Params, 'SortBy') || 'issued_at';
|
|
30
|
+
const sortOrder = this.getParamValue(Params, 'SortOrder') || 'desc';
|
|
31
|
+
const maxResults = this.getParamValue(Params, 'MaxResults') || 100;
|
|
32
|
+
// Require either userId or courseId
|
|
33
|
+
if (!userId && !courseId) {
|
|
34
|
+
return {
|
|
35
|
+
Success: false,
|
|
36
|
+
ResultCode: 'VALIDATION_ERROR',
|
|
37
|
+
Message: 'Either UserID or CourseID is required',
|
|
38
|
+
Params
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
// Build query parameters
|
|
42
|
+
const queryParams = {
|
|
43
|
+
limit: Math.min(maxResults, 100),
|
|
44
|
+
sort: sortBy,
|
|
45
|
+
order: sortOrder
|
|
46
|
+
};
|
|
47
|
+
if (dateFrom) {
|
|
48
|
+
queryParams.issued_after = new Date(dateFrom).toISOString();
|
|
49
|
+
}
|
|
50
|
+
if (dateTo) {
|
|
51
|
+
queryParams.issued_before = new Date(dateTo).toISOString();
|
|
52
|
+
}
|
|
53
|
+
// Determine endpoint based on parameters
|
|
54
|
+
let endpoint = '/certificates';
|
|
55
|
+
if (userId && courseId) {
|
|
56
|
+
// Get specific certificate for user/course combination
|
|
57
|
+
endpoint = `/users/${userId}/courses/${courseId}/certificate`;
|
|
58
|
+
}
|
|
59
|
+
else if (userId) {
|
|
60
|
+
// Get all certificates for a user
|
|
61
|
+
endpoint = `/users/${userId}/certificates`;
|
|
62
|
+
}
|
|
63
|
+
else if (courseId) {
|
|
64
|
+
// Get all certificates issued for a course
|
|
65
|
+
endpoint = `/courses/${courseId}/certificates`;
|
|
66
|
+
}
|
|
67
|
+
// Build query string
|
|
68
|
+
const queryString = Object.keys(queryParams).length > 0
|
|
69
|
+
? '?' + new URLSearchParams(queryParams).toString()
|
|
70
|
+
: '';
|
|
71
|
+
// Get certificates
|
|
72
|
+
const certificatesResponse = await this.makeLearnWorldsRequest(endpoint + queryString, 'GET', null, ContextUser);
|
|
73
|
+
if (!certificatesResponse.success) {
|
|
74
|
+
return {
|
|
75
|
+
Success: false,
|
|
76
|
+
ResultCode: 'API_ERROR',
|
|
77
|
+
Message: certificatesResponse.message || 'Failed to retrieve certificates',
|
|
78
|
+
Params
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
// Handle single certificate vs array
|
|
82
|
+
const rawData = certificatesResponse.data;
|
|
83
|
+
const certificatesArray = Array.isArray(rawData)
|
|
84
|
+
? rawData
|
|
85
|
+
: (rawData?.data || (rawData?.id ? [rawData] : []));
|
|
86
|
+
const formattedCertificates = [];
|
|
87
|
+
// Process each certificate
|
|
88
|
+
for (const cert of certificatesArray) {
|
|
89
|
+
const formattedCert = {
|
|
90
|
+
id: cert.id || cert.certificate_id,
|
|
91
|
+
userId: cert.user_id || userId,
|
|
92
|
+
courseId: cert.course_id || courseId,
|
|
93
|
+
certificateNumber: cert.certificate_number || cert.number,
|
|
94
|
+
issuedAt: cert.issued_at || cert.created_at,
|
|
95
|
+
expiresAt: cert.expires_at,
|
|
96
|
+
status: cert.status || 'active',
|
|
97
|
+
grade: cert.grade,
|
|
98
|
+
score: cert.score,
|
|
99
|
+
completionPercentage: cert.completion_percentage || 100
|
|
100
|
+
};
|
|
101
|
+
// Add user info if available
|
|
102
|
+
if (cert.user) {
|
|
103
|
+
formattedCert.user = {
|
|
104
|
+
id: cert.user.id || cert.user_id,
|
|
105
|
+
email: cert.user.email,
|
|
106
|
+
name: cert.user.name || `${cert.user.first_name || ''} ${cert.user.last_name || ''}`.trim()
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
else if (!userId && cert.user_id) {
|
|
110
|
+
// Try to get user info
|
|
111
|
+
const userResponse = await this.makeLearnWorldsRequest(`/users/${cert.user_id}`, 'GET', null, ContextUser);
|
|
112
|
+
if (userResponse.success && userResponse.data) {
|
|
113
|
+
const user = userResponse.data;
|
|
114
|
+
formattedCert.user = {
|
|
115
|
+
id: user.id,
|
|
116
|
+
email: user.email,
|
|
117
|
+
name: `${user.first_name || ''} ${user.last_name || ''}`.trim() || user.username
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
// Add course info if available
|
|
122
|
+
if (cert.course) {
|
|
123
|
+
formattedCert.course = {
|
|
124
|
+
id: cert.course.id || cert.course_id,
|
|
125
|
+
title: cert.course.title,
|
|
126
|
+
duration: cert.course.duration
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
else if (!courseId && cert.course_id) {
|
|
130
|
+
// Try to get course info
|
|
131
|
+
const courseResponse = await this.makeLearnWorldsRequest(`/courses/${cert.course_id}`, 'GET', null, ContextUser);
|
|
132
|
+
if (courseResponse.success && courseResponse.data) {
|
|
133
|
+
const course = courseResponse.data;
|
|
134
|
+
formattedCert.course = {
|
|
135
|
+
id: course.id,
|
|
136
|
+
title: course.title,
|
|
137
|
+
duration: course.duration
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
// Add download links if requested
|
|
142
|
+
if (includeDownloadLinks) {
|
|
143
|
+
formattedCert.downloadLinks = {
|
|
144
|
+
pdf: cert.pdf_url || cert.download_url,
|
|
145
|
+
image: cert.image_url,
|
|
146
|
+
publicUrl: cert.public_url || cert.certificate_url
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
// Add verification info
|
|
150
|
+
formattedCert.verification = {
|
|
151
|
+
url: cert.verification_url,
|
|
152
|
+
code: cert.verification_code,
|
|
153
|
+
qrCode: cert.qr_code_url
|
|
154
|
+
};
|
|
155
|
+
formattedCertificates.push(formattedCert);
|
|
156
|
+
}
|
|
157
|
+
// Calculate summary statistics
|
|
158
|
+
const totalCertificates = formattedCertificates.length;
|
|
159
|
+
const activeCertificates = formattedCertificates.filter(c => c.status === 'active' && (!c.expiresAt || new Date(c.expiresAt) > new Date())).length;
|
|
160
|
+
const expiredCertificates = formattedCertificates.filter(c => c.expiresAt && new Date(c.expiresAt) <= new Date()).length;
|
|
161
|
+
// Group by course if getting user certificates
|
|
162
|
+
const certificatesByCourse = {};
|
|
163
|
+
if (userId && !courseId) {
|
|
164
|
+
formattedCertificates.forEach(cert => {
|
|
165
|
+
const courseTitle = cert.course?.title || 'Unknown Course';
|
|
166
|
+
if (!certificatesByCourse[courseTitle]) {
|
|
167
|
+
certificatesByCourse[courseTitle] = [];
|
|
168
|
+
}
|
|
169
|
+
certificatesByCourse[courseTitle].push(cert);
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
// Group by user if getting course certificates
|
|
173
|
+
const certificatesByUser = {};
|
|
174
|
+
if (courseId && !userId) {
|
|
175
|
+
formattedCertificates.forEach(cert => {
|
|
176
|
+
const userName = cert.user?.name || cert.user?.email || 'Unknown User';
|
|
177
|
+
if (!certificatesByUser[userName]) {
|
|
178
|
+
certificatesByUser[userName] = [];
|
|
179
|
+
}
|
|
180
|
+
certificatesByUser[userName].push(cert);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
// Create summary
|
|
184
|
+
const summary = {
|
|
185
|
+
totalCertificates: totalCertificates,
|
|
186
|
+
activeCertificates: activeCertificates,
|
|
187
|
+
expiredCertificates: expiredCertificates,
|
|
188
|
+
dateRange: {
|
|
189
|
+
from: dateFrom || 'all-time',
|
|
190
|
+
to: dateTo || 'current'
|
|
191
|
+
},
|
|
192
|
+
filterType: userId && courseId ? 'user-course' : (userId ? 'user' : 'course'),
|
|
193
|
+
groupedData: userId && !courseId ? certificatesByCourse : (courseId && !userId ? certificatesByUser : null)
|
|
194
|
+
};
|
|
195
|
+
// Update output parameters
|
|
196
|
+
const outputParams = [...Params];
|
|
197
|
+
const certificatesParam = outputParams.find(p => p.Name === 'Certificates');
|
|
198
|
+
if (certificatesParam) {
|
|
199
|
+
certificatesParam.Value = formattedCertificates;
|
|
200
|
+
}
|
|
201
|
+
const totalCountParam = outputParams.find(p => p.Name === 'TotalCount');
|
|
202
|
+
if (totalCountParam) {
|
|
203
|
+
totalCountParam.Value = totalCertificates;
|
|
204
|
+
}
|
|
205
|
+
const summaryParam = outputParams.find(p => p.Name === 'Summary');
|
|
206
|
+
if (summaryParam) {
|
|
207
|
+
summaryParam.Value = summary;
|
|
208
|
+
}
|
|
209
|
+
return {
|
|
210
|
+
Success: true,
|
|
211
|
+
ResultCode: 'SUCCESS',
|
|
212
|
+
Message: `Retrieved ${totalCertificates} certificate(s)`,
|
|
213
|
+
Params: outputParams
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
218
|
+
return {
|
|
219
|
+
Success: false,
|
|
220
|
+
ResultCode: 'EXECUTION_ERROR',
|
|
221
|
+
Message: `Error retrieving certificates: ${errorMessage}`,
|
|
222
|
+
Params
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Define the parameters this action expects
|
|
228
|
+
*/
|
|
229
|
+
get Params() {
|
|
230
|
+
const baseParams = this.getCommonLMSParams();
|
|
231
|
+
const specificParams = [
|
|
232
|
+
{
|
|
233
|
+
Name: 'UserID',
|
|
234
|
+
Type: 'Input',
|
|
235
|
+
Value: null
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
Name: 'CourseID',
|
|
239
|
+
Type: 'Input',
|
|
240
|
+
Value: null
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
Name: 'DateFrom',
|
|
244
|
+
Type: 'Input',
|
|
245
|
+
Value: null
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
Name: 'DateTo',
|
|
249
|
+
Type: 'Input',
|
|
250
|
+
Value: null
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
Name: 'IncludeDownloadLinks',
|
|
254
|
+
Type: 'Input',
|
|
255
|
+
Value: true
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
Name: 'SortBy',
|
|
259
|
+
Type: 'Input',
|
|
260
|
+
Value: 'issued_at'
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
Name: 'SortOrder',
|
|
264
|
+
Type: 'Input',
|
|
265
|
+
Value: 'desc'
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
Name: 'MaxResults',
|
|
269
|
+
Type: 'Input',
|
|
270
|
+
Value: 100
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
Name: 'Certificates',
|
|
274
|
+
Type: 'Output',
|
|
275
|
+
Value: null
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
Name: 'TotalCount',
|
|
279
|
+
Type: 'Output',
|
|
280
|
+
Value: null
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
Name: 'Summary',
|
|
284
|
+
Type: 'Output',
|
|
285
|
+
Value: null
|
|
286
|
+
}
|
|
287
|
+
];
|
|
288
|
+
return [...baseParams, ...specificParams];
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Metadata about this action
|
|
292
|
+
*/
|
|
293
|
+
get Description() {
|
|
294
|
+
return 'Retrieves certificates earned by users in LearnWorlds courses with download links and verification info';
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
exports.GetCertificatesAction = GetCertificatesAction;
|
|
298
|
+
exports.GetCertificatesAction = GetCertificatesAction = __decorate([
|
|
299
|
+
(0, global_1.RegisterClass)(learnworlds_base_action_1.LearnWorldsBaseAction, 'GetCertificatesAction')
|
|
300
|
+
], GetCertificatesAction);
|
|
301
|
+
//# sourceMappingURL=get-certificates.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-certificates.action.js","sourceRoot":"","sources":["../../../../src/providers/learnworlds/actions/get-certificates.action.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mDAAuD;AACvD,wEAAmE;AAGnE;;GAEG;AAEI,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,+CAAqB;IAC5D;;OAEG;IACI,KAAK,CAAC,iBAAiB,CAAC,MAAuB;QAClD,MAAM,EAAE,MAAM,EAAE,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QACF,OAAO,CAAC,GAAG,UAAU,EAAE,GAAG,cAAc,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,IAAW,WAAW;QAClB,OAAO,yGAAyG,CAAC;IACrH,CAAC;CACJ,CAAA;AAnUY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,sBAAa,EAAC,+CAAqB,EAAE,uBAAuB,CAAC;GACjD,qBAAqB,CAmUjC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { LearnWorldsBaseAction } from '../learnworlds-base.action';
|
|
2
|
+
import { ActionParam, ActionResultSimple, RunActionParams } from '@memberjunction/actions-base';
|
|
3
|
+
/**
|
|
4
|
+
* Action to retrieve comprehensive analytics for a LearnWorlds course
|
|
5
|
+
*/
|
|
6
|
+
export declare class GetCourseAnalyticsAction extends LearnWorldsBaseAction {
|
|
7
|
+
/**
|
|
8
|
+
* Get course performance analytics
|
|
9
|
+
*/
|
|
10
|
+
InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
11
|
+
/**
|
|
12
|
+
* Format module statistics
|
|
13
|
+
*/
|
|
14
|
+
private formatModuleStats;
|
|
15
|
+
/**
|
|
16
|
+
* Calculate user breakdown statistics
|
|
17
|
+
*/
|
|
18
|
+
private calculateUserBreakdown;
|
|
19
|
+
/**
|
|
20
|
+
* Calculate growth rate from trend data
|
|
21
|
+
*/
|
|
22
|
+
private calculateGrowthRate;
|
|
23
|
+
/**
|
|
24
|
+
* Calculate engagement trend
|
|
25
|
+
*/
|
|
26
|
+
private calculateEngagementTrend;
|
|
27
|
+
/**
|
|
28
|
+
* Define the parameters this action expects
|
|
29
|
+
*/
|
|
30
|
+
get Params(): ActionParam[];
|
|
31
|
+
/**
|
|
32
|
+
* Metadata about this action
|
|
33
|
+
*/
|
|
34
|
+
get Description(): string;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=get-course-analytics.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-course-analytics.action.d.ts","sourceRoot":"","sources":["../../../../src/providers/learnworlds/actions/get-course-analytics.action.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEhG;;GAEG;AACH,qBACa,wBAAyB,SAAQ,qBAAqB;IAC/D;;OAEG;IACU,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAkMpF;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAoBzB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAkC9B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAe3B;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAehC;;OAEG;IACH,IAAW,MAAM,IAAI,WAAW,EAAE,CA6CjC;IAED;;OAEG;IACH,IAAW,WAAW,IAAI,MAAM,CAE/B;CACJ"}
|