@project-sunbird/collection-editor-react 1.0.0 → 1.0.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 (108) hide show
  1. package/README.md +55 -0
  2. package/dist/api/content.d.ts +1 -1
  3. package/dist/api/framework.d.ts +0 -1
  4. package/dist/api/hierarchy.d.ts +7 -1
  5. package/dist/collection-editor.umd.js +144 -104
  6. package/dist/components/AssetBrowser/AssetBrowser.d.ts +0 -1
  7. package/dist/components/AssignPageNumber/AssignPageNumber.d.ts +0 -1
  8. package/dist/components/BulkUpload/CsvUpload.d.ts +0 -1
  9. package/dist/components/Collaborators/ManageCollaborators.d.ts +0 -1
  10. package/dist/components/CollectionEditor/CollectionEditor.d.ts +0 -1
  11. package/dist/components/ContentPlayer/ContentPlayer.d.ts +0 -1
  12. package/dist/components/ContextualEditor/AssessmentDetailPanel.d.ts +7 -0
  13. package/dist/components/ContextualEditor/Breadcrumb.d.ts +0 -1
  14. package/dist/components/ContextualEditor/ContentEditForm.d.ts +0 -1
  15. package/dist/components/ContextualEditor/ContextualEditor.d.ts +0 -1
  16. package/dist/components/ContextualEditor/TabBar.d.ts +0 -1
  17. package/dist/components/ContextualEditor/TitleAppIcon.d.ts +0 -1
  18. package/dist/components/Dialcode/DialcodePanel.d.ts +0 -1
  19. package/dist/components/LibraryDock/FilterChips.d.ts +0 -1
  20. package/dist/components/LibraryDock/LibraryCard.d.ts +0 -1
  21. package/dist/components/LibraryDock/LibraryDock.d.ts +0 -1
  22. package/dist/components/LibraryDock/LibraryFilterPanel.d.ts +0 -1
  23. package/dist/components/LibraryDock/LibraryPreviewPanel.d.ts +0 -1
  24. package/dist/components/OutlineTree/OutlineTree.d.ts +0 -1
  25. package/dist/components/OutlineTree/TreeNode.d.ts +0 -1
  26. package/dist/components/ProgressStatus/ProgressStatus.d.ts +0 -1
  27. package/dist/components/ResourceReorder/ResourceReorderDialog.d.ts +0 -1
  28. package/dist/components/SparkMetaForm/FormSection.d.ts +0 -1
  29. package/dist/components/SparkMetaForm/SparkMetaForm.d.ts +0 -1
  30. package/dist/components/SparkMetaForm/fields/AppIconField.d.ts +0 -1
  31. package/dist/components/SparkMetaForm/fields/AppIconPickerModal.d.ts +0 -1
  32. package/dist/components/SparkMetaForm/fields/ChipGroupField.d.ts +0 -1
  33. package/dist/components/SparkMetaForm/fields/DateTimeField.d.ts +0 -1
  34. package/dist/components/SparkMetaForm/fields/DialcodeInputField.d.ts +0 -1
  35. package/dist/components/SparkMetaForm/fields/KeywordSuggestField.d.ts +0 -1
  36. package/dist/components/SparkMetaForm/fields/LicenseSelectField.d.ts +0 -1
  37. package/dist/components/SparkMetaForm/fields/MultiSelectField.d.ts +0 -1
  38. package/dist/components/SparkMetaForm/fields/NestedSelectField.d.ts +0 -1
  39. package/dist/components/SparkMetaForm/fields/PolicyCardField.d.ts +9 -0
  40. package/dist/components/SparkMetaForm/fields/RadioField.d.ts +0 -1
  41. package/dist/components/SparkMetaForm/fields/SelectField.d.ts +0 -1
  42. package/dist/components/SparkMetaForm/fields/TextField.d.ts +0 -1
  43. package/dist/components/SparkMetaForm/hooks/useCascade.d.ts +0 -1
  44. package/dist/components/SparkMetaForm/hooks/useFieldPrepare.d.ts +9 -1
  45. package/dist/components/SparkMetaForm/hooks/useFieldPrepare.learningPath.test.d.ts +1 -0
  46. package/dist/components/SplitBuilderShell/SplitBuilderShell.d.ts +0 -1
  47. package/dist/components/Topbar/Topbar.d.ts +0 -1
  48. package/dist/components/UnitContentList/AssessmentSlotItem.d.ts +7 -0
  49. package/dist/components/UnitContentList/ContentRow.d.ts +0 -1
  50. package/dist/components/UnitContentList/SkillPicker.d.ts +15 -0
  51. package/dist/components/UnitContentList/UnitContentList.d.ts +1 -1
  52. package/dist/components/modals/ConfirmDialog.d.ts +0 -1
  53. package/dist/components/modals/PublishChecklist.d.ts +0 -1
  54. package/dist/components/modals/QualityParamsModal.d.ts +0 -1
  55. package/dist/components/modals/UnsavedChangesModal.d.ts +0 -1
  56. package/dist/components/shared/Button.d.ts +0 -1
  57. package/dist/components/shared/Card.d.ts +0 -1
  58. package/dist/components/shared/Chip.d.ts +0 -1
  59. package/dist/components/shared/CourseDetailsPanel.d.ts +11 -0
  60. package/dist/components/shared/DropZone.d.ts +0 -1
  61. package/dist/components/shared/LanguageSelector/LanguageSelector.d.ts +0 -1
  62. package/dist/components/shared/LearningPathIcon.d.ts +6 -0
  63. package/dist/components/shared/Spinner.d.ts +0 -1
  64. package/dist/components/shared/index.d.ts +2 -0
  65. package/dist/dev-mock-api.d.ts +1 -0
  66. package/dist/hooks/useAssessmentSlots.d.ts +16 -0
  67. package/dist/hooks/useChannelData.d.ts +0 -1
  68. package/dist/hooks/useContentType.d.ts +0 -1
  69. package/dist/hooks/useEditorInit.d.ts +0 -1
  70. package/dist/hooks/useFramework.d.ts +0 -1
  71. package/dist/hooks/useLabels.d.ts +0 -1
  72. package/dist/hooks/useLibrary.d.ts +30 -1
  73. package/dist/hooks/useLibrary.test.d.ts +1 -0
  74. package/dist/hooks/useLibraryTargetLabel.d.ts +1 -0
  75. package/dist/hooks/useQumlContent.d.ts +0 -1
  76. package/dist/hooks/useSaveHierarchy.d.ts +6 -0
  77. package/dist/hooks/useSaveHierarchy.test.d.ts +1 -0
  78. package/dist/hooks/useSkillCategory.d.ts +24 -0
  79. package/dist/hooks/useSkillCategory.test.d.ts +1 -0
  80. package/dist/hooks/useSkillScope.d.ts +14 -0
  81. package/dist/hooks/useSkillScope.test.d.ts +1 -0
  82. package/dist/hooks/useToolbarActions.d.ts +0 -1
  83. package/dist/hooks/useTree.d.ts +0 -1
  84. package/dist/i18n/index.d.ts +0 -1
  85. package/dist/i18n/locales/ar.json.d.ts +92 -0
  86. package/dist/i18n/locales/en.json.d.ts +92 -0
  87. package/dist/i18n/locales/fr.json.d.ts +92 -0
  88. package/dist/i18n/locales/pt.json.d.ts +92 -0
  89. package/dist/index.cjs +144 -104
  90. package/dist/index.d.ts +1 -0
  91. package/dist/index.js +10861 -11055
  92. package/dist/services/quml/QumlPlayerService.d.ts +0 -1
  93. package/dist/store/editor.store.d.ts +3 -1
  94. package/dist/store/i18n.store.d.ts +0 -1
  95. package/dist/store/library.store.d.ts +0 -1
  96. package/dist/store/tree.store.d.ts +8 -3
  97. package/dist/store/tree.store.learningPath.test.d.ts +1 -0
  98. package/dist/store/ui.store.d.ts +2 -0
  99. package/dist/style.css +1 -1
  100. package/dist/types/content.d.ts +2 -0
  101. package/dist/types/framework.d.ts +4 -0
  102. package/dist/types/profile.d.ts +30 -0
  103. package/dist/types/profile.test.d.ts +1 -0
  104. package/dist/utils/lpStructure.d.ts +151 -0
  105. package/dist/utils/lpStructure.test.d.ts +1 -0
  106. package/dist/utils/validateRequiredFields.d.ts +0 -1
  107. package/dist/web-component/configRoundTrip.test.d.ts +1 -0
  108. package/package.json +13 -4
