@memberjunction/actions-bizapps-lms 2.55.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.
Files changed (49) hide show
  1. package/.turbo/turbo-build.log +4 -0
  2. package/CHANGELOG.md +12 -0
  3. package/dist/base/base-lms.action.d.ts +77 -0
  4. package/dist/base/base-lms.action.d.ts.map +1 -0
  5. package/dist/base/base-lms.action.js +176 -0
  6. package/dist/base/base-lms.action.js.map +1 -0
  7. package/dist/index.d.ts +3 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +21 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/providers/learnworlds/actions/get-courses.action.d.ts +125 -0
  12. package/dist/providers/learnworlds/actions/get-courses.action.d.ts.map +1 -0
  13. package/dist/providers/learnworlds/actions/get-courses.action.js +436 -0
  14. package/dist/providers/learnworlds/actions/get-courses.action.js.map +1 -0
  15. package/dist/providers/learnworlds/actions/get-user-details.action.d.ts +95 -0
  16. package/dist/providers/learnworlds/actions/get-user-details.action.d.ts.map +1 -0
  17. package/dist/providers/learnworlds/actions/get-user-details.action.js +280 -0
  18. package/dist/providers/learnworlds/actions/get-user-details.action.js.map +1 -0
  19. package/dist/providers/learnworlds/actions/get-user-progress.action.d.ts +151 -0
  20. package/dist/providers/learnworlds/actions/get-user-progress.action.d.ts.map +1 -0
  21. package/dist/providers/learnworlds/actions/get-user-progress.action.js +417 -0
  22. package/dist/providers/learnworlds/actions/get-user-progress.action.js.map +1 -0
  23. package/dist/providers/learnworlds/actions/get-users.action.d.ts +53 -0
  24. package/dist/providers/learnworlds/actions/get-users.action.d.ts.map +1 -0
  25. package/dist/providers/learnworlds/actions/get-users.action.js +272 -0
  26. package/dist/providers/learnworlds/actions/get-users.action.js.map +1 -0
  27. package/dist/providers/learnworlds/actions/index.d.ts +5 -0
  28. package/dist/providers/learnworlds/actions/index.d.ts.map +1 -0
  29. package/dist/providers/learnworlds/actions/index.js +22 -0
  30. package/dist/providers/learnworlds/actions/index.js.map +1 -0
  31. package/dist/providers/learnworlds/index.d.ts +3 -0
  32. package/dist/providers/learnworlds/index.d.ts.map +1 -0
  33. package/dist/providers/learnworlds/index.js +21 -0
  34. package/dist/providers/learnworlds/index.js.map +1 -0
  35. package/dist/providers/learnworlds/learnworlds-base.action.d.ts +52 -0
  36. package/dist/providers/learnworlds/learnworlds-base.action.d.ts.map +1 -0
  37. package/dist/providers/learnworlds/learnworlds-base.action.js +186 -0
  38. package/dist/providers/learnworlds/learnworlds-base.action.js.map +1 -0
  39. package/package.json +40 -0
  40. package/src/base/base-lms.action.ts +197 -0
  41. package/src/index.ts +5 -0
  42. package/src/providers/learnworlds/actions/get-courses.action.ts +592 -0
  43. package/src/providers/learnworlds/actions/get-user-details.action.ts +381 -0
  44. package/src/providers/learnworlds/actions/get-user-progress.action.ts +625 -0
  45. package/src/providers/learnworlds/actions/get-users.action.ts +319 -0
  46. package/src/providers/learnworlds/actions/index.ts +5 -0
  47. package/src/providers/learnworlds/index.ts +5 -0
  48. package/src/providers/learnworlds/learnworlds-base.action.ts +221 -0
  49. package/tsconfig.json +18 -0
