Skip to content

Commit

Permalink
Merge pull request Sunbird-ALL#161 from Sunbird-ALL/all-1.2-tn-dev
Browse files Browse the repository at this point in the history
All 1.2 tn dev
  • Loading branch information
gouravmore authored Sep 12, 2024
2 parents 2a79b97 + d4ec59c commit 25dc31c
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 53 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/all-app-sandbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
node-version: "18"

- name: Install AWS CLI
run: |
Expand Down Expand Up @@ -75,7 +75,9 @@ jobs:
REACT_APP_IS_APP_IFRAME: ${{ vars.REACT_APP_IS_APP_IFRAME }}
REACT_APP_IS_IN_APP_AUTHORISATION: ${{ vars.REACT_APP_IS_IN_APP_AUTHORISATION }}
REACT_APP_LANGUAGES: ${{ vars.REACT_APP_LANGUAGES }}
CI: false # Disabling CI to not treat warnings as errors
REACT_APP_AWS_ACCESS_KEY_ID: ${{ secrets.REACT_APP_AWS_ACCESS_KEY_ID }}
REACT_APP_AWS_SECRET_ACCESS_KEY: ${{ secrets.REACT_APP_AWS_SECRET_ACCESS_KEY }}
CI: false # Disabling CI to not treat warnings as errors
run: npm run build

- name: Deploy to S3 Bucket
Expand All @@ -91,7 +93,7 @@ jobs:
uses: chetan/invalidate-cloudfront-action@master
env:
DISTRIBUTION: ${{ secrets.AWS_DISTRIBUTION }}
PATHS: '/*'
PATHS: "/*"
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
8 changes: 5 additions & 3 deletions .github/workflows/all-dev-rig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
node-version: "18"

- name: Install AWS CLI
run: |
Expand Down Expand Up @@ -75,7 +75,9 @@ jobs:
REACT_APP_IS_APP_IFRAME: ${{ vars.REACT_APP_IS_APP_IFRAME }}
REACT_APP_IS_IN_APP_AUTHORISATION: ${{ vars.REACT_APP_IS_IN_APP_AUTHORISATION }}
REACT_APP_LANGUAGES: ${{ vars.REACT_APP_LANGUAGES }}
CI: false # Disabling CI to not treat warnings as errors
REACT_APP_AWS_ACCESS_KEY_ID: ${{ secrets.REACT_APP_AWS_ACCESS_KEY_ID }}
REACT_APP_AWS_SECRET_ACCESS_KEY: ${{ secrets.REACT_APP_AWS_SECRET_ACCESS_KEY }}
CI: false # Disabling CI to not treat warnings as errors
run: npm run build

- name: Deploy to S3 Bucket
Expand All @@ -91,7 +93,7 @@ jobs:
uses: chetan/invalidate-cloudfront-action@master
env:
DISTRIBUTION: ${{ secrets.AWS_DISTRIBUTION }}
PATHS: '/*'
PATHS: "/*"
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
8 changes: 5 additions & 3 deletions .github/workflows/all-dev-tn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
node-version: "18"

- name: Install AWS CLI
run: |
Expand Down Expand Up @@ -75,7 +75,9 @@ jobs:
REACT_APP_IS_APP_IFRAME: ${{ vars.REACT_APP_IS_APP_IFRAME }}
REACT_APP_IS_IN_APP_AUTHORISATION: ${{ vars.REACT_APP_IS_IN_APP_AUTHORISATION }}
REACT_APP_LANGUAGES: ${{ vars.REACT_APP_LANGUAGES }}
CI: false # Disabling CI to not treat warnings as errors
REACT_APP_AWS_ACCESS_KEY_ID: ${{ secrets.REACT_APP_AWS_ACCESS_KEY_ID }}
REACT_APP_AWS_SECRET_ACCESS_KEY: ${{ secrets.REACT_APP_AWS_SECRET_ACCESS_KEY }}
CI: false # Disabling CI to not treat warnings as errors
run: npm run build

- name: Deploy to S3 Bucket
Expand All @@ -91,7 +93,7 @@ jobs:
uses: chetan/invalidate-cloudfront-action@master
env:
DISTRIBUTION: ${{ secrets.AWS_DISTRIBUTION }}
PATHS: '/*'
PATHS: "/*"
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
8 changes: 5 additions & 3 deletions .github/workflows/all-prod-rig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
node-version: "18"

