@sparkle-learning/core 0.0.39 → 0.0.40
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/{auth.service-4b584cd7.js → PrivateRoute-074c584e.js} +30 -0
- package/dist/cjs/{sparkle-export-lessons_6.cjs.entry.js → header-mobile-collapse_61.cjs.entry.js} +11602 -2716
- package/dist/cjs/{icons-c61db785.js → icons-fda820af.js} +0 -0
- package/dist/cjs/index.cjs.js +5 -6
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sparkle-code.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-core.cjs.js +1 -1
- package/dist/cjs/sparkle-feedback.cjs.entry.js +1 -2
- package/dist/cjs/sparkle-menu-collapsible.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-quiz-feedback_5.cjs.entry.js +117 -0
- package/dist/cjs/sparkle-quiz.cjs.entry.js +120 -0
- package/dist/cjs/student.service-2e58f237.js +78 -0
- package/dist/esm/{auth.service-9fb86455.js → PrivateRoute-c5441f35.js} +33 -4
- package/dist/esm/{animation-e0716b39.js → animation-12377cb3.js} +1 -1
- package/dist/esm/{auth.store-633e8414.js → auth.store-dba2c2da.js} +1 -1
- package/dist/esm/{facilitator.service-8fd435bf.js → facilitator.service-b0292f7f.js} +2 -2
- package/dist/esm/{feed.service-ace049e5.js → feed.service-8fbe4ce3.js} +3 -3
- package/dist/esm/{framework-delegate-e4f8013b.js → framework-delegate-3e634a5c.js} +1 -1
- package/dist/esm/{sparkle-export-lessons_6.entry.js → header-mobile-collapse_61.entry.js} +11501 -2670
- package/dist/esm/{helpers-03073fe4.js → helpers-bf0e23d6.js} +1 -1
- package/dist/esm/{httpService-61864992.js → httpService-7b75b095.js} +2 -2
- package/dist/esm/{icons-90b957ab.js → icons-1c794c74.js} +1 -1
- package/dist/esm/{index-b4b4e503.js → index-2b84cad2.js} +3 -3
- package/dist/esm/{index-a2d2941d.js → index-45fec1e7.js} +1 -1
- package/dist/esm/{index-37004831.js → index-5e8971ae.js} +1 -1
- package/dist/esm/{index-dedabca0.js → index-cded2d87.js} +2 -2
- package/dist/esm/{index.es-283fbd2e.js → index.es-e0c0f891.js} +1 -1
- package/dist/esm/index.js +5 -6
- package/dist/esm/{input-shims-cc3720a0.js → input-shims-671d8d9f.js} +2 -2
- package/dist/esm/ion-accordion.entry.js +1 -1
- package/dist/esm/ion-action-sheet_4.entry.js +5 -5
- package/dist/esm/ion-app.entry.js +3 -3
- package/dist/esm/ion-back-button.entry.js +1 -1
- package/dist/esm/ion-breadcrumb.entry.js +1 -1
- package/dist/esm/ion-content_2.entry.js +2 -2
- package/dist/esm/ion-datetime-button.entry.js +1 -1
- package/dist/esm/ion-datetime.entry.js +1 -1
- package/dist/esm/ion-fab-button.entry.js +1 -1
- package/dist/esm/ion-footer.entry.js +2 -2
- package/dist/esm/ion-img.entry.js +1 -1
- package/dist/esm/ion-infinite-scroll.entry.js +2 -2
- package/dist/esm/ion-item-options.entry.js +1 -1
- package/dist/esm/ion-item-sliding.entry.js +2 -2
- package/dist/esm/ion-loading.entry.js +3 -3
- package/dist/esm/ion-menu-button.entry.js +4 -4
- package/dist/esm/ion-menu-toggle.entry.js +4 -4
- package/dist/esm/ion-menu.entry.js +4 -4
- package/dist/esm/ion-modal.entry.js +6 -6
- package/dist/esm/ion-nav.entry.js +4 -4
- package/dist/esm/ion-picker-column-internal_2.entry.js +1 -1
- package/dist/esm/ion-picker-column.entry.js +1 -1
- package/dist/esm/ion-picker.entry.js +3 -3
- package/dist/esm/ion-progress-bar.entry.js +1 -1
- package/dist/esm/ion-refresher.entry.js +3 -3
- package/dist/esm/ion-reorder-group.entry.js +2 -2
- package/dist/esm/ion-router-outlet.entry.js +4 -4
- package/dist/esm/ion-router.entry.js +1 -1
- package/dist/esm/ion-searchbar.entry.js +1 -1
- package/dist/esm/ion-segment-button.entry.js +1 -1
- package/dist/esm/ion-segment.entry.js +1 -1
- package/dist/esm/ion-select_2.entry.js +2 -2
- package/dist/esm/ion-slides.entry.js +1 -1
- package/dist/esm/ion-tab.entry.js +2 -2
- package/dist/esm/ion-textarea.entry.js +1 -1
- package/dist/esm/ion-toast.entry.js +3 -3
- package/dist/esm/ion-toggle.entry.js +1 -1
- package/dist/esm/ion-virtual-scroll.entry.js +1 -1
- package/dist/esm/{ios.transition-3a6179bb.js → ios.transition-131d64fe.js} +3 -3
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{md.transition-cff16bf3.js → md.transition-f6126011.js} +3 -3
- package/dist/esm/{menu-toggle-util-59241733.js → menu-toggle-util-bace8ae6.js} +1 -1
- package/dist/esm/{overlays-bdd9344a.js → overlays-3b4dca92.js} +2 -2
- package/dist/esm/{purify-7085b248.js → purify-85bfcc69.js} +1 -1
- package/dist/esm/sparkle-animation-player.entry.js +1 -1
- package/dist/esm/sparkle-code.entry.js +1 -1
- package/dist/esm/sparkle-core.js +1 -1
- package/dist/esm/sparkle-facilitator-notes-form.entry.js +5 -5
- package/dist/esm/sparkle-feed-post.entry.js +1 -1
- package/dist/esm/sparkle-feedback.entry.js +5 -6
- package/dist/esm/sparkle-goal-form.entry.js +6 -6
- package/dist/esm/sparkle-menu-collapsible.entry.js +1 -1
- package/dist/esm/sparkle-quiz-feedback_5.entry.js +109 -0
- package/dist/esm/sparkle-quiz.entry.js +116 -0
- package/dist/esm/{status-tap-463d0f87.js → status-tap-dde52787.js} +2 -2
- package/dist/esm/{student.service-e6eb1f99.js → student.service-0746418b.js} +19 -3
- package/dist/esm/{swipe-back-f8765ac9.js → swipe-back-7847a0c1.js} +1 -1
- package/dist/esm/{util-a831d09d.js → util-6ef753e9.js} +1 -1
- package/dist/node_modules/@sparkle-learning/components/dist/collection/components/button/button.css +49 -0
- package/dist/node_modules/@sparkle-learning/components/dist/collection/components/cards/card/card.css +208 -0
- package/dist/node_modules/@sparkle-learning/components/dist/collection/components/cards/cards.css +31 -0
- package/dist/node_modules/@sparkle-learning/components/dist/collection/components/code/code.css +245 -0
- package/dist/node_modules/@sparkle-learning/components/dist/collection/components/dropdown/dropdown.css +115 -0
- package/dist/node_modules/@sparkle-learning/components/dist/collection/components/header/header-mobile-collapse/header-mobile-collapse.css +255 -0
- package/dist/node_modules/@sparkle-learning/components/dist/collection/components/header/header.css +232 -0
- package/dist/node_modules/@sparkle-learning/components/dist/collection/components/menu/collapsible/collapsible.css +3 -0
- package/dist/node_modules/@sparkle-learning/components/dist/collection/components/menu/menu-toggle/menu-toggle.css +25 -0
- package/dist/node_modules/@sparkle-learning/components/dist/collection/components/menu/menu.css +71 -0
- package/dist/node_modules/@sparkle-learning/components/dist/collection/components/nav/nav.css +194 -0
- package/dist/node_modules/@sparkle-learning/components/dist/collection/components/notfound-page/notfound-page.css +4 -0
- package/dist/node_modules/@sparkle-learning/components/dist/collection/components/overlay/overlay.css +67 -0
- package/dist/node_modules/@sparkle-learning/components/dist/collection/components/page-footer/page-footer.css +18 -0
- package/dist/node_modules/@sparkle-learning/components/dist/collection/components/pagination/pagination.css +89 -0
- package/dist/node_modules/@sparkle-learning/components/dist/collection/components/select/select.css +52 -0
- package/dist/node_modules/@sparkle-learning/components/dist/collection/components/sidebar/sidebar.css +98 -0
- package/dist/node_modules/@sparkle-learning/components/dist/collection/components/sparkle-lower-content-nav/sparkle-lower-content-nav.css +8 -0
- package/dist/node_modules/@sparkle-learning/components/dist/collection/components/table-of-contents/table-of-contents.css +37 -0
- package/dist/node_modules/@sparkle-learning/components/dist/collection/components/tabs/tabs.css +64 -0
- package/dist/sparkle-core/index.esm.js +1 -1
- package/dist/sparkle-core/{p-539bf742.js → p-00d10dc9.js} +2 -2
- package/dist/sparkle-core/{p-b9933822.js → p-05c032dd.js} +1 -1
- package/dist/sparkle-core/{p-dabc80c4.entry.js → p-0664370b.entry.js} +1 -1
- package/dist/sparkle-core/p-077c732b.js +4 -0
- package/dist/sparkle-core/{p-c278db5f.entry.js → p-0ad5c123.entry.js} +1 -1
- package/dist/sparkle-core/{p-b9b1d4da.entry.js → p-0afa3a4d.entry.js} +1 -1
- package/dist/sparkle-core/{p-285ab4ed.entry.js → p-0c3f3ea6.entry.js} +1 -1
- package/dist/sparkle-core/{p-727e1c28.entry.js → p-0f1c5899.entry.js} +1 -1
- package/dist/sparkle-core/{p-64e814b9.entry.js → p-11356b03.entry.js} +1 -1
- package/dist/sparkle-core/{p-b5ec8fb0.entry.js → p-11a6c175.entry.js} +1 -1
- package/dist/sparkle-core/p-12dd96d7.js +4 -0
- package/dist/sparkle-core/{p-a85598ad.js → p-1d4c7c11.js} +1 -1
- package/dist/sparkle-core/{p-c8fe45df.entry.js → p-1e125ca5.entry.js} +1 -1
- package/dist/sparkle-core/{p-cab3da3c.entry.js → p-1e4f65ee.entry.js} +1 -1
- package/dist/sparkle-core/{p-405f7c58.js → p-2033cd86.js} +2 -2
- package/dist/sparkle-core/p-23aca7ca.js +4 -0
- package/dist/sparkle-core/{p-e65c72cc.entry.js → p-24cb9a33.entry.js} +1 -1
- package/dist/sparkle-core/{p-014b5707.entry.js → p-2c1ca854.entry.js} +1 -1
- package/dist/sparkle-core/{p-340754ed.js → p-2f569553.js} +1 -1
- package/dist/sparkle-core/{p-2e2b813c.js → p-2ff67662.js} +2 -2
- package/dist/sparkle-core/{p-0c0f8acd.entry.js → p-30b810d1.entry.js} +1 -1
- package/dist/sparkle-core/{p-b236d258.entry.js → p-377b04c2.entry.js} +1 -1
- package/dist/sparkle-core/{p-fde382f0.entry.js → p-39712c56.entry.js} +1 -1
- package/dist/sparkle-core/{p-be28346b.js → p-3de0e00c.js} +1 -1
- package/dist/sparkle-core/p-462bffba.js +1 -0
- package/dist/sparkle-core/{p-3f85e1ca.js → p-48f72e63.js} +2 -2
- package/dist/sparkle-core/{p-6f0545b3.entry.js → p-54dd894f.entry.js} +1 -1
- package/dist/sparkle-core/{p-ce94efdb.entry.js → p-564e64fc.entry.js} +1 -1
- package/dist/sparkle-core/{p-db8387eb.entry.js → p-58e4bbe5.entry.js} +1 -1
- package/dist/sparkle-core/{p-ca4c8a10.js → p-5cad23f1.js} +1 -1
- package/dist/sparkle-core/p-5efc6566.js +1 -0
- package/dist/sparkle-core/{p-c9cd4ff1.js → p-600cf6a3.js} +1 -1
- package/dist/sparkle-core/{p-2e035338.entry.js → p-641bfc92.entry.js} +1 -1
- package/dist/sparkle-core/{p-b4bc8b02.entry.js → p-6faa194c.entry.js} +1 -1
- package/dist/sparkle-core/{p-2f10208d.entry.js → p-6ffd2420.entry.js} +1 -1
- package/dist/sparkle-core/p-73721c84.js +4 -0
- package/dist/sparkle-core/{p-ed9f48c4.entry.js → p-74864276.entry.js} +1 -1
- package/dist/sparkle-core/p-80d6b0e6.entry.js +1 -0
- package/dist/sparkle-core/p-8492a765.entry.js +1 -0
- package/dist/sparkle-core/{p-a019ad0c.js → p-86ed13f0.js} +1 -1
- package/dist/sparkle-core/{p-4ae75caa.entry.js → p-894ff7e6.entry.js} +1 -1
- package/dist/sparkle-core/{p-5519d283.entry.js → p-9289cdbc.entry.js} +1 -1
- package/dist/sparkle-core/{p-4bd4dab2.js → p-935e7cfc.js} +1 -1
- package/dist/sparkle-core/{p-25e556cc.entry.js → p-957715c5.entry.js} +1 -1
- package/dist/sparkle-core/{p-b4b01fa2.entry.js → p-9abbd715.entry.js} +1 -1
- package/dist/sparkle-core/{p-e7568d4b.js → p-9d894ed4.js} +1 -1
- package/dist/sparkle-core/{p-4320dac0.entry.js → p-9ebf0537.entry.js} +1 -1
- package/dist/sparkle-core/p-a49ab4e8.entry.js +1 -0
- package/dist/sparkle-core/{p-93e74f1b.entry.js → p-af3cc111.entry.js} +1 -1
- package/dist/sparkle-core/{p-5fc26938.js → p-b0603d19.js} +1 -1
- package/dist/sparkle-core/{p-317037de.entry.js → p-b3f375fb.entry.js} +1 -1
- package/dist/sparkle-core/p-b4408842.entry.js +352 -0
- package/dist/sparkle-core/{p-2fba9a3a.entry.js → p-b5f3e1bf.entry.js} +1 -1
- package/dist/sparkle-core/{p-82ad4e7c.entry.js → p-b96f3c84.entry.js} +2 -2
- package/dist/sparkle-core/{p-ad102371.js → p-bd80ff43.js} +1 -1
- package/dist/sparkle-core/{p-f0cf4a8f.entry.js → p-be64105c.entry.js} +1 -1
- package/dist/sparkle-core/{p-f4b0b6a4.entry.js → p-c0533c23.entry.js} +1 -1
- package/dist/sparkle-core/p-c3cadfc6.entry.js +1 -0
- package/dist/sparkle-core/{p-2d4a5ddf.entry.js → p-c60b29bd.entry.js} +2 -2
- package/dist/sparkle-core/{p-56a2e8a2.js → p-cabe9139.js} +1 -1
- package/dist/sparkle-core/{p-0bb0cf41.entry.js → p-cabfbf22.entry.js} +1 -1
- package/dist/sparkle-core/{p-66a85393.entry.js → p-ce4b22f7.entry.js} +1 -1
- package/dist/sparkle-core/{p-17eb4633.js → p-d68092b7.js} +1 -1
- package/dist/sparkle-core/{p-0ea2518d.entry.js → p-de4deb61.entry.js} +1 -1
- package/dist/sparkle-core/{p-1f0b3ff9.entry.js → p-e686d8b5.entry.js} +1 -1
- package/dist/sparkle-core/{p-08d97c59.entry.js → p-e77d982d.entry.js} +1 -1
- package/dist/sparkle-core/{p-44f813b7.entry.js → p-e863bf1d.entry.js} +1 -1
- package/dist/sparkle-core/{p-63f69cdc.entry.js → p-ebd4354b.entry.js} +1 -1
- package/dist/sparkle-core/{p-fc965b88.entry.js → p-ef4edc48.entry.js} +1 -1
- package/dist/sparkle-core/{p-c2bbaf55.entry.js → p-fb0ca75e.entry.js} +1 -1
- package/dist/sparkle-core/{p-b83444c7.entry.js → p-fb757951.entry.js} +1 -1
- package/dist/sparkle-core/{p-d81a0680.js → p-fbccd30c.js} +1 -1
- package/dist/sparkle-core/sparkle-core.esm.js +1 -1
- package/package.json +2 -2
- package/dist/cjs/PrivateRoute-4abc9d29.js +0 -35
- package/dist/cjs/dom-utils-b8befdd5.js +0 -63
- package/dist/cjs/header-mobile-collapse.cjs.entry.js +0 -90
- package/dist/cjs/index-70e63f5b.js +0 -3071
- package/dist/cjs/injectHistory-7206bbb9.js +0 -9
- package/dist/cjs/ion-avatar.cjs.entry.js +0 -25
- package/dist/cjs/ion-button.cjs.entry.js +0 -129
- package/dist/cjs/ion-card_2.cjs.entry.js +0 -91
- package/dist/cjs/ion-checkbox_4.cjs.entry.js +0 -360
- package/dist/cjs/ion-col_3.cjs.entry.js +0 -159
- package/dist/cjs/ion-icon_13.cjs.entry.js +0 -1505
- package/dist/cjs/ion-input_2.cjs.entry.js +0 -313
- package/dist/cjs/ion-label_2.cjs.entry.js +0 -126
- package/dist/cjs/ion-spinner.cjs.entry.js +0 -64
- package/dist/cjs/match-path-84c9f7ca.js +0 -511
- package/dist/cjs/sparkle-card_3.cjs.entry.js +0 -91
- package/dist/cjs/sparkle-course-root.cjs.entry.js +0 -146
- package/dist/cjs/sparkle-dropdown.cjs.entry.js +0 -61
- package/dist/cjs/sparkle-facilitator-header_19.cjs.entry.js +0 -2130
- package/dist/cjs/sparkle-goal-progress.cjs.entry.js +0 -19
- package/dist/cjs/sparkle-gww-item.cjs.entry.js +0 -74
- package/dist/cjs/sparkle-menu-toggle_3.cjs.entry.js +0 -236
- package/dist/cjs/sparkle-validation-error.cjs.entry.js +0 -21
- package/dist/cjs/stencil-router-redirect.cjs.entry.js +0 -32
- package/dist/cjs/student.service-d48f1c99.js +0 -61
- package/dist/cjs/user.store-8a049c4e.js +0 -21
- package/dist/esm/PrivateRoute-7b526801.js +0 -33
- package/dist/esm/dom-utils-109a7d75.js +0 -55
- package/dist/esm/header-mobile-collapse.entry.js +0 -86
- package/dist/esm/index-f9b9ba5d.js +0 -3067
- package/dist/esm/injectHistory-968f626d.js +0 -7
- package/dist/esm/ion-avatar.entry.js +0 -21
- package/dist/esm/ion-button.entry.js +0 -125
- package/dist/esm/ion-card_2.entry.js +0 -86
- package/dist/esm/ion-checkbox_4.entry.js +0 -353
- package/dist/esm/ion-col_3.entry.js +0 -153
- package/dist/esm/ion-icon_13.entry.js +0 -1489
- package/dist/esm/ion-input_2.entry.js +0 -308
- package/dist/esm/ion-label_2.entry.js +0 -121
- package/dist/esm/ion-spinner.entry.js +0 -60
- package/dist/esm/match-path-36fdf5c7.js +0 -499
- package/dist/esm/sparkle-card_3.entry.js +0 -85
- package/dist/esm/sparkle-course-root.entry.js +0 -142
- package/dist/esm/sparkle-dropdown.entry.js +0 -57
- package/dist/esm/sparkle-facilitator-header_19.entry.js +0 -2108
- package/dist/esm/sparkle-goal-progress.entry.js +0 -15
- package/dist/esm/sparkle-gww-item.entry.js +0 -70
- package/dist/esm/sparkle-menu-toggle_3.entry.js +0 -230
- package/dist/esm/sparkle-validation-error.entry.js +0 -17
- package/dist/esm/stencil-router-redirect.entry.js +0 -28
- package/dist/esm/user.store-b8645067.js +0 -19
- package/dist/sparkle-core/p-03585916.js +0 -1
- package/dist/sparkle-core/p-1019ebc3.js +0 -1
- package/dist/sparkle-core/p-1728ead7.js +0 -1
- package/dist/sparkle-core/p-32762a44.entry.js +0 -1
- package/dist/sparkle-core/p-3bc68dd0.js +0 -1
- package/dist/sparkle-core/p-3c133235.entry.js +0 -1
- package/dist/sparkle-core/p-46869031.entry.js +0 -1
- package/dist/sparkle-core/p-4a5f2b2b.js +0 -1
- package/dist/sparkle-core/p-53bcbd1d.js +0 -1
- package/dist/sparkle-core/p-54ada5e3.entry.js +0 -1
- package/dist/sparkle-core/p-554da5b8.entry.js +0 -1
- package/dist/sparkle-core/p-5da2d95a.entry.js +0 -1
- package/dist/sparkle-core/p-6b05a1d3.entry.js +0 -1
- package/dist/sparkle-core/p-6ea246fe.js +0 -4
- package/dist/sparkle-core/p-6ed0236e.entry.js +0 -1
- package/dist/sparkle-core/p-7f25366a.entry.js +0 -1
- package/dist/sparkle-core/p-91accfc1.js +0 -1
- package/dist/sparkle-core/p-a5c5da9a.entry.js +0 -1
- package/dist/sparkle-core/p-a8a77bec.entry.js +0 -1
- package/dist/sparkle-core/p-c4af184b.entry.js +0 -1
- package/dist/sparkle-core/p-c71cbbf7.entry.js +0 -1
- package/dist/sparkle-core/p-c8c73fa7.js +0 -4
- package/dist/sparkle-core/p-cd832fbf.entry.js +0 -1
- package/dist/sparkle-core/p-d0ac5f17.js +0 -1
- package/dist/sparkle-core/p-d1fcbfc2.js +0 -4
- package/dist/sparkle-core/p-d432d3ac.entry.js +0 -1
- package/dist/sparkle-core/p-d969f7d0.entry.js +0 -348
- package/dist/sparkle-core/p-dca90a55.entry.js +0 -4
- package/dist/sparkle-core/p-dd2e7f84.js +0 -4
- package/dist/sparkle-core/p-e0429a19.entry.js +0 -1
- package/dist/sparkle-core/p-e7066c64.entry.js +0 -1
- package/dist/sparkle-core/p-eb40a191.entry.js +0 -1
- package/dist/sparkle-core/p-ecdea569.entry.js +0 -1
- package/dist/sparkle-core/p-ef6c2352.entry.js +0 -1
@@ -1,2108 +0,0 @@
|
|
1
|
-
import { r as registerInstance, h, e as getElement, H as Host, i as createEvent, F as Fragment, c as getAssetPath, k as getContext } from './index-c04b9ed5.js';
|
2
|
-
import { m as menuController } from './index-dedabca0.js';
|
3
|
-
import { S as SignalRService, t as templates, s as signalRStore } from './index-f9b9ba5d.js';
|
4
|
-
import { T as TocStore, A as AuthStore, c as createStore } from './auth.store-633e8414.js';
|
5
|
-
import { F as FacilitatorService, f as facilitatorStore } from './facilitator.service-8fd435bf.js';
|
6
|
-
import { H as HttpService } from './httpService-61864992.js';
|
7
|
-
import { m as modalController, h as alertController } from './overlays-bdd9344a.js';
|
8
|
-
import { A as AppDataService, g as goalStore, F as FeedService, f as feedStore } from './feed.service-ace049e5.js';
|
9
|
-
import { E as EnvironmentConfigService } from './environment-config.service-2b5d692b.js';
|
10
|
-
import { A as AssetsService } from './assets.service-66e848b8.js';
|
11
|
-
import { b as MyHealthTemplate, S as SparkleGlobal$1, c as MyHealthTemplateJSON, d as MyMoodTemplate, e as MyMoodTemplateJSON } from './util-a831d09d.js';
|
12
|
-
import { A as AuthService, s as setupConfig } from './auth.service-9fb86455.js';
|
13
|
-
import { u as userStore } from './user.store-b8645067.js';
|
14
|
-
import { S as StudentService } from './student.service-e6eb1f99.js';
|
15
|
-
import { i as injectHistory } from './injectHistory-968f626d.js';
|
16
|
-
import { m as matchPath, a as matchesAreEqual, s as stripTrailingSlash, b as addLeadingSlash, c as createLocation, d as createKey, h as hasBasename, e as stripBasename, f as createPath, g as stripLeadingSlash, l as locationsAreEqual } from './match-path-36fdf5c7.js';
|
17
|
-
import { A as ActiveRouter } from './active-router-fc9e4e06.js';
|
18
|
-
import { s as storageAvailable, a as supportsHistory, b as supportsPopStateOnHashChange, g as getConfirmation, c as isExtraneousPopstateEvent, d as supportsGoWithoutReloadUsingHash } from './dom-utils-109a7d75.js';
|
19
|
-
import './hardware-back-button-fa04d6e9.js';
|
20
|
-
import './helpers-03073fe4.js';
|
21
|
-
import './ionic-global-4903e23e.js';
|
22
|
-
import './animation-e0716b39.js';
|
23
|
-
import './localstorage.service-4bf408c8.js';
|
24
|
-
|
25
|
-
const facilitatorHeaderCss = "sparkle-facilitator-header{background-color:var(--background);box-shadow:0px 1px 3px rgba(2, 8, 20, 0.06), 0px 1px 2px rgba(2, 8, 20, 0.04);color:var(--text-color--light);display:block;font-size:14px;font-weight:500;line-height:1;position:fixed;top:0;left:0;transform:translateY(0);transition:transform 200ms ease;user-select:none;width:100%;white-space:nowrap;z-index:2}@media (min-width: 768px){.Layout:not(.is-menu-toggled) sparkle-facilitator-header.hidden{transform:translateY(-100%)}}@media (max-width: 768px){.Layout.is-menu-toggled sparkle-facilitator-header.hidden{transform:translateY(-100%)}}sparkle-facilitator-header header{align-items:center;display:flex;height:var(--header-height);padding:0 1.4rem 0 0.8rem}sparkle-facilitator-header a{color:inherit;font-weight:500;padding:10px 0}sparkle-facilitator-header ion-icon{font-size:16px;color:#B2BECD}sparkle-facilitator-header .link-active{color:var(--ion-color-sparkle)}@media (hover: hover){sparkle-facilitator-header a:not(.link-active):hover{color:var(--text-color)}}sparkle-facilitator-header sparkle-menu-toggle{flex:none;margin-right:0.75em}sparkle-facilitator-header .HeaderLogo{color:var(--text-color--dark);font-family:var(--heading-font-family);height:25px;margin-right:2em;display:flex;justify-content:center;align-items:center;font-size:1.5em}sparkle-facilitator-header .SectionNav stencil-route{display:flex}sparkle-facilitator-header .SectionNav .Dropdown{align-self:center;color:var(--text-color);margin-right:0.75em}sparkle-facilitator-header .SectionNav .Dropdown-button{border:solid 1px #DEE3EA;border-radius:6px;color:var(--text-color--dark);padding:10px;transition:border-color 100ms ease}sparkle-facilitator-header .SectionNav .Dropdown.is-open .Dropdown-button{border-color:var(--line-rule-color)}sparkle-facilitator-header .SectionNav .Dropdown-panel{min-width:180px}sparkle-facilitator-header .SectionNav .Dropdown-panel a{display:flex;justify-content:space-between}sparkle-facilitator-header .SectionNav .Dropdown-panel svg{height:1em;width:1em}sparkle-facilitator-header .SectionNav .Dropdown-panel .Nav-link{margin-left:0;margin-right:0}sparkle-facilitator-header .SectionNav-tabs>*{align-items:center;display:inline-flex;height:var(--header-height);margin-right:1em;padding:0px 1em;position:relative}sparkle-facilitator-header .SectionNav-tabs .link-active:after{background-color:currentColor;bottom:0;content:\"\";display:block;height:2px;left:0;position:absolute;width:100%}sparkle-facilitator-header .UtilNav{align-items:center;display:flex;font-size:12px;margin-left:auto}sparkle-facilitator-header .UtilNav>*{margin-left:1em}sparkle-facilitator-header .UtilNav .Dropdown.is-open{color:var(--text-color)}sparkle-facilitator-header .UtilNav .Dropdown-button{padding:10px 0}@media (hover: hover){sparkle-facilitator-header .UtilNav .Dropdown-button:hover{color:var(--text-color)}}sparkle-facilitator-header .UtilNav .Dropdown-panel{font-size:14px}sparkle-facilitator-header .girls-inc-logo{display:block;max-width:40px;max-height:40px;width:auto;height:auto}";
|
26
|
-
|
27
|
-
const SparkleFacilitatorHeader = class {
|
28
|
-
constructor(hostRef) {
|
29
|
-
registerInstance(this, hostRef);
|
30
|
-
this.courseName = '';
|
31
|
-
this.hidden = false;
|
32
|
-
this.frameRequested = false;
|
33
|
-
this.prevScroll = 0;
|
34
|
-
}
|
35
|
-
handleScroll() {
|
36
|
-
if (!this.frameRequested) {
|
37
|
-
requestAnimationFrame(() => {
|
38
|
-
const { scrollY } = window;
|
39
|
-
this.hidden = scrollY > 60 && scrollY > this.prevScroll;
|
40
|
-
this.prevScroll = scrollY;
|
41
|
-
this.frameRequested = false;
|
42
|
-
});
|
43
|
-
this.frameRequested = true;
|
44
|
-
}
|
45
|
-
}
|
46
|
-
componentWillLoad() {
|
47
|
-
}
|
48
|
-
hostData() {
|
49
|
-
return {
|
50
|
-
class: { hidden: this.hidden },
|
51
|
-
};
|
52
|
-
}
|
53
|
-
openEnd() {
|
54
|
-
menuController.enable(true, 'students');
|
55
|
-
menuController.open('students');
|
56
|
-
}
|
57
|
-
async openOnlineStudentsSidebar() {
|
58
|
-
document.getElementById("#onlineStudents");
|
59
|
-
}
|
60
|
-
__stencil_render() {
|
61
|
-
return (h("header", null, h("a", { href: "/home" }, h("div", { class: "HeaderLogo" }, this.courseName)), h("header-mobile-collapse", null, h("div", { class: "SectionNav-tabs" }), h("nav", { class: "UtilNav" }, h("sparkle-button", { href: "/login", round: true }, "Login"), h("sparkle-button", { href: "/signup", primary: true, round: true }, "Get Started"), h("slot", { name: "logo" })))));
|
62
|
-
}
|
63
|
-
get el() { return getElement(this); }
|
64
|
-
render() { return h(Host, this.hostData(), this.__stencil_render()); }
|
65
|
-
};
|
66
|
-
SparkleFacilitatorHeader.style = facilitatorHeaderCss;
|
67
|
-
|
68
|
-
class StoreService {
|
69
|
-
constructor() { }
|
70
|
-
static getInstance() {
|
71
|
-
if (!StoreService.instance) {
|
72
|
-
StoreService.instance = new StoreService();
|
73
|
-
}
|
74
|
-
return StoreService.instance;
|
75
|
-
}
|
76
|
-
async UpdateTocPageInfo(pageInfo) {
|
77
|
-
TocStore.state.pageInfo = pageInfo;
|
78
|
-
}
|
79
|
-
}
|
80
|
-
|
81
|
-
const facilitatorPageCss = ".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-facilitator-page{display:grid;font-size:16px;grid-template-columns:1fr;line-height:2;margin-top:var(--header-height);overflow-x:hidden;transform:var(--page-transform, none);transition:transform 200ms cubic-bezier(0.2, 1, 0.2, 1);--page-padding:2rem;padding:20px}@media (min-width: 1234px){sparkle-facilitator-page{grid-template-columns:1fr}}@media (min-width: 1800px){sparkle-facilitator-page{grid-template-columns:1fr}}sparkle-facilitator-page>main.column-1{position:relative;grid-column:1;margin-bottom:3rem;padding:var(--page-padding, 2rem 1rem);position:relative}sparkle-facilitator-page>main.column-2{position:relative;grid-column:1;margin-bottom:3rem;padding:var(--page-padding, 2rem 1rem);position:relative}sparkle-facilitator-page sparkle-pagination{grid-column:1 / -1;border:none;--page-padding:0rem 1rem}sparkle-facilitator-page .full-screen{grid-column:1 / -1;height:calc(100vh - var(--header-height));margin-bottom:0;overflow:hidden;padding:0}sparkle-facilitator-page sparkle-page-footer{margin-top:0rem}sparkle-facilitator-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-facilitator-page .page-heading-encapsulation:hover{border-color:#92a1b3}sparkle-facilitator-page h1{display:flex;justify-content:space-between;margin-top:2rem;margin-bottom:1rem}sparkle-facilitator-page h2 a[href^='#'],sparkle-facilitator-page h3 a[href^='#'],sparkle-facilitator-page h4 a[href^='#'],sparkle-facilitator-page h5 a[href^='#'],sparkle-facilitator-page h6 a[href^='#']{color:inherit;position:relative}sparkle-facilitator-page h2 a[href^='#']:before,sparkle-facilitator-page h3 a[href^='#']:before,sparkle-facilitator-page h4 a[href^='#']:before,sparkle-facilitator-page h5 a[href^='#']:before,sparkle-facilitator-page h6 a[href^='#']:before{content:'#';opacity:0;padding-right:5px;position:absolute;right:100%;transition:opacity 100ms ease}sparkle-facilitator-page h2 a[href^='#']:hover:before,sparkle-facilitator-page h3 a[href^='#']:hover:before,sparkle-facilitator-page h4 a[href^='#']:hover:before,sparkle-facilitator-page h5 a[href^='#']:hover:before,sparkle-facilitator-page h6 a[href^='#']:hover:before{opacity:1}sparkle-facilitator-page h2 code,sparkle-facilitator-page h3 code,sparkle-facilitator-page h4 code,sparkle-facilitator-page h5 code,sparkle-facilitator-page h6 code{background:none;font-size:inherit}sparkle-facilitator-page aside{float:right;margin-left:20px;margin-bottom:20px}@media (min-width: 1234px){sparkle-facilitator-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-facilitator-page main.no-demo .page-meta{transform:translateY(-60px)}}sparkle-facilitator-page main.has-demo .page-meta internal-ad{display:none}sparkle-facilitator-page .tab-content{padding:20px}";
|
82
|
-
|
83
|
-
const FacilitatorPage = class {
|
84
|
-
constructor(hostRef) {
|
85
|
-
registerInstance(this, hostRef);
|
86
|
-
this.pageDidLoad = createEvent(this, "pageDidLoad", 7);
|
87
|
-
this.isLesson = false;
|
88
|
-
this.notesPage = { title: null, path: null, body: null, pageInfo: null };
|
89
|
-
this.lessonNotesPage = { title: null, path: null, body: null, pageInfo: null };
|
90
|
-
this.page = { title: null, path: null, body: null, pageInfo: null };
|
91
|
-
this.onlineStudents = [];
|
92
|
-
this.activetab = "FACILITATOR_NOTES";
|
93
|
-
this.validateFetch = (response) => {
|
94
|
-
if (!response.ok) {
|
95
|
-
throw response;
|
96
|
-
}
|
97
|
-
return response.json();
|
98
|
-
};
|
99
|
-
this.handleNotesPage = (page) => {
|
100
|
-
this.badFetch = null;
|
101
|
-
this.notesPage = page;
|
102
|
-
this.pageDidLoad.emit({ pageInfo: this.notesPage.pageInfo });
|
103
|
-
};
|
104
|
-
this.handleLessonNotesPage = (page) => {
|
105
|
-
this.badFetchLessonNotes = null;
|
106
|
-
this.lessonNotesPage = page;
|
107
|
-
};
|
108
|
-
this.handleNewPage = (page) => {
|
109
|
-
this.page = page;
|
110
|
-
this.page = Object.assign(Object.assign({}, this.page), { nextUrl: "/presentation/teacher" + this.page.nextUrl, previousUrl: "/presentation/teacher" + this.page.previousUrl });
|
111
|
-
StoreService.getInstance().UpdateTocPageInfo(this.page.pageInfo);
|
112
|
-
};
|
113
|
-
this.handleBadFetch = (error) => {
|
114
|
-
this.badFetch = error;
|
115
|
-
this.notesPage = {
|
116
|
-
title: error.statusText,
|
117
|
-
body: null,
|
118
|
-
path: null,
|
119
|
-
pageInfo: null
|
120
|
-
};
|
121
|
-
};
|
122
|
-
this.handleLessonNotesBadFetch = (error) => {
|
123
|
-
this.badFetchLessonNotes = error;
|
124
|
-
this.lessonNotesPage = {
|
125
|
-
title: error.statusText,
|
126
|
-
body: null,
|
127
|
-
path: null,
|
128
|
-
pageInfo: null
|
129
|
-
};
|
130
|
-
};
|
131
|
-
}
|
132
|
-
async componentWillLoad() {
|
133
|
-
await this.fetchClasses();
|
134
|
-
return this.fetchNotesPage(this.notesPath) && this.fetchPage(this.path);
|
135
|
-
}
|
136
|
-
componentDidLoad() {
|
137
|
-
this.isLesson = TocStore.state.pageInfo.pageId > 0;
|
138
|
-
if (!this.isLesson) {
|
139
|
-
this.activetab = "ONLINE_STUDENTS";
|
140
|
-
}
|
141
|
-
}
|
142
|
-
async fetchClasses() {
|
143
|
-
await FacilitatorService.getInstance().fetchClasses();
|
144
|
-
}
|
145
|
-
fetchNotesPage(path, oldPath) {
|
146
|
-
if (path === null || path === oldPath) {
|
147
|
-
return;
|
148
|
-
}
|
149
|
-
path = /^\/docs\/pages\/[a-z]{2}\.json$/.test(path) ? path.replace('.json', '/index.json') : path;
|
150
|
-
let lessonPath = this.getLessonPath(path);
|
151
|
-
console.log(lessonPath);
|
152
|
-
return fetch(path).then(this.validateFetch).then(this.handleNotesPage).catch(this.handleBadFetch) &&
|
153
|
-
fetch(lessonPath).then(this.validateFetch).then(this.handleLessonNotesPage).catch(this.handleLessonNotesBadFetch);
|
154
|
-
}
|
155
|
-
getLessonPath(path) {
|
156
|
-
let splittedPath = path.split("/");
|
157
|
-
splittedPath.pop();
|
158
|
-
return splittedPath.join("/") + "/lesson-notes.json";
|
159
|
-
}
|
160
|
-
fetchPage(path, oldPath) {
|
161
|
-
if (path === null || path === oldPath) {
|
162
|
-
return;
|
163
|
-
}
|
164
|
-
if (SignalRService.getInstance().connection.connectionState == "Connected") {
|
165
|
-
SignalRService.getInstance().callSignalR("NavigateFacilitatorPresentationCourseTo", { url: this.path.replace(".json", "") });
|
166
|
-
}
|
167
|
-
path = /^\/docs\/pages\/[a-z]{2}\.json$/.test(path) ? path.replace('.json', '/index.json') : path;
|
168
|
-
return fetch(path).then(this.validateFetch).then(this.handleNewPage).catch(this.handleBadFetch);
|
169
|
-
}
|
170
|
-
disconnectedCallback() {
|
171
|
-
StoreService.getInstance().UpdateTocPageInfo(null);
|
172
|
-
}
|
173
|
-
setDocumentMeta(page) {
|
174
|
-
const { title, meta = {} } = page;
|
175
|
-
const metaEls = {
|
176
|
-
title: document.head.querySelectorAll('.meta-title'),
|
177
|
-
description: document.head.querySelectorAll('.meta-description'),
|
178
|
-
url: document.head.querySelectorAll('.meta-url, link[rel="canonical"]'),
|
179
|
-
image: document.head.querySelectorAll('.meta-image'),
|
180
|
-
};
|
181
|
-
const updateMeta = (els, update) => {
|
182
|
-
els.forEach((el) => {
|
183
|
-
['href', 'content'].forEach(attr => {
|
184
|
-
if (el.hasAttribute(attr)) {
|
185
|
-
el.setAttribute(attr, update(el.getAttribute(attr)));
|
186
|
-
}
|
187
|
-
});
|
188
|
-
});
|
189
|
-
};
|
190
|
-
// Title
|
191
|
-
const getTitle = () => {
|
192
|
-
const suffix = /^\/docs\/pages.*$/.test(this.notesPath) ? 'Sparkle' : 'Sparkle';
|
193
|
-
// Favor meta title, else go with auto-title. fallback to generic title
|
194
|
-
return meta.title || title ? `${title} - ${suffix}` : suffix;
|
195
|
-
};
|
196
|
-
document.title = getTitle();
|
197
|
-
updateMeta(metaEls.title, getTitle);
|
198
|
-
// Canonical URL
|
199
|
-
updateMeta(metaEls.url, (oldVal) => {
|
200
|
-
const uri = '/docs/';
|
201
|
-
const path = location.pathname.split(uri)[1];
|
202
|
-
return oldVal.split(uri)[0] + uri + path;
|
203
|
-
});
|
204
|
-
// Description
|
205
|
-
updateMeta(metaEls.description, () => meta.description || 'Sparkle is the free open-source platform for creating learning content on web, mobile and desktop.');
|
206
|
-
// Sharing Image
|
207
|
-
updateMeta(metaEls.image, () => meta.image || 'https://girlsinclearning.com//images/logo-primary.png');
|
208
|
-
}
|
209
|
-
hostData() {
|
210
|
-
return {
|
211
|
-
class: {
|
212
|
-
[this.notesPage.pageClass]: typeof this.notesPage.pageClass === 'string',
|
213
|
-
},
|
214
|
-
};
|
215
|
-
}
|
216
|
-
renderNavigation() {
|
217
|
-
return (h("div", { class: "p-2 d-md-flex justify-content-md-center" }, h("div", { class: "btn-group btn-group-sm", role: "group", "aria-label": "Basic outlined example" }, h("button", { type: "button", class: "btn btn-outline-primary" }, "Prev"), h("input", { type: "text", class: "form-control", placeholder: "Input group example", "aria-label": "Input group example", "aria-describedby": "btnGroupAddon", value: this.path.replace("index", ""), readOnly: true }), h("button", { type: "button", class: "btn btn-outline-primary" }, "Next"))));
|
218
|
-
}
|
219
|
-
renderTabs() {
|
220
|
-
return (h("main", { class: 'no-demo' }, h("ul", { class: "nav nav-tabs" }, this.isLesson &&
|
221
|
-
h(Fragment, null, h("li", { class: "nav-item" }, h("a", { class: `nav-link ${this.activetab == "FACILITATOR_NOTES" ? 'active' : ''}`, href: "javascript:void(0)", onClick: () => this.activetab = "FACILITATOR_NOTES" }, "Facilitator Notes")), h("li", { class: "nav-item" }, h("a", { class: `nav-link ${this.activetab == "NOTES" ? 'active' : ''}`, href: "javascript:void(0)", onClick: () => this.activetab = "NOTES" }, "Notes")), h("li", { class: "nav-item" }, h("a", { class: `nav-link ${this.activetab == "LESSON_NOTES" ? 'active' : ''}`, href: "javascript:void(0)", onClick: () => this.activetab = "LESSON_NOTES" }, "Lesson Notes"))), h("li", { class: "nav-item" }, h("a", { class: `nav-link ${this.activetab == "ONLINE_STUDENTS" ? 'active' : ''}`, href: "javascript:void(0)", onClick: () => this.activetab = "ONLINE_STUDENTS" }, "Online Students")), h("li", { class: "nav-item" }, h("a", { class: `nav-link ${this.activetab == "DASHBOARD" ? 'active' : ''}`, href: "javascript:void(0)", onClick: () => this.activetab = "DASHBOARD" }, "Dashboard")), h("li", { class: "nav-item" }, h("a", { class: `nav-link ${this.activetab == "EXPORT" ? 'active' : ''}`, href: "javascript:void(0)", onClick: () => this.activetab = "EXPORT" }, "Export"))), h("div", { class: "tab-content" }, this.activetab == "FACILITATOR_NOTES" && this.renderFacilitatorNotes(), this.activetab == "NOTES" && h("sparkle-facilitator-notes", null), this.activetab == "LESSON_NOTES" && this.renderLessonNotes(), this.activetab == "ONLINE_STUDENTS" && h("sparkle-online-students", { path: this.path }), this.activetab == "DASHBOARD" && h("sparkle-facilitator-dashboard", null), this.activetab == "EXPORT" && h("sparkle-export-lessons", null))));
|
222
|
-
}
|
223
|
-
renderLessonNotes() {
|
224
|
-
const { lessonNotesPage } = this;
|
225
|
-
const Template = templates[lessonNotesPage.template] || templates.default;
|
226
|
-
if (this.badFetchLessonNotes) {
|
227
|
-
return templates.error(this.badFetch);
|
228
|
-
}
|
229
|
-
return h(Template, { page: lessonNotesPage });
|
230
|
-
}
|
231
|
-
renderFacilitatorNotes() {
|
232
|
-
const { notesPage } = this;
|
233
|
-
const Template = templates[notesPage.template] || templates.default;
|
234
|
-
if (this.badFetch) {
|
235
|
-
return templates.error(this.badFetch);
|
236
|
-
}
|
237
|
-
return h(Template, { page: notesPage });
|
238
|
-
}
|
239
|
-
__stencil_render() {
|
240
|
-
console.log(facilitatorStore.state.classes);
|
241
|
-
const { page } = this;
|
242
|
-
const content = this.renderTabs();
|
243
|
-
return h("div", { class: "container" }, h("div", { class: "d-flex justify-content-between align-items-center" }, h("sparkle-page-footer", { page: page }), h("div", null, h("select", { class: "form-select", "aria-label": "Default select example" }, facilitatorStore.state.classes.map(item => h("option", null, item.ClassName))))), content);
|
244
|
-
}
|
245
|
-
static get watchers() { return {
|
246
|
-
"notesPath": ["fetchNotesPage"],
|
247
|
-
"path": ["fetchPage"],
|
248
|
-
"page": ["setDocumentMeta"]
|
249
|
-
}; }
|
250
|
-
render() { return h(Host, this.hostData(), this.__stencil_render()); }
|
251
|
-
};
|
252
|
-
FacilitatorPage.style = facilitatorPageCss;
|
253
|
-
|
254
|
-
class AccountService {
|
255
|
-
constructor() { }
|
256
|
-
static getInstance() {
|
257
|
-
if (!AccountService.instance) {
|
258
|
-
AccountService.instance = new AccountService();
|
259
|
-
}
|
260
|
-
return AccountService.instance;
|
261
|
-
}
|
262
|
-
async register(registerInput) {
|
263
|
-
const headers = {
|
264
|
-
'Content-Type': 'application/json',
|
265
|
-
};
|
266
|
-
AuthStore.state.loading = true;
|
267
|
-
let result;
|
268
|
-
try {
|
269
|
-
result = await HttpService.http.post('api/Account/Register', registerInput, {
|
270
|
-
headers: headers
|
271
|
-
});
|
272
|
-
if (result.Succeeded) {
|
273
|
-
AuthStore.state.loading = false;
|
274
|
-
}
|
275
|
-
}
|
276
|
-
catch (e) {
|
277
|
-
AuthStore.state.loading = false;
|
278
|
-
return e;
|
279
|
-
}
|
280
|
-
return result;
|
281
|
-
}
|
282
|
-
async forgotPassword(forgotPasswordInput) {
|
283
|
-
AuthStore.state.loading = true;
|
284
|
-
let result;
|
285
|
-
try {
|
286
|
-
result = await HttpService.http.post('api/Account/Forgot-Password', forgotPasswordInput);
|
287
|
-
if (result.Succeeded) {
|
288
|
-
AuthStore.state.loading = false;
|
289
|
-
}
|
290
|
-
}
|
291
|
-
catch (e) {
|
292
|
-
AuthStore.state.loading = false;
|
293
|
-
return e;
|
294
|
-
}
|
295
|
-
return result;
|
296
|
-
}
|
297
|
-
async resetPassword(resetPasswordInput) {
|
298
|
-
AuthStore.state.loading = true;
|
299
|
-
let result;
|
300
|
-
try {
|
301
|
-
result = await HttpService.http.post('api/Account/reset-password', resetPasswordInput);
|
302
|
-
if (result.Succeeded) {
|
303
|
-
AuthStore.state.loading = false;
|
304
|
-
}
|
305
|
-
}
|
306
|
-
catch (e) {
|
307
|
-
AuthStore.state.loading = false;
|
308
|
-
return e;
|
309
|
-
}
|
310
|
-
return result;
|
311
|
-
}
|
312
|
-
}
|
313
|
-
|
314
|
-
const sparkleForgotPasswordCss = "sparkle-forgot-password .list{margin-bottom:0}";
|
315
|
-
|
316
|
-
const SparkleForgotPassword = class {
|
317
|
-
constructor(hostRef) {
|
318
|
-
registerInstance(this, hostRef);
|
319
|
-
this.formControls = {
|
320
|
-
email: {
|
321
|
-
isValid: false,
|
322
|
-
value: '',
|
323
|
-
validate: value => {
|
324
|
-
if (value) {
|
325
|
-
return true;
|
326
|
-
}
|
327
|
-
else {
|
328
|
-
return false;
|
329
|
-
}
|
330
|
-
},
|
331
|
-
},
|
332
|
-
};
|
333
|
-
this.submitted = false;
|
334
|
-
}
|
335
|
-
changeFormValue(controlName, value) {
|
336
|
-
this.formControls = Object.assign(Object.assign({}, this.formControls), { [controlName]: Object.assign(Object.assign({}, this.formControls[controlName]), { value: value, isValid: this.formControls[controlName].validate(value) }) });
|
337
|
-
}
|
338
|
-
async handleSubmit(e) {
|
339
|
-
e.preventDefault();
|
340
|
-
this.submitted = true;
|
341
|
-
let isFormValid = true;
|
342
|
-
//Run all validation functions
|
343
|
-
for (let controlName in this.formControls) {
|
344
|
-
let control = this.formControls[controlName];
|
345
|
-
control.validate(control.value);
|
346
|
-
if (!control.isValid) {
|
347
|
-
isFormValid = false;
|
348
|
-
}
|
349
|
-
}
|
350
|
-
if (isFormValid) {
|
351
|
-
let result = await AccountService.getInstance().forgotPassword({
|
352
|
-
Email: this.formControls.email.value,
|
353
|
-
ClientURL: window.location.origin + "/reset-password"
|
354
|
-
});
|
355
|
-
if (result.Succeeded) {
|
356
|
-
this.history.replace('/login', {});
|
357
|
-
}
|
358
|
-
else if (result.Failed) {
|
359
|
-
if (result.Errors.length > 0) {
|
360
|
-
this.validationErrors = result.Errors;
|
361
|
-
}
|
362
|
-
}
|
363
|
-
}
|
364
|
-
}
|
365
|
-
render() {
|
366
|
-
return [
|
367
|
-
h("div", null, h("div", { class: "login-logo" }, h("img", { src: getAssetPath("/assets/img/G3-Girls.jpg"), alt: "Girls Inc" })), h("sparkle-validation-error", { errors: this.validationErrors }), h("form", { novalidate: "true", onSubmit: (e) => this.handleSubmit(e) }, h("ion-list", { "no-lines": true }, h("ion-item", { lines: "none" }, "Enter your email address and we will send you a link to reset your password."), h("ion-item", null, h("ion-label", { position: "stacked", color: "primary" }, "Email"), h("ion-input", { name: "email", type: "text", value: this.formControls.email.value, onInput: (ev) => this.changeFormValue("email", ev.target.value), spellcheck: false, autocapitalize: "off" })), h("ion-text", { color: "danger" }, h("p", { hidden: this.formControls.email.isValid || this.submitted === false, class: "ion-padding-left" }, "Email is required")), h("br", null), h("div", { class: "ion-padding" }, h("ion-button", { type: "submit", expand: "block", disabled: AuthStore.state.loading }, AuthStore.state.loading && h("ion-spinner", { name: "dots" }), " SEND PASSWORD RESET EMAIL")))))
|
368
|
-
];
|
369
|
-
}
|
370
|
-
};
|
371
|
-
SparkleForgotPassword.style = sparkleForgotPasswordCss;
|
372
|
-
|
373
|
-
const sparkleGoalsCss = ":host{display:block}sparkle-dropdown a{color:var(--text-color);padding:1em;cursor:pointer}";
|
374
|
-
|
375
|
-
const SparkleGoals = class {
|
376
|
-
constructor(hostRef) {
|
377
|
-
registerInstance(this, hostRef);
|
378
|
-
}
|
379
|
-
async componentDidLoad() {
|
380
|
-
await AppDataService.getInstance().getAllGoals();
|
381
|
-
}
|
382
|
-
async presentAddGoalModal(appData) {
|
383
|
-
const modal = await modalController.create({
|
384
|
-
component: "sparkle-goal-form",
|
385
|
-
cssClass: "auto-height",
|
386
|
-
componentProps: { appData }
|
387
|
-
});
|
388
|
-
await modal.present();
|
389
|
-
}
|
390
|
-
render() {
|
391
|
-
return (h(Host, null, h("h2", null, "MY GOALS"), h("ion-item", { lines: "none" }, h("ion-button", { size: "default", color: "primary", slot: "end", onClick: () => this.presentAddGoalModal(null) }, h("ion-icon", { name: "add-outline" }), "Add")), h("div", { class: "ion-padding" }, h("sparkle-cards", null, goalStore.state.goals.map((goal) => h("div", { style: { "position": "relative" } }, h("sparkle-goal-item", { goal: goal.AppData, onEditGoal: () => this.presentAddGoalModal(goal) })))), !goalStore.state.goalsLoading && goalStore.state.goals.length == 0
|
392
|
-
&& h("div", { class: "text-center" }, "No Goals"), goalStore.state.goalsLoading &&
|
393
|
-
h("div", { class: "text-center" }, h("ion-spinner", { name: "dots" })))));
|
394
|
-
}
|
395
|
-
};
|
396
|
-
SparkleGoals.style = sparkleGoalsCss;
|
397
|
-
|
398
|
-
const sparkleGwwCss = ":host{display:block}";
|
399
|
-
|
400
|
-
const SparkleGww = class {
|
401
|
-
constructor(hostRef) {
|
402
|
-
registerInstance(this, hostRef);
|
403
|
-
this.commentPosted = createEvent(this, "commentPosted", 7);
|
404
|
-
this.postComment = async (model) => {
|
405
|
-
const result = await FeedService.getInstance().createPostComment(model);
|
406
|
-
if (result.Succeeded) {
|
407
|
-
this.commentPosted.emit();
|
408
|
-
}
|
409
|
-
};
|
410
|
-
}
|
411
|
-
async componentDidLoad() {
|
412
|
-
await FeedService.getInstance().getAllPosts();
|
413
|
-
}
|
414
|
-
render() {
|
415
|
-
console.log(feedStore.state.postIdLoading, "Loading");
|
416
|
-
return (h(Host, null, feedStore.state.posts.map((item) => h("sparkle-gww-item", { key: item.Id, post: item, onPostComment: this.postComment, loading: feedStore.state.postIdLoading == item.Id }))));
|
417
|
-
}
|
418
|
-
};
|
419
|
-
SparkleGww.style = sparkleGwwCss;
|
420
|
-
|
421
|
-
const storage = window.localStorage;
|
422
|
-
function set(key, value) {
|
423
|
-
return new Promise((resolve, reject) => {
|
424
|
-
try {
|
425
|
-
storage && storage.setItem(key, JSON.stringify(value));
|
426
|
-
resolve();
|
427
|
-
}
|
428
|
-
catch (err) {
|
429
|
-
reject(`Couldnt store object ${err}`);
|
430
|
-
}
|
431
|
-
});
|
432
|
-
}
|
433
|
-
function get(key) {
|
434
|
-
try {
|
435
|
-
if (storage) {
|
436
|
-
const item = storage.getItem(key);
|
437
|
-
return JSON.parse(item);
|
438
|
-
}
|
439
|
-
}
|
440
|
-
catch (err) {
|
441
|
-
return null;
|
442
|
-
}
|
443
|
-
}
|
444
|
-
|
445
|
-
class SparkleGlobal {
|
446
|
-
}
|
447
|
-
SparkleGlobal.LOCALSTORAGE_CLASSROOM_MODE = "SPARKLE_CLASSROOM_MODE";
|
448
|
-
|
449
|
-
const headerCss = "sparkle-header{background-color:var(--background);box-shadow:0px 1px 3px rgba(2, 8, 20, 0.06), 0px 1px 2px rgba(2, 8, 20, 0.04);color:var(--text-color--light);display:block;font-size:14px;font-weight:500;line-height:1;position:fixed;top:0;left:0;transform:translateY(0);transition:transform 200ms ease;user-select:none;width:100%;white-space:nowrap;z-index:2}@media (min-width: 768px){.Layout:not(.is-menu-toggled) sparkle-header.hidden{transform:translateY(-100%)}}@media (max-width: 768px){.Layout.is-menu-toggled sparkle-header.hidden{transform:translateY(-100%)}}sparkle-header header{align-items:center;display:flex;height:var(--header-height);padding:0 1.4rem 0 0.8rem}sparkle-header a{color:inherit;font-weight:500;padding:10px 0}sparkle-header ion-icon{font-size:16px;color:#b2becd}sparkle-header .link-active{color:var(--ion-color-sparkle)}@media (hover: hover){sparkle-header a:not(.link-active):hover{color:var(--text-color)}}sparkle-header sparkle-menu-toggle{flex:none;margin-right:0.75em}sparkle-header .HeaderLogo{color:var(--text-color--dark);font-family:var(--heading-font-family);height:25px;margin-right:2em;display:flex;justify-content:center;align-items:center;font-size:1.5em}sparkle-header .SectionNav stencil-route{display:flex}sparkle-header .SectionNav .Dropdown{align-self:center;color:var(--text-color);margin-right:0.75em}sparkle-header .SectionNav .Dropdown-button{border:solid 1px #dee3ea;border-radius:6px;color:var(--text-color--dark);padding:10px;transition:border-color 100ms ease}sparkle-header .SectionNav .Dropdown.is-open .Dropdown-button{border-color:var(--line-rule-color)}sparkle-header .SectionNav .Dropdown-panel{min-width:180px}sparkle-header .SectionNav .Dropdown-panel a{display:flex;justify-content:space-between}sparkle-header .SectionNav .Dropdown-panel svg{height:1em;width:1em}sparkle-header .SectionNav .Dropdown-panel .Nav-link{margin-left:0;margin-right:0}sparkle-header .SectionNav-tabs>*{align-items:center;display:inline-flex;height:var(--header-height);margin-right:1em;padding:0px 1em;position:relative}sparkle-header .SectionNav-tabs .link-active:after{background-color:currentColor;bottom:0;content:'';display:block;height:2px;left:0;position:absolute;width:100%}sparkle-header .UtilNav{align-items:center;display:flex;font-size:12px;margin-left:auto}sparkle-header .UtilNav>*{margin-left:1em}sparkle-header .UtilNav .Dropdown.is-open{color:var(--text-color)}sparkle-header .UtilNav .Dropdown-button{padding:10px 0}@media (hover: hover){sparkle-header .UtilNav .Dropdown-button:hover{color:var(--text-color)}}sparkle-header .UtilNav .Dropdown-panel{font-size:14px}sparkle-header .class-room-toggle-container{display:flex;justify-content:start;align-items:center;padding-left:20px}sparkle-header .class-room-mode-toggle-title{padding-right:5px}sparkle-header .class-room-mode-toggle{align-items:center;display:flex;justify-content:center;width:90px;height:28px;background:var(--ion-color-sparkle-step-50);border-radius:18px}sparkle-header .class-room-mode-toggle button{background-color:transparent;border:none;border-radius:16px;color:#5b708b;cursor:pointer;font-family:var(--font-family);font-size:11px;letter-spacing:-0.02em;width:calc(50% - 2px);line-height:21px;padding-top:2px;transition:200ms background-color ease, 200ms color ease}sparkle-header .class-room-mode-toggle button:focus,sparkle-header .class-room-mode-toggle button:active{outline:none}sparkle-header .class-room-mode-toggle button.is-selected{background-color:var(--ion-color-sparkle);color:var(--ion-color-sparkle-contrast);font-weight:600;box-shadow:0px 2px 3px #a7b5c7}sparkle-header .girls-inc-logo{display:block;max-width:40px;max-height:40px;width:auto;height:auto}sparkle-header sparkle-dropdown.profile-dropdown .Dropdown-icon{height:30px;width:30px}sparkle-header sparkle-dropdown.profile-dropdown .Dropdown-arrow{height:30px}";
|
450
|
-
|
451
|
-
const SparkleHeader = class {
|
452
|
-
constructor(hostRef) {
|
453
|
-
registerInstance(this, hostRef);
|
454
|
-
this.classRoomModeChanged = createEvent(this, "classRoomModeChanged", 7);
|
455
|
-
this.hideClassRoomToggle = false;
|
456
|
-
this.courseName = '';
|
457
|
-
this.imageUrl = '';
|
458
|
-
this.classRoomMode = true;
|
459
|
-
this.hidden = false;
|
460
|
-
this.frameRequested = false;
|
461
|
-
this.prevScroll = 0;
|
462
|
-
}
|
463
|
-
handleScroll() {
|
464
|
-
if (!this.frameRequested) {
|
465
|
-
requestAnimationFrame(() => {
|
466
|
-
const { scrollY } = window;
|
467
|
-
this.hidden = scrollY > 60 && scrollY > this.prevScroll;
|
468
|
-
this.prevScroll = scrollY;
|
469
|
-
this.frameRequested = false;
|
470
|
-
});
|
471
|
-
this.frameRequested = true;
|
472
|
-
}
|
473
|
-
}
|
474
|
-
componentDidLoad() {
|
475
|
-
var _a;
|
476
|
-
this.classRoomMode = (_a = get(SparkleGlobal.LOCALSTORAGE_CLASSROOM_MODE)) !== null && _a !== void 0 ? _a : false;
|
477
|
-
}
|
478
|
-
hostData() {
|
479
|
-
return {
|
480
|
-
class: { hidden: this.hidden },
|
481
|
-
};
|
482
|
-
}
|
483
|
-
toggleClassRoomMode() {
|
484
|
-
this.classRoomMode = !this.classRoomMode;
|
485
|
-
set(SparkleGlobal.LOCALSTORAGE_CLASSROOM_MODE, this.classRoomMode);
|
486
|
-
this.classRoomModeChanged.emit(this.classRoomMode);
|
487
|
-
}
|
488
|
-
renderModeToggle() {
|
489
|
-
return (h("div", { class: "class-room-toggle-container" }, h("div", { class: "class-room-mode-toggle-title" }, "Classroom"), h("div", { class: "class-room-mode-toggle" }, h("button", { class: this.classRoomMode == true ? 'is-selected' : null, title: "Toggle classroom mode", onClick: () => this.toggleClassRoomMode() }, "On"), h("button", { class: this.classRoomMode == false ? 'is-selected' : null, title: "Toggle classroom mode", onClick: () => this.toggleClassRoomMode() }, "Off"))));
|
490
|
-
}
|
491
|
-
__stencil_render() {
|
492
|
-
return (h("header", null, h("sparkle-menu-toggle", { onClick: this.toggleClickFn }), h("a", { href: "/home" }, h("div", { class: "HeaderLogo" }, this.courseName)), h("header-mobile-collapse", null, h("div", { class: "SectionNav-tabs" }, h("stencil-route-link", { url: "/home" }, "Home")), h("nav", { class: "UtilNav" }, !this.authUser ? ([
|
493
|
-
h("sparkle-button", { href: "/login", round: true }, "Login"),
|
494
|
-
h("sparkle-button", { href: "/signup", primary: true, round: true }, "Get Started"),
|
495
|
-
]) : (h("sparkle-dropdown", { image: this.imageUrl, align: "center", label: "Account", class: "label-sm-only profile-dropdown" }, h("section", null, h("stencil-route-link", { url: "/profile" }, "My Profile"), h("stencil-route-link", { url: "/enrollment" }, "My Enrollment"), h("a", { onClick: this.signoutClickFn }, "Sign Out")))), !this.hideClassRoomToggle && this.renderModeToggle(), h("slot", { name: "logo" })))));
|
496
|
-
}
|
497
|
-
render() { return h(Host, this.hostData(), this.__stencil_render()); }
|
498
|
-
};
|
499
|
-
SparkleHeader.style = headerCss;
|
500
|
-
|
501
|
-
const { state, reset } = createStore({
|
502
|
-
mediaUploading: false,
|
503
|
-
});
|
504
|
-
const mediaStore = { state, reset };
|
505
|
-
|
506
|
-
class MediaService {
|
507
|
-
constructor() { }
|
508
|
-
static getInstance() {
|
509
|
-
if (!MediaService.instance) {
|
510
|
-
MediaService.instance = new MediaService();
|
511
|
-
}
|
512
|
-
return MediaService.instance;
|
513
|
-
}
|
514
|
-
async uploadImage(files) {
|
515
|
-
let formData = new FormData();
|
516
|
-
for (let i = 0; i < files.length; i++) {
|
517
|
-
formData.append("uploads[]", files[i], files[i].name);
|
518
|
-
}
|
519
|
-
mediaStore.state.mediaUploading = true;
|
520
|
-
let result;
|
521
|
-
try {
|
522
|
-
result = await HttpService.http.post(`api/v1/MediaItems/Upload`, formData);
|
523
|
-
if (result) {
|
524
|
-
mediaStore.state.mediaUploading = false;
|
525
|
-
}
|
526
|
-
}
|
527
|
-
catch (e) {
|
528
|
-
mediaStore.state.mediaUploading = false;
|
529
|
-
}
|
530
|
-
return result;
|
531
|
-
}
|
532
|
-
}
|
533
|
-
|
534
|
-
const sparkleHealthCss = ":host{display:block}.health-image{display:block;max-width:300px;max-height:200px;width:auto;height:auto}";
|
535
|
-
|
536
|
-
const SparkleHealth = class {
|
537
|
-
constructor(hostRef) {
|
538
|
-
registerInstance(this, hostRef);
|
539
|
-
this.uploadedImageUrl = "";
|
540
|
-
this.heartRate = 0;
|
541
|
-
this.public = true;
|
542
|
-
this.submitted = false;
|
543
|
-
}
|
544
|
-
async postFeed() {
|
545
|
-
const sparkleConfig = EnvironmentConfigService.getInstance().get('sparkle');
|
546
|
-
const tocData = await AssetsService.getInstance().loadJsonFile(sparkleConfig.tocPath);
|
547
|
-
var model = {
|
548
|
-
PostText: MyHealthTemplate(this.heartRate),
|
549
|
-
ExternalResourceUrl: this.uploadedImageUrl,
|
550
|
-
IsPublic: this.public,
|
551
|
-
MiniAppId: SparkleGlobal$1.MY_HEALTH_APP_ID,
|
552
|
-
CourseId: tocData.id,
|
553
|
-
PostTextJSON: MyHealthTemplateJSON(this.heartRate)
|
554
|
-
};
|
555
|
-
const result = await FeedService.getInstance().createPost(model);
|
556
|
-
if (result.Succeeded) {
|
557
|
-
this.history.replace('/home');
|
558
|
-
}
|
559
|
-
}
|
560
|
-
async uploadImage(event) {
|
561
|
-
this.submitted = true;
|
562
|
-
console.log(event.target.files);
|
563
|
-
if (event.target.files && event.target.files[0]) {
|
564
|
-
const result = await MediaService.getInstance().uploadImage(event.target.files);
|
565
|
-
if (result.Succeeded && result.Data && result.Data.length > 0) {
|
566
|
-
this.uploadedImageUrl = result.Data[0].FullImageUrl;
|
567
|
-
console.log(this.uploadedImageUrl);
|
568
|
-
}
|
569
|
-
}
|
570
|
-
}
|
571
|
-
selectFile() {
|
572
|
-
this.el.querySelector("#fileInput").click();
|
573
|
-
}
|
574
|
-
render() {
|
575
|
-
return (h(Host, null, h("div", null, h("h3", null, "MY HEALTH"), h("p", null, "This mini-app will help girls develop and instil good physical health habits"), h("ion-list", null, h("ion-list-header", null, "Select Heart Rate"), h("ion-item", { lines: "none" }, h("ion-range", { min: 0, max: 150, step: 1, snaps: true, pin: true, onIonChange: (ev) => this.heartRate = +ev.detail.value }, h("ion-icon", { size: "small", slot: "start", name: "pulse" }), h("ion-icon", { name: "pulse", size: "small" }), h("div", { slot: "end" }, h("strong", null, this.heartRate)))), this.uploadedImageUrl && h("ion-item", { lines: "none" }, h("img", { class: "health-image", src: this.uploadedImageUrl })), h("ion-item", { lines: "none" }, h("input", { type: "file", id: "fileInput", onChange: (ev) => this.uploadImage(ev), style: { display: "none" }, accept: "image/*" }), h("div", null, h("ion-button", { onClick: () => this.selectFile(), disabled: mediaStore.state.mediaUploading }, mediaStore.state.mediaUploading && h("ion-spinner", { name: "dots" }), "Upload Image"))), h("ion-item", { lines: "none" }, h("ion-label", null, "Share to Community Wall"), h("ion-checkbox", { slot: "start", onChange: (ev) => this.public = ev.detail.checked, checked: true })), h("ion-item", { lines: "none" }, h("ion-button", { slot: "end", color: "primary", size: "default", onClick: () => this.postFeed(), disabled: mediaStore.state.mediaUploading || feedStore.state.createPostLoading }, feedStore.state.createPostLoading && h("ion-spinner", { name: "dots" }), " POST"))))));
|
576
|
-
}
|
577
|
-
get el() { return getElement(this); }
|
578
|
-
};
|
579
|
-
SparkleHealth.style = sparkleHealthCss;
|
580
|
-
|
581
|
-
const sparkleLoginCss = "sparkle-login .list{margin-bottom:0}";
|
582
|
-
|
583
|
-
const PageLogin = class {
|
584
|
-
constructor(hostRef) {
|
585
|
-
registerInstance(this, hostRef);
|
586
|
-
this.userDidLogIn = createEvent(this, "userDidLogIn", 7);
|
587
|
-
this.username = {
|
588
|
-
valid: false,
|
589
|
-
value: ''
|
590
|
-
};
|
591
|
-
this.password = {
|
592
|
-
valid: false,
|
593
|
-
value: ''
|
594
|
-
};
|
595
|
-
this.rememberMe = {
|
596
|
-
valid: true,
|
597
|
-
value: false
|
598
|
-
};
|
599
|
-
this.submitted = false;
|
600
|
-
}
|
601
|
-
handleUsername(ev) {
|
602
|
-
this.validateUsername();
|
603
|
-
this.username = Object.assign(Object.assign({}, this.username), { value: ev.target.value });
|
604
|
-
}
|
605
|
-
handlePassword(ev) {
|
606
|
-
this.validatePassword();
|
607
|
-
this.password.value = ev.target.value;
|
608
|
-
this.password = Object.assign(Object.assign({}, this.password), { value: ev.target.value });
|
609
|
-
}
|
610
|
-
handleRememberMe(ev) {
|
611
|
-
this.rememberMe = Object.assign(Object.assign({}, this.password), { value: ev.target.checked });
|
612
|
-
console.log(this.rememberMe.value);
|
613
|
-
}
|
614
|
-
validateUsername() {
|
615
|
-
if (this.username.value && this.username.value.length > 0) {
|
616
|
-
this.username = Object.assign(Object.assign({}, this.username), { valid: true });
|
617
|
-
return;
|
618
|
-
}
|
619
|
-
this.username = Object.assign(Object.assign({}, this.username), { valid: false });
|
620
|
-
}
|
621
|
-
validatePassword() {
|
622
|
-
if (this.password.value && this.password.value.length > 0) {
|
623
|
-
this.password.valid = true;
|
624
|
-
this.password = Object.assign(Object.assign({}, this.password), { valid: true });
|
625
|
-
return;
|
626
|
-
}
|
627
|
-
this.password = Object.assign(Object.assign({}, this.password), { valid: false });
|
628
|
-
}
|
629
|
-
async componentWillLoad() {
|
630
|
-
this.destroyListener = AuthStore.onChange('authUser', async (authUser) => {
|
631
|
-
this.notsignin = !authUser;
|
632
|
-
});
|
633
|
-
this.notsignin = !AuthStore.state.authUser;
|
634
|
-
}
|
635
|
-
disconnectedCallback() {
|
636
|
-
if (this.destroyListener) {
|
637
|
-
this.destroyListener();
|
638
|
-
}
|
639
|
-
}
|
640
|
-
async onLogin(e) {
|
641
|
-
e.preventDefault();
|
642
|
-
// const navCtrl: HTMLIonRouterElement = await (this.nav as any).componentOnReady();
|
643
|
-
this.validatePassword();
|
644
|
-
this.validateUsername();
|
645
|
-
this.submitted = true;
|
646
|
-
if (this.password.valid && this.username.valid) {
|
647
|
-
//await UserData.login(this.username.value);
|
648
|
-
await AuthService.getInstance().authenticate({
|
649
|
-
Email: this.username.value,
|
650
|
-
Password: this.password.value,
|
651
|
-
RememberClient: this.rememberMe.value
|
652
|
-
});
|
653
|
-
sessionStorage.setItem('rememberMe', this.rememberMe.value == true ? '1' : '0');
|
654
|
-
this.userDidLogIn.emit({ loginStatus: true });
|
655
|
-
}
|
656
|
-
}
|
657
|
-
async onSignup(e) {
|
658
|
-
e.preventDefault();
|
659
|
-
//const navCtrl: HTMLIonRouterElement = await (this.nav as any).componentOnReady();
|
660
|
-
//navCtrl.push('/signup');
|
661
|
-
}
|
662
|
-
renderLogin() {
|
663
|
-
return [
|
664
|
-
h("div", null, h("div", { class: "login-logo" }, h("img", { src: getAssetPath("/assets/img/G3-Girls.jpg"), alt: "Girls Inc" })), h("form", { novalidate: "true", onSubmit: (e) => this.onLogin(e) }, h("ion-list", { "no-lines": true }, h("ion-item", null, h("ion-label", { position: "stacked", color: "primary" }, "Username"), h("ion-input", { name: "username", type: "text", value: this.username.value, onInput: (ev) => this.handleUsername(ev), spellcheck: false, autocapitalize: "off", required: true })), h("ion-text", { color: "danger" }, h("p", { hidden: this.username.valid || this.submitted === false, class: "ion-padding-left" }, "Username is required")), h("ion-item", null, h("ion-label", { position: "stacked", color: "primary" }, "Password"), h("ion-input", { name: "password", type: "password", value: this.password.value, onInput: (ev) => this.handlePassword(ev), required: true })), h("ion-text", { color: "danger" }, h("p", { hidden: this.password.valid || this.submitted === false, class: "ion-padding-left" }, "Password is required")), h("ion-item", { lines: "none" }, h("ion-label", null, "Remember Me"), h("ion-checkbox", { slot: "start", checked: this.rememberMe.value, onIonChange: (e) => this.handleRememberMe(e) })), h("ion-item", { lines: "none" }, h("stencil-route-link", { slot: "end", url: "/forgot-password", exact: true }, "Forgot Password?"))), h("ion-row", null, h("ion-col", null, h("ion-button", { type: "submit", expand: "block", disabled: AuthStore.state.loading }, AuthStore.state.loading && h("ion-spinner", { name: "dots" }), " Log In"))), h("ion-item", { lines: "none" }, h("span", null, " Not registered yet? ", h("stencil-route-link", { url: "/signup", exact: true }, "Sign Up")))))
|
665
|
-
];
|
666
|
-
}
|
667
|
-
render() {
|
668
|
-
if (!this.notsignin) {
|
669
|
-
return h("stencil-router-redirect", { url: "home" });
|
670
|
-
}
|
671
|
-
return this.renderLogin();
|
672
|
-
}
|
673
|
-
};
|
674
|
-
PageLogin.style = sparkleLoginCss;
|
675
|
-
|
676
|
-
const menuCss = "sparkle-menu{background-color:var(--background);border-right:solid 1px var(--line-rule-color);display:flex;flex-direction:column;height:100vh;left:0;position:fixed;top:0;transition:transform 200ms cubic-bezier(0.2, 1, 0.2, 1);transform:var(--menu-transform, none);width:var(--menu-width);z-index:1}sparkle-menu>header{align-items:center;border-bottom:solid 1px var(--line-rule-color);display:flex;flex:none;height:var(--header-height);padding:0 1.4rem 0 0.8rem;user-select:none}sparkle-menu sparkle-menu-toggle{margin-right:0.75em}sparkle-menu .MenuLogo{color:var(--text-color--dark);font-family:var(--heading-font-family);height:25px}sparkle-menu>.Menu{overflow-y:auto;-webkit-overflow-scrolling:touch}sparkle-menu nav{padding:2rem 1.5rem}.MenuControls{border-bottom:solid 1px var(--line-rule-color);box-shadow:0 5px 10px -10px rgba(0, 0, 0, 0.1);font-size:13px;padding:1em}.CourseSelect,.CourseSelect .Dropdown,.CourseSelect .Dropdown-button{width:100%}.CourseSelect-course{align-items:center;display:flex}.CourseSelect-icon{height:14px;width:14px;margin-right:0.5em}.CourseSelect .Select-option{padding-left:0.75em}";
|
677
|
-
|
678
|
-
const SparkleMenu = class {
|
679
|
-
constructor(hostRef) {
|
680
|
-
registerInstance(this, hostRef);
|
681
|
-
this.config = {
|
682
|
-
showRomanNumber: false,
|
683
|
-
showModuleIndex: true,
|
684
|
-
showSessionIndex: true
|
685
|
-
};
|
686
|
-
}
|
687
|
-
render() {
|
688
|
-
return [
|
689
|
-
h("header", null, h("sparkle-menu-toggle", { onClick: this.toggleClickFn }), h("stencil-route-link", { url: "/docs/" }, h("div", { class: "MenuLogo" }, this.toc.name))),
|
690
|
-
// <section class="MenuControls">
|
691
|
-
// <course-select />
|
692
|
-
// </section>,
|
693
|
-
h("stencil-route-switch", { scrollTopOffset: 0, class: "Menu" }, h("sparkle-nav", { toc: this.toc, config: this.config })),
|
694
|
-
];
|
695
|
-
}
|
696
|
-
};
|
697
|
-
SparkleMenu.style = menuCss;
|
698
|
-
|
699
|
-
const sparkleMoodCss = ":host{display:block}.show{display:block}.hide{display:none}";
|
700
|
-
|
701
|
-
const SparkleMood = class {
|
702
|
-
constructor(hostRef) {
|
703
|
-
registerInstance(this, hostRef);
|
704
|
-
this.feelingItems = ["Anger", "Fear", "Disgust", "Happiness", "Sadness", "Suprise", "Neutral", "Anxiety", "Love", "Depression", "Contempt", "Pride", "Shame", "Envy"];
|
705
|
-
this.intensityItems = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'];
|
706
|
-
this.locationItems = ["anger.jpg", "fear.jpg", "disgust.jpg", "happiness.jpg", "sadness.jpg", "neutral.jpg", "anxiety.jpg", "love.jpg", "depression.jpg", "contempt.jpg", "pride.jpg", "shame.jpg", "envy.jpg"];
|
707
|
-
this.feeling = this.feelingItems[0];
|
708
|
-
this.intensity = this.intensityItems[0];
|
709
|
-
this.location = this.locationItems[0];
|
710
|
-
this.public = true;
|
711
|
-
this.submitted = false;
|
712
|
-
this.currentStep = "FEELING";
|
713
|
-
}
|
714
|
-
back() {
|
715
|
-
if (this.currentStep == "LOCATION") {
|
716
|
-
this.currentStep = "INTENSITY";
|
717
|
-
}
|
718
|
-
else if (this.currentStep == "INTENSITY") {
|
719
|
-
this.currentStep = "FEELING";
|
720
|
-
}
|
721
|
-
}
|
722
|
-
async next() {
|
723
|
-
if (this.currentStep == "FEELING") {
|
724
|
-
this.currentStep = "INTENSITY";
|
725
|
-
}
|
726
|
-
else if (this.currentStep == "INTENSITY") {
|
727
|
-
this.currentStep = "LOCATION";
|
728
|
-
}
|
729
|
-
else if (this.currentStep == "LOCATION") {
|
730
|
-
const sparkleConfig = EnvironmentConfigService.getInstance().get('sparkle');
|
731
|
-
const tocData = await AssetsService.getInstance().loadJsonFile(sparkleConfig.tocPath);
|
732
|
-
var model = {
|
733
|
-
CourseId: tocData.id,
|
734
|
-
PostText: MyMoodTemplate(this.feeling, this.intensity, getAssetPath(`../assets/img/mood/` + this.location)),
|
735
|
-
PostTextJSON: MyMoodTemplateJSON(this.feeling, this.intensity, getAssetPath(`../assets/img/mood/` + this.location)),
|
736
|
-
ExternalResourceUrl: "",
|
737
|
-
IsPublic: this.public,
|
738
|
-
MiniAppId: SparkleGlobal$1.MY_MOOD_APP_ID,
|
739
|
-
};
|
740
|
-
const result = await FeedService.getInstance().createPost(model);
|
741
|
-
if (result.Succeeded) {
|
742
|
-
this.history.replace('/home');
|
743
|
-
}
|
744
|
-
}
|
745
|
-
}
|
746
|
-
render() {
|
747
|
-
const buttonLabel = this.currentStep == "LOCATION" ? "SUBMIT" : "NEXT";
|
748
|
-
return (h(Host, null, h("div", { class: `${this.currentStep == "FEELING" ? '' : 'hide'}` }, h("ion-list", null, h("ion-radio-group", { name: "feeling", value: this.feeling, onIonChange: (ev) => this.feeling = ev.detail.value }, h("ion-list-header", null, h("ion-label", null, "FEELING")), this.feelingItems.map((item) => h("ion-item", null, h("ion-label", null, item), h("ion-radio", { slot: "start", value: item })))))), h("div", { class: `${this.currentStep == "INTENSITY" ? '' : 'hide'}` }, h("ion-list", null, h("ion-radio-group", { name: "intesity", value: this.intensity, onIonChange: (ev) => this.intensity = ev.detail.value }, h("ion-list-header", null, h("ion-label", null, "INTENSITY")), this.intensityItems.map((item) => h("ion-item", null, h("ion-label", null, item), h("ion-radio", { slot: "start", value: item })))))), h("div", { class: `${this.currentStep == "LOCATION" ? '' : 'hide'}` }, h("ion-list", null, h("ion-radio-group", { name: "location", value: this.location, onIonChange: (ev) => this.location = ev.detail.value }, h("ion-list-header", null, h("ion-label", null, h("h3", null, "LOCATION"))), this.locationItems.map((item) => h("ion-item", null, h("ion-label", null, h("img", { src: getAssetPath(`../assets/img/mood/` + item) })), h("ion-radio", { slot: "start", value: item })))), h("ion-item", { lines: "none" }, h("ion-label", null, "Share to Community Wall"), h("ion-checkbox", { slot: "start", onChange: (ev) => this.public = ev.detail.checked, checked: true })))), h("ion-item", { lines: "none" }, this.currentStep != "FEELING" && h("ion-button", { size: "default", slot: "start", onClick: () => this.back() }, "BACK"), h("ion-button", { slot: "end", color: "primary", size: "default", onClick: () => this.next(), disabled: feedStore.state.createPostLoading }, feedStore.state.createPostLoading && h("ion-spinner", { name: "dots" }), buttonLabel))));
|
749
|
-
}
|
750
|
-
};
|
751
|
-
SparkleMood.style = sparkleMoodCss;
|
752
|
-
|
753
|
-
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}";
|
754
|
-
|
755
|
-
const SparklePage = class {
|
756
|
-
constructor(hostRef) {
|
757
|
-
registerInstance(this, hostRef);
|
758
|
-
this.pageDidLoad = createEvent(this, "pageDidLoad", 7);
|
759
|
-
this.presentation = false;
|
760
|
-
this.page = { title: null, path: null, body: null, pageInfo: null };
|
761
|
-
this.isLesson = false;
|
762
|
-
this.handleFacilitatorNavigationChange = (url) => {
|
763
|
-
this.history.replace(url, {});
|
764
|
-
};
|
765
|
-
this.validateFetch = (response) => {
|
766
|
-
if (!response.ok) {
|
767
|
-
throw response;
|
768
|
-
}
|
769
|
-
return response.json();
|
770
|
-
};
|
771
|
-
this.handleNewPage = (page) => {
|
772
|
-
this.badFetch = null;
|
773
|
-
this.page = page;
|
774
|
-
if (this.presentation) {
|
775
|
-
this.page = Object.assign(Object.assign({}, this.page), { previousUrl: "/presentation" + this.page.previousUrl, nextUrl: "/presentation" + this.page.nextUrl });
|
776
|
-
}
|
777
|
-
StoreService.getInstance().UpdateTocPageInfo(this.page.pageInfo);
|
778
|
-
this.isLesson = this.page.pageInfo.pageId > 0;
|
779
|
-
this.pageDidLoad.emit({ pageInfo: this.page.pageInfo });
|
780
|
-
};
|
781
|
-
this.handleBadFetch = (error) => {
|
782
|
-
this.badFetch = error;
|
783
|
-
this.page = {
|
784
|
-
title: error.statusText,
|
785
|
-
body: null,
|
786
|
-
path: null,
|
787
|
-
pageInfo: null
|
788
|
-
};
|
789
|
-
};
|
790
|
-
}
|
791
|
-
componentWillLoad() {
|
792
|
-
if (this.path) {
|
793
|
-
return this.fetchPage(this.path);
|
794
|
-
}
|
795
|
-
}
|
796
|
-
componentDidLoad() {
|
797
|
-
if (this.presentation) {
|
798
|
-
signalRStore.onChange("connected", (connected) => {
|
799
|
-
if (connected) {
|
800
|
-
SignalRService.getInstance().connection.on("NavigateFacilitatorPresentationCourseTo", this.handleFacilitatorNavigationChange);
|
801
|
-
}
|
802
|
-
});
|
803
|
-
}
|
804
|
-
}
|
805
|
-
fetchPage(path, oldPath) {
|
806
|
-
if (SignalRService.getInstance().connection.connectionState == "Connected") {
|
807
|
-
SignalRService.getInstance().callSignalR("OnStudentNavigate", { url: window.location.href });
|
808
|
-
if (this.presentation) {
|
809
|
-
console.log('register listener');
|
810
|
-
SignalRService.getInstance().connection.on("NavigateFacilitatorPresentationCourseTo", this.handleFacilitatorNavigationChange);
|
811
|
-
}
|
812
|
-
}
|
813
|
-
if (path === null || path === oldPath) {
|
814
|
-
return;
|
815
|
-
}
|
816
|
-
path = /^\/docs\/pages\/[a-z]{2}\.json$/.test(path) ? path.replace('.json', '/index.json') : path;
|
817
|
-
return fetch(path).then(this.validateFetch).then(this.handleNewPage).catch(this.handleBadFetch);
|
818
|
-
}
|
819
|
-
disconnectedCallback() {
|
820
|
-
StoreService.getInstance().UpdateTocPageInfo(null);
|
821
|
-
}
|
822
|
-
// @Watch('page')
|
823
|
-
// setScrollPosition() {
|
824
|
-
// const hash = this.history.location.hash;
|
825
|
-
// if (this.isServer || (hash !== undefined && hash !== '')) {
|
826
|
-
// return;
|
827
|
-
// }
|
828
|
-
// requestAnimationFrame(() => {
|
829
|
-
// const { location } = this.history;
|
830
|
-
// const { scrollPosition = [0, 0] } = location;
|
831
|
-
// const [x, y] = scrollPosition;
|
832
|
-
// document.documentElement.scrollTo(x, y);
|
833
|
-
// });
|
834
|
-
// }
|
835
|
-
setDocumentMeta(page) {
|
836
|
-
const { title, meta = {} } = page;
|
837
|
-
const metaEls = {
|
838
|
-
title: document.head.querySelectorAll('.meta-title'),
|
839
|
-
description: document.head.querySelectorAll('.meta-description'),
|
840
|
-
url: document.head.querySelectorAll('.meta-url, link[rel="canonical"]'),
|
841
|
-
image: document.head.querySelectorAll('.meta-image'),
|
842
|
-
};
|
843
|
-
const updateMeta = (els, update) => {
|
844
|
-
els.forEach((el) => {
|
845
|
-
['href', 'content'].forEach(attr => {
|
846
|
-
if (el.hasAttribute(attr)) {
|
847
|
-
el.setAttribute(attr, update(el.getAttribute(attr)));
|
848
|
-
}
|
849
|
-
});
|
850
|
-
});
|
851
|
-
};
|
852
|
-
// Title
|
853
|
-
const getTitle = () => {
|
854
|
-
const suffix = /^\/docs\/pages\/appflow.*$/.test(this.path) ? 'Sparkle' : 'Sparkle';
|
855
|
-
// Favor meta title, else go with auto-title. fallback to generic title
|
856
|
-
return meta.title || title ? `${title} - ${suffix}` : suffix;
|
857
|
-
};
|
858
|
-
document.title = getTitle();
|
859
|
-
updateMeta(metaEls.title, getTitle);
|
860
|
-
// Canonical URL
|
861
|
-
updateMeta(metaEls.url, (oldVal) => {
|
862
|
-
const uri = '/docs/';
|
863
|
-
const path = location.pathname.split(uri)[1];
|
864
|
-
return oldVal.split(uri)[0] + uri + path;
|
865
|
-
});
|
866
|
-
// Description
|
867
|
-
updateMeta(metaEls.description, () => meta.description || 'Sparkle is the free open-source platform for creating learning content on web, mobile and desktop.');
|
868
|
-
// Sharing Image
|
869
|
-
updateMeta(metaEls.image, () => meta.image || 'https://girlsinclearning.com//images/logo-primary.png');
|
870
|
-
}
|
871
|
-
hostData() {
|
872
|
-
return {
|
873
|
-
class: {
|
874
|
-
[this.page.pageClass]: typeof this.page.pageClass === 'string',
|
875
|
-
},
|
876
|
-
};
|
877
|
-
}
|
878
|
-
async presentFeedbackModal() {
|
879
|
-
const modal = await modalController.create({
|
880
|
-
component: 'sparkle-feedback',
|
881
|
-
cssClass: 'sparkle-modal sparkle-feedback-modal'
|
882
|
-
});
|
883
|
-
await modal.present();
|
884
|
-
}
|
885
|
-
async openProjectorPage() {
|
886
|
-
if (userStore.state.user.FacilitatorClassList.length > 1) {
|
887
|
-
await this.presentAlertClasses();
|
888
|
-
}
|
889
|
-
else {
|
890
|
-
this.openWindows();
|
891
|
-
}
|
892
|
-
}
|
893
|
-
async presentAlertClasses() {
|
894
|
-
var inputs = [];
|
895
|
-
// var defaultCourseClassId = this.jwtService.getDefaultCourseClassId();
|
896
|
-
var classes = userStore.state.user.FacilitatorClassList;
|
897
|
-
classes.forEach((item, index) => inputs.push({
|
898
|
-
name: 'radio' + index,
|
899
|
-
type: 'radio',
|
900
|
-
label: item.CourseName,
|
901
|
-
value: item.CourseClassId,
|
902
|
-
//checked: defaultCourseClassId > 0 ? item.CourseClassId == defaultCourseClassId : index == 0
|
903
|
-
}));
|
904
|
-
const alert = await alertController.create({
|
905
|
-
header: 'Classes',
|
906
|
-
inputs: inputs,
|
907
|
-
buttons: [
|
908
|
-
{
|
909
|
-
text: 'Cancel',
|
910
|
-
role: 'cancel',
|
911
|
-
cssClass: 'secondary',
|
912
|
-
handler: () => {
|
913
|
-
}
|
914
|
-
}, {
|
915
|
-
text: 'Ok',
|
916
|
-
handler: (data) => {
|
917
|
-
}
|
918
|
-
}
|
919
|
-
]
|
920
|
-
});
|
921
|
-
await alert.present();
|
922
|
-
}
|
923
|
-
openWindows() {
|
924
|
-
//this.jwtService.updateDefaultCourseClassId(data);
|
925
|
-
window.open(window.location.origin + "/presentation" + this.path.replace(".json", ""), "_blank");
|
926
|
-
setTimeout(() => {
|
927
|
-
window.open(window.location.origin + "/presentation" + '/teacher' + this.path.replace(".json", ""), "_blank");
|
928
|
-
}, 500);
|
929
|
-
}
|
930
|
-
renderControls() {
|
931
|
-
if (AuthStore.state.isAuthenticated) {
|
932
|
-
return (h("div", { class: "controls" }, h("ion-button", { onClick: () => this.presentFeedbackModal() }, h("ion-icon", { name: "chatbox-outline" })), this.isLesson && userStore.state.user && userStore.state.user.Roles.indexOf('Facilitator') > -1 && h("ion-button", { onClick: () => this.openProjectorPage() }, h("ion-icon", { name: "desktop-outline" }))));
|
933
|
-
}
|
934
|
-
return "";
|
935
|
-
}
|
936
|
-
__stencil_render() {
|
937
|
-
if (this.path) {
|
938
|
-
const { page } = this;
|
939
|
-
if (this.badFetch) {
|
940
|
-
return templates.error(this.badFetch);
|
941
|
-
}
|
942
|
-
const Template = templates[page.template] || templates.default;
|
943
|
-
const content = [
|
944
|
-
h("main", { class: 'no-demo' }, this.renderControls(), h(Template, { page: page }))
|
945
|
-
];
|
946
|
-
return content;
|
947
|
-
}
|
948
|
-
else {
|
949
|
-
return h("main", { class: 'no-demo' }, h("slot", null));
|
950
|
-
}
|
951
|
-
}
|
952
|
-
static get watchers() { return {
|
953
|
-
"path": ["fetchPage"],
|
954
|
-
"page": ["setDocumentMeta"]
|
955
|
-
}; }
|
956
|
-
render() { return h(Host, this.hostData(), this.__stencil_render()); }
|
957
|
-
};
|
958
|
-
SparklePage.style = pageCss;
|
959
|
-
|
960
|
-
const sparkleResetPasswordCss = ":host{display:block}";
|
961
|
-
|
962
|
-
const SparkleResetPassword = class {
|
963
|
-
constructor(hostRef) {
|
964
|
-
registerInstance(this, hostRef);
|
965
|
-
this.formControls = {
|
966
|
-
password: {
|
967
|
-
isValid: false,
|
968
|
-
value: '',
|
969
|
-
validate: value => {
|
970
|
-
if (value) {
|
971
|
-
return true;
|
972
|
-
}
|
973
|
-
else {
|
974
|
-
return false;
|
975
|
-
}
|
976
|
-
},
|
977
|
-
},
|
978
|
-
confirmPassword: {
|
979
|
-
isValid: false,
|
980
|
-
value: '',
|
981
|
-
validate: value => {
|
982
|
-
if (value) {
|
983
|
-
return true;
|
984
|
-
}
|
985
|
-
else {
|
986
|
-
return false;
|
987
|
-
}
|
988
|
-
},
|
989
|
-
},
|
990
|
-
};
|
991
|
-
this.submitted = false;
|
992
|
-
}
|
993
|
-
componentDidLoad() {
|
994
|
-
console.log(this.history.location.query.code);
|
995
|
-
console.log(this.history.location.query.email);
|
996
|
-
}
|
997
|
-
changeFormValue(controlName, value) {
|
998
|
-
this.formControls = Object.assign(Object.assign({}, this.formControls), { [controlName]: Object.assign(Object.assign({}, this.formControls[controlName]), { value: value, isValid: this.formControls[controlName].validate(value) }) });
|
999
|
-
}
|
1000
|
-
async handleSubmit(e) {
|
1001
|
-
e.preventDefault();
|
1002
|
-
this.submitted = true;
|
1003
|
-
let isFormValid = true;
|
1004
|
-
//Run all validation functions
|
1005
|
-
for (let controlName in this.formControls) {
|
1006
|
-
let control = this.formControls[controlName];
|
1007
|
-
control.validate(control.value);
|
1008
|
-
if (!control.isValid) {
|
1009
|
-
isFormValid = false;
|
1010
|
-
}
|
1011
|
-
}
|
1012
|
-
if (isFormValid) {
|
1013
|
-
let result = await AccountService.getInstance().resetPassword({
|
1014
|
-
Email: this.history.location.query.email,
|
1015
|
-
Token: this.history.location.query.code,
|
1016
|
-
Password: this.formControls.password.value,
|
1017
|
-
ConfirmPassword: this.formControls.confirmPassword.value,
|
1018
|
-
});
|
1019
|
-
if (result.Succeeded) {
|
1020
|
-
this.history.replace('/login', {});
|
1021
|
-
}
|
1022
|
-
else if (result.Failed) {
|
1023
|
-
if (result.Errors.length > 0) {
|
1024
|
-
this.validationErrors = result.Errors;
|
1025
|
-
}
|
1026
|
-
}
|
1027
|
-
}
|
1028
|
-
}
|
1029
|
-
render() {
|
1030
|
-
return (h(Host, null, h("div", { class: "login-logo" }, h("img", { src: getAssetPath("/assets/img/G3-Girls.jpg"), alt: "Girls Inc" })), h("sparkle-validation-error", { errors: this.validationErrors }), h("form", { novalidate: "true", onSubmit: (e) => this.handleSubmit(e) }, h("ion-item", null, h("ion-label", { position: "stacked", color: "primary" }, "Password"), h("ion-input", { name: "password", type: "password", value: this.formControls.password.value, onInput: (ev) => this.changeFormValue("password", ev.target.value) })), h("ion-text", { color: "danger" }, h("p", { hidden: this.formControls.password.isValid || this.submitted === false, class: "ion-padding-start" }, "Password is required")), h("ion-item", null, h("ion-label", { position: "stacked", color: "primary" }, "Confirm Password"), h("ion-input", { name: "confirmPassword", type: "password", value: this.formControls.confirmPassword.value, onInput: (ev) => this.changeFormValue("confirmPassword", ev.target.value) })), h("ion-text", { color: "danger" }, h("p", { hidden: this.formControls.confirmPassword.isValid || this.submitted === false, class: "ion-padding-start" }, "Confirm Password is required")), h("br", null), h("div", { class: "ion-padding" }, h("ion-button", { type: "submit", expand: "block", disabled: AuthStore.state.loading }, AuthStore.state.loading && h("ion-spinner", { name: "dots" }), " Reset Password")))));
|
1031
|
-
}
|
1032
|
-
};
|
1033
|
-
SparkleResetPassword.style = sparkleResetPasswordCss;
|
1034
|
-
|
1035
|
-
const sparkleRootCss = ":root{--page-padding:2rem 0}sparkle-root{overflow-y:auto}.Layout{display:flex;overflow-x:hidden}.Layout>stencil-route,.Layout>stencil-route-switch{width:100%}.Layout.is-menu-toggled{--menu-transform:translateX(calc(-1 * var(--menu-width)));--page-margin-left:0}@media (max-width: 768px){.Layout{--menu-transform:translateX(calc(-1 * var(--menu-width)));--page-padding:1.5rem;--page-margin-left:0}.Layout.is-menu-toggled{--menu-transform:none;--page-transform:translateX(var(--menu-width))}.Layout.is-menu-toggled sparkle-page>*{opacity:0.2;pointer-events:none}body.scroll-lock{overflow-y:hidden}}#messagesList{display:grid;font-size:12px;font-weight:bold;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);margin-top:56px;padding:4px;background:#e50739;color:#fff}";
|
1036
|
-
|
1037
|
-
const SparkleRoot = class {
|
1038
|
-
constructor(hostRef) {
|
1039
|
-
registerInstance(this, hostRef);
|
1040
|
-
this.history = null;
|
1041
|
-
this.handleStudentNavigationChange = (url) => {
|
1042
|
-
this.history.replace(url, {});
|
1043
|
-
};
|
1044
|
-
}
|
1045
|
-
async componentWillLoad() {
|
1046
|
-
setupConfig({
|
1047
|
-
sparkle: Object.assign(Object.assign({}, this.config), { prod: true })
|
1048
|
-
});
|
1049
|
-
//return Promise.reject();
|
1050
|
-
await HttpService.getInstance();
|
1051
|
-
await HttpService.init();
|
1052
|
-
var sparkleConfig = EnvironmentConfigService.getInstance().get('sparkle');
|
1053
|
-
if (sparkleConfig && sparkleConfig.auth && sparkleConfig.auth.getToken()) {
|
1054
|
-
AuthStore.state.isAuthenticated = true;
|
1055
|
-
}
|
1056
|
-
AuthStore.onChange("isAuthenticated", async (isAuthenticated) => {
|
1057
|
-
if (isAuthenticated) {
|
1058
|
-
console.log('authenticated');
|
1059
|
-
await StudentService.getInstance().fetchUserConfiguration();
|
1060
|
-
}
|
1061
|
-
});
|
1062
|
-
if (AuthStore.state.isAuthenticated) {
|
1063
|
-
return await StudentService.getInstance().fetchUserConfiguration();
|
1064
|
-
}
|
1065
|
-
//SignalRAspNetCoreHelper.initSignalR();
|
1066
|
-
}
|
1067
|
-
componentDidLoad() {
|
1068
|
-
SignalRService.getInstance().connection.on("NavigateStudentTo", this.handleStudentNavigationChange);
|
1069
|
-
AuthStore.onChange("isAuthenticated", async (isAuthenticated) => {
|
1070
|
-
if (isAuthenticated) {
|
1071
|
-
SignalRService.getInstance().start();
|
1072
|
-
}
|
1073
|
-
});
|
1074
|
-
if (AuthStore.state.isAuthenticated) {
|
1075
|
-
SignalRService.getInstance().start();
|
1076
|
-
}
|
1077
|
-
}
|
1078
|
-
render() {
|
1079
|
-
return (h(Host, null, h("slot", null)));
|
1080
|
-
}
|
1081
|
-
};
|
1082
|
-
injectHistory(SparkleRoot);
|
1083
|
-
SparkleRoot.style = sparkleRootCss;
|
1084
|
-
|
1085
|
-
const sparkleSignupCss = "sparkle-signup .list{margin-bottom:0}";
|
1086
|
-
|
1087
|
-
const SparkleSignup = class {
|
1088
|
-
constructor(hostRef) {
|
1089
|
-
registerInstance(this, hostRef);
|
1090
|
-
this.formControls = {
|
1091
|
-
firstName: {
|
1092
|
-
isValid: false,
|
1093
|
-
value: '',
|
1094
|
-
validate: value => {
|
1095
|
-
if (value) {
|
1096
|
-
return true;
|
1097
|
-
}
|
1098
|
-
else {
|
1099
|
-
return false;
|
1100
|
-
}
|
1101
|
-
},
|
1102
|
-
},
|
1103
|
-
lastName: {
|
1104
|
-
isValid: false,
|
1105
|
-
value: '',
|
1106
|
-
validate: value => {
|
1107
|
-
if (value) {
|
1108
|
-
return true;
|
1109
|
-
}
|
1110
|
-
else {
|
1111
|
-
return false;
|
1112
|
-
}
|
1113
|
-
},
|
1114
|
-
},
|
1115
|
-
userName: {
|
1116
|
-
isValid: false,
|
1117
|
-
value: '',
|
1118
|
-
validate: value => {
|
1119
|
-
if (value) {
|
1120
|
-
return true;
|
1121
|
-
}
|
1122
|
-
else {
|
1123
|
-
return false;
|
1124
|
-
}
|
1125
|
-
},
|
1126
|
-
},
|
1127
|
-
email: {
|
1128
|
-
isValid: false,
|
1129
|
-
value: '',
|
1130
|
-
validate: value => {
|
1131
|
-
if (value) {
|
1132
|
-
return true;
|
1133
|
-
}
|
1134
|
-
else {
|
1135
|
-
return false;
|
1136
|
-
}
|
1137
|
-
},
|
1138
|
-
},
|
1139
|
-
password: {
|
1140
|
-
isValid: false,
|
1141
|
-
value: '',
|
1142
|
-
validate: value => {
|
1143
|
-
if (value) {
|
1144
|
-
return true;
|
1145
|
-
}
|
1146
|
-
else {
|
1147
|
-
return false;
|
1148
|
-
}
|
1149
|
-
},
|
1150
|
-
},
|
1151
|
-
confirmPassword: {
|
1152
|
-
isValid: false,
|
1153
|
-
value: '',
|
1154
|
-
validate: value => {
|
1155
|
-
if (value) {
|
1156
|
-
return true;
|
1157
|
-
}
|
1158
|
-
else {
|
1159
|
-
return false;
|
1160
|
-
}
|
1161
|
-
},
|
1162
|
-
},
|
1163
|
-
};
|
1164
|
-
this.submitted = false;
|
1165
|
-
}
|
1166
|
-
changeFormValue(controlName, value) {
|
1167
|
-
this.formControls = Object.assign(Object.assign({}, this.formControls), { [controlName]: Object.assign(Object.assign({}, this.formControls[controlName]), { value: value, isValid: this.formControls[controlName].validate(value) }) });
|
1168
|
-
}
|
1169
|
-
async handleSubmit(e) {
|
1170
|
-
e.preventDefault();
|
1171
|
-
this.submitted = true;
|
1172
|
-
let isFormValid = true;
|
1173
|
-
//Run all validation functions
|
1174
|
-
for (let controlName in this.formControls) {
|
1175
|
-
let control = this.formControls[controlName];
|
1176
|
-
control.validate(control.value);
|
1177
|
-
if (!control.isValid) {
|
1178
|
-
isFormValid = false;
|
1179
|
-
}
|
1180
|
-
}
|
1181
|
-
if (isFormValid) {
|
1182
|
-
let result = await AccountService.getInstance().register({
|
1183
|
-
Email: this.formControls.email.value,
|
1184
|
-
UserName: this.formControls.userName.value,
|
1185
|
-
FirstName: this.formControls.firstName.value,
|
1186
|
-
LastName: this.formControls.lastName.value,
|
1187
|
-
Password: this.formControls.password.value,
|
1188
|
-
ConfirmPassword: this.formControls.confirmPassword.value,
|
1189
|
-
});
|
1190
|
-
if (result.Succeeded) {
|
1191
|
-
this.history.replace('/login', {});
|
1192
|
-
}
|
1193
|
-
else if (result.Failed) {
|
1194
|
-
if (result.Errors.length > 0) {
|
1195
|
-
this.validationErrors = result.Errors;
|
1196
|
-
}
|
1197
|
-
}
|
1198
|
-
}
|
1199
|
-
}
|
1200
|
-
render() {
|
1201
|
-
return [
|
1202
|
-
h("div", null, h("div", { class: "signup-logo" }, h("img", { src: getAssetPath("/assets/img/G3-Girls.jpg"), alt: "Girls Inc" })), h("sparkle-validation-error", { errors: this.validationErrors }), h("form", { onSubmit: e => this.handleSubmit(e), novalidate: true }, h("ion-list", { "no-lines": true }, h("ion-item", null, h("ion-label", { position: "stacked", color: "primary" }, "First Name"), h("ion-input", { name: "firstName", type: "text", value: this.formControls.firstName.value, onInput: (ev) => this.changeFormValue("firstName", ev.target.value) })), h("ion-text", { color: "danger" }, h("p", { hidden: this.formControls.firstName.isValid || this.submitted === false, class: "ion-padding-start" }, "First Name is required")), h("ion-item", null, h("ion-label", { position: "stacked", color: "primary" }, "Last Name"), h("ion-input", { name: "lastName", type: "text", value: this.formControls.lastName.value, onInput: (ev) => this.changeFormValue("lastName", ev.target.value) })), h("ion-text", { color: "danger" }, h("p", { hidden: this.formControls.lastName.isValid || this.submitted === false, class: "ion-padding-start" }, "Last Name is required")), h("ion-item", null, h("ion-label", { position: "stacked", color: "primary" }, "Username"), h("ion-input", { name: "userName", type: "text", value: this.formControls.userName.value, onInput: (ev) => this.changeFormValue("userName", ev.target.value) })), h("ion-text", { color: "danger" }, h("p", { hidden: this.formControls.userName.isValid || this.submitted === false, class: "ion-padding-start" }, "Username is required")), h("ion-item", null, h("ion-label", { position: "stacked", color: "primary" }, "Email"), h("ion-input", { name: "email", type: "text", value: this.formControls.email.value, onInput: (ev) => this.changeFormValue("email", ev.target.value) })), h("ion-text", { color: "danger" }, h("p", { hidden: this.formControls.email.isValid || this.submitted === false, class: "ion-padding-start" }, "Email is required")), h("ion-item", null, h("ion-label", { position: "stacked", color: "primary" }, "Password"), h("ion-input", { name: "password", type: "password", value: this.formControls.password.value, onInput: (ev) => this.changeFormValue("password", ev.target.value) })), h("ion-text", { color: "danger" }, h("p", { hidden: this.formControls.password.isValid || this.submitted === false, class: "ion-padding-start" }, "Password is required")), h("ion-item", null, h("ion-label", { position: "stacked", color: "primary" }, "Confirm Password"), h("ion-input", { name: "confirmPassword", type: "password", value: this.formControls.confirmPassword.value, onInput: (ev) => this.changeFormValue("confirmPassword", ev.target.value) })), h("ion-text", { color: "danger" }, h("p", { hidden: this.formControls.confirmPassword.isValid || this.submitted === false, class: "ion-padding-start" }, "Confirm Password is required"))), h("div", { class: "ion-padding" }, h("ion-button", { type: "submit", expand: "block", disabled: AuthStore.state.loading }, AuthStore.state.loading && h("ion-spinner", { name: "dots" }), "Register")), h("ion-item", { lines: "none" }, "Already have an account? \u00A0", h("stencil-route-link", { url: "/login", exact: true }, "Log In"))))
|
1203
|
-
];
|
1204
|
-
}
|
1205
|
-
};
|
1206
|
-
SparkleSignup.style = sparkleSignupCss;
|
1207
|
-
|
1208
|
-
const sparkleUnauthorizedCss = ":host{display:block}.unauthorized{display:block;padding-left:var(--page-margin-left);padding-top:var(--header-height)}.content{text-align:center;padding-top:40px}";
|
1209
|
-
|
1210
|
-
const SparkleUnauthorized = class {
|
1211
|
-
constructor(hostRef) {
|
1212
|
-
registerInstance(this, hostRef);
|
1213
|
-
}
|
1214
|
-
render() {
|
1215
|
-
return (h(Host, { class: {
|
1216
|
-
'unauthorized': true,
|
1217
|
-
} }, h("div", { class: "content" }, h("h1", null, "401"), h("p", null, "Unauthorized"))));
|
1218
|
-
}
|
1219
|
-
};
|
1220
|
-
SparkleUnauthorized.style = sparkleUnauthorizedCss;
|
1221
|
-
|
1222
|
-
const sparkleUserEnrollmentCss = ":host{display:block}";
|
1223
|
-
|
1224
|
-
const SparkleUserEnrollment = class {
|
1225
|
-
constructor(hostRef) {
|
1226
|
-
registerInstance(this, hostRef);
|
1227
|
-
this.enrollmentFormControls = {
|
1228
|
-
ShortCode: {
|
1229
|
-
isValid: false,
|
1230
|
-
value: '',
|
1231
|
-
validate: (value) => {
|
1232
|
-
if (value) {
|
1233
|
-
return true;
|
1234
|
-
}
|
1235
|
-
else {
|
1236
|
-
return false;
|
1237
|
-
}
|
1238
|
-
},
|
1239
|
-
},
|
1240
|
-
};
|
1241
|
-
this.enrollmentFormSubmitted = false;
|
1242
|
-
}
|
1243
|
-
changeEnrollmentFormValue(controlName, value) {
|
1244
|
-
this.enrollmentFormControls = Object.assign(Object.assign({}, this.enrollmentFormControls), { [controlName]: Object.assign(Object.assign({}, this.enrollmentFormControls[controlName]), { value: value, isValid: this.enrollmentFormControls[controlName].validate(value) }) });
|
1245
|
-
}
|
1246
|
-
async handleEnrollmentFormSubmit(e) {
|
1247
|
-
e.preventDefault();
|
1248
|
-
this.enrollmentFormSubmitted = true;
|
1249
|
-
let isFormValid = true;
|
1250
|
-
//Run all validation functions
|
1251
|
-
for (let controlName in this.enrollmentFormControls) {
|
1252
|
-
let control = this.enrollmentFormControls[controlName];
|
1253
|
-
control.validate(control.value);
|
1254
|
-
if (!control.isValid) {
|
1255
|
-
isFormValid = false;
|
1256
|
-
}
|
1257
|
-
}
|
1258
|
-
if (isFormValid) {
|
1259
|
-
let result = await StudentService.getInstance().enrollClass({
|
1260
|
-
ShortCode: this.enrollmentFormControls.ShortCode.value,
|
1261
|
-
});
|
1262
|
-
console.log(result);
|
1263
|
-
}
|
1264
|
-
}
|
1265
|
-
async leaveClass(enrollmentId) {
|
1266
|
-
let result = await StudentService.getInstance().leaveClass({
|
1267
|
-
Id: enrollmentId,
|
1268
|
-
});
|
1269
|
-
console.log(result);
|
1270
|
-
}
|
1271
|
-
renderEnrollmentList() {
|
1272
|
-
if (userStore.state.enrollmentList.length > 0) {
|
1273
|
-
return (userStore.state.enrollmentList.map((item) => h("ion-item", null, h("ion-label", null, item.Name), h("ion-button", { onClick: () => this.leaveClass(item.Id) }, h("ion-icon", { name: "trash" })))));
|
1274
|
-
}
|
1275
|
-
else {
|
1276
|
-
return (h("ion-item", { lines: "none" }, h("ion-text", { class: "ion-text-center" }, "No data found")));
|
1277
|
-
}
|
1278
|
-
}
|
1279
|
-
render() {
|
1280
|
-
return (h(Host, null, h("form", { onSubmit: e => this.handleEnrollmentFormSubmit(e), novalidate: true }, h("ion-list", { "no-lines": true }, h("ion-list-header", null, "Enrollment"), h("ion-grid", null, h("ion-row", { class: "ion-align-items-center" }, h("ion-col", { size: "9" }, h("ion-item", null, h("ion-label", { position: "stacked", color: "primary" }, "Short Code"), h("ion-input", { name: "ShortCode", type: "text", value: this.enrollmentFormControls.ShortCode.value, onInput: (ev) => this.changeEnrollmentFormValue("ShortCode", ev.target.value) })), h("ion-text", { color: "danger" }, h("p", { hidden: this.enrollmentFormControls.ShortCode.isValid || this.enrollmentFormSubmitted === false, class: "ion-padding-start" }, "Short Code is required"))), h("ion-col", { size: "3" }, h("div", null, h("ion-button", { slot: "end", type: "submit", expand: "block" }, "Enroll"))))))), h("ion-list", null, h("ion-list-header", null, "Enroll List"), this.renderEnrollmentList())));
|
1281
|
-
}
|
1282
|
-
};
|
1283
|
-
SparkleUserEnrollment.style = sparkleUserEnrollmentCss;
|
1284
|
-
|
1285
|
-
const sparkleUserProfileCss = ":host{display:block}ion-card{box-shadow:0px 2px 2px rgba(0, 0, 0, 0.2);overflow:visible;margin:16px 0 24px;position:relative;padding-top:60px}ion-card .img-wrapper{background-color:#f5f5f5;border-radius:10px;position:absolute;left:50%;top:-30px;transform:translateX(-50%)}ion-card .img-wrapper img{border-radius:10px;width:80px;height:80px}ion-card .img-wrapper ion-button{--border-width:1px;--border-color:var(--ion-color-sparkle);--border-style:solid;--padding-start:0;--padding-end:0;--padding-bottom:0;--padding-top:0;--border-radius:50%;height:26px;width:26px;position:absolute;right:-10px;bottom:-10px}ion-card .img-wrapper ion-button ion-icon{width:14px;height:14px}ion-card .img-wrapper img.loading{opacity:0.1}.image-upload-loading{position:absolute;top:40%;left:35%}";
|
1286
|
-
|
1287
|
-
const SparkleUserProfile = class {
|
1288
|
-
constructor(hostRef) {
|
1289
|
-
registerInstance(this, hostRef);
|
1290
|
-
this.profileFormControls = {
|
1291
|
-
ProfileImage: {
|
1292
|
-
isValid: true,
|
1293
|
-
value: '',
|
1294
|
-
validate: (_) => {
|
1295
|
-
return true;
|
1296
|
-
},
|
1297
|
-
},
|
1298
|
-
FirstName: {
|
1299
|
-
isValid: false,
|
1300
|
-
value: '',
|
1301
|
-
validate: (value) => {
|
1302
|
-
if (value) {
|
1303
|
-
return true;
|
1304
|
-
}
|
1305
|
-
else {
|
1306
|
-
return false;
|
1307
|
-
}
|
1308
|
-
},
|
1309
|
-
},
|
1310
|
-
LastName: {
|
1311
|
-
isValid: false,
|
1312
|
-
value: '',
|
1313
|
-
validate: (value) => {
|
1314
|
-
if (value) {
|
1315
|
-
return true;
|
1316
|
-
}
|
1317
|
-
else {
|
1318
|
-
return false;
|
1319
|
-
}
|
1320
|
-
},
|
1321
|
-
},
|
1322
|
-
ProfileText: {
|
1323
|
-
isValid: true,
|
1324
|
-
value: '',
|
1325
|
-
validate: (value) => {
|
1326
|
-
if (value) {
|
1327
|
-
return true;
|
1328
|
-
}
|
1329
|
-
else {
|
1330
|
-
return false;
|
1331
|
-
}
|
1332
|
-
}
|
1333
|
-
}
|
1334
|
-
};
|
1335
|
-
this.profileFormSubmitted = false;
|
1336
|
-
}
|
1337
|
-
componentWillLoad() {
|
1338
|
-
if (userStore.state.user) {
|
1339
|
-
const user = userStore.state.user;
|
1340
|
-
this.changeFormValue("FirstName", user.FirstName);
|
1341
|
-
this.changeFormValue("LastName", user.LastName);
|
1342
|
-
this.changeFormValue("ProfileText", user.ProfileText);
|
1343
|
-
this.changeFormValue("ProfileImage", user.ProfileImage);
|
1344
|
-
}
|
1345
|
-
}
|
1346
|
-
changeFormValue(controlName, value) {
|
1347
|
-
this.profileFormControls = Object.assign(Object.assign({}, this.profileFormControls), { [controlName]: Object.assign(Object.assign({}, this.profileFormControls[controlName]), { value: value, isValid: this.profileFormControls[controlName].validate(value) }) });
|
1348
|
-
}
|
1349
|
-
async handleProfileFormSubmit(e) {
|
1350
|
-
e.preventDefault();
|
1351
|
-
await this.updateUser();
|
1352
|
-
}
|
1353
|
-
async updateUser() {
|
1354
|
-
this.profileFormSubmitted = true;
|
1355
|
-
let isFormValid = true;
|
1356
|
-
for (let controlName in this.profileFormControls) {
|
1357
|
-
let control = this.profileFormControls[controlName];
|
1358
|
-
control.validate(control.value);
|
1359
|
-
if (!control.isValid) {
|
1360
|
-
isFormValid = false;
|
1361
|
-
}
|
1362
|
-
}
|
1363
|
-
if (isFormValid) {
|
1364
|
-
await StudentService.getInstance().updateProfile({
|
1365
|
-
FirstName: this.profileFormControls.FirstName.value,
|
1366
|
-
LastName: this.profileFormControls.LastName.value,
|
1367
|
-
ProfileImage: this.profileFormControls.ProfileImage.value,
|
1368
|
-
ProfileText: this.profileFormControls.ProfileText.value
|
1369
|
-
});
|
1370
|
-
}
|
1371
|
-
}
|
1372
|
-
async uploadProfileImage(event) {
|
1373
|
-
if (event.target.files && event.target.files[0]) {
|
1374
|
-
const result = await MediaService.getInstance().uploadImage(event.target.files);
|
1375
|
-
if (result.Succeeded && result.Data && result.Data.length > 0) {
|
1376
|
-
this.changeFormValue("ProfileImage", result.Data[0].FullImageUrl);
|
1377
|
-
await this.updateUser();
|
1378
|
-
}
|
1379
|
-
}
|
1380
|
-
}
|
1381
|
-
selectFile() {
|
1382
|
-
this.el.querySelector("#fileInput").click();
|
1383
|
-
}
|
1384
|
-
render() {
|
1385
|
-
return (h(Host, null, h("ion-card", { color: "sparkle" }, h("div", { class: "img-wrapper" }, h("img", { class: mediaStore.state.mediaUploading ? "loading" : '', src: this.profileFormControls.ProfileImage.value || getAssetPath(`../assets/svg/profile.svg`) }), h("input", { type: "file", id: "fileInput", onChange: (ev) => this.uploadProfileImage(ev), style: { display: "none" }, accept: "image/*" }), h("ion-button", { color: "sparkle", onClick: () => this.selectFile(), disabled: mediaStore.state.mediaUploading }, h("ion-icon", { slot: "icon-only", name: "camera-outline" })), mediaStore.state.mediaUploading && h("ion-spinner", { class: "image-upload-loading", name: "dots" })), h("ion-card-content", { class: "ion-text-center" }, h("h2", null, this.profileFormControls.FirstName.value, " ", this.profileFormControls.LastName.value), h("h3", null, this.profileFormControls.ProfileText.value))), h("form", { onSubmit: e => this.handleProfileFormSubmit(e), novalidate: true }, h("ion-list", { "no-lines": true }, h("ion-item", null, h("ion-label", { position: "stacked", color: "primary" }, "First Name"), h("ion-input", { name: "firstName", type: "text", value: this.profileFormControls.FirstName.value, onInput: (ev) => this.changeFormValue("FirstName", ev.target.value) })), h("ion-text", { color: "danger" }, h("p", { hidden: this.profileFormControls.FirstName.isValid || this.profileFormSubmitted === false, class: "ion-padding-start" }, "First Name is required")), h("ion-item", null, h("ion-label", { position: "stacked", color: "primary" }, "Last Name"), h("ion-input", { name: "lastName", type: "text", value: this.profileFormControls.LastName.value, onInput: (ev) => this.changeFormValue("LastName", ev.target.value) })), h("ion-text", { color: "danger" }, h("p", { hidden: this.profileFormControls.LastName.isValid || this.profileFormSubmitted === false, class: "ion-padding-start" }, "Last Name is required")), h("ion-item", null, h("ion-label", { position: "stacked", color: "primary" }, "Profile Bio"), h("ion-input", { name: "lastName", type: "text", value: this.profileFormControls.ProfileText.value, onInput: (ev) => this.changeFormValue("ProfileText", ev.target.value) })), h("ion-text", { color: "danger" }, h("p", { hidden: this.profileFormControls.ProfileText.isValid || this.profileFormSubmitted === false, class: "ion-padding-start" }, "Profile Bio is required"))), h("div", { class: "ion-padding" }, h("ion-button", { type: "submit", expand: "block", disabled: userStore.state.updateLoading }, userStore.state.updateLoading && h("ion-spinner", { name: "dots" }), " Update")))));
|
1386
|
-
}
|
1387
|
-
get el() { return getElement(this); }
|
1388
|
-
};
|
1389
|
-
SparkleUserProfile.style = sparkleUserProfileCss;
|
1390
|
-
|
1391
|
-
const routeCss = "stencil-route.inactive{display:none}";
|
1392
|
-
|
1393
|
-
const Route = class {
|
1394
|
-
constructor(hostRef) {
|
1395
|
-
registerInstance(this, hostRef);
|
1396
|
-
this.group = null;
|
1397
|
-
this.match = null;
|
1398
|
-
this.componentProps = {};
|
1399
|
-
this.exact = false;
|
1400
|
-
this.scrollOnNextRender = false;
|
1401
|
-
this.previousMatch = null;
|
1402
|
-
}
|
1403
|
-
// Identify if the current route is a match.
|
1404
|
-
computeMatch(newLocation) {
|
1405
|
-
const isGrouped = this.group != null || (this.el.parentElement != null && this.el.parentElement.tagName.toLowerCase() === 'stencil-route-switch');
|
1406
|
-
if (!newLocation || isGrouped) {
|
1407
|
-
return;
|
1408
|
-
}
|
1409
|
-
this.previousMatch = this.match;
|
1410
|
-
return this.match = matchPath(newLocation.pathname, {
|
1411
|
-
path: this.url,
|
1412
|
-
exact: this.exact,
|
1413
|
-
strict: true
|
1414
|
-
});
|
1415
|
-
}
|
1416
|
-
async loadCompleted() {
|
1417
|
-
let routeViewOptions = {};
|
1418
|
-
if (this.history && this.history.location.hash) {
|
1419
|
-
routeViewOptions = {
|
1420
|
-
scrollToId: this.history.location.hash.substr(1)
|
1421
|
-
};
|
1422
|
-
}
|
1423
|
-
else if (this.scrollTopOffset) {
|
1424
|
-
routeViewOptions = {
|
1425
|
-
scrollTopOffset: this.scrollTopOffset
|
1426
|
-
};
|
1427
|
-
}
|
1428
|
-
// After all children have completed then tell switch
|
1429
|
-
// the provided callback will get executed after this route is in view
|
1430
|
-
if (typeof this.componentUpdated === 'function') {
|
1431
|
-
this.componentUpdated(routeViewOptions);
|
1432
|
-
// If this is an independent route and it matches then routes have updated.
|
1433
|
-
// If the only change to location is a hash change then do not scroll.
|
1434
|
-
}
|
1435
|
-
else if (this.match && !matchesAreEqual(this.match, this.previousMatch) && this.routeViewsUpdated) {
|
1436
|
-
this.routeViewsUpdated(routeViewOptions);
|
1437
|
-
}
|
1438
|
-
}
|
1439
|
-
async componentDidUpdate() {
|
1440
|
-
await this.loadCompleted();
|
1441
|
-
}
|
1442
|
-
async componentDidLoad() {
|
1443
|
-
await this.loadCompleted();
|
1444
|
-
}
|
1445
|
-
render() {
|
1446
|
-
// If there is no activeRouter then do not render
|
1447
|
-
// Check if this route is in the matching URL (for example, a parent route)
|
1448
|
-
if (!this.match || !this.history) {
|
1449
|
-
return null;
|
1450
|
-
}
|
1451
|
-
// component props defined in route
|
1452
|
-
// the history api
|
1453
|
-
// current match data including params
|
1454
|
-
const childProps = Object.assign({}, this.componentProps, { history: this.history, match: this.match });
|
1455
|
-
// If there is a routerRender defined then use
|
1456
|
-
// that and pass the component and component props with it.
|
1457
|
-
if (this.routeRender) {
|
1458
|
-
return this.routeRender(Object.assign({}, childProps, { component: this.component }));
|
1459
|
-
}
|
1460
|
-
if (this.component) {
|
1461
|
-
const ChildComponent = this.component;
|
1462
|
-
return (h(ChildComponent, Object.assign({}, childProps)));
|
1463
|
-
}
|
1464
|
-
}
|
1465
|
-
get el() { return getElement(this); }
|
1466
|
-
static get watchers() { return {
|
1467
|
-
"location": ["computeMatch"]
|
1468
|
-
}; }
|
1469
|
-
};
|
1470
|
-
ActiveRouter.injectProps(Route, [
|
1471
|
-
'location',
|
1472
|
-
'history',
|
1473
|
-
'historyType',
|
1474
|
-
'routeViewsUpdated'
|
1475
|
-
]);
|
1476
|
-
Route.style = routeCss;
|
1477
|
-
|
1478
|
-
const warning = (value, ...args) => {
|
1479
|
-
if (!value) {
|
1480
|
-
console.warn(...args);
|
1481
|
-
}
|
1482
|
-
};
|
1483
|
-
|
1484
|
-
// Adapted from the https://github.com/ReactTraining/history and converted to TypeScript
|
1485
|
-
const createTransitionManager = () => {
|
1486
|
-
let prompt;
|
1487
|
-
let listeners = [];
|
1488
|
-
const setPrompt = (nextPrompt) => {
|
1489
|
-
warning(prompt == null, 'A history supports only one prompt at a time');
|
1490
|
-
prompt = nextPrompt;
|
1491
|
-
return () => {
|
1492
|
-
if (prompt === nextPrompt) {
|
1493
|
-
prompt = null;
|
1494
|
-
}
|
1495
|
-
};
|
1496
|
-
};
|
1497
|
-
const confirmTransitionTo = (location, action, getUserConfirmation, callback) => {
|
1498
|
-
// TODO: If another transition starts while we're still confirming
|
1499
|
-
// the previous one, we may end up in a weird state. Figure out the
|
1500
|
-
// best way to handle this.
|
1501
|
-
if (prompt != null) {
|
1502
|
-
const result = typeof prompt === 'function' ? prompt(location, action) : prompt;
|
1503
|
-
if (typeof result === 'string') {
|
1504
|
-
if (typeof getUserConfirmation === 'function') {
|
1505
|
-
getUserConfirmation(result, callback);
|
1506
|
-
}
|
1507
|
-
else {
|
1508
|
-
warning(false, 'A history needs a getUserConfirmation function in order to use a prompt message');
|
1509
|
-
callback(true);
|
1510
|
-
}
|
1511
|
-
}
|
1512
|
-
else {
|
1513
|
-
// Return false from a transition hook to cancel the transition.
|
1514
|
-
callback(result !== false);
|
1515
|
-
}
|
1516
|
-
}
|
1517
|
-
else {
|
1518
|
-
callback(true);
|
1519
|
-
}
|
1520
|
-
};
|
1521
|
-
const appendListener = (fn) => {
|
1522
|
-
let isActive = true;
|
1523
|
-
const listener = (...args) => {
|
1524
|
-
if (isActive) {
|
1525
|
-
fn(...args);
|
1526
|
-
}
|
1527
|
-
};
|
1528
|
-
listeners.push(listener);
|
1529
|
-
return () => {
|
1530
|
-
isActive = false;
|
1531
|
-
listeners = listeners.filter(item => item !== listener);
|
1532
|
-
};
|
1533
|
-
};
|
1534
|
-
const notifyListeners = (...args) => {
|
1535
|
-
listeners.forEach(listener => listener(...args));
|
1536
|
-
};
|
1537
|
-
return {
|
1538
|
-
setPrompt,
|
1539
|
-
confirmTransitionTo,
|
1540
|
-
appendListener,
|
1541
|
-
notifyListeners
|
1542
|
-
};
|
1543
|
-
};
|
1544
|
-
|
1545
|
-
const createScrollHistory = (win, applicationScrollKey = 'scrollPositions') => {
|
1546
|
-
let scrollPositions = new Map();
|
1547
|
-
const set = (key, value) => {
|
1548
|
-
scrollPositions.set(key, value);
|
1549
|
-
if (storageAvailable(win, 'sessionStorage')) {
|
1550
|
-
const arrayData = [];
|
1551
|
-
scrollPositions.forEach((value, key) => {
|
1552
|
-
arrayData.push([key, value]);
|
1553
|
-
});
|
1554
|
-
win.sessionStorage.setItem('scrollPositions', JSON.stringify(arrayData));
|
1555
|
-
}
|
1556
|
-
};
|
1557
|
-
const get = (key) => {
|
1558
|
-
return scrollPositions.get(key);
|
1559
|
-
};
|
1560
|
-
const has = (key) => {
|
1561
|
-
return scrollPositions.has(key);
|
1562
|
-
};
|
1563
|
-
const capture = (key) => {
|
1564
|
-
set(key, [win.scrollX, win.scrollY]);
|
1565
|
-
};
|
1566
|
-
if (storageAvailable(win, 'sessionStorage')) {
|
1567
|
-
const scrollData = win.sessionStorage.getItem(applicationScrollKey);
|
1568
|
-
scrollPositions = scrollData ?
|
1569
|
-
new Map(JSON.parse(scrollData)) :
|
1570
|
-
scrollPositions;
|
1571
|
-
}
|
1572
|
-
if ('scrollRestoration' in win.history) {
|
1573
|
-
history.scrollRestoration = 'manual';
|
1574
|
-
}
|
1575
|
-
return {
|
1576
|
-
set,
|
1577
|
-
get,
|
1578
|
-
has,
|
1579
|
-
capture
|
1580
|
-
};
|
1581
|
-
};
|
1582
|
-
|
1583
|
-
// Adapted from the https://github.com/ReactTraining/history and converted to TypeScript
|
1584
|
-
const PopStateEvent = 'popstate';
|
1585
|
-
const HashChangeEvent$1 = 'hashchange';
|
1586
|
-
/**
|
1587
|
-
* Creates a history object that uses the HTML5 history API including
|
1588
|
-
* pushState, replaceState, and the popstate event.
|
1589
|
-
*/
|
1590
|
-
const createBrowserHistory = (win, props = {}) => {
|
1591
|
-
let forceNextPop = false;
|
1592
|
-
const globalHistory = win.history;
|
1593
|
-
const globalLocation = win.location;
|
1594
|
-
const globalNavigator = win.navigator;
|
1595
|
-
const canUseHistory = supportsHistory(win);
|
1596
|
-
const needsHashChangeListener = !supportsPopStateOnHashChange(globalNavigator);
|
1597
|
-
const scrollHistory = createScrollHistory(win);
|
1598
|
-
const forceRefresh = (props.forceRefresh != null) ? props.forceRefresh : false;
|
1599
|
-
const getUserConfirmation = (props.getUserConfirmation != null) ? props.getUserConfirmation : getConfirmation;
|
1600
|
-
const keyLength = (props.keyLength != null) ? props.keyLength : 6;
|
1601
|
-
const basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : '';
|
1602
|
-
const getHistoryState = () => {
|
1603
|
-
try {
|
1604
|
-
return win.history.state || {};
|
1605
|
-
}
|
1606
|
-
catch (e) {
|
1607
|
-
// IE 11 sometimes throws when accessing window.history.state
|
1608
|
-
// See https://github.com/ReactTraining/history/pull/289
|
1609
|
-
return {};
|
1610
|
-
}
|
1611
|
-
};
|
1612
|
-
const getDOMLocation = (historyState) => {
|
1613
|
-
historyState = historyState || {};
|
1614
|
-
const { key, state } = historyState;
|
1615
|
-
const { pathname, search, hash } = globalLocation;
|
1616
|
-
let path = pathname + search + hash;
|
1617
|
-
warning((!basename || hasBasename(path, basename)), 'You are attempting to use a basename on a page whose URL path does not begin ' +
|
1618
|
-
'with the basename. Expected path "' + path + '" to begin with "' + basename + '".');
|
1619
|
-
if (basename) {
|
1620
|
-
path = stripBasename(path, basename);
|
1621
|
-
}
|
1622
|
-
return createLocation(path, state, key || createKey(keyLength));
|
1623
|
-
};
|
1624
|
-
const transitionManager = createTransitionManager();
|
1625
|
-
const setState = (nextState) => {
|
1626
|
-
// Capture location for the view before changing history.
|
1627
|
-
scrollHistory.capture(history.location.key);
|
1628
|
-
Object.assign(history, nextState);
|
1629
|
-
// Set scroll position based on its previous storage value
|
1630
|
-
history.location.scrollPosition = scrollHistory.get(history.location.key);
|
1631
|
-
history.length = globalHistory.length;
|
1632
|
-
transitionManager.notifyListeners(history.location, history.action);
|
1633
|
-
};
|
1634
|
-
const handlePopState = (event) => {
|
1635
|
-
// Ignore extraneous popstate events in WebKit.
|
1636
|
-
if (!isExtraneousPopstateEvent(globalNavigator, event)) {
|
1637
|
-
handlePop(getDOMLocation(event.state));
|
1638
|
-
}
|
1639
|
-
};
|
1640
|
-
const handleHashChange = () => {
|
1641
|
-
handlePop(getDOMLocation(getHistoryState()));
|
1642
|
-
};
|
1643
|
-
const handlePop = (location) => {
|
1644
|
-
if (forceNextPop) {
|
1645
|
-
forceNextPop = false;
|
1646
|
-
setState();
|
1647
|
-
}
|
1648
|
-
else {
|
1649
|
-
const action = 'POP';
|
1650
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, (ok) => {
|
1651
|
-
if (ok) {
|
1652
|
-
setState({ action, location });
|
1653
|
-
}
|
1654
|
-
else {
|
1655
|
-
revertPop(location);
|
1656
|
-
}
|
1657
|
-
});
|
1658
|
-
}
|
1659
|
-
};
|
1660
|
-
const revertPop = (fromLocation) => {
|
1661
|
-
const toLocation = history.location;
|
1662
|
-
// TODO: We could probably make this more reliable by
|
1663
|
-
// keeping a list of keys we've seen in sessionStorage.
|
1664
|
-
// Instead, we just default to 0 for keys we don't know.
|
1665
|
-
let toIndex = allKeys.indexOf(toLocation.key);
|
1666
|
-
let fromIndex = allKeys.indexOf(fromLocation.key);
|
1667
|
-
if (toIndex === -1) {
|
1668
|
-
toIndex = 0;
|
1669
|
-
}
|
1670
|
-
if (fromIndex === -1) {
|
1671
|
-
fromIndex = 0;
|
1672
|
-
}
|
1673
|
-
const delta = toIndex - fromIndex;
|
1674
|
-
if (delta) {
|
1675
|
-
forceNextPop = true;
|
1676
|
-
go(delta);
|
1677
|
-
}
|
1678
|
-
};
|
1679
|
-
const initialLocation = getDOMLocation(getHistoryState());
|
1680
|
-
let allKeys = [initialLocation.key];
|
1681
|
-
let listenerCount = 0;
|
1682
|
-
let isBlocked = false;
|
1683
|
-
// Public interface
|
1684
|
-
const createHref = (location) => {
|
1685
|
-
return basename + createPath(location);
|
1686
|
-
};
|
1687
|
-
const push = (path, state) => {
|
1688
|
-
warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' +
|
1689
|
-
'argument is a location-like object that already has state; it is ignored');
|
1690
|
-
const action = 'PUSH';
|
1691
|
-
const location = createLocation(path, state, createKey(keyLength), history.location);
|
1692
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, (ok) => {
|
1693
|
-
if (!ok) {
|
1694
|
-
return;
|
1695
|
-
}
|
1696
|
-
const href = createHref(location);
|
1697
|
-
const { key, state } = location;
|
1698
|
-
if (canUseHistory) {
|
1699
|
-
globalHistory.pushState({ key, state }, '', href);
|
1700
|
-
if (forceRefresh) {
|
1701
|
-
globalLocation.href = href;
|
1702
|
-
}
|
1703
|
-
else {
|
1704
|
-
const prevIndex = allKeys.indexOf(history.location.key);
|
1705
|
-
const nextKeys = allKeys.slice(0, prevIndex === -1 ? 0 : prevIndex + 1);
|
1706
|
-
nextKeys.push(location.key);
|
1707
|
-
allKeys = nextKeys;
|
1708
|
-
setState({ action, location });
|
1709
|
-
}
|
1710
|
-
}
|
1711
|
-
else {
|
1712
|
-
warning(state === undefined, 'Browser history cannot push state in browsers that do not support HTML5 history');
|
1713
|
-
globalLocation.href = href;
|
1714
|
-
}
|
1715
|
-
});
|
1716
|
-
};
|
1717
|
-
const replace = (path, state) => {
|
1718
|
-
warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' +
|
1719
|
-
'argument is a location-like object that already has state; it is ignored');
|
1720
|
-
const action = 'REPLACE';
|
1721
|
-
const location = createLocation(path, state, createKey(keyLength), history.location);
|
1722
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, (ok) => {
|
1723
|
-
if (!ok) {
|
1724
|
-
return;
|
1725
|
-
}
|
1726
|
-
const href = createHref(location);
|
1727
|
-
const { key, state } = location;
|
1728
|
-
if (canUseHistory) {
|
1729
|
-
globalHistory.replaceState({ key, state }, '', href);
|
1730
|
-
if (forceRefresh) {
|
1731
|
-
globalLocation.replace(href);
|
1732
|
-
}
|
1733
|
-
else {
|
1734
|
-
const prevIndex = allKeys.indexOf(history.location.key);
|
1735
|
-
if (prevIndex !== -1) {
|
1736
|
-
allKeys[prevIndex] = location.key;
|
1737
|
-
}
|
1738
|
-
setState({ action, location });
|
1739
|
-
}
|
1740
|
-
}
|
1741
|
-
else {
|
1742
|
-
warning(state === undefined, 'Browser history cannot replace state in browsers that do not support HTML5 history');
|
1743
|
-
globalLocation.replace(href);
|
1744
|
-
}
|
1745
|
-
});
|
1746
|
-
};
|
1747
|
-
const go = (n) => {
|
1748
|
-
globalHistory.go(n);
|
1749
|
-
};
|
1750
|
-
const goBack = () => go(-1);
|
1751
|
-
const goForward = () => go(1);
|
1752
|
-
const checkDOMListeners = (delta) => {
|
1753
|
-
listenerCount += delta;
|
1754
|
-
if (listenerCount === 1) {
|
1755
|
-
win.addEventListener(PopStateEvent, handlePopState);
|
1756
|
-
if (needsHashChangeListener) {
|
1757
|
-
win.addEventListener(HashChangeEvent$1, handleHashChange);
|
1758
|
-
}
|
1759
|
-
}
|
1760
|
-
else if (listenerCount === 0) {
|
1761
|
-
win.removeEventListener(PopStateEvent, handlePopState);
|
1762
|
-
if (needsHashChangeListener) {
|
1763
|
-
win.removeEventListener(HashChangeEvent$1, handleHashChange);
|
1764
|
-
}
|
1765
|
-
}
|
1766
|
-
};
|
1767
|
-
const block = (prompt = '') => {
|
1768
|
-
const unblock = transitionManager.setPrompt(prompt);
|
1769
|
-
if (!isBlocked) {
|
1770
|
-
checkDOMListeners(1);
|
1771
|
-
isBlocked = true;
|
1772
|
-
}
|
1773
|
-
return () => {
|
1774
|
-
if (isBlocked) {
|
1775
|
-
isBlocked = false;
|
1776
|
-
checkDOMListeners(-1);
|
1777
|
-
}
|
1778
|
-
return unblock();
|
1779
|
-
};
|
1780
|
-
};
|
1781
|
-
const listen = (listener) => {
|
1782
|
-
const unlisten = transitionManager.appendListener(listener);
|
1783
|
-
checkDOMListeners(1);
|
1784
|
-
return () => {
|
1785
|
-
checkDOMListeners(-1);
|
1786
|
-
unlisten();
|
1787
|
-
};
|
1788
|
-
};
|
1789
|
-
const history = {
|
1790
|
-
length: globalHistory.length,
|
1791
|
-
action: 'POP',
|
1792
|
-
location: initialLocation,
|
1793
|
-
createHref,
|
1794
|
-
push,
|
1795
|
-
replace,
|
1796
|
-
go,
|
1797
|
-
goBack,
|
1798
|
-
goForward,
|
1799
|
-
block,
|
1800
|
-
listen,
|
1801
|
-
win: win
|
1802
|
-
};
|
1803
|
-
return history;
|
1804
|
-
};
|
1805
|
-
|
1806
|
-
// Adapted from the https://github.com/ReactTraining/history and converted to TypeScript
|
1807
|
-
const HashChangeEvent = 'hashchange';
|
1808
|
-
const HashPathCoders = {
|
1809
|
-
hashbang: {
|
1810
|
-
encodePath: (path) => path.charAt(0) === '!' ? path : '!/' + stripLeadingSlash(path),
|
1811
|
-
decodePath: (path) => path.charAt(0) === '!' ? path.substr(1) : path
|
1812
|
-
},
|
1813
|
-
noslash: {
|
1814
|
-
encodePath: stripLeadingSlash,
|
1815
|
-
decodePath: addLeadingSlash
|
1816
|
-
},
|
1817
|
-
slash: {
|
1818
|
-
encodePath: addLeadingSlash,
|
1819
|
-
decodePath: addLeadingSlash
|
1820
|
-
}
|
1821
|
-
};
|
1822
|
-
const createHashHistory = (win, props = {}) => {
|
1823
|
-
let forceNextPop = false;
|
1824
|
-
let ignorePath = null;
|
1825
|
-
let listenerCount = 0;
|
1826
|
-
let isBlocked = false;
|
1827
|
-
const globalLocation = win.location;
|
1828
|
-
const globalHistory = win.history;
|
1829
|
-
const canGoWithoutReload = supportsGoWithoutReloadUsingHash(win.navigator);
|
1830
|
-
const keyLength = (props.keyLength != null) ? props.keyLength : 6;
|
1831
|
-
const { getUserConfirmation = getConfirmation, hashType = 'slash' } = props;
|
1832
|
-
const basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : '';
|
1833
|
-
const { encodePath, decodePath } = HashPathCoders[hashType];
|
1834
|
-
const getHashPath = () => {
|
1835
|
-
// We can't use window.location.hash here because it's not
|
1836
|
-
// consistent across browsers - Firefox will pre-decode it!
|
1837
|
-
const href = globalLocation.href;
|
1838
|
-
const hashIndex = href.indexOf('#');
|
1839
|
-
return hashIndex === -1 ? '' : href.substring(hashIndex + 1);
|
1840
|
-
};
|
1841
|
-
const pushHashPath = (path) => (globalLocation.hash = path);
|
1842
|
-
const replaceHashPath = (path) => {
|
1843
|
-
const hashIndex = globalLocation.href.indexOf('#');
|
1844
|
-
globalLocation.replace(globalLocation.href.slice(0, hashIndex >= 0 ? hashIndex : 0) + '#' + path);
|
1845
|
-
};
|
1846
|
-
const getDOMLocation = () => {
|
1847
|
-
let path = decodePath(getHashPath());
|
1848
|
-
warning((!basename || hasBasename(path, basename)), 'You are attempting to use a basename on a page whose URL path does not begin ' +
|
1849
|
-
'with the basename. Expected path "' + path + '" to begin with "' + basename + '".');
|
1850
|
-
if (basename) {
|
1851
|
-
path = stripBasename(path, basename);
|
1852
|
-
}
|
1853
|
-
return createLocation(path, undefined, createKey(keyLength));
|
1854
|
-
};
|
1855
|
-
const transitionManager = createTransitionManager();
|
1856
|
-
const setState = (nextState) => {
|
1857
|
-
Object.assign(history, nextState);
|
1858
|
-
history.length = globalHistory.length;
|
1859
|
-
transitionManager.notifyListeners(history.location, history.action);
|
1860
|
-
};
|
1861
|
-
const handleHashChange = () => {
|
1862
|
-
const path = getHashPath();
|
1863
|
-
const encodedPath = encodePath(path);
|
1864
|
-
if (path !== encodedPath) {
|
1865
|
-
// Ensure we always have a properly-encoded hash.
|
1866
|
-
replaceHashPath(encodedPath);
|
1867
|
-
}
|
1868
|
-
else {
|
1869
|
-
const location = getDOMLocation();
|
1870
|
-
const prevLocation = history.location;
|
1871
|
-
if (!forceNextPop && locationsAreEqual(prevLocation, location)) {
|
1872
|
-
return; // A hashchange doesn't always == location change.
|
1873
|
-
}
|
1874
|
-
if (ignorePath === createPath(location)) {
|
1875
|
-
return; // Ignore this change; we already setState in push/replace.
|
1876
|
-
}
|
1877
|
-
ignorePath = null;
|
1878
|
-
handlePop(location);
|
1879
|
-
}
|
1880
|
-
};
|
1881
|
-
const handlePop = (location) => {
|
1882
|
-
if (forceNextPop) {
|
1883
|
-
forceNextPop = false;
|
1884
|
-
setState();
|
1885
|
-
}
|
1886
|
-
else {
|
1887
|
-
const action = 'POP';
|
1888
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, (ok) => {
|
1889
|
-
if (ok) {
|
1890
|
-
setState({ action, location });
|
1891
|
-
}
|
1892
|
-
else {
|
1893
|
-
revertPop(location);
|
1894
|
-
}
|
1895
|
-
});
|
1896
|
-
}
|
1897
|
-
};
|
1898
|
-
const revertPop = (fromLocation) => {
|
1899
|
-
const toLocation = history.location;
|
1900
|
-
// TODO: We could probably make this more reliable by
|
1901
|
-
// keeping a list of paths we've seen in sessionStorage.
|
1902
|
-
// Instead, we just default to 0 for paths we don't know.
|
1903
|
-
let toIndex = allPaths.lastIndexOf(createPath(toLocation));
|
1904
|
-
let fromIndex = allPaths.lastIndexOf(createPath(fromLocation));
|
1905
|
-
if (toIndex === -1) {
|
1906
|
-
toIndex = 0;
|
1907
|
-
}
|
1908
|
-
if (fromIndex === -1) {
|
1909
|
-
fromIndex = 0;
|
1910
|
-
}
|
1911
|
-
const delta = toIndex - fromIndex;
|
1912
|
-
if (delta) {
|
1913
|
-
forceNextPop = true;
|
1914
|
-
go(delta);
|
1915
|
-
}
|
1916
|
-
};
|
1917
|
-
// Ensure the hash is encoded properly before doing anything else.
|
1918
|
-
const path = getHashPath();
|
1919
|
-
const encodedPath = encodePath(path);
|
1920
|
-
if (path !== encodedPath) {
|
1921
|
-
replaceHashPath(encodedPath);
|
1922
|
-
}
|
1923
|
-
const initialLocation = getDOMLocation();
|
1924
|
-
let allPaths = [createPath(initialLocation)];
|
1925
|
-
// Public interface
|
1926
|
-
const createHref = (location) => ('#' + encodePath(basename + createPath(location)));
|
1927
|
-
const push = (path, state) => {
|
1928
|
-
warning(state === undefined, 'Hash history cannot push state; it is ignored');
|
1929
|
-
const action = 'PUSH';
|
1930
|
-
const location = createLocation(path, undefined, createKey(keyLength), history.location);
|
1931
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, (ok) => {
|
1932
|
-
if (!ok) {
|
1933
|
-
return;
|
1934
|
-
}
|
1935
|
-
const path = createPath(location);
|
1936
|
-
const encodedPath = encodePath(basename + path);
|
1937
|
-
const hashChanged = getHashPath() !== encodedPath;
|
1938
|
-
if (hashChanged) {
|
1939
|
-
// We cannot tell if a hashchange was caused by a PUSH, so we'd
|
1940
|
-
// rather setState here and ignore the hashchange. The caveat here
|
1941
|
-
// is that other hash histories in the page will consider it a POP.
|
1942
|
-
ignorePath = path;
|
1943
|
-
pushHashPath(encodedPath);
|
1944
|
-
const prevIndex = allPaths.lastIndexOf(createPath(history.location));
|
1945
|
-
const nextPaths = allPaths.slice(0, prevIndex === -1 ? 0 : prevIndex + 1);
|
1946
|
-
nextPaths.push(path);
|
1947
|
-
allPaths = nextPaths;
|
1948
|
-
setState({ action, location });
|
1949
|
-
}
|
1950
|
-
else {
|
1951
|
-
warning(false, 'Hash history cannot PUSH the same path; a new entry will not be added to the history stack');
|
1952
|
-
setState();
|
1953
|
-
}
|
1954
|
-
});
|
1955
|
-
};
|
1956
|
-
const replace = (path, state) => {
|
1957
|
-
warning(state === undefined, 'Hash history cannot replace state; it is ignored');
|
1958
|
-
const action = 'REPLACE';
|
1959
|
-
const location = createLocation(path, undefined, createKey(keyLength), history.location);
|
1960
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, (ok) => {
|
1961
|
-
if (!ok) {
|
1962
|
-
return;
|
1963
|
-
}
|
1964
|
-
const path = createPath(location);
|
1965
|
-
const encodedPath = encodePath(basename + path);
|
1966
|
-
const hashChanged = getHashPath() !== encodedPath;
|
1967
|
-
if (hashChanged) {
|
1968
|
-
// We cannot tell if a hashchange was caused by a REPLACE, so we'd
|
1969
|
-
// rather setState here and ignore the hashchange. The caveat here
|
1970
|
-
// is that other hash histories in the page will consider it a POP.
|
1971
|
-
ignorePath = path;
|
1972
|
-
replaceHashPath(encodedPath);
|
1973
|
-
}
|
1974
|
-
const prevIndex = allPaths.indexOf(createPath(history.location));
|
1975
|
-
if (prevIndex !== -1) {
|
1976
|
-
allPaths[prevIndex] = path;
|
1977
|
-
}
|
1978
|
-
setState({ action, location });
|
1979
|
-
});
|
1980
|
-
};
|
1981
|
-
const go = (n) => {
|
1982
|
-
warning(canGoWithoutReload, 'Hash history go(n) causes a full page reload in this browser');
|
1983
|
-
globalHistory.go(n);
|
1984
|
-
};
|
1985
|
-
const goBack = () => go(-1);
|
1986
|
-
const goForward = () => go(1);
|
1987
|
-
const checkDOMListeners = (win, delta) => {
|
1988
|
-
listenerCount += delta;
|
1989
|
-
if (listenerCount === 1) {
|
1990
|
-
win.addEventListener(HashChangeEvent, handleHashChange);
|
1991
|
-
}
|
1992
|
-
else if (listenerCount === 0) {
|
1993
|
-
win.removeEventListener(HashChangeEvent, handleHashChange);
|
1994
|
-
}
|
1995
|
-
};
|
1996
|
-
const block = (prompt = '') => {
|
1997
|
-
const unblock = transitionManager.setPrompt(prompt);
|
1998
|
-
if (!isBlocked) {
|
1999
|
-
checkDOMListeners(win, 1);
|
2000
|
-
isBlocked = true;
|
2001
|
-
}
|
2002
|
-
return () => {
|
2003
|
-
if (isBlocked) {
|
2004
|
-
isBlocked = false;
|
2005
|
-
checkDOMListeners(win, -1);
|
2006
|
-
}
|
2007
|
-
return unblock();
|
2008
|
-
};
|
2009
|
-
};
|
2010
|
-
const listen = (listener) => {
|
2011
|
-
const unlisten = transitionManager.appendListener(listener);
|
2012
|
-
checkDOMListeners(win, 1);
|
2013
|
-
return () => {
|
2014
|
-
checkDOMListeners(win, -1);
|
2015
|
-
unlisten();
|
2016
|
-
};
|
2017
|
-
};
|
2018
|
-
const history = {
|
2019
|
-
length: globalHistory.length,
|
2020
|
-
action: 'POP',
|
2021
|
-
location: initialLocation,
|
2022
|
-
createHref,
|
2023
|
-
push,
|
2024
|
-
replace,
|
2025
|
-
go,
|
2026
|
-
goBack,
|
2027
|
-
goForward,
|
2028
|
-
block,
|
2029
|
-
listen,
|
2030
|
-
win: win
|
2031
|
-
};
|
2032
|
-
return history;
|
2033
|
-
};
|
2034
|
-
|
2035
|
-
const getLocation = (location, root) => {
|
2036
|
-
// Remove the root URL if found at beginning of string
|
2037
|
-
const pathname = location.pathname.indexOf(root) == 0 ?
|
2038
|
-
'/' + location.pathname.slice(root.length) :
|
2039
|
-
location.pathname;
|
2040
|
-
return Object.assign({}, location, { pathname });
|
2041
|
-
};
|
2042
|
-
const HISTORIES = {
|
2043
|
-
'browser': createBrowserHistory,
|
2044
|
-
'hash': createHashHistory
|
2045
|
-
};
|
2046
|
-
const Router = class {
|
2047
|
-
constructor(hostRef) {
|
2048
|
-
registerInstance(this, hostRef);
|
2049
|
-
this.root = '/';
|
2050
|
-
this.historyType = 'browser';
|
2051
|
-
// A suffix to append to the page title whenever
|
2052
|
-
// it's updated through RouteTitle
|
2053
|
-
this.titleSuffix = '';
|
2054
|
-
this.routeViewsUpdated = (options = {}) => {
|
2055
|
-
if (this.history && options.scrollToId && this.historyType === 'browser') {
|
2056
|
-
const elm = this.history.win.document.getElementById(options.scrollToId);
|
2057
|
-
if (elm) {
|
2058
|
-
return elm.scrollIntoView();
|
2059
|
-
}
|
2060
|
-
}
|
2061
|
-
this.scrollTo(options.scrollTopOffset || this.scrollTopOffset);
|
2062
|
-
};
|
2063
|
-
this.isServer = getContext(this, "isServer");
|
2064
|
-
this.queue = getContext(this, "queue");
|
2065
|
-
}
|
2066
|
-
componentWillLoad() {
|
2067
|
-
this.history = HISTORIES[this.historyType](this.el.ownerDocument.defaultView);
|
2068
|
-
this.history.listen((location) => {
|
2069
|
-
location = getLocation(location, this.root);
|
2070
|
-
this.location = location;
|
2071
|
-
});
|
2072
|
-
this.location = getLocation(this.history.location, this.root);
|
2073
|
-
}
|
2074
|
-
scrollTo(scrollToLocation) {
|
2075
|
-
const history = this.history;
|
2076
|
-
if (scrollToLocation == null || this.isServer || !history) {
|
2077
|
-
return;
|
2078
|
-
}
|
2079
|
-
if (history.action === 'POP' && Array.isArray(history.location.scrollPosition)) {
|
2080
|
-
return this.queue.write(() => {
|
2081
|
-
if (history && history.location && Array.isArray(history.location.scrollPosition)) {
|
2082
|
-
history.win.scrollTo(history.location.scrollPosition[0], history.location.scrollPosition[1]);
|
2083
|
-
}
|
2084
|
-
});
|
2085
|
-
}
|
2086
|
-
// okay, the frame has passed. Go ahead and render now
|
2087
|
-
return this.queue.write(() => {
|
2088
|
-
history.win.scrollTo(0, scrollToLocation);
|
2089
|
-
});
|
2090
|
-
}
|
2091
|
-
render() {
|
2092
|
-
if (!this.location || !this.history) {
|
2093
|
-
return;
|
2094
|
-
}
|
2095
|
-
const state = {
|
2096
|
-
historyType: this.historyType,
|
2097
|
-
location: this.location,
|
2098
|
-
titleSuffix: this.titleSuffix,
|
2099
|
-
root: this.root,
|
2100
|
-
history: this.history,
|
2101
|
-
routeViewsUpdated: this.routeViewsUpdated
|
2102
|
-
};
|
2103
|
-
return (h(ActiveRouter.Provider, { state: state }, h("slot", null)));
|
2104
|
-
}
|
2105
|
-
get el() { return getElement(this); }
|
2106
|
-
};
|
2107
|
-
|
2108
|
-
export { SparkleFacilitatorHeader as sparkle_facilitator_header, FacilitatorPage as sparkle_facilitator_page, SparkleForgotPassword as sparkle_forgot_password, SparkleGoals as sparkle_goals, SparkleGww as sparkle_gww, SparkleHeader as sparkle_header, SparkleHealth as sparkle_health, PageLogin as sparkle_login, SparkleMenu as sparkle_menu, SparkleMood as sparkle_mood, SparklePage as sparkle_page, SparkleResetPassword as sparkle_reset_password, SparkleRoot as sparkle_root, SparkleSignup as sparkle_signup, SparkleUnauthorized as sparkle_unauthorized, SparkleUserEnrollment as sparkle_user_enrollment, SparkleUserProfile as sparkle_user_profile, Route as stencil_route, Router as stencil_router };
|