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.
- package/MIGRATION.md +125 -0
- package/README.md +942 -0
- package/SECURITY.md +35 -0
- package/android/build.gradle +42 -0
- package/android/src/main/java/expo/modules/invoke/AppActionsHandler.kt +74 -0
- package/android/src/main/java/expo/modules/invoke/ExpoInvokeModule.kt +135 -0
- package/android/src/main/java/expo/modules/invoke/QuickTileService.kt +63 -0
- package/android/src/main/java/expo/modules/invoke/ShortcutsHelper.kt +72 -0
- package/build/cli/commands/generate.d.ts +1 -0
- package/build/cli/commands/generate.js +119 -0
- package/build/cli/commands/generate.js.map +1 -0
- package/build/cli/commands/test.d.ts +1 -0
- package/build/cli/commands/test.js +53 -0
- package/build/cli/commands/test.js.map +1 -0
- package/build/cli/commands/validate.d.ts +1 -0
- package/build/cli/commands/validate.js +116 -0
- package/build/cli/commands/validate.js.map +1 -0
- package/build/cli/index.d.ts +2 -0
- package/build/cli/index.js +37 -0
- package/build/cli/index.js.map +1 -0
- package/build/plugin/android/withAndroidInvoke.d.ts +8 -0
- package/build/plugin/android/withAndroidInvoke.js +106 -0
- package/build/plugin/android/withAndroidInvoke.js.map +1 -0
- package/build/plugin/codegen/generateActionsXml.d.ts +2 -0
- package/build/plugin/codegen/generateActionsXml.js +69 -0
- package/build/plugin/codegen/generateActionsXml.js.map +1 -0
- package/build/plugin/codegen/generateShortcutsXml.d.ts +2 -0
- package/build/plugin/codegen/generateShortcutsXml.js +45 -0
- package/build/plugin/codegen/generateShortcutsXml.js.map +1 -0
- package/build/plugin/codegen/generateSwiftIntents.d.ts +2 -0
- package/build/plugin/codegen/generateSwiftIntents.js +129 -0
- package/build/plugin/codegen/generateSwiftIntents.js.map +1 -0
- package/build/plugin/ios/withIOSInvoke.d.ts +9 -0
- package/build/plugin/ios/withIOSInvoke.js +83 -0
- package/build/plugin/ios/withIOSInvoke.js.map +1 -0
- package/build/plugin/src/withInvoke.d.ts +16 -0
- package/build/plugin/src/withInvoke.js +13 -0
- package/build/plugin/src/withInvoke.js.map +1 -0
- package/build/src/components/AddToSiriButton.d.ts +18 -0
- package/build/src/components/AddToSiriButton.d.ts.map +1 -0
- package/build/src/components/AddToSiriButton.js +35 -0
- package/build/src/components/AddToSiriButton.js.map +1 -0
- package/build/src/components/InvokeDebugger.d.ts +12 -0
- package/build/src/components/InvokeDebugger.d.ts.map +1 -0
- package/build/src/components/InvokeDebugger.js +122 -0
- package/build/src/components/InvokeDebugger.js.map +1 -0
- package/build/src/components/ShortcutChip.d.ts +20 -0
- package/build/src/components/ShortcutChip.d.ts.map +1 -0
- package/build/src/components/ShortcutChip.js +44 -0
- package/build/src/components/ShortcutChip.js.map +1 -0
- package/build/src/hooks/useAddToSiri.d.ts +9 -0
- package/build/src/hooks/useAddToSiri.d.ts.map +1 -0
- package/build/src/hooks/useAddToSiri.js +15 -0
- package/build/src/hooks/useAddToSiri.js.map +1 -0
- package/build/src/hooks/useDonation.d.ts +26 -0
- package/build/src/hooks/useDonation.d.ts.map +1 -0
- package/build/src/hooks/useDonation.js +21 -0
- package/build/src/hooks/useDonation.js.map +1 -0
- package/build/src/hooks/useFocusFilter.d.ts +11 -0
- package/build/src/hooks/useFocusFilter.d.ts.map +1 -0
- package/build/src/hooks/useFocusFilter.js +24 -0
- package/build/src/hooks/useFocusFilter.js.map +1 -0
- package/build/src/hooks/useHandoff.d.ts +29 -0
- package/build/src/hooks/useHandoff.d.ts.map +1 -0
- package/build/src/hooks/useHandoff.js +27 -0
- package/build/src/hooks/useHandoff.js.map +1 -0
- package/build/src/hooks/useInvoke.d.ts +43 -0
- package/build/src/hooks/useInvoke.d.ts.map +1 -0
- package/build/src/hooks/useInvoke.js +70 -0
- package/build/src/hooks/useInvoke.js.map +1 -0
- package/build/src/hooks/useInvokeAnalytics.d.ts +23 -0
- package/build/src/hooks/useInvokeAnalytics.d.ts.map +1 -0
- package/build/src/hooks/useInvokeAnalytics.js +27 -0
- package/build/src/hooks/useInvokeAnalytics.js.map +1 -0
- package/build/src/hooks/useInvokeHistory.d.ts +11 -0
- package/build/src/hooks/useInvokeHistory.d.ts.map +1 -0
- package/build/src/hooks/useInvokeHistory.js +26 -0
- package/build/src/hooks/useInvokeHistory.js.map +1 -0
- package/build/src/hooks/useInvokeInit.d.ts +16 -0
- package/build/src/hooks/useInvokeInit.d.ts.map +1 -0
- package/build/src/hooks/useInvokeInit.js +32 -0
- package/build/src/hooks/useInvokeInit.js.map +1 -0
- package/build/src/hooks/useLiveActivityIntent.d.ts +21 -0
- package/build/src/hooks/useLiveActivityIntent.d.ts.map +1 -0
- package/build/src/hooks/useLiveActivityIntent.js +9 -0
- package/build/src/hooks/useLiveActivityIntent.js.map +1 -0
- package/build/src/hooks/useQuickTile.d.ts +23 -0
- package/build/src/hooks/useQuickTile.d.ts.map +1 -0
- package/build/src/hooks/useQuickTile.js +15 -0
- package/build/src/hooks/useQuickTile.js.map +1 -0
- package/build/src/hooks/useShortcuts.d.ts +25 -0
- package/build/src/hooks/useShortcuts.d.ts.map +1 -0
- package/build/src/hooks/useShortcuts.js +23 -0
- package/build/src/hooks/useShortcuts.js.map +1 -0
- package/build/src/hooks/useSpotlight.d.ts +23 -0
- package/build/src/hooks/useSpotlight.d.ts.map +1 -0
- package/build/src/hooks/useSpotlight.js +13 -0
- package/build/src/hooks/useSpotlight.js.map +1 -0
- package/build/src/hooks/useWidgetData.d.ts +20 -0
- package/build/src/hooks/useWidgetData.d.ts.map +1 -0
- package/build/src/hooks/useWidgetData.js +12 -0
- package/build/src/hooks/useWidgetData.js.map +1 -0
- package/build/src/index.d.ts +32 -0
- package/build/src/index.d.ts.map +1 -0
- package/build/src/index.js +27 -0
- package/build/src/index.js.map +1 -0
- package/build/src/module.d.ts +25 -0
- package/build/src/module.d.ts.map +1 -0
- package/build/src/module.js +102 -0
- package/build/src/module.js.map +1 -0
- package/build/src/types/index.d.ts +156 -0
- package/build/src/types/index.d.ts.map +1 -0
- package/build/src/types/index.js +4 -0
- package/build/src/types/index.js.map +1 -0
- package/build/src/utils/actionStore.d.ts +6 -0
- package/build/src/utils/actionStore.d.ts.map +1 -0
- package/build/src/utils/actionStore.js +32 -0
- package/build/src/utils/actionStore.js.map +1 -0
- package/build/src/utils/analytics.d.ts +12 -0
- package/build/src/utils/analytics.d.ts.map +1 -0
- package/build/src/utils/analytics.js +29 -0
- package/build/src/utils/analytics.js.map +1 -0
- package/build/src/utils/testing.d.ts +39 -0
- package/build/src/utils/testing.d.ts.map +1 -0
- package/build/src/utils/testing.js +58 -0
- package/build/src/utils/testing.js.map +1 -0
- package/build/src/utils/validation.d.ts +11 -0
- package/build/src/utils/validation.d.ts.map +1 -0
- package/build/src/utils/validation.js +128 -0
- package/build/src/utils/validation.js.map +1 -0
- package/expo-module.config.json +9 -0
- package/ios/Focus/FocusFilterManager.swift +19 -0
- package/ios/Intents/BaseInvokeIntent.swift +42 -0
- package/ios/Intents/HandoffManager.swift +49 -0
- package/ios/Intents/InvokeActionStore.swift +21 -0
- package/ios/Intents/InvokeParameterTypes.swift +142 -0
- package/ios/LiveActivity/LiveActivityIntentBridge.swift +44 -0
- package/ios/Module/ExpoInvokeModule.swift +170 -0
- package/ios/Notifications/NotificationActionHandler.swift +80 -0
- package/ios/Shortcuts/DonationManager.swift +44 -0
- package/ios/Shortcuts/ShortcutsManager.swift +32 -0
- package/ios/Shortcuts/SpotlightManager.swift +48 -0
- package/ios/Widget/WidgetManager.swift +19 -0
- package/package.json +111 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ResolvedIntent, InvokeSource, ParameterValue } from '../types';
|
|
2
|
+
export interface UseInvokeOptions {
|
|
3
|
+
/** Only fire for this specific intentId. Omit to receive all. */
|
|
4
|
+
intentId?: string;
|
|
5
|
+
/** Only fire for intents from these sources. Omit to receive from all. */
|
|
6
|
+
source?: InvokeSource | InvokeSource[];
|
|
7
|
+
/** Inline handler — alternative to watching `intent` in a useEffect */
|
|
8
|
+
onFire?: (intent: ResolvedIntent) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface UseInvokeResult {
|
|
11
|
+
/** The most recently received intent, or null if none pending */
|
|
12
|
+
intent: ResolvedIntent | null;
|
|
13
|
+
/** Typed shortcut to the intent's parameters */
|
|
14
|
+
parameters: Record<string, ParameterValue>;
|
|
15
|
+
/** The surface that triggered this intent */
|
|
16
|
+
source: InvokeSource | null;
|
|
17
|
+
/** Call this after you've handled the intent to clear it */
|
|
18
|
+
clear: () => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The main hook for receiving intents from any native surface.
|
|
22
|
+
*
|
|
23
|
+
* Works for cold start (app was closed) and warm start (app was backgrounded).
|
|
24
|
+
* Call useInvokeInit() once in the root layout first.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // Receive any intent
|
|
28
|
+
* const { intent, parameters, source, clear } = useInvoke();
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* // Filter by intent ID
|
|
32
|
+
* const { intent, parameters } = useInvoke({ intentId: 'create_errand' });
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // Filter by surface
|
|
36
|
+
* const { intent } = useInvoke({ source: ['siri', 'widget'] });
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* // Inline handler
|
|
40
|
+
* useInvoke({ intentId: 'create_errand', onFire: (i) => openWizard(i.parameters) });
|
|
41
|
+
*/
|
|
42
|
+
export declare function useInvoke(options?: UseInvokeOptions): UseInvokeResult;
|
|
43
|
+
//# sourceMappingURL=useInvoke.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInvoke.d.ts","sourceRoot":"","sources":["../../../src/hooks/useInvoke.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAK7E,MAAM,WAAW,gBAAgB;IAC/B,iEAAiE;IACjE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC;IACvC,uEAAuE;IACvE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;CAC3C;AAED,MAAM,WAAW,eAAe;IAC9B,iEAAiE;IACjE,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9B,gDAAgD;IAChD,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC3C,6CAA6C;IAC7C,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;IAC5B,4DAA4D;IAC5D,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,eAAe,CAkCrE"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { consumePendingIntent } from '../utils/actionStore';
|
|
3
|
+
import { addIntentListener } from '../module';
|
|
4
|
+
import { trackFired } from '../utils/analytics';
|
|
5
|
+
/**
|
|
6
|
+
* The main hook for receiving intents from any native surface.
|
|
7
|
+
*
|
|
8
|
+
* Works for cold start (app was closed) and warm start (app was backgrounded).
|
|
9
|
+
* Call useInvokeInit() once in the root layout first.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // Receive any intent
|
|
13
|
+
* const { intent, parameters, source, clear } = useInvoke();
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // Filter by intent ID
|
|
17
|
+
* const { intent, parameters } = useInvoke({ intentId: 'create_errand' });
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* // Filter by surface
|
|
21
|
+
* const { intent } = useInvoke({ source: ['siri', 'widget'] });
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* // Inline handler
|
|
25
|
+
* useInvoke({ intentId: 'create_errand', onFire: (i) => openWizard(i.parameters) });
|
|
26
|
+
*/
|
|
27
|
+
export function useInvoke(options) {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
const [intent, setIntent] = useState(null);
|
|
30
|
+
const optionsRef = useRef(options);
|
|
31
|
+
optionsRef.current = options;
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
// Cold start — drain anything stored before this component mounted
|
|
35
|
+
const initial = consumePendingIntent();
|
|
36
|
+
if (initial && matches(initial, optionsRef.current)) {
|
|
37
|
+
trackFired(initial);
|
|
38
|
+
setIntent(initial);
|
|
39
|
+
(_b = (_a = optionsRef.current) === null || _a === void 0 ? void 0 : _a.onFire) === null || _b === void 0 ? void 0 : _b.call(_a, initial);
|
|
40
|
+
}
|
|
41
|
+
// Warm start — subscribe for future intents while mounted
|
|
42
|
+
const sub = addIntentListener((received) => {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
if (matches(received, optionsRef.current)) {
|
|
45
|
+
trackFired(received);
|
|
46
|
+
setIntent(received);
|
|
47
|
+
(_b = (_a = optionsRef.current) === null || _a === void 0 ? void 0 : _a.onFire) === null || _b === void 0 ? void 0 : _b.call(_a, received);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return () => sub.remove();
|
|
51
|
+
}, []);
|
|
52
|
+
const clear = () => setIntent(null);
|
|
53
|
+
return {
|
|
54
|
+
intent,
|
|
55
|
+
parameters: (_a = intent === null || intent === void 0 ? void 0 : intent.parameters) !== null && _a !== void 0 ? _a : {},
|
|
56
|
+
source: (_b = intent === null || intent === void 0 ? void 0 : intent.source) !== null && _b !== void 0 ? _b : null,
|
|
57
|
+
clear,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function matches(intent, options) {
|
|
61
|
+
if ((options === null || options === void 0 ? void 0 : options.intentId) && intent.intentId !== options.intentId)
|
|
62
|
+
return false;
|
|
63
|
+
if (options === null || options === void 0 ? void 0 : options.source) {
|
|
64
|
+
const sources = Array.isArray(options.source) ? options.source : [options.source];
|
|
65
|
+
if (!sources.includes(intent.source))
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=useInvoke.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInvoke.js","sourceRoot":"","sources":["../../../src/hooks/useInvoke.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAsBhD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,SAAS,CAAC,OAA0B;;IAClD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAwB,IAAI,CAAC,CAAC;IAClE,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IACnC,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC;IAE7B,SAAS,CAAC,GAAG,EAAE;;QACb,mEAAmE;QACnE,MAAM,OAAO,GAAG,oBAAoB,EAAE,CAAC;QACvC,IAAI,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YACpD,UAAU,CAAC,OAAO,CAAC,CAAC;YACpB,SAAS,CAAC,OAAO,CAAC,CAAC;YACnB,MAAA,MAAA,UAAU,CAAC,OAAO,0CAAE,MAAM,mDAAG,OAAO,CAAC,CAAC;QACxC,CAAC;QAED,0DAA0D;QAC1D,MAAM,GAAG,GAAG,iBAAiB,CAAC,CAAC,QAAQ,EAAE,EAAE;;YACzC,IAAI,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC1C,UAAU,CAAC,QAAQ,CAAC,CAAC;gBACrB,SAAS,CAAC,QAAQ,CAAC,CAAC;gBACpB,MAAA,MAAA,UAAU,CAAC,OAAO,0CAAE,MAAM,mDAAG,QAAQ,CAAC,CAAC;YACzC,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;IAC5B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,KAAK,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAEpC,OAAO;QACL,MAAM;QACN,UAAU,EAAE,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,mCAAI,EAAE;QACpC,MAAM,EAAE,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,mCAAI,IAAI;QAC9B,KAAK;KACN,CAAC;AACJ,CAAC;AAED,SAAS,OAAO,CAAC,MAAsB,EAAE,OAA0B;IACjE,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,KAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5E,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,EAAE,CAAC;QACpB,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAClF,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;YAAE,OAAO,KAAK,CAAC;IACrD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { InvokeSource } from '../types';
|
|
2
|
+
export interface InvokeAnalytics {
|
|
3
|
+
/** How many times each intentId has fired */
|
|
4
|
+
fired: Record<string, number>;
|
|
5
|
+
/** How many times each intentId has been donated */
|
|
6
|
+
donated: Record<string, number>;
|
|
7
|
+
/** How many times each surface triggered an intent */
|
|
8
|
+
bySource: Partial<Record<InvokeSource, number>>;
|
|
9
|
+
/** Total intents fired this session */
|
|
10
|
+
total: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Per-intent fire counts, donation counts, and surface breakdown.
|
|
14
|
+
* Use to understand which intents are most popular and which surfaces drive usage.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const { fired, bySource, total } = useInvokeAnalytics();
|
|
18
|
+
* console.log(fired['create_errand']); // 12
|
|
19
|
+
* console.log(bySource['siri']); // 8
|
|
20
|
+
* console.log(bySource['widget']); // 4
|
|
21
|
+
*/
|
|
22
|
+
export declare function useInvokeAnalytics(): InvokeAnalytics;
|
|
23
|
+
//# sourceMappingURL=useInvokeAnalytics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInvokeAnalytics.d.ts","sourceRoot":"","sources":["../../../src/hooks/useInvokeAnalytics.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,MAAM,WAAW,eAAe;IAC9B,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,sDAAsD;IACtD,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;IAChD,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,IAAI,eAAe,CAepD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { getAnalytics, onIntentFired } from '../utils/analytics';
|
|
3
|
+
/**
|
|
4
|
+
* Per-intent fire counts, donation counts, and surface breakdown.
|
|
5
|
+
* Use to understand which intents are most popular and which surfaces drive usage.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const { fired, bySource, total } = useInvokeAnalytics();
|
|
9
|
+
* console.log(fired['create_errand']); // 12
|
|
10
|
+
* console.log(bySource['siri']); // 8
|
|
11
|
+
* console.log(bySource['widget']); // 4
|
|
12
|
+
*/
|
|
13
|
+
export function useInvokeAnalytics() {
|
|
14
|
+
const [analytics, setAnalytics] = useState(() => {
|
|
15
|
+
const a = getAnalytics();
|
|
16
|
+
return { ...a, total: Object.values(a.fired).reduce((s, n) => s + n, 0) };
|
|
17
|
+
});
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const unsub = onIntentFired(() => {
|
|
20
|
+
const a = getAnalytics();
|
|
21
|
+
setAnalytics({ ...a, total: Object.values(a.fired).reduce((s, n) => s + n, 0) });
|
|
22
|
+
});
|
|
23
|
+
return unsub;
|
|
24
|
+
}, []);
|
|
25
|
+
return analytics;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=useInvokeAnalytics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInvokeAnalytics.js","sourceRoot":"","sources":["../../../src/hooks/useInvokeAnalytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAcjE;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB;IAChC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAkB,GAAG,EAAE;QAC/D,MAAM,CAAC,GAAG,YAAY,EAAE,CAAC;QACzB,OAAO,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IAC5E,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,KAAK,GAAG,aAAa,CAAC,GAAG,EAAE;YAC/B,MAAM,CAAC,GAAG,YAAY,EAAE,CAAC;YACzB,YAAY,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QACnF,CAAC,CAAC,CAAC;QACH,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ResolvedIntent } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the N most recent intents that fired during this session.
|
|
4
|
+
* Useful for analytics dashboards or "Recent actions" UI.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const history = useInvokeHistory(5);
|
|
8
|
+
* // history[0] = most recent intent
|
|
9
|
+
*/
|
|
10
|
+
export declare function useInvokeHistory(maxItems?: number): ResolvedIntent[];
|
|
11
|
+
//# sourceMappingURL=useInvokeHistory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInvokeHistory.d.ts","sourceRoot":"","sources":["../../../src/hooks/useInvokeHistory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAM/C;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,SAAc,GAAG,cAAc,EAAE,CAazE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { addIntentListener } from '../module';
|
|
3
|
+
const _history = [];
|
|
4
|
+
const DEFAULT_MAX = 20;
|
|
5
|
+
/**
|
|
6
|
+
* Returns the N most recent intents that fired during this session.
|
|
7
|
+
* Useful for analytics dashboards or "Recent actions" UI.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const history = useInvokeHistory(5);
|
|
11
|
+
* // history[0] = most recent intent
|
|
12
|
+
*/
|
|
13
|
+
export function useInvokeHistory(maxItems = DEFAULT_MAX) {
|
|
14
|
+
const [history, setHistory] = useState([..._history].slice(0, maxItems));
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const sub = addIntentListener((intent) => {
|
|
17
|
+
_history.unshift(intent);
|
|
18
|
+
if (_history.length > DEFAULT_MAX)
|
|
19
|
+
_history.pop();
|
|
20
|
+
setHistory([..._history].slice(0, maxItems));
|
|
21
|
+
});
|
|
22
|
+
return () => sub.remove();
|
|
23
|
+
}, [maxItems]);
|
|
24
|
+
return history;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=useInvokeHistory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInvokeHistory.js","sourceRoot":"","sources":["../../../src/hooks/useInvokeHistory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,QAAQ,GAAqB,EAAE,CAAC;AACtC,MAAM,WAAW,GAAG,EAAE,CAAC;AAEvB;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAQ,GAAG,WAAW;IACrD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAmB,CAAC,GAAG,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE3F,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,GAAG,GAAG,iBAAiB,CAAC,CAAC,MAAM,EAAE,EAAE;YACvC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACzB,IAAI,QAAQ,CAAC,MAAM,GAAG,WAAW;gBAAE,QAAQ,CAAC,GAAG,EAAE,CAAC;YAClD,UAAU,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;IAC5B,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Call this ONCE in your root layout (_layout.tsx / App.tsx).
|
|
3
|
+
*
|
|
4
|
+
* Handles every entry surface:
|
|
5
|
+
* - Cold start: drains intent written before JS loaded
|
|
6
|
+
* - Warm start: subscribes to intents while app is running
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* // app/_layout.tsx
|
|
10
|
+
* export default function RootLayout() {
|
|
11
|
+
* useInvokeInit();
|
|
12
|
+
* return <Stack />;
|
|
13
|
+
* }
|
|
14
|
+
*/
|
|
15
|
+
export declare function useInvokeInit(): void;
|
|
16
|
+
//# sourceMappingURL=useInvokeInit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInvokeInit.d.ts","sourceRoot":"","sources":["../../../src/hooks/useInvokeInit.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAepC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { getInitialIntent, addIntentListener } from '../module';
|
|
3
|
+
import { storePendingIntent } from '../utils/actionStore';
|
|
4
|
+
/**
|
|
5
|
+
* Call this ONCE in your root layout (_layout.tsx / App.tsx).
|
|
6
|
+
*
|
|
7
|
+
* Handles every entry surface:
|
|
8
|
+
* - Cold start: drains intent written before JS loaded
|
|
9
|
+
* - Warm start: subscribes to intents while app is running
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // app/_layout.tsx
|
|
13
|
+
* export default function RootLayout() {
|
|
14
|
+
* useInvokeInit();
|
|
15
|
+
* return <Stack />;
|
|
16
|
+
* }
|
|
17
|
+
*/
|
|
18
|
+
export function useInvokeInit() {
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
// Cold start — intent was written to native storage before JS loaded
|
|
21
|
+
const initial = getInitialIntent();
|
|
22
|
+
if (initial) {
|
|
23
|
+
storePendingIntent(initial);
|
|
24
|
+
}
|
|
25
|
+
// Warm start — app was running or backgrounded when intent fired
|
|
26
|
+
const subscription = addIntentListener((intent) => {
|
|
27
|
+
storePendingIntent(intent);
|
|
28
|
+
});
|
|
29
|
+
return () => subscription.remove();
|
|
30
|
+
}, []);
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=useInvokeInit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInvokeInit.js","sourceRoot":"","sources":["../../../src/hooks/useInvokeInit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa;IAC3B,SAAS,CAAC,GAAG,EAAE;QACb,qEAAqE;QACrE,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;QACnC,IAAI,OAAO,EAAE,CAAC;YACZ,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAC9B,CAAC;QAED,iEAAiE;QACjE,MAAM,YAAY,GAAG,iBAAiB,CAAC,CAAC,MAAM,EAAE,EAAE;YAChD,kBAAkB,CAAC,MAAM,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;IACrC,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Link an active Live Activity to an intent.
|
|
3
|
+
* When the user taps the Dynamic Island or Lock Screen Live Activity, the intent fires.
|
|
4
|
+
*
|
|
5
|
+
* Requires expo-live-activity to be installed.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const { link } = useLiveActivityIntent();
|
|
9
|
+
*
|
|
10
|
+
* // After starting a Live Activity:
|
|
11
|
+
* const activityId = await startActivity({ errandId: '123' });
|
|
12
|
+
* link(activityId, 'track_errand');
|
|
13
|
+
*
|
|
14
|
+
* // Now tapping the Dynamic Island → useInvoke({ source: 'live_activity' }) fires
|
|
15
|
+
*/
|
|
16
|
+
export interface UseLiveActivityIntentResult {
|
|
17
|
+
/** Link an active Live Activity to an intent. Tapping the Dynamic Island or Lock Screen fires it. */
|
|
18
|
+
link: (activityId: string, intentId: string) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare function useLiveActivityIntent(): UseLiveActivityIntentResult;
|
|
21
|
+
//# sourceMappingURL=useLiveActivityIntent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLiveActivityIntent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useLiveActivityIntent.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,2BAA2B;IAC1C,qGAAqG;IACrG,IAAI,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACtD;AAED,wBAAgB,qBAAqB,IAAI,2BAA2B,CAMnE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { setLiveActivityIntent } from '../module';
|
|
3
|
+
export function useLiveActivityIntent() {
|
|
4
|
+
const link = useCallback((activityId, intentId) => {
|
|
5
|
+
setLiveActivityIntent(activityId, intentId);
|
|
6
|
+
}, []);
|
|
7
|
+
return { link };
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=useLiveActivityIntent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLiveActivityIntent.js","sourceRoot":"","sources":["../../../src/hooks/useLiveActivityIntent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAsBlD,MAAM,UAAU,qBAAqB;IACnC,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,UAAkB,EAAE,QAAgB,EAAQ,EAAE;QACtE,qBAAqB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAC9C,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,IAAI,EAAE,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type QuickTileState } from '../module';
|
|
2
|
+
export interface UseQuickTileResult {
|
|
3
|
+
/**
|
|
4
|
+
* Update the Android Quick Settings tile state and label.
|
|
5
|
+
* The tile fires the intent configured in app.json (supportsQuickTile: true).
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const { setActive, setInactive } = useQuickTile();
|
|
9
|
+
*
|
|
10
|
+
* // When user has active errands:
|
|
11
|
+
* setActive('3 Active Errands');
|
|
12
|
+
*
|
|
13
|
+
* // When idle:
|
|
14
|
+
* setInactive('Create Errand');
|
|
15
|
+
*/
|
|
16
|
+
setActive: (label?: string) => void;
|
|
17
|
+
setInactive: (label?: string) => void;
|
|
18
|
+
setUnavailable: (label?: string) => void;
|
|
19
|
+
update: (state: QuickTileState, label: string) => void;
|
|
20
|
+
}
|
|
21
|
+
/** Android only — no-op on iOS. */
|
|
22
|
+
export declare function useQuickTile(defaultLabel?: string): UseQuickTileResult;
|
|
23
|
+
//# sourceMappingURL=useQuickTile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useQuickTile.d.ts","sourceRoot":"","sources":["../../../src/hooks/useQuickTile.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAEjE,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;;;OAYG;IACH,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,WAAW,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,cAAc,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,MAAM,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxD;AAED,mCAAmC;AACnC,wBAAgB,YAAY,CAAC,YAAY,SAAK,GAAG,kBAAkB,CAWlE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { updateQuickTile } from '../module';
|
|
3
|
+
/** Android only — no-op on iOS. */
|
|
4
|
+
export function useQuickTile(defaultLabel = '') {
|
|
5
|
+
const update = useCallback((state, label) => {
|
|
6
|
+
updateQuickTile(state, label);
|
|
7
|
+
}, []);
|
|
8
|
+
return {
|
|
9
|
+
update,
|
|
10
|
+
setActive: (label = defaultLabel) => update('active', label),
|
|
11
|
+
setInactive: (label = defaultLabel) => update('inactive', label),
|
|
12
|
+
setUnavailable: (label = defaultLabel) => update('unavailable', label),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=useQuickTile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useQuickTile.js","sourceRoot":"","sources":["../../../src/hooks/useQuickTile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,eAAe,EAAuB,MAAM,WAAW,CAAC;AAsBjE,mCAAmC;AACnC,MAAM,UAAU,YAAY,CAAC,YAAY,GAAG,EAAE;IAC5C,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,KAAqB,EAAE,KAAa,EAAE,EAAE;QAClE,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAChC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,MAAM;QACN,SAAS,EAAE,CAAC,KAAK,GAAG,YAAY,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC;QAC5D,WAAW,EAAE,CAAC,KAAK,GAAG,YAAY,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC;QAChE,cAAc,EAAE,CAAC,KAAK,GAAG,YAAY,EAAE,EAAE,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,CAAC;KACvE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ShortcutDefinition } from '../types';
|
|
2
|
+
export interface UseShortcutsResult {
|
|
3
|
+
shortcuts: ShortcutDefinition[];
|
|
4
|
+
/**
|
|
5
|
+
* Set the dynamic shortcuts that appear on app icon long-press.
|
|
6
|
+
* iOS: max 10 (combined static + dynamic). Android: max 5.
|
|
7
|
+
* Call this after user logs in or when their context changes.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* setShortcuts([
|
|
11
|
+
* { id: 'home-delivery', title: 'Deliver from Home', intentId: 'create_errand',
|
|
12
|
+
* parameters: { pickup: homeAddress } },
|
|
13
|
+
* ]);
|
|
14
|
+
*/
|
|
15
|
+
setShortcuts: (shortcuts: ShortcutDefinition[]) => void;
|
|
16
|
+
/** Remove all dynamic shortcuts */
|
|
17
|
+
clear: () => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Manage dynamic shortcuts on the app icon long-press menu.
|
|
21
|
+
* iOS: Siri Suggestions + long-press menu.
|
|
22
|
+
* Android: Launcher long-press menu.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useShortcuts(): UseShortcutsResult;
|
|
25
|
+
//# sourceMappingURL=useShortcuts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useShortcuts.d.ts","sourceRoot":"","sources":["../../../src/hooks/useShortcuts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnD,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAChC;;;;;;;;;;OAUG;IACH,YAAY,EAAE,CAAC,SAAS,EAAE,kBAAkB,EAAE,KAAK,IAAI,CAAC;IACxD,mCAAmC;IACnC,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,kBAAkB,CAkBjD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import { setDynamicShortcuts, getDynamicShortcuts, clearDynamicShortcuts } from '../module';
|
|
3
|
+
/**
|
|
4
|
+
* Manage dynamic shortcuts on the app icon long-press menu.
|
|
5
|
+
* iOS: Siri Suggestions + long-press menu.
|
|
6
|
+
* Android: Launcher long-press menu.
|
|
7
|
+
*/
|
|
8
|
+
export function useShortcuts() {
|
|
9
|
+
const [shortcuts, setShortcutsState] = useState([]);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
setShortcutsState(getDynamicShortcuts());
|
|
12
|
+
}, []);
|
|
13
|
+
const setShortcuts = useCallback((defs) => {
|
|
14
|
+
setDynamicShortcuts(defs);
|
|
15
|
+
setShortcutsState(defs);
|
|
16
|
+
}, []);
|
|
17
|
+
const clear = useCallback(() => {
|
|
18
|
+
clearDynamicShortcuts();
|
|
19
|
+
setShortcutsState([]);
|
|
20
|
+
}, []);
|
|
21
|
+
return { shortcuts, setShortcuts, clear };
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=useShortcuts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useShortcuts.js","sourceRoot":"","sources":["../../../src/hooks/useShortcuts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAqB5F;;;;GAIG;AACH,MAAM,UAAU,YAAY;IAC1B,MAAM,CAAC,SAAS,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAuB,EAAE,CAAC,CAAC;IAE1E,SAAS,CAAC,GAAG,EAAE;QACb,iBAAiB,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAC3C,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,IAA0B,EAAE,EAAE;QAC9D,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAC1B,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE;QAC7B,qBAAqB,EAAE,CAAC;QACxB,iBAAiB,CAAC,EAAE,CAAC,CAAC;IACxB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SpotlightItem } from '../types';
|
|
2
|
+
export interface UseSpotlightResult {
|
|
3
|
+
/**
|
|
4
|
+
* Add items to iOS Spotlight search.
|
|
5
|
+
* When user taps the result, the configured intent fires.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* index([{
|
|
9
|
+
* id: 'errand-123',
|
|
10
|
+
* title: 'Deliver to Airport Hills',
|
|
11
|
+
* description: 'Active errand — tap to track',
|
|
12
|
+
* intentId: 'track_errand',
|
|
13
|
+
* intentParameters: { errandId: '123' },
|
|
14
|
+
* keywords: ['delivery', 'airport', 'active'],
|
|
15
|
+
* }]);
|
|
16
|
+
*/
|
|
17
|
+
index: (items: SpotlightItem[]) => void;
|
|
18
|
+
/** Remove items from Spotlight by ID */
|
|
19
|
+
deindex: (ids: string[]) => void;
|
|
20
|
+
}
|
|
21
|
+
/** iOS only — no-op on Android. */
|
|
22
|
+
export declare function useSpotlight(): UseSpotlightResult;
|
|
23
|
+
//# sourceMappingURL=useSpotlight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSpotlight.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSpotlight.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;;;;OAaG;IACH,KAAK,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;IACxC,wCAAwC;IACxC,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAClC;AAED,mCAAmC;AACnC,wBAAgB,YAAY,IAAI,kBAAkB,CAUjD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { indexSpotlightItems, deindexSpotlightItems } from '../module';
|
|
3
|
+
/** iOS only — no-op on Android. */
|
|
4
|
+
export function useSpotlight() {
|
|
5
|
+
const index = useCallback((items) => {
|
|
6
|
+
indexSpotlightItems(items);
|
|
7
|
+
}, []);
|
|
8
|
+
const deindex = useCallback((ids) => {
|
|
9
|
+
deindexSpotlightItems(ids);
|
|
10
|
+
}, []);
|
|
11
|
+
return { index, deindex };
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=useSpotlight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSpotlight.js","sourceRoot":"","sources":["../../../src/hooks/useSpotlight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAuBvE,mCAAmC;AACnC,MAAM,UAAU,YAAY;IAC1B,MAAM,KAAK,GAAG,WAAW,CAAC,CAAC,KAAsB,EAAE,EAAE;QACnD,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,GAAa,EAAE,EAAE;QAC5C,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { WidgetDataValue } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Push live app state into home screen widgets and iOS Control Center controls.
|
|
4
|
+
* Uses App Groups (iOS) and SharedPreferences (Android) under the hood.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const { push } = useWidgetData('activeErrands');
|
|
8
|
+
* // After fetching errands:
|
|
9
|
+
* push({ count: 3, label: '3 Active Errands' });
|
|
10
|
+
*
|
|
11
|
+
* // In your widget config (app.json), the widget reads this key to display live data.
|
|
12
|
+
*/
|
|
13
|
+
export interface UseWidgetDataResult {
|
|
14
|
+
/** Write a value to widget-shared storage and trigger a widget timeline reload. */
|
|
15
|
+
push: (value: WidgetDataValue | Record<string, WidgetDataValue>) => void;
|
|
16
|
+
/** Read the current value from widget-shared storage. */
|
|
17
|
+
read: () => WidgetDataValue | Record<string, WidgetDataValue> | null;
|
|
18
|
+
}
|
|
19
|
+
export declare function useWidgetData(key: string): UseWidgetDataResult;
|
|
20
|
+
//# sourceMappingURL=useWidgetData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWidgetData.d.ts","sourceRoot":"","sources":["../../../src/hooks/useWidgetData.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,mBAAmB;IAClC,mFAAmF;IACnF,IAAI,EAAE,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,KAAK,IAAI,CAAC;IACzE,yDAAyD;IACzD,IAAI,EAAE,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,IAAI,CAAC;CACtE;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB,CAa9D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { setWidgetData, getWidgetData } from '../module';
|
|
3
|
+
export function useWidgetData(key) {
|
|
4
|
+
const push = useCallback((value) => {
|
|
5
|
+
setWidgetData(key, value);
|
|
6
|
+
}, [key]);
|
|
7
|
+
const read = useCallback(() => {
|
|
8
|
+
return getWidgetData(key);
|
|
9
|
+
}, [key]);
|
|
10
|
+
return { push, read };
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=useWidgetData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWidgetData.js","sourceRoot":"","sources":["../../../src/hooks/useWidgetData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAqBzD,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,MAAM,IAAI,GAAG,WAAW,CACtB,CAAC,KAAwD,EAAE,EAAE;QAC3D,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC,EACD,CAAC,GAAG,CAAC,CACN,CAAC;IAEF,MAAM,IAAI,GAAG,WAAW,CAAC,GAA6D,EAAE;QACtF,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAEV,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export { configure } from './module';
|
|
2
|
+
export { onIntentFired } from './utils/analytics';
|
|
3
|
+
export { onIntentFired as onInvoke } from './utils/analytics';
|
|
4
|
+
export { getInitialIntent, addIntentListener, donateAction, deleteAction, deleteAllActions, setDynamicShortcuts, getDynamicShortcuts, clearDynamicShortcuts, indexSpotlightItems, deindexSpotlightItems, setWidgetData, getWidgetData, updateQuickTile, advertiseHandoff, stopHandoff, setLiveActivityIntent, addIntentToSiri, getFocusMode, } from './module';
|
|
5
|
+
export { useInvokeInit } from './hooks/useInvokeInit';
|
|
6
|
+
export { useInvoke } from './hooks/useInvoke';
|
|
7
|
+
export { useDonation } from './hooks/useDonation';
|
|
8
|
+
export { useShortcuts } from './hooks/useShortcuts';
|
|
9
|
+
export { useWidgetData } from './hooks/useWidgetData';
|
|
10
|
+
export { useSpotlight } from './hooks/useSpotlight';
|
|
11
|
+
export { useQuickTile } from './hooks/useQuickTile';
|
|
12
|
+
export { useHandoff } from './hooks/useHandoff';
|
|
13
|
+
export { useLiveActivityIntent } from './hooks/useLiveActivityIntent';
|
|
14
|
+
export { useInvokeHistory } from './hooks/useInvokeHistory';
|
|
15
|
+
export { useInvokeAnalytics } from './hooks/useInvokeAnalytics';
|
|
16
|
+
export { useAddToSiri } from './hooks/useAddToSiri';
|
|
17
|
+
export { useFocusFilter } from './hooks/useFocusFilter';
|
|
18
|
+
export { AddToSiriButton } from './components/AddToSiriButton';
|
|
19
|
+
export { ShortcutChip } from './components/ShortcutChip';
|
|
20
|
+
export { InvokeDebugger } from './components/InvokeDebugger';
|
|
21
|
+
export { mockInvoke, simulateColdStart, simulateWarmStart, createMockIntent, } from './utils/testing';
|
|
22
|
+
export type { InvokeSource, IntentDefinition, IntentParameter, ParameterType, ParameterValue, ResolvedIntent, DonationInput, ShortcutDefinition, SpotlightItem, WidgetDefinition, WidgetAction, WidgetSize, WidgetDataValue, NotificationCategoryDefinition, NotificationActionDefinition, LocationParameter, PersonParameter, EnumOption, InvokeConfig, } from './types';
|
|
23
|
+
export type { UseInvokeOptions, UseInvokeResult } from './hooks/useInvoke';
|
|
24
|
+
export type { UseShortcutsResult } from './hooks/useShortcuts';
|
|
25
|
+
export type { UseSpotlightResult } from './hooks/useSpotlight';
|
|
26
|
+
export type { UseQuickTileResult } from './hooks/useQuickTile';
|
|
27
|
+
export type { UseHandoffResult } from './hooks/useHandoff';
|
|
28
|
+
export type { InvokeAnalytics } from './hooks/useInvokeAnalytics';
|
|
29
|
+
export type { UseLiveActivityIntentResult } from './hooks/useLiveActivityIntent';
|
|
30
|
+
export type { UseWidgetDataResult } from './hooks/useWidgetData';
|
|
31
|
+
export type { QuickTileState, FocusMode } from './module';
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG9D,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,qBAAqB,EACrB,eAAe,EACf,YAAY,GACb,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAG7D,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,cAAc,EACd,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,eAAe,EACf,8BAA8B,EAC9B,4BAA4B,EAC5B,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,YAAY,GACb,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC3E,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,YAAY,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACjF,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// ─── Configuration ────────────────────────────────────────────────────────────
|
|
2
|
+
export { configure } from './module';
|
|
3
|
+
export { onIntentFired } from './utils/analytics';
|
|
4
|
+
export { onIntentFired as onInvoke } from './utils/analytics';
|
|
5
|
+
// ─── Core module functions ────────────────────────────────────────────────────
|
|
6
|
+
export { getInitialIntent, addIntentListener, donateAction, deleteAction, deleteAllActions, setDynamicShortcuts, getDynamicShortcuts, clearDynamicShortcuts, indexSpotlightItems, deindexSpotlightItems, setWidgetData, getWidgetData, updateQuickTile, advertiseHandoff, stopHandoff, setLiveActivityIntent, addIntentToSiri, getFocusMode, } from './module';
|
|
7
|
+
// ─── Hooks ────────────────────────────────────────────────────────────────────
|
|
8
|
+
export { useInvokeInit } from './hooks/useInvokeInit';
|
|
9
|
+
export { useInvoke } from './hooks/useInvoke';
|
|
10
|
+
export { useDonation } from './hooks/useDonation';
|
|
11
|
+
export { useShortcuts } from './hooks/useShortcuts';
|
|
12
|
+
export { useWidgetData } from './hooks/useWidgetData';
|
|
13
|
+
export { useSpotlight } from './hooks/useSpotlight';
|
|
14
|
+
export { useQuickTile } from './hooks/useQuickTile';
|
|
15
|
+
export { useHandoff } from './hooks/useHandoff';
|
|
16
|
+
export { useLiveActivityIntent } from './hooks/useLiveActivityIntent';
|
|
17
|
+
export { useInvokeHistory } from './hooks/useInvokeHistory';
|
|
18
|
+
export { useInvokeAnalytics } from './hooks/useInvokeAnalytics';
|
|
19
|
+
export { useAddToSiri } from './hooks/useAddToSiri';
|
|
20
|
+
export { useFocusFilter } from './hooks/useFocusFilter';
|
|
21
|
+
// ─── Components ───────────────────────────────────────────────────────────────
|
|
22
|
+
export { AddToSiriButton } from './components/AddToSiriButton';
|
|
23
|
+
export { ShortcutChip } from './components/ShortcutChip';
|
|
24
|
+
export { InvokeDebugger } from './components/InvokeDebugger';
|
|
25
|
+
// ─── Testing utilities ────────────────────────────────────────────────────────
|
|
26
|
+
export { mockInvoke, simulateColdStart, simulateWarmStart, createMockIntent, } from './utils/testing';
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE9D,iFAAiF;AACjF,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,qBAAqB,EACrB,eAAe,EACf,YAAY,GACb,MAAM,UAAU,CAAC;AAElB,iFAAiF;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,iFAAiF;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,iFAAiF;AACjF,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC"}
|