@edx/frontend-app-subscription-learner-dashboard 1.21.0 → 1.22.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/dist/providers.js CHANGED
@@ -1,8 +1,10 @@
1
1
  import GlobalDataProvider from './data/contexts/GlobalDataProvider';
2
2
  import { MasqueradeProvider } from './data/context/MasqueradeProvider';
3
+ import { ProgressiveProfilingQuizProvider } from './widgets/ProgressiveProfilingQuiz';
3
4
  const providers = [
4
5
  GlobalDataProvider,
5
6
  MasqueradeProvider,
7
+ ProgressiveProfilingQuizProvider,
6
8
  ];
7
9
  export default providers;
8
10
  //# sourceMappingURL=providers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"providers.js","sourceRoot":"","sources":["../src/providers.ts"],"names":[],"mappings":"AAEA,OAAO,kBAAkB,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAEvE,MAAM,SAAS,GAAkB;IAC/B,kBAAkB;IAClB,kBAAkB;CACnB,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { AppProvider } from '@openedx/frontend-base';\n\nimport GlobalDataProvider from './data/contexts/GlobalDataProvider';\nimport { MasqueradeProvider } from './data/context/MasqueradeProvider';\n\nconst providers: AppProvider[] = [\n GlobalDataProvider,\n MasqueradeProvider,\n];\n\nexport default providers;\n"]}
1
+ {"version":3,"file":"providers.js","sourceRoot":"","sources":["../src/providers.ts"],"names":[],"mappings":"AAEA,OAAO,kBAAkB,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AAEtF,MAAM,SAAS,GAAkB;IAC/B,kBAAkB;IAClB,kBAAkB;IAClB,gCAAgC;CACjC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { AppProvider } from '@openedx/frontend-base';\n\nimport GlobalDataProvider from './data/contexts/GlobalDataProvider';\nimport { MasqueradeProvider } from './data/context/MasqueradeProvider';\nimport { ProgressiveProfilingQuizProvider } from './widgets/ProgressiveProfilingQuiz';\n\nconst providers: AppProvider[] = [\n GlobalDataProvider,\n MasqueradeProvider,\n ProgressiveProfilingQuizProvider,\n];\n\nexport default providers;\n"]}
@@ -0,0 +1,20 @@
1
+ import React, { ReactNode } from 'react';
2
+ interface ProgressiveProfilingQuizContextType {
3
+ isModalOpen: boolean;
4
+ openModal: () => void;
5
+ closeModal: () => void;
6
+ currentStep: number;
7
+ setCurrentStep: (step: number) => void;
8
+ goToNextStep: () => void;
9
+ goToPreviousStep: () => void;
10
+ answers: Record<string, string>;
11
+ setAnswer: (question: string, answer: string) => void;
12
+ isComplete: boolean;
13
+ setIsComplete: (isComplete: boolean) => void;
14
+ }
15
+ interface ProgressiveProfilingQuizProviderProps {
16
+ children: ReactNode;
17
+ }
18
+ export declare const ProgressiveProfilingQuizProvider: React.FC<ProgressiveProfilingQuizProviderProps>;
19
+ export declare const useProgressiveProfilingQuiz: () => ProgressiveProfilingQuizContextType;
20
+ export {};
@@ -0,0 +1,43 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext, useMemo, useState, useCallback, } from 'react';
3
+ const ProgressiveProfilingQuizContext = createContext(null);
4
+ export const ProgressiveProfilingQuizProvider = ({ children }) => {
5
+ const [isModalOpen, setIsModalOpen] = useState(false);
6
+ const [currentStep, setCurrentStep] = useState(0);
7
+ const [answers, setAnswers] = useState({});
8
+ const [isComplete, setIsComplete] = useState(false);
9
+ const openModal = useCallback(() => setIsModalOpen(true), []);
10
+ const closeModal = useCallback(() => setIsModalOpen(false), []);
11
+ const goToNextStep = useCallback(() => setCurrentStep(prev => prev + 1), []);
12
+ const goToPreviousStep = useCallback(() => setCurrentStep(prev => Math.max(0, prev - 1)), []);
13
+ const setAnswer = useCallback((question, answer) => {
14
+ setAnswers(prev => (Object.assign(Object.assign({}, prev), { [question]: answer })));
15
+ }, []);
16
+ const contextValue = useMemo(() => ({
17
+ isModalOpen,
18
+ openModal,
19
+ closeModal,
20
+ currentStep,
21
+ setCurrentStep,
22
+ goToNextStep,
23
+ goToPreviousStep,
24
+ answers,
25
+ setAnswer,
26
+ isComplete,
27
+ setIsComplete,
28
+ }), [
29
+ isModalOpen, openModal, closeModal,
30
+ currentStep, goToNextStep, goToPreviousStep,
31
+ answers, setAnswer,
32
+ isComplete,
33
+ ]);
34
+ return (_jsx(ProgressiveProfilingQuizContext.Provider, { value: contextValue, children: children }));
35
+ };
36
+ export const useProgressiveProfilingQuiz = () => {
37
+ const context = useContext(ProgressiveProfilingQuizContext);
38
+ if (!context) {
39
+ throw new Error('useProgressiveProfilingQuiz must be used within a ProgressiveProfilingQuizProvider');
40
+ }
41
+ return context;
42
+ };
43
+ //# sourceMappingURL=ProgressiveProfilingQuizProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProgressiveProfilingQuizProvider.js","sourceRoot":"","sources":["../../../src/widgets/ProgressiveProfilingQuiz/ProgressiveProfilingQuizProvider.tsx"],"names":[],"mappings":";AAAA,OAAc,EACZ,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAa,WAAW,GACrE,MAAM,OAAO,CAAC;AAgBf,MAAM,+BAA+B,GAAG,aAAa,CAA6C,IAAI,CAAC,CAAC;AAMxG,MAAM,CAAC,MAAM,gCAAgC,GAAoD,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IAChH,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAClD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAyB,EAAE,CAAC,CAAC;IACnE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QA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AEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAwC,EAAE;IACnF,MAAM,OAAO,GAAG,UAAU,CAAC,+BAA+B,CAAC,CAAC;IAC5D,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,oFAAoF,CAAC,CAAC;IACxG,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import React, {\n createContext, useContext, useMemo, useState, ReactNode, useCallback,\n} from 'react';\n\ninterface ProgressiveProfilingQuizContextType {\n isModalOpen: boolean,\n openModal: () => void,\n closeModal: () => void,\n currentStep: number,\n setCurrentStep: (step: number) => void,\n goToNextStep: () => void,\n goToPreviousStep: () => void,\n answers: Record<string, string>,\n setAnswer: (question: string, answer: string) => void,\n isComplete: boolean,\n setIsComplete: (isComplete: boolean) => void,\n}\n\nconst ProgressiveProfilingQuizContext = createContext<ProgressiveProfilingQuizContextType | null>(null);\n\ninterface ProgressiveProfilingQuizProviderProps {\n children: ReactNode,\n}\n\nexport const ProgressiveProfilingQuizProvider: React.FC<ProgressiveProfilingQuizProviderProps> = ({ children }) => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n const [currentStep, setCurrentStep] = useState(0);\n const [answers, setAnswers] = useState<Record<string, string>>({});\n const [isComplete, setIsComplete] = useState(false);\n\n const openModal = useCallback(() => setIsModalOpen(true), []);\n const closeModal = useCallback(() => setIsModalOpen(false), []);\n\n const goToNextStep = useCallback(() => setCurrentStep(prev => prev + 1), []);\n const goToPreviousStep = useCallback(() => setCurrentStep(prev => Math.max(0, prev - 1)), []);\n\n const setAnswer = useCallback((question: string, answer: string) => {\n setAnswers(prev => ({ ...prev, [question]: answer }));\n }, []);\n\n const contextValue = useMemo(() => ({\n isModalOpen,\n openModal,\n closeModal,\n currentStep,\n setCurrentStep,\n goToNextStep,\n goToPreviousStep,\n answers,\n setAnswer,\n isComplete,\n setIsComplete,\n }), [\n isModalOpen, openModal, closeModal,\n currentStep, goToNextStep, goToPreviousStep,\n answers, setAnswer,\n isComplete,\n ]);\n\n return (\n <ProgressiveProfilingQuizContext.Provider value={contextValue}>\n {children}\n </ProgressiveProfilingQuizContext.Provider>\n );\n};\n\nexport const useProgressiveProfilingQuiz = (): ProgressiveProfilingQuizContextType => {\n const context = useContext(ProgressiveProfilingQuizContext);\n if (!context) {\n throw new Error('useProgressiveProfilingQuiz must be used within a ProgressiveProfilingQuizProvider');\n }\n return context;\n};\n"]}
@@ -1,5 +1,9 @@
1
+ import { ProgressiveProfilingQuizProvider } from './ProgressiveProfilingQuizProvider';
1
2
  const app = {
2
3
  appId: 'org.2u-edx.frontend.app.progressiveProfiling',
4
+ providers: [
5
+ ProgressiveProfilingQuizProvider,
6
+ ],
3
7
  };
