@sparkle-learning/core 0.0.53 → 0.0.54
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/cjs/{PrivateRoute-074c584e.js → PrivateRoute-e2047db2.js} +18 -30
- package/dist/cjs/{feed.service-b4f09441.js → appdata.service-d28cf2d6.js} +4 -56
- package/dist/cjs/{assets.service-0c759d51.js → assets.service-bfa75092.js} +1 -1
- package/dist/cjs/{environment-config.service-0e02b049.js → environment-config.service-c8ff1f3d.js} +0 -1
- package/dist/cjs/{facilitator.service-9e990274.js → facilitator.service-0b9f6ac7.js} +1 -1
- package/dist/cjs/feed.service-6df9382f.js +57 -0
- package/dist/cjs/header-mobile-collapse_61.cjs.entry.js +76 -87
- package/dist/cjs/{httpService-7211d93b.js → httpService-d8a5b474.js} +13 -11
- package/dist/cjs/index.cjs.js +5 -4
- package/dist/cjs/ion-select_3.cjs.entry.js +77 -68
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/media.service-2bc73d37.js +40 -0
- package/dist/cjs/{signalR.service-5672eebc.js → signalR.service-0d5da1d3.js} +18 -20
- package/dist/cjs/sparkle-animation-player.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-assignment.cjs.entry.js +25 -0
- package/dist/cjs/sparkle-character-intro.cjs.entry.js +2 -2
- package/dist/cjs/sparkle-core.cjs.js +1 -1
- package/dist/cjs/sparkle-discussion-questions_2.cjs.entry.js +20 -11
- package/dist/cjs/sparkle-discussion.cjs.entry.js +6 -4
- package/dist/cjs/sparkle-facilitator-notes-form.cjs.entry.js +5 -3
- package/dist/cjs/sparkle-feedback.cjs.entry.js +5 -3
- package/dist/cjs/sparkle-goal-form.cjs.entry.js +11 -8
- package/dist/cjs/sparkle-quiz-container.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-quiz-old.cjs.entry.js +120 -0
- package/dist/cjs/sparkle-quiz.cjs.entry.js +31 -48
- package/dist/cjs/{student.service-2e58f237.js → student.service-d8ec2551.js} +1 -1
- package/dist/cjs/token.service-bfb0089b.js +86 -0
- package/dist/cjs/{util-d383acb8.js → util-47e320b2.js} +2 -2
- package/dist/collection/PrivateRoute.js +2 -2
- package/dist/collection/collection-manifest.json +3 -2
- package/dist/collection/components/layout/facilitator/facilitator-page.js +2 -3
- package/dist/collection/components/layout/page/page.css +4 -0
- package/dist/collection/components/layout/page/page.js +39 -26
- package/dist/collection/components/sparkle-assignment/sparkle-assignment.css +3 -0
- package/dist/collection/components/sparkle-assignment/sparkle-assignment.js +25 -0
- package/dist/collection/components/sparkle-character-intro/sparkle-character-intro.css +8 -1
- package/dist/collection/components/sparkle-character-intro/sparkle-character-intro.js +10 -6
- package/dist/collection/components/sparkle-course-root/sparkle-course-root.js +13 -2
- package/dist/collection/components/sparkle-discussion/sparkle-discussion-questions/sparkle-discussion-questions.js +4 -2
- package/dist/collection/components/sparkle-discussion/sparkle-discussion-results/sparkle-discussion-results.js +15 -9
- package/dist/collection/components/sparkle-discussion/sparkle-discussion.css +5 -0
- package/dist/collection/components/sparkle-discussion/sparkle-discussion.js +5 -3
- package/dist/collection/components/sparkle-feed-post/sparkle-feed-post.js +54 -67
- package/dist/collection/components/sparkle-login/sparkle-login.js +2 -1
- package/dist/collection/components/sparkle-quiz/{sparkle-quiz/sparkle-quiz.css → sparkle-quiz-old/sparkle-quiz-old.css} +1 -1
- package/dist/collection/components/sparkle-quiz/{sparkle-quiz/sparkle-quiz.js → sparkle-quiz-old/sparkle-quiz-old.js} +4 -4
- package/dist/collection/components/sparkle-quiz/{sparkle-quiz-v1.js → sparkle-quiz.js} +23 -25
- package/dist/collection/components/sparkle-quiz-container/sparkle-quiz-container.js +1 -1
- package/dist/collection/components/sparkle-root/sparkle-root.js +12 -10
- package/dist/collection/services/assignment.service.js +14 -0
- package/dist/collection/services/auth/auth.service.js +15 -14
- package/dist/collection/services/environment/environment-config.js +1 -1
- package/dist/collection/services/environment/environment-config.service.js +0 -1
- package/dist/collection/services/httpService.js +12 -10
- package/dist/collection/services/signalR.service.js +17 -19
- package/dist/collection/services/token.service.js +68 -0
- package/dist/collection/util.js +5 -2
- package/dist/esm/{PrivateRoute-c5441f35.js → PrivateRoute-c6e80d5d.js} +17 -29
- package/dist/esm/{feed.service-8fbe4ce3.js → appdata.service-d1058e00.js} +5 -55
- package/dist/esm/{assets.service-66e848b8.js → assets.service-def1d63c.js} +1 -1
- package/dist/esm/{environment-config.service-2b5d692b.js → environment-config.service-b191f276.js} +0 -1
- package/dist/esm/{facilitator.service-b0292f7f.js → facilitator.service-53e05a01.js} +1 -1
- package/dist/esm/feed.service-8385ad7a.js +54 -0
- package/dist/esm/header-mobile-collapse_61.entry.js +70 -81
- package/dist/esm/{httpService-7b75b095.js → httpService-db476835.js} +13 -11
- package/dist/esm/index.js +5 -4
- package/dist/esm/ion-select_3.entry.js +77 -68
- package/dist/esm/loader.js +1 -1
- package/dist/esm/media.service-b68cbfff.js +37 -0
- package/dist/esm/{signalR.service-9d5b9f36.js → signalR.service-4a2d5a92.js} +18 -20
- package/dist/esm/sparkle-animation-player.entry.js +1 -1
- package/dist/esm/sparkle-assignment.entry.js +21 -0
- package/dist/esm/sparkle-character-intro.entry.js +3 -3
- package/dist/esm/sparkle-core.js +1 -1
- package/dist/esm/sparkle-discussion-questions_2.entry.js +20 -11
- package/dist/esm/sparkle-discussion.entry.js +6 -4
- package/dist/esm/sparkle-facilitator-notes-form.entry.js +5 -3
- package/dist/esm/sparkle-feedback.entry.js +5 -3
- package/dist/esm/sparkle-goal-form.entry.js +8 -5
- package/dist/esm/sparkle-quiz-container.entry.js +1 -1
- package/dist/esm/sparkle-quiz-old.entry.js +116 -0
- package/dist/esm/sparkle-quiz.entry.js +31 -48
- package/dist/esm/{student.service-0746418b.js → student.service-6457aaa0.js} +1 -1
- package/dist/esm/token.service-20f1a256.js +83 -0
- package/dist/esm/{util-6ef753e9.js → util-57cc8006.js} +2 -2
- package/dist/sparkle-core/index.esm.js +1 -1
- package/dist/sparkle-core/p-11ac00b0.js +1 -0
- package/dist/sparkle-core/p-13ec39db.entry.js +1 -0
- package/dist/sparkle-core/{p-5efc6566.js → p-17b6b07e.js} +1 -1
- package/dist/sparkle-core/p-33a7151d.entry.js +1 -0
- package/dist/sparkle-core/{p-fbccd30c.js → p-38f707fb.js} +1 -1
- package/dist/sparkle-core/p-38fa5987.js +1 -0
- package/dist/sparkle-core/{p-9a443f51.js → p-408176ba.js} +1 -1
- package/dist/sparkle-core/p-630a4fa0.js +1 -0
- package/dist/sparkle-core/{p-0a5d7c4f.entry.js → p-6a1fc0af.entry.js} +26 -26
- package/dist/sparkle-core/p-6fab3a4b.js +1 -0
- package/dist/sparkle-core/p-71720d6e.entry.js +1 -0
- package/dist/sparkle-core/{p-162bff1a.entry.js → p-72053ae0.entry.js} +1 -1
- package/dist/sparkle-core/{p-18cdd458.entry.js → p-85d4cd5c.entry.js} +1 -1
- package/dist/sparkle-core/p-967a2ed7.js +1 -0
- package/dist/sparkle-core/{p-ff0e0d4e.entry.js → p-98daeddb.entry.js} +1 -1
- package/dist/sparkle-core/p-98f7780c.entry.js +1 -0
- package/dist/sparkle-core/p-bd90903e.js +1 -0
- package/dist/sparkle-core/{p-a49ab4e8.entry.js → p-c64a34cd.entry.js} +1 -1
- package/dist/sparkle-core/{p-44334ef3.entry.js → p-ca907214.entry.js} +2 -2
- package/dist/sparkle-core/p-d51f30ca.js +1 -0
- package/dist/sparkle-core/p-dcff298d.entry.js +1 -0
- package/dist/sparkle-core/p-e50c8b04.entry.js +1 -0
- package/dist/sparkle-core/p-ed9de327.js +1 -0
- package/dist/sparkle-core/p-f891c79a.entry.js +1 -0
- package/dist/sparkle-core/sparkle-core.esm.js +1 -1
- package/dist/types/components/layout/page/page.d.ts +2 -0
- package/dist/types/components/sparkle-assignment/sparkle-assignment.d.ts +6 -0
- package/dist/types/components/sparkle-course-root/sparkle-course-root.d.ts +1 -0
- package/dist/types/components/sparkle-feed-post/sparkle-feed-post.d.ts +3 -2
- package/dist/types/components/sparkle-quiz/{sparkle-quiz/sparkle-quiz.d.ts → sparkle-quiz-old/sparkle-quiz-old.d.ts} +1 -1
- package/dist/types/components/sparkle-quiz/{sparkle-quiz-v1.d.ts → sparkle-quiz.d.ts} +1 -1
- package/dist/types/components.d.ts +49 -36
- package/dist/types/models/class.model.d.ts +4 -0
- package/dist/types/services/assignment.service.d.ts +8 -0
- package/dist/types/services/auth/auth.service.d.ts +1 -1
- package/dist/types/services/environment/environment-config.d.ts +3 -0
- package/dist/types/services/token.service.d.ts +12 -0
- package/dist/types/util.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/sparkle-quiz-v1.cjs.entry.js +0 -105
- package/dist/esm/sparkle-quiz-v1.entry.js +0 -101
- package/dist/sparkle-core/p-1d4c7c11.js +0 -1
- package/dist/sparkle-core/p-30767c1c.entry.js +0 -1
- package/dist/sparkle-core/p-3265ed87.entry.js +0 -1
- package/dist/sparkle-core/p-370609ba.entry.js +0 -1
- package/dist/sparkle-core/p-462bffba.js +0 -1
- package/dist/sparkle-core/p-4c9f994f.js +0 -1
- package/dist/sparkle-core/p-58e4bbe5.entry.js +0 -1
- package/dist/sparkle-core/p-600cf6a3.js +0 -1
- package/dist/sparkle-core/p-80d6b0e6.entry.js +0 -1
- package/dist/sparkle-core/p-af3cc111.entry.js +0 -1
- package/dist/sparkle-core/p-b226f54d.js +0 -1
- /package/dist/collection/components/sparkle-quiz/{sparkle-quiz-v1.css → sparkle-quiz.css} +0 -0
- /package/dist/sparkle-core/{p-935e7cfc.js → p-8b56f734.js} +0 -0
@@ -9,19 +9,22 @@ import { f as findClosestIonContent, d as disableContentScrollY, r as resetConte
|
|
9
9
|
import { i as isRTL } from './dir-03012648.js';
|
10
10
|
import { S as SPINNERS } from './spinner-configs-a37e628a.js';
|
11
11
|
import { A as ActiveRouter } from './active-router-fc9e4e06.js';
|
12
|
-
import { i as initSetupConfig, A as AuthService, P as PrivateRoute, s as setupConfig } from './PrivateRoute-
|
13
|
-
import { A as AssetsService } from './assets.service-
|
14
|
-
import { A as AuthStore, c as createCommonjsModule, g as getDefaultExportFromCjs, b as commonjsGlobal, T as TocStore
|
15
|
-
import { u as userStore, S as StudentService } from './student.service-
|
16
|
-
import { E as EnvironmentConfigService } from './environment-config.service-
|
17
|
-
import { s as sample, S as SparkleGlobal$1, d as date, M as MyHealthTemplate, a as MyHealthTemplateJSON, b as MyMoodTemplate, c as MyMoodTemplateJSON } from './util-
|
18
|
-
import { F as FacilitatorService, f as facilitatorStore } from './facilitator.service-
|
12
|
+
import { i as initSetupConfig, A as AuthService, P as PrivateRoute, s as setupConfig } from './PrivateRoute-c6e80d5d.js';
|
13
|
+
import { A as AssetsService } from './assets.service-def1d63c.js';
|
14
|
+
import { A as AuthStore, c as createCommonjsModule, g as getDefaultExportFromCjs, b as commonjsGlobal, T as TocStore } from './auth.store-dba2c2da.js';
|
15
|
+
import { u as userStore, S as StudentService } from './student.service-6457aaa0.js';
|
16
|
+
import { E as EnvironmentConfigService } from './environment-config.service-b191f276.js';
|
17
|
+
import { s as sample, S as SparkleGlobal$1, d as date, M as MyHealthTemplate, a as MyHealthTemplateJSON, b as MyMoodTemplate, c as MyMoodTemplateJSON } from './util-57cc8006.js';
|
18
|
+
import { F as FacilitatorService, f as facilitatorStore } from './facilitator.service-53e05a01.js';
|
19
19
|
import { m as menuController } from './index-cded2d87.js';
|
20
20
|
import { m as modalController, a as alertController, t as toastController } from './overlays-3b4dca92.js';
|
21
|
-
import { S as SignalRService, s as signalRStore } from './signalR.service-
|
22
|
-
import { H as HttpService } from './httpService-
|
23
|
-
import { A as AppDataService, g as goalStore
|
24
|
-
import './
|
21
|
+
import { S as SignalRService, s as signalRStore } from './signalR.service-4a2d5a92.js';
|
22
|
+
import { H as HttpService } from './httpService-db476835.js';
|
23
|
+
import { A as AppDataService, g as goalStore } from './appdata.service-d1058e00.js';
|
24
|
+
import { F as FeedService, f as feedStore } from './feed.service-8385ad7a.js';
|
25
|
+
import { M as MediaService, m as mediaStore } from './media.service-b68cbfff.js';
|
26
|
+
import { g as get$1 } from './localstorage.service-4bf408c8.js';
|
27
|
+
import { A as AppConsts } from './token.service-20f1a256.js';
|
25
28
|
import './hardware-back-button-fa04d6e9.js';
|
26
29
|
import './animation-12377cb3.js';
|
27
30
|
|
@@ -3065,7 +3068,7 @@ const SparkleCourseRoot = class {
|
|
3065
3068
|
this.config = {
|
3066
3069
|
appUrl: 'http://localhost:3333',
|
3067
3070
|
globalAssetsUrl: 'http://localhost:3333/assets',
|
3068
|
-
apiUrl: 'https://localhost:
|
3071
|
+
apiUrl: 'https://localhost:44369/',
|
3069
3072
|
quizPath: this.quizPath,
|
3070
3073
|
tocPath: this.tocPath,
|
3071
3074
|
menu: {
|
@@ -3114,6 +3117,10 @@ const SparkleCourseRoot = class {
|
|
3114
3117
|
var sidebar = document.getElementById('onlineStudents');
|
3115
3118
|
await sidebar.show();
|
3116
3119
|
}
|
3120
|
+
useDidLogin(event) {
|
3121
|
+
console.log('Received the userDidLogInevent: ', event.detail);
|
3122
|
+
return h$1("stencil-router-redirect", { url: "/home" });
|
3123
|
+
}
|
3117
3124
|
renderPage(path) {
|
3118
3125
|
return (h$1("stencil-route", { url: '/' + path, routeRender: props => [
|
3119
3126
|
this.renderHeaderAndMenu(),
|
@@ -12539,7 +12546,7 @@ const FacilitatorPage = class {
|
|
12539
12546
|
}
|
12540
12547
|
path = /^\/docs\/pages\/[a-z]{2}\.json$/.test(path) ? path.replace('.json', '/index.json') : path;
|
12541
12548
|
let lessonPath = this.getLessonPath(path);
|
12542
|
-
console.log(lessonPath);
|
12549
|
+
console.log("lessonPath", lessonPath);
|
12543
12550
|
return fetch(path).then(this.validateFetch).then(this.handleNotesPage).catch(this.handleBadFetch) &&
|
12544
12551
|
fetch(lessonPath).then(this.validateFetch).then(this.handleLessonNotesPage).catch(this.handleLessonNotesBadFetch);
|
12545
12552
|
}
|
@@ -12552,7 +12559,7 @@ const FacilitatorPage = class {
|
|
12552
12559
|
if (path === null || path === oldPath) {
|
12553
12560
|
return;
|
12554
12561
|
}
|
12555
|
-
if (SignalRService.getInstance().connection.
|
12562
|
+
if (SignalRService.getInstance().connection._connectionState == "Connected") {
|
12556
12563
|
SignalRService.getInstance().callSignalR("NavigateFacilitatorPresentationCourseTo", { url: this.path.replace(".json", "") });
|
12557
12564
|
}
|
12558
12565
|
path = /^\/docs\/pages\/[a-z]{2}\.json$/.test(path) ? path.replace('.json', '/index.json') : path;
|
@@ -12628,7 +12635,6 @@ const FacilitatorPage = class {
|
|
12628
12635
|
return h$1(Template, { page: notesPage });
|
12629
12636
|
}
|
12630
12637
|
__stencil_render() {
|
12631
|
-
console.log(facilitatorStore.state.classes);
|
12632
12638
|
const { page } = this;
|
12633
12639
|
const content = this.renderTabs();
|
12634
12640
|
return h$1("div", { class: "container" }, h$1("div", { class: "d-flex justify-content-between align-items-center" }, h$1("sparkle-page-footer", { page: page }), h$1("div", null, h$1("select", { class: "form-select", "aria-label": "Default select example" }, facilitatorStore.state.classes.map(item => h$1("option", null, item.ClassName))))), content);
|
@@ -12975,39 +12981,6 @@ const SparkleHeader = class {
|
|
12975
12981
|
};
|
12976
12982
|
SparkleHeader.style = headerCss;
|
12977
12983
|
|
12978
|
-
const { state, reset } = createStore({
|
12979
|
-
mediaUploading: false,
|
12980
|
-
});
|
12981
|
-
const mediaStore = { state, reset };
|
12982
|
-
|
12983
|
-
class MediaService {
|
12984
|
-
constructor() { }
|
12985
|
-
static getInstance() {
|
12986
|
-
if (!MediaService.instance) {
|
12987
|
-
MediaService.instance = new MediaService();
|
12988
|
-
}
|
12989
|
-
return MediaService.instance;
|
12990
|
-
}
|
12991
|
-
async uploadImage(files) {
|
12992
|
-
let formData = new FormData();
|
12993
|
-
for (let i = 0; i < files.length; i++) {
|
12994
|
-
formData.append("uploads[]", files[i], files[i].name);
|
12995
|
-
}
|
12996
|
-
mediaStore.state.mediaUploading = true;
|
12997
|
-
let result;
|
12998
|
-
try {
|
12999
|
-
result = await HttpService.http.post(`api/v1/MediaItems/Upload`, formData);
|
13000
|
-
if (result) {
|
13001
|
-
mediaStore.state.mediaUploading = false;
|
13002
|
-
}
|
13003
|
-
}
|
13004
|
-
catch (e) {
|
13005
|
-
mediaStore.state.mediaUploading = false;
|
13006
|
-
}
|
13007
|
-
return result;
|
13008
|
-
}
|
13009
|
-
}
|
13010
|
-
|
13011
12984
|
const sparkleHealthCss = ":host{display:block}.health-image{display:block;max-width:300px;max-height:200px;width:auto;height:auto}";
|
13012
12985
|
|
13013
12986
|
const SparkleHealth = class {
|
@@ -13122,12 +13095,13 @@ const PageLogin = class {
|
|
13122
13095
|
this.submitted = true;
|
13123
13096
|
if (this.password.valid && this.username.valid) {
|
13124
13097
|
//await UserData.login(this.username.value);
|
13125
|
-
await AuthService.getInstance().authenticate({
|
13098
|
+
let result = await AuthService.getInstance().authenticate({
|
13126
13099
|
Email: this.username.value,
|
13127
13100
|
Password: this.password.value,
|
13128
13101
|
RememberClient: this.rememberMe.value
|
13129
13102
|
});
|
13130
|
-
|
13103
|
+
console.log(result);
|
13104
|
+
//sessionStorage.setItem('rememberMe', this.rememberMe.value == true ? '1' : '0');
|
13131
13105
|
this.userDidLogIn.emit({ loginStatus: true });
|
13132
13106
|
}
|
13133
13107
|
}
|
@@ -13390,7 +13364,7 @@ const SparkleOnlineStudents = class {
|
|
13390
13364
|
};
|
13391
13365
|
SparkleOnlineStudents.style = onlineStudentsCss;
|
13392
13366
|
|
13393
|
-
const pageCss = ".Error{align-items:center;background-color:var(--offset-background);color:var(--text-color--light);display:flex;flex-direction:column;justify-content:center;line-height:1;white-space:nowrap}.Error.full-screen{padding-bottom:3rem}.Error>*{margin:10px}.Error h1,.Error div{color:inherit;font-size:3rem}.Error div{text-shadow:3px 3px 3px rgba(0,0,0,0.1)}.Error p{font-size:18px}sparkle-page{display:grid;font-size:16px;grid-template-columns:1fr minmax(0, var(--page-width, 720px)) 1fr;line-height:2;margin-left:var(--page-margin-left);margin-top:var(--header-height);overflow-x:hidden;transform:var(--page-transform, none);transition:transform 200ms cubic-bezier(0.2, 1, 0.2, 1)}@media (min-width: 1234px){sparkle-page{grid-template-columns:1fr minmax(0, var(--page-width, 720px)) 3fr}}@media (min-width: 1800px){sparkle-page{grid-template-columns:1fr minmax(0, var(--page-width, 720px)) 1fr 240px}}sparkle-page>main{position:relative;grid-column:2;margin-bottom:3rem;padding:var(--page-padding, 2rem 1rem);position:relative}sparkle-page sparkle-pagination{grid-column:1 / -1}sparkle-page .full-screen{grid-column:1 / -1;height:calc(100vh - var(--header-height));margin-bottom:0;overflow:hidden;padding:0}sparkle-page .page-heading-encapsulation{text-transform:uppercase;background:transparent;color:#2d4665;border:1px solid #dee3ea;border-radius:14px;height:24px;padding:2px 8px;font-weight:600;font-size:10px;line-height:14px;display:inline-flex;align-items:center;align-self:center;justify-self:flex-end;letter-spacing:0.08em;float:right}sparkle-page .page-heading-encapsulation:hover{border-color:#92a1b3}sparkle-page h1{display:flex;justify-content:space-between;margin-top:2rem;margin-bottom:1rem}sparkle-page h2 a[href^='#'],sparkle-page h3 a[href^='#'],sparkle-page h4 a[href^='#'],sparkle-page h5 a[href^='#'],sparkle-page h6 a[href^='#']{color:inherit;position:relative}sparkle-page h2 a[href^='#']:before,sparkle-page h3 a[href^='#']:before,sparkle-page h4 a[href^='#']:before,sparkle-page h5 a[href^='#']:before,sparkle-page h6 a[href^='#']:before{content:'#';opacity:0;padding-right:5px;position:absolute;right:100%;transition:opacity 100ms ease}sparkle-page h2 a[href^='#']:hover:before,sparkle-page h3 a[href^='#']:hover:before,sparkle-page h4 a[href^='#']:hover:before,sparkle-page h5 a[href^='#']:hover:before,sparkle-page h6 a[href^='#']:hover:before{opacity:1}sparkle-page h2 code,sparkle-page h3 code,sparkle-page h4 code,sparkle-page h5 code,sparkle-page h6 code{background:none;font-size:inherit}sparkle-page aside{float:right;margin-left:20px;margin-bottom:20px}@media (min-width: 1234px){sparkle-page main.no-demo .page-meta{position:fixed;right:0;top:100px;width:240px;transition:0.2s transform ease}sparkle-header.hidden~stencil-route sparkle-page main.no-demo .page-meta{transform:translateY(-60px)}}sparkle-page main.has-demo .page-meta internal-ad{display:none}sparkle-page .controls{display:flex;justify-content:flex-end}";
|
13367
|
+
const pageCss = ".Error{align-items:center;background-color:var(--offset-background);color:var(--text-color--light);display:flex;flex-direction:column;justify-content:center;line-height:1;white-space:nowrap}.Error.full-screen{padding-bottom:3rem}.Error>*{margin:10px}.Error h1,.Error div{color:inherit;font-size:3rem}.Error div{text-shadow:3px 3px 3px rgba(0,0,0,0.1)}.Error p{font-size:18px}sparkle-page{display:grid;font-size:16px;grid-template-columns:1fr minmax(0, var(--page-width, 720px)) 1fr;line-height:2;margin-left:var(--page-margin-left);margin-top:var(--header-height);overflow-x:hidden;transform:var(--page-transform, none);transition:transform 200ms cubic-bezier(0.2, 1, 0.2, 1)}@media (min-width: 1234px){sparkle-page{grid-template-columns:1fr minmax(0, var(--page-width, 720px)) 3fr}}@media (min-width: 1800px){sparkle-page{grid-template-columns:1fr minmax(0, var(--page-width, 720px)) 1fr 240px}}sparkle-page>main{position:relative;grid-column:2;margin-bottom:3rem;padding:var(--page-padding, 2rem 1rem);position:relative}sparkle-page sparkle-pagination{grid-column:1 / -1}sparkle-page .full-screen{grid-column:1 / -1;height:calc(100vh - var(--header-height));margin-bottom:0;overflow:hidden;padding:0}sparkle-page .page-heading-encapsulation{text-transform:uppercase;background:transparent;color:#2d4665;border:1px solid #dee3ea;border-radius:14px;height:24px;padding:2px 8px;font-weight:600;font-size:10px;line-height:14px;display:inline-flex;align-items:center;align-self:center;justify-self:flex-end;letter-spacing:0.08em;float:right}sparkle-page .page-heading-encapsulation:hover{border-color:#92a1b3}sparkle-page h1{display:flex;justify-content:space-between;margin-top:2rem;margin-bottom:1rem}sparkle-page h2 a[href^='#'],sparkle-page h3 a[href^='#'],sparkle-page h4 a[href^='#'],sparkle-page h5 a[href^='#'],sparkle-page h6 a[href^='#']{color:inherit;position:relative}sparkle-page h2 a[href^='#']:before,sparkle-page h3 a[href^='#']:before,sparkle-page h4 a[href^='#']:before,sparkle-page h5 a[href^='#']:before,sparkle-page h6 a[href^='#']:before{content:'#';opacity:0;padding-right:5px;position:absolute;right:100%;transition:opacity 100ms ease}sparkle-page h2 a[href^='#']:hover:before,sparkle-page h3 a[href^='#']:hover:before,sparkle-page h4 a[href^='#']:hover:before,sparkle-page h5 a[href^='#']:hover:before,sparkle-page h6 a[href^='#']:hover:before{opacity:1}sparkle-page h2 code,sparkle-page h3 code,sparkle-page h4 code,sparkle-page h5 code,sparkle-page h6 code{background:none;font-size:inherit}sparkle-page aside{float:right;margin-left:20px;margin-bottom:20px}@media (min-width: 1234px){sparkle-page main.no-demo .page-meta{position:fixed;right:0;top:100px;width:240px;transition:0.2s transform ease}sparkle-header.hidden~stencil-route sparkle-page main.no-demo .page-meta{transform:translateY(-60px)}}sparkle-page main.has-demo .page-meta internal-ad{display:none}sparkle-page .controls{display:flex;justify-content:flex-end}.controls ion-button ion-icon{color:#fff}";
|
13394
13368
|
|
13395
13369
|
const SparklePage = class {
|
13396
13370
|
constructor(hostRef) {
|
@@ -13399,7 +13373,15 @@ const SparklePage = class {
|
|
13399
13373
|
this.presentation = false;
|
13400
13374
|
this.page = { title: null, path: null, body: null, pageInfo: null };
|
13401
13375
|
this.isLesson = false;
|
13402
|
-
this.
|
13376
|
+
this.eventEmitter = (user, data) => {
|
13377
|
+
let event = new CustomEvent('receivedSignalREvent', { detail: JSON.parse(data) });
|
13378
|
+
document.body.dispatchEvent(event);
|
13379
|
+
};
|
13380
|
+
this.pollSubmissionEventEmitter = (type, data) => {
|
13381
|
+
let event = new CustomEvent('receivedPollSubmissionSignalREvent', { detail: { data: data, type: type } });
|
13382
|
+
document.body.dispatchEvent(event);
|
13383
|
+
};
|
13384
|
+
this.handleFacilitatorNavigationChange = url => {
|
13403
13385
|
this.history.replace(url, {});
|
13404
13386
|
};
|
13405
13387
|
this.validateFetch = (response) => {
|
@@ -13412,7 +13394,7 @@ const SparklePage = class {
|
|
13412
13394
|
this.badFetch = null;
|
13413
13395
|
this.page = page;
|
13414
13396
|
if (this.presentation) {
|
13415
|
-
this.page = Object.assign(Object.assign({}, this.page), { previousUrl:
|
13397
|
+
this.page = Object.assign(Object.assign({}, this.page), { previousUrl: '/presentation' + this.page.previousUrl, nextUrl: '/presentation' + this.page.nextUrl });
|
13416
13398
|
}
|
13417
13399
|
StoreService.getInstance().UpdateTocPageInfo(this.page.pageInfo);
|
13418
13400
|
this.isLesson = this.page.pageInfo.pageId > 0;
|
@@ -13424,7 +13406,7 @@ const SparklePage = class {
|
|
13424
13406
|
title: error.statusText,
|
13425
13407
|
body: null,
|
13426
13408
|
path: null,
|
13427
|
-
pageInfo: null
|
13409
|
+
pageInfo: null,
|
13428
13410
|
};
|
13429
13411
|
};
|
13430
13412
|
}
|
@@ -13435,19 +13417,25 @@ const SparklePage = class {
|
|
13435
13417
|
}
|
13436
13418
|
componentDidLoad() {
|
13437
13419
|
if (this.presentation) {
|
13438
|
-
signalRStore.onChange(
|
13420
|
+
signalRStore.onChange('connected', connected => {
|
13439
13421
|
if (connected) {
|
13440
|
-
SignalRService.getInstance().connection.on(
|
13422
|
+
SignalRService.getInstance().connection.on('SendMessage', this.eventEmitter);
|
13423
|
+
SignalRService.getInstance().connection.on('NavigateFacilitatorPresentationCourseTo', this.handleFacilitatorNavigationChange);
|
13424
|
+
SignalRService.getInstance().connection.on('PollSubmission', this.pollSubmissionEventEmitter);
|
13425
|
+
}
|
13426
|
+
else {
|
13427
|
+
SignalRService.getInstance().connection.off('SendMessage', this.eventEmitter);
|
13428
|
+
SignalRService.getInstance().connection.off('PollSubmission', this.eventEmitter);
|
13429
|
+
SignalRService.getInstance().connection.off('NavigateFacilitatorPresentationCourseTo', this.handleFacilitatorNavigationChange);
|
13441
13430
|
}
|
13442
13431
|
});
|
13443
13432
|
}
|
13444
13433
|
}
|
13445
13434
|
fetchPage(path, oldPath) {
|
13446
|
-
if (SignalRService.getInstance().connection.
|
13447
|
-
SignalRService.getInstance().callSignalR(
|
13435
|
+
if (SignalRService.getInstance().connection._connectionState == 'Connected') {
|
13436
|
+
SignalRService.getInstance().callSignalR('OnStudentNavigate', { url: window.location.href });
|
13448
13437
|
if (this.presentation) {
|
13449
|
-
|
13450
|
-
SignalRService.getInstance().connection.on("NavigateFacilitatorPresentationCourseTo", this.handleFacilitatorNavigationChange);
|
13438
|
+
SignalRService.getInstance().connection.on('NavigateFacilitatorPresentationCourseTo', this.handleFacilitatorNavigationChange);
|
13451
13439
|
}
|
13452
13440
|
}
|
13453
13441
|
if (path === null || path === oldPath) {
|
@@ -13518,7 +13506,7 @@ const SparklePage = class {
|
|
13518
13506
|
async presentFeedbackModal() {
|
13519
13507
|
const modal = await modalController.create({
|
13520
13508
|
component: 'sparkle-feedback',
|
13521
|
-
cssClass: 'sparkle-modal sparkle-feedback-modal'
|
13509
|
+
cssClass: 'sparkle-modal sparkle-feedback-modal',
|
13522
13510
|
});
|
13523
13511
|
await modal.present();
|
13524
13512
|
}
|
@@ -13549,29 +13537,28 @@ const SparklePage = class {
|
|
13549
13537
|
text: 'Cancel',
|
13550
13538
|
role: 'cancel',
|
13551
13539
|
cssClass: 'secondary',
|
13552
|
-
handler: () => {
|
13553
|
-
|
13554
|
-
|
13540
|
+
handler: () => { },
|
13541
|
+
},
|
13542
|
+
{
|
13555
13543
|
text: 'Ok',
|
13556
|
-
handler:
|
13557
|
-
|
13558
|
-
|
13559
|
-
]
|
13544
|
+
handler: data => { },
|
13545
|
+
},
|
13546
|
+
],
|
13560
13547
|
});
|
13561
13548
|
await alert.present();
|
13562
13549
|
}
|
13563
13550
|
openWindows() {
|
13564
13551
|
//this.jwtService.updateDefaultCourseClassId(data);
|
13565
|
-
window.open(window.location.origin +
|
13552
|
+
window.open(window.location.origin + '/presentation' + this.path.replace('.json', ''), '_blank');
|
13566
13553
|
setTimeout(() => {
|
13567
|
-
window.open(window.location.origin +
|
13554
|
+
window.open(window.location.origin + '/presentation' + '/teacher' + this.path.replace('.json', ''), '_blank');
|
13568
13555
|
}, 500);
|
13569
13556
|
}
|
13570
13557
|
renderControls() {
|
13571
13558
|
if (AuthStore.state.isAuthenticated) {
|
13572
|
-
return (h$1("div", { class: "controls" }, h$1("ion-button", { onClick: () => this.presentFeedbackModal() }, h$1("ion-icon", { name: "chatbox-outline" })), this.isLesson && userStore.state.user && userStore.state.user.Roles.indexOf('Facilitator') > -1 && h$1("ion-button", { onClick: () => this.openProjectorPage() }, h$1("ion-icon", { name: "desktop-outline" }))));
|
13559
|
+
return (h$1("div", { class: "controls" }, h$1("ion-button", { onClick: () => this.presentFeedbackModal() }, h$1("ion-icon", { name: "chatbox-outline" })), this.isLesson && userStore.state.user && userStore.state.user.Roles.indexOf('Facilitator') > -1 && (h$1("ion-button", { onClick: () => this.openProjectorPage() }, h$1("ion-icon", { name: "desktop-outline" })))));
|
13573
13560
|
}
|
13574
|
-
return
|
13561
|
+
return '';
|
13575
13562
|
}
|
13576
13563
|
__stencil_render() {
|
13577
13564
|
if (this.path) {
|
@@ -13581,12 +13568,12 @@ const SparklePage = class {
|
|
13581
13568
|
}
|
13582
13569
|
const Template = templates[page.template] || templates.default;
|
13583
13570
|
const content = [
|
13584
|
-
h$1("main", { class: 'no-demo' }, this.renderControls(), h$1(Template, { page: page }))
|
13571
|
+
h$1("main", { class: 'no-demo' }, this.renderControls(), h$1(Template, { page: page })),
|
13585
13572
|
];
|
13586
13573
|
return content;
|
13587
13574
|
}
|
13588
13575
|
else {
|
13589
|
-
return h$1("main", { class: 'no-demo' }, h$1("slot", null));
|
13576
|
+
return (h$1("main", { class: 'no-demo' }, h$1("slot", null)));
|
13590
13577
|
}
|
13591
13578
|
}
|
13592
13579
|
static get watchers() { return {
|
@@ -13748,22 +13735,24 @@ const SparkleRoot = class {
|
|
13748
13735
|
constructor(hostRef) {
|
13749
13736
|
registerInstance(this, hostRef);
|
13750
13737
|
this.history = null;
|
13751
|
-
this.handleStudentNavigationChange =
|
13738
|
+
this.handleStudentNavigationChange = url => {
|
13752
13739
|
this.history.replace(url, {});
|
13753
13740
|
};
|
13754
13741
|
}
|
13755
13742
|
async componentWillLoad() {
|
13756
13743
|
setupConfig({
|
13757
|
-
sparkle: Object.assign(Object.assign({}, this.config), { prod: true })
|
13744
|
+
sparkle: Object.assign(Object.assign({}, this.config), { prod: true }),
|
13758
13745
|
});
|
13759
13746
|
//return Promise.reject();
|
13760
13747
|
await HttpService.getInstance();
|
13761
13748
|
await HttpService.init();
|
13762
|
-
|
13763
|
-
|
13749
|
+
let auth = await get$1(AppConsts.AUTH_USER_LOCALSTORAGE);
|
13750
|
+
console.log(auth);
|
13751
|
+
//TODO: check expiry as well
|
13752
|
+
if (auth && auth.JWToken) {
|
13764
13753
|
AuthStore.state.isAuthenticated = true;
|
13765
13754
|
}
|
13766
|
-
AuthStore.onChange(
|
13755
|
+
AuthStore.onChange('isAuthenticated', async (isAuthenticated) => {
|
13767
13756
|
if (isAuthenticated) {
|
13768
13757
|
console.log('authenticated');
|
13769
13758
|
await StudentService.getInstance().fetchUserConfiguration();
|
@@ -13775,8 +13764,8 @@ const SparkleRoot = class {
|
|
13775
13764
|
//SignalRAspNetCoreHelper.initSignalR();
|
13776
13765
|
}
|
13777
13766
|
componentDidLoad() {
|
13778
|
-
SignalRService.getInstance().connection.on(
|
13779
|
-
AuthStore.onChange(
|
13767
|
+
SignalRService.getInstance().connection.on('NavigateStudentTo', this.handleStudentNavigationChange);
|
13768
|
+
AuthStore.onChange('isAuthenticated', async (isAuthenticated) => {
|
13780
13769
|
if (isAuthenticated) {
|
13781
13770
|
SignalRService.getInstance().start();
|
13782
13771
|
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { a as axios_1, u as utils, f as formats, s as sideChannel, T as TocStore } from './auth.store-dba2c2da.js';
|
2
2
|
import { t as toastController } from './overlays-3b4dca92.js';
|
3
|
-
import { E as EnvironmentConfigService } from './environment-config.service-
|
3
|
+
import { E as EnvironmentConfigService } from './environment-config.service-b191f276.js';
|
4
|
+
import { T as TokenService } from './token.service-20f1a256.js';
|
4
5
|
|
5
6
|
var axios = axios_1;
|
6
7
|
|
@@ -596,7 +597,7 @@ class HttpService {
|
|
596
597
|
this.http = axios.create({
|
597
598
|
baseURL: sparkleConfig.apiUrl,
|
598
599
|
headers: {
|
599
|
-
'Content-Type': 'application/json'
|
600
|
+
'Content-Type': 'application/json',
|
600
601
|
},
|
601
602
|
timeout: 30000,
|
602
603
|
paramsSerializer: function (params) {
|
@@ -605,9 +606,10 @@ class HttpService {
|
|
605
606
|
});
|
606
607
|
},
|
607
608
|
});
|
608
|
-
this.http.interceptors.request.use(function (config) {
|
609
|
-
|
610
|
-
|
609
|
+
this.http.interceptors.request.use(async function (config) {
|
610
|
+
let token = await TokenService.getInstance().getToken();
|
611
|
+
if (token) {
|
612
|
+
config.headers.common['Authorization'] = 'Bearer ' + token;
|
611
613
|
}
|
612
614
|
// //config.headers.common['.AspNetCore.Culture'] = sparkle.utils.getCookieValue('Sparkle.Localization.CultureName');
|
613
615
|
config.headers.common['Sparkle.CourseId'] = sparkleConfig.courseId;
|
@@ -625,7 +627,7 @@ class HttpService {
|
|
625
627
|
if (response.data.Message) {
|
626
628
|
const toast = await toastController.create({
|
627
629
|
message: response.data.Message,
|
628
|
-
duration: 3000
|
630
|
+
duration: 3000,
|
629
631
|
});
|
630
632
|
toast.present();
|
631
633
|
}
|
@@ -636,7 +638,7 @@ class HttpService {
|
|
636
638
|
// that falls out of the range of 2xx
|
637
639
|
const toast = await toastController.create({
|
638
640
|
message: error.response.data.ErrorMessage,
|
639
|
-
duration: 3000
|
641
|
+
duration: 3000,
|
640
642
|
});
|
641
643
|
toast.present();
|
642
644
|
return Promise.reject(error);
|
@@ -646,7 +648,7 @@ class HttpService {
|
|
646
648
|
// that falls out of the range of 2xx
|
647
649
|
const toast = await toastController.create({
|
648
650
|
message: error.response.data.Message,
|
649
|
-
duration: 3000
|
651
|
+
duration: 3000,
|
650
652
|
});
|
651
653
|
toast.present();
|
652
654
|
return Promise.reject(error.response.data);
|
@@ -656,7 +658,7 @@ class HttpService {
|
|
656
658
|
// that falls out of the range of 2xx
|
657
659
|
const toast = await toastController.create({
|
658
660
|
message: error.response.data.Message,
|
659
|
-
duration: 3000
|
661
|
+
duration: 3000,
|
660
662
|
});
|
661
663
|
toast.present();
|
662
664
|
return Promise.reject(error);
|
@@ -669,8 +671,8 @@ class HttpService {
|
|
669
671
|
}
|
670
672
|
else {
|
671
673
|
const toast = await toastController.create({
|
672
|
-
message:
|
673
|
-
duration: 3000
|
674
|
+
message: 'Unknown Error',
|
675
|
+
duration: 3000,
|
674
676
|
});
|
675
677
|
toast.present();
|
676
678
|
}
|
package/dist/esm/index.js
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
-
export { A as AuthService, P as PrivateRoute, i as initSetupEnvironmentConfig, s as setupEnvironmentConfig } from './PrivateRoute-
|
2
|
-
export { E as EnvironmentConfigService } from './environment-config.service-
|
3
|
-
export { A as AssetsService } from './assets.service-
|
1
|
+
export { A as AuthService, P as PrivateRoute, i as initSetupEnvironmentConfig, s as setupEnvironmentConfig } from './PrivateRoute-c6e80d5d.js';
|
2
|
+
export { E as EnvironmentConfigService } from './environment-config.service-b191f276.js';
|
3
|
+
export { A as AssetsService } from './assets.service-def1d63c.js';
|
4
4
|
export { A as AuthStore } from './auth.store-dba2c2da.js';
|
5
5
|
import './index-c04b9ed5.js';
|
6
6
|
import './localstorage.service-4bf408c8.js';
|
7
|
-
import './httpService-
|
7
|
+
import './httpService-db476835.js';
|
8
8
|
import './overlays-3b4dca92.js';
|
9
9
|
import './ionic-global-4903e23e.js';
|
10
10
|
import './hardware-back-button-fa04d6e9.js';
|
11
11
|
import './helpers-bf0e23d6.js';
|
12
|
+
import './token.service-20f1a256.js';
|
@@ -3,9 +3,15 @@ import { g as getIonMode } from './ionic-global-4903e23e.js';
|
|
3
3
|
import { f as focusElement, k as findItemLabel, b as getAriaLabel, d as renderHiddenInput } from './helpers-bf0e23d6.js';
|
4
4
|
import { f as popoverController, h as actionSheetController, a as alertController } from './overlays-3b4dca92.js';
|
5
5
|
import { h as hostContext } from './theme-7ef00c83.js';
|
6
|
-
import {
|
7
|
-
import './
|
6
|
+
import { H as HttpService } from './httpService-db476835.js';
|
7
|
+
import { F as FeedService } from './feed.service-8385ad7a.js';
|
8
|
+
import { M as MediaService } from './media.service-b68cbfff.js';
|
9
|
+
import { T as TokenService } from './token.service-20f1a256.js';
|
10
|
+
import { S as SparkleGlobal } from './util-57cc8006.js';
|
8
11
|
import './hardware-back-button-fa04d6e9.js';
|
12
|
+
import './auth.store-dba2c2da.js';
|
13
|
+
import './environment-config.service-b191f276.js';
|
14
|
+
import './localstorage.service-4bf408c8.js';
|
9
15
|
|
10
16
|
/*!
|
11
17
|
* (C) Ionic http://ionicframework.com - MIT License
|
@@ -494,6 +500,20 @@ const SelectOption = class {
|
|
494
500
|
let selectOptionIds = 0;
|
495
501
|
SelectOption.style = selectOptionCss;
|
496
502
|
|
503
|
+
class AssignmentService {
|
504
|
+
constructor() { }
|
505
|
+
static getInstance() {
|
506
|
+
if (!AssignmentService.instance) {
|
507
|
+
AssignmentService.instance = new AssignmentService();
|
508
|
+
}
|
509
|
+
return AssignmentService.instance;
|
510
|
+
}
|
511
|
+
async createAssignment(payload) {
|
512
|
+
let result = await HttpService.http.post(`api/v1/Assignment/Create`, payload);
|
513
|
+
return result;
|
514
|
+
}
|
515
|
+
}
|
516
|
+
|
497
517
|
const sparkleFeedPostCss = ":host{display:block}.post-footer-container{display:flex;justify-content:flex-end}.post-footer{display:flex;justify-content:space-between;align-items:center}.error{color:red;margin-right:10px}.success{color:green;margin-right:10px}.uploaded-image{display:block;max-height:140px;width:auto !important}.public-post-toggle{display:flex;justify-content:flex-end;align-items:center}.assignment-name{display:none}";
|
498
518
|
|
499
519
|
const SparkleFeedPost = class {
|
@@ -512,26 +532,10 @@ const SparkleFeedPost = class {
|
|
512
532
|
setText(text) {
|
513
533
|
this.postText = text;
|
514
534
|
}
|
515
|
-
// async postToFeed() {
|
516
|
-
// const sparkleConfig: EnvironmentSparkleConfig = EnvironmentConfigService.getInstance().get('sparkle');
|
517
|
-
// const tocData = await AssetsService.getInstance().loadJsonFile<ICourse>(sparkleConfig.tocPath);
|
518
|
-
// var model = {
|
519
|
-
// CourseId: tocData.id,
|
520
|
-
// MiniAppId: SparkleGlobal.MY_GOALS_APP_ID,
|
521
|
-
// PostText: MyGoalTemplate(this.name.value, this.goalUpdateText.value, this.progress),
|
522
|
-
// PostTextJSON: MyGoalTemplateJSON(this.name.value, this.goalUpdateText.value, this.progress),
|
523
|
-
// IsPublic: this.public,
|
524
|
-
// ExternalResourceUrl: "",
|
525
|
-
// }
|
526
|
-
// const result = await FeedService.getInstance().createPost(model);
|
527
|
-
// if (result.Succeeded) {
|
528
|
-
// //show success toast
|
529
|
-
// }
|
530
|
-
// }
|
531
535
|
isAuthenticated() {
|
532
536
|
try {
|
533
|
-
|
534
|
-
if (!!
|
537
|
+
let token = TokenService.getInstance().getTokenSync();
|
538
|
+
if (!!token) {
|
535
539
|
return true;
|
536
540
|
}
|
537
541
|
}
|
@@ -539,63 +543,68 @@ const SparkleFeedPost = class {
|
|
539
543
|
return false;
|
540
544
|
}
|
541
545
|
}
|
542
|
-
submitPost() {
|
546
|
+
async submitPost() {
|
547
|
+
this.postLoading = true;
|
543
548
|
this.errorMessage = '';
|
544
549
|
this.successMessage = '';
|
545
550
|
//let formData = new FormData(this.el.querySelector("form")) as any;
|
546
551
|
//var postText = this.el.getElementsByClassName("PostText")[0] as HTMLInputElement;
|
547
|
-
this.el.getElementsByClassName('PostExternalUrl')[0];
|
548
|
-
this.el.getElementsByClassName('IsPublic')[0];
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
552
|
+
var postExternalUrl = this.el.getElementsByClassName('PostExternalUrl')[0];
|
553
|
+
var isPublic = this.el.getElementsByClassName('IsPublic')[0];
|
554
|
+
var data = {
|
555
|
+
PostText: this.postText,
|
556
|
+
IsPublic: isPublic.checked,
|
557
|
+
ExternalResourceUrl: postExternalUrl.value,
|
558
|
+
MiniAppId: SparkleGlobal.MY_GOALS_APP_ID,
|
559
|
+
AssignmentName: this.assignmentName,
|
560
|
+
AssignmentData: '',
|
561
|
+
PostTextJSON: null,
|
562
|
+
};
|
563
|
+
const result = await FeedService.getInstance().createPost(data);
|
564
|
+
if (result.Succeeded) {
|
565
|
+
this.postLoading = false;
|
566
|
+
//show success toast
|
567
|
+
this.successMessage = 'Posted Successfully.';
|
568
|
+
this.postText = '';
|
569
|
+
this.externalResourceUrl = '';
|
570
|
+
this.uploadedImage = '';
|
571
|
+
}
|
572
|
+
else {
|
573
|
+
this.postLoading = false;
|
574
|
+
this.errorMessage = 'There is an error while posting to feed.';
|
575
|
+
}
|
576
|
+
if (this.assignmentName) {
|
577
|
+
var assignmentModel = {
|
578
|
+
AssignmentData: JSON.stringify({ text: data.PostText, url: data.ExternalResourceUrl }),
|
579
|
+
AssignmentName: this.assignmentName,
|
580
|
+
};
|
581
|
+
await AssignmentService.getInstance().createAssignment(assignmentModel);
|
582
|
+
}
|
583
|
+
}
|
584
|
+
async uploadImage(evt) {
|
585
|
+
this.uploadImageLoading = true;
|
586
|
+
var files = evt.target.files;
|
587
|
+
let result = await MediaService.getInstance().uploadImage(files);
|
588
|
+
if (result.Succeeded) {
|
589
|
+
console.log(result);
|
590
|
+
this.uploadImageLoading = false;
|
591
|
+
this.uploadedImage = result.Data.length > 0 ? result.Data[0].FullImageUrl : '';
|
592
|
+
this.externalResourceUrl = result.Data.length > 0 ? result.Data[0].FullImageUrl : '';
|
593
|
+
}
|
594
|
+
else {
|
595
|
+
this.uploadImageLoading = false;
|
596
|
+
this.errorMessage = 'There is an error while uploading an image.';
|
597
|
+
}
|
590
598
|
}
|
591
599
|
selectFile() {
|
592
600
|
var fileInput = document.getElementById('fileInput');
|
593
601
|
fileInput.click();
|
594
602
|
}
|
595
603
|
renderUserInfo() {
|
596
|
-
|
597
|
-
|
598
|
-
|
604
|
+
let authUser = TokenService.getInstance().getAuthUserSync();
|
605
|
+
//var tokenInfo = { Token: null, ProfileImageUrl: null };
|
606
|
+
if (authUser && authUser.JWToken) {
|
607
|
+
return (h("ion-avatar", { class: "header-avatar", slot: "end" }, authUser.PhotoUrl ? h("img", { src: authUser.PhotoUrl }) : h("img", { src: "/assets/img/user.png" })));
|
599
608
|
}
|
600
609
|
else {
|
601
610
|
return (h("ion-button", { slot: "end", href: "/login" }, "Login to Post"));
|
@@ -603,7 +612,7 @@ const SparkleFeedPost = class {
|
|
603
612
|
}
|
604
613
|
render() {
|
605
614
|
const userInfo = this.renderUserInfo();
|
606
|
-
return (h(Host, null, h("div", { class: "assignment-name", ref: el => (this.ref = el) }, h("slot", null)), h("ion-card", null, h("ion-item", { class: "header", lines: "full" }, userInfo), h("ion-card-content", null, h("form", null, h("ion-list", null, h("ion-item", { class: "padding" }, h("ion-textarea", { class: "PostText", required: true, placeholder: "Post Text", name: "PostText", value: this.postText })), h("ion-item", { class: "padding" }, h("ion-input", { class: "PostExternalUrl", required: true, type: "text", placeholder: "URL", name: "ExternalResourceUrl", value: this.externalResourceUrl })), this.uploadedImage ? (h("ion-item", { class: "padding" }, h("img", { class: "uploaded-image", src: this.uploadedImage }))) : (''), h("ion-item", { lines: "none" }, h("input", { type: "file", id: "fileInput", onChange: evt => this.uploadImage(evt), style: { display: 'none' }, accept: "image/*" }), this.uploadImageLoading ? h("ion-spinner", { color: "primary" }) : '', h("ion-button", { slot: "start", onClick: evt => this.selectFile() }, h("ion-icon", { name: "add" }), "Upload Image")), h("div", { class: "public-post-toggle" }, h("ion-toggle", { class: "IsPublic", color: "primary", name: "IsPublic" }), h("div", null, "Public Post")), h("div", { class: "post-footer-container" }, h("div", { class: "post-footer" }, h("div", null, h("div", { class: "error" }, this.errorMessage), h("div", { class: "success" }, this.successMessage)), h("ion-button", { slot: "end", size: "default", onClick: evt => this.submitPost(), disabled: !this.isAuthenticated() }, "Post")))))))));
|
615
|
+
return (h(Host, null, h("div", { class: "assignment-name", ref: el => (this.ref = el) }, h("slot", null)), h("ion-card", null, h("ion-item", { class: "header", lines: "full" }, userInfo), h("ion-card-content", null, h("form", null, h("ion-list", null, h("ion-item", { class: "padding" }, h("ion-textarea", { class: "PostText", required: true, placeholder: "Post Text", name: "PostText", value: this.postText })), h("ion-item", { class: "padding" }, h("ion-input", { class: "PostExternalUrl", required: true, type: "text", placeholder: "URL", name: "ExternalResourceUrl", value: this.externalResourceUrl })), this.uploadedImage ? (h("ion-item", { class: "ion-padding", lines: "none" }, h("img", { class: "uploaded-image", src: this.uploadedImage }))) : (''), h("ion-item", { lines: "none" }, h("input", { type: "file", id: "fileInput", onChange: evt => this.uploadImage(evt), style: { display: 'none' }, accept: "image/*" }), this.uploadImageLoading ? h("ion-spinner", { color: "primary" }) : '', h("ion-button", { slot: "start", onClick: evt => this.selectFile() }, h("ion-icon", { name: "add" }), "Upload Image")), h("div", { class: "public-post-toggle" }, h("ion-toggle", { class: "IsPublic", color: "primary", name: "IsPublic" }), h("div", null, "Public Post")), h("div", { class: "post-footer-container" }, h("div", { class: "post-footer" }, h("div", null, h("div", { class: "error" }, this.errorMessage), h("div", { class: "success" }, this.successMessage)), h("div", null, this.postLoading ? h("ion-spinner", { color: "primary" }) : ''), h("ion-button", { slot: "end", size: "default", onClick: evt => this.submitPost(), disabled: this.postLoading || !this.isAuthenticated() }, "Post")))))))));
|
607
616
|
}
|
608
617
|
get el() { return getElement(this); }
|
609
618
|
};
|