@cuemath/leap 3.3.28-af → 3.3.28
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/assets/lottie/lottie.js +2 -2
- package/dist/assets/lottie/lottie.js.map +1 -1
- package/dist/features/auth/account-selector/account-selector-styled.js +6 -5
- package/dist/features/auth/account-selector/account-selector-styled.js.map +1 -1
- package/dist/features/auth/account-selector/account-selector.js +52 -58
- package/dist/features/auth/account-selector/account-selector.js.map +1 -1
- package/dist/features/auth/account-selector/comps/compact-header/account-selector-header.js +31 -0
- package/dist/features/auth/account-selector/comps/compact-header/account-selector-header.js.map +1 -0
- package/dist/features/auth/comps/auth-page-layout/auth-page-layout-styled.js +1 -1
- package/dist/features/auth/comps/auth-page-layout/auth-page-layout-styled.js.map +1 -1
- package/dist/features/auth/comps/auth-page-layout/auth-page-layout.js +6 -6
- package/dist/features/auth/comps/auth-page-layout/auth-page-layout.js.map +1 -1
- package/dist/features/auth/comps/pill-button/pill-button.js +19 -19
- package/dist/features/auth/comps/pill-button/pill-button.js.map +1 -1
- package/dist/features/auth/comps/user-list/user-list-styled.js +3 -2
- package/dist/features/auth/comps/user-list/user-list-styled.js.map +1 -1
- package/dist/features/auth/pla-signup/pla-analytics-events.js +5 -4
- package/dist/features/auth/pla-signup/pla-analytics-events.js.map +1 -1
- package/dist/features/auth/pla-signup/signup-header/signup-header.js +1 -1
- package/dist/features/auth/pla-signup/signup-header/signup-header.js.map +1 -1
- package/dist/features/auth/signup/circular-step-wrapper/circular-step-wrapper.js +24 -24
- package/dist/features/auth/signup/circular-step-wrapper/circular-step-wrapper.js.map +1 -1
- package/dist/features/auth/signup-unavailable/signup-unavailable-styled.js +16 -0
- package/dist/features/auth/signup-unavailable/signup-unavailable-styled.js.map +1 -0
- package/dist/features/auth/signup-unavailable/signup-unavailable-view.js +62 -0
- package/dist/features/auth/signup-unavailable/signup-unavailable-view.js.map +1 -0
- package/dist/features/auth/signup-unavailable/signup-unavailable.js +17 -0
- package/dist/features/auth/signup-unavailable/signup-unavailable.js.map +1 -0
- package/dist/features/circle-games/game-launcher/api/get-content-for-today/get-circle-home-api.js +6 -6
- package/dist/features/circle-games/game-launcher/api/get-content-for-today/get-circle-home-api.js.map +1 -1
- package/dist/features/circle-games/game-launcher/dal/use-get-circle-home-details-dal/use-get-circle-home-details-dal.js +20 -21
- package/dist/features/circle-games/game-launcher/dal/use-get-circle-home-details-dal/use-get-circle-home-details-dal.js.map +1 -1
- package/dist/features/circle-games/games/web-view/web-view-types.js.map +1 -1
- package/dist/features/circle-games/hooks/use-circle-sounds/constants.js +7 -5
- package/dist/features/circle-games/hooks/use-circle-sounds/constants.js.map +1 -1
- package/dist/features/circle-games/hooks/use-circle-sounds/helper.js +19 -0
- package/dist/features/circle-games/hooks/use-circle-sounds/helper.js.map +1 -0
- package/dist/features/circle-games/hooks/use-circle-sounds/use-circle-sounds.js +104 -101
- package/dist/features/circle-games/hooks/use-circle-sounds/use-circle-sounds.js.map +1 -1
- package/dist/features/circle-games/sign-up/api/use-update-username-api/use-update-username-api.js +9 -0
- package/dist/features/circle-games/sign-up/api/use-update-username-api/use-update-username-api.js.map +1 -0
- package/dist/features/circle-games/sign-up/comp/circular-steps/circular-steps.js +12 -12
- package/dist/features/circle-games/sign-up/comp/circular-steps/circular-steps.js.map +1 -1
- package/dist/features/circle-games/sign-up/dal/update-username-dal/update-username-dal.js +38 -0
- package/dist/features/circle-games/sign-up/dal/update-username-dal/update-username-dal.js.map +1 -0
- package/dist/features/circle-games/sign-up/sign-up-types.js.map +1 -1
- package/dist/features/circle-games/sign-up/sign-up.js +156 -128
- package/dist/features/circle-games/sign-up/sign-up.js.map +1 -1
- package/dist/features/journey/hooks/use-puzzles-journey/use-puzzle-dashboard-journey.js +23 -29
- package/dist/features/journey/hooks/use-puzzles-journey/use-puzzle-dashboard-journey.js.map +1 -1
- package/dist/features/journey/journey-id/journey-id-student.js +1 -1
- package/dist/features/journey/journey-id/journey-id-student.js.map +1 -1
- package/dist/features/journey/use-journey/constants.js +18 -2
- package/dist/features/journey/use-journey/constants.js.map +1 -1
- package/dist/features/journey/use-journey/use-journey.js +10 -7
- package/dist/features/journey/use-journey/use-journey.js.map +1 -1
- package/dist/features/milestone/create/comps/add-custom-chapter/add-custom-chapter.js +42 -40
- package/dist/features/milestone/create/comps/add-custom-chapter/add-custom-chapter.js.map +1 -1
- package/dist/features/milestone/create/comps/add-custom-chapter/course-catalog.js +70 -64
- package/dist/features/milestone/create/comps/add-custom-chapter/course-catalog.js.map +1 -1
- package/dist/features/milestone/create/comps/add-custom-chapter/hooks/use-catalog-helpers.js +54 -29
- package/dist/features/milestone/create/comps/add-custom-chapter/hooks/use-catalog-helpers.js.map +1 -1
- package/dist/features/milestone/create/comps/chapters-selection-step/chapter-selection-step-v2/chapter-category/chapter-category-container.js +48 -28
- package/dist/features/milestone/create/comps/chapters-selection-step/chapter-selection-step-v2/chapter-category/chapter-category-container.js.map +1 -1
- package/dist/features/milestone/create/comps/chapters-selection-step/chapters-selection-step.js +79 -76
- package/dist/features/milestone/create/comps/chapters-selection-step/chapters-selection-step.js.map +1 -1
- package/dist/features/milestone/create/comps/chapters-selection-step/utils.js +97 -94
- package/dist/features/milestone/create/comps/chapters-selection-step/utils.js.map +1 -1
- package/dist/features/milestone/create/comps/class-details-step/class-details-step.js +160 -143
- package/dist/features/milestone/create/comps/class-details-step/class-details-step.js.map +1 -1
- package/dist/features/milestone/create/comps/class-details-step/class-details-utils.js +22 -12
- package/dist/features/milestone/create/comps/class-details-step/class-details-utils.js.map +1 -1
- package/dist/features/milestone/create/comps/test-type-step/test-type-step.js +64 -59
- package/dist/features/milestone/create/comps/test-type-step/test-type-step.js.map +1 -1
- package/dist/features/milestone/create/milestone-create-container.js +17 -15
- package/dist/features/milestone/create/milestone-create-container.js.map +1 -1
- package/dist/features/milestone/create/milestone-create-helpers.js +170 -153
- package/dist/features/milestone/create/milestone-create-helpers.js.map +1 -1
- package/dist/features/milestone/create/milestone-create-styled.js +1 -1
- package/dist/features/milestone/create/milestone-create-styled.js.map +1 -1
- package/dist/features/milestone/create/milestone-create.js +19 -17
- package/dist/features/milestone/create/milestone-create.js.map +1 -1
- package/dist/features/parent-dashboard/api/get-student-profile-summary.js +9 -0
- package/dist/features/parent-dashboard/api/get-student-profile-summary.js.map +1 -0
- package/dist/features/parent-dashboard/comps/compact-header/compact-header.js +16 -16
- package/dist/features/parent-dashboard/comps/compact-header/compact-header.js.map +1 -1
- package/dist/features/parent-dashboard/comps/parent-dashboard-faqs/parent-dashboard-faqs-constants.js +29 -13
- package/dist/features/parent-dashboard/comps/parent-dashboard-faqs/parent-dashboard-faqs-constants.js.map +1 -1
- package/dist/features/parent-dashboard/comps/pla-first-session-introduction/pla-first-session-introduction-styled.js +10 -0
- package/dist/features/parent-dashboard/comps/pla-first-session-introduction/pla-first-session-introduction-styled.js.map +1 -0
- package/dist/features/parent-dashboard/comps/pla-first-session-introduction/pla-first-session-introduction.js +44 -0
- package/dist/features/parent-dashboard/comps/pla-first-session-introduction/pla-first-session-introduction.js.map +1 -0
- package/dist/features/parent-dashboard/hooks/use-fetch-parent-home.js +28 -0
- package/dist/features/parent-dashboard/hooks/use-fetch-parent-home.js.map +1 -0
- package/dist/features/parent-dashboard/hooks/use-parent-home-data.js +34 -44
- package/dist/features/parent-dashboard/hooks/use-parent-home-data.js.map +1 -1
- package/dist/features/parent-dashboard/hooks/use-student-profile-summary-data.js +24 -0
- package/dist/features/parent-dashboard/hooks/use-student-profile-summary-data.js.map +1 -0
- package/dist/features/parent-dashboard/hooks/use-switch-user-journey.js +71 -0
- package/dist/features/parent-dashboard/hooks/use-switch-user-journey.js.map +1 -0
- package/dist/features/parent-dashboard/modals/help-and-support/help-and-support.js +40 -0
- package/dist/features/parent-dashboard/modals/help-and-support/help-and-support.js.map +1 -0
- package/dist/features/parent-dashboard/modals/student-login-info/student-login-info.js +44 -0
- package/dist/features/parent-dashboard/modals/student-login-info/student-login-info.js.map +1 -0
- package/dist/features/parent-dashboard/modals/student-profile-summary/student-profile-summary-helpers.js +32 -0
- package/dist/features/parent-dashboard/modals/student-profile-summary/student-profile-summary-helpers.js.map +1 -0
- package/dist/features/parent-dashboard/modals/student-profile-summary/student-profile-summary-styled.js +12 -0
- package/dist/features/parent-dashboard/modals/student-profile-summary/student-profile-summary-styled.js.map +1 -0
- package/dist/features/parent-dashboard/modals/student-profile-summary/student-profile-summary.js +44 -0
- package/dist/features/parent-dashboard/modals/student-profile-summary/student-profile-summary.js.map +1 -0
- package/dist/features/parent-dashboard/modals/trial-report/trial-report-styled.js +13 -0
- package/dist/features/parent-dashboard/modals/trial-report/trial-report-styled.js.map +1 -0
- package/dist/features/parent-dashboard/modals/trial-report/trial-report.js +28 -0
- package/dist/features/parent-dashboard/modals/trial-report/trial-report.js.map +1 -0
- package/dist/features/parent-dashboard/modals/tutor-change/tutor-change-constants.js +43 -0
- package/dist/features/parent-dashboard/modals/tutor-change/tutor-change-constants.js.map +1 -0
- package/dist/features/parent-dashboard/modals/tutor-change/tutor-change-styled.js +61 -0
- package/dist/features/parent-dashboard/modals/tutor-change/tutor-change-styled.js.map +1 -0
- package/dist/features/parent-dashboard/modals/tutor-change/tutor-change.js +86 -0
- package/dist/features/parent-dashboard/modals/tutor-change/tutor-change.js.map +1 -0
- package/dist/features/parent-dashboard/parent-dashboard-styled.js +2 -2
- package/dist/features/parent-dashboard/parent-dashboard-styled.js.map +1 -1
- package/dist/features/parent-dashboard/parent-dashboard-types.js +3 -2
- package/dist/features/parent-dashboard/parent-dashboard-types.js.map +1 -1
- package/dist/features/parent-dashboard/parent-dashboard-view.js +143 -131
- package/dist/features/parent-dashboard/parent-dashboard-view.js.map +1 -1
- package/dist/features/sentry/constants/ignored.js +10 -6
- package/dist/features/sentry/constants/ignored.js.map +1 -1
- package/dist/features/stickers/constants.js +235 -0
- package/dist/features/stickers/constants.js.map +1 -0
- package/dist/features/{ui/sticker-grid/sticker-grid-styles.js → stickers/sticker-selector/comps/sticker/sticker-styled.js} +15 -45
- package/dist/features/stickers/sticker-selector/comps/sticker/sticker-styled.js.map +1 -0
- package/dist/features/stickers/sticker-selector/comps/sticker/sticker.js +49 -0
- package/dist/features/stickers/sticker-selector/comps/sticker/sticker.js.map +1 -0
- package/dist/features/stickers/sticker-selector/comps/stiker-selector-grid/sticker-selector-grid-styled.js +28 -0
- package/dist/features/stickers/sticker-selector/comps/stiker-selector-grid/sticker-selector-grid-styled.js.map +1 -0
- package/dist/features/stickers/sticker-selector/comps/stiker-selector-grid/sticker-selector-grid.js +26 -0
- package/dist/features/stickers/sticker-selector/comps/stiker-selector-grid/sticker-selector-grid.js.map +1 -0
- package/dist/features/stickers/sticker-selector/sticker-selector-styled.js +13 -0
- package/dist/features/stickers/sticker-selector/sticker-selector-styled.js.map +1 -0
- package/dist/features/stickers/sticker-selector/sticker-selector.js +86 -0
- package/dist/features/stickers/sticker-selector/sticker-selector.js.map +1 -0
- package/dist/features/stickers/stickers-effects/stickers-effects-animations.js +82 -0
- package/dist/features/stickers/stickers-effects/stickers-effects-animations.js.map +1 -0
- package/dist/features/stickers/stickers-effects/stickers-effects-cache.js +19 -0
- package/dist/features/stickers/stickers-effects/stickers-effects-cache.js.map +1 -0
- package/dist/features/stickers/stickers-effects/stickers-effects-helper.js +105 -0
- package/dist/features/stickers/stickers-effects/stickers-effects-helper.js.map +1 -0
- package/dist/features/stickers/stickers-effects/stickers-effects-styled.js +37 -0
- package/dist/features/stickers/stickers-effects/stickers-effects-styled.js.map +1 -0
- package/dist/features/stickers/stickers-effects/stickers-effects.js +67 -0
- package/dist/features/stickers/stickers-effects/stickers-effects.js.map +1 -0
- package/dist/features/trial-session/comps/pla/session-summary/session-summary-constants.js +8 -7
- package/dist/features/trial-session/comps/pla/session-summary/session-summary-constants.js.map +1 -1
- package/dist/features/trial-session/comps/pla/session-summary/session-summary.js +27 -26
- package/dist/features/trial-session/comps/pla/session-summary/session-summary.js.map +1 -1
- package/dist/features/trial-session/comps/pla/session-summary/summary-card/summary-card.js +16 -16
- package/dist/features/trial-session/comps/pla/session-summary/summary-card/summary-card.js.map +1 -1
- package/dist/features/trial-session/comps/pla/upcoming-sessions/upcoming-sessions.js +40 -35
- package/dist/features/trial-session/comps/pla/upcoming-sessions/upcoming-sessions.js.map +1 -1
- package/dist/features/trial-session/comps/school-goals/school-goals.js +25 -24
- package/dist/features/trial-session/comps/school-goals/school-goals.js.map +1 -1
- package/dist/features/trial-session/comps/session-report/report-information/report-information-styled.js +15 -13
- package/dist/features/trial-session/comps/session-report/report-information/report-information-styled.js.map +1 -1
- package/dist/features/trial-session/comps/session-report/report-information/report-information.js +1 -1
- package/dist/features/trial-session/comps/session-report/report-information/report-information.js.map +1 -1
- package/dist/features/trial-session/comps/trial-circle-game/trial-circle-game.js +60 -61
- package/dist/features/trial-session/comps/trial-circle-game/trial-circle-game.js.map +1 -1
- package/dist/features/trial-session/comps/worksheet/worksheet.js +23 -23
- package/dist/features/trial-session/comps/worksheet/worksheet.js.map +1 -1
- package/dist/features/trial-session/trial-session-types.js.map +1 -1
- package/dist/features/trial-session/trial-session-view.js +71 -73
- package/dist/features/trial-session/trial-session-view.js.map +1 -1
- package/dist/features/ui/dot-lottie-animations/dot-lottie-animation.js +88 -75
- package/dist/features/ui/dot-lottie-animations/dot-lottie-animation.js.map +1 -1
- package/dist/features/ui/lottie-animation/lottie-animation.js +55 -46
- package/dist/features/ui/lottie-animation/lottie-animation.js.map +1 -1
- package/dist/features/ui/modals/modal-styled.js +48 -15
- package/dist/features/ui/modals/modal-styled.js.map +1 -1
- package/dist/features/ui/modals/modal.js +46 -38
- package/dist/features/ui/modals/modal.js.map +1 -1
- package/dist/index.d.ts +223 -67
- package/dist/index.js +515 -493
- package/dist/index.js.map +1 -1
- package/dist/static/error.dd744fa5.json +1 -0
- package/dist/static/username.2c755605.json +1 -0
- package/package.json +1 -1
- package/dist/features/ui/sticker-grid/sticker-grid-styles.js.map +0 -1
- package/dist/features/ui/sticker-grid/sticker-grid.js +0 -24
- package/dist/features/ui/sticker-grid/sticker-grid.js.map +0 -1
- package/dist/features/ui/sticker-grid/sticker.js +0 -57
- package/dist/features/ui/sticker-grid/sticker.js.map +0 -1
- package/dist/features/ui/stickers/constants.js +0 -6
- package/dist/features/ui/stickers/constants.js.map +0 -1
- package/dist/features/ui/stickers/stickers-effects.js +0 -64
- package/dist/features/ui/stickers/stickers-effects.js.map +0 -1
- package/dist/features/ui/stickers/stickers-styled.js +0 -29
- package/dist/features/ui/stickers/stickers-styled.js.map +0 -1
- package/dist/features/ui/stickers/stickers-utils.js +0 -91
- package/dist/features/ui/stickers/stickers-utils.js.map +0 -1
- package/dist/features/ui/stickers/stickers.js +0 -40
- package/dist/features/ui/stickers/stickers.js.map +0 -1
- package/dist/static/error.cbe1ddde.json +0 -1
- package/dist/static/username.9e034d51.json +0 -1
|
@@ -1,110 +1,113 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useAutoPlayPermission as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
[
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
23
|
-
[
|
|
24
|
-
[
|
|
25
|
-
[
|
|
26
|
-
[
|
|
27
|
-
[
|
|
28
|
-
[
|
|
29
|
-
[
|
|
30
|
-
[
|
|
31
|
-
[
|
|
32
|
-
[
|
|
33
|
-
[
|
|
34
|
-
[
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (o.state === "suspended")
|
|
42
|
-
try {
|
|
43
|
-
await o.resume();
|
|
44
|
-
} catch (r) {
|
|
45
|
-
console.warn("Failed to resume AudioContext:", r);
|
|
1
|
+
import { useCallback as s, useRef as R, useEffect as m } from "react";
|
|
2
|
+
import { useAutoPlayPermission as P } from "../../../hooks/use-auto-play-permission/use-auto-play-permission.js";
|
|
3
|
+
import { CircleSoundKeyMapper as U, SWIPE_SOUND_ORDER as O } from "./constants.js";
|
|
4
|
+
import { fadeInSound as p, fadeOutSound as D } from "./helper.js";
|
|
5
|
+
import { CircleSoundKey as n } from "./use-circle-sounds-enums.js";
|
|
6
|
+
let S = 0;
|
|
7
|
+
const c = {
|
|
8
|
+
[n.BACKGROUND]: null,
|
|
9
|
+
[n.BACKGROUND_RUSHHOUR]: null,
|
|
10
|
+
[n.TUTORIAL]: null,
|
|
11
|
+
[n.SWIPE_01]: null,
|
|
12
|
+
[n.SWIPE_02]: null,
|
|
13
|
+
[n.SWIPE_03]: null,
|
|
14
|
+
[n.SWIPE_04]: null,
|
|
15
|
+
[n.SWIPE_DOWN]: null,
|
|
16
|
+
[n.TOGGLE]: null,
|
|
17
|
+
[n.POINTS_AWARDED]: null,
|
|
18
|
+
[n.POINTS_ADDED]: null,
|
|
19
|
+
[n.GAME_CARD_CLICK]: null,
|
|
20
|
+
[n.CLOCK_IN]: null,
|
|
21
|
+
[n.CLOCK_OUT]: null,
|
|
22
|
+
[n.ACCURACY_IN]: null,
|
|
23
|
+
[n.ACCURACY_OUT]: null,
|
|
24
|
+
[n.STREAK_IN]: null,
|
|
25
|
+
[n.STREAK_OUT]: null,
|
|
26
|
+
[n.ACCURACY_INTRO]: null,
|
|
27
|
+
[n.ACCURACY_TARGET]: null,
|
|
28
|
+
[n.TIME_INTRO]: null,
|
|
29
|
+
[n.TIME_TARGET]: null,
|
|
30
|
+
[n.METER_FILL]: null,
|
|
31
|
+
[n.YOUR_SCORE]: null,
|
|
32
|
+
[n.HIGH_SCORE]: null,
|
|
33
|
+
[n.KEEP_IT_UP]: null,
|
|
34
|
+
[n.DOING_GREAT]: null,
|
|
35
|
+
[n.ALL_DONE]: null
|
|
36
|
+
}, f = {}, b = () => {
|
|
37
|
+
const { canAutoPlayAudio: _ } = P(), C = s((t) => {
|
|
38
|
+
if (!c[t]) {
|
|
39
|
+
const l = new Audio(U[t]);
|
|
40
|
+
c[t] = l;
|
|
46
41
|
}
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const t = R[n];
|
|
61
|
-
if (!t || !r) return;
|
|
62
|
-
const c = o.createBufferSource(), E = o.createGain();
|
|
63
|
-
if (c.buffer = t, c.loop = l, c.connect(E).connect(o.destination), u ? E.gain.setValueAtTime(1, o.currentTime) : A(E), c.start(), l) {
|
|
64
|
-
const _ = i[n];
|
|
65
|
-
_ && (_.source.stop(), delete i[n]), i[n] = { source: c, gainNode: E }, c.onended = () => {
|
|
66
|
-
var S;
|
|
67
|
-
((S = i[n]) == null ? void 0 : S.source) === c && delete i[n];
|
|
68
|
-
};
|
|
42
|
+
}, []), i = R(/* @__PURE__ */ new Set()), o = R({}), r = s(
|
|
43
|
+
(t, l = !0, e = !1) => {
|
|
44
|
+
C(t);
|
|
45
|
+
const u = c[t];
|
|
46
|
+
if (!u || !_) return;
|
|
47
|
+
if (e && (u.loop = e), o.current[t] && clearInterval(o.current[t]), !u.paused && u.currentTime > 0 && !u.ended) {
|
|
48
|
+
if (l)
|
|
49
|
+
u.volume = 1;
|
|
50
|
+
else {
|
|
51
|
+
const I = p(u);
|
|
52
|
+
o.current[t] = I;
|
|
53
|
+
}
|
|
54
|
+
return u;
|
|
69
55
|
}
|
|
56
|
+
u.volume = l ? 1 : 0;
|
|
57
|
+
const A = u.play();
|
|
58
|
+
if (A && (f[t] = A), !l) {
|
|
59
|
+
const I = p(u);
|
|
60
|
+
o.current[t] = I;
|
|
61
|
+
}
|
|
62
|
+
return u;
|
|
70
63
|
},
|
|
71
|
-
[
|
|
72
|
-
),
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
64
|
+
[C, _]
|
|
65
|
+
), a = s((t, l) => {
|
|
66
|
+
const e = c[t];
|
|
67
|
+
if (!e) return;
|
|
68
|
+
if (o.current[t] && clearInterval(o.current[t]), l) {
|
|
69
|
+
e.pause();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const u = D(e);
|
|
73
|
+
o.current[t] = u;
|
|
74
|
+
}, []), d = s(
|
|
75
|
+
(t, l = !0) => {
|
|
76
|
+
var e;
|
|
77
|
+
if (f[t] !== void 0) {
|
|
78
|
+
(e = f[t]) == null || e.then(() => {
|
|
79
|
+
a(t, l);
|
|
80
|
+
}).catch((u) => {
|
|
81
|
+
console.log("sound not playing", u);
|
|
82
|
+
});
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
a(t, l);
|
|
86
|
+
},
|
|
87
|
+
[a]
|
|
88
|
+
), T = s(() => {
|
|
89
|
+
const t = O[S] || n.SWIPE_01;
|
|
90
|
+
S = (S + 1) % O.length, r(t);
|
|
91
|
+
}, [r]), v = s(() => r(n.TOGGLE), [r]), E = s(() => {
|
|
92
|
+
const t = document.visibilityState;
|
|
93
|
+
t === "hidden" && Object.entries(c).forEach(([l, e]) => {
|
|
94
|
+
e && !e.paused && (d(l, !0), i.current.add(l));
|
|
95
|
+
}), t === "visible" && (i.current.forEach((l) => {
|
|
96
|
+
r(l);
|
|
97
|
+
}), i.current.clear());
|
|
98
|
+
}, [r, d]);
|
|
99
|
+
return m(() => {
|
|
100
|
+
document.addEventListener("visibilitychange", E);
|
|
101
|
+
const t = o.current;
|
|
95
102
|
return () => {
|
|
96
|
-
document.removeEventListener("visibilitychange",
|
|
97
|
-
|
|
98
|
-
})
|
|
103
|
+
document.removeEventListener("visibilitychange", E), Object.values(t).forEach((l) => {
|
|
104
|
+
l && clearInterval(l);
|
|
105
|
+
});
|
|
99
106
|
};
|
|
100
|
-
}, [
|
|
101
|
-
playSwipeSound: P,
|
|
102
|
-
play: s,
|
|
103
|
-
stop: T,
|
|
104
|
-
playButtonSound: U
|
|
105
|
-
};
|
|
107
|
+
}, [E]), { playSwipeSound: T, play: r, stop: d, playButtonSound: v };
|
|
106
108
|
};
|
|
107
109
|
export {
|
|
108
|
-
|
|
110
|
+
c as soundMapper,
|
|
111
|
+
b as useCircleSounds
|
|
109
112
|
};
|
|
110
113
|
//# sourceMappingURL=use-circle-sounds.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-circle-sounds.js","sources":["../../../../../src/features/circle-games/hooks/use-circle-sounds/use-circle-sounds.ts"],"sourcesContent":["import type { TimeoutMap } from './use-circle-sound-types';\n\nimport { useCallback, useEffect, useRef } from 'react';\n\nimport { useAutoPlayPermission } from '../../../hooks/use-auto-play-permission/use-auto-play-permission';\nimport { CircleSoundKeyMapper, SWIPE_SOUND_ORDER } from './constants';\nimport { CircleSoundKey } from './use-circle-sounds-enums';\n\nlet swipeSoundIndex = 0;\nconst audioContext = new (window.AudioContext || window.webkitAudioContext)();\n\nconst bufferMapper: Record<CircleSoundKey, AudioBuffer | null> = {\n [CircleSoundKey.BACKGROUND]: null,\n [CircleSoundKey.BACKGROUND_RUSHHOUR]: null,\n [CircleSoundKey.TUTORIAL]: null,\n [CircleSoundKey.SWIPE_01]: null,\n [CircleSoundKey.SWIPE_02]: null,\n [CircleSoundKey.SWIPE_03]: null,\n [CircleSoundKey.SWIPE_04]: null,\n [CircleSoundKey.SWIPE_DOWN]: null,\n [CircleSoundKey.TOGGLE]: null,\n [CircleSoundKey.POINTS_AWARDED]: null,\n [CircleSoundKey.POINTS_ADDED]: null,\n [CircleSoundKey.GAME_CARD_CLICK]: null,\n [CircleSoundKey.CLOCK_IN]: null,\n [CircleSoundKey.CLOCK_OUT]: null,\n [CircleSoundKey.ACCURACY_IN]: null,\n [CircleSoundKey.ACCURACY_OUT]: null,\n [CircleSoundKey.STREAK_IN]: null,\n [CircleSoundKey.STREAK_OUT]: null,\n [CircleSoundKey.ACCURACY_INTRO]: null,\n [CircleSoundKey.ACCURACY_TARGET]: null,\n [CircleSoundKey.TIME_INTRO]: null,\n [CircleSoundKey.TIME_TARGET]: null,\n [CircleSoundKey.METER_FILL]: null,\n [CircleSoundKey.YOUR_SCORE]: null,\n [CircleSoundKey.HIGH_SCORE]: null,\n [CircleSoundKey.KEEP_IT_UP]: null,\n [CircleSoundKey.DOING_GREAT]: null,\n [CircleSoundKey.ALL_DONE]: null,\n};\n\ntype ActiveSound = {\n source: AudioBufferSourceNode;\n gainNode: GainNode;\n};\n\nconst activeSounds: Partial<Record<CircleSoundKey, ActiveSound>> = {};\n\nconst loadSound = async (key: CircleSoundKey) => {\n if (!bufferMapper[key]) {\n const response = await fetch(CircleSoundKeyMapper[key]);\n const arrayBuffer = await response.arrayBuffer();\n const decoded = await audioContext.decodeAudioData(arrayBuffer);\n\n bufferMapper[key] = decoded;\n }\n};\n\nconst resumeAudioContext = async () => {\n if (audioContext.state === 'suspended') {\n try {\n await audioContext.resume();\n } catch (err) {\n // eslint-disable-next-line no-console\n console.warn('Failed to resume AudioContext:', err);\n }\n }\n};\n\nexport const useCircleSounds = () => {\n const { canAutoPlayAudio: canPlayAudio } = useAutoPlayPermission();\n\n const pausedSoundsRef = useRef<Set<CircleSoundKey>>(new Set());\n const timeoutRefs = useRef<TimeoutMap>({});\n\n const fadeIn = (gainNode: GainNode) => {\n gainNode.gain.setValueAtTime(0, audioContext.currentTime);\n gainNode.gain.linearRampToValueAtTime(1, audioContext.currentTime + 0.5);\n };\n\n const fadeOut = (gainNode: GainNode, key: CircleSoundKey) => {\n gainNode.gain.setValueAtTime(gainNode.gain.value, audioContext.currentTime);\n gainNode.gain.linearRampToValueAtTime(0, audioContext.currentTime + 0.5);\n const timeout = setTimeout(() => {\n activeSounds[key]?.source.stop();\n delete activeSounds[key];\n }, 500);\n\n timeoutRefs.current[key] = timeout as unknown as number;\n };\n\n const play = useCallback(\n async (key: CircleSoundKey, immediately = true, loop = false) => {\n await loadSound(key);\n const buffer = bufferMapper[key];\n\n if (!buffer || !canPlayAudio) return;\n\n const source = audioContext.createBufferSource();\n const gainNode = audioContext.createGain();\n\n source.buffer = buffer;\n source.loop = loop;\n source.connect(gainNode).connect(audioContext.destination);\n\n if (immediately) {\n gainNode.gain.setValueAtTime(1, audioContext.currentTime);\n } else {\n fadeIn(gainNode);\n }\n\n source.start();\n\n // Only track looping/long sounds in activeSounds for stopping later\n if (loop) {\n const existing = activeSounds[key];\n\n if (existing) {\n existing.source.stop();\n delete activeSounds[key];\n }\n\n activeSounds[key] = { source, gainNode };\n\n source.onended = () => {\n if (activeSounds[key]?.source === source) {\n delete activeSounds[key];\n }\n };\n }\n },\n [canPlayAudio],\n );\n\n const stop = useCallback(async (key: CircleSoundKey, immediately = true) => {\n const sound = activeSounds[key];\n\n if (!sound) return;\n\n if (immediately) {\n sound.source.stop();\n delete activeSounds[key];\n } else {\n fadeOut(sound.gainNode, key);\n }\n }, []);\n\n const playSwipeSound = useCallback(() => {\n const key = SWIPE_SOUND_ORDER[swipeSoundIndex] || CircleSoundKey.SWIPE_01;\n\n swipeSoundIndex = (swipeSoundIndex + 1) % SWIPE_SOUND_ORDER.length;\n play(key);\n }, [play]);\n\n const playButtonSound = useCallback(() => {\n play(CircleSoundKey.TOGGLE);\n }, [play]);\n\n const handleVisibilityChange = useCallback(async () => {\n if (document.visibilityState === 'visible') {\n await resumeAudioContext();\n pausedSoundsRef.current.forEach(key => {\n play(key);\n });\n pausedSoundsRef.current.clear();\n } else {\n Object.keys(activeSounds).forEach(key => {\n stop(key as CircleSoundKey, true);\n pausedSoundsRef.current.add(key as CircleSoundKey);\n });\n }\n }, [play, stop]);\n\n useEffect(() => {\n const interactionEvents = ['pointerdown', 'touchstart'];\n const tryResume = () => {\n resumeAudioContext();\n };\n\n document.addEventListener('visibilitychange', handleVisibilityChange);\n interactionEvents.forEach(event => {\n window.addEventListener(event, tryResume, { once: true });\n });\n\n const timeouts = timeoutRefs.current;\n\n return () => {\n document.removeEventListener('visibilitychange', handleVisibilityChange);\n interactionEvents.forEach(event => {\n window.removeEventListener(event, tryResume);\n });\n Object.values(timeouts).forEach(id => clearTimeout(id));\n };\n }, [handleVisibilityChange]);\n\n return {\n playSwipeSound,\n play,\n stop,\n playButtonSound,\n };\n};\n"],"names":["swipeSoundIndex","audioContext","bufferMapper","CircleSoundKey","activeSounds","loadSound","key","arrayBuffer","CircleSoundKeyMapper","decoded","resumeAudioContext","err","useCircleSounds","canPlayAudio","useAutoPlayPermission","pausedSoundsRef","useRef","timeoutRefs","fadeIn","gainNode","fadeOut","timeout","_a","play","useCallback","immediately","loop","buffer","source","existing","stop","sound","playSwipeSound","SWIPE_SOUND_ORDER","playButtonSound","handleVisibilityChange","useEffect","interactionEvents","tryResume","event","timeouts","id"],"mappings":";;;;AAQA,IAAIA,IAAkB;AACtB,MAAMC,IAAe,KAAK,OAAO,gBAAgB,OAAO,oBAAoB,GAEtEC,IAA2D;AAAA,EAC/D,CAACC,EAAe,UAAU,GAAG;AAAA,EAC7B,CAACA,EAAe,mBAAmB,GAAG;AAAA,EACtC,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,UAAU,GAAG;AAAA,EAC7B,CAACA,EAAe,MAAM,GAAG;AAAA,EACzB,CAACA,EAAe,cAAc,GA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vEE,EAAkB,QAAQ,CAASE,MAAA;AAC1B,eAAA,oBAAoBA,GAAOD,CAAS;AAAA,MAAA,CAC5C,GACD,OAAO,OAAOE,CAAQ,EAAE,QAAQ,CAAMC,MAAA,aAAaA,CAAE,CAAC;AAAA,IAAA;AAAA,EACxD,GACC,CAACN,CAAsB,CAAC,GAEpB;AAAA,IACL,gBAAAH;AAAA,IACA,MAAAT;AAAA,IACA,MAAAO;AAAA,IACA,iBAAAI;AAAA,EAAA;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"use-circle-sounds.js","sources":["../../../../../src/features/circle-games/hooks/use-circle-sounds/use-circle-sounds.ts"],"sourcesContent":["import type { TimeoutMap } from './use-circle-sound-types';\n\nimport { useCallback, useEffect, useRef } from 'react';\n\nimport { useAutoPlayPermission } from '../../../hooks/use-auto-play-permission/use-auto-play-permission';\nimport { CircleSoundKeyMapper, SWIPE_SOUND_ORDER } from './constants';\nimport { fadeInSound, fadeOutSound } from './helper';\nimport { CircleSoundKey } from './use-circle-sounds-enums';\n\nlet swipeSoundIndex = 0;\n\nexport const soundMapper: Record<keyof typeof CircleSoundKeyMapper, null | HTMLAudioElement> = {\n [CircleSoundKey.BACKGROUND]: null,\n [CircleSoundKey.BACKGROUND_RUSHHOUR]: null,\n [CircleSoundKey.TUTORIAL]: null,\n [CircleSoundKey.SWIPE_01]: null,\n [CircleSoundKey.SWIPE_02]: null,\n [CircleSoundKey.SWIPE_03]: null,\n [CircleSoundKey.SWIPE_04]: null,\n [CircleSoundKey.SWIPE_DOWN]: null,\n [CircleSoundKey.TOGGLE]: null,\n [CircleSoundKey.POINTS_AWARDED]: null,\n [CircleSoundKey.POINTS_ADDED]: null,\n [CircleSoundKey.GAME_CARD_CLICK]: null,\n [CircleSoundKey.CLOCK_IN]: null,\n [CircleSoundKey.CLOCK_OUT]: null,\n [CircleSoundKey.ACCURACY_IN]: null,\n [CircleSoundKey.ACCURACY_OUT]: null,\n [CircleSoundKey.STREAK_IN]: null,\n [CircleSoundKey.STREAK_OUT]: null,\n [CircleSoundKey.ACCURACY_INTRO]: null,\n [CircleSoundKey.ACCURACY_TARGET]: null,\n [CircleSoundKey.TIME_INTRO]: null,\n [CircleSoundKey.TIME_TARGET]: null,\n [CircleSoundKey.METER_FILL]: null,\n [CircleSoundKey.YOUR_SCORE]: null,\n [CircleSoundKey.HIGH_SCORE]: null,\n [CircleSoundKey.KEEP_IT_UP]: null,\n [CircleSoundKey.DOING_GREAT]: null,\n [CircleSoundKey.ALL_DONE]: null,\n};\n\nconst soundInstancePromise: Partial<Record<keyof typeof CircleSoundKeyMapper, Promise<void>>> = {};\n\nexport const useCircleSounds = () => {\n const { canAutoPlayAudio: canPlayAudio } = useAutoPlayPermission();\n\n const loadSound = useCallback((key: CircleSoundKey) => {\n if (!soundMapper[key]) {\n const loadedSound = new Audio(CircleSoundKeyMapper[key]);\n\n soundMapper[key] = loadedSound;\n }\n }, []);\n\n const pausedSoundsRef = useRef<Set<CircleSoundKey>>(new Set());\n const timeoutRefs = useRef<TimeoutMap>({});\n\n const play = useCallback(\n (key: CircleSoundKey, immediately: boolean = true, loop = false) => {\n loadSound(key);\n const soundInstance = soundMapper[key];\n\n if (!soundInstance || !canPlayAudio) return;\n\n // this makes sure that it keeps the default loop value at the time it was requested to be loaded\n // helps in visibility change where we only want to resume\n if (loop) {\n soundInstance.loop = loop;\n }\n\n if (timeoutRefs.current[key]) {\n clearInterval(timeoutRefs.current[key]);\n }\n\n // resume sound\n if (!soundInstance.paused && soundInstance.currentTime > 0 && !soundInstance.ended) {\n if (!immediately) {\n const intervalId = fadeInSound(soundInstance);\n\n timeoutRefs.current[key] = intervalId;\n } else {\n soundInstance.volume = 1;\n }\n\n return soundInstance;\n }\n\n // play sound\n soundInstance.volume = immediately ? 1 : 0;\n const promise = soundInstance.play();\n\n if (promise) {\n soundInstancePromise[key] = promise;\n }\n\n if (!immediately) {\n const intervalId = fadeInSound(soundInstance);\n\n timeoutRefs.current[key] = intervalId;\n }\n\n return soundInstance;\n },\n [loadSound, canPlayAudio],\n );\n\n const handleSoundStop = useCallback((key: CircleSoundKey, immediately: boolean) => {\n const soundInstance = soundMapper[key];\n\n if (!soundInstance) return;\n\n if (timeoutRefs.current[key]) {\n clearInterval(timeoutRefs.current[key]);\n }\n\n if (immediately) {\n soundInstance.pause();\n\n return;\n }\n\n const intervalId = fadeOutSound(soundInstance);\n\n timeoutRefs.current[key] = intervalId;\n }, []);\n\n const stop = useCallback(\n (key: CircleSoundKey, immediately: boolean = true) => {\n // if play returned a promise\n if (soundInstancePromise[key] !== undefined) {\n soundInstancePromise[key]\n ?.then(() => {\n handleSoundStop(key, immediately);\n })\n .catch(err => {\n // eslint-disable-next-line no-console\n console.log('sound not playing', err);\n });\n\n return;\n }\n\n handleSoundStop(key, immediately);\n },\n [handleSoundStop],\n );\n\n const playSwipeSound = useCallback(() => {\n const key = SWIPE_SOUND_ORDER[swipeSoundIndex] || CircleSoundKey.SWIPE_01;\n\n swipeSoundIndex = (swipeSoundIndex + 1) % SWIPE_SOUND_ORDER.length;\n\n play(key);\n }, [play]);\n\n const playButtonSound = useCallback(() => {\n const sound = play(CircleSoundKey.TOGGLE);\n\n return sound;\n }, [play]);\n\n const handleVisibilityChange = useCallback(() => {\n const visibilityState = document.visibilityState;\n\n if (visibilityState === 'hidden') {\n Object.entries(soundMapper).forEach(([key, sound]) => {\n if (sound && !sound.paused) {\n stop(key as CircleSoundKey, true);\n pausedSoundsRef.current.add(key as CircleSoundKey);\n }\n });\n }\n\n if (visibilityState === 'visible') {\n pausedSoundsRef.current.forEach(key => {\n play(key);\n });\n pausedSoundsRef.current.clear();\n }\n }, [play, stop]);\n\n useEffect(() => {\n document.addEventListener('visibilitychange', handleVisibilityChange);\n const timeouts = timeoutRefs.current;\n\n return () => {\n document.removeEventListener('visibilitychange', handleVisibilityChange);\n Object.values(timeouts).forEach(id => {\n id && clearInterval(id);\n });\n };\n }, [handleVisibilityChange]);\n\n return { playSwipeSound, play, stop, playButtonSound };\n};\n"],"names":["swipeSoundIndex","soundMapper","CircleSoundKey","soundInstancePromise","useCircleSounds","canPlayAudio","useAutoPlayPermission","loadSound","useCallback","key","loadedSound","CircleSoundKeyMapper","pausedSoundsRef","useRef","timeoutRefs","play","immediately","loop","soundInstance","intervalId","fadeInSound","promise","handleSoundStop","fadeOutSound","stop","_a","err","playSwipeSound","SWIPE_SOUND_ORDER","playButtonSound","handleVisibilityChange","visibilityState","sound","useEffect","timeouts","id"],"mappings":";;;;;AASA,IAAIA,IAAkB;AAEf,MAAMC,IAAkF;AAAA,EAC7F,CAACC,EAAe,UAAU,GAAG;AAAA,EAC7B,CAACA,EAAe,mBAAmB,GAAG;AAAA,EACtC,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,UAAU,GAAG;AAAA,EAC7B,CAACA,EAAe,MAAM,GAAG;AAAA,EACzB,CAACA,EAAe,cAAc,GAAG;AAAA,EACjC,CAACA,EAAe,YAAY,GAAG;AAAA,EAC/B,CAACA,EAAe,eAAe,GAAG;AAAA,EAClC,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,SAAS,GAAG;AAAA,EAC5B,CAACA,EAAe,WAAW,GAAG;AAAA,EAC9B,CAACA,EAAe,YAAY,GAAG;AAAA,EAC/B,CAACA,EAAe,SAAS,GAAG;AAAA,EAC5B,CAACA,EAAe,UAAU,GAAG;AAAA,EAC7B,CAACA,EAAe,cAAc,GAAG;AAAA,EACjC,CAACA,EAAe,eAAe,GAAG;AAAA,EAClC,CAACA,EAAe,UAAU,GAAG;AAAA,EAC7B,CAACA,EAAe,WAAW,GAAG;AAAA,EAC9B,CAACA,EAAe,UAAU,GAAG;AAAA,EAC7B,CAACA,EAAe,UAAU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,EAAM,WAClBR,EAAKf,GAAuB,EAAI,GAChBG,EAAA,QAAQ,IAAIH,CAAqB;AAAA,IACnD,CACD,GAGCsB,MAAoB,cACNnB,EAAA,QAAQ,QAAQ,CAAOH,MAAA;AACrC,MAAAM,EAAKN,CAAG;AAAA,IAAA,CACT,GACDG,EAAgB,QAAQ;EAC1B,GACC,CAACG,GAAMS,CAAI,CAAC;AAEf,SAAAS,EAAU,MAAM;AACL,aAAA,iBAAiB,oBAAoBH,CAAsB;AACpE,UAAMI,IAAWpB,EAAY;AAE7B,WAAO,MAAM;AACF,eAAA,oBAAoB,oBAAoBgB,CAAsB,GACvE,OAAO,OAAOI,CAAQ,EAAE,QAAQ,CAAMC,MAAA;AACpC,QAAAA,KAAM,cAAcA,CAAE;AAAA,MAAA,CACvB;AAAA,IAAA;AAAA,EACH,GACC,CAACL,CAAsB,CAAC,GAEpB,EAAE,gBAAAH,GAAgB,MAAAZ,GAAM,MAAAS,GAAM,iBAAAK,EAAgB;AACvD;"}
|
package/dist/features/circle-games/sign-up/api/use-update-username-api/use-update-username-api.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createPostAPI as e } from "@cuemath/rest-api";
|
|
2
|
+
import { BASE_URL_V1 as o } from "../../../../../constants/api.js";
|
|
3
|
+
const { usePost: p } = e({
|
|
4
|
+
getURL: (s, { studentId: t }) => `${o}/students/${t}/`
|
|
5
|
+
});
|
|
6
|
+
export {
|
|
7
|
+
p as useUpdateUsernamePost
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=use-update-username-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-update-username-api.js","sources":["../../../../../../src/features/circle-games/sign-up/api/use-update-username-api/use-update-username-api.ts"],"sourcesContent":["import type {\n IUpdateUsernamePayload,\n IUpdateUsernameResponse,\n} from './use-update-username-api-types';\n\nimport { createPostAPI } from '@cuemath/rest-api';\n\nimport { BASE_URL_V1 } from '../../../../../constants/api';\n\nconst { usePost: useUpdateUsernamePost } = createPostAPI<\n IUpdateUsernameResponse,\n IUpdateUsernamePayload,\n { studentId: string }\n>({\n getURL: (_, { studentId }) => `${BASE_URL_V1}/students/${studentId}/`,\n});\n\nexport { useUpdateUsernamePost };\n"],"names":["useUpdateUsernamePost","createPostAPI","_","studentId","BASE_URL_V1"],"mappings":";;AASA,MAAM,EAAE,SAASA,EAAsB,IAAIC,EAIzC;AAAA,EACA,QAAQ,CAACC,GAAG,EAAE,WAAAC,EAAgB,MAAA,GAAGC,CAAW,aAAaD,CAAS;AACpE,CAAC;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as e, Fragment as
|
|
2
|
-
import { useRef as m, useCallback as
|
|
1
|
+
import { jsx as e, Fragment as S, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as m, useCallback as k } from "react";
|
|
3
3
|
import B from "../../../../../assets/line-icons/icons/circle-back.js";
|
|
4
4
|
import { LOTTIE as R } from "../../../../../assets/lottie/lottie.js";
|
|
5
5
|
import A from "../../../../ui/lottie-animation/lottie-animation.js";
|
|
6
6
|
import I from "../../../../ui/text/text.js";
|
|
7
|
-
import { BackgroundImage as P, ScreenWrapper as b, TransparentIconButton as L, CircularStepsContainer as T, CircularStepsWrapper as
|
|
8
|
-
import { TOTAL_FRAMES as
|
|
7
|
+
import { BackgroundImage as P, ScreenWrapper as b, TransparentIconButton as L, CircularStepsContainer as T, CircularStepsWrapper as $, CustEleContainer as q, CircularProgressContainer as v, CircularProgress as w, Label as F, CustomDataContainer as M } from "./circular-steps-styled.js";
|
|
8
|
+
import { TOTAL_FRAMES as W } from "./constants.js";
|
|
9
9
|
const j = ({ img: n }) => /* @__PURE__ */ e(P, { children: n }), x = {
|
|
10
10
|
autoplay: !1,
|
|
11
11
|
loop: !1,
|
|
@@ -14,18 +14,18 @@ const j = ({ img: n }) => /* @__PURE__ */ e(P, { children: n }), x = {
|
|
|
14
14
|
const { width: s, height: u } = d, r = n[t], l = m(null), a = m(-1), g = () => {
|
|
15
15
|
var o, i;
|
|
16
16
|
(i = (o = n[t]) == null ? void 0 : o.onBack) == null || i.call(o);
|
|
17
|
-
}, h =
|
|
17
|
+
}, h = k(() => {
|
|
18
18
|
if (l.current && (r != null && r.isProgressAnimationRequired)) {
|
|
19
|
-
const o = n.filter((E) => E.isProgressAnimationRequired), i =
|
|
19
|
+
const o = n.filter((E) => E.isProgressAnimationRequired), i = W / o.length, p = a.current >= 0 ? a.current : 0, f = Math.round(p * i + 1), C = Math.round(t * i);
|
|
20
20
|
a.current = t, l.current.playSegments([f, C], !0);
|
|
21
21
|
}
|
|
22
22
|
}, [t, r == null ? void 0 : r.isProgressAnimationRequired, n]);
|
|
23
|
-
return /* @__PURE__ */ e(
|
|
23
|
+
return /* @__PURE__ */ e(S, { children: r ? /* @__PURE__ */ c(b, { width: s, height: u, children: [
|
|
24
24
|
r.onBack ? /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(B, { onClick: g }) }) : null,
|
|
25
25
|
r.background ? /* @__PURE__ */ e(j, { img: r.background }) : null,
|
|
26
|
-
/* @__PURE__ */ e(T, { children: /* @__PURE__ */ c(
|
|
27
|
-
r.custEle ? /* @__PURE__ */ e(
|
|
28
|
-
r.custEleInsideStep ? /* @__PURE__ */ c(
|
|
26
|
+
/* @__PURE__ */ e(T, { children: /* @__PURE__ */ c($, { children: [
|
|
27
|
+
r.custEle ? /* @__PURE__ */ e(q, { children: r.custEle }) : null,
|
|
28
|
+
r.custEleInsideStep ? /* @__PURE__ */ c(v, { width: s, height: u, children: [
|
|
29
29
|
r.isProgressAnimationRequired ? /* @__PURE__ */ e(w, { children: /* @__PURE__ */ e(
|
|
30
30
|
A,
|
|
31
31
|
{
|
|
@@ -35,11 +35,11 @@ const j = ({ img: n }) => /* @__PURE__ */ e(P, { children: n }), x = {
|
|
|
35
35
|
onRender: h
|
|
36
36
|
}
|
|
37
37
|
) }) : null,
|
|
38
|
-
r.label ? /* @__PURE__ */ e(
|
|
38
|
+
r.label ? /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(I, { $renderAs: "ab2", $align: "center", $color: "WHITE", $whiteSpace: "pre", children: r.label }) }) : null,
|
|
39
39
|
r.custEleInsideStep
|
|
40
40
|
] }) : null
|
|
41
41
|
] }) }),
|
|
42
|
-
r.custEleBelowStep ? /* @__PURE__ */ e(
|
|
42
|
+
r.custEleBelowStep ? /* @__PURE__ */ e(M, { children: r.custEleBelowStep }) : null
|
|
43
43
|
] }) : null });
|
|
44
44
|
};
|
|
45
45
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"circular-steps.js","sources":["../../../../../../src/features/circle-games/sign-up/comp/circular-steps/circular-steps.tsx"],"sourcesContent":["import type { ILottieAnimationRef } from '../../../../ui/lottie-animation/types';\nimport type { ICircularStepsProps } from './circular-steps-types';\nimport type { FC } from 'react';\n\nimport { useCallback, useRef } from 'react';\n\nimport CircleBackIcon from '../../../../../assets/line-icons/icons/circle-back';\nimport { LOTTIE } from '../../../../../assets/lottie/lottie';\nimport LottieAnimation from '../../../../ui/lottie-animation/lottie-animation';\nimport Text from '../../../../ui/text/text';\nimport * as Styled from './circular-steps-styled';\nimport { TOTAL_FRAMES } from './constants';\n\nexport const BackgroundImage = ({ img }: { img: React.ReactNode }) => {\n return <Styled.BackgroundImage>{img}</Styled.BackgroundImage>;\n};\n\nconst animationSettings = {\n autoplay: false,\n loop: false,\n renderer: 'canvas',\n};\n\nexport const CircularSteps: FC<ICircularStepsProps> = ({ steps, currentStepIndex, dimensions }) => {\n const { width, height } = dimensions;\n\n const step = steps[currentStepIndex];\n const animationRef = useRef<ILottieAnimationRef | null>(null);\n const previousStepIndex = useRef<number>(-1);\n\n const handleBack = () => {\n steps[currentStepIndex]?.onBack?.();\n };\n\n const onLottieRender = useCallback(() => {\n if (animationRef.current && step?.isProgressAnimationRequired) {\n const actualSteps = steps.filter(_step => _step.isProgressAnimationRequired);\n const stepSize = TOTAL_FRAMES / actualSteps.length;\n\n const validPreviousIndex = previousStepIndex.current >= 0 ? previousStepIndex.current : 0;\n\n const fromFrame = Math.round(validPreviousIndex * stepSize + 1);\n const toFrame = Math.round(currentStepIndex * stepSize);\n\n previousStepIndex.current = currentStepIndex;\n animationRef.current.playSegments([fromFrame, toFrame], true);\n }\n }, [currentStepIndex, step?.isProgressAnimationRequired, steps]);\n\n return (\n <>\n {step ? (\n <Styled.ScreenWrapper width={width} height={height}>\n {step.onBack ? (\n <Styled.TransparentIconButton>\n <CircleBackIcon onClick={handleBack} />\n </Styled.TransparentIconButton>\n ) : null}\n {step.background ? <BackgroundImage img={step.background} /> : null}\n <Styled.CircularStepsContainer>\n <Styled.CircularStepsWrapper>\n {step.custEle ? (\n <Styled.CustEleContainer>{step.custEle}</Styled.CustEleContainer>\n ) : null}\n\n {/*circular data container*/}\n {step.custEleInsideStep ? (\n <Styled.CircularProgressContainer width={width} height={height}>\n {step.isProgressAnimationRequired ? (\n <Styled.CircularProgress>\n <LottieAnimation\n ref={animationRef}\n src={LOTTIE.LEVELUP_RINGS}\n settings={animationSettings}\n onRender={onLottieRender}\n />\n </Styled.CircularProgress>\n ) : null}\n\n {step.label ? (\n <Styled.Label>\n <Text $renderAs=\"ab2\" $color=\"WHITE\">\n {step.label}\n </Text>\n </Styled.Label>\n ) : null}\n {step.custEleInsideStep}\n </Styled.CircularProgressContainer>\n ) : null}\n </Styled.CircularStepsWrapper>\n </Styled.CircularStepsContainer>\n {/* custom data container below circle */}\n {step.custEleBelowStep ? (\n <Styled.CustomDataContainer>{step.custEleBelowStep}</Styled.CustomDataContainer>\n ) : null}\n </Styled.ScreenWrapper>\n ) : null}\n </>\n );\n};\n"],"names":["BackgroundImage","img","jsx","Styled.BackgroundImage","animationSettings","CircularSteps","steps","currentStepIndex","dimensions","width","height","step","animationRef","useRef","previousStepIndex","handleBack","_b","_a","onLottieRender","useCallback","actualSteps","_step","stepSize","TOTAL_FRAMES","validPreviousIndex","fromFrame","toFrame","jsxs","Styled.ScreenWrapper","Styled.TransparentIconButton","CircleBackIcon","Styled.CircularStepsContainer","Styled.CircularStepsWrapper","Styled.CustEleContainer","Styled.CircularProgressContainer","Styled.CircularProgress","LottieAnimation","LOTTIE","Styled.Label","Text","Styled.CustomDataContainer"],"mappings":";;;;;;;;AAaO,MAAMA,IAAkB,CAAC,EAAE,KAAAC,QACxB,gBAAAC,EAAAC,GAAA,EAAwB,UAAIF,EAAA,CAAA,GAGhCG,IAAoB;AAAA,EACxB,UAAU;AAAA,EACV,MAAM;AAAA,EACN,UAAU;AACZ,GAEaC,IAAyC,CAAC,EAAE,OAAAC,GAAO,kBAAAC,GAAkB,YAAAC,QAAiB;AAC3F,QAAA,EAAE,OAAAC,GAAO,QAAAC,EAAW,IAAAF,GAEpBG,IAAOL,EAAMC,CAAgB,GAC7BK,IAAeC,EAAmC,IAAI,GACtDC,IAAoBD,EAAe,EAAE,GAErCE,IAAa,MAAM;;AACjB,KAAAC,KAAAC,IAAAX,EAAAC,CAAgB,MAAhB,gBAAAU,EAAmB,WAAnB,QAAAD,EAAA,KAAAC;AAAA,EAA4B,GAG9BC,IAAiBC,EAAY,MAAM;AACnC,QAAAP,EAAa,YAAWD,KAAA,QAAAA,EAAM,8BAA6B;AAC7D,YAAMS,IAAcd,EAAM,OAAO,CAAAe,MAASA,EAAM,2BAA2B,GACrEC,IAAWC,IAAeH,EAAY,QAEtCI,IAAqBV,EAAkB,WAAW,IAAIA,EAAkB,UAAU,GAElFW,IAAY,KAAK,MAAMD,IAAqBF,IAAW,CAAC,GACxDI,IAAU,KAAK,MAAMnB,IAAmBe,CAAQ;AAEtD,MAAAR,EAAkB,UAAUP,GAC5BK,EAAa,QAAQ,aAAa,CAACa,GAAWC,CAAO,GAAG,EAAI;AAAA,IAC9D;AAAA,KACC,CAACnB,GAAkBI,KAAA,gBAAAA,EAAM,6BAA6BL,CAAK,CAAC;AAE/D,gCAEK,UACCK,IAAA,gBAAAgB,EAACC,GAAA,EAAqB,OAAAnB,GAAc,QAAAC,GACjC,UAAA;AAAA,IAAKC,EAAA,SACH,gBAAAT,EAAA2B,GAAA,EACC,4BAACC,GAAe,EAAA,SAASf,GAAY,EAAA,CACvC,IACE;AAAA,IACHJ,EAAK,aAAa,gBAAAT,EAACF,KAAgB,KAAKW,EAAK,WAAY,CAAA,IAAK;AAAA,sBAC9DoB,GAAA,EACC,UAAC,gBAAAJ,EAAAK,GAAA,EACE,UAAA;AAAA,MAAArB,EAAK,UACH,gBAAAT,EAAA+B,GAAA,EAAyB,UAAAtB,EAAK,QAAQ,CAAA,IACrC;AAAA,MAGHA,EAAK,oBACJ,gBAAAgB,EAACO,GAAA,EAAiC,OAAAzB,GAAc,QAAAC,GAC7C,UAAA;AAAA,QAAAC,EAAK,8BACJ,gBAAAT,EAACiC,GAAA,EACC,UAAA,gBAAAjC;AAAA,UAACkC;AAAA,UAAA;AAAA,YACC,KAAKxB;AAAA,YACL,KAAKyB,EAAO;AAAA,YACZ,UAAUjC;AAAA,YACV,UAAUc;AAAA,UAAA;AAAA,WAEd,IACE;AAAA,QAEHP,EAAK,
|
|
1
|
+
{"version":3,"file":"circular-steps.js","sources":["../../../../../../src/features/circle-games/sign-up/comp/circular-steps/circular-steps.tsx"],"sourcesContent":["import type { ILottieAnimationRef } from '../../../../ui/lottie-animation/types';\nimport type { ICircularStepsProps } from './circular-steps-types';\nimport type { FC } from 'react';\n\nimport { useCallback, useRef } from 'react';\n\nimport CircleBackIcon from '../../../../../assets/line-icons/icons/circle-back';\nimport { LOTTIE } from '../../../../../assets/lottie/lottie';\nimport LottieAnimation from '../../../../ui/lottie-animation/lottie-animation';\nimport Text from '../../../../ui/text/text';\nimport * as Styled from './circular-steps-styled';\nimport { TOTAL_FRAMES } from './constants';\n\nexport const BackgroundImage = ({ img }: { img: React.ReactNode }) => {\n return <Styled.BackgroundImage>{img}</Styled.BackgroundImage>;\n};\n\nconst animationSettings = {\n autoplay: false,\n loop: false,\n renderer: 'canvas',\n};\n\nexport const CircularSteps: FC<ICircularStepsProps> = ({ steps, currentStepIndex, dimensions }) => {\n const { width, height } = dimensions;\n\n const step = steps[currentStepIndex];\n const animationRef = useRef<ILottieAnimationRef | null>(null);\n const previousStepIndex = useRef<number>(-1);\n\n const handleBack = () => {\n steps[currentStepIndex]?.onBack?.();\n };\n\n const onLottieRender = useCallback(() => {\n if (animationRef.current && step?.isProgressAnimationRequired) {\n const actualSteps = steps.filter(_step => _step.isProgressAnimationRequired);\n const stepSize = TOTAL_FRAMES / actualSteps.length;\n\n const validPreviousIndex = previousStepIndex.current >= 0 ? previousStepIndex.current : 0;\n\n const fromFrame = Math.round(validPreviousIndex * stepSize + 1);\n const toFrame = Math.round(currentStepIndex * stepSize);\n\n previousStepIndex.current = currentStepIndex;\n animationRef.current.playSegments([fromFrame, toFrame], true);\n }\n }, [currentStepIndex, step?.isProgressAnimationRequired, steps]);\n\n return (\n <>\n {step ? (\n <Styled.ScreenWrapper width={width} height={height}>\n {step.onBack ? (\n <Styled.TransparentIconButton>\n <CircleBackIcon onClick={handleBack} />\n </Styled.TransparentIconButton>\n ) : null}\n {step.background ? <BackgroundImage img={step.background} /> : null}\n <Styled.CircularStepsContainer>\n <Styled.CircularStepsWrapper>\n {step.custEle ? (\n <Styled.CustEleContainer>{step.custEle}</Styled.CustEleContainer>\n ) : null}\n\n {/*circular data container*/}\n {step.custEleInsideStep ? (\n <Styled.CircularProgressContainer width={width} height={height}>\n {step.isProgressAnimationRequired ? (\n <Styled.CircularProgress>\n <LottieAnimation\n ref={animationRef}\n src={LOTTIE.LEVELUP_RINGS}\n settings={animationSettings}\n onRender={onLottieRender}\n />\n </Styled.CircularProgress>\n ) : null}\n\n {step.label ? (\n <Styled.Label>\n <Text $renderAs=\"ab2\" $align=\"center\" $color=\"WHITE\" $whiteSpace=\"pre\">\n {step.label}\n </Text>\n </Styled.Label>\n ) : null}\n {step.custEleInsideStep}\n </Styled.CircularProgressContainer>\n ) : null}\n </Styled.CircularStepsWrapper>\n </Styled.CircularStepsContainer>\n {/* custom data container below circle */}\n {step.custEleBelowStep ? (\n <Styled.CustomDataContainer>{step.custEleBelowStep}</Styled.CustomDataContainer>\n ) : null}\n </Styled.ScreenWrapper>\n ) : null}\n </>\n );\n};\n"],"names":["BackgroundImage","img","jsx","Styled.BackgroundImage","animationSettings","CircularSteps","steps","currentStepIndex","dimensions","width","height","step","animationRef","useRef","previousStepIndex","handleBack","_b","_a","onLottieRender","useCallback","actualSteps","_step","stepSize","TOTAL_FRAMES","validPreviousIndex","fromFrame","toFrame","jsxs","Styled.ScreenWrapper","Styled.TransparentIconButton","CircleBackIcon","Styled.CircularStepsContainer","Styled.CircularStepsWrapper","Styled.CustEleContainer","Styled.CircularProgressContainer","Styled.CircularProgress","LottieAnimation","LOTTIE","Styled.Label","Text","Styled.CustomDataContainer"],"mappings":";;;;;;;;AAaO,MAAMA,IAAkB,CAAC,EAAE,KAAAC,QACxB,gBAAAC,EAAAC,GAAA,EAAwB,UAAIF,EAAA,CAAA,GAGhCG,IAAoB;AAAA,EACxB,UAAU;AAAA,EACV,MAAM;AAAA,EACN,UAAU;AACZ,GAEaC,IAAyC,CAAC,EAAE,OAAAC,GAAO,kBAAAC,GAAkB,YAAAC,QAAiB;AAC3F,QAAA,EAAE,OAAAC,GAAO,QAAAC,EAAW,IAAAF,GAEpBG,IAAOL,EAAMC,CAAgB,GAC7BK,IAAeC,EAAmC,IAAI,GACtDC,IAAoBD,EAAe,EAAE,GAErCE,IAAa,MAAM;;AACjB,KAAAC,KAAAC,IAAAX,EAAAC,CAAgB,MAAhB,gBAAAU,EAAmB,WAAnB,QAAAD,EAAA,KAAAC;AAAA,EAA4B,GAG9BC,IAAiBC,EAAY,MAAM;AACnC,QAAAP,EAAa,YAAWD,KAAA,QAAAA,EAAM,8BAA6B;AAC7D,YAAMS,IAAcd,EAAM,OAAO,CAAAe,MAASA,EAAM,2BAA2B,GACrEC,IAAWC,IAAeH,EAAY,QAEtCI,IAAqBV,EAAkB,WAAW,IAAI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AA;AAAA,IAECA,EAAK,mBACH,gBAAAT,EAAAsC,GAAA,EAA4B,UAAA7B,EAAK,iBAAiB,CAAA,IACjD;AAAA,EAAA,GACN,IACE,KACN,CAAA;AAEJ;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useCallback as l, useMemo as m } from "react";
|
|
2
|
+
import { useUpdateUsernamePost as c } from "../../api/use-update-username-api/use-update-username-api.js";
|
|
3
|
+
const d = (u) => {
|
|
4
|
+
const {
|
|
5
|
+
post: r,
|
|
6
|
+
isProcessing: t,
|
|
7
|
+
...s
|
|
8
|
+
} = c({
|
|
9
|
+
onComplete(n, e) {
|
|
10
|
+
let o = null;
|
|
11
|
+
e && (o = {
|
|
12
|
+
username: e.username
|
|
13
|
+
}), u(o);
|
|
14
|
+
}
|
|
15
|
+
}), a = l(
|
|
16
|
+
({ username: n, studentId: e }) => {
|
|
17
|
+
r(
|
|
18
|
+
{
|
|
19
|
+
username: n,
|
|
20
|
+
create_circle_profile_only: !0
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
studentId: e
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
},
|
|
27
|
+
[r]
|
|
28
|
+
);
|
|
29
|
+
return m(() => ({
|
|
30
|
+
updateUsername: a,
|
|
31
|
+
isProcessing: t,
|
|
32
|
+
...s
|
|
33
|
+
}), [a, t, s]);
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
d as useUpdateUsernameDal
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=update-username-dal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-username-dal.js","sources":["../../../../../../src/features/circle-games/sign-up/dal/update-username-dal/update-username-dal.ts"],"sourcesContent":["import type { IUpdateUsernameResponse } from '../../api/use-update-username-api/use-update-username-api-types';\n\nimport { useCallback, useMemo } from 'react';\n\nimport { useUpdateUsernamePost } from '../../api/use-update-username-api/use-update-username-api';\n\nexport const useUpdateUsernameDal = (\n onCompleted: (data: IUpdateUsernameResponse | null) => void,\n) => {\n const {\n post: updateUsernamePost,\n isProcessing,\n ...rest\n } = useUpdateUsernamePost({\n onComplete(_, response) {\n let data: IUpdateUsernameResponse | null = null;\n\n if (response) {\n data = {\n username: response.username,\n };\n }\n\n onCompleted(data);\n },\n });\n\n const updateUsername = useCallback(\n ({ username, studentId }: { username: string; studentId: string }) => {\n updateUsernamePost(\n {\n username: username,\n create_circle_profile_only: true,\n },\n {\n studentId,\n },\n );\n },\n [updateUsernamePost],\n );\n\n const returnVal = useMemo(() => {\n return {\n updateUsername,\n isProcessing,\n ...rest,\n };\n }, [updateUsername, isProcessing, rest]);\n\n return returnVal;\n};\n"],"names":["useUpdateUsernameDal","onCompleted","updateUsernamePost","isProcessing","rest","useUpdateUsernamePost","_","response","data","updateUsername","useCallback","username","studentId","useMemo"],"mappings":";;AAMa,MAAAA,IAAuB,CAClCC,MACG;AACG,QAAA;AAAA,IACJ,MAAMC;AAAA,IACN,cAAAC;AAAA,IACA,GAAGC;AAAA,MACDC,EAAsB;AAAA,IACxB,WAAWC,GAAGC,GAAU;AACtB,UAAIC,IAAuC;AAE3C,MAAID,MACKC,IAAA;AAAA,QACL,UAAUD,EAAS;AAAA,MAAA,IAIvBN,EAAYO,CAAI;AAAA,IAClB;AAAA,EAAA,CACD,GAEKC,IAAiBC;AAAA,IACrB,CAAC,EAAE,UAAAC,GAAU,WAAAC,QAAyD;AACpE,MAAAV;AAAA,QACE;AAAA,UACE,UAAAS;AAAA,UACA,4BAA4B;AAAA,QAC9B;AAAA,QACA;AAAA,UACE,WAAAC;AAAA,QACF;AAAA,MAAA;AAAA,IAEJ;AAAA,IACA,CAACV,CAAkB;AAAA,EAAA;AAWd,SARWW,EAAQ,OACjB;AAAA,IACL,gBAAAJ;AAAA,IACA,cAAAN;AAAA,IACA,GAAGC;AAAA,EAAA,IAEJ,CAACK,GAAgBN,GAAcC,CAAI,CAAC;AAGzC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-up-types.js","sources":["../../../../src/features/circle-games/sign-up/sign-up-types.ts"],"sourcesContent":["import type { ICreateUserResponseDal } from './dal/create-user-dal/create-user-dal-types';\nimport type { IUpdateUserPayloadDal } from './dal/update-user-dal/update-user-dal-types';\n\nexport enum State {\n ADDED = 'ADDED',\n DEMO = 'DEMO',\n TRIAL = 'TRL',\n PAID = 'PAID',\n ACTIVE = 'ACT',\n INACTIVE = 'INACT',\n LEFT = 'LEFT',\n PAUSED = 'PSD',\n HOLD = 'HOLD',\n}\n\nexport interface ISignUpProps {\n circleOnLeapSignedUp: boolean;\n circleOnLeapPremiumEnabled: boolean;\n mathGymEnrolledUser: boolean;\n circleEnrolledUser: boolean;\n circleOnLeapPremiumDays: number;\n circleUsername: string;\n countryCode: string;\n grade: string;\n state: State;\n studentId: string;\n isSignUpProcessing: boolean;\n onUpdateUser?: (data: IUpdateUserPayloadDal) => void;\n onCreateUser?: (data: ICreateUserResponseDal) => void;\n onSignupStepsComplete: (data: IUpdateUserPayloadDal | ICreateUserResponseDal | null) => void;\n}\n"],"names":["State"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sign-up-types.js","sources":["../../../../src/features/circle-games/sign-up/sign-up-types.ts"],"sourcesContent":["import type { IUpdateUsernameResponse } from './api/use-update-username-api/use-update-username-api-types';\nimport type { ICreateUserResponseDal } from './dal/create-user-dal/create-user-dal-types';\nimport type { IUpdateUserPayloadDal } from './dal/update-user-dal/update-user-dal-types';\n\nexport enum State {\n ADDED = 'ADDED',\n DEMO = 'DEMO',\n TRIAL = 'TRL',\n PAID = 'PAID',\n ACTIVE = 'ACT',\n INACTIVE = 'INACT',\n LEFT = 'LEFT',\n PAUSED = 'PSD',\n HOLD = 'HOLD',\n}\n\nexport interface ISignUpProps {\n circleOnLeapSignedUp: boolean;\n circleOnLeapPremiumEnabled: boolean;\n mathGymEnrolledUser: boolean;\n circleEnrolledUser: boolean;\n circleOnLeapPremiumDays: number;\n circleUsername: string;\n countryCode: string;\n grade: string;\n state: State;\n studentId: string;\n isSignUpProcessing: boolean;\n onUpdateUser?: (data: IUpdateUserPayloadDal) => void;\n onCreateUser?: (data: ICreateUserResponseDal) => void;\n onSignupStepsComplete: (\n data: IUpdateUserPayloadDal | ICreateUserResponseDal | IUpdateUsernameResponse | null,\n ) => void;\n isPLAStudent?: boolean;\n}\n"],"names":["State"],"mappings":"AAIY,IAAAA,sBAAAA,OACVA,EAAA,QAAQ,SACRA,EAAA,OAAO,QACPA,EAAA,QAAQ,OACRA,EAAA,OAAO,QACPA,EAAA,SAAS,OACTA,EAAA,WAAW,SACXA,EAAA,OAAO,QACPA,EAAA,SAAS,OACTA,EAAA,OAAO,QATGA,IAAAA,KAAA,CAAA,CAAA;"}
|