4
8
  export default app;
5
9
  //# sourceMappingURL=app.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/widgets/ProgressiveProfilingQuiz/app.ts"],"names":[],"mappings":"AAEA,MAAM,GAAG,GAAQ;IACf,KAAK,EAAE,8CAA8C;CACtD,CAAC;AAEF,eAAe,GAAG,CAAC","sourcesContent":["import { App } from '@openedx/frontend-base';\n\nconst app: App = {\n appId: 'org.2u-edx.frontend.app.progressiveProfiling',\n};\n\nexport default app;\n"]}
1
+ {"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/widgets/ProgressiveProfilingQuiz/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AAEtF,MAAM,GAAG,GAAQ;IACf,KAAK,EAAE,8CAA8C;IACrD,SAAS,EAAE;QACT,gCAAgC;KACjC;CACF,CAAC;AAEF,eAAe,GAAG,CAAC","sourcesContent":["import { App } from '@openedx/frontend-base';\nimport { ProgressiveProfilingQuizProvider } from './ProgressiveProfilingQuizProvider';\n\nconst app: App = {\n appId: 'org.2u-edx.frontend.app.progressiveProfiling',\n providers: [\n ProgressiveProfilingQuizProvider,\n ],\n};\n\nexport default app;\n"]}
@@ -1 +1,2 @@
1
1
  export { default as progressiveProfilingApp } from './app';
2
+ export { ProgressiveProfilingQuizProvider, useProgressiveProfilingQuiz } from './ProgressiveProfilingQuizProvider';
@@ -1,2 +1,3 @@
1
1
  export { default as progressiveProfilingApp } from './app';
2
+ export { ProgressiveProfilingQuizProvider, useProgressiveProfilingQuiz } from './ProgressiveProfilingQuizProvider';
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/widgets/ProgressiveProfilingQuiz/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,OAAO,CAAC","sourcesContent":["export { default as progressiveProfilingApp } from './app';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/widgets/ProgressiveProfilingQuiz/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,gCAAgC,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC","sourcesContent":["export { default as progressiveProfilingApp } from './app';\nexport { ProgressiveProfilingQuizProvider, useProgressiveProfilingQuiz } from './ProgressiveProfilingQuizProvider';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edx/frontend-app-subscription-learner-dashboard",
3
- "version": "1.21.0",
3
+ "version": "1.22.0",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",