@contractspec/module.learning-journey 2.3.0 → 2.5.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 (52) hide show
  1. package/dist/browser/engines/index.js +149 -0
  2. package/dist/browser/engines/xp.js +149 -0
  3. package/dist/browser/entities/index.js +4 -0
  4. package/dist/browser/entities/learner.js +4 -0
  5. package/dist/browser/i18n/catalogs/en.js +43 -0
  6. package/dist/browser/i18n/catalogs/es.js +43 -0
  7. package/dist/browser/i18n/catalogs/fr.js +43 -0
  8. package/dist/browser/i18n/catalogs/index.js +127 -0
  9. package/dist/browser/i18n/index.js +169 -0
  10. package/dist/browser/i18n/keys.js +16 -0
  11. package/dist/browser/i18n/locale.js +13 -0
  12. package/dist/browser/i18n/messages.js +139 -0
  13. package/dist/browser/index.js +153 -0
  14. package/dist/engines/index.js +149 -0
  15. package/dist/engines/xp.d.ts +7 -0
  16. package/dist/engines/xp.js +149 -0
  17. package/dist/entities/index.d.ts +1 -0
  18. package/dist/entities/index.js +4 -0
  19. package/dist/entities/learner.d.ts +2 -0
  20. package/dist/entities/learner.js +4 -0
  21. package/dist/i18n/catalogs/en.d.ts +6 -0
  22. package/dist/i18n/catalogs/en.js +44 -0
  23. package/dist/i18n/catalogs/es.d.ts +6 -0
  24. package/dist/i18n/catalogs/es.js +44 -0
  25. package/dist/i18n/catalogs/fr.d.ts +6 -0
  26. package/dist/i18n/catalogs/fr.js +44 -0
  27. package/dist/i18n/catalogs/index.d.ts +8 -0
  28. package/dist/i18n/catalogs/index.js +128 -0
  29. package/dist/i18n/i18n.test.d.ts +1 -0
  30. package/dist/i18n/index.d.ts +14 -0
  31. package/dist/i18n/index.js +170 -0
  32. package/dist/i18n/keys.d.ts +25 -0
  33. package/dist/i18n/keys.js +17 -0
  34. package/dist/i18n/locale.d.ts +8 -0
  35. package/dist/i18n/locale.js +14 -0
  36. package/dist/i18n/messages.d.ts +14 -0
  37. package/dist/i18n/messages.js +140 -0
  38. package/dist/index.js +153 -0
  39. package/dist/node/engines/index.js +149 -0
  40. package/dist/node/engines/xp.js +149 -0
  41. package/dist/node/entities/index.js +4 -0
  42. package/dist/node/entities/learner.js +4 -0
  43. package/dist/node/i18n/catalogs/en.js +43 -0
  44. package/dist/node/i18n/catalogs/es.js +43 -0
  45. package/dist/node/i18n/catalogs/fr.js +43 -0
  46. package/dist/node/i18n/catalogs/index.js +127 -0
  47. package/dist/node/i18n/index.js +169 -0
  48. package/dist/node/i18n/keys.js +16 -0
  49. package/dist/node/i18n/locale.js +13 -0
  50. package/dist/node/i18n/messages.js +139 -0
  51. package/dist/node/index.js +153 -0
  52. package/package.json +146 -5
@@ -1,4 +1,139 @@
1
1
  // @bun
