@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 @@
|
|
|
1
|
+
{"version":3,"file":"useKeyboard.js","sources":["../../src/hooks/useKeyboard.ts"],"sourcesContent":["/**\n * Where the on-screen keyboard is. iOS says so as it starts to move (`keyboardWill…`), Android only once it has\n * (`keyboardDid…`: it sends no \"will\" events).\n *\n * Each screen makes its own room, with `useKeyboardCover`: on Android the system sometimes has made it already (see\n * `keyboardCover`).\n */\nimport { useCallback, useEffect, useRef, useState, type RefObject } from 'react';\nimport { Dimensions, Keyboard, Platform, type KeyboardEvent, type LayoutChangeEvent, type View } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { keyboardCover, RestHeight, windowShrinksGuess } from './keyboardCover';\n\nexport interface KeyboardState {\n /** The keyboard is up. */\n shown: boolean;\n /** How tall it is, in points; 0 when it is down. */\n height: number;\n /** Where its top edge sits on the screen, in points; null when it is down. */\n top: number | null;\n /** How long it takes to move (iOS; 0 on Android). */\n duration: number;\n}\n\nconst DOWN: KeyboardState = { shown: false, height: 0, top: null, duration: 0 };\n\nexport const KEYBOARD_SHOW = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow';\nexport const KEYBOARD_HIDE = Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide';\n\nexport function useKeyboard(): KeyboardState {\n const [state, setState] = useState<KeyboardState>(DOWN);\n // Android leaves the navigation bar out of the keyboard's height and puts its top that much too low: the keyboard\n // also covers the bar, so its real top is the screen's bottom less both.\n const navBar = useSafeAreaInsets().bottom;\n useEffect(() => {\n const show = Keyboard.addListener(KEYBOARD_SHOW, (e: KeyboardEvent) =>\n setState({\n shown: true,\n height: e.endCoordinates.height,\n top:\n Platform.OS === 'android'\n ? Dimensions.get('screen').height - e.endCoordinates.height - navBar\n : e.endCoordinates.screenY,\n duration: e.duration ?? 0,\n }),\n );\n // iOS also moves it without hiding (another keyboard, the suggestion bar): keep up with that.\n const change =\n Platform.OS === 'ios'\n ? Keyboard.addListener('keyboardWillChangeFrame', (e: KeyboardEvent) =>\n setState((prev) =>\n prev.shown\n ? {\n shown: true,\n height: e.endCoordinates.height,\n top: e.endCoordinates.screenY,\n duration: e.duration ?? 0,\n }\n : prev,\n ),\n )\n : null;\n const hide = Keyboard.addListener(KEYBOARD_HIDE, (e: KeyboardEvent) =>\n setState({ ...DOWN, duration: e?.duration ?? 0 }),\n );\n return () => {\n show.remove();\n change?.remove();\n hide.remove();\n };\n }, [navBar]);\n return state;\n}\n\n/** Whether this app's window shrinks for the keyboard, once a keyboard has shown it (one answer for the whole app). */\nlet shrinksSeen: boolean | null = null;\n\n/**\n * How much of one view the keyboard covers, in points (0 while it is down), for a view that runs to the bottom of the\n * screen: pad or scroll by `covers`. `view` is that view, and `onLayout` goes on it. Some Android phones shrink the\n * window for the keyboard and some do not; the view's own height says which, and only what the system has not made\n * room for counts (iOS never shrinks it).\n */\nexport function useKeyboardCover(view: RefObject<View | null>): {\n keyboard: KeyboardState;\n covers: number;\n onLayout: (e: LayoutChangeEvent) => void;\n} {\n const keyboard = useKeyboard();\n const insets = useSafeAreaInsets();\n const android = Platform.OS === 'android';\n // How much the system shrank the view for the keyboard now up, once measured.\n const [measured, setMeasured] = useState<number | null>(null);\n const rest = useRef(new RestHeight());\n const up = useRef<{ keyboard: number; at: number } | null>(null);\n const madeFrom = useCallback((height: number) => {\n const shown = up.current;\n if (!shown || height <= 0) return;\n const made = Math.max(0, rest.current.base(shown.keyboard, shown.at) - height);\n shrinksSeen = made >= shown.keyboard / 2;\n setMeasured(made);\n }, []);\n const onLayout = useCallback(\n (e: LayoutChangeEvent) => {\n const { height } = e.nativeEvent.layout;\n if (up.current) madeFrom(height);\n else rest.current.seen(height, Date.now());\n },\n [madeFrom],\n );\n useEffect(() => {\n if (!android) return undefined;\n const show = Keyboard.addListener(KEYBOARD_SHOW, (e: KeyboardEvent) => {\n up.current = { keyboard: e.endCoordinates.height, at: Date.now() };\n setMeasured(null);\n view.current?.measure((_x, _y, _width, height) => madeFrom(height));\n });\n const hide = Keyboard.addListener(KEYBOARD_HIDE, () => {\n up.current = null;\n setMeasured(null);\n });\n return () => {\n show.remove();\n hide.remove();\n };\n }, [android, view, madeFrom]);\n // The view's new height reaches JS a few frames after the keyboard's event; until it does, the room goes by what\n // the window did before (or by the system bars), so the composer does not jump up under the header meanwhile.\n const made = measured ?? (windowShrinksGuess(shrinksSeen, insets) ? keyboard.height : 0);\n const covers = keyboardCover({\n keyboard: keyboard.shown ? keyboard.height : 0,\n navBar: android ? insets.bottom : 0,\n madeBySystem: android ? made : 0,\n });\n return { keyboard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AA,CAAY,IAAI,CAAA;AAChB,MAAK,CAAA,EAAA,GAAA,IAAA,CAAA,OAAA,KAAL,mBAAc,OAAQ,CAAA,CAAC,IAAI,EAAI,EAAA,MAAA,EAAQ,MAAW,KAAA,QAAA,CAAS,MAAM,CAAA,CAAA;AAAA,KAClE,CAAA;AACD,IAAA,MAAM,IAAO,GAAA,QAAA,CAAS,WAAY,CAAA,aAAA,EAAe,MAAM;AACrD,MAAA,EAAA,CAAG,OAAU,GAAA,IAAA;AACb,MAAA,WAAA,CAAY,IAAI,CAAA;AAAA,KACjB,CAAA;AACD,IAAA,OAAO,MAAM;AACX,MAAA,IAAA,CAAK,MAAO,EAAA;AACZ,MAAA,IAAA,CAAK,MAAO,EAAA;AAAA,KACd;AAAA,GACC,EAAA,CAAC,OAAS,EAAA,IAAA,EAAM,QAAQ,CAAC,CAAA;AAG5B,EAAA,MAAM,OAAO,QAAa,IAAA,IAAA,GAAA,QAAA,GAAA,kBAAA,CAAmB,aAAa,MAAM,CAAA,GAAI,SAAS,MAAS,GAAA,CAAA;AACtF,EAAA,MAAM,SAAS,aAAc,CAAA;AAAA,IAC3B,QAAU,EAAA,QAAA,CAAS,KAAQ,GAAA,QAAA,CAAS,MAAS,GAAA,CAAA;AAAA,IAC7C,MAAA,EAAQ,OAAU,GAAA,MAAA,CAAO,MAAS,GAAA,CAAA;AAAA,IAClC,YAAA,EAAc,UAAU,IAAO,GAAA;AAAA,GAChC,CAAA;AACD,EAAO,OAAA;AAAA,IACL,QAAA;AAAA,IACA,MAAA;AAAA,IACA;AAAA,GACF;AACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {useState,useEffect}from'react';import {AccessibilityInfo}from'react-native';function useReducedMotion() {
|
|
2
|
+
const [reduced, setReduced] = useState(false);
|
|
3
|
+
useEffect(() => {
|
|
4
|
+
let alive = true;
|
|
5
|
+
AccessibilityInfo.isReduceMotionEnabled().then((value) => alive && setReduced(value)).catch(() => void 0);
|
|
6
|
+
const sub = AccessibilityInfo.addEventListener("reduceMotionChanged", setReduced);
|
|
7
|
+
return () => {
|
|
8
|
+
alive = false;
|
|
9
|
+
sub.remove();
|
|
10
|
+
};
|
|
11
|
+
}, []);
|
|
12
|
+
return reduced;
|
|
13
|
+
}export{useReducedMotion};//# sourceMappingURL=useReducedMotion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReducedMotion.js","sources":["../../src/hooks/useReducedMotion.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { AccessibilityInfo } from 'react-native';\n\n/** The phone's \"Reduce Motion\" setting, kept current while the screen is open. */\nexport function useReducedMotion(): boolean {\n const [reduced, setReduced] = useState(false);\n useEffect(() => {\n let alive = true;\n AccessibilityInfo.isReduceMotionEnabled()\n .then((value) => alive && setReduced(value))\n .catch(() => undefined);\n const sub = AccessibilityInfo.addEventListener('reduceMotionChanged', setReduced);\n return () => {\n alive = false;\n sub.remove();\n };\n }, []);\n return reduced;\n}\n"],"names":[],"mappings":"oFAIO,SAAS,gBAA4B,GAAA;AAC1C,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAS,KAAK,CAAA;AAC5C,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,KAAQ,GAAA,IAAA;AACZ,IAAkB,iBAAA,CAAA,qBAAA,EAAwB,CAAA,IAAA,CAAK,CAAS,KAAA,KAAA,KAAA,IAAS,UAAW,CAAA,KAAK,CAAC,CAAA,CAAE,KAAM,CAAA,MAAM,MAAS,CAAA;AACzG,IAAA,MAAM,GAAM,GAAA,iBAAA,CAAkB,gBAAiB,CAAA,qBAAA,EAAuB,UAAU,CAAA;AAChF,IAAA,OAAO,MAAM;AACX,MAAQ,KAAA,GAAA,KAAA;AACR,MAAA,GAAA,CAAI,MAAO,EAAA;AAAA,KACb;AAAA,GACF,EAAG,EAAE,CAAA;AACL,EAAO,OAAA,OAAA;AACT"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {Platform,Linking}from'react-native';import {requireOptionalNativeModule}from'expo-modules-core';let native;
|
|
2
|
+
function sms() {
|
|
3
|
+
if (native === void 0)
|
|
4
|
+
native = requireOptionalNativeModule("ExpoSMS");
|
|
5
|
+
return native;
|
|
6
|
+
}
|
|
7
|
+
async function openMessages({
|
|
8
|
+
to,
|
|
9
|
+
body,
|
|
10
|
+
href
|
|
11
|
+
}) {
|
|
12
|
+
var _a;
|
|
13
|
+
if (Platform.OS === "ios") {
|
|
14
|
+
const opened = await Linking.openURL(href).then(() => true).catch(() => false);
|
|
15
|
+
if (opened)
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
const mod = sms();
|
|
19
|
+
if ((mod == null ? void 0 : mod.sendSMSAsync) && await ((_a = mod.isAvailableAsync) == null ? void 0 : _a.call(mod).catch(() => false))) {
|
|
20
|
+
const sent = await mod.sendSMSAsync([to], body, {}).then(() => true).catch(() => false);
|
|
21
|
+
if (sent)
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
return Linking.openURL(href).then(() => true).catch(() => false);
|
|
25
|
+
}export{openMessages};//# sourceMappingURL=openMessages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openMessages.js","sources":["../../src/imessage/openMessages.ts"],"sourcesContent":["/**\n * Opens the phone's own Messages app at Lucy's line with the first text ready.\n *\n * - iOS: the Messages app itself, by the `sms:` link, so the conversation with Lucy carries on there. Apple's in-app\n * composer (MFMessageComposeViewController) is only the fallback: it sends one text and closes, which read as\n * Messages opening and then shutting on the person.\n * - Android: the phone's default SMS app (Telephony's default SMS package), which WhatsApp can never be (a bare `sms:`\n * link goes to whichever app claims it, and WhatsApp claims it once picked \"always\"). The link is the last resort.\n * The composer and the default SMS app come from expo-sms's native module; a build without it gets the link.\n */\nimport { Linking, Platform } from 'react-native';\nimport { requireOptionalNativeModule } from 'expo-modules-core';\n\ninterface ExpoSmsModule {\n isAvailableAsync?: () => Promise<boolean>;\n sendSMSAsync?: (addresses: string[], message: string, options: object) => Promise<{ result: string }>;\n}\n\nlet native: ExpoSmsModule | null | undefined;\nfunction sms(): ExpoSmsModule | null {\n if (native === undefined) native = requireOptionalNativeModule<ExpoSmsModule>('ExpoSMS');\n return native;\n}\n\nexport interface MessagesTarget {\n /** Lucy's line: the iCloud handle or the SMS number. Never print it. */\n to: string;\n /** The first text, hidden pairing code included. */\n body: string;\n /** The same as an `sms:` link, for builds without the native composer. */\n href: string;\n}\n\n/** True when Messages opened (or its composer showed); false when nothing on this phone could. */\nexport async function openMessages({ to, body, href }: MessagesTarget): Promise<boolean> {\n if (Platform.OS === 'ios') {\n const opened = await Linking.openURL(href)\n .then(() => true)\n .catch(() => false);\n if (opened) return true;\n }\n const mod = sms();\n if (mod?.sendSMSAsync && (await mod.isAvailableAsync?.().catch(() => false))) {\n const sent = await mod\n .sendSMSAsync([to], body, {})\n .then(() => true)\n .catch(() => false);\n if (sent) return true;\n }\n return Linking.openURL(href)\n .then(() => true)\n .catch(() => false);\n}\n"],"names":[],"mappings":"wGAkBA,IAAI,MAAA;AACJ,SAAS,GAA4B,GAAA;AACnC,EAAA,IAAI,MAAW,KAAA,MAAA;AAAW,IAAA,MAAA,GAAS,4BAA2C,SAAS,CAAA;AACvF,EAAO,OAAA,MAAA;AACT;AAWA,eAAsB,YAAa,CAAA;AAAA,EACjC,EAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF,CAAqC,EAAA;AArCrC,EAAA,IAAA,EAAA;AAsCE,EAAI,IAAA,QAAA,CAAS,OAAO,KAAO,EAAA;AACzB,IAAA,MAAM,MAAS,GAAA,MAAM,OAAQ,CAAA,OAAA,CAAQ,IAAI,CAAA,CAAE,IAAK,CAAA,MAAM,IAAI,CAAA,CAAE,KAAM,CAAA,MAAM,KAAK,CAAA;AAC7E,IAAI,IAAA,MAAA;AAAQ,MAAO,OAAA,IAAA;AAAA;AAErB,EAAA,MAAM,MAAM,GAAI,EAAA;AAChB,EAAI,IAAA,CAAA,GAAA,IAAA,IAAA,GAAA,MAAA,GAAA,GAAA,CAAK,iBAAiB,OAAM,CAAA,EAAA,GAAA,GAAA,CAAI,qBAAJ,IAAyB,GAAA,MAAA,GAAA,EAAA,CAAA,IAAA,CAAA,GAAA,CAAA,CAAA,KAAA,CAAM,MAAM,KAAS,CAAA,CAAA,EAAA;AAC5E,IAAA,MAAM,OAAO,MAAM,GAAA,CAAI,YAAa,CAAA,CAAC,EAAE,CAAG,EAAA,IAAA,EAAM,EAAE,EAAE,IAAK,CAAA,MAAM,IAAI,CAAE,CAAA,KAAA,CAAM,MAAM,KAAK,CAAA;AACtF,IAAI,IAAA,IAAA;AAAM,MAAO,OAAA,IAAA;AAAA;AAEnB,EAAO,OAAA,OAAA,CAAQ,OAAQ,CAAA,IAAI,CAAE,CAAA,IAAA,CAAK,MAAM,IAAI,CAAA,CAAE,KAAM,CAAA,MAAM,KAAK,CAAA;AACjE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {Platform}from'react-native';const ANDROID = Platform.OS === "android";
|
|
2
|
+
const MESSAGES_APP = ANDROID ? "Messages" : "iMessage";
|
|
3
|
+
const TEXT_LUCY = `Text Lucy on ${MESSAGES_APP}`;
|
|
4
|
+
const TEXT_FROM = ANDROID ? "your phone" : "your iPhone, iPad or Mac";
|
|
5
|
+
function textSteps(steps) {
|
|
6
|
+
if (!ANDROID)
|
|
7
|
+
return [...steps];
|
|
8
|
+
return steps.map((step) => ({
|
|
9
|
+
title: step.title,
|
|
10
|
+
body: step.body.replace(/Text Lucy on iMessage/g, TEXT_LUCY).replace(/iPhone, iPad or Mac/g, TEXT_FROM)
|
|
11
|
+
}));
|
|
12
|
+
}export{ANDROID,MESSAGES_APP,TEXT_FROM,TEXT_LUCY,textSteps};//# sourceMappingURL=platform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.js","sources":["../../src/imessage/platform.ts"],"sourcesContent":["/**\n * Texting Lucy, said for the phone in the hand - as Yantra's app does (account/mobile features/channels\n * HomeImessage.tsx, ConnectAppsSheet.tsx `smsOnly`). An iPhone texts Lucy's iMessage handle; an Android phone cannot\n * text an Apple ID, so it texts the SMS/RCS number forwarding to the same line, in its Messages app. Everything that\n * names the app or shows its icon reads from here, so an Android phone never sees \"iMessage\".\n */\nimport { Platform } from 'react-native';\n\nexport const ANDROID = Platform.OS === 'android';\n\n/** The app Lucy is texted in: iMessage on Apple devices, Messages (SMS/RCS) on Android. */\nexport const MESSAGES_APP = ANDROID ? 'Messages' : 'iMessage';\n\n/** The button that opens the texting sheet. */\nexport const TEXT_LUCY = `Text Lucy on ${MESSAGES_APP}`;\n\n/** What the phone is called once it is linked. */\nexport const LINKED_THING = ANDROID ? 'phone' : 'iPhone';\n\n/** Where the person can text Lucy from. */\nexport const TEXT_FROM = ANDROID ? 'your phone' : 'your iPhone, iPad or Mac';\n\n/**\n * The web's TEXT_STEPS (content.ts), with the button they name and the devices they promise matched to this phone.\n */\nexport function textSteps(steps: readonly { title: string; body: string }[]): { title: string; body: string }[] {\n if (!ANDROID) return [...steps];\n return steps.map((step) => ({\n title: step.title,\n body: step.body.replace(/Text Lucy on iMessage/g, TEXT_LUCY).replace(/iPhone, iPad or Mac/g, TEXT_FROM),\n }));\n}\n"],"names":[],"mappings":"oCAOa,MAAA,OAAA,GAAU,SAAS,EAAO,KAAA;AAG1B,MAAA,YAAA,GAAe,UAAU,UAAa,GAAA;AAG5C,MAAM,YAAY,CAAgB,aAAA,EAAA,YAAA,CAAA;AAM5B,MAAA,SAAA,GAAY,UAAU,YAAe,GAAA;AAK3C,SAAS,UAAU,KAMtB,EAAA;AACF,EAAA,IAAI,CAAC,OAAA;AAAS,IAAO,OAAA,CAAC,GAAG,KAAK,CAAA;AAC9B,EAAO,OAAA,KAAA,CAAM,IAAI,CAAS,IAAA,MAAA;AAAA,IACxB,OAAO,IAAK,CAAA,KAAA;AAAA,IACZ,IAAA,EAAM,KAAK,IAAK,CAAA,OAAA,CAAQ,0BAA0B,SAAS,CAAA,CAAE,OAAQ,CAAA,sBAAA,EAAwB,SAAS;AAAA,GACtG,CAAA,CAAA;AACJ"}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import {agentBackendUrl,accountKey,getChatToken}from'../chat/auth.js';var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __publicField = (obj, key, value) => {
|
|
21
|
+
__defNormalProp(obj, key + "" , value);
|
|
22
|
+
return value;
|
|
23
|
+
};
|
|
24
|
+
class TextLinkError extends Error {
|
|
25
|
+
constructor(kind, message) {
|
|
26
|
+
super(message);
|
|
27
|
+
__publicField(this, "kind");
|
|
28
|
+
this.name = "TextLinkError";
|
|
29
|
+
this.kind = kind;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const IMESSAGE_CHANNEL = "imessage-webhook";
|
|
33
|
+
const LUCY_GREETING = "Hi Lucy";
|
|
34
|
+
const MAX_MESSAGE = 300;
|
|
35
|
+
const TIMEOUT_MS = 8e3;
|
|
36
|
+
const CODE_TTL_MS = 10 * 6e4;
|
|
37
|
+
const REUSE_LEAD_MS = 2 * 6e4;
|
|
38
|
+
const ADDRESS_QUERY = `query ClockbookImessageLine { imessageBotAddress }`;
|
|
39
|
+
const SMS_QUERY = `query ClockbookSmsLine { smsBotNumber }`;
|
|
40
|
+
const BINDINGS_QUERY = `query ClockbookTextBindings($chatSessionId: String) {
|
|
41
|
+
gatewayListBindings(chatSessionId: $chatSessionId) { channelType externalChatId externalAccountId }
|
|
42
|
+
}`;
|
|
43
|
+
const MINT_MUTATION = `mutation ClockbookPairingCode($input: GatewayPairingTokenInput!) {
|
|
44
|
+
gatewayGeneratePairingToken(input: $input) { token expiresAt }
|
|
45
|
+
}`;
|
|
46
|
+
const HIDDEN_FRAME = "\u2063";
|
|
47
|
+
const HIDDEN_DIGITS = ["\u200B", "\u200C", "\u2060", "\u2062"];
|
|
48
|
+
function encodeHiddenCode(token) {
|
|
49
|
+
let out = HIDDEN_FRAME;
|
|
50
|
+
for (let i = 0; i < token.length; i += 1) {
|
|
51
|
+
const byte = token.charCodeAt(i) & 255;
|
|
52
|
+
for (let shift = 6; shift >= 0; shift -= 2)
|
|
53
|
+
out += HIDDEN_DIGITS[byte >> shift & 3];
|
|
54
|
+
}
|
|
55
|
+
return out + HIDDEN_FRAME;
|
|
56
|
+
}
|
|
57
|
+
function smsHref(address, body) {
|
|
58
|
+
return `sms:${address}?&body=${encodeURIComponent(body)}`;
|
|
59
|
+
}
|
|
60
|
+
function ownThread(bindings) {
|
|
61
|
+
return bindings.find((b) => {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
return b.channelType === IMESSAGE_CHANNEL && !String((_a = b.externalChatId) != null ? _a : "").includes(";+;") && !String((_b = b.externalAccountId) != null ? _b : "").startsWith("ws_");
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function threadReach(thread) {
|
|
67
|
+
var _a;
|
|
68
|
+
return /^(SMS|RCS);/i.test((_a = thread.externalChatId) != null ? _a : "") ? "sms" : "imessage";
|
|
69
|
+
}
|
|
70
|
+
function lineAddress(line, reach) {
|
|
71
|
+
if (reach === "sms")
|
|
72
|
+
return line.sms;
|
|
73
|
+
return line.imessage || line.sms;
|
|
74
|
+
}
|
|
75
|
+
function firstText(message) {
|
|
76
|
+
const text = (message != null ? message : "").trim().slice(0, MAX_MESSAGE).trim();
|
|
77
|
+
return text || LUCY_GREETING;
|
|
78
|
+
}
|
|
79
|
+
function normalizeExpiry(expiresAt, receivedAt) {
|
|
80
|
+
const at = typeof expiresAt === "string" ? Number(expiresAt) : expiresAt;
|
|
81
|
+
const latest = receivedAt + CODE_TTL_MS;
|
|
82
|
+
if (typeof at !== "number" || !Number.isFinite(at) || at - receivedAt < 6e4)
|
|
83
|
+
return latest;
|
|
84
|
+
return Math.min(at, latest);
|
|
85
|
+
}
|
|
86
|
+
const RATE_LIMITED = /too many pairing|rate.?limit/i;
|
|
87
|
+
const SIGNED_OUT = /unauthori[sz]ed|unauthenticated|not authenticated|jwt|token (is )?(expired|invalid)|session expired/i;
|
|
88
|
+
function classifyError(message, code) {
|
|
89
|
+
if (RATE_LIMITED.test(message))
|
|
90
|
+
return new TextLinkError("rate-limited", message);
|
|
91
|
+
if (code === "UNAUTHENTICATED" || SIGNED_OUT.test(message))
|
|
92
|
+
return new TextLinkError("signed-out", message);
|
|
93
|
+
return new TextLinkError("failed", message || "The platform could not answer.");
|
|
94
|
+
}
|
|
95
|
+
async function post(url, token, query, variables, signal) {
|
|
96
|
+
return fetch(url, {
|
|
97
|
+
method: "POST",
|
|
98
|
+
headers: {
|
|
99
|
+
"content-type": "application/json",
|
|
100
|
+
Authorization: `Bearer ${token}`
|
|
101
|
+
},
|
|
102
|
+
body: JSON.stringify({
|
|
103
|
+
query,
|
|
104
|
+
variables
|
|
105
|
+
}),
|
|
106
|
+
signal
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
async function ask(query, variables, signal) {
|
|
110
|
+
var _a, _b, _c;
|
|
111
|
+
const url = await agentBackendUrl().catch(() => {
|
|
112
|
+
throw new TextLinkError("failed", "Could not reach Lucy.");
|
|
113
|
+
});
|
|
114
|
+
const timeout = new AbortController();
|
|
115
|
+
const timer = setTimeout(() => timeout.abort(), TIMEOUT_MS);
|
|
116
|
+
const onAbort = () => timeout.abort();
|
|
117
|
+
signal == null ? void 0 : signal.addEventListener("abort", onAbort);
|
|
118
|
+
try {
|
|
119
|
+
let res = await post(url, await getChatToken(), query, variables, timeout.signal);
|
|
120
|
+
if (res.status === 401)
|
|
121
|
+
res = await post(url, await getChatToken({
|
|
122
|
+
fresh: true
|
|
123
|
+
}), query, variables, timeout.signal);
|
|
124
|
+
if (res.status === 401)
|
|
125
|
+
throw new TextLinkError("signed-out", "The sign-in was refused.");
|
|
126
|
+
const json = await res.json().catch(() => null);
|
|
127
|
+
const first = (_a = json == null ? void 0 : json.errors) == null ? void 0 : _a[0];
|
|
128
|
+
if (first)
|
|
129
|
+
throw classifyError(String((_b = first.message) != null ? _b : ""), (_c = first.extensions) == null ? void 0 : _c.code);
|
|
130
|
+
if (!res.ok || !(json == null ? void 0 : json.data))
|
|
131
|
+
throw new TextLinkError("failed", `The platform answered ${res.status}.`);
|
|
132
|
+
return json.data;
|
|
133
|
+
} catch (err) {
|
|
134
|
+
if (err instanceof TextLinkError)
|
|
135
|
+
throw err;
|
|
136
|
+
if ((err == null ? void 0 : err.kind) === "signed-out")
|
|
137
|
+
throw new TextLinkError("signed-out", "Sign in first.");
|
|
138
|
+
throw new TextLinkError("failed", (err == null ? void 0 : err.message) || "Could not reach Lucy.");
|
|
139
|
+
} finally {
|
|
140
|
+
clearTimeout(timer);
|
|
141
|
+
signal == null ? void 0 : signal.removeEventListener("abort", onAbort);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function devLog(what, detail) {
|
|
145
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
146
|
+
console.log(`[textLink] ${what}:`, detail);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function orElse(promise, fallback, signal, what = "lookup") {
|
|
150
|
+
return promise.catch((err) => {
|
|
151
|
+
var _a;
|
|
152
|
+
if ((signal == null ? void 0 : signal.aborted) || err instanceof TextLinkError && err.kind === "signed-out")
|
|
153
|
+
throw err;
|
|
154
|
+
devLog(`${what} failed`, (_a = err == null ? void 0 : err.message) != null ? _a : err);
|
|
155
|
+
return fallback;
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
function newConversationId() {
|
|
159
|
+
const c = globalThis.crypto;
|
|
160
|
+
if (c == null ? void 0 : c.randomUUID)
|
|
161
|
+
return c.randomUUID();
|
|
162
|
+
const bytes = new Uint8Array(16);
|
|
163
|
+
if (c == null ? void 0 : c.getRandomValues)
|
|
164
|
+
c.getRandomValues(bytes);
|
|
165
|
+
else
|
|
166
|
+
for (let i = 0; i < 16; i += 1)
|
|
167
|
+
bytes[i] = Math.floor(Math.random() * 256);
|
|
168
|
+
bytes[6] = bytes[6] & 15 | 64;
|
|
169
|
+
bytes[8] = bytes[8] & 63 | 128;
|
|
170
|
+
const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
171
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
172
|
+
}
|
|
173
|
+
const codes = /* @__PURE__ */ new Map();
|
|
174
|
+
async function pairingCode(account, signal) {
|
|
175
|
+
var _a, _b, _c;
|
|
176
|
+
const kept = codes.get(account);
|
|
177
|
+
if (kept && kept.expiresAt - Date.now() > REUSE_LEAD_MS)
|
|
178
|
+
return kept;
|
|
179
|
+
const data = await ask(
|
|
180
|
+
MINT_MUTATION,
|
|
181
|
+
{
|
|
182
|
+
input: {
|
|
183
|
+
channelType: IMESSAGE_CHANNEL,
|
|
184
|
+
chatSessionId: newConversationId(),
|
|
185
|
+
scope: "chatSession"
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
signal
|
|
189
|
+
);
|
|
190
|
+
const token = (_b = (_a = data.gatewayGeneratePairingToken) == null ? void 0 : _a.token) == null ? void 0 : _b.trim();
|
|
191
|
+
if (!token)
|
|
192
|
+
throw new TextLinkError("failed", "The platform did not mint a code.");
|
|
193
|
+
const code = {
|
|
194
|
+
token,
|
|
195
|
+
expiresAt: normalizeExpiry((_c = data.gatewayGeneratePairingToken) == null ? void 0 : _c.expiresAt, Date.now())
|
|
196
|
+
};
|
|
197
|
+
codes.set(account, code);
|
|
198
|
+
return code;
|
|
199
|
+
}
|
|
200
|
+
function clearTextLinkCodes() {
|
|
201
|
+
codes.clear();
|
|
202
|
+
}
|
|
203
|
+
async function fetchTextLink(reach, {
|
|
204
|
+
message,
|
|
205
|
+
signal
|
|
206
|
+
} = {}) {
|
|
207
|
+
const [imessage, sms, bindings] = await Promise.all([orElse(ask(ADDRESS_QUERY, void 0, signal).then((d) => {
|
|
208
|
+
var _a;
|
|
209
|
+
return ((_a = d.imessageBotAddress) == null ? void 0 : _a.trim()) || null;
|
|
210
|
+
}), null, signal, "imessageBotAddress"), orElse(ask(SMS_QUERY, void 0, signal).then((d) => {
|
|
211
|
+
var _a;
|
|
212
|
+
return ((_a = d.smsBotNumber) == null ? void 0 : _a.trim()) || null;
|
|
213
|
+
}), null, signal, "smsBotNumber"), orElse(ask(BINDINGS_QUERY, {
|
|
214
|
+
chatSessionId: null
|
|
215
|
+
}, signal).then((d) => {
|
|
216
|
+
var _a;
|
|
217
|
+
return (_a = d.gatewayListBindings) != null ? _a : [];
|
|
218
|
+
}), [], signal, "gatewayListBindings")]);
|
|
219
|
+
devLog("line", {
|
|
220
|
+
backend: await agentBackendUrl().catch(() => null),
|
|
221
|
+
imessageLine: imessage ? "set" : "empty",
|
|
222
|
+
smsLine: sms ? "set" : "empty",
|
|
223
|
+
bindings: bindings.length
|
|
224
|
+
});
|
|
225
|
+
const thread = ownThread(bindings);
|
|
226
|
+
const route = thread ? threadReach(thread) : reach;
|
|
227
|
+
const address = lineAddress({
|
|
228
|
+
imessage,
|
|
229
|
+
sms
|
|
230
|
+
}, route);
|
|
231
|
+
const body = firstText(message);
|
|
232
|
+
const base = {
|
|
233
|
+
reach: route,
|
|
234
|
+
smsAvailable: Boolean(sms)
|
|
235
|
+
};
|
|
236
|
+
if (!address)
|
|
237
|
+
return __spreadProps(__spreadValues({}, base), {
|
|
238
|
+
href: null,
|
|
239
|
+
to: null,
|
|
240
|
+
body: null,
|
|
241
|
+
linked: Boolean(thread),
|
|
242
|
+
expiresAt: null
|
|
243
|
+
});
|
|
244
|
+
if (thread)
|
|
245
|
+
return __spreadProps(__spreadValues({}, base), {
|
|
246
|
+
href: smsHref(address, body),
|
|
247
|
+
to: address,
|
|
248
|
+
body,
|
|
249
|
+
linked: true,
|
|
250
|
+
expiresAt: null
|
|
251
|
+
});
|
|
252
|
+
const account = accountKey(await getChatToken());
|
|
253
|
+
const code = await pairingCode(account, signal);
|
|
254
|
+
const coded = body + encodeHiddenCode(code.token);
|
|
255
|
+
return __spreadProps(__spreadValues({}, base), {
|
|
256
|
+
href: smsHref(address, coded),
|
|
257
|
+
to: address,
|
|
258
|
+
body: coded,
|
|
259
|
+
linked: false,
|
|
260
|
+
expiresAt: code.expiresAt
|
|
261
|
+
});
|
|
262
|
+
}export{IMESSAGE_CHANNEL,LUCY_GREETING,TextLinkError,classifyError,clearTextLinkCodes,encodeHiddenCode,fetchTextLink,firstText,lineAddress,normalizeExpiry,ownThread,smsHref,threadReach};//# sourceMappingURL=textLink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textLink.js","sources":["../../src/imessage/textLink.ts"],"sourcesContent":["/**\n * \"Text Lucy on iMessage\": an `sms:` link that opens Messages at the platform's iMessage line with the first text\n * ready to send - the same link the web home builds (browser src/pages/Home/imessage/textLink.ts; keep the two in\n * step).\n *\n * A phone the gateway has never seen cannot be told apart from a stranger, so its first text carries a one-time\n * pairing code, hidden in the greeting as invisible characters: the person sees and sends \"Hi Lucy\", and the gateway\n * links the phone to their account. A phone that already texts Lucy gets the plain greeting.\n *\n * Everything is asked of the backend Lucy's agent trusts, with the person's agent token (chat/auth.ts) - the token\n * the web page's surface sign-in brings back - so the platform decides what they may see. The line's addresses only\n * ever live inside `href`: the app opens it and never prints it.\n */\nimport { accountKey, agentBackendUrl, getChatToken } from '../chat/auth';\n\n/** imessage: an Apple device texting the iCloud handle. sms: an Android phone texting the forwarding number. */\nexport type TextReach = 'imessage' | 'sms';\n\nexport interface TextLink {\n /** The line `href` texts. A phone that is already linked keeps the line it is linked on. */\n reach: TextReach;\n /** The `sms:` link with the first text ready; null when that line is not answering. Never print it. */\n href: string | null;\n /** The line `href` texts and the text it carries, for the native Messages composer. Never print them. */\n to: string | null;\n body: string | null;\n /** The person's phone already texts Lucy: the plain greeting, no code. */\n linked: boolean;\n /** When the hidden one-time code stops working (Unix ms); null when there is none. */\n expiresAt: number | null;\n /** The platform has an SMS/RCS number, so a phone without iMessage can text Lucy too. */\n smsAvailable: boolean;\n}\n\nexport type TextLinkErrorKind = 'signed-out' | 'rate-limited' | 'failed';\n\nexport class TextLinkError extends Error {\n readonly kind: TextLinkErrorKind;\n\n constructor(kind: TextLinkErrorKind, message: string) {\n super(message);\n this.name = 'TextLinkError';\n this.kind = kind;\n }\n}\n\n/** The gateway channel the iMessage line arrives on. SMS and RCS forwarded to the same Mac arrive on it too. */\nexport const IMESSAGE_CHANNEL = 'imessage-webhook';\n\n/** What the person sees ready in Messages, and sends. */\nexport const LUCY_GREETING = 'Hi Lucy';\n\nconst MAX_MESSAGE = 300;\nconst TIMEOUT_MS = 8000;\n/** The gateway's code lifetime (messenger-gateway pairing-service: 600 s). */\nconst CODE_TTL_MS = 10 * 60_000;\n/** A minted code is reused until this close to its expiry: the gateway mints only five a minute. */\nconst REUSE_LEAD_MS = 2 * 60_000;\n\nconst ADDRESS_QUERY = `query ClockbookImessageLine { imessageBotAddress }`;\n// Its own request: a backend that does not serve `smsBotNumber` fails this one alone, never the address.\nconst SMS_QUERY = `query ClockbookSmsLine { smsBotNumber }`;\nconst BINDINGS_QUERY = `query ClockbookTextBindings($chatSessionId: String) {\n gatewayListBindings(chatSessionId: $chatSessionId) { channelType externalChatId externalAccountId }\n}`;\nconst MINT_MUTATION = `mutation ClockbookPairingCode($input: GatewayPairingTokenInput!) {\n gatewayGeneratePairingToken(input: $input) { token expiresAt }\n}`;\n\n/*\n * The hidden code's wire format, shared with the messenger gateway and the web home (change them together):\n * FRAME + four base-4 digits per byte of the token, high bits first, + FRAME. Every character is a Unicode\n * default-ignorable, so Messages shows only the greeting. Tokens are base64url, so each character code is its byte.\n */\nconst HIDDEN_FRAME = '';\nconst HIDDEN_DIGITS = ['', '', '', ''];\n\nexport function encodeHiddenCode(token: string): string {\n let out = HIDDEN_FRAME;\n for (let i = 0; i < token.length; i += 1) {\n const byte = token.charCodeAt(i) & 0xff;\n for (let shift = 6; shift >= 0; shift -= 2) out += HIDDEN_DIGITS[(byte >> shift) & 3];\n }\n return out + HIDDEN_FRAME;\n}\n\n/** `?&body=` is the one form both iOS Messages and Android's messaging apps read the body from. */\nexport function smsHref(address: string, body: string): string {\n return `sms:${address}?&body=${encodeURIComponent(body)}`;\n}\n\nexport interface TextBinding {\n channelType?: string | null;\n externalChatId?: string | null;\n externalAccountId?: string | null;\n}\n\n/** The person's own one-on-one thread on the platform line: never a group chat, never a workspace's line. */\nexport function ownThread(bindings: readonly TextBinding[]): TextBinding | undefined {\n return bindings.find(\n (b) =>\n b.channelType === IMESSAGE_CHANNEL &&\n !String(b.externalChatId ?? '').includes(';+;') &&\n !String(b.externalAccountId ?? '').startsWith('ws_'),\n );\n}\n\n/** A linked thread keeps texting the way it is linked: texts the Mac's iPhone forwarded are SMS or RCS. */\nexport function threadReach(thread: TextBinding): TextReach {\n return /^(SMS|RCS);/i.test(thread.externalChatId ?? '') ? 'sms' : 'imessage';\n}\n\nexport interface TextLine {\n imessage: string | null;\n sms: string | null;\n}\n\n/** An iPhone can text a number too; an Android phone cannot text an Apple ID, so nothing stands in for the number. */\nexport function lineAddress(line: TextLine, reach: TextReach): string | null {\n if (reach === 'sms') return line.sms;\n return line.imessage || line.sms;\n}\n\n/** The first text: the person's own words when they brought some, Lucy's greeting otherwise. */\nexport function firstText(message?: string): string {\n const text = (message ?? '').trim().slice(0, MAX_MESSAGE).trim();\n return text || LUCY_GREETING;\n}\n\n/** Never trust less than a minute of a just-minted code, nor more than its lifetime (the device clock may be off). */\nexport function normalizeExpiry(expiresAt: unknown, receivedAt: number): number {\n const at = typeof expiresAt === 'string' ? Number(expiresAt) : expiresAt;\n const latest = receivedAt + CODE_TTL_MS;\n if (typeof at !== 'number' || !Number.isFinite(at) || at - receivedAt < 60_000) return latest;\n return Math.min(at, latest);\n}\n\ninterface GqlReply<T> {\n data?: T | null;\n errors?: Array<{ message?: string; extensions?: { code?: string } | null }>;\n}\n\nconst RATE_LIMITED = /too many pairing|rate.?limit/i;\nconst SIGNED_OUT =\n /unauthori[sz]ed|unauthenticated|not authenticated|jwt|token (is )?(expired|invalid)|session expired/i;\n\nexport function classifyError(message: string, code?: string | null): TextLinkError {\n if (RATE_LIMITED.test(message)) return new TextLinkError('rate-limited', message);\n if (code === 'UNAUTHENTICATED' || SIGNED_OUT.test(message)) return new TextLinkError('signed-out', message);\n return new TextLinkError('failed', message || 'The platform could not answer.');\n}\n\nasync function post(url: string, token: string, query: string, variables: object | undefined, signal: AbortSignal) {\n return fetch(url, {\n method: 'POST',\n headers: { 'content-type': 'application/json', Authorization: `Bearer ${token}` },\n body: JSON.stringify({ query, variables }),\n signal,\n });\n}\n\n/** One GraphQL call with the agent token; a 401 mints a fresh token and tries once more (as the web's retry). */\nasync function ask<T>(query: string, variables: object | undefined, signal?: AbortSignal): Promise<T> {\n const url = await agentBackendUrl().catch(() => {\n throw new TextLinkError('failed', 'Could not reach Lucy.');\n });\n const timeout = new AbortController();\n const timer = setTimeout(() => timeout.abort(), TIMEOUT_MS);\n const onAbort = () => timeout.abort();\n signal?.addEventListener('abort', onAbort);\n try {\n let res = await post(url, await getChatToken(), query, variables, timeout.signal);\n if (res.status === 401)\n res = await post(url, await getChatToken({ fresh: true }), query, variables, timeout.signal);\n if (res.status === 401) throw new TextLinkError('signed-out', 'The sign-in was refused.');\n const json = (await res.json().catch(() => null)) as GqlReply<T> | null;\n const first = json?.errors?.[0];\n if (first) throw classifyError(String(first.message ?? ''), first.extensions?.code);\n if (!res.ok || !json?.data) throw new TextLinkError('failed', `The platform answered ${res.status}.`);\n return json.data;\n } catch (err) {\n if (err instanceof TextLinkError) throw err;\n // getChatToken's own errors: no Auth0 session is a sign-in, the rest a failure.\n if ((err as { kind?: string })?.kind === 'signed-out') throw new TextLinkError('signed-out', 'Sign in first.');\n throw new TextLinkError('failed', (err as Error)?.message || 'Could not reach Lucy.');\n } finally {\n clearTimeout(timer);\n signal?.removeEventListener('abort', onAbort);\n }\n}\n\ndeclare const __DEV__: boolean | undefined;\n/** Development builds say why a lookup came back empty (never the line's address itself). */\nfunction devLog(what: string, detail: unknown): void {\n if (typeof __DEV__ !== 'undefined' && __DEV__) {\n // eslint-disable-next-line no-console\n console.log(`[textLink] ${what}:`, detail);\n }\n}\n\n/** A lookup that may come back empty; only a refused sign-in (or the caller giving up) gets through. */\nfunction orElse<T>(promise: Promise<T>, fallback: T, signal?: AbortSignal, what = 'lookup'): Promise<T> {\n return promise.catch((err: unknown) => {\n if (signal?.aborted || (err instanceof TextLinkError && err.kind === 'signed-out')) throw err;\n devLog(`${what} failed`, (err as Error)?.message ?? err);\n return fallback;\n });\n}\n\n/** A fresh conversation for the phone to bridge into, as the gateway starts one for /newchat. */\nfunction newConversationId(): string {\n const c = (globalThis as { crypto?: Crypto }).crypto;\n if (c?.randomUUID) return c.randomUUID();\n const bytes = new Uint8Array(16);\n if (c?.getRandomValues) c.getRandomValues(bytes);\n else for (let i = 0; i < 16; i += 1) bytes[i] = Math.floor(Math.random() * 256);\n bytes[6] = (bytes[6] & 0x0f) | 0x40;\n bytes[8] = (bytes[8] & 0x3f) | 0x80;\n const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join('');\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;\n}\n\n/** Codes minted in this session, per account: reopening the sheet reuses one. */\nconst codes = new Map<string, { token: string; expiresAt: number }>();\n\nasync function pairingCode(account: string, signal?: AbortSignal): Promise<{ token: string; expiresAt: number }> {\n const kept = codes.get(account);\n if (kept && kept.expiresAt - Date.now() > REUSE_LEAD_MS) return kept;\n const data = await ask<{ gatewayGeneratePairingToken?: { token?: string | null; expiresAt?: unknown } | null }>(\n MINT_MUTATION,\n // `chatSession` like every other pairing entry point: the phone bridges into this chat only.\n { input: { channelType: IMESSAGE_CHANNEL, chatSessionId: newConversationId(), scope: 'chatSession' } },\n signal,\n );\n const token = data.gatewayGeneratePairingToken?.token?.trim();\n if (!token) throw new TextLinkError('failed', 'The platform did not mint a code.');\n const code = { token, expiresAt: normalizeExpiry(data.gatewayGeneratePairingToken?.expiresAt, Date.now()) };\n codes.set(account, code);\n return code;\n}\n\n/** Forget every code minted here: on sign-out, so the next person on this phone gets their own. */\nexport function clearTextLinkCodes(): void {\n codes.clear();\n}\n\n/**\n * The link for a phone that texts on `reach`. Throws a TextLinkError: `signed-out` when the platform refused the\n * sign-in, `rate-limited` after too many codes in a minute, `failed` otherwise.\n */\nexport async function fetchTextLink(\n reach: TextReach,\n { message, signal }: { message?: string; signal?: AbortSignal } = {},\n): Promise<TextLink> {\n const [imessage, sms, bindings] = await Promise.all([\n orElse(\n ask<{ imessageBotAddress?: string | null }>(ADDRESS_QUERY, undefined, signal).then(\n (d) => d.imessageBotAddress?.trim() || null,\n ),\n null,\n signal,\n 'imessageBotAddress',\n ),\n orElse(\n ask<{ smsBotNumber?: string | null }>(SMS_QUERY, undefined, signal).then(\n (d) => d.smsBotNumber?.trim() || null,\n ),\n null,\n signal,\n 'smsBotNumber',\n ),\n orElse(\n ask<{ gatewayListBindings?: TextBinding[] | null }>(BINDINGS_QUERY, { chatSessionId: null }, signal).then(\n (d) => d.gatewayListBindings ?? [],\n ),\n [] as TextBinding[],\n signal,\n 'gatewayListBindings',\n ),\n ]);\n devLog('line', {\n backend: await agentBackendUrl().catch(() => null),\n imessageLine: imessage ? 'set' : 'empty',\n smsLine: sms ? 'set' : 'empty',\n bindings: bindings.length,\n });\n\n const thread = ownThread(bindings);\n const route = thread ? threadReach(thread) : reach;\n const address = lineAddress({ imessage, sms }, route);\n const body = firstText(message);\n const base = { reach: route, smsAvailable: Boolean(sms) };\n if (!address) return { ...base, href: null, to: null, body: null, linked: Boolean(thread), expiresAt: null };\n if (thread) return { ...base, href: smsHref(address, body), to: address, body, linked: true, expiresAt: null };\n\n const account = accountKey(await getChatToken());\n const code = await pairingCode(account, signal);\n const coded = body + encodeHiddenCode(code.token);\n return {\n ...base,\n href: smsHref(address, coded),\n to: address,\n body: coded,\n linked: false,\n expiresAt: code.expiresAt,\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAiCO,MAAM,sBAAsB,KAAM,CAAA;AAAA,EAEvC,WAAA,CAAY,MAAyB,OAAiB,EAAA;AACpD,IAAA,KAAA,CAAM,OAAO,CAAA;AAFf,IAAS,aAAA,CAAA,IAAA,EAAA,MAAA,CAAA;AAGP,IAAA,IAAA,CAAK,IAAO,GAAA,eAAA;AACZ,IAAA,IAAA,CAAK,IAAO,GAAA,IAAA;AAAA;AAEhB;AAGO,MAAM,gBAAmB,GAAA;AAGzB,MAAM,aAAgB,GAAA;AAC7B,MAAM,WAAc,GAAA,GAAA;AACpB,MAAM,UAAa,GAAA,GAAA;AAEnB,MAAM,cAAc,EAAK,GAAA,GAAA;AAEzB,MAAM,gBAAgB,CAAI,GAAA,GAAA;AAC1B,MAAM,aAAgB,GAAA,CAAA,kDAAA,C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index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {Feature}from'@common-stack/client-react';import ClockbookMobileModule from'./module.js';export{config}from'./config/env-config.js';export{CLOCKBOOK_ROUTES}from'./config/routes.js';export{colors}from'./theme/colors.js';export{PROMPT_MAX,appBase,appTextingLink,businessBase,businessLink,chatLink,openChore,openUrl,yantraAppUrl}from'./utils/links.js';export{openYantraInSheet,openYantraUrl,signedInYantraLink}from'./utils/yantraLinks.js';export{SignInPrompt,useSignInGate}from'./components/SignInPrompt.js';export{AnimatedMark,Mark}from'./components/Logo.js';export{default as CustomDrawer}from'./components/CustomDrawer.js';var index = new Feature(ClockbookMobileModule);export{index as default};//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { Feature } from '@common-stack/client-react';\nimport ClockbookMobileModule from './module';\n\nexport default new Feature(ClockbookMobileModule);\nexport { config } from './config/env-config';\nexport { CLOCKBOOK_ROUTES } from './config/routes';\nexport { colors } from './theme/colors';\nexport {\n appBase,\n appTextingLink,\n chatLink,\n businessBase,\n businessLink,\n openUrl,\n openChore,\n PROMPT_MAX,\n yantraAppUrl,\n} from './utils/links';\nexport { openYantraInSheet, openYantraUrl, signedInYantraLink } from './utils/yantraLinks';\nexport { SignInPrompt, useSignInGate, type SignInPurpose } from './components/SignInPrompt';\nexport { Mark, AnimatedMark } from './components/Logo';\n// The drawer is loaded by the app's generated navigation from lib/components/CustomDrawer.js\n// (config.json customDrawerPath); exported here so rollup emits it.\nexport { default as CustomDrawer } from './components/CustomDrawer';\n"],"names":[],"mappings":"snBAEA,YAAe,IAAI,QAAQ,qBAAqB,CAAA"}
|
package/lib/live/card.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const ASKS_CALL = /\b(call|phone|ring|dial)\b/i;
|
|
2
|
+
const IN_A_CALL = /\b(making a call|calling|on the line|ringing|on hold)\b/i;
|
|
3
|
+
const ASKS_SHOP = /\b(buy|order|shop|shopping|find me|cheapest|price|deal)\b/i;
|
|
4
|
+
function cardKind(text, current = "general") {
|
|
5
|
+
if (current === "call" || ASKS_CALL.test(text) || IN_A_CALL.test(text))
|
|
6
|
+
return "call";
|
|
7
|
+
if (current === "shop" || ASKS_SHOP.test(text))
|
|
8
|
+
return "shop";
|
|
9
|
+
return current;
|
|
10
|
+
}
|
|
11
|
+
function callStarts(status) {
|
|
12
|
+
return IN_A_CALL.test(status);
|
|
13
|
+
}
|
|
14
|
+
function cardTitle(prompt) {
|
|
15
|
+
const t = prompt.replace(/\s+/g, " ").trim();
|
|
16
|
+
if (!t)
|
|
17
|
+
return "A chore for Lucy";
|
|
18
|
+
return t.length > 44 ? `${t.slice(0, 43).trimEnd()}\u2026` : t;
|
|
19
|
+
}
|
|
20
|
+
function cardSummary(reply) {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
const plain = reply.replace(/\[ASK_USER\][\s\S]*?(?:\[\/ASK_USER\]|$)/g, "").replace(/```[\s\S]*?(?:```|$)/g, "").replace(/\[\[surface:[^|\]]+\|([^\]]+)\]\]/g, "$1").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/[*_#>`]/g, "").replace(/\s+/g, " ").trim();
|
|
23
|
+
const first = (_b = (_a = /^(.+?[.!?])(\s|$)/.exec(plain)) == null ? void 0 : _a[1]) != null ? _b : plain;
|
|
24
|
+
return first.length > 80 ? `${first.slice(0, 79).trimEnd()}\u2026` : first;
|
|
25
|
+
}
|
|
26
|
+
function minutesSpent(fromSeconds, nowSeconds) {
|
|
27
|
+
return Math.max(1, Math.round((nowSeconds - fromSeconds) / 60));
|
|
28
|
+
}export{callStarts,cardKind,cardSummary,cardTitle,minutesSpent};//# sourceMappingURL=card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.js","sources":["../../src/live/card.ts"],"sourcesContent":["/**\n * What a Live Activity card says for one of Lucy's chores (live/liveActivity.ts shows it). Pure, so it is tested\n * without a phone. CardState is the card's ContentState (portable-devices/mobile/targets/lucy-live) and what Yantra's\n * pushes send as `content-state` (that folder's README.md): keep the three the same.\n */\nexport type CardKind = 'call' | 'shop' | 'general';\nexport type CardPhase = 'working' | 'asking' | 'done' | 'failed';\n\nexport interface CardState {\n kind: CardKind;\n phase: CardPhase;\n /** The line under the title: what Lucy is doing now, her question, or how it ended. */\n detail: string;\n /** Unix seconds the timer counts from: the call's start on a call, else the chore's. */\n startedAt?: number;\n /** Picks so far, while shopping. */\n count?: number;\n /** Minutes Lucy spent on it, once done. */\n minutesBack?: number;\n}\n\nconst ASKS_CALL = /\\b(call|phone|ring|dial)\\b/i;\nconst IN_A_CALL = /\\b(making a call|calling|on the line|ringing|on hold)\\b/i;\nconst ASKS_SHOP = /\\b(buy|order|shop|shopping|find me|cheapest|price|deal)\\b/i;\n\n/** The kind of chore, from what was asked or what Lucy says she is doing. A call stays a call. */\nexport function cardKind(text: string, current: CardKind = 'general'): CardKind {\n if (current === 'call' || ASKS_CALL.test(text) || IN_A_CALL.test(text)) return 'call';\n if (current === 'shop' || ASKS_SHOP.test(text)) return 'shop';\n return current;\n}\n\n/** Whether a status line is the call itself starting: then the card's timer counts from now. */\nexport function callStarts(status: string): boolean {\n return IN_A_CALL.test(status);\n}\n\n/** The card's title: the chore as asked, on one line. */\nexport function cardTitle(prompt: string): string {\n const t = prompt.replace(/\\s+/g, ' ').trim();\n if (!t) return 'A chore for Lucy';\n return t.length > 44 ? `${t.slice(0, 43).trimEnd()}…` : t;\n}\n\n/** A finished card's line: the first sentence of Lucy's last reply, without its question card or markup. */\nexport function cardSummary(reply: string): string {\n const plain = reply\n .replace(/\\[ASK_USER\\][\\s\\S]*?(?:\\[\\/ASK_USER\\]|$)/g, '')\n .replace(/```[\\s\\S]*?(?:```|$)/g, '')\n .replace(/\\[\\[surface:[^|\\]]+\\|([^\\]]+)\\]\\]/g, '$1')\n .replace(/\\[([^\\]]+)\\]\\([^)]+\\)/g, '$1')\n .replace(/[*_#>`]/g, '')\n .replace(/\\s+/g, ' ')\n .trim();\n const first = /^(.+?[.!?])(\\s|$)/.exec(plain)?.[1] ?? plain;\n return first.length > 80 ? `${first.slice(0, 79).trimEnd()}…` : first;\n}\n\n/** Minutes Lucy spent, at least one. */\nexport function minutesSpent(fromSeconds: number, nowSeconds: number): number {\n return Math.max(1, Math.round((nowSeconds - fromSeconds) / 60));\n}\n"],"names":[],"mappings":"AAmBA,MAAM,SAAY,GAAA,6BAAA;AAClB,MAAM,SAAY,GAAA,0DAAA;AAClB,MAAM,SAAY,GAAA,4DAAA;AAGF,SAAA,QAAA,CAAS,IAAc,EAAA,OAAA,GAAoB,SAAqB,EAAA;AAC9E,EAAI,IAAA,OAAA,KAAY,UAAU,SAAU,CAAA,IAAA,CAAK,IAAI,CAAK,IAAA,SAAA,CAAU,KAAK,IAAI,CAAA;AAAG,IAAO,OAAA,MAAA;AAC/E,EAAA,IAAI,OAAY,KAAA,MAAA,IAAU,SAAU,CAAA,IAAA,CAAK,IAAI,CAAA;AAAG,IAAO,OAAA,MAAA;AACvD,EAAO,OAAA,OAAA;AACT;AAGO,SAAS,WAAW,MAAyB,EAAA;AAClD,EAAO,OAAA,SAAA,CAAU,KAAK,MAAM,CAAA;AAC9B;AAGO,SAAS,UAAU,MAAwB,EAAA;AAChD,EAAA,MAAM,IAAI,MAAO,CAAA,OAAA,CAAQ,MAAQ,EAAA,GAAG,EAAE,IAAK,EAAA;AAC3C,EAAA,IAAI,CAAC,CAAA;AAAG,IAAO,OAAA,kBAAA;AACf,EAAO,OAAA,CAAA,CAAE,MAAS,GAAA,EAAA,GAAK,CAAG,EAAA,CAAA,CAAE,MAAM,CAAG,EAAA,EAAE,CAAE,CAAA,OAAA,EAAe,CAAA,MAAA,CAAA,GAAA,CAAA;AAC1D;AAGO,SAAS,YAAY,KAAuB,EAAA;AA3CnD,EAAA,IAAA,EAAA,EAAA,EAAA;AA4CE,EAAM,MAAA,KAAA,GAAQ,KAAM,CAAA,OAAA,CAAQ,2CAA6C,EAAA,EAAE,CAAE,CAAA,OAAA,CAAQ,uBAAyB,EAAA,EAAE,CAAE,CAAA,OAAA,CAAQ,oCAAsC,EAAA,IAAI,EAAE,OAAQ,CAAA,wBAAA,EAA0B,IAAI,CAAA,CAAE,OAAQ,CAAA,UAAA,EAAY,EAAE,CAAA,CAAE,OAAQ,CAAA,MAAA,EAAQ,GAAG,CAAA,CAAE,IAAK,EAAA;AAChQ,EAAA,MAAM,SAAQ,EAAoB,GAAA,CAAA,EAAA,GAAA,mBAAA,CAAA,IAAA,CAAK,KAAK,CAA9B,KAAA,IAAA,GAAA,MAAA,GAAA,EAAA,CAAkC,OAAlC,IAAwC,GAAA,EAAA,GAAA,KAAA;AACtD,EAAO,OAAA,KAAA,CAAM,MAAS,GAAA,EAAA,GAAK,CAAG,EAAA,KAAA,CAAM,MAAM,CAAG,EAAA,EAAE,CAAE,CAAA,OAAA,EAAe,CAAA,MAAA,CAAA,GAAA,KAAA;AAClE;AAGgB,SAAA,YAAA,CAAa,aAAqB,UAA4B,EAAA;AAC5E,EAAO,OAAA,IAAA,CAAK,IAAI,CAAG,EAAA,IAAA,CAAK,OAAO,UAAa,GAAA,WAAA,IAAe,EAAE,CAAC,CAAA;AAChE"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import AsyncStorage from'@react-native-async-storage/async-storage';import {Platform}from'react-native';import {requireOptionalNativeModule}from'expo-modules-core';import {cardTitle,cardKind,callStarts,minutesSpent,cardSummary}from'./card.js';var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
const native = Platform.OS === "ios" ? requireOptionalNativeModule("LucyLiveActivity") : null;
|
|
21
|
+
const DONE_SHOWN_S = 15 * 60;
|
|
22
|
+
const FAILED_SHOWN_S = 30 * 60;
|
|
23
|
+
const QUICK_S = 20;
|
|
24
|
+
const cards = /* @__PURE__ */ new Map();
|
|
25
|
+
const nowS = () => Date.now() / 1e3;
|
|
26
|
+
function enabled() {
|
|
27
|
+
try {
|
|
28
|
+
return Boolean(native == null ? void 0 : native.areEnabled());
|
|
29
|
+
} catch (e) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function show(choreId, card) {
|
|
34
|
+
native == null ? void 0 : native.update(choreId, card.state).catch(() => void 0);
|
|
35
|
+
}
|
|
36
|
+
function startChoreCard(choreId, prompt) {
|
|
37
|
+
if (!native || cards.has(choreId) || !enabled())
|
|
38
|
+
return;
|
|
39
|
+
const began = nowS();
|
|
40
|
+
const card = {
|
|
41
|
+
title: cardTitle(prompt),
|
|
42
|
+
began,
|
|
43
|
+
state: {
|
|
44
|
+
kind: cardKind(prompt),
|
|
45
|
+
phase: "working",
|
|
46
|
+
detail: "Getting started",
|
|
47
|
+
startedAt: began
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
cards.set(choreId, card);
|
|
51
|
+
native.start(choreId, card.title, card.state).catch(() => cards.delete(choreId));
|
|
52
|
+
}
|
|
53
|
+
function choreCardStatus(choreId, status) {
|
|
54
|
+
var _a;
|
|
55
|
+
const card = cards.get(choreId);
|
|
56
|
+
const line = status.trim();
|
|
57
|
+
if (!card || !line || line === card.state.detail)
|
|
58
|
+
return;
|
|
59
|
+
if (card.callAt === void 0 && callStarts(line))
|
|
60
|
+
card.callAt = nowS();
|
|
61
|
+
card.state = __spreadProps(__spreadValues({}, card.state), {
|
|
62
|
+
kind: cardKind(line, card.state.kind),
|
|
63
|
+
phase: "working",
|
|
64
|
+
detail: line,
|
|
65
|
+
startedAt: (_a = card.callAt) != null ? _a : card.began
|
|
66
|
+
});
|
|
67
|
+
show(choreId, card);
|
|
68
|
+
}
|
|
69
|
+
function choreCardAsks(choreId, question) {
|
|
70
|
+
const card = cards.get(choreId);
|
|
71
|
+
if (!card || card.state.phase === "asking")
|
|
72
|
+
return;
|
|
73
|
+
card.state = __spreadProps(__spreadValues({}, card.state), {
|
|
74
|
+
phase: "asking",
|
|
75
|
+
detail: question
|
|
76
|
+
});
|
|
77
|
+
show(choreId, card);
|
|
78
|
+
}
|
|
79
|
+
function choreCardResumes(choreId) {
|
|
80
|
+
const card = cards.get(choreId);
|
|
81
|
+
if (!card)
|
|
82
|
+
return;
|
|
83
|
+
card.state = __spreadProps(__spreadValues({}, card.state), {
|
|
84
|
+
phase: "working",
|
|
85
|
+
detail: "Back on it"
|
|
86
|
+
});
|
|
87
|
+
show(choreId, card);
|
|
88
|
+
}
|
|
89
|
+
function endChoreCard(choreId, outcome, reply = "") {
|
|
90
|
+
const card = cards.get(choreId);
|
|
91
|
+
if (!card || !native)
|
|
92
|
+
return;
|
|
93
|
+
cards.delete(choreId);
|
|
94
|
+
if (outcome === "stopped") {
|
|
95
|
+
native.end(choreId, null, 0).catch(() => void 0);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const now = nowS();
|
|
99
|
+
const state = outcome === "done" ? __spreadProps(__spreadValues({}, card.state), {
|
|
100
|
+
phase: "done",
|
|
101
|
+
detail: cardSummary(reply) || "All done",
|
|
102
|
+
minutesBack: minutesSpent(card.began, now)
|
|
103
|
+
}) : __spreadProps(__spreadValues({}, card.state), {
|
|
104
|
+
phase: "failed",
|
|
105
|
+
detail: "Open Clockbook to see what happened"
|
|
106
|
+
});
|
|
107
|
+
const shown = now - card.began < QUICK_S ? 0 : outcome === "done" ? DONE_SHOWN_S : FAILED_SHOWN_S;
|
|
108
|
+
native.end(choreId, state, shown).catch(() => void 0);
|
|
109
|
+
}
|
|
110
|
+
const CARD_TOKENS_KEY = "clockbook.lucy.cardTokens";
|
|
111
|
+
const MAX_CARD_TOKENS = 30;
|
|
112
|
+
let cardTokens = null;
|
|
113
|
+
const cardTokenListeners = /* @__PURE__ */ new Set();
|
|
114
|
+
async function loadCardTokens() {
|
|
115
|
+
if (cardTokens)
|
|
116
|
+
return cardTokens;
|
|
117
|
+
let saved = [];
|
|
118
|
+
try {
|
|
119
|
+
const raw = await AsyncStorage.getItem(CARD_TOKENS_KEY);
|
|
120
|
+
if (raw)
|
|
121
|
+
saved = JSON.parse(raw);
|
|
122
|
+
} catch (e) {
|
|
123
|
+
}
|
|
124
|
+
cardTokens = new Map([...Array.isArray(saved) ? saved : [], ...cardTokens != null ? cardTokens : []]);
|
|
125
|
+
return cardTokens;
|
|
126
|
+
}
|
|
127
|
+
function keepCardToken(choreId, token) {
|
|
128
|
+
const tokens = cardTokens != null ? cardTokens : /* @__PURE__ */ new Map();
|
|
129
|
+
cardTokens = tokens;
|
|
130
|
+
tokens.delete(choreId);
|
|
131
|
+
tokens.set(choreId, token);
|
|
132
|
+
while (tokens.size > MAX_CARD_TOKENS)
|
|
133
|
+
tokens.delete(tokens.keys().next().value);
|
|
134
|
+
AsyncStorage.setItem(CARD_TOKENS_KEY, JSON.stringify([...tokens])).catch(() => void 0);
|
|
135
|
+
cardTokenListeners.forEach((l) => l(choreId, token));
|
|
136
|
+
}
|
|
137
|
+
async function cardTokenFor(choreId) {
|
|
138
|
+
return (await loadCardTokens()).get(choreId);
|
|
139
|
+
}
|
|
140
|
+
function onCardToken(listener) {
|
|
141
|
+
cardTokenListeners.add(listener);
|
|
142
|
+
return () => cardTokenListeners.delete(listener);
|
|
143
|
+
}
|
|
144
|
+
native == null ? void 0 : native.addListener("onPushToken", (e) => keepCardToken(e.choreId, e.token));export{cardTokenFor,choreCardAsks,choreCardResumes,choreCardStatus,endChoreCard,onCardToken,startChoreCard};//# sourceMappingURL=liveActivity.js.map
|