@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.
Files changed (378) hide show
  1. package/.claude-flow/data/pending-insights.jsonl +43 -0
  2. package/.claude-flow/sessions/session-1794323376548.json +14 -0
  3. package/CHANGELOG.md +41 -0
  4. package/jest.config.cjs +22 -0
  5. package/lib/assets/home/loop-day.jpg +0 -0
  6. package/lib/assets/home/loop-day.mp4 +0 -0
  7. package/lib/assets/home/loop-time-back.jpg +0 -0
  8. package/lib/assets/home/loop-time-back.mp4 +0 -0
  9. package/lib/assets/home/loop-where.jpg +0 -0
  10. package/lib/assets/home/loop-where.mp4 +0 -0
  11. package/lib/assets/home/reel-gym.jpg +0 -0
  12. package/lib/assets/home/reel-gym.mp4 +0 -0
  13. package/lib/assets/home/reel-internet.jpg +0 -0
  14. package/lib/assets/home/reel-internet.mp4 +0 -0
  15. package/lib/assets/icon.png +0 -0
  16. package/lib/assets/lottie/.claude-flow/data/pending-insights.jsonl +1 -0
  17. package/lib/assets/lottie/lucy-mark-calendar.json +1827 -0
  18. package/lib/assets/lottie/lucy-mark-call.json +1470 -0
  19. package/lib/assets/lottie/lucy-mark-connect.json +2552 -0
  20. package/lib/assets/lottie/lucy-mark-details.json +1735 -0
  21. package/lib/assets/lottie/lucy-mark-email.json +1363 -0
  22. package/lib/assets/lottie/lucy-mark-message.json +1154 -0
  23. package/lib/assets/lottie/lucy-mark-search.json +1067 -0
  24. package/lib/assets/lottie/lucy-mark-think.json +1253 -0
  25. package/lib/assets/lottie/lucy-mark-write.json +1532 -0
  26. package/lib/assets/lottie/time-back.json +16458 -0
  27. package/lib/assets/lottie/where-lucy-works-chat.json +6170 -0
  28. package/lib/assets/lottie/where-lucy-works-cloud.json +10066 -0
  29. package/lib/assets/lottie/where-lucy-works-mine-none.json +2478 -0
  30. package/lib/assets/lottie/where-lucy-works-mine-offline.json +2373 -0
  31. package/lib/assets/lottie/where-lucy-works-mine-online.json +7881 -0
  32. package/lib/assets/sounds/hours-back.m4a +0 -0
  33. package/lib/assets/sounds/meet-lucy.m4a +0 -0
  34. package/lib/assets/sounds/power-on.m4a +0 -0
  35. package/lib/assets/sounds/wind-back.m4a +0 -0
  36. package/lib/assets/sounds/youre-in.m4a +0 -0
  37. package/lib/chat/agent.js +358 -0
  38. package/lib/chat/agent.js.map +1 -0
  39. package/lib/chat/appFront.js +32 -0
  40. package/lib/chat/appFront.js.map +1 -0
  41. package/lib/chat/auth.js +370 -0
  42. package/lib/chat/auth.js.map +1 -0
  43. package/lib/chat/chores.js +360 -0
  44. package/lib/chat/chores.js.map +1 -0
  45. package/lib/chat/connectors.js +45 -0
  46. package/lib/chat/connectors.js.map +1 -0
  47. package/lib/chat/jobs.js +223 -0
  48. package/lib/chat/jobs.js.map +1 -0
  49. package/lib/chat/lucyMotion.js +6 -0
  50. package/lib/chat/lucyMotion.js.map +1 -0
  51. package/lib/chat/protocol.js +111 -0
  52. package/lib/chat/protocol.js.map +1 -0
  53. package/lib/chat/results.js +133 -0
  54. package/lib/chat/results.js.map +1 -0
  55. package/lib/chat/store.js +81 -0
  56. package/lib/chat/store.js.map +1 -0
  57. package/lib/chat/useDictation.js +168 -0
  58. package/lib/chat/useDictation.js.map +1 -0
  59. package/lib/chat/useLucyChat.js +451 -0
  60. package/lib/chat/useLucyChat.js.map +1 -0
  61. package/lib/chat/useMyComputer.js +32 -0
  62. package/lib/chat/useMyComputer.js.map +1 -0
  63. package/lib/chat/whereLucyWorks.js +52 -0
  64. package/lib/chat/whereLucyWorks.js.map +1 -0
  65. package/lib/chat/workspace.js +124 -0
  66. package/lib/chat/workspace.js.map +1 -0
  67. package/lib/components/AreaShot.js +289 -0
  68. package/lib/components/AreaShot.js.map +1 -0
  69. package/lib/components/Backdrops.js +262 -0
  70. package/lib/components/Backdrops.js.map +1 -0
  71. package/lib/components/BottomSheet.js +61 -0
  72. package/lib/components/BottomSheet.js.map +1 -0
  73. package/lib/components/ChatSheets.js +429 -0
  74. package/lib/components/ChatSheets.js.map +1 -0
  75. package/lib/components/ConnectorLogo.js +91 -0
  76. package/lib/components/ConnectorLogo.js.map +1 -0
  77. package/lib/components/CustomDrawer.js +534 -0
  78. package/lib/components/CustomDrawer.js.map +1 -0
  79. package/lib/components/IdeasPane.js +394 -0
  80. package/lib/components/IdeasPane.js.map +1 -0
  81. package/lib/components/ImessageSheet.js +261 -0
  82. package/lib/components/ImessageSheet.js.map +1 -0
  83. package/lib/components/KeyboardAvoider.js +29 -0
  84. package/lib/components/KeyboardAvoider.js.map +1 -0
  85. package/lib/components/Logo.js +81 -0
  86. package/lib/components/Logo.js.map +1 -0
  87. package/lib/components/LucyWorking.js +67 -0
  88. package/lib/components/LucyWorking.js.map +1 -0
  89. package/lib/components/Markdown.js +260 -0
  90. package/lib/components/Markdown.js.map +1 -0
  91. package/lib/components/Media.js +93 -0
  92. package/lib/components/Media.js.map +1 -0
  93. package/lib/components/MessagesAppIcon.js +23 -0
  94. package/lib/components/MessagesAppIcon.js.map +1 -0
  95. package/lib/components/MicButton.js +71 -0
  96. package/lib/components/MicButton.js.map +1 -0
  97. package/lib/components/ResultCards.js +974 -0
  98. package/lib/components/ResultCards.js.map +1 -0
  99. package/lib/components/SignInPrompt.js +148 -0
  100. package/lib/components/SignInPrompt.js.map +1 -0
  101. package/lib/components/SignedOut.js +38 -0
  102. package/lib/components/SignedOut.js.map +1 -0
  103. package/lib/components/TalkToLucyHero.js +487 -0
  104. package/lib/components/TalkToLucyHero.js.map +1 -0
  105. package/lib/components/TalkToLucySheet.js +182 -0
  106. package/lib/components/TalkToLucySheet.js.map +1 -0
  107. package/lib/components/WhereLucyWorks.js +277 -0
  108. package/lib/components/WhereLucyWorks.js.map +1 -0
  109. package/lib/components/WorkspaceSection.js +271 -0
  110. package/lib/components/WorkspaceSection.js.map +1 -0
  111. package/lib/components/YantraMark.js +13 -0
  112. package/lib/components/YantraMark.js.map +1 -0
  113. package/lib/components/drawerHeader.js +38 -0
  114. package/lib/components/drawerHeader.js.map +1 -0
  115. package/lib/components/lottieInstalled.js +6 -0
  116. package/lib/components/lottieInstalled.js.map +1 -0
  117. package/lib/components/ui.js +550 -0
  118. package/lib/components/ui.js.map +1 -0
  119. package/lib/components/useSignOut.js +7 -0
  120. package/lib/components/useSignOut.js.map +1 -0
  121. package/lib/components/viewport.js +121 -0
  122. package/lib/components/viewport.js.map +1 -0
  123. package/lib/components/voiceDial.js +10 -0
  124. package/lib/components/voiceDial.js.map +1 -0
  125. package/lib/compute.js +157 -0
  126. package/lib/compute.js.map +1 -0
  127. package/lib/config/env-config.js +27 -0
  128. package/lib/config/env-config.js.map +1 -0
  129. package/lib/config/routes.js +15 -0
  130. package/lib/config/routes.js.map +1 -0
  131. package/lib/content.js +25 -0
  132. package/lib/content.js.map +1 -0
  133. package/lib/hooks/keyboardCover.js +39 -0
  134. package/lib/hooks/keyboardCover.js.map +1 -0
  135. package/lib/hooks/useKeyboard.js +121 -0
  136. package/lib/hooks/useKeyboard.js.map +1 -0
  137. package/lib/hooks/useReducedMotion.js +13 -0
  138. package/lib/hooks/useReducedMotion.js.map +1 -0
  139. package/lib/imessage/openMessages.js +25 -0
  140. package/lib/imessage/openMessages.js.map +1 -0
  141. package/lib/imessage/platform.js +12 -0
  142. package/lib/imessage/platform.js.map +1 -0
  143. package/lib/imessage/textLink.js +262 -0
  144. package/lib/imessage/textLink.js.map +1 -0
  145. package/lib/index.js +1 -0
  146. package/lib/index.js.map +1 -0
  147. package/lib/live/card.js +28 -0
  148. package/lib/live/card.js.map +1 -0
  149. package/lib/live/liveActivity.js +144 -0
  150. package/lib/live/liveActivity.js.map +1 -0
  151. package/lib/module.js +3 -0
  152. package/lib/module.js.map +1 -0
  153. package/lib/offer/BlackFridayOffer.js +378 -0
  154. package/lib/offer/BlackFridayOffer.js.map +1 -0
  155. package/lib/offer/blackFriday.js +78 -0
  156. package/lib/offer/blackFriday.js.map +1 -0
  157. package/lib/offer/parts.js +624 -0
  158. package/lib/offer/parts.js.map +1 -0
  159. package/lib/offer/state.js +63 -0
  160. package/lib/offer/state.js.map +1 -0
  161. package/lib/push/push.js +142 -0
  162. package/lib/push/push.js.map +1 -0
  163. package/lib/push/usePushNotifications.js +39 -0
  164. package/lib/push/usePushNotifications.js.map +1 -0
  165. package/lib/routes.json +175 -0
  166. package/lib/screens/Account/index.js +209 -0
  167. package/lib/screens/Account/index.js.map +1 -0
  168. package/lib/screens/Chat/index.js +710 -0
  169. package/lib/screens/Chat/index.js.map +1 -0
  170. package/lib/screens/Chores/index.js +18 -0
  171. package/lib/screens/Chores/index.js.map +1 -0
  172. package/lib/screens/Connectors/index.js +17 -0
  173. package/lib/screens/Connectors/index.js.map +1 -0
  174. package/lib/screens/History/index.js +380 -0
  175. package/lib/screens/History/index.js.map +1 -0
  176. package/lib/screens/Home/index.js +2715 -0
  177. package/lib/screens/Home/index.js.map +1 -0
  178. package/lib/screens/Home/media.js +25 -0
  179. package/lib/screens/Home/media.js.map +1 -0
  180. package/lib/screens/Welcome/index.js +1066 -0
  181. package/lib/screens/Welcome/index.js.map +1 -0
  182. package/lib/talk/talkToLucy.js +139 -0
  183. package/lib/talk/talkToLucy.js.map +1 -0
  184. package/lib/theme/colors.js +29 -0
  185. package/lib/theme/colors.js.map +1 -0
  186. package/lib/theme/fonts.js +17 -0
  187. package/lib/theme/fonts.js.map +1 -0
  188. package/lib/theme/muse.js +134 -0
  189. package/lib/theme/muse.js.map +1 -0
  190. package/lib/utils/links.js +54 -0
  191. package/lib/utils/links.js.map +1 -0
  192. package/lib/utils/yantraLinks.js +68 -0
  193. package/lib/utils/yantraLinks.js.map +1 -0
  194. package/lib/welcome/flow.js +375 -0
  195. package/lib/welcome/flow.js.map +1 -0
  196. package/lib/welcome/haptics.js +125 -0
  197. package/lib/welcome/haptics.js.map +1 -0
  198. package/lib/welcome/parts.js +1996 -0
  199. package/lib/welcome/parts.js.map +1 -0
  200. package/lib/welcome/powerOn.js +29 -0
  201. package/lib/welcome/powerOn.js.map +1 -0
  202. package/lib/welcome/seen.js +41 -0
  203. package/lib/welcome/seen.js.map +1 -0
  204. package/lib/welcome/sound.js +110 -0
  205. package/lib/welcome/sound.js.map +1 -0
  206. package/package.json +66 -5
  207. package/rollup.config.mjs +42 -0
  208. package/src/.claude-flow/data/pending-insights.jsonl +19 -0
  209. package/src/.claude-flow/sessions/session-1795013028422.json +14 -0
  210. package/src/__tests__/auth.test.ts +94 -0
  211. package/src/__tests__/blackFriday.test.ts +75 -0
  212. package/src/__tests__/cardTokens.test.ts +77 -0
  213. package/src/__tests__/chores.test.ts +188 -0
  214. package/src/__tests__/choresList.test.ts +100 -0
  215. package/src/__tests__/connectLink.test.ts +21 -0
  216. package/src/__tests__/content.test.ts +54 -0
  217. package/src/__tests__/dictation.test.ts +186 -0
  218. package/src/__tests__/envConfig.test.ts +14 -0
  219. package/src/__tests__/haptics.test.ts +202 -0
  220. package/src/__tests__/jobs.test.ts +130 -0
  221. package/src/__tests__/keyboardCover.test.ts +84 -0
  222. package/src/__tests__/liveCard.test.ts +39 -0
  223. package/src/__tests__/lockedPhone.test.ts +355 -0
  224. package/src/__tests__/lucyMotion.test.ts +34 -0
  225. package/src/__tests__/platform.test.ts +32 -0
  226. package/src/__tests__/powerOn.test.ts +62 -0
  227. package/src/__tests__/protocol.test.ts +125 -0
  228. package/src/__tests__/push.test.ts +111 -0
  229. package/src/__tests__/results.test.ts +256 -0
  230. package/src/__tests__/sound.test.ts +248 -0
  231. package/src/__tests__/talkToLucy.test.ts +205 -0
  232. package/src/__tests__/textLink.test.ts +91 -0
  233. package/src/__tests__/voiceDial.test.ts +53 -0
  234. package/src/__tests__/welcomeFlow.test.ts +157 -0
  235. package/src/__tests__/whereLucyWorks.test.ts +81 -0
  236. package/src/__tests__/yantraLinks.test.ts +96 -0
  237. package/src/assets/home/loop-day.jpg +0 -0
  238. package/src/assets/home/loop-day.mp4 +0 -0
  239. package/src/assets/home/loop-time-back.jpg +0 -0
  240. package/src/assets/home/loop-time-back.mp4 +0 -0
  241. package/src/assets/home/loop-where.jpg +0 -0
  242. package/src/assets/home/loop-where.mp4 +0 -0
  243. package/src/assets/home/reel-gym.jpg +0 -0
  244. package/src/assets/home/reel-gym.mp4 +0 -0
  245. package/src/assets/home/reel-internet.jpg +0 -0
  246. package/src/assets/home/reel-internet.mp4 +0 -0
  247. package/src/assets/icon.png +0 -0
  248. package/src/assets/lottie/.claude-flow/data/pending-insights.jsonl +1 -0
  249. package/src/assets/lottie/lucy-mark-calendar.json +1827 -0
  250. package/src/assets/lottie/lucy-mark-call.json +1470 -0
  251. package/src/assets/lottie/lucy-mark-connect.json +2552 -0
  252. package/src/assets/lottie/lucy-mark-details.json +1735 -0
  253. package/src/assets/lottie/lucy-mark-email.json +1363 -0
  254. package/src/assets/lottie/lucy-mark-message.json +1154 -0
  255. package/src/assets/lottie/lucy-mark-search.json +1067 -0
  256. package/src/assets/lottie/lucy-mark-think.json +1253 -0
  257. package/src/assets/lottie/lucy-mark-write.json +1532 -0
  258. package/src/assets/lottie/time-back.json +16458 -0
  259. package/src/assets/lottie/where-lucy-works-chat.json +6170 -0
  260. package/src/assets/lottie/where-lucy-works-cloud.json +10066 -0
  261. package/src/assets/lottie/where-lucy-works-mine-none.json +2478 -0
  262. package/src/assets/lottie/where-lucy-works-mine-offline.json +2373 -0
  263. package/src/assets/lottie/where-lucy-works-mine-online.json +7881 -0
  264. package/src/assets/sounds/hours-back.m4a +0 -0
  265. package/src/assets/sounds/meet-lucy.m4a +0 -0
  266. package/src/assets/sounds/power-on.m4a +0 -0
  267. package/src/assets/sounds/wind-back.m4a +0 -0
  268. package/src/assets/sounds/youre-in.m4a +0 -0
  269. package/src/chat/.claude-flow/data/pending-insights.jsonl +1 -0
  270. package/src/chat/agent.ts +376 -0
  271. package/src/chat/appFront.ts +39 -0
  272. package/src/chat/auth.ts +433 -0
  273. package/src/chat/chores.ts +394 -0
  274. package/src/chat/connectors.ts +75 -0
  275. package/src/chat/jobs.ts +228 -0
  276. package/src/chat/lucyMotion.ts +33 -0
  277. package/src/chat/protocol.ts +192 -0
  278. package/src/chat/results.ts +224 -0
  279. package/src/chat/store.ts +87 -0
  280. package/src/chat/useDictation.ts +201 -0
  281. package/src/chat/useLucyChat.ts +458 -0
  282. package/src/chat/useMyComputer.ts +41 -0
  283. package/src/chat/whereLucyWorks.ts +97 -0
  284. package/src/chat/workspace.ts +127 -0
  285. package/src/components/.claude-flow/data/pending-insights.jsonl +3 -0
  286. package/src/components/AreaShot.tsx +239 -0
  287. package/src/components/Backdrops.tsx +323 -0
  288. package/src/components/BottomSheet.tsx +96 -0
  289. package/src/components/ChatSheets.tsx +565 -0
  290. package/src/components/ConnectorLogo.tsx +116 -0
  291. package/src/components/CustomDrawer.tsx +526 -0
  292. package/src/components/IdeasPane.tsx +318 -0
  293. package/src/components/ImessageSheet.tsx +280 -0
  294. package/src/components/KeyboardAvoider.tsx +45 -0
  295. package/src/components/Logo.tsx +97 -0
  296. package/src/components/LucyWorking.tsx +122 -0
  297. package/src/components/Markdown.tsx +219 -0
  298. package/src/components/Media.tsx +173 -0
  299. package/src/components/MessagesAppIcon.tsx +51 -0
  300. package/src/components/MicButton.tsx +92 -0
  301. package/src/components/ResultCards.tsx +1067 -0
  302. package/src/components/SignInPrompt.tsx +182 -0
  303. package/src/components/SignedOut.tsx +47 -0
  304. package/src/components/TalkToLucyHero.tsx +540 -0
  305. package/src/components/TalkToLucySheet.tsx +208 -0
  306. package/src/components/VoiceOrb.tsx +364 -0
  307. package/src/components/WhereLucyWorks.tsx +261 -0
  308. package/src/components/WorkspaceSection.tsx +307 -0
  309. package/src/components/YantraMark.tsx +30 -0
  310. package/src/components/drawerHeader.tsx +46 -0
  311. package/src/components/kit.tsx +309 -0
  312. package/src/components/lottieInstalled.ts +7 -0
  313. package/src/components/ui.tsx +700 -0
  314. package/src/components/useSignOut.ts +21 -0
  315. package/src/components/viewport.tsx +166 -0
  316. package/src/components/voiceDial.ts +45 -0
  317. package/src/compute.ts +168 -0
  318. package/src/config/env-config.ts +50 -0
  319. package/src/config/routes.ts +28 -0
  320. package/src/content.ts +217 -0
  321. package/src/hooks/keyboardCover.ts +70 -0
  322. package/src/hooks/useKeyboard.ts +135 -0
  323. package/src/hooks/useReducedMotion.ts +19 -0
  324. package/src/imessage/openMessages.ts +53 -0
  325. package/src/imessage/platform.ts +32 -0
  326. package/src/imessage/textLink.ts +307 -0
  327. package/src/index.ts +24 -0
  328. package/src/live/card.ts +62 -0
  329. package/src/live/liveActivity.ts +192 -0
  330. package/src/module.ts +8 -0
  331. package/src/offer/BlackFridayOffer.tsx +394 -0
  332. package/src/offer/blackFriday.ts +109 -0
  333. package/src/offer/parts.tsx +650 -0
  334. package/src/offer/state.ts +78 -0
  335. package/src/push/push.ts +171 -0
  336. package/src/push/usePushNotifications.ts +47 -0
  337. package/src/screens/Account/index.tsx +310 -0
  338. package/src/screens/Chat/.claude-flow/data/pending-insights.jsonl +4 -0
  339. package/src/screens/Chat/index.tsx +891 -0
  340. package/src/screens/Chores/index.tsx +35 -0
  341. package/src/screens/Connectors/index.tsx +35 -0
  342. package/src/screens/History/index.tsx +346 -0
  343. package/src/screens/Home/index.tsx +2776 -0
  344. package/src/screens/Home/media.ts +31 -0
  345. package/src/screens/Welcome/index.tsx +1182 -0
  346. package/src/talk/talkToLucy.ts +187 -0
  347. package/src/theme/colors.ts +38 -0
  348. package/src/theme/fonts.ts +30 -0
  349. package/src/theme/muse.ts +86 -0
  350. package/src/utils/links.ts +84 -0
  351. package/src/utils/yantraLinks.ts +94 -0
  352. package/src/welcome/flow.ts +418 -0
  353. package/src/welcome/haptics.ts +179 -0
  354. package/src/welcome/parts.tsx +2160 -0
  355. package/src/welcome/powerOn.ts +84 -0
  356. package/src/welcome/seen.ts +68 -0
  357. package/src/welcome/sound.ts +173 -0
  358. package/tools/lottie/chat.motion +0 -0
  359. package/tools/lottie/cloud.motion +0 -0
  360. package/tools/lottie/generate.mjs +1209 -0
  361. package/tools/lottie/inter-glyphs.json +4416 -0
  362. package/tools/lottie/lucy-mark-calendar.motion +0 -0
  363. package/tools/lottie/lucy-mark-call.motion +0 -0
  364. package/tools/lottie/lucy-mark-connect.motion +0 -0
  365. package/tools/lottie/lucy-mark-details.motion +0 -0
  366. package/tools/lottie/lucy-mark-email.motion +0 -0
  367. package/tools/lottie/lucy-mark-message.motion +0 -0
  368. package/tools/lottie/lucy-mark-search.motion +0 -0
  369. package/tools/lottie/lucy-mark-think.motion +0 -0
  370. package/tools/lottie/lucy-mark-write.motion +0 -0
  371. package/tools/lottie/mark.json +1 -0
  372. package/tools/lottie/mine-none.motion +0 -0
  373. package/tools/lottie/mine-offline.motion +0 -0
  374. package/tools/lottie/mine-online.motion +0 -0
  375. package/tools/lottie/time-back.mjs +604 -0
  376. package/tools/sounds/render.mjs +730 -0
  377. package/tsconfig.json +17 -0
  378. package/README.md +0 -3
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Sign out where you are, with no screen in between.
3
+ *
4
+ * The auth package's Logout route is a modal whose spinner, once signed out, calls `navigate('MainStack')`. Under React
5
+ * Navigation 7 `navigate` no longer goes back to a screen already in the stack, so that pushed a second Home over the
6
+ * modal: a Home card on a grey sheet, and the sheet again when the card went. Here the same logout runs (the action the
7
+ * Logout screen dispatches: the auth instance logs out and the Apollo cache is reset), then the caller goes to Home.
8
+ * The package's useLogout is not used: it goes on to LOGOUT_REDIRECT_PATH (the Login screen), and Clockbook works
9
+ * signed out.
10
+ */
11
+ import { useCallback } from 'react';
12
+ import { useDispatch } from 'react-redux';
13
+ import { loggedOutInProgress } from '@adminide-stack/user-auth0-client';
14
+
15
+ export function useSignOut(then?: () => void): () => void {
16
+ const dispatch = useDispatch();
17
+ return useCallback(() => {
18
+ dispatch(loggedOutInProgress());
19
+ then?.();
20
+ }, [dispatch, then]);
21
+ }
@@ -0,0 +1,166 @@
1
+ /**
2
+ * What part of a scrolling page is on screen, without asking the native side while it scrolls.
3
+ *
4
+ * A view measures where it sits on the page once (measureLayout against the page's content, on mount and whenever
5
+ * the content resizes); from then on "is it on screen" is arithmetic on the scroll offset the ScrollView reports.
6
+ * This replaced per-component measureInWindow polling (15 timers, ~40 native calls a second), which is what made
7
+ * Home stutter on Android.
8
+ */
9
+ import React, { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
10
+ import type { LayoutChangeEvent, NativeScrollEvent, NativeSyntheticEvent, View } from 'react-native';
11
+
12
+ type Listener = () => void;
13
+
14
+ interface Viewport {
15
+ /** The page's content, every tracked view is measured against it. */
16
+ contentRef: React.RefObject<View | null>;
17
+ scrollY: () => number;
18
+ height: () => number;
19
+ /** Fires after a scroll moved or the page resized (coalesced to one per frame). */
20
+ subscribe: (listener: Listener) => () => void;
21
+ /** Fires when the content's size changed, so positions must be measured again. */
22
+ subscribeLayout: (listener: Listener) => () => void;
23
+ }
24
+
25
+ const ViewportContext = createContext<Viewport | null>(null);
26
+
27
+ /** Owns the page's scroll position; spread `handlers` on the ScrollView and wrap its children in `contentRef`. */
28
+ export function useViewportController() {
29
+ const contentRef = useRef<View>(null);
30
+ const y = useRef(0);
31
+ const h = useRef(0);
32
+ const listeners = useRef(new Set<Listener>()).current;
33
+ const layoutListeners = useRef(new Set<Listener>()).current;
34
+ const frame = useRef<number | null>(null);
35
+
36
+ const notify = useCallback(() => {
37
+ if (frame.current !== null) return;
38
+ frame.current = requestAnimationFrame(() => {
39
+ frame.current = null;
40
+ listeners.forEach((l) => l());
41
+ });
42
+ }, [listeners]);
43
+
44
+ const viewport = useMemo<Viewport>(
45
+ () => ({
46
+ contentRef,
47
+ scrollY: () => y.current,
48
+ height: () => h.current,
49
+ subscribe: (l) => {
50
+ listeners.add(l);
51
+ return () => listeners.delete(l);
52
+ },
53
+ subscribeLayout: (l) => {
54
+ layoutListeners.add(l);
55
+ return () => layoutListeners.delete(l);
56
+ },
57
+ }),
58
+ [listeners, layoutListeners],
59
+ );
60
+
61
+ useEffect(
62
+ () => () => {
63
+ if (frame.current !== null) cancelAnimationFrame(frame.current);
64
+ },
65
+ [],
66
+ );
67
+
68
+ const handlers = useMemo(
69
+ () => ({
70
+ scrollEventThrottle: 32,
71
+ onScroll: (e: NativeSyntheticEvent<NativeScrollEvent>) => {
72
+ y.current = e.nativeEvent.contentOffset.y;
73
+ notify();
74
+ },
75
+ onLayout: (e: LayoutChangeEvent) => {
76
+ h.current = e.nativeEvent.layout.height;
77
+ notify();
78
+ },
79
+ onContentSizeChange: () => {
80
+ layoutListeners.forEach((l) => l());
81
+ },
82
+ }),
83
+ [notify, layoutListeners],
84
+ );
85
+
86
+ return { viewport, handlers, contentRef };
87
+ }
88
+
89
+ export function ViewportProvider({ value, children }: { value: Viewport; children: React.ReactNode }) {
90
+ return <ViewportContext.Provider value={value}>{children}</ViewportContext.Provider>;
91
+ }
92
+
93
+ /**
94
+ * Whether `ref` is on screen: at least `minFraction` of it inside the viewport (or, with `edge`, its top above that
95
+ * fraction of the screen's height). `undefined` until it has been measured. Outside a ViewportProvider it is always
96
+ * on screen. With `once`, it stops listening after the first time it is on screen.
97
+ */
98
+ export function useInView(
99
+ ref: React.RefObject<View | null>,
100
+ {
101
+ enabled = true,
102
+ minFraction = 1 / 3,
103
+ edge,
104
+ once = false,
105
+ }: {
106
+ enabled?: boolean;
107
+ minFraction?: number;
108
+ edge?: number;
109
+ once?: boolean;
110
+ } = {},
111
+ ): boolean | undefined {
112
+ const viewport = useContext(ViewportContext);
113
+ const [inView, setInView] = useState<boolean | undefined>(viewport ? undefined : true);
114
+ const pos = useRef<{ top: number; height: number } | null>(null);
115
+ const done = useRef(false);
116
+
117
+ useEffect(() => {
118
+ if (!viewport) return undefined;
119
+ if (!enabled) {
120
+ setInView(false);
121
+ return undefined;
122
+ }
123
+ let alive = true;
124
+ const check = () => {
125
+ const p = pos.current;
126
+ const vh = viewport.height();
127
+ if (!p || !vh || done.current) return;
128
+ const top = viewport.scrollY();
129
+ let next: boolean;
130
+ if (edge !== undefined) {
131
+ next = p.top < top + vh * edge && p.top + p.height > top;
132
+ } else {
133
+ const visible = Math.min(p.top + p.height, top + vh) - Math.max(p.top, top);
134
+ next = p.height > 0 && visible >= Math.min(p.height, vh) * minFraction;
135
+ }
136
+ setInView((prev) => (prev === next ? prev : next));
137
+ if (next && once) done.current = true;
138
+ };
139
+ const measure = () => {
140
+ const node = ref.current;
141
+ const content = viewport.contentRef.current;
142
+ if (!node || !content) return;
143
+ node.measureLayout(
144
+ content as never,
145
+ (_x, y, _w, height) => {
146
+ if (!alive) return;
147
+ pos.current = { top: y, height };
148
+ check();
149
+ },
150
+ () => undefined,
151
+ );
152
+ };
153
+ // After this frame's layout.
154
+ const first = requestAnimationFrame(measure);
155
+ const offScroll = viewport.subscribe(check);
156
+ const offLayout = viewport.subscribeLayout(measure);
157
+ return () => {
158
+ alive = false;
159
+ cancelAnimationFrame(first);
160
+ offScroll();
161
+ offLayout();
162
+ };
163
+ }, [viewport, ref, enabled, minFraction, edge, once]);
164
+
165
+ return inView;
166
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * The arithmetic of Home's voice orb (components/VoiceOrb.tsx): its dial of sixty ticks, and the light that runs round
3
+ * them while Lucy listens. Kept apart from the drawing so it can be tested.
4
+ */
5
+
6
+ export const TICKS = 60;
7
+ /** How far behind the running light's head its tail still glows, as a share of the dial. */
8
+ export const TAIL = 0.28;
9
+
10
+ export interface DialTick {
11
+ i: number;
12
+ /** Clockwise from twelve. */
13
+ deg: number;
14
+ /** Every fifth tick, as a clock marks its hours. */
15
+ major: boolean;
16
+ }
17
+
18
+ export function dialTicks(count = TICKS): DialTick[] {
19
+ return Array.from({ length: count }, (_, i) => ({ i, deg: (360 / count) * i, major: i % 5 === 0 }));
20
+ }
21
+
22
+ /** How bright tick `i` is while the light's head is at `phase` (0 to 1, clockwise from twelve). */
23
+ export function tailAt(i: number, phase: number, count = TICKS, tail = TAIL): number {
24
+ const behind = (((phase - i / count) % 1) + 1) % 1;
25
+ return behind <= tail ? 1 - behind / tail : 0;
26
+ }
27
+
28
+ /**
29
+ * tailAt as an Animated interpolation's ranges, for one tick: dark until the head reaches it, full as it passes, out by
30
+ * the tail's end. A tail that runs on past twelve is still glowing as the next lap begins.
31
+ */
32
+ export function tailRange(i: number, count = TICKS, tail = TAIL): { inputRange: number[]; outputRange: number[] } {
33
+ const p = i / count;
34
+ const e = 1e-4;
35
+ const points: [number, number][] = [];
36
+ if (p + tail <= 1) {
37
+ if (p > 0) points.push([0, 0], [p - e, 0]);
38
+ points.push([p, 1], [p + tail, 0]);
39
+ if (p + tail < 1) points.push([1, 0]);
40
+ } else {
41
+ const atTwelve = 1 - (1 - p) / tail;
42
+ points.push([0, atTwelve], [p + tail - 1, 0], [p - e, 0], [p, 1], [1, atTwelve]);
43
+ }
44
+ return { inputRange: points.map(([x]) => x), outputRange: points.map(([, y]) => y) };
45
+ }
package/src/compute.ts ADDED
@@ -0,0 +1,168 @@
1
+ /* eslint-disable import/no-extraneous-dependencies */
2
+ import { getFilteredRoutes } from '@common-stack/client-react/lib/utils/filteredRoutes.js';
3
+ import type { IRouteModule } from '@common-stack/core';
4
+
5
+ /**
6
+ * Clockbook's screens. Home mirrors the web home page (browser src/pages/Home, the `/` route).
7
+ * Paths under `/l/` go into the drawer layout (MainStack.Layout.<Name>); the rest into the root
8
+ * stack (MainStack.<Name>). Navigator names are listed in config/routes.ts; keep both in step.
9
+ */
10
+ export const clockbookMobilePageStore: IRouteModule[] = [
11
+ {
12
+ key: 'home',
13
+ path: '/l/home',
14
+ name: 'Home',
15
+ exact: true,
16
+ index: true,
17
+ priority: 1,
18
+ auth: false,
19
+ menu_position: 'side',
20
+ component: () => import('./screens/Home'),
21
+ props: {
22
+ initialParams: {},
23
+ options: {
24
+ title: 'Clockbook',
25
+ drawerLabel: 'Home',
26
+ headerTintColor: '#1A1714',
27
+ headerTitleStyle: { fontWeight: 'bold' },
28
+ headerTitleAlign: 'left',
29
+ headerStyle: { backgroundColor: '#FFFAF5' },
30
+ headerShadowVisible: false,
31
+ gestureEnabled: false,
32
+ animation: 'fade',
33
+ freezeOnBlur: true,
34
+ },
35
+ },
36
+ },
37
+ {
38
+ // Lucy's chores, in the drawer.
39
+ key: 'chores',
40
+ path: '/l/chores',
41
+ name: 'Chores',
42
+ exact: true,
43
+ priority: 4,
44
+ auth: false,
45
+ menu_position: 'side',
46
+ component: () => import('./screens/Chores'),
47
+ props: {
48
+ initialParams: {},
49
+ options: {
50
+ title: 'Lucy’s chores',
51
+ drawerLabel: 'Lucy’s chores',
52
+ headerStyle: { backgroundColor: '#FFFAF5' },
53
+ headerShadowVisible: false,
54
+ gestureEnabled: false,
55
+ animation: 'fade',
56
+ freezeOnBlur: true,
57
+ },
58
+ },
59
+ },
60
+ {
61
+ // The apps Lucy can use, in the drawer.
62
+ key: 'connectors',
63
+ path: '/l/connectors',
64
+ name: 'Connectors',
65
+ exact: true,
66
+ priority: 5,
67
+ auth: false,
68
+ menu_position: 'side',
69
+ component: () => import('./screens/Connectors'),
70
+ props: {
71
+ initialParams: {},
72
+ options: {
73
+ title: 'Connectors',
74
+ drawerLabel: 'Connectors',
75
+ headerStyle: { backgroundColor: '#FFFAF5' },
76
+ headerShadowVisible: false,
77
+ gestureEnabled: false,
78
+ animation: 'fade',
79
+ freezeOnBlur: true,
80
+ },
81
+ },
82
+ },
83
+ {
84
+ // Lucy's chat, a drawer screen (it draws its own header, with the menu button).
85
+ key: 'chat',
86
+ path: '/l/chat',
87
+ name: 'Chat',
88
+ exact: true,
89
+ priority: 2,
90
+ auth: false,
91
+ menu_position: 'side',
92
+ component: () => import('./screens/Chat'),
93
+ props: {
94
+ initialParams: {},
95
+ options: {
96
+ title: 'Lucy',
97
+ drawerLabel: 'Chat',
98
+ headerShown: false,
99
+ gestureEnabled: false,
100
+ animation: 'fade',
101
+ },
102
+ },
103
+ },
104
+ {
105
+ // Who is signed in and what they have with Lucy; opened from the drawer's profile card.
106
+ key: 'account',
107
+ path: '/account',
108
+ name: 'Account',
109
+ exact: true,
110
+ priority: 3,
111
+ auth: false,
112
+ component: () => import('./screens/Account'),
113
+ props: {
114
+ initialParams: {},
115
+ options: {
116
+ title: 'Account',
117
+ headerShown: false,
118
+ gestureEnabled: true,
119
+ animation: 'slide_from_right',
120
+ },
121
+ },
122
+ },
123
+ {
124
+ // Lucy's past chats; opened from the chat's header.
125
+ key: 'history',
126
+ path: '/history',
127
+ name: 'History',
128
+ exact: true,
129
+ priority: 6,
130
+ auth: false,
131
+ component: () => import('./screens/History'),
132
+ props: {
133
+ initialParams: {},
134
+ options: {
135
+ title: 'History',
136
+ headerShown: false,
137
+ gestureEnabled: true,
138
+ animation: 'slide_from_right',
139
+ },
140
+ },
141
+ },
142
+ {
143
+ // The welcome, once per phone: Home opens it on first launch (welcome/seen.ts remembers it was seen).
144
+ key: 'welcome',
145
+ path: '/welcome',
146
+ name: 'Welcome',
147
+ exact: true,
148
+ priority: 7,
149
+ auth: false,
150
+ component: () => import('./screens/Welcome'),
151
+ props: {
152
+ initialParams: {},
153
+ options: {
154
+ title: 'Welcome',
155
+ headerShown: false,
156
+ gestureEnabled: false,
157
+ animation: 'fade',
158
+ },
159
+ },
160
+ },
161
+ ];
162
+
163
+ const selectedRoutes = ['home', 'chores', 'connectors', 'chat', 'account', 'history', 'welcome'];
164
+
165
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
166
+ const filteredRoutes = getFilteredRoutes(clockbookMobilePageStore as any, selectedRoutes);
167
+
168
+ export { filteredRoutes };
@@ -0,0 +1,50 @@
1
+ import { str, cleanEnv } from 'envalid';
2
+
3
+ // The app (portable-devices/mobile config/public-config.js) publishes its @env values on process.APP_ENV.
4
+ const env = (process as { APP_ENV?: NodeJS.ProcessEnv; env?: NodeJS.ProcessEnv }).APP_ENV || process.env;
5
+
6
+ export const config = cleanEnv(env, {
7
+ APP_NAME: str({ default: 'Clockbook' }),
8
+ /** The Clockbook app: chores open its new-chat page with the chore pre-typed; Sign in opens it. */
9
+ APP_URL: str({ default: 'https://clockbook.com' }),
10
+ /**
11
+ * Clockbook for business (the web page's VITE_BUSINESS_URL). Empty hides every business link,
12
+ * as on the web page.
13
+ */
14
+ BUSINESS_URL: str({ default: 'https://clockbook.com/business' }),
15
+ /** The Yantra app Clockbook runs on (the web page's YANTRA_APP_URL): "For business" and iMessage texting open it. */
16
+ YANTRA_APP_URL: str({ default: 'https://yantra.app' }),
17
+ /**
18
+ * The service a person's own computer links to, so the chat can show it once it is connected: our own address
19
+ * (kube-orchestration computer-link-proxy) on the same plane as the agent below, never the Worker's Cloudflare one.
20
+ */
21
+ COMPUTER_LINK_URL: str({
22
+ default:
23
+ (env.NODE_ENV || 'production') === 'production'
24
+ ? 'https://computer-link.yantra.app'
25
+ : 'https://computer-link.cdebase.dev',
26
+ }),
27
+ /**
28
+ * Lucy's agent (the web chat's cdecli agent): the native chat opens its sessions and streams its turns here. It names
29
+ * the Yantra backend it trusts at GET /v1/auth/context, and that is where the chat's token is minted.
30
+ */
31
+ CDECLI_AGENT_URL: str({
32
+ default:
33
+ (env.NODE_ENV || 'production') === 'production'
34
+ ? 'https://cdecli-agent.yantra.app'
35
+ : 'https://cdecli-agent.cdebase.dev',
36
+ }),
37
+ /**
38
+ * The kind of build, from eas.json: "preview" for its test builds (the development, preview and previewSubmit
39
+ * profiles), "production" for the store's. Empty when the build didn't say.
40
+ */
41
+ RELEASE_CHANNEL: str({ default: '' }),
42
+ });
43
+
44
+ /**
45
+ * Builds made to be checked: development builds, and eas.json's test builds (RELEASE_CHANNEL "preview"). Never a store
46
+ * build, nor one that didn't say what it is.
47
+ */
48
+ export function isTestBuild(build: { dev: boolean; channel: string }): boolean {
49
+ return build.dev || build.channel === 'preview';
50
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Navigator names the generated navigation gives the routes in compute.ts: routes whose
3
+ * path starts with `/l/` live in the drawer, under `MainStack.Layout`; the rest directly under `MainStack`.
4
+ * Keep the two files in step.
5
+ */
6
+ /**
7
+ * A drawer screen reached from a screen pushed over the drawer (Account, History): the drawer is the root stack's
8
+ * `MainStack` screen, so the route goes through it (React Navigation's nested navigate).
9
+ */
10
+ export function drawerRoute(screen: string, params?: object): [string, object] {
11
+ return ['MainStack', { screen, params }];
12
+ }
13
+
14
+ export const CLOCKBOOK_ROUTES = {
15
+ HOME: 'MainStack.Layout.Home',
16
+ /** Lucy's chores, a drawer screen. */
17
+ CHORES: 'MainStack.Layout.Chores',
18
+ /** The apps Lucy can use, a drawer screen. */
19
+ CONNECTORS: 'MainStack.Layout.Connectors',
20
+ /** Lucy's chat, a drawer screen. Params: `prompt` (a chore to send now) and `at`. */
21
+ CHAT: 'MainStack.Layout.Chat',
22
+ /** Account: profile, Lucy's chores, connected apps, help, sign out. Opened from the drawer's profile card. */
23
+ ACCOUNT: 'MainStack.Account',
24
+ /** Lucy's past chats, pushed from the chat's header. */
25
+ HISTORY: 'MainStack.History',
26
+ /** The welcome, opened by Home on a phone's first launch. */
27
+ WELCOME: 'MainStack.Welcome',
28
+ } as const;