@adminide-stack/clock-tik-mobile 0.0.0-stage → 12.0.37-alpha.1
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/.claude-flow/data/pending-insights.jsonl +43 -0
- package/.claude-flow/sessions/session-1794323376548.json +14 -0
- package/CHANGELOG.md +41 -0
- package/jest.config.cjs +22 -0
- package/lib/assets/home/loop-day.jpg +0 -0
- package/lib/assets/home/loop-day.mp4 +0 -0
- package/lib/assets/home/loop-time-back.jpg +0 -0
- package/lib/assets/home/loop-time-back.mp4 +0 -0
- package/lib/assets/home/loop-where.jpg +0 -0
- package/lib/assets/home/loop-where.mp4 +0 -0
- package/lib/assets/home/reel-gym.jpg +0 -0
- package/lib/assets/home/reel-gym.mp4 +0 -0
- package/lib/assets/home/reel-internet.jpg +0 -0
- package/lib/assets/home/reel-internet.mp4 +0 -0
- package/lib/assets/icon.png +0 -0
- package/lib/assets/lottie/.claude-flow/data/pending-insights.jsonl +1 -0
- package/lib/assets/lottie/lucy-mark-calendar.json +1827 -0
- package/lib/assets/lottie/lucy-mark-call.json +1470 -0
- package/lib/assets/lottie/lucy-mark-connect.json +2552 -0
- package/lib/assets/lottie/lucy-mark-details.json +1735 -0
- package/lib/assets/lottie/lucy-mark-email.json +1363 -0
- package/lib/assets/lottie/lucy-mark-message.json +1154 -0
- package/lib/assets/lottie/lucy-mark-search.json +1067 -0
- package/lib/assets/lottie/lucy-mark-think.json +1253 -0
- package/lib/assets/lottie/lucy-mark-write.json +1532 -0
- package/lib/assets/lottie/time-back.json +16458 -0
- package/lib/assets/lottie/where-lucy-works-chat.json +6170 -0
- package/lib/assets/lottie/where-lucy-works-cloud.json +10066 -0
- package/lib/assets/lottie/where-lucy-works-mine-none.json +2478 -0
- package/lib/assets/lottie/where-lucy-works-mine-offline.json +2373 -0
- package/lib/assets/lottie/where-lucy-works-mine-online.json +7881 -0
- package/lib/assets/sounds/hours-back.m4a +0 -0
- package/lib/assets/sounds/meet-lucy.m4a +0 -0
- package/lib/assets/sounds/power-on.m4a +0 -0
- package/lib/assets/sounds/wind-back.m4a +0 -0
- package/lib/assets/sounds/youre-in.m4a +0 -0
- package/lib/chat/agent.js +358 -0
- package/lib/chat/agent.js.map +1 -0
- package/lib/chat/appFront.js +32 -0
- package/lib/chat/appFront.js.map +1 -0
- package/lib/chat/auth.js +370 -0
- package/lib/chat/auth.js.map +1 -0
- package/lib/chat/chores.js +360 -0
- package/lib/chat/chores.js.map +1 -0
- package/lib/chat/connectors.js +45 -0
- package/lib/chat/connectors.js.map +1 -0
- package/lib/chat/jobs.js +223 -0
- package/lib/chat/jobs.js.map +1 -0
- package/lib/chat/lucyMotion.js +6 -0
- package/lib/chat/lucyMotion.js.map +1 -0
- package/lib/chat/protocol.js +111 -0
- package/lib/chat/protocol.js.map +1 -0
- package/lib/chat/results.js +133 -0
- package/lib/chat/results.js.map +1 -0
- package/lib/chat/store.js +81 -0
- package/lib/chat/store.js.map +1 -0
- package/lib/chat/useDictation.js +168 -0
- package/lib/chat/useDictation.js.map +1 -0
- package/lib/chat/useLucyChat.js +451 -0
- package/lib/chat/useLucyChat.js.map +1 -0
- package/lib/chat/useMyComputer.js +32 -0
- package/lib/chat/useMyComputer.js.map +1 -0
- package/lib/chat/whereLucyWorks.js +52 -0
- package/lib/chat/whereLucyWorks.js.map +1 -0
- package/lib/chat/workspace.js +124 -0
- package/lib/chat/workspace.js.map +1 -0
- package/lib/components/AreaShot.js +289 -0
- package/lib/components/AreaShot.js.map +1 -0
- package/lib/components/Backdrops.js +262 -0
- package/lib/components/Backdrops.js.map +1 -0
- package/lib/components/BottomSheet.js +61 -0
- package/lib/components/BottomSheet.js.map +1 -0
- package/lib/components/ChatSheets.js +429 -0
- package/lib/components/ChatSheets.js.map +1 -0
- package/lib/components/ConnectorLogo.js +91 -0
- package/lib/components/ConnectorLogo.js.map +1 -0
- package/lib/components/CustomDrawer.js +534 -0
- package/lib/components/CustomDrawer.js.map +1 -0
- package/lib/components/IdeasPane.js +394 -0
- package/lib/components/IdeasPane.js.map +1 -0
- package/lib/components/ImessageSheet.js +261 -0
- package/lib/components/ImessageSheet.js.map +1 -0
- package/lib/components/KeyboardAvoider.js +29 -0
- package/lib/components/KeyboardAvoider.js.map +1 -0
- package/lib/components/Logo.js +81 -0
- package/lib/components/Logo.js.map +1 -0
- package/lib/components/LucyWorking.js +67 -0
- package/lib/components/LucyWorking.js.map +1 -0
- package/lib/components/Markdown.js +260 -0
- package/lib/components/Markdown.js.map +1 -0
- package/lib/components/Media.js +93 -0
- package/lib/components/Media.js.map +1 -0
- package/lib/components/MessagesAppIcon.js +23 -0
- package/lib/components/MessagesAppIcon.js.map +1 -0
- package/lib/components/MicButton.js +71 -0
- package/lib/components/MicButton.js.map +1 -0
- package/lib/components/ResultCards.js +974 -0
- package/lib/components/ResultCards.js.map +1 -0
- package/lib/components/SignInPrompt.js +148 -0
- package/lib/components/SignInPrompt.js.map +1 -0
- package/lib/components/SignedOut.js +38 -0
- package/lib/components/SignedOut.js.map +1 -0
- package/lib/components/TalkToLucyHero.js +487 -0
- package/lib/components/TalkToLucyHero.js.map +1 -0
- package/lib/components/TalkToLucySheet.js +182 -0
- package/lib/components/TalkToLucySheet.js.map +1 -0
- package/lib/components/WhereLucyWorks.js +277 -0
- package/lib/components/WhereLucyWorks.js.map +1 -0
- package/lib/components/WorkspaceSection.js +271 -0
- package/lib/components/WorkspaceSection.js.map +1 -0
- package/lib/components/YantraMark.js +13 -0
- package/lib/components/YantraMark.js.map +1 -0
- package/lib/components/drawerHeader.js +38 -0
- package/lib/components/drawerHeader.js.map +1 -0
- package/lib/components/lottieInstalled.js +6 -0
- package/lib/components/lottieInstalled.js.map +1 -0
- package/lib/components/ui.js +550 -0
- package/lib/components/ui.js.map +1 -0
- package/lib/components/useSignOut.js +7 -0
- package/lib/components/useSignOut.js.map +1 -0
- package/lib/components/viewport.js +121 -0
- package/lib/components/viewport.js.map +1 -0
- package/lib/components/voiceDial.js +10 -0
- package/lib/components/voiceDial.js.map +1 -0
- package/lib/compute.js +157 -0
- package/lib/compute.js.map +1 -0
- package/lib/config/env-config.js +27 -0
- package/lib/config/env-config.js.map +1 -0
- package/lib/config/routes.js +15 -0
- package/lib/config/routes.js.map +1 -0
- package/lib/content.js +25 -0
- package/lib/content.js.map +1 -0
- package/lib/hooks/keyboardCover.js +39 -0
- package/lib/hooks/keyboardCover.js.map +1 -0
- package/lib/hooks/useKeyboard.js +121 -0
- package/lib/hooks/useKeyboard.js.map +1 -0
- package/lib/hooks/useReducedMotion.js +13 -0
- package/lib/hooks/useReducedMotion.js.map +1 -0
- package/lib/imessage/openMessages.js +25 -0
- package/lib/imessage/openMessages.js.map +1 -0
- package/lib/imessage/platform.js +12 -0
- package/lib/imessage/platform.js.map +1 -0
- package/lib/imessage/textLink.js +262 -0
- package/lib/imessage/textLink.js.map +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -0
- package/lib/live/card.js +28 -0
- package/lib/live/card.js.map +1 -0
- package/lib/live/liveActivity.js +144 -0
- package/lib/live/liveActivity.js.map +1 -0
- package/lib/module.js +3 -0
- package/lib/module.js.map +1 -0
- package/lib/offer/BlackFridayOffer.js +378 -0
- package/lib/offer/BlackFridayOffer.js.map +1 -0
- package/lib/offer/blackFriday.js +78 -0
- package/lib/offer/blackFriday.js.map +1 -0
- package/lib/offer/parts.js +624 -0
- package/lib/offer/parts.js.map +1 -0
- package/lib/offer/state.js +63 -0
- package/lib/offer/state.js.map +1 -0
- package/lib/push/push.js +142 -0
- package/lib/push/push.js.map +1 -0
- package/lib/push/usePushNotifications.js +39 -0
- package/lib/push/usePushNotifications.js.map +1 -0
- package/lib/routes.json +175 -0
- package/lib/screens/Account/index.js +209 -0
- package/lib/screens/Account/index.js.map +1 -0
- package/lib/screens/Chat/index.js +710 -0
- package/lib/screens/Chat/index.js.map +1 -0
- package/lib/screens/Chores/index.js +18 -0
- package/lib/screens/Chores/index.js.map +1 -0
- package/lib/screens/Connectors/index.js +17 -0
- package/lib/screens/Connectors/index.js.map +1 -0
- package/lib/screens/History/index.js +380 -0
- package/lib/screens/History/index.js.map +1 -0
- package/lib/screens/Home/index.js +2715 -0
- package/lib/screens/Home/index.js.map +1 -0
- package/lib/screens/Home/media.js +25 -0
- package/lib/screens/Home/media.js.map +1 -0
- package/lib/screens/Welcome/index.js +1066 -0
- package/lib/screens/Welcome/index.js.map +1 -0
- package/lib/talk/talkToLucy.js +139 -0
- package/lib/talk/talkToLucy.js.map +1 -0
- package/lib/theme/colors.js +29 -0
- package/lib/theme/colors.js.map +1 -0
- package/lib/theme/fonts.js +17 -0
- package/lib/theme/fonts.js.map +1 -0
- package/lib/theme/muse.js +134 -0
- package/lib/theme/muse.js.map +1 -0
- package/lib/utils/links.js +54 -0
- package/lib/utils/links.js.map +1 -0
- package/lib/utils/yantraLinks.js +68 -0
- package/lib/utils/yantraLinks.js.map +1 -0
- package/lib/welcome/flow.js +375 -0
- package/lib/welcome/flow.js.map +1 -0
- package/lib/welcome/haptics.js +125 -0
- package/lib/welcome/haptics.js.map +1 -0
- package/lib/welcome/parts.js +1996 -0
- package/lib/welcome/parts.js.map +1 -0
- package/lib/welcome/powerOn.js +29 -0
- package/lib/welcome/powerOn.js.map +1 -0
- package/lib/welcome/seen.js +41 -0
- package/lib/welcome/seen.js.map +1 -0
- package/lib/welcome/sound.js +110 -0
- package/lib/welcome/sound.js.map +1 -0
- package/package.json +66 -5
- package/rollup.config.mjs +42 -0
- package/src/.claude-flow/data/pending-insights.jsonl +19 -0
- package/src/.claude-flow/sessions/session-1795013028422.json +14 -0
- package/src/__tests__/auth.test.ts +94 -0
- package/src/__tests__/blackFriday.test.ts +75 -0
- package/src/__tests__/cardTokens.test.ts +77 -0
- package/src/__tests__/chores.test.ts +188 -0
- package/src/__tests__/choresList.test.ts +100 -0
- package/src/__tests__/connectLink.test.ts +21 -0
- package/src/__tests__/content.test.ts +54 -0
- package/src/__tests__/dictation.test.ts +186 -0
- package/src/__tests__/envConfig.test.ts +14 -0
- package/src/__tests__/haptics.test.ts +202 -0
- package/src/__tests__/jobs.test.ts +130 -0
- package/src/__tests__/keyboardCover.test.ts +84 -0
- package/src/__tests__/liveCard.test.ts +39 -0
- package/src/__tests__/lockedPhone.test.ts +355 -0
- package/src/__tests__/lucyMotion.test.ts +34 -0
- package/src/__tests__/platform.test.ts +32 -0
- package/src/__tests__/powerOn.test.ts +62 -0
- package/src/__tests__/protocol.test.ts +125 -0
- package/src/__tests__/push.test.ts +111 -0
- package/src/__tests__/results.test.ts +256 -0
- package/src/__tests__/sound.test.ts +248 -0
- package/src/__tests__/talkToLucy.test.ts +205 -0
- package/src/__tests__/textLink.test.ts +91 -0
- package/src/__tests__/voiceDial.test.ts +53 -0
- package/src/__tests__/welcomeFlow.test.ts +157 -0
- package/src/__tests__/whereLucyWorks.test.ts +81 -0
- package/src/__tests__/yantraLinks.test.ts +96 -0
- package/src/assets/home/loop-day.jpg +0 -0
- package/src/assets/home/loop-day.mp4 +0 -0
- package/src/assets/home/loop-time-back.jpg +0 -0
- package/src/assets/home/loop-time-back.mp4 +0 -0
- package/src/assets/home/loop-where.jpg +0 -0
- package/src/assets/home/loop-where.mp4 +0 -0
- package/src/assets/home/reel-gym.jpg +0 -0
- package/src/assets/home/reel-gym.mp4 +0 -0
- package/src/assets/home/reel-internet.jpg +0 -0
- package/src/assets/home/reel-internet.mp4 +0 -0
- package/src/assets/icon.png +0 -0
- package/src/assets/lottie/.claude-flow/data/pending-insights.jsonl +1 -0
- package/src/assets/lottie/lucy-mark-calendar.json +1827 -0
- package/src/assets/lottie/lucy-mark-call.json +1470 -0
- package/src/assets/lottie/lucy-mark-connect.json +2552 -0
- package/src/assets/lottie/lucy-mark-details.json +1735 -0
- package/src/assets/lottie/lucy-mark-email.json +1363 -0
- package/src/assets/lottie/lucy-mark-message.json +1154 -0
- package/src/assets/lottie/lucy-mark-search.json +1067 -0
- package/src/assets/lottie/lucy-mark-think.json +1253 -0
- package/src/assets/lottie/lucy-mark-write.json +1532 -0
- package/src/assets/lottie/time-back.json +16458 -0
- package/src/assets/lottie/where-lucy-works-chat.json +6170 -0
- package/src/assets/lottie/where-lucy-works-cloud.json +10066 -0
- package/src/assets/lottie/where-lucy-works-mine-none.json +2478 -0
- package/src/assets/lottie/where-lucy-works-mine-offline.json +2373 -0
- package/src/assets/lottie/where-lucy-works-mine-online.json +7881 -0
- package/src/assets/sounds/hours-back.m4a +0 -0
- package/src/assets/sounds/meet-lucy.m4a +0 -0
- package/src/assets/sounds/power-on.m4a +0 -0
- package/src/assets/sounds/wind-back.m4a +0 -0
- package/src/assets/sounds/youre-in.m4a +0 -0
- package/src/chat/.claude-flow/data/pending-insights.jsonl +1 -0
- package/src/chat/agent.ts +376 -0
- package/src/chat/appFront.ts +39 -0
- package/src/chat/auth.ts +433 -0
- package/src/chat/chores.ts +394 -0
- package/src/chat/connectors.ts +75 -0
- package/src/chat/jobs.ts +228 -0
- package/src/chat/lucyMotion.ts +33 -0
- package/src/chat/protocol.ts +192 -0
- package/src/chat/results.ts +224 -0
- package/src/chat/store.ts +87 -0
- package/src/chat/useDictation.ts +201 -0
- package/src/chat/useLucyChat.ts +458 -0
- package/src/chat/useMyComputer.ts +41 -0
- package/src/chat/whereLucyWorks.ts +97 -0
- package/src/chat/workspace.ts +127 -0
- package/src/components/.claude-flow/data/pending-insights.jsonl +3 -0
- package/src/components/AreaShot.tsx +239 -0
- package/src/components/Backdrops.tsx +323 -0
- package/src/components/BottomSheet.tsx +96 -0
- package/src/components/ChatSheets.tsx +565 -0
- package/src/components/ConnectorLogo.tsx +116 -0
- package/src/components/CustomDrawer.tsx +526 -0
- package/src/components/IdeasPane.tsx +318 -0
- package/src/components/ImessageSheet.tsx +280 -0
- package/src/components/KeyboardAvoider.tsx +45 -0
- package/src/components/Logo.tsx +97 -0
- package/src/components/LucyWorking.tsx +122 -0
- package/src/components/Markdown.tsx +219 -0
- package/src/components/Media.tsx +173 -0
- package/src/components/MessagesAppIcon.tsx +51 -0
- package/src/components/MicButton.tsx +92 -0
- package/src/components/ResultCards.tsx +1067 -0
- package/src/components/SignInPrompt.tsx +182 -0
- package/src/components/SignedOut.tsx +47 -0
- package/src/components/TalkToLucyHero.tsx +540 -0
- package/src/components/TalkToLucySheet.tsx +208 -0
- package/src/components/VoiceOrb.tsx +364 -0
- package/src/components/WhereLucyWorks.tsx +261 -0
- package/src/components/WorkspaceSection.tsx +307 -0
- package/src/components/YantraMark.tsx +30 -0
- package/src/components/drawerHeader.tsx +46 -0
- package/src/components/kit.tsx +309 -0
- package/src/components/lottieInstalled.ts +7 -0
- package/src/components/ui.tsx +700 -0
- package/src/components/useSignOut.ts +21 -0
- package/src/components/viewport.tsx +166 -0
- package/src/components/voiceDial.ts +45 -0
- package/src/compute.ts +168 -0
- package/src/config/env-config.ts +50 -0
- package/src/config/routes.ts +28 -0
- package/src/content.ts +217 -0
- package/src/hooks/keyboardCover.ts +70 -0
- package/src/hooks/useKeyboard.ts +135 -0
- package/src/hooks/useReducedMotion.ts +19 -0
- package/src/imessage/openMessages.ts +53 -0
- package/src/imessage/platform.ts +32 -0
- package/src/imessage/textLink.ts +307 -0
- package/src/index.ts +24 -0
- package/src/live/card.ts +62 -0
- package/src/live/liveActivity.ts +192 -0
- package/src/module.ts +8 -0
- package/src/offer/BlackFridayOffer.tsx +394 -0
- package/src/offer/blackFriday.ts +109 -0
- package/src/offer/parts.tsx +650 -0
- package/src/offer/state.ts +78 -0
- package/src/push/push.ts +171 -0
- package/src/push/usePushNotifications.ts +47 -0
- package/src/screens/Account/index.tsx +310 -0
- package/src/screens/Chat/.claude-flow/data/pending-insights.jsonl +4 -0
- package/src/screens/Chat/index.tsx +891 -0
- package/src/screens/Chores/index.tsx +35 -0
- package/src/screens/Connectors/index.tsx +35 -0
- package/src/screens/History/index.tsx +346 -0
- package/src/screens/Home/index.tsx +2776 -0
- package/src/screens/Home/media.ts +31 -0
- package/src/screens/Welcome/index.tsx +1182 -0
- package/src/talk/talkToLucy.ts +187 -0
- package/src/theme/colors.ts +38 -0
- package/src/theme/fonts.ts +30 -0
- package/src/theme/muse.ts +86 -0
- package/src/utils/links.ts +84 -0
- package/src/utils/yantraLinks.ts +94 -0
- package/src/welcome/flow.ts +418 -0
- package/src/welcome/haptics.ts +179 -0
- package/src/welcome/parts.tsx +2160 -0
- package/src/welcome/powerOn.ts +84 -0
- package/src/welcome/seen.ts +68 -0
- package/src/welcome/sound.ts +173 -0
- package/tools/lottie/chat.motion +0 -0
- package/tools/lottie/cloud.motion +0 -0
- package/tools/lottie/generate.mjs +1209 -0
- package/tools/lottie/inter-glyphs.json +4416 -0
- package/tools/lottie/lucy-mark-calendar.motion +0 -0
- package/tools/lottie/lucy-mark-call.motion +0 -0
- package/tools/lottie/lucy-mark-connect.motion +0 -0
- package/tools/lottie/lucy-mark-details.motion +0 -0
- package/tools/lottie/lucy-mark-email.motion +0 -0
- package/tools/lottie/lucy-mark-message.motion +0 -0
- package/tools/lottie/lucy-mark-search.motion +0 -0
- package/tools/lottie/lucy-mark-think.motion +0 -0
- package/tools/lottie/lucy-mark-write.motion +0 -0
- package/tools/lottie/mark.json +1 -0
- package/tools/lottie/mine-none.motion +0 -0
- package/tools/lottie/mine-offline.motion +0 -0
- package/tools/lottie/mine-online.motion +0 -0
- package/tools/lottie/time-back.mjs +604 -0
- package/tools/sounds/render.mjs +730 -0
- package/tsconfig.json +17 -0
- package/README.md +0 -3
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_ANSWERS,
|
|
3
|
+
FILL_MS,
|
|
4
|
+
TIME,
|
|
5
|
+
TIME_KEYS,
|
|
6
|
+
autoAdvance,
|
|
7
|
+
buildChat,
|
|
8
|
+
cleanName,
|
|
9
|
+
controlsDelay,
|
|
10
|
+
lifeAdmin,
|
|
11
|
+
longDate,
|
|
12
|
+
nextStep,
|
|
13
|
+
odometerColumns,
|
|
14
|
+
reminderDates,
|
|
15
|
+
rollRows,
|
|
16
|
+
words,
|
|
17
|
+
yearsLabel,
|
|
18
|
+
type Answers,
|
|
19
|
+
} from '../welcome/flow';
|
|
20
|
+
|
|
21
|
+
const alex: Answers = { ...DEFAULT_ANSWERS, name: 'Alex' };
|
|
22
|
+
|
|
23
|
+
describe('lifeAdmin', () => {
|
|
24
|
+
it('matches the web home for the survey’s 169 minutes a day', () => {
|
|
25
|
+
expect(lifeAdmin(169)).toEqual({
|
|
26
|
+
min: 169,
|
|
27
|
+
backMin: 38,
|
|
28
|
+
week: '4.4',
|
|
29
|
+
yearHours: 229,
|
|
30
|
+
wakingDays: 64,
|
|
31
|
+
lifetimeYears: 9,
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('scales with every answer to the hours question', () => {
|
|
36
|
+
const rows = TIME_KEYS.map((k) => {
|
|
37
|
+
const n = lifeAdmin(TIME[k].min);
|
|
38
|
+
return [k, n.week, n.yearHours, n.wakingDays, n.lifetimeYears];
|
|
39
|
+
});
|
|
40
|
+
expect(rows).toEqual([
|
|
41
|
+
['h01', '1.2', 62, 17, 2],
|
|
42
|
+
['h12', '2.4', 125, 34, 5],
|
|
43
|
+
['h23', '4.4', 229, 64, 9],
|
|
44
|
+
['h3p', '5.5', 286, 80, 11],
|
|
45
|
+
]);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('never says zero years', () => {
|
|
49
|
+
expect(lifeAdmin(5).lifetimeYears).toBe(1);
|
|
50
|
+
expect(yearsLabel(1)).toBe('1 year');
|
|
51
|
+
expect(yearsLabel(9)).toBe('9 years');
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe('words', () => {
|
|
56
|
+
it('keeps the emphasis apart from the punctuation after it', () => {
|
|
57
|
+
expect(words('Nice to meet you, *Alex*.')).toEqual([
|
|
58
|
+
{ a: '', b: 'Nice' },
|
|
59
|
+
{ a: '', b: 'to' },
|
|
60
|
+
{ a: '', b: 'meet' },
|
|
61
|
+
{ a: '', b: 'you,' },
|
|
62
|
+
{ a: 'Alex', b: '.' },
|
|
63
|
+
]);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('carries emphasis across words', () => {
|
|
67
|
+
expect(words('take *64 days* of')).toEqual([
|
|
68
|
+
{ a: '', b: 'take' },
|
|
69
|
+
{ a: '64', b: '' },
|
|
70
|
+
{ a: 'days', b: '' },
|
|
71
|
+
{ a: '', b: 'of' },
|
|
72
|
+
]);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
describe('cleanName', () => {
|
|
77
|
+
it('keeps a capitalised first name', () => {
|
|
78
|
+
expect(cleanName(' sahil revankar ')).toBe('Sahil');
|
|
79
|
+
expect(cleanName('*maya*')).toBe('Maya');
|
|
80
|
+
expect(cleanName(' ')).toBe('');
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
describe('buildChat', () => {
|
|
85
|
+
it('opens with two lines from Lucy, the second after the first', () => {
|
|
86
|
+
const { lines, end } = buildChat('name', alex);
|
|
87
|
+
expect(lines.map((l) => [l.who, l.age])).toEqual([
|
|
88
|
+
['lucy', 0],
|
|
89
|
+
['lucy', 0],
|
|
90
|
+
]);
|
|
91
|
+
expect(lines[1].start).toBeGreaterThan(lines[0].start);
|
|
92
|
+
expect(end).toBeGreaterThan(lines[1].start);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('shows the answer, Lucy’s reply and the two lines before them', () => {
|
|
96
|
+
const { lines } = buildChat('pain2', { ...alex, pain: 'bills' });
|
|
97
|
+
expect(lines.map((l) => [l.who, l.age, l.plain])).toEqual([
|
|
98
|
+
['lucy', 2, 'Before we go on, have we met?'],
|
|
99
|
+
['lucy', 1, 'What eats most of your week?'],
|
|
100
|
+
['you', 0, 'Bills and subscriptions'],
|
|
101
|
+
['lucy', 0, 'Rates creep up and fees sneak in. I’ll make the calls that bring them down.'],
|
|
102
|
+
]);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('names them in orange', () => {
|
|
106
|
+
const hello = buildChat('hello', alex).lines.find((l) => l.age === 0);
|
|
107
|
+
expect(hello?.plain).toBe('Nice to meet you, Alex.');
|
|
108
|
+
expect(hello?.words.some((w) => w.a === 'Alex')).toBe(true);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('has nothing to say off the chat', () => {
|
|
112
|
+
expect(buildChat('bad', alex)).toEqual({ lines: [], end: 0 });
|
|
113
|
+
expect(controlsDelay('bad', alex)).toBe(0);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
describe('steps', () => {
|
|
118
|
+
it('skips the free week while there is no subscription', () => {
|
|
119
|
+
expect(nextStep('yay', { trial: false })).toBe('done');
|
|
120
|
+
expect(nextStep('yay', { trial: true })).toBe('pay');
|
|
121
|
+
expect(nextStep('pay', { trial: true })).toBe('remind');
|
|
122
|
+
expect(nextStep('done', { trial: true })).toBe('done');
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('moves on by itself only where nothing is asked', () => {
|
|
126
|
+
expect(autoAdvance('yay', alex, { trial: false })).toEqual({ to: 'done', after: 3000 });
|
|
127
|
+
expect(autoAdvance('hello', alex, { trial: false })?.to).toBe('signin');
|
|
128
|
+
expect(autoAdvance('time2', alex, { trial: false })?.to).toBe('review');
|
|
129
|
+
expect(autoAdvance('review', alex, { trial: false })?.after).toBeGreaterThan(FILL_MS);
|
|
130
|
+
expect(autoAdvance('name', alex, { trial: false })).toBeNull();
|
|
131
|
+
expect(autoAdvance('signin', alex, { trial: false })).toBeNull();
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
describe('the rolling numbers', () => {
|
|
136
|
+
it('runs up to the years and one past them', () => {
|
|
137
|
+
expect(rollRows(9)).toEqual({ rows: [3, 4, 5, 6, 7, 8, 9, 10], target: 6 });
|
|
138
|
+
expect(rollRows(2)).toEqual({ rows: [1, 2, 3], target: 1 });
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it('stops each odometer digit on its own figure', () => {
|
|
142
|
+
const cols = odometerColumns(229);
|
|
143
|
+
expect(cols.map((c) => c.stop)).toEqual([12, 22, 39]);
|
|
144
|
+
expect(cols.map((c) => c.digits[c.stop])).toEqual([2, 2, 9]);
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
describe('reminderDates', () => {
|
|
149
|
+
it('offers two and three days before a free week ends', () => {
|
|
150
|
+
const { ends, options } = reminderDates(new Date(2026, 10, 19));
|
|
151
|
+
expect(longDate(ends)).toBe('Thursday, November 26');
|
|
152
|
+
expect(options.map((o) => [o.daysBefore, longDate(o.date)])).toEqual([
|
|
153
|
+
[2, 'Tuesday, November 24'],
|
|
154
|
+
[3, 'Monday, November 23'],
|
|
155
|
+
]);
|
|
156
|
+
});
|
|
157
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { describe, expect, it } from '@jest/globals';
|
|
2
|
+
import { AUTO_ROUNDS, nextStage, pickComputer, sceneFor, workplaces } from '../chat/whereLucyWorks';
|
|
3
|
+
|
|
4
|
+
describe('workplaces', () => {
|
|
5
|
+
it('always offers the chat, her computer and yours, in that order', () => {
|
|
6
|
+
expect(workplaces(null).map((p) => p.id)).toStrictEqual(['chat', 'cloud', 'mine']);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('invites a person with no computer connected', () => {
|
|
10
|
+
const mine = workplaces(null)[2];
|
|
11
|
+
|
|
12
|
+
expect(mine.tab).toBe('Your computer');
|
|
13
|
+
expect(mine.body).toContain('Connect your computer');
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('names the computer once it is connected', () => {
|
|
17
|
+
const mine = workplaces({ name: 'MacBook Pro', online: true })[2];
|
|
18
|
+
|
|
19
|
+
expect(mine.tab).toBe('MacBook Pro');
|
|
20
|
+
expect(mine.titleEm).toBe('MacBook Pro');
|
|
21
|
+
expect(mine.body).toContain('asks you first');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('says how to bring an offline computer back', () => {
|
|
25
|
+
expect(workplaces({ name: 'MacBook Pro', online: false })[2].body).toContain('Open Yantra on it');
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
describe('nextStage', () => {
|
|
30
|
+
it('takes turns', () => {
|
|
31
|
+
expect(nextStage(1, 3)).toBe(1);
|
|
32
|
+
expect(nextStage(2, 3)).toBe(2);
|
|
33
|
+
expect(nextStage(3, 3)).toBe(0);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('rests after going around enough times', () => {
|
|
37
|
+
expect(nextStage(3 * AUTO_ROUNDS - 1, 3)).toBe(2);
|
|
38
|
+
expect(nextStage(3 * AUTO_ROUNDS, 3)).toBeNull();
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('pickComputer', () => {
|
|
43
|
+
it('is nothing when there are none', () => {
|
|
44
|
+
expect(pickComputer([])).toBeNull();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('prefers one that is online', () => {
|
|
48
|
+
expect(
|
|
49
|
+
pickComputer([
|
|
50
|
+
{ name: 'Old iMac', online: false, lastSeenAt: 900 },
|
|
51
|
+
{ name: 'MacBook Pro', online: true, lastSeenAt: 100 },
|
|
52
|
+
]),
|
|
53
|
+
).toStrictEqual({ name: 'MacBook Pro', online: true });
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('otherwise shows the one seen most recently', () => {
|
|
57
|
+
expect(
|
|
58
|
+
pickComputer([
|
|
59
|
+
{ name: 'Old iMac', online: false, lastSeenAt: 100 },
|
|
60
|
+
{ name: 'MacBook Pro', online: false, lastSeenAt: 900 },
|
|
61
|
+
]),
|
|
62
|
+
).toStrictEqual({ name: 'MacBook Pro', online: false });
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('ignores a row it cannot name', () => {
|
|
66
|
+
expect(pickComputer([{ name: ' ', online: true }, { online: true }])).toBeNull();
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
describe('sceneFor', () => {
|
|
71
|
+
it('plays the chat and her computer the same for everyone', () => {
|
|
72
|
+
expect(sceneFor('chat', null)).toBe('chat');
|
|
73
|
+
expect(sceneFor('cloud', { name: 'MacBook Pro', online: true })).toBe('cloud');
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it("draws the person's computer the way it is right now", () => {
|
|
77
|
+
expect(sceneFor('mine', null)).toBe('mine-none');
|
|
78
|
+
expect(sceneFor('mine', { name: 'MacBook Pro', online: true })).toBe('mine-online');
|
|
79
|
+
expect(sceneFor('mine', { name: 'MacBook Pro', online: false })).toBe('mine-offline');
|
|
80
|
+
});
|
|
81
|
+
});
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// yantraLinks.ts reads the stored Auth0 session (chat/auth.ts) and opens the browser: stub the native modules.
|
|
2
|
+
jest.mock(
|
|
3
|
+
'expo-secure-store',
|
|
4
|
+
() => ({ getItemAsync: jest.fn(), setItemAsync: jest.fn(), deleteItemAsync: jest.fn() }),
|
|
5
|
+
{ virtual: true },
|
|
6
|
+
);
|
|
7
|
+
jest.mock('@react-native-async-storage/async-storage', () => ({ getItem: jest.fn() }), { virtual: true });
|
|
8
|
+
jest.mock('expo-web-browser', () => ({ openBrowserAsync: jest.fn(), WebBrowserPresentationStyle: {} }), {
|
|
9
|
+
virtual: true,
|
|
10
|
+
});
|
|
11
|
+
jest.mock('react-native', () => ({ Platform: { OS: 'ios' }, Linking: { openURL: jest.fn() }, AppState: {} }), {
|
|
12
|
+
virtual: true,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// eslint-disable-next-line import/first
|
|
16
|
+
import { signedInYantraLink, type SignInDeps } from '../utils/yantraLinks';
|
|
17
|
+
|
|
18
|
+
const CONNECT = 'https://yantra.app/connect/google-calendar?via=surface';
|
|
19
|
+
const SIGNED_IN = 'https://yantra.app/auth/app-sign-in?ticket=t&next=%2Fconnect%2Fgoogle-calendar%3Fvia%3Dsurface';
|
|
20
|
+
|
|
21
|
+
function deps(answer: { ok?: boolean; url?: unknown } | Error = { url: SIGNED_IN }, over: Partial<SignInDeps> = {}) {
|
|
22
|
+
const fetch = jest.fn(async () => {
|
|
23
|
+
if (answer instanceof Error) throw answer;
|
|
24
|
+
return { ok: answer.ok ?? true, json: async () => ({ url: answer.url }) } as Response;
|
|
25
|
+
});
|
|
26
|
+
return {
|
|
27
|
+
fetch,
|
|
28
|
+
all: {
|
|
29
|
+
token: async () => 'id.token.jwt',
|
|
30
|
+
agentApp: async () => 'https://yantra.app',
|
|
31
|
+
fetch: fetch as unknown as typeof globalThis.fetch,
|
|
32
|
+
...over,
|
|
33
|
+
} as SignInDeps,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
describe('signedInYantraLink', () => {
|
|
38
|
+
it('asks Yantra for a sign-in link to the page, with the person’s ID token', async () => {
|
|
39
|
+
const { fetch, all } = deps();
|
|
40
|
+
|
|
41
|
+
await expect(signedInYantraLink(CONNECT, all)).resolves.toBe(SIGNED_IN);
|
|
42
|
+
expect(fetch).toHaveBeenCalledWith(
|
|
43
|
+
'https://yantra.app/resources/app-sign-in/start',
|
|
44
|
+
expect.objectContaining({
|
|
45
|
+
method: 'POST',
|
|
46
|
+
headers: { 'Content-Type': 'application/json', Authorization: 'Bearer id.token.jwt' },
|
|
47
|
+
body: JSON.stringify({ returnTo: '/connect/google-calendar?via=surface' }),
|
|
48
|
+
}),
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('signs in to the Yantra Lucy’s agent names (staging) too', async () => {
|
|
53
|
+
const staging = 'https://idefront.yantra-app-v1.cdebase.dev/account/connectors';
|
|
54
|
+
const { fetch, all } = deps(
|
|
55
|
+
{ url: 'https://idefront.yantra-app-v1.cdebase.dev/auth/app-sign-in?ticket=t' },
|
|
56
|
+
{ agentApp: async () => 'https://idefront.yantra-app-v1.cdebase.dev' },
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
await expect(signedInYantraLink(staging, all)).resolves.toContain('/auth/app-sign-in');
|
|
60
|
+
expect(fetch).toHaveBeenCalledTimes(1);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it.each([
|
|
64
|
+
['another site', 'https://evil.example/connect/google-calendar'],
|
|
65
|
+
['a look-alike Yantra host', 'https://idefront.evil.example/connect/google-calendar'],
|
|
66
|
+
['plain http', 'http://yantra.app/connect/google-calendar'],
|
|
67
|
+
['not a link', 'yantra.app/connect'],
|
|
68
|
+
])('never sends the token to %s: the link opens as it is', async (_name, url) => {
|
|
69
|
+
const { fetch, all } = deps();
|
|
70
|
+
|
|
71
|
+
await expect(signedInYantraLink(url, all)).resolves.toBe(url);
|
|
72
|
+
expect(fetch).not.toHaveBeenCalled();
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('opens the page as before when signed out here', async () => {
|
|
76
|
+
const { fetch, all } = deps(undefined, {
|
|
77
|
+
token: async () => {
|
|
78
|
+
throw new Error('signed-out');
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
await expect(signedInYantraLink(CONNECT, all)).resolves.toBe(CONNECT);
|
|
83
|
+
expect(fetch).not.toHaveBeenCalled();
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it.each([
|
|
87
|
+
['Yantra refuses the sign-in', { ok: false }],
|
|
88
|
+
['Yantra cannot be reached', new Error('offline')],
|
|
89
|
+
['the answer has no link', { url: 42 }],
|
|
90
|
+
['the link is for another site', { url: 'https://evil.example/auth/app-sign-in?ticket=t' }],
|
|
91
|
+
])('opens the page as before when %s', async (_name, answer) => {
|
|
92
|
+
const { all } = deps(answer as { ok?: boolean; url?: unknown } | Error);
|
|
93
|
+
|
|
94
|
+
await expect(signedInYantraLink(CONNECT, all)).resolves.toBe(CONNECT);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"edit","file":"/Applications/MAMP/htdocs/cdmbase-projects/cdmbase-github/clockbook/feature-mobile-app/clock-tik/packages-modules/clock-tik/mobile/tools/lottie/time-back.mjs","success":true,"timestamp":1794491324856,"sessionId":null}
|