expo-invoke 1.0.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.
Files changed (144) hide show
  1. package/MIGRATION.md +125 -0
  2. package/README.md +942 -0
  3. package/SECURITY.md +35 -0
  4. package/android/build.gradle +42 -0
  5. package/android/src/main/java/expo/modules/invoke/AppActionsHandler.kt +74 -0
  6. package/android/src/main/java/expo/modules/invoke/ExpoInvokeModule.kt +135 -0
  7. package/android/src/main/java/expo/modules/invoke/QuickTileService.kt +63 -0
  8. package/android/src/main/java/expo/modules/invoke/ShortcutsHelper.kt +72 -0
  9. package/build/cli/commands/generate.d.ts +1 -0
  10. package/build/cli/commands/generate.js +119 -0
  11. package/build/cli/commands/generate.js.map +1 -0
  12. package/build/cli/commands/test.d.ts +1 -0
  13. package/build/cli/commands/test.js +53 -0
  14. package/build/cli/commands/test.js.map +1 -0
  15. package/build/cli/commands/validate.d.ts +1 -0
  16. package/build/cli/commands/validate.js +116 -0
  17. package/build/cli/commands/validate.js.map +1 -0
  18. package/build/cli/index.d.ts +2 -0
  19. package/build/cli/index.js +37 -0
  20. package/build/cli/index.js.map +1 -0
  21. package/build/plugin/android/withAndroidInvoke.d.ts +8 -0
  22. package/build/plugin/android/withAndroidInvoke.js +106 -0
  23. package/build/plugin/android/withAndroidInvoke.js.map +1 -0
  24. package/build/plugin/codegen/generateActionsXml.d.ts +2 -0
  25. package/build/plugin/codegen/generateActionsXml.js +69 -0
  26. package/build/plugin/codegen/generateActionsXml.js.map +1 -0
  27. package/build/plugin/codegen/generateShortcutsXml.d.ts +2 -0
  28. package/build/plugin/codegen/generateShortcutsXml.js +45 -0
  29. package/build/plugin/codegen/generateShortcutsXml.js.map +1 -0
  30. package/build/plugin/codegen/generateSwiftIntents.d.ts +2 -0
  31. package/build/plugin/codegen/generateSwiftIntents.js +129 -0
  32. package/build/plugin/codegen/generateSwiftIntents.js.map +1 -0
  33. package/build/plugin/ios/withIOSInvoke.d.ts +9 -0
  34. package/build/plugin/ios/withIOSInvoke.js +83 -0
  35. package/build/plugin/ios/withIOSInvoke.js.map +1 -0
  36. package/build/plugin/src/withInvoke.d.ts +16 -0
  37. package/build/plugin/src/withInvoke.js +13 -0
  38. package/build/plugin/src/withInvoke.js.map +1 -0
  39. package/build/src/components/AddToSiriButton.d.ts +18 -0
  40. package/build/src/components/AddToSiriButton.d.ts.map +1 -0
  41. package/build/src/components/AddToSiriButton.js +35 -0
  42. package/build/src/components/AddToSiriButton.js.map +1 -0
  43. package/build/src/components/InvokeDebugger.d.ts +12 -0
  44. package/build/src/components/InvokeDebugger.d.ts.map +1 -0
  45. package/build/src/components/InvokeDebugger.js +122 -0
  46. package/build/src/components/InvokeDebugger.js.map +1 -0
  47. package/build/src/components/ShortcutChip.d.ts +20 -0
  48. package/build/src/components/ShortcutChip.d.ts.map +1 -0
  49. package/build/src/components/ShortcutChip.js +44 -0
  50. package/build/src/components/ShortcutChip.js.map +1 -0
  51. package/build/src/hooks/useAddToSiri.d.ts +9 -0
  52. package/build/src/hooks/useAddToSiri.d.ts.map +1 -0
  53. package/build/src/hooks/useAddToSiri.js +15 -0
  54. package/build/src/hooks/useAddToSiri.js.map +1 -0
  55. package/build/src/hooks/useDonation.d.ts +26 -0
  56. package/build/src/hooks/useDonation.d.ts.map +1 -0
  57. package/build/src/hooks/useDonation.js +21 -0
  58. package/build/src/hooks/useDonation.js.map +1 -0
  59. package/build/src/hooks/useFocusFilter.d.ts +11 -0
  60. package/build/src/hooks/useFocusFilter.d.ts.map +1 -0
  61. package/build/src/hooks/useFocusFilter.js +24 -0
  62. package/build/src/hooks/useFocusFilter.js.map +1 -0
  63. package/build/src/hooks/useHandoff.d.ts +29 -0
  64. package/build/src/hooks/useHandoff.d.ts.map +1 -0
  65. package/build/src/hooks/useHandoff.js +27 -0
  66. package/build/src/hooks/useHandoff.js.map +1 -0
  67. package/build/src/hooks/useInvoke.d.ts +43 -0
  68. package/build/src/hooks/useInvoke.d.ts.map +1 -0
  69. package/build/src/hooks/useInvoke.js +70 -0
  70. package/build/src/hooks/useInvoke.js.map +1 -0
  71. package/build/src/hooks/useInvokeAnalytics.d.ts +23 -0
  72. package/build/src/hooks/useInvokeAnalytics.d.ts.map +1 -0
  73. package/build/src/hooks/useInvokeAnalytics.js +27 -0
  74. package/build/src/hooks/useInvokeAnalytics.js.map +1 -0
  75. package/build/src/hooks/useInvokeHistory.d.ts +11 -0
  76. package/build/src/hooks/useInvokeHistory.d.ts.map +1 -0
  77. package/build/src/hooks/useInvokeHistory.js +26 -0
  78. package/build/src/hooks/useInvokeHistory.js.map +1 -0
  79. package/build/src/hooks/useInvokeInit.d.ts +16 -0
  80. package/build/src/hooks/useInvokeInit.d.ts.map +1 -0
  81. package/build/src/hooks/useInvokeInit.js +32 -0
  82. package/build/src/hooks/useInvokeInit.js.map +1 -0
  83. package/build/src/hooks/useLiveActivityIntent.d.ts +21 -0
  84. package/build/src/hooks/useLiveActivityIntent.d.ts.map +1 -0
  85. package/build/src/hooks/useLiveActivityIntent.js +9 -0
  86. package/build/src/hooks/useLiveActivityIntent.js.map +1 -0
  87. package/build/src/hooks/useQuickTile.d.ts +23 -0
  88. package/build/src/hooks/useQuickTile.d.ts.map +1 -0
  89. package/build/src/hooks/useQuickTile.js +15 -0
  90. package/build/src/hooks/useQuickTile.js.map +1 -0
  91. package/build/src/hooks/useShortcuts.d.ts +25 -0
  92. package/build/src/hooks/useShortcuts.d.ts.map +1 -0
  93. package/build/src/hooks/useShortcuts.js +23 -0
  94. package/build/src/hooks/useShortcuts.js.map +1 -0
  95. package/build/src/hooks/useSpotlight.d.ts +23 -0
  96. package/build/src/hooks/useSpotlight.d.ts.map +1 -0
  97. package/build/src/hooks/useSpotlight.js +13 -0
  98. package/build/src/hooks/useSpotlight.js.map +1 -0
  99. package/build/src/hooks/useWidgetData.d.ts +20 -0
  100. package/build/src/hooks/useWidgetData.d.ts.map +1 -0
  101. package/build/src/hooks/useWidgetData.js +12 -0
  102. package/build/src/hooks/useWidgetData.js.map +1 -0
  103. package/build/src/index.d.ts +32 -0
  104. package/build/src/index.d.ts.map +1 -0
  105. package/build/src/index.js +27 -0
  106. package/build/src/index.js.map +1 -0
  107. package/build/src/module.d.ts +25 -0
  108. package/build/src/module.d.ts.map +1 -0
  109. package/build/src/module.js +102 -0
  110. package/build/src/module.js.map +1 -0
  111. package/build/src/types/index.d.ts +156 -0
  112. package/build/src/types/index.d.ts.map +1 -0
  113. package/build/src/types/index.js +4 -0
  114. package/build/src/types/index.js.map +1 -0
  115. package/build/src/utils/actionStore.d.ts +6 -0
  116. package/build/src/utils/actionStore.d.ts.map +1 -0
  117. package/build/src/utils/actionStore.js +32 -0
  118. package/build/src/utils/actionStore.js.map +1 -0
  119. package/build/src/utils/analytics.d.ts +12 -0
  120. package/build/src/utils/analytics.d.ts.map +1 -0
  121. package/build/src/utils/analytics.js +29 -0
  122. package/build/src/utils/analytics.js.map +1 -0
  123. package/build/src/utils/testing.d.ts +39 -0
  124. package/build/src/utils/testing.d.ts.map +1 -0
  125. package/build/src/utils/testing.js +58 -0
  126. package/build/src/utils/testing.js.map +1 -0
  127. package/build/src/utils/validation.d.ts +11 -0
  128. package/build/src/utils/validation.d.ts.map +1 -0
  129. package/build/src/utils/validation.js +128 -0
  130. package/build/src/utils/validation.js.map +1 -0
  131. package/expo-module.config.json +9 -0
  132. package/ios/Focus/FocusFilterManager.swift +19 -0
  133. package/ios/Intents/BaseInvokeIntent.swift +42 -0
  134. package/ios/Intents/HandoffManager.swift +49 -0
  135. package/ios/Intents/InvokeActionStore.swift +21 -0
  136. package/ios/Intents/InvokeParameterTypes.swift +142 -0
  137. package/ios/LiveActivity/LiveActivityIntentBridge.swift +44 -0
  138. package/ios/Module/ExpoInvokeModule.swift +170 -0
  139. package/ios/Notifications/NotificationActionHandler.swift +80 -0
  140. package/ios/Shortcuts/DonationManager.swift +44 -0
  141. package/ios/Shortcuts/ShortcutsManager.swift +32 -0
  142. package/ios/Shortcuts/SpotlightManager.swift +48 -0
  143. package/ios/Widget/WidgetManager.swift +19 -0
  144. package/package.json +111 -0