- name: Install AWS CLI
run: |
Expand Down Expand Up @@ -75,7 +75,9 @@ jobs:
REACT_APP_IS_APP_IFRAME: ${{ vars.REACT_APP_IS_APP_IFRAME }}
REACT_APP_IS_IN_APP_AUTHORISATION: ${{ vars.REACT_APP_IS_IN_APP_AUTHORISATION }}
REACT_APP_LANGUAGES: ${{ vars.REACT_APP_LANGUAGES }}
CI: false # Disabling CI to not treat warnings as errors
REACT_APP_AWS_ACCESS_KEY_ID: ${{ secrets.REACT_APP_AWS_ACCESS_KEY_ID }}
REACT_APP_AWS_SECRET_ACCESS_KEY: ${{ secrets.REACT_APP_AWS_SECRET_ACCESS_KEY }}
CI: false # Disabling CI to not treat warnings as errors
run: npm run build

- name: Deploy to S3 Bucket
Expand All @@ -91,7 +93,7 @@ jobs:
uses: chetan/invalidate-cloudfront-action@master
env:
DISTRIBUTION: ${{ secrets.AWS_DISTRIBUTION }}
PATHS: '/*'
PATHS: "/*"
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
8 changes: 5 additions & 3 deletions .github/workflows/all-staging-tn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
node-version: "18"

- name: Install AWS CLI
run: |
Expand Down Expand Up @@ -75,7 +75,9 @@ jobs:
REACT_APP_IS_APP_IFRAME: ${{ vars.REACT_APP_IS_APP_IFRAME }}
REACT_APP_IS_IN_APP_AUTHORISATION: ${{ vars.REACT_APP_IS_IN_APP_AUTHORISATION }}
REACT_APP_LANGUAGES: ${{ vars.REACT_APP_LANGUAGES }}
CI: false # Disabling CI to not treat warnings as errors
REACT_APP_AWS_ACCESS_KEY_ID: ${{ secrets.REACT_APP_AWS_ACCESS_KEY_ID }}
REACT_APP_AWS_SECRET_ACCESS_KEY: ${{ secrets.REACT_APP_AWS_SECRET_ACCESS_KEY }}
CI: false # Disabling CI to not treat warnings as errors
run: npm run build