@@ -0,0 +1,4 @@
1
+
2
+ > @memberjunction/actions-bizapps-lms@2.55.0 build
3
+ > tsc
4
+
package/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # @memberjunction/actions-bizapps-lms
2
+
3
+ ## 2.55.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [659f892]
8
+ - @memberjunction/core-entities@2.55.0
9
+ - @memberjunction/actions@2.55.0
10
+ - @memberjunction/actions-base@2.55.0
11
+ - @memberjunction/core@2.55.0
12
+ - @memberjunction/global@2.55.0
@@ -0,0 +1,77 @@
1
+ import { ActionParam } from '@memberjunction/actions-base';
2
+ import { BaseAction } from '@memberjunction/actions';
3
+ import { UserInfo } from '@memberjunction/core';
4
+ import { CompanyIntegrationEntity } from '@memberjunction/core-entities';
5
+ /**
6
+ * Base class for all LMS-related actions.
7
+ * Provides common functionality and patterns for interacting with Learning Management Systems.
8
+ */
9
+ export declare abstract class BaseLMSAction extends BaseAction {
10
+ /**
11
+ * The LMS provider this action is designed for (e.g., 'LearnWorlds', 'Moodle', etc.)
12
+ */
13
+ protected abstract lmsProvider: string;
14
+ /**
15
+ * The integration name to look up in the Integration entity
16
+ */
17
+ protected abstract integrationName: string;
18
+ /**
19
+ * Cached company integration for the current execution
20
+ */
21
+ private _companyIntegration;
22
+ /**
23
+ * Common LMS parameters that many actions will need
24
+ */
25
+ protected getCommonLMSParams(): ActionParam[];
26
+ /**
27
+ * Gets the company integration record for the specified company and LMS
28
+ */
29
+ protected getCompanyIntegration(companyId: string, contextUser: UserInfo): Promise<CompanyIntegrationEntity>;
30
+ /**
31
+ * Gets credentials from environment variables
32
+ * Format: BIZAPPS_{PROVIDER}_{COMPANY_ID}_{CREDENTIAL_TYPE}
33
+ * Example: BIZAPPS_LEARNWORLDS_12345_API_KEY
34
+ */
35
+ protected getCredentialFromEnv(companyId: string, credentialType: string): string | undefined;
36
+ /**
37
+ * Gets API credentials - first tries environment variables, then falls back to database
38
+ */
39
+ protected getAPICredentials(integration: CompanyIntegrationEntity): Promise<{
40
+ apiKey?: string;
41
+ apiSecret?: string;
42
+ accessToken?: string;
43
+ }>;
44
+ /**
45
+ * Gets the base URL for API calls
46
+ */
47
+ protected getAPIBaseURL(integration: CompanyIntegrationEntity): Promise<string>;
48
+ /**
49
+ * Helper to get parameter value with type safety
50
+ */
51
+ protected getParamValue(params: ActionParam[], paramName: string): any;
52
+ /**
53
+ * Standard date format for LMS systems (ISO 8601)
54
+ */
55
+ protected formatLMSDate(date: Date): string;
56
+ /**
57
+ * Parse date from LMS format
58
+ */
59
+ protected parseLMSDate(dateString: string): Date;
60
+ /**
61
+ * Calculate progress percentage
62
+ */
63
+ protected calculateProgressPercentage(completed: number, total: number): number;
64
+ /**
65
+ * Format duration in seconds to human readable format
66
+ */
67
+ protected formatDuration(seconds: number): string;
68
+ /**
69
+ * Helper to build consistent error messages for LMS operations
70
+ */
71
+ protected buildLMSErrorMessage(operation: string, details: string, systemError?: any): string;
72
+ /**
73
+ * Common enrollment status mapping
74
+ */
75
+ protected mapEnrollmentStatus(status: string): 'active' | 'completed' | 'expired' | 'suspended' | 'unknown';
76
+ }
77
+ //# sourceMappingURL=base-lms.action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-lms.action.d.ts","sourceRoot":"","sources":["../../src/base/base-lms.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAGzE;;;GAGG;AACH,8BACsB,aAAc,SAAQ,UAAU;IAClD;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAEvC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IAE3C;;OAEG;IACH,OAAO,CAAC,mBAAmB,CAAyC;IAEpE;;OAEG;IACH,SAAS,CAAC,kBAAkB,IAAI,WAAW,EAAE;IAU7C;;OAEG;cACa,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAyBlH;;;;OAIG;IACH,SAAS,CAAC,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAK7F;;OAEG;cACa,iBAAiB,CAAC,WAAW,EAAE,wBAAwB,GAAG,OAAO,CAAC;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IA2BhJ;;OAEG;cACa,aAAa,CAAC,WAAW,EAAE,wBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC;IAUrF;;OAEG;IACH,SAAS,CAAC,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,GAAG;IAKtE;;OAEG;IACH,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAI3C;;OAEG;IACH,SAAS,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAIhD;;OAEG;IACH,SAAS,CAAC,2BAA2B,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAK/E;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAcjD;;OAEG;IACH,SAAS,CAAC,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,GAAG,GAAG,MAAM;IAQ7F;;OAEG;IACH,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS;CAa9G"}
@@ -0,0 +1,176 @@
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.BaseLMSAction = void 0;
10
+ const actions_1 = require("@memberjunction/actions");
11
+ const global_1 = require("@memberjunction/global");
12
+ const core_1 = require("@memberjunction/core");
13
+ /**
14
+ * Base class for all LMS-related actions.
15
+ * Provides common functionality and patterns for interacting with Learning Management Systems.
16
+ */
17
+ let BaseLMSAction = class BaseLMSAction extends actions_1.BaseAction {
18
+ /**
19
+ * Cached company integration for the current execution
20
+ */
21
+ _companyIntegration = null;
22
+ /**
23
+ * Common LMS parameters that many actions will need
24
+ */
25
+ getCommonLMSParams() {
26
+ return [
27
+ {
28
+ Name: 'CompanyID',
29
+ Type: 'Input',
30
+ Value: null
31
+ }
32
+ ];
33
+ }
34
+ /**
35
+ * Gets the company integration record for the specified company and LMS
36
+ */
37
+ async getCompanyIntegration(companyId, contextUser) {
38
+ // Check cache first
39
+ if (this._companyIntegration && this._companyIntegration.CompanyID === companyId) {
40
+ return this._companyIntegration;
41
+ }
42
+ const rv = new core_1.RunView();
43
+ const result = await rv.RunView({
44
+ EntityName: 'Company Integrations',
45
+ ExtraFilter: `CompanyID = '${companyId}' AND Integration.Name = '${this.integrationName}'`,
46
+ ResultType: 'entity_object'
47
+ }, contextUser);
48
+ if (!result.Success) {
49
+ throw new Error(`Failed to retrieve company integration: ${result.ErrorMessage}`);
50
+ }
51
+ if (!result.Results || result.Results.length === 0) {
52
+ throw new Error(`No ${this.integrationName} integration found for company ${companyId}. Please configure the integration first.`);
53
+ }
54
+ this._companyIntegration = result.Results[0];
55
+ return this._companyIntegration;
56
+ }
57
+ /**
58
+ * Gets credentials from environment variables
59
+ * Format: BIZAPPS_{PROVIDER}_{COMPANY_ID}_{CREDENTIAL_TYPE}
60
+ * Example: BIZAPPS_LEARNWORLDS_12345_API_KEY
61
+ */
62
+ getCredentialFromEnv(companyId, credentialType) {
63
+ const envKey = `BIZAPPS_${this.lmsProvider.toUpperCase().replace(/\s+/g, '_')}_${companyId}_${credentialType.toUpperCase()}`;
64
+ return process.env[envKey];
65
+ }
66
+ /**
67
+ * Gets API credentials - first tries environment variables, then falls back to database
68
+ */
69
+ async getAPICredentials(integration) {
70
+ const companyId = integration.CompanyID;
71
+ // Try environment variables first
72
+ const envApiKey = this.getCredentialFromEnv(companyId, 'API_KEY');
73
+ const envApiSecret = this.getCredentialFromEnv(companyId, 'API_SECRET');
74
+ const envAccessToken = this.getCredentialFromEnv(companyId, 'ACCESS_TOKEN');
75
+ if (envApiKey || envAccessToken) {
76
+ return {
77
+ apiKey: envApiKey,
78
+ apiSecret: envApiSecret,
79
+ accessToken: envAccessToken
80
+ };
81
+ }
82
+ // Fall back to database (for backwards compatibility)
83
+ if (!integration.APIKey && !integration.AccessToken) {
84
+ throw new Error(`No API credentials found for ${this.integrationName} integration. Please set environment variables or configure in database.`);
85
+ }
86
+ return {
87
+ apiKey: integration.APIKey || undefined,
88
+ accessToken: integration.AccessToken || undefined
89
+ };
90
+ }
91
+ /**
92
+ * Gets the base URL for API calls
93
+ */
94
+ async getAPIBaseURL(integration) {
95
+ // Check if custom URL is stored in the integration
96
+ if (integration.CustomAttribute1) {
97
+ return integration.CustomAttribute1;
98
+ }
99
+ // Return empty string - derived classes should override this
100
+ return '';
101
+ }
102
+ /**
103
+ * Helper to get parameter value with type safety
104
+ */
105
+ getParamValue(params, paramName) {
106
+ const param = params.find(p => p.Name === paramName);
107
+ return param?.Value;
108
+ }
109
+ /**
110
+ * Standard date format for LMS systems (ISO 8601)
111
+ */
112
+ formatLMSDate(date) {
113
+ return date.toISOString();
114
+ }
115
+ /**
116
+ * Parse date from LMS format
117
+ */
118
+ parseLMSDate(dateString) {
119
+ return new Date(dateString);
120
+ }
121
+ /**
122
+ * Calculate progress percentage
123
+ */
124
+ calculateProgressPercentage(completed, total) {
125
+ if (total === 0)
126
+ return 0;
127
+ return Math.round((completed / total) * 100);
128
+ }
129
+ /**
130
+ * Format duration in seconds to human readable format
131
+ */
132
+ formatDuration(seconds) {
133
+ const hours = Math.floor(seconds / 3600);
134
+ const minutes = Math.floor((seconds % 3600) / 60);
135
+ const secs = seconds % 60;
136
+ if (hours > 0) {
137
+ return `${hours}h ${minutes}m ${secs}s`;
138
+ }
139
+ else if (minutes > 0) {
140
+ return `${minutes}m ${secs}s`;
141
+ }
142
+ else {
143
+ return `${secs}s`;
144
+ }
145
+ }
146
+ /**
147
+ * Helper to build consistent error messages for LMS operations
148
+ */
149
+ buildLMSErrorMessage(operation, details, systemError) {
150
+ let message = `LMS operation failed: ${operation}. ${details}`;
151
+ if (systemError) {
152
+ message += ` System error: ${systemError.message || systemError}`;
153
+ }
154
+ return message;
155
+ }
156
+ /**
157
+ * Common enrollment status mapping
158
+ */
159
+ mapEnrollmentStatus(status) {
160
+ const statusMap = {
161
+ 'active': 'active',
162
+ 'completed': 'completed',
163
+ 'finished': 'completed',
164
+ 'expired': 'expired',
165
+ 'suspended': 'suspended',
166
+ 'paused': 'suspended',
167
+ 'inactive': 'suspended'
168
+ };
169
+ return statusMap[status.toLowerCase()] || 'unknown';
170
+ }
171
+ };
172
+ exports.BaseLMSAction = BaseLMSAction;
173
+ exports.BaseLMSAction = BaseLMSAction = __decorate([
174
+ (0, global_1.RegisterClass)(actions_1.BaseAction, 'BaseLMSAction')
175
+ ], BaseLMSAction);
176
+ //# sourceMappingURL=base-lms.action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-lms.action.js","sourceRoot":"","sources":["../../src/base/base-lms.action.ts"],"names":[],"mappings":";;;;;;;;;AACA,qDAAqD;AACrD,mDAAuD;AAGvD,+CAAyD;AAEzD;;;GAGG;AAEI,IAAe,aAAa,GAA5B,MAAe,aAAc,SAAQ,oBAAU;IAWlD;;OAEG;IACK,mBAAmB,GAAoC,IAAI,CAAC;IAEpE;;OAEG;IACO,kBAAkB;QACxB,OAAO;YACH;gBACI,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,IAAI;aACd;SACJ,CAAC;IACN,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,qBAAqB,CAAC,SAAiB,EAAE,WAAqB;QAC1E,oBAAoB;QACpB,IAAI,IAAI,CAAC,mBAAmB,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,EAAE,WAAW;YACvB,SAAS,EAAE,SAAS;YACpB,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,WAAW;YACrB,UAAU,EAAE,WAAW;SAC1B,CAAC;QAEF,OAAO,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,SAAS,CAAC;IACxD,CAAC;CACJ,CAAA;AAxLqB,sCAAa;wBAAb,aAAa;IADlC,IAAA,sBAAa,EAAC,oBAAU,EAAE,eAAe,CAAC;GACrB,aAAa,CAwLlC"}
@@ -0,0 +1,3 @@
1
+ export * from './base/base-lms.action';
2
+ export * from './providers/learnworlds';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,wBAAwB,CAAC;AAGvC,cAAc,yBAAyB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ // Export base LMS action class
18
+ __exportStar(require("./base/base-lms.action"), exports);
19
+ // Export LearnWorlds provider
20
+ __exportStar(require("./providers/learnworlds"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+BAA+B;AAC/B,yDAAuC;AAEvC,8BAA8B;AAC9B,0DAAwC"}
@@ -0,0 +1,125 @@
1
+ import { LearnWorldsBaseAction } from '../learnworlds-base.action';
2
+ import { ActionParam, ActionResultSimple, RunActionParams } from '@memberjunction/actions-base';
3
+ /**
4
+ * Interface for a LearnWorlds course
5
+ */
6
+ export interface LearnWorldsCourse {
7
+ id: string;
8
+ title: string;
9
+ subtitle?: string;
10
+ description?: string;
11
+ shortDescription?: string;
12
+ status: 'published' | 'draft' | 'coming_soon';
13
+ visibility: 'public' | 'private' | 'hidden';
14
+ isActive: boolean;
15
+ isFree: boolean;
16
+ price?: number;
17
+ currency?: string;
18
+ originalPrice?: number;
19
+ discountPercentage?: number;
20
+ categoryId?: string;
21
+ categoryName?: string;
22
+ tags?: string[];
23
+ level?: 'beginner' | 'intermediate' | 'advanced' | 'all';
24
+ language?: string;
25
+ duration?: number;
26
+ thumbnailUrl?: string;
27
+ coverImageUrl?: string;
28
+ promoVideoUrl?: string;
29
+ instructorId?: string;
30
+ instructorName?: string;
31
+ instructorBio?: string;
32
+ instructorAvatarUrl?: string;
33
+ totalUnits: number;
34
+ totalLessons: number;
35
+ totalQuizzes: number;
36
+ totalAssignments: number;
37
+ estimatedDuration?: number;
38
+ totalEnrollments: number;
39
+ activeEnrollments: number;
40
+ completionRate: number;
41
+ averageRating?: number;
42
+ totalReviews?: number;
43
+ createdAt: Date;
44
+ updatedAt: Date;
45
+ publishedAt?: Date;
46
+ enrollmentStartDate?: Date;
47
+ enrollmentEndDate?: Date;
48
+ requiresApproval: boolean;
49
+ hasPrerequisites: boolean;
50
+ prerequisites?: string[];
51
+ certificateAvailable: boolean;
52
+ objectives?: string[];
53
+ targetAudience?: string[];
54
+ requirements?: string[];
55
+ }
56
+ /**
57
+ * Interface for course catalog summary
58
+ */
59
+ export interface CourseCatalogSummary {
60
+ totalCourses: number;
61
+ publishedCourses: number;
62
+ draftCourses: number;
63
+ freeCourses: number;
64
+ paidCourses: number;
65
+ categoryCounts: Record<string, number>;
66
+ levelCounts: Record<string, number>;
67
+ languageCounts: Record<string, number>;
68
+ enrollmentStats: {
69
+ totalEnrollments: number;
70
+ averageEnrollmentsPerCourse: number;
71
+ mostPopularCourses: Array<{
72
+ id: string;
73
+ title: string;
74
+ enrollments: number;
75
+ }>;
76
+ };
77
+ priceStats: {
78
+ averagePrice: number;
79
+ minPrice: number;
80
+ maxPrice: number;
81
+ currency: string;
82
+ };
83
+ }
84
+ /**
85
+ * Action to retrieve courses from LearnWorlds LMS
86
+ */
87
+ export declare class GetLearnWorldsCoursesAction extends LearnWorldsBaseAction {
88
+ /**
89
+ * Description of the action
90
+ */
91
+ get Description(): string;
92
+ /**
93
+ * Main execution method
94
+ */
95
+ protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
96
+ /**
97
+ * Map LearnWorlds course data to our interface
98
+ */
99
+ private mapLearnWorldsCourse;
100
+ /**
101
+ * Map course status
102
+ */
103
+ private mapCourseStatus;
104
+ /**
105
+ * Map course visibility
106
+ */
107
+ private mapCourseVisibility;
108
+ /**
109
+ * Map course level
110
+ */
111
+ private mapCourseLevel;
112
+ /**
113
+ * Calculate discount percentage
114
+ */
115
+ private calculateDiscountPercentage;
116
+ /**
117
+ * Calculate course catalog summary
118
+ */
119
+ private calculateCourseCatalogSummary;
120
+ /**
121
+ * Define the parameters for this action
122
+ */
123
+ get Params(): ActionParam[];
124
+ }
125
+ //# sourceMappingURL=get-courses.action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-courses.action.d.ts","sourceRoot":"","sources":["../../../../src/providers/learnworlds/actions/get-courses.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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