@simon-says-build/ssb-overlay
v0.13.3
Published
SSB inside a native app SimonSays controls: the SSB button for the people who change the app (screenshot, mark, ask for a change), and Help for everyone who uses it.
Readme
@simon-says-build/ssb-overlay
The SSB button inside a native app SimonSays controls (docs/IN-APP-SSB.md). A member of the app's organization, an SSB operator, or an allowed cast login (the super-admin by default) gets a small SSB button; it opens Tell SSB on the phone: the screen's picture, a mark on it, the conversation, SSB's drafts and Start working. Everyone else sees nothing.
import { SsbHost } from "@simon-says-build/ssb-overlay";
import { captureScreen } from "react-native-view-shot";
<SsbHost
appId={Constants.expoConfig?.extra?.ssb?.appId}
backend={process.env.EXPO_PUBLIC_SUPABASE_URL}
getToken={async () => (await supabase.auth.getSession()).data.session?.access_token}
sessionKey={session?.user.id}
route={usePathname()}
capture={() => captureScreen({ format: "jpg", quality: 0.6, result: "data-uri" })}
storage={AsyncStorage}
>
{/* the app */}
</SsbHost>Nothing secret goes in the bundle: the app's own session token is checked by SSB against the app's backend (functions/in-app.mjs).
SSB opens as a bottom sheet (0.9.0): half way up with the chat, full screen
with the work at the top. It needs @gorhom/bottom-sheet 5,
react-native-reanimated, react-native-worklets and
react-native-gesture-handler in the app (npx expo install them; the
installer does).
Help, for everyone who uses the app (0.8.0)
<SsbHelp> is the web Help widget's native twin (docs/HELPDESK.md): ANY
signed-in user of the app asks how it works; SSB answers, and hands it to a
person on the organization's help desk when it cannot help. It shows only
where the organization switched its help desk on for the app.
import { SsbHelp, SsbHelpChat, useSsbHelp } from "@simon-says-build/ssb-overlay";
<SsbHelp appId="impulse-native" backend="firebase:impulse-mode"
getToken={() => auth.currentUser?.getIdToken() ?? null} sessionKey={user?.uid}
route={usePathname()} bubble={showHelpEverywhere}>
{/* the app */}
</SsbHelp>
// Where Help belongs in the app: `useSsbHelp().show` / `.unread`, a screen
// rendering <SsbHelpChat onClose={router.back} />, and `bubble` for a Help
// button on every screen (the person's own switch, kept by the app).npm test runs the pure half.