- name: Deploy to S3 Bucket
Expand All @@ -91,7 +93,7 @@ jobs:
uses: chetan/invalidate-cloudfront-action@master
env:
DISTRIBUTION: ${{ secrets.AWS_DISTRIBUTION }}
PATHS: '/*'
PATHS: "/*"
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
2 changes: 1 addition & 1 deletion src/components/Assesment/Assesment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ export const ProfileHeader = ({
const handleProfileBack = () => {
try {
if (process.env.REACT_APP_IS_APP_IFRAME === "true") {
window.parent.postMessage({ type: "restore-iframe-content" });
window.parent.postMessage({ type: "restore-iframe-content" }, "*");
navigate("/");
} else {
navigate("/discover-start");
Expand Down
49 changes: 27 additions & 22 deletions src/components/DiscoverSentance/DiscoverSentance.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ const SpeakSentenceComponent = () => {
const [disableScreen, setDisableScreen] = useState(false);
const [play] = useSound(LevelCompleteAudio);
const [openMessageDialog, setOpenMessageDialog] = useState("");
const [totalSyllableCount, setTotalSyllableCount] = useState('');
const [totalSyllableCount, setTotalSyllableCount] = useState("");
const [isNextButtonCalled, setIsNextButtonCalled] = useState(false);


const callConfettiAndPlay = () => {
play();
callConfetti();
Expand Down Expand Up @@ -100,16 +99,19 @@ const SpeakSentenceComponent = () => {
}, [voiceText]);

const send = (score) => {
if (process.env.REACT_APP_IS_APP_IFRAME === 'true') {
window.parent.postMessage({
score: score,
message: "all-test-rig-score",
});
if (process.env.REACT_APP_IS_APP_IFRAME === "true") {
window.parent.postMessage(
{
score: score,
message: "all-test-rig-score",
},
"*"
);
}
};

const handleNext = async () => {
setIsNextButtonCalled(true)
setIsNextButtonCalled(true);
setEnableNext(false);

try {
Expand Down Expand Up @@ -165,17 +167,17 @@ const SpeakSentenceComponent = () => {
const { data: getSetData } = getSetResultRes;
const data = JSON.stringify(getSetData?.data);
Log(data, "discovery", "ET");
if(process.env.REACT_APP_POST_LEARNER_PROGRESS === "true"){
await axios.post(
`${process.env.REACT_APP_LEARNER_AI_ORCHESTRATION_HOST}/${config.URLS.CREATE_LEARNER_PROGRESS}`,
{
userId: localStorage.getItem("virtualId"),
sessionId: localStorage.getItem("sessionId"),
subSessionId: sub_session_id,
milestoneLevel: getSetData?.data?.currentLevel,
language: localStorage.getItem("lang"),
}
);
if (process.env.REACT_APP_POST_LEARNER_PROGRESS === "true") {
await axios.post(
`${process.env.REACT_APP_LEARNER_AI_ORCHESTRATION_HOST}/${config.URLS.CREATE_LEARNER_PROGRESS}`,
{
userId: localStorage.getItem("virtualId"),
sessionId: localStorage.getItem("sessionId"),
subSessionId: sub_session_id,
milestoneLevel: getSetData?.data?.currentLevel,
language: localStorage.getItem("lang"),
}
);
}
if (
getSetData.data.sessionResult === "pass" &&
Expand All @@ -193,7 +195,9 @@ const SpeakSentenceComponent = () => {
`${process.env.REACT_APP_CONTENT_SERVICE_APP_HOST}/${config.URLS.GET_PAGINATION}?page=1&limit=5&collectionId=${sentences?.[newSentencePassedCounter]?.collectionId}`
);
setCurrentContentType("Sentence");
setTotalSyllableCount(resSentencesPagination?.data?.totalSyllableCount);
setTotalSyllableCount(
resSentencesPagination?.data?.totalSyllableCount
);
setCurrentCollectionId(
sentences?.[newSentencePassedCounter]?.collectionId
);
Expand Down Expand Up @@ -274,7 +278,7 @@ const SpeakSentenceComponent = () => {
`${process.env.REACT_APP_CONTENT_SERVICE_APP_HOST}/${config.URLS.GET_PAGINATION}?page=1&limit=5&collectionId=${sentences?.collectionId}`
);
setCurrentContentType("Sentence");
setTotalSyllableCount(resPagination?.data?.totalSyllableCount)
setTotalSyllableCount(resPagination?.data?.totalSyllableCount);
setCurrentCollectionId(sentences?.collectionId);
setAssessmentResponse(resAssessment);
localStorage.setItem("storyTitle", sentences?.name);
Expand All @@ -289,7 +293,8 @@ const SpeakSentenceComponent = () => {
})();
}, []);
const handleBack = () => {
const destination = process.env.REACT_APP_IS_APP_IFRAME === 'true' ? "/" : "/discover-start";
const destination =
process.env.REACT_APP_IS_APP_IFRAME === "true" ? "/" : "/discover-start";
navigate(destination);
// if (process.env.REACT_APP_IS_APP_IFRAME === 'true') {
// navigate("/");
Expand Down
16 changes: 8 additions & 8 deletions src/config/awsS3.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// import { S3Client } from '@aws-sdk/client-s3';
import { S3Client } from "@aws-sdk/client-s3";

// export default new S3Client({
// region: process.env.REACT_APP_AWS_S3_REGION,
// credentials: {
// accessKeyId: process.env.REACT_APP_AWS_ACCESS_KEY_ID,
// secretAccessKey: process.env.REACT_APP_AWS_SECRET_ACCESS_KEY,
// },
// });
export default new S3Client({
region: process.env.REACT_APP_AWS_S3_REGION,
credentials: {
accessKeyId: process.env.REACT_APP_AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.REACT_APP_AWS_SECRET_ACCESS_KEY,
},
});
5 changes: 3 additions & 2 deletions src/utils/VoiceAnalyser.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ import {
} from "./constants";
import config from "./urlConstants.json";
import { filterBadWords } from "./Badwords";
// import S3Client from '../config/awsS3';
import S3Client from "../config/awsS3";
import { PutObjectCommand } from "@aws-sdk/client-s3";
/* eslint-disable */

const AudioPath = {
Expand Down Expand Up @@ -363,7 +364,7 @@ function VoiceAnalyser(props) {

// TODO: Remove false when REACT_APP_AWS_S3_BUCKET_NAME and keys added
var audioFileName = "";
if (process.env.REACT_APP_CAPTURE_AUDIO === "true" && false) {
if (process.env.REACT_APP_CAPTURE_AUDIO === "true") {
let getContentId = currentLine;
audioFileName = `${
process.env.REACT_APP_CHANNEL
Expand Down
13 changes: 8 additions & 5 deletions src/views/Practice/Practice.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,13 @@ const Practice = () => {

const send = (score) => {
if (process.env.REACT_APP_IS_APP_IFRAME === "true") {
window.parent.postMessage({
score: score,
message: "all-test-rig-score",
});
window.parent.postMessage(
{
score: score,
message: "all-test-rig-score",
},
"*"
);
}
};

Expand Down Expand Up @@ -683,7 +686,7 @@ const Practice = () => {
questions[currentQuestion]?.contentSourceData || [];
const stringLengths = contentSourceData.map((item) => item.text.length);
const length = stringLengths[0];
window.parent.postMessage({ type: "stringLengths", length });
window.parent.postMessage({ type: "stringLengths", length }, "*");
}
}
}, [questions[currentQuestion]]);
Expand Down

0 comments on commit 25dc31c

Please sign in to comment.