package/README.md CHANGED
@@ -90,6 +90,61 @@ registerCollectionEditor('my-collection-editor');
90
90
 
91
91
  ---
92
92
 
93
+ ## Learning Path profile
94
+
95
+ Setting `config.primaryCategory` to `'Learning Path'` switches the editor into the **Learning Path**
96
+ profile — a config-driven variant of the same editor, not a fork. Everything else about the public
97
+ API (props, events, `apiBaseUrl`, the web component) is unchanged; the profile only affects internal
98
+ behavior:
99
+
100
+ - The hierarchy is `Learning Path → Level → Course`. Levels are the only unit type (`maxDepth: 1`);
101
+ Courses are linked whole as leaves, never authored inline.
102
+ - The path's first and last Level are the **Prior** and **Outcome Assessment** slots — ordinary
103
+ Levels wrapping a single question-set-only Course, rendered by `OutlineTree` as pinned rows above
104
+ and below the Level list rather than as regular tree rows.
105
+ - A Level's skill scope comes from the Prior Assessment's own skill tags (never from linked courses);
106
+ with no Prior Assessment linked, Levels fall back to manual selection from the active framework's
107
+ skill-equivalent category.
108
+ - CSV bulk upload, dial codes, and inline Course preview are disabled for this profile; publish is
109
+ gated by the derived structural rules (see `IEditorProfile`) instead of a manual checklist.
110
+
111
+ ```tsx
112
+ import { CollectionEditor } from '@project-sunbird/collection-editor-react';
113
+ import '@project-sunbird/collection-editor-react/dist/style.css';
114
+
115
+ const learningPathConfig = {
116
+ context: {
117
+ authToken: 'your-bearer-token',
118
+ userId: 'user-id',
119
+ sid: 'session-id',
120
+ did: 'device-id',
121
+ channel: 'channel-id',
122
+ pdata: { id: 'your.app.id', ver: '1.0' },
123
+ env: 'collection_editor',
124
+ identifier: 'do_lp_123456789',
125
+ contentId: 'do_lp_123456789',
126
+ framework: 'USF',
127
+ },
128
+ config: {
129
+ mode: 'edit',
130
+ objectType: 'Collection',
131
+ primaryCategory: 'Learning Path', // the only switch — everything else is resolved from this
132
+ },
133
+ };
134
+
135
+ export default function App() {
136
+ return <CollectionEditor {...learningPathConfig} />;
137
+ }
138
+ ```
139
+
140
+ The equivalent web-component usage is identical to the standard flow — just set
141
+ `primaryCategory: 'Learning Path'` in the JSON passed to `el.config`.
142
+
143
+ `IEditorProfile` (exported for advanced integrations that need to introspect the active profile,
144
+ e.g. `unitLabelKey`/`features` for a custom host toolbar) is re-exported from the package root.
145
+
146
+ ---
147
+
93
148
  ## API