package/MIGRATION.md ADDED
@@ -0,0 +1,125 @@
1
+ # Migration Guide
2
+
3
+ ## From `expo-errands-assistant`
4
+
5
+ The `expo-errands-assistant` local module was hardcoded for a single Siri action with no parameters, no Android support, and no reusability. `expo-invoke` replaces it entirely.
6
+
7
+ ### Step 1 — Replace the import
8
+
9
+ ```diff
10
+ - import { useErrandsAssistant } from '../modules/expo-errands-assistant';
11
+ + import { useInvokeInit, useInvoke } from 'expo-invoke';
12
+ ```
13
+
14
+ ### Step 2 — Replace the root-level init
15
+
16
+ ```diff
17
+ // app/_layout.tsx
18
+ - useErrandsAssistant(); // old
19
+ + useInvokeInit(); // new — same cold/warm start behaviour
20
+ ```
21
+
22
+ ### Step 3 — Replace the intent listener
23
+
24
+ ```diff
25
+ // Before
26
+ - const { action } = useErrandsAssistant();
27
+ - if (action === 'CreateErrand') { router.push('/create'); }
28
+
29
+ // After
30
+ + const { intent } = useInvoke({ intentId: 'create_errand' });
31
+ + useEffect(() => { if (intent) router.push('/create'); }, [intent]);
32
+ ```
33
+
34
+ ### Step 4 — Move the native intent to app.json
35
+
36
+ Delete the hardcoded Swift intent file. The config plugin generates it:
37
+
38
+ ```json
39
+ // app.json
40
+ {
41
+ "plugins": [["expo-invoke", {
42
+ "intents": [{
43
+ "id": "create_errand",
44
+ "title": "Create an Errand",
45
+ "phrases": ["Create an errand in ${applicationName}"]
46
+ }]
47
+ }]]
48
+ }
49
+ ```
50
+
51
+ ---
52
+
53
+ ## From `react-native-siri-shortcut`
54
+
55
+ ### Install expo-invoke
56
+
57
+ ```bash
58
+ npx expo install expo-invoke
59
+ npx expo uninstall react-native-siri-shortcut
60
+ ```
61
+
62
+ ### Replace donation calls
63
+
64
+ ```diff
65
+ - import SiriShortcuts from 'react-native-siri-shortcut';
66
+ - SiriShortcuts.donateShortcut({ identifier: 'create', title: 'Create', userInfo: {} });
67
+
68
+ + import { useDonation } from 'expo-invoke';
69
+ + const { donate } = useDonation();
70
+ + donate({ intentId: 'create_errand', title: 'Create an Errand' });
71
+ ```
72
+
73
+ ### Replace the shortcut listener
74
+
75
+ ```diff
76
+ - import { ShortcutListener } from 'react-native-siri-shortcut';
77
+ - <ShortcutListener onShortcutReceived={({ identifier }) => { ... }} />
78
+
79
+ + import { useInvoke } from 'expo-invoke';
80
+ + const { intent } = useInvoke();
81
+ + // intent.intentId === 'create_errand' when fired
82
+ ```
83
+
84
+ ---
85
+
86
+ ## From `expo-siri-shortcut`
87
+
88
+ ### Install expo-invoke
89
+
90
+ ```bash
91
+ npx expo install expo-invoke
92
+ npx expo uninstall expo-siri-shortcut
93
+ ```
94
+
95
+ ### Replace the shortcut button
96
+
97
+ ```diff
98
+ - import { SiriShortcutButton } from 'expo-siri-shortcut';
99
+ - <SiriShortcutButton shortcut={{ activityType: 'create', title: 'Create' }} />
100
+
101
+ + import { AddToSiriButton } from 'expo-invoke';
102
+ + <AddToSiriButton intentId="create_errand" />
103
+ ```
104
+
105
+ ### Replace the activity listener
106
+
107
+ The old `expo-siri-shortcut` used `NSUserActivity`. `expo-invoke` uses the modern App Intents API. Replace the app delegate hook with `useInvokeInit()` and receive via `useInvoke()`.
108
+
109
+ ---
110
+
111
+ ## Key Behavioural Differences
112
+
113
+ | Behaviour | Old packages | expo-invoke |
114
+ |---|---|---|
115
+ | iOS API | SiriKit (deprecated) | App Intents (iOS 16+) |
116
+ | Android | None | Google App Actions BII |
117
+ | Multi-intent | No | Yes — unlimited |
118
+ | Parameters | None / manual | 8 typed parameter types |
119
+ | Widget bridge | No | Yes — WidgetKit + AppWidgetProvider |
120
+ | Dynamic Island | No | Yes |
121
+ | Cold start TTL | None | 30s default, configurable |
122
+ | Intent deduplication | No | Yes (2s window) |
123
+ | Source attribution | No | 20 surfaces |
124
+ | Testing utilities | No | mockInvoke, simulateColdStart |
125
+ | CLI | No | validate, generate, test |