@ateam-ai-mobile/expo 0.1.0

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/src/haptics.ts ADDED
@@ -0,0 +1,27 @@
1
+ /**
2
+ * expo-haptics implementation of the plugin HapticsAPI.
3
+ */
4
+ import * as Haptics from 'expo-haptics';
5
+ import type { HapticsAPI } from '@ateam-ai-mobile/plugin-runtime';
6
+
7
+ export const expoHaptics: HapticsAPI = {
8
+ impact(style) {
9
+ const map = {
10
+ light: Haptics.ImpactFeedbackStyle.Light,
11
+ medium: Haptics.ImpactFeedbackStyle.Medium,
12
+ heavy: Haptics.ImpactFeedbackStyle.Heavy,
13
+ } as const;
14
+ Haptics.impactAsync(map[style]).catch(() => {});
15
+ },
16
+ notification(type) {
17
+ const map = {
18
+ success: Haptics.NotificationFeedbackType.Success,
19
+ warning: Haptics.NotificationFeedbackType.Warning,
20
+ error: Haptics.NotificationFeedbackType.Error,
21
+ } as const;
22
+ Haptics.notificationAsync(map[type]).catch(() => {});
23
+ },
24
+ selection() {
25
+ Haptics.selectionAsync().catch(() => {});
26
+ },
27
+ };
package/src/index.ts ADDED
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @ateam-ai-mobile/expo — Expo-backed providers for the ADAS SDK.
3
+ *
4
+ * Bare-RN hosts skip this package entirely (core + plugin-runtime have safe
5
+ * defaults); Expo hosts call setupExpoProviders() once at startup to light
6
+ * up haptics, persistent bundle caching, attachment previews, and the
7
+ * expo modules remote bundles may require.
8
+ */
9
+ import * as ExpoWebBrowser from 'expo-web-browser';
10
+ import * as ExpoLinking from 'expo-linking';
11
+ import * as ExpoClipboard from 'expo-clipboard';
12
+ import {
13
+ setHapticsProvider,
14
+ setBundleStorage,
15
+ registerBundleModules,
16
+ } from '@ateam-ai-mobile/plugin-runtime';
17
+ import { setClipboardProvider } from '@ateam-ai-mobile/ui';
18
+
19
+ import { expoHaptics } from './haptics';
20
+ import { ExpoBundleStorage } from './bundleStorage';
21
+ import { ExpoAttachmentCache } from './attachmentCache';
22
+
23
+ export { expoHaptics } from './haptics';
24
+ export { ExpoBundleStorage } from './bundleStorage';
25
+ export { ExpoAttachmentCache } from './attachmentCache';
26
+ // NOTE: createBridge (device capabilities bridge) is intentionally NOT
27
+ // exported here — it statically imports the optional expo modules
28
+ // (calendar/contacts/location/…), which would break Metro builds in hosts
29
+ // that don't install them. Install those modules and import it from the
30
+ // subpath: `import { createBridge } from '@ateam-ai-mobile/expo/bridge'`.
31
+
32
+ /**
33
+ * Wire all Expo providers in one call. Runs before initAdas() is fine —
34
+ * these registries are independent of the core config.
35
+ *
36
+ * Returns the attachment cache so the host can pass it to initAdas():
37
+ * const { attachmentCache } = setupExpoProviders();
38
+ * initAdas({ ..., attachmentCache });
39
+ */
40
+ export function setupExpoProviders(opts?: {
41
+ /** Extra modules remote bundles may require(), e.g. react-native-webview.
42
+ * Static imports must live in the HOST (it owns the native build). */
43
+ bundleModules?: Record<string, any>;
44
+ }): { attachmentCache: ExpoAttachmentCache } {
45
+ setHapticsProvider(expoHaptics);
46
+ setBundleStorage(new ExpoBundleStorage());
47
+ setClipboardProvider({
48
+ setString: (text: string) => ExpoClipboard.setStringAsync(text).then(() => {}),
49
+ });
50
+ registerBundleModules({
51
+ 'expo-web-browser': ExpoWebBrowser,
52
+ 'expo-linking': ExpoLinking,
53
+ ...(opts?.bundleModules || {}),
54
+ });
55
+ return { attachmentCache: new ExpoAttachmentCache() };
56
+ }