94
149
 
95
150
  ### `<CollectionEditor>` props
@@ -1,5 +1,5 @@
1
1
  import { IContent } from '../types/content';
2
-
2
+ export declare const DEFAULT_SEARCH_FIELDS: string[];
3
3
  export declare function compositeSearch(params: {
4
4
  filters?: Record<string, unknown>;
5
5
  query?: string;
@@ -1,5 +1,4 @@
1
1
  import { IFramework, ITerm } from '../types/framework';
2
-
3
2
  export declare function getFramework(frameworkId: string): Promise<IFramework>;
4
3
  export declare function searchTerms(frameworkId: string, categoryCode: string, query?: string): Promise<ITerm[]>;
5
4
  export interface IFrameworkSearchResult {
@@ -1,5 +1,4 @@
1
1
  import { INode } from '../types/editor';
2
-
3
2
  export declare function mapToINode(raw: unknown, parentId?: string): INode;
4
3
  export declare function readHierarchy(contentId: string): Promise<{
5
4
  content: Record<string, unknown>;
@@ -19,6 +18,13 @@ export declare function updateHierarchy(_contentId: string, nodesModified: Recor
19
18
  identifiers?: Record<string, string>;
20
19
  }>;
21
20
  export declare function publishContent(contentId: string, lastPublishedBy?: string): Promise<void>;
21
+ /**
22
+ * Reads a Course's own hierarchy — used by the Learning Path editor to detect
23
+ * assessment courses (Courses whose leaves are all QuML Question Sets, see
24
+ * src/utils/lpStructure.ts). No metadata marker exists for this today, so the
25
+ * pre/post assessment slot must read the course tree on selection.
26
+ */
27
+ export declare function readCourseHierarchy(courseId: string): Promise<Record<string, unknown>>;
22
28
  export declare function readContent(contentId: string): Promise<Record<string, unknown>>;
23
29
  export declare function sendForReview(contentId: string): Promise<void>;
24
30
  export declare function rejectContent(contentId: string, comment: string): Promise<void>;