2
+ // src/i18n/catalogs/en.ts
3
+ import { defineTranslation } from "@contractspec/lib.contracts-spec/translations";
4
+ var enMessages = defineTranslation({
5
+ meta: {
6
+ key: "learning-journey.messages",
7
+ version: "1.0.0",
8
+ domain: "learning-journey",
9
+ description: "XP source labels for the learning-journey module",
10
+ owners: ["platform"],
11
+ stability: "experimental"
12
+ },
13
+ locale: "en",
14
+ fallback: "en",
15
+ messages: {
16
+ "xp.source.base": {
17
+ value: "Base",
18
+ description: "XP breakdown label for base XP"
19
+ },
20
+ "xp.source.scoreBonus": {
21
+ value: "Score Bonus",
22
+ description: "XP breakdown label for score-based bonus"
23
+ },
24
+ "xp.source.perfectScore": {
25
+ value: "Perfect Score",
26
+ description: "XP breakdown label for perfect score bonus"
27
+ },
28
+ "xp.source.firstAttempt": {
29
+ value: "First Attempt",
30
+ description: "XP breakdown label for first attempt bonus"
31
+ },
32
+ "xp.source.retryPenalty": {
33
+ value: "Retry Penalty",
34
+ description: "XP breakdown label for retry penalty"
35
+ },
36
+ "xp.source.streakBonus": {
37
+ value: "Streak Bonus",
38
+ description: "XP breakdown label for streak bonus"
39
+ }
40
+ }
41
+ });
42
+
43
+ // src/i18n/catalogs/fr.ts
44
+ import { defineTranslation as defineTranslation2 } from "@contractspec/lib.contracts-spec/translations";
45
+ var frMessages = defineTranslation2({
46
+ meta: {
47
+ key: "learning-journey.messages",
48
+ version: "1.0.0",
49
+ domain: "learning-journey",
50
+ description: "XP source labels (French)",
51
+ owners: ["platform"],
52
+ stability: "experimental"
53
+ },
54
+ locale: "fr",
55
+ fallback: "en",
56
+ messages: {
57
+ "xp.source.base": {
58
+ value: "Base",
59
+ description: "XP breakdown label for base XP"
60
+ },
61
+ "xp.source.scoreBonus": {
62
+ value: "Bonus de score",
63
+ description: "XP breakdown label for score-based bonus"
64
+ },
65
+ "xp.source.perfectScore": {
66
+ value: "Score parfait",
67
+ description: "XP breakdown label for perfect score bonus"
68
+ },
69
+ "xp.source.firstAttempt": {
70
+ value: "Premier essai",
71
+ description: "XP breakdown label for first attempt bonus"
72
+ },
73
+ "xp.source.retryPenalty": {
74
+ value: "P\xE9nalit\xE9 de r\xE9essai",
75
+ description: "XP breakdown label for retry penalty"
76
+ },
77
+ "xp.source.streakBonus": {
78
+ value: "Bonus de s\xE9rie",
79
+ description: "XP breakdown label for streak bonus"
80
+ }
81
+ }
82
+ });
83
+
84
+ // src/i18n/catalogs/es.ts
85
+ import { defineTranslation as defineTranslation3 } from "@contractspec/lib.contracts-spec/translations";
86
+ var esMessages = defineTranslation3({
87
+ meta: {
88
+ key: "learning-journey.messages",
89
+ version: "1.0.0",
90
+ domain: "learning-journey",
91
+ description: "XP source labels (Spanish)",
92
+ owners: ["platform"],
93
+ stability: "experimental"
94
+ },
95
+ locale: "es",
96
+ fallback: "en",
97
+ messages: {
98
+ "xp.source.base": {
99
+ value: "Base",
100
+ description: "XP breakdown label for base XP"
101
+ },
102
+ "xp.source.scoreBonus": {
103
+ value: "Bonificaci\xF3n por puntuaci\xF3n",
104
+ description: "XP breakdown label for score-based bonus"
105
+ },
106
+ "xp.source.perfectScore": {
107
+ value: "Puntuaci\xF3n perfecta",
108
+ description: "XP breakdown label for perfect score bonus"
109
+ },
110
+ "xp.source.firstAttempt": {
111
+ value: "Primer intento",
112
+ description: "XP breakdown label for first attempt bonus"
113
+ },
114
+ "xp.source.retryPenalty": {
115
+ value: "Penalizaci\xF3n por reintento",
116
+ description: "XP breakdown label for retry penalty"
117
+ },
118
+ "xp.source.streakBonus": {
119
+ value: "Bonificaci\xF3n por racha",
120
+ description: "XP breakdown label for streak bonus"
121
+ }
122
+ }
123
+ });
124
+
125
+ // src/i18n/messages.ts
126
+ import {
127
+ createI18nFactory
128
+ } from "@contractspec/lib.contracts-spec/translations";
129
+ var factory = createI18nFactory({
130
+ specKey: "learning-journey.messages",
131
+ catalogs: [enMessages, frMessages, esMessages]
132
+ });
133
+ var createLearningJourneyI18n = factory.create;
134
+ var getDefaultI18n = factory.getDefault;
135
+ var resetI18nRegistry = factory.resetRegistry;
136
+
2
137
  // src/engines/xp.ts
3
138
  var DEFAULT_XP_CONFIG = {
4
139
  baseValues: {
@@ -164,9 +299,23 @@ class XPEngine {
164
299
  return 0;
165
300
  }
166
301
  }
302
+ var SOURCE_KEY_MAP = {
303
+ base: "xp.source.base",
304
+ score_bonus: "xp.source.scoreBonus",
305
+ perfect_score: "xp.source.perfectScore",
306
+ first_attempt: "xp.source.firstAttempt",
307
+ retry_penalty: "xp.source.retryPenalty",
308
+ streak_bonus: "xp.source.streakBonus"
309
+ };
310
+ function getXpSourceLabel(source, locale) {
311
+ const i18n = createLearningJourneyI18n(locale);
312
+ const i18nKey = SOURCE_KEY_MAP[source];
313
+ return i18nKey ? i18n.t(i18nKey) : source;
314
+ }
167
315
  var xpEngine = new XPEngine;
168
316
  export {
169
317
  xpEngine,
318
+ getXpSourceLabel,
170
319
  XPEngine,
171
320
  DEFAULT_XP_CONFIG
172
321
  };
@@ -92,6 +92,7 @@ export declare const learningJourneyEntities: (import("@contractspec/lib.schema"
92
92
  currentStreak: import("@contractspec/lib.schema").EntityScalarField;
93
93
  longestStreak: import("@contractspec/lib.schema").EntityScalarField;
94
94
  lastActivityAt: import("@contractspec/lib.schema").EntityScalarField;
95
+ locale: import("@contractspec/lib.schema").EntityScalarField;
95
96
  timezone: import("@contractspec/lib.schema").EntityScalarField;
96
97
  dailyGoalXp: import("@contractspec/lib.schema").EntityScalarField;
97
98
  reminderEnabled: import("@contractspec/lib.schema").EntityScalarField;
@@ -1192,6 +1192,10 @@ var LearnerEntity = defineEntity5({
1192
1192
  isOptional: true,
1193
1193
  description: "Last learning activity"
1194
1194
  }),
1195
+ locale: field5.string({
1196
+ isOptional: true,
1197
+ description: 'Preferred locale for learning content (e.g. "en", "fr", "es")'
1198
+ }),
1195
1199
  timezone: field5.string({
1196
1200
  default: '"UTC"',
1197
1201
  description: "Learner timezone"
@@ -20,6 +20,7 @@ export declare const LearnerEntity: import("@contractspec/lib.schema").EntitySpe
20
20
  currentStreak: import("@contractspec/lib.schema").EntityScalarField;
21
21
  longestStreak: import("@contractspec/lib.schema").EntityScalarField;
22
22
  lastActivityAt: import("@contractspec/lib.schema").EntityScalarField;
23
+ locale: import("@contractspec/lib.schema").EntityScalarField;
23
24
  timezone: import("@contractspec/lib.schema").EntityScalarField;
24
25
  dailyGoalXp: import("@contractspec/lib.schema").EntityScalarField;
25
26
  reminderEnabled: import("@contractspec/lib.schema").EntityScalarField;
@@ -131,6 +132,7 @@ export declare const learnerEntities: (import("@contractspec/lib.schema").Entity
131
132
  currentStreak: import("@contractspec/lib.schema").EntityScalarField;
132
133
  longestStreak: import("@contractspec/lib.schema").EntityScalarField;
133
134
  lastActivityAt: import("@contractspec/lib.schema").EntityScalarField;
135
+ locale: import("@contractspec/lib.schema").EntityScalarField;
134
136
  timezone: import("@contractspec/lib.schema").EntityScalarField;
135
137
  dailyGoalXp: import("@contractspec/lib.schema").EntityScalarField;
136
138
  reminderEnabled: import("@contractspec/lib.schema").EntityScalarField;
@@ -52,6 +52,10 @@ var LearnerEntity = defineEntity({
52
52
  isOptional: true,
53
53
  description: "Last learning activity"
54
54
  }),
55
+ locale: field.string({
56
+ isOptional: true,
57
+ description: 'Preferred locale for learning content (e.g. "en", "fr", "es")'
58
+ }),
55
59
  timezone: field.string({
56
60
  default: '"UTC"',
57
61
  description: "Learner timezone"
@@ -0,0 +1,6 @@
1
+ /**
2
+ * English (en) translation catalog for @contractspec/module.learning-journey.
3
+ *
4
+ * @module i18n/catalogs/en
5
+ */
6
+ export declare const enMessages: import("@contractspec/lib.contracts-spec/translations").TranslationSpec;
@@ -0,0 +1,44 @@
1
+ // @bun
2
+ // src/i18n/catalogs/en.ts
3
+ import { defineTranslation } from "@contractspec/lib.contracts-spec/translations";
4
+ var enMessages = defineTranslation({
5
+ meta: {
6
+ key: "learning-journey.messages",
7
+ version: "1.0.0",
8
+ domain: "learning-journey",
9
+ description: "XP source labels for the learning-journey module",
10
+ owners: ["platform"],
11
+ stability: "experimental"
12
+ },
13
+ locale: "en",
14
+ fallback: "en",
15
+ messages: {
16
+ "xp.source.base": {
17
+ value: "Base",
18
+ description: "XP breakdown label for base XP"
19
+ },
20
+ "xp.source.scoreBonus": {
21
+ value: "Score Bonus",
22
+ description: "XP breakdown label for score-based bonus"
23
+ },
24
+ "xp.source.perfectScore": {
25
+ value: "Perfect Score",
26
+ description: "XP breakdown label for perfect score bonus"
27
+ },
28
+ "xp.source.firstAttempt": {
29
+ value: "First Attempt",
30
+ description: "XP breakdown label for first attempt bonus"
31
+ },
32
+ "xp.source.retryPenalty": {
33
+ value: "Retry Penalty",
34
+ description: "XP breakdown label for retry penalty"
35
+ },
36
+ "xp.source.streakBonus": {
37
+ value: "Streak Bonus",
38
+ description: "XP breakdown label for streak bonus"
39
+ }
40
+ }
41
+ });
42
+ export {
43
+ enMessages
44
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Spanish (es) translation catalog for @contractspec/module.learning-journey.
3
+ *
4
+ * @module i18n/catalogs/es
5
+ */
6
+ export declare const esMessages: import("@contractspec/lib.contracts-spec/translations").TranslationSpec;
@@ -0,0 +1,44 @@
1
+ // @bun
2
+ // src/i18n/catalogs/es.ts
3
+ import { defineTranslation } from "@contractspec/lib.contracts-spec/translations";
4
+ var esMessages = defineTranslation({
5
+ meta: {
6
+ key: "learning-journey.messages",
7
+ version: "1.0.0",
8
+ domain: "learning-journey",
9
+ description: "XP source labels (Spanish)",
10
+ owners: ["platform"],
11
+ stability: "experimental"
12
+ },
13
+ locale: "es",
14
+ fallback: "en",
15
+ messages: {
16
+ "xp.source.base": {
17
+ value: "Base",
18
+ description: "XP breakdown label for base XP"
19
+ },
20
+ "xp.source.scoreBonus": {
21
+ value: "Bonificaci\xF3n por puntuaci\xF3n",
22
+ description: "XP breakdown label for score-based bonus"
23
+ },
24
+ "xp.source.perfectScore": {
25
+ value: "Puntuaci\xF3n perfecta",
26
+ description: "XP breakdown label for perfect score bonus"
27
+ },
28
+ "xp.source.firstAttempt": {
29
+ value: "Primer intento",
30
+ description: "XP breakdown label for first attempt bonus"
31
+ },
32
+ "xp.source.retryPenalty": {
33
+ value: "Penalizaci\xF3n por reintento",
34
+ description: "XP breakdown label for retry penalty"
35
+ },
36
+ "xp.source.streakBonus": {
37
+ value: "Bonificaci\xF3n por racha",
38
+ description: "XP breakdown label for streak bonus"
39
+ }
40
+ }
41
+ });
42
+ export {
43
+ esMessages
44
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * French (fr) translation catalog for @contractspec/module.learning-journey.
3
+ *
4
+ * @module i18n/catalogs/fr
5
+ */
6
+ export declare const frMessages: import("@contractspec/lib.contracts-spec/translations").TranslationSpec;
@@ -0,0 +1,44 @@
1
+ // @bun
2
+ // src/i18n/catalogs/fr.ts
3
+ import { defineTranslation } from "@contractspec/lib.contracts-spec/translations";
4
+ var frMessages = defineTranslation({
5
+ meta: {
6
+ key: "learning-journey.messages",
7
+ version: "1.0.0",
8
+ domain: "learning-journey",
9
+ description: "XP source labels (French)",
10
+ owners: ["platform"],
11
+ stability: "experimental"
12
+ },
13
+ locale: "fr",
14
+ fallback: "en",
15
+ messages: {
16
+ "xp.source.base": {
17
+ value: "Base",
18
+ description: "XP breakdown label for base XP"
19
+ },
20
+ "xp.source.scoreBonus": {
21
+ value: "Bonus de score",
22
+ description: "XP breakdown label for score-based bonus"
23
+ },
24
+ "xp.source.perfectScore": {
25
+ value: "Score parfait",
26
+ description: "XP breakdown label for perfect score bonus"
27
+ },
28
+ "xp.source.firstAttempt": {
29
+ value: "Premier essai",
30
+ description: "XP breakdown label for first attempt bonus"
31
+ },
32
+ "xp.source.retryPenalty": {
33
+ value: "P\xE9nalit\xE9 de r\xE9essai",
34
+ description: "XP breakdown label for retry penalty"
35
+ },
36
+ "xp.source.streakBonus": {
37
+ value: "Bonus de s\xE9rie",
38
+ description: "XP breakdown label for streak bonus"
39
+ }
40
+ }
41
+ });
42
+ export {
43
+ frMessages
44
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Translation catalog barrel exports.
3
+ *
4
+ * @module i18n/catalogs
5
+ */
6
+ export { enMessages } from './en';
7
+ export { frMessages } from './fr';
8
+ export { esMessages } from './es';
@@ -0,0 +1,128 @@
1
+ // @bun
2
+ // src/i18n/catalogs/en.ts
3
+ import { defineTranslation } from "@contractspec/lib.contracts-spec/translations";
4
+ var enMessages = defineTranslation({
5
+ meta: {
6
+ key: "learning-journey.messages",
7
+ version: "1.0.0",
8
+ domain: "learning-journey",
9
+ description: "XP source labels for the learning-journey module",
10
+ owners: ["platform"],
11
+ stability: "experimental"
12
+ },
13
+ locale: "en",
14
+ fallback: "en",
15
+ messages: {
16
+ "xp.source.base": {
17
+ value: "Base",
18
+ description: "XP breakdown label for base XP"
19
+ },
20
+ "xp.source.scoreBonus": {
21
+ value: "Score Bonus",
22
+ description: "XP breakdown label for score-based bonus"
23
+ },
24
+ "xp.source.perfectScore": {
25
+ value: "Perfect Score",
26
+ description: "XP breakdown label for perfect score bonus"
27
+ },
28
+ "xp.source.firstAttempt": {
29
+ value: "First Attempt",
30
+ description: "XP breakdown label for first attempt bonus"
31
+ },
32
+ "xp.source.retryPenalty": {
33
+ value: "Retry Penalty",
34
+ description: "XP breakdown label for retry penalty"
35
+ },
36
+ "xp.source.streakBonus": {
37
+ value: "Streak Bonus",
38
+ description: "XP breakdown label for streak bonus"
39
+ }
40
+ }
41
+ });
42
+
43
+ // src/i18n/catalogs/fr.ts
44
+ import { defineTranslation as defineTranslation2 } from "@contractspec/lib.contracts-spec/translations";
45
+ var frMessages = defineTranslation2({
46
+ meta: {
47
+ key: "learning-journey.messages",
48
+ version: "1.0.0",
49
+ domain: "learning-journey",
50
+ description: "XP source labels (French)",
51
+ owners: ["platform"],
52
+ stability: "experimental"
53
+ },
54
+ locale: "fr",
55
+ fallback: "en",
56
+ messages: {
57
+ "xp.source.base": {
58
+ value: "Base",
59
+ description: "XP breakdown label for base XP"
60
+ },
61
+ "xp.source.scoreBonus": {
62
+ value: "Bonus de score",
63
+ description: "XP breakdown label for score-based bonus"
64
+ },
65
+ "xp.source.perfectScore": {
66
+ value: "Score parfait",
67
+ description: "XP breakdown label for perfect score bonus"
68
+ },
69
+ "xp.source.firstAttempt": {
70
+ value: "Premier essai",
71
+ description: "XP breakdown label for first attempt bonus"
72
+ },
73
+ "xp.source.retryPenalty": {
74
+ value: "P\xE9nalit\xE9 de r\xE9essai",
75
+ description: "XP breakdown label for retry penalty"
76
+ },
77
+ "xp.source.streakBonus": {
78
+ value: "Bonus de s\xE9rie",
79
+ description: "XP breakdown label for streak bonus"
80
+ }
81
+ }
82
+ });
83
+
84
+ // src/i18n/catalogs/es.ts
85
+ import { defineTranslation as defineTranslation3 } from "@contractspec/lib.contracts-spec/translations";
86
+ var esMessages = defineTranslation3({
87
+ meta: {
88
+ key: "learning-journey.messages",
89
+ version: "1.0.0",
90
+ domain: "learning-journey",
91
+ description: "XP source labels (Spanish)",
92
+ owners: ["platform"],
93
+ stability: "experimental"
94
+ },
95
+ locale: "es",
96
+ fallback: "en",
97
+ messages: {
98
+ "xp.source.base": {
99
+ value: "Base",
100
+ description: "XP breakdown label for base XP"
101
+ },
102
+ "xp.source.scoreBonus": {
103
+ value: "Bonificaci\xF3n por puntuaci\xF3n",
104
+ description: "XP breakdown label for score-based bonus"
105
+ },
106
+ "xp.source.perfectScore": {
107
+ value: "Puntuaci\xF3n perfecta",
108
+ description: "XP breakdown label for perfect score bonus"
109
+ },
110
+ "xp.source.firstAttempt": {
111
+ value: "Primer intento",
112
+ description: "XP breakdown label for first attempt bonus"
113
+ },
114
+ "xp.source.retryPenalty": {
115
+ value: "Penalizaci\xF3n por reintento",
116
+ description: "XP breakdown label for retry penalty"
117
+ },
118
+ "xp.source.streakBonus": {
119
+ value: "Bonificaci\xF3n por racha",
120
+ description: "XP breakdown label for streak bonus"
121
+ }
122
+ }
123
+ });
124
+ export {
125
+ frMessages,
126
+ esMessages,
127
+ enMessages
128
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Internationalization (i18n) module for @contractspec/module.learning-journey.
3
+ *
4
+ * @module i18n
5
+ */
6
+ export { createLearningJourneyI18n, getDefaultI18n, resetI18nRegistry, } from './messages';
7
+ export type { LearningJourneyI18n } from './messages';
8
+ export { resolveLocale, isSupportedLocale, DEFAULT_LOCALE, SUPPORTED_LOCALES, } from './locale';
9
+ export type { SupportedLocale } from './locale';
10
+ export { I18N_KEYS, XP_SOURCE_KEYS } from './keys';
11
+ export type { LearningJourneyMessageKey } from './keys';
12
+ export { enMessages } from './catalogs/en';
13
+ export { frMessages } from './catalogs/fr';
14
+ export { esMessages } from './catalogs/es';