@appsupportkit/support-sdk 0.1.1 → 0.2.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/lib/commonjs/api.js +29 -0
- package/lib/commonjs/api.js.map +1 -1
- package/lib/commonjs/components/BottomSheet.js +67 -47
- package/lib/commonjs/components/BottomSheet.js.map +1 -1
- package/lib/commonjs/components/LauncherButton.js +177 -0
- package/lib/commonjs/components/LauncherButton.js.map +1 -0
- package/lib/commonjs/components/SupportButton.js +76 -146
- package/lib/commonjs/components/SupportButton.js.map +1 -1
- package/lib/commonjs/components/icons.js +74 -23
- package/lib/commonjs/components/icons.js.map +1 -1
- package/lib/commonjs/components/primitives.js +183 -38
- package/lib/commonjs/components/primitives.js.map +1 -1
- package/lib/commonjs/components/screens/ComposeScreen.js +115 -58
- package/lib/commonjs/components/screens/ComposeScreen.js.map +1 -1
- package/lib/commonjs/components/screens/HomeScreen.js +170 -115
- package/lib/commonjs/components/screens/HomeScreen.js.map +1 -1
- package/lib/commonjs/components/screens/ThreadScreen.js +222 -108
- package/lib/commonjs/components/screens/ThreadScreen.js.map +1 -1
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/push.js +103 -0
- package/lib/commonjs/push.js.map +1 -0
- package/lib/commonjs/theme.js +136 -17
- package/lib/commonjs/theme.js.map +1 -1
- package/lib/commonjs/types.js +7 -0
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/unread.js +92 -0
- package/lib/commonjs/unread.js.map +1 -0
- package/lib/commonjs/useSupportThreads.js +286 -0
- package/lib/commonjs/useSupportThreads.js.map +1 -0
- package/lib/commonjs/utils.js +33 -0
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/module/api.js +27 -0
- package/lib/module/api.js.map +1 -1
- package/lib/module/components/BottomSheet.js +68 -48
- package/lib/module/components/BottomSheet.js.map +1 -1
- package/lib/module/components/LauncherButton.js +172 -0
- package/lib/module/components/LauncherButton.js.map +1 -0
- package/lib/module/components/SupportButton.js +79 -149
- package/lib/module/components/SupportButton.js.map +1 -1
- package/lib/module/components/icons.js +72 -22
- package/lib/module/components/icons.js.map +1 -1
- package/lib/module/components/primitives.js +179 -39
- package/lib/module/components/primitives.js.map +1 -1
- package/lib/module/components/screens/ComposeScreen.js +118 -61
- package/lib/module/components/screens/ComposeScreen.js.map +1 -1
- package/lib/module/components/screens/HomeScreen.js +172 -117
- package/lib/module/components/screens/HomeScreen.js.map +1 -1
- package/lib/module/components/screens/ThreadScreen.js +228 -112
- package/lib/module/components/screens/ThreadScreen.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/push.js +98 -0
- package/lib/module/push.js.map +1 -0
- package/lib/module/theme.js +135 -16
- package/lib/module/theme.js.map +1 -1
- package/lib/module/types.js +7 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/unread.js +83 -0
- package/lib/module/unread.js.map +1 -0
- package/lib/module/useSupportThreads.js +281 -0
- package/lib/module/useSupportThreads.js.map +1 -0
- package/lib/module/utils.js +30 -0
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/api.d.ts +17 -1
- package/lib/typescript/api.d.ts.map +1 -1
- package/lib/typescript/components/BottomSheet.d.ts.map +1 -1
- package/lib/typescript/components/LauncherButton.d.ts +14 -0
- package/lib/typescript/components/LauncherButton.d.ts.map +1 -0
- package/lib/typescript/components/SupportButton.d.ts +3 -3
- package/lib/typescript/components/SupportButton.d.ts.map +1 -1
- package/lib/typescript/components/icons.d.ts +13 -2
- package/lib/typescript/components/icons.d.ts.map +1 -1
- package/lib/typescript/components/primitives.d.ts +35 -4
- package/lib/typescript/components/primitives.d.ts.map +1 -1
- package/lib/typescript/components/screens/ComposeScreen.d.ts.map +1 -1
- package/lib/typescript/components/screens/HomeScreen.d.ts +3 -2
- package/lib/typescript/components/screens/HomeScreen.d.ts.map +1 -1
- package/lib/typescript/components/screens/ThreadScreen.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +2 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/push.d.ts +18 -0
- package/lib/typescript/push.d.ts.map +1 -0
- package/lib/typescript/theme.d.ts +44 -3
- package/lib/typescript/theme.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +37 -4
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/unread.d.ts +22 -0
- package/lib/typescript/unread.d.ts.map +1 -0
- package/lib/typescript/useSupportThreads.d.ts +28 -0
- package/lib/typescript/useSupportThreads.d.ts.map +1 -0
- package/lib/typescript/utils.d.ts +5 -0
- package/lib/typescript/utils.d.ts.map +1 -1
- package/package.json +8 -2
- package/src/api.ts +41 -1
- package/src/components/BottomSheet.tsx +61 -43
- package/src/components/LauncherButton.tsx +217 -0
- package/src/components/SupportButton.tsx +81 -162
- package/src/components/icons.tsx +77 -19
- package/src/components/primitives.tsx +217 -36
- package/src/components/screens/ComposeScreen.tsx +131 -61
- package/src/components/screens/HomeScreen.tsx +168 -117
- package/src/components/screens/ThreadScreen.tsx +289 -119
- package/src/index.tsx +3 -0
- package/src/push.ts +97 -0
- package/src/theme.ts +165 -18
- package/src/types.ts +39 -4
- package/src/unread.ts +91 -0
- package/src/useSupportThreads.ts +372 -0
- package/src/utils.ts +33 -0
package/lib/typescript/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { QueryType, ThreadsResponse } from './types';
|
|
1
|
+
import type { PushPermissionStatus, QueryType, ThreadsResponse } from './types';
|
|
2
2
|
export interface ApiConfig {
|
|
3
3
|
supabaseUrl: string;
|
|
4
4
|
apiKey: string;
|
|
@@ -11,6 +11,22 @@ export declare class SupportApiError extends Error {
|
|
|
11
11
|
constructor(message: string, status: number | null, offline?: boolean);
|
|
12
12
|
}
|
|
13
13
|
export declare function getThreads(config: ApiConfig, revenuecatId: string): Promise<ThreadsResponse>;
|
|
14
|
+
/**
|
|
15
|
+
* Badge-only endpoint (~18 bytes) used for idle polling, instead of
|
|
16
|
+
* re-fetching every thread and message just to check for new replies.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getUnreadCount(config: ApiConfig, revenuecatId: string): Promise<{
|
|
19
|
+
total_unread: number;
|
|
20
|
+
}>;
|
|
21
|
+
/** Reports the OS notification permission outcome (including denials). */
|
|
22
|
+
export declare function registerPush(config: ApiConfig, input: {
|
|
23
|
+
revenuecatId: string;
|
|
24
|
+
permissionStatus: PushPermissionStatus;
|
|
25
|
+
expoPushToken: string | null;
|
|
26
|
+
asked: boolean;
|
|
27
|
+
}): Promise<{
|
|
28
|
+
ok: boolean;
|
|
29
|
+
}>;
|
|
14
30
|
export declare function submitQuery(config: ApiConfig, input: {
|
|
15
31
|
queryType: QueryType;
|
|
16
32
|
message: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,oBAAoB,EACpB,SAAS,EACT,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,eAAgB,SAAQ,KAAK;IACxC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,wDAAwD;IACxD,OAAO,EAAE,OAAO,CAAC;gBAEL,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,UAAQ;CAMpE;AA2CD,wBAAgB,UAAU,CACxB,MAAM,EAAE,SAAS,EACjB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,eAAe,CAAC,CAK1B;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,MAAM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names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../../src/components/BottomSheet.tsx"],"names":[],"mappings":"AAWA,OAAO,EAA4C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAWjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAK7C,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,OAAO,EACP,KAAK,EACL,QAAQ,GACT,EAAE;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACrB,sCAyJA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
2
|
+
import type { SupportTheme } from '../theme';
|
|
3
|
+
import type { LauncherVariant } from '../types';
|
|
4
|
+
export declare function LauncherButton({ theme, unread, variant, size, label, style, onPress, }: {
|
|
5
|
+
theme: SupportTheme;
|
|
6
|
+
unread: number;
|
|
7
|
+
variant?: LauncherVariant;
|
|
8
|
+
size?: number;
|
|
9
|
+
/** Renders a pill with text next to the mark instead of a circle. */
|
|
10
|
+
label?: string;
|
|
11
|
+
style?: StyleProp<ViewStyle>;
|
|
12
|
+
onPress: () => void;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=LauncherButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LauncherButton.d.ts","sourceRoot":"","sources":["../../../src/components/LauncherButton.tsx"],"names":[],"mappings":"AAKA,OAAO,EAML,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAUhD,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,MAAM,EACN,OAAiB,EACjB,IAAS,EACT,KAAK,EACL,KAAK,EACL,OAAO,GACR,EAAE;IACD,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,+BA8KA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { SupportButtonProps } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
* The single entry point of the SDK: a
|
|
4
|
-
* opens the support bottom sheet.
|
|
5
|
-
*
|
|
3
|
+
* The single entry point of the SDK: a launcher with an unread badge that
|
|
4
|
+
* opens the support bottom sheet. Threads, polling, and read receipts are
|
|
5
|
+
* handled by useSupportThreads.
|
|
6
6
|
*/
|
|
7
7
|
export declare function SupportButton(props: SupportButtonProps): import("react").JSX.Element | null;
|
|
8
8
|
//# sourceMappingURL=SupportButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupportButton.d.ts","sourceRoot":"","sources":["../../../src/components/SupportButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SupportButton.d.ts","sourceRoot":"","sources":["../../../src/components/SupportButton.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAa,kBAAkB,EAAU,MAAM,UAAU,CAAC;AActE;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,sCA4LtD"}
|
|
@@ -24,9 +24,20 @@ export declare function CheckIcon({ color, size }: {
|
|
|
24
24
|
color: string;
|
|
25
25
|
size?: number;
|
|
26
26
|
}): import("react").JSX.Element;
|
|
27
|
-
/**
|
|
28
|
-
export declare function
|
|
27
|
+
/** Send arrow: a stem plus a chevron head, both centered on the same axis. */
|
|
28
|
+
export declare function ArrowUpIcon({ color, size }: {
|
|
29
29
|
color: string;
|
|
30
30
|
size?: number;
|
|
31
31
|
}): import("react").JSX.Element;
|
|
32
|
+
/**
|
|
33
|
+
* The chat-bubble mark on the launcher button: a filled bubble with the
|
|
34
|
+
* dots knocked out in the button's own fill color. Solid shapes read far
|
|
35
|
+
* better than 1.5px strokes at launcher size and on top of a color fill.
|
|
36
|
+
*/
|
|
37
|
+
export declare function ChatBubbleMark({ color, dotColor, size, }: {
|
|
38
|
+
color: string;
|
|
39
|
+
/** The surface behind the mark — the dots are punched out in this color. */
|
|
40
|
+
dotColor: string;
|
|
41
|
+
size?: number;
|
|
42
|
+
}): import("react").JSX.Element;
|
|
32
43
|
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/components/icons.tsx"],"names":[],"mappings":"AAOA,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,IAAS,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,+BA0B9E;AAED,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,IAAS,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,+BAyBpF;AAED,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,IAAS,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,+BAyBrF;AAED,+EAA+E;AAC/E,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,IAAS,EACT,SAAmB,GACpB,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,GA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C,EAAE,KAAK,EAAE,IAAS,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,+BAc/E;AAED,8EAA8E;AAC9E,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,IAAS,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,+BAsCjF;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,IAAS,GACV,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,+BA4CA"}
|
|
@@ -4,12 +4,19 @@ import type { SupportTheme } from '../theme';
|
|
|
4
4
|
import type { QueryStatus, QueryType } from '../types';
|
|
5
5
|
export declare function typeIcon(type: QueryType, color: string, size?: number): ReactNode;
|
|
6
6
|
export declare function typeColor(type: QueryType, theme: SupportTheme): string;
|
|
7
|
+
export declare function typeBackground(type: QueryType, theme: SupportTheme): string;
|
|
8
|
+
/** Tinted round chip holding a type icon — the anchor of every list row. */
|
|
9
|
+
export declare function TypeGlyph({ type, theme, size, }: {
|
|
10
|
+
type: QueryType;
|
|
11
|
+
theme: SupportTheme;
|
|
12
|
+
size?: number;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
7
14
|
/** Status dot + label — same visual language as the dashboard. */
|
|
8
15
|
export declare function StatusIndicator({ status, theme, }: {
|
|
9
16
|
status: QueryStatus;
|
|
10
17
|
theme: SupportTheme;
|
|
11
18
|
}): import("react").JSX.Element;
|
|
12
|
-
/** Pressable row with the standard
|
|
19
|
+
/** Pressable row with the standard press wash. */
|
|
13
20
|
export declare function PressableRow({ onPress, children, theme, style, accessibilityLabel, }: {
|
|
14
21
|
onPress: () => void;
|
|
15
22
|
children: ReactNode;
|
|
@@ -17,20 +24,42 @@ export declare function PressableRow({ onPress, children, theme, style, accessib
|
|
|
17
24
|
style?: StyleProp<ViewStyle>;
|
|
18
25
|
accessibilityLabel?: string;
|
|
19
26
|
}): import("react").JSX.Element;
|
|
20
|
-
|
|
27
|
+
/** Circular icon button — back, close, send. */
|
|
28
|
+
export declare function IconButton({ onPress, children, theme, accessibilityLabel, size, disabled, tone, }: {
|
|
29
|
+
onPress: () => void;
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
theme: SupportTheme;
|
|
32
|
+
accessibilityLabel: string;
|
|
33
|
+
size?: number;
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
tone?: 'surface' | 'accent';
|
|
36
|
+
}): import("react").JSX.Element;
|
|
37
|
+
export declare function PrimaryButton({ label, onPress, disabled, theme, fullWidth, }: {
|
|
21
38
|
label: string;
|
|
22
39
|
onPress: () => void;
|
|
23
40
|
disabled?: boolean;
|
|
24
41
|
theme: SupportTheme;
|
|
42
|
+
fullWidth?: boolean;
|
|
25
43
|
}): import("react").JSX.Element;
|
|
26
44
|
export declare function SecondaryButton({ label, onPress, theme, }: {
|
|
27
45
|
label: string;
|
|
28
46
|
onPress: () => void;
|
|
29
47
|
theme: SupportTheme;
|
|
30
48
|
}): import("react").JSX.Element;
|
|
49
|
+
/** The count pill on a thread row. */
|
|
50
|
+
export declare function UnreadPill({ count, theme, }: {
|
|
51
|
+
count: number;
|
|
52
|
+
theme: SupportTheme;
|
|
53
|
+
}): import("react").JSX.Element;
|
|
54
|
+
export declare function SectionLabel({ children, theme, style, }: {
|
|
55
|
+
children: ReactNode;
|
|
56
|
+
theme: SupportTheme;
|
|
57
|
+
style?: StyleProp<TextStyle>;
|
|
58
|
+
}): import("react").JSX.Element;
|
|
31
59
|
/** Small muted icon + one line — no illustrations. */
|
|
32
|
-
export declare function EmptyState({ message, theme, icon, }: {
|
|
60
|
+
export declare function EmptyState({ message, hint, theme, icon, }: {
|
|
33
61
|
message: string;
|
|
62
|
+
hint?: string;
|
|
34
63
|
theme: SupportTheme;
|
|
35
64
|
icon?: ReactNode;
|
|
36
65
|
}): import("react").JSX.Element;
|
|
@@ -41,14 +70,16 @@ export declare function ErrorState({ message, onRetry, theme, }: {
|
|
|
41
70
|
theme: SupportTheme;
|
|
42
71
|
}): import("react").JSX.Element;
|
|
43
72
|
/** Pulsing block matching final layout dimensions. */
|
|
44
|
-
export declare function SkeletonBlock({ width, height, theme, style, }: {
|
|
73
|
+
export declare function SkeletonBlock({ width, height, theme, radius, style, }: {
|
|
45
74
|
width: number | `${number}%`;
|
|
46
75
|
height: number;
|
|
47
76
|
theme: SupportTheme;
|
|
77
|
+
radius?: number;
|
|
48
78
|
style?: StyleProp<ViewStyle>;
|
|
49
79
|
}): import("react").JSX.Element;
|
|
50
80
|
export declare const textStyles: {
|
|
51
81
|
title: (theme: SupportTheme) => TextStyle;
|
|
82
|
+
heading: (theme: SupportTheme) => TextStyle;
|
|
52
83
|
body: (theme: SupportTheme) => TextStyle;
|
|
53
84
|
secondary: (theme: SupportTheme) => TextStyle;
|
|
54
85
|
meta: (theme: SupportTheme) => TextStyle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../../src/components/primitives.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,
|
|
1
|
+
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../../src/components/primitives.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAML,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAIvD,wBAAgB,QAAQ,CAAC,IA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C;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,YAAY,CAAC;CACrB,+BASA;AAED,sDAAsD;AACtD,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,MAAM,EACN,KAAK,EACL,MAAM,EACN,KAAK,GACN,EAAE;IACD,KAAK,EAAE,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,+BAsCA;AAED,eAAO,MAAM,UAAU;mBACN,YAAY,KAAG,SAAS;qBAMtB,YAAY,KAAG,SAAS;kBAM3B,YAAY,KAAG,SAAS;uBAKnB,YAAY,KAAG,SAAS;kBAK7B,YAAY,KAAG,SAAS;CAKvC,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ,KAAK,GACN,EAAE;IACD,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,YAAY,CAAC;CACrB,+BAqBA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComposeScreen.d.ts","sourceRoot":"","sources":["../../../../src/components/screens/ComposeScreen.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ComposeScreen.d.ts","sourceRoot":"","sources":["../../../../src/components/screens/ComposeScreen.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAgE7C,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,IAAI,EACJ,MAAM,EACN,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,YAAY,CAAC;IACpB,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,gEAAgE;IAChE,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CACvD,+BAkJA"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { SupportTheme } from '../../theme';
|
|
2
2
|
import type { QueryType, Thread } from '../../types';
|
|
3
|
-
export declare function HomeScreen({ theme, threads, loading, error,
|
|
3
|
+
export declare function HomeScreen({ theme, threads, loading, refreshing, error, onRefresh, onCompose, onOpenThread, onClose, }: {
|
|
4
4
|
theme: SupportTheme;
|
|
5
5
|
threads: Thread[] | null;
|
|
6
6
|
loading: boolean;
|
|
7
|
+
refreshing: boolean;
|
|
7
8
|
error: string | null;
|
|
8
|
-
|
|
9
|
+
onRefresh: () => void;
|
|
9
10
|
onCompose: (type: QueryType) => void;
|
|
10
11
|
onOpenThread: (thread: Thread) => void;
|
|
11
12
|
onClose: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HomeScreen.d.ts","sourceRoot":"","sources":["../../../../src/components/screens/HomeScreen.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA+
|
|
1
|
+
{"version":3,"file":"HomeScreen.d.ts","sourceRoot":"","sources":["../../../../src/components/screens/HomeScreen.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA+IrD,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,OAAO,EACP,OAAO,EACP,UAAU,EACV,KAAK,EACL,SAAS,EACT,SAAS,EACT,YAAY,EACZ,OAAO,GACR,EAAE;IACD,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACrC,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,+BAyHA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadScreen.d.ts","sourceRoot":"","sources":["../../../../src/components/screens/ThreadScreen.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ThreadScreen.d.ts","sourceRoot":"","sources":["../../../../src/components/screens/ThreadScreen.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,aAAa,CAAC;AA2KzD,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,MAAM,EACN,MAAM,EACN,MAAM,GACP,EAAE;IACD,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,gEAAgE;IAChE,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CACrD,+BA4MA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { SupportButton } from './components/SupportButton';
|
|
2
2
|
export { supportDarkTheme, supportLightTheme, resolveTheme, type SupportTheme, } from './theme';
|
|
3
3
|
export { SupportApiError } from './api';
|
|
4
|
-
export
|
|
4
|
+
export { isPushAvailable } from './push';
|
|
5
|
+
export type { LauncherVariant, MessageSender, PushPermissionStatus, QueryStatus, QueryType, SupportButtonProps, SupportUser, Thread, ThreadMessage, ThreadsResponse, ThemeName, } from './types';
|
|
5
6
|
export { QUERY_TYPE_LABEL, USER_MESSAGE_MAX, USER_MESSAGE_MIN, } from './types';
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,KAAK,YAAY,GAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AACxC,YAAY,EACV,aAAa,EACb,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,WAAW,EACX,MAAM,EACN,aAAa,EACb,eAAe,EACf,SAAS,GACV,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,KAAK,YAAY,GAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACzC,YAAY,EACV,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,WAAW,EACX,MAAM,EACN,aAAa,EACb,eAAe,EACf,SAAS,GACV,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PushPermissionStatus } from './types';
|
|
2
|
+
/** True when the host app has expo-notifications installed. */
|
|
3
|
+
export declare const isPushAvailable: boolean;
|
|
4
|
+
export interface PushRegistration {
|
|
5
|
+
status: PushPermissionStatus;
|
|
6
|
+
/** Whether the OS prompt was actually presented during this call. */
|
|
7
|
+
asked: boolean;
|
|
8
|
+
token: string | null;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Ensures notification permission has been requested, and returns the
|
|
12
|
+
* outcome plus an Expo push token when one is obtainable.
|
|
13
|
+
*
|
|
14
|
+
* Never throws: any failure resolves to an 'undetermined' registration so
|
|
15
|
+
* callers can report it and move on.
|
|
16
|
+
*/
|
|
17
|
+
export declare function ensurePushPermission(expoProjectId?: string): Promise<PushRegistration>;
|
|
18
|
+
//# sourceMappingURL=push.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../src/push.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAuBpD,+DAA+D;AAC/D,eAAO,MAAM,eAAe,SAAyB,CAAC;AAEtD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,oBAAoB,CAAC;IAC7B,qEAAqE;IACrE,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAQD;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,gBAAgB,CAAC,CAoC3B"}
|
|
@@ -1,13 +1,54 @@
|
|
|
1
|
-
import { motion,
|
|
1
|
+
import { motion, spacing, type ThemeColors } from '@appsupportkit/design-tokens';
|
|
2
|
+
import type { ViewStyle } from 'react-native';
|
|
2
3
|
import type { ThemeName } from './types';
|
|
4
|
+
/** Rounder than the dashboard: touch targets read better with more radius. */
|
|
5
|
+
export declare const supportRadii: {
|
|
6
|
+
readonly control: 10;
|
|
7
|
+
readonly card: 14;
|
|
8
|
+
readonly cardLg: 18;
|
|
9
|
+
/** Message bubbles. */
|
|
10
|
+
readonly bubble: 18;
|
|
11
|
+
/** The tight corner on a bubble's sender side. */
|
|
12
|
+
readonly bubbleTail: 6;
|
|
13
|
+
readonly sheet: 24;
|
|
14
|
+
readonly pill: 999;
|
|
15
|
+
readonly full: 9999;
|
|
16
|
+
};
|
|
17
|
+
export interface SupportShadows {
|
|
18
|
+
/** Floating launcher button. */
|
|
19
|
+
launcher: ViewStyle;
|
|
20
|
+
/** The bottom sheet itself. */
|
|
21
|
+
sheet: ViewStyle;
|
|
22
|
+
/** Unread badge, so it lifts off the button. */
|
|
23
|
+
badge: ViewStyle;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The launcher sits on the host app's own background rather than on an SDK
|
|
27
|
+
* surface, so the two themes need different treatment: on near-black a
|
|
28
|
+
* solid fill needs a hairline to separate from the background and a black
|
|
29
|
+
* shadow, while on white the accent-tinted shadow does that work and a
|
|
30
|
+
* borderless mark has to be darkened to stay legible.
|
|
31
|
+
*/
|
|
32
|
+
export interface LauncherPalette {
|
|
33
|
+
/** Hairline drawn over the solid fill. */
|
|
34
|
+
solidRing: string;
|
|
35
|
+
/** Mark color for the borderless (minimal) variant. */
|
|
36
|
+
minimalMark: string;
|
|
37
|
+
}
|
|
3
38
|
export interface SupportTheme {
|
|
4
39
|
name: ThemeName;
|
|
5
40
|
colors: ThemeColors;
|
|
6
41
|
spacing: typeof spacing;
|
|
7
|
-
radii: typeof
|
|
42
|
+
radii: typeof supportRadii;
|
|
8
43
|
motion: typeof motion;
|
|
44
|
+
shadows: SupportShadows;
|
|
45
|
+
launcher: LauncherPalette;
|
|
9
46
|
}
|
|
10
47
|
export declare const supportDarkTheme: SupportTheme;
|
|
11
48
|
export declare const supportLightTheme: SupportTheme;
|
|
12
|
-
|
|
49
|
+
/**
|
|
50
|
+
* @param name "light" | "dark" (default dark).
|
|
51
|
+
* @param accentColor Optional brand color (hex) replacing the default accent.
|
|
52
|
+
*/
|
|
53
|
+
export declare function resolveTheme(name: ThemeName | undefined, accentColor?: string): SupportTheme;
|
|
13
54
|
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/theme.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/theme.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,MAAM,EAEN,OAAO,EACP,KAAK,WAAW,EACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,8EAA8E;AAC9E,eAAO,MAAM,YAAY;;;;IAKvB,uBAAuB;;IAEvB,kDAAkD;;;;;CAI1C,CAAC;AAEX,MAAM,WAAW,cAAc;IAC7B,gCAAgC;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,+BAA+B;IAC/B,KAAK,EAAE,SAAS,CAAC;IACjB,gDAAgD;IAChD,KAAK,EAAE,SAAS,CAAC;CAClB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,OAAO,OAAO,CAAC;IACxB,KAAK,EAAE,OAAO,YAAY,CAAC;IAC3B,MAAM,EAAE,OAAO,MAAM,CAAC;IACtB,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,EAAE,eAAe,CAAC;CAC3B;AAmFD,eAAO,MAAM,gBAAgB,EAAE,YAA6C,CAAC;AAC7E,eAAO,MAAM,iBAAiB,EAAE,YAA+C,CAAC;AA+BhF;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,SAAS,GAAG,SAAS,EAC3B,WAAW,CAAC,EAAE,MAAM,GACnB,YAAY,CAGd"}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
1
2
|
export type QueryType = 'feedback' | 'feature_request' | 'bug_report';
|
|
2
3
|
export type QueryStatus = 'open' | 'resolved';
|
|
3
4
|
export type MessageSender = 'user' | 'admin';
|
|
4
5
|
export type ThemeName = 'dark' | 'light';
|
|
6
|
+
export type PushPermissionStatus = 'undetermined' | 'granted' | 'denied';
|
|
7
|
+
/**
|
|
8
|
+
* How the launcher renders:
|
|
9
|
+
* solid — accent fill, elevated. The floating action button.
|
|
10
|
+
* soft — app surface + hairline border. Sits in a header or toolbar.
|
|
11
|
+
* minimal — bare mark, no fill or border. Sits in a nav bar.
|
|
12
|
+
*/
|
|
13
|
+
export type LauncherVariant = 'solid' | 'soft' | 'minimal';
|
|
5
14
|
export interface SupportUser {
|
|
6
15
|
/** Display name shown to the support team. */
|
|
7
16
|
name: string;
|
|
@@ -28,12 +37,36 @@ export interface SupportButtonProps {
|
|
|
28
37
|
/** Visual theme. Matches the admin dashboard tokens. Default "dark". */
|
|
29
38
|
theme?: ThemeName;
|
|
30
39
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
|
|
40
|
+
* Brand color (hex, e.g. "#FF5A1F") replacing the default accent across
|
|
41
|
+
* the launcher, buttons, and the user's own message bubbles. The pressed
|
|
42
|
+
* shade, the 12% wash, and a legible foreground are derived from it.
|
|
43
|
+
*/
|
|
44
|
+
accentColor?: string;
|
|
45
|
+
/** Launcher style. Default "solid" — the floating action button. */
|
|
46
|
+
variant?: LauncherVariant;
|
|
47
|
+
/** Launcher diameter in px (height when `label` is set). Default 52. */
|
|
48
|
+
size?: number;
|
|
49
|
+
/** Renders the launcher as a pill with this text beside the mark. */
|
|
50
|
+
label?: string;
|
|
51
|
+
/** Style applied to the launcher — position it, add margins, etc. */
|
|
52
|
+
style?: StyleProp<ViewStyle>;
|
|
53
|
+
/**
|
|
54
|
+
* Idle poll interval (ms) — how often the unread badge is refreshed while
|
|
55
|
+
* the sheet is CLOSED, using a lightweight count-only endpoint. Default
|
|
56
|
+
* 60000; set 0 to disable idle polling (mount / sheet-open / foreground
|
|
57
|
+
* refreshes still happen).
|
|
58
|
+
*
|
|
59
|
+
* While the sheet is open the SDK polls faster on its own: every 15s on
|
|
60
|
+
* the thread list and every 5s inside a thread, where latency is felt.
|
|
35
61
|
*/
|
|
36
62
|
pollIntervalMs?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Optional EAS project id, forwarded to expo-notifications when minting a
|
|
65
|
+
* push token. Only needed if the host app's config doesn't already
|
|
66
|
+
* provide one. Push is skipped entirely when expo-notifications isn't
|
|
67
|
+
* installed — it is an optional peer dependency.
|
|
68
|
+
*/
|
|
69
|
+
expoProjectId?: string;
|
|
37
70
|
}
|
|
38
71
|
export interface ThreadMessage {
|
|
39
72
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,iBAAiB,GAAG,YAAY,CAAC;AACtE,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,UAAU,CAAC;AAC9C,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,CAAC;AAC7C,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE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;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,aAAa,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,aAAa,CAAC;QACtB,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,IAAI,CAAC;IACT,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAItD,CAAC;AAEF,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,gBAAgB,MAAM,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Thread } from './types';
|
|
2
|
+
/** Watermark map: thread id → `created_at` (ms) of the newest seen reply. */
|
|
3
|
+
export type ReadWatermarks = Map<string, number>;
|
|
4
|
+
/** `created_at` (ms) of the newest admin message, or 0 if there are none. */
|
|
5
|
+
export declare function latestAdminMessageAt(thread: Thread): number;
|
|
6
|
+
/** Admin messages in `thread` newer than `watermark`. */
|
|
7
|
+
export declare function unreadSince(thread: Thread, watermark: number): number;
|
|
8
|
+
/**
|
|
9
|
+
* Returns `thread` with `unread_count` narrowed by what this device knows
|
|
10
|
+
* the user has read. Identity is preserved when nothing changes so lists
|
|
11
|
+
* stay referentially stable between polls.
|
|
12
|
+
*/
|
|
13
|
+
export declare function reconcileThread(thread: Thread, watermarks: ReadWatermarks): Thread;
|
|
14
|
+
export declare function reconcileThreads(threads: Thread[], watermarks: ReadWatermarks): Thread[];
|
|
15
|
+
export declare function sumUnread(threads: Thread[]): number;
|
|
16
|
+
/**
|
|
17
|
+
* Drops watermarks the server has caught up on (its own count is already 0)
|
|
18
|
+
* and ones for threads that no longer exist, so the map can't grow without
|
|
19
|
+
* bound over a long session.
|
|
20
|
+
*/
|
|
21
|
+
export declare function pruneWatermarks(watermarks: ReadWatermarks, serverThreads: Thread[]): ReadWatermarks;
|
|
22
|
+
//# sourceMappingURL=unread.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unread.d.ts","sourceRoot":"","sources":["../../src/unread.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC,6EAA6E;AAC7E,MAAM,MAAM,cAAc,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEjD,6EAA6E;AAC7E,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQ3D;AAED,yDAAyD;AACzD,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAQrE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,cAAc,GACzB,MAAM,CAKR;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EAAE,EACjB,UAAU,EAAE,cAAc,GACzB,MAAM,EAAE,CAEV;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAEnD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,cAAc,EAC1B,aAAa,EAAE,MAAM,EAAE,GACtB,cAAc,CAShB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ApiConfig } from './api';
|
|
2
|
+
import type { Thread } from './types';
|
|
3
|
+
export declare const IDLE_POLL_MS = 60000;
|
|
4
|
+
export interface SupportThreadsState {
|
|
5
|
+
/** Server threads with unread counts narrowed by local reads. */
|
|
6
|
+
threads: Thread[] | null;
|
|
7
|
+
totalUnread: number;
|
|
8
|
+
/** First load only — there is nothing cached to show yet. */
|
|
9
|
+
loading: boolean;
|
|
10
|
+
/** User-pulled refresh with content already on screen. */
|
|
11
|
+
refreshing: boolean;
|
|
12
|
+
/** Set only when there is nothing cached; background failures stay quiet. */
|
|
13
|
+
error: string | null;
|
|
14
|
+
/** User-initiated refresh (pull-to-refresh, retry button). */
|
|
15
|
+
refresh: () => void;
|
|
16
|
+
/** Awaited by send/submit handlers so the list reflects the write. */
|
|
17
|
+
reload: () => Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export declare function useSupportThreads({ config, revenuecatId, enabled, sheetOpen, activeThreadId, idlePollMs, }: {
|
|
20
|
+
config: ApiConfig;
|
|
21
|
+
revenuecatId: string;
|
|
22
|
+
/** False when props failed validation — no requests are made. */
|
|
23
|
+
enabled: boolean;
|
|
24
|
+
sheetOpen: boolean;
|
|
25
|
+
activeThreadId: string | null;
|
|
26
|
+
idlePollMs: number;
|
|
27
|
+
}): SupportThreadsState;
|
|
28
|
+
//# sourceMappingURL=useSupportThreads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSupportThreads.d.ts","sourceRoot":"","sources":["../../src/useSupportThreads.ts"],"names":[],"mappings":"AAgBA,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAetC,eAAO,MAAM,YAAY,QAAS,CAAC;AA0CnC,MAAM,WAAW,mBAAmB;IAClC,iEAAiE;IACjE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,6DAA6D;IAC7D,OAAO,EAAE,OAAO,CAAC;IACjB,0DAA0D;IAC1D,UAAU,EAAE,OAAO,CAAC;IACpB,6EAA6E;IAC7E,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,8DAA8D;IAC9D,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,sEAAsE;IACtE,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,MAAM,EACN,YAAY,EACZ,OAAO,EACP,SAAS,EACT,cAAc,EACd,UAAU,GACX,EAAE;IACD,MAAM,EAAE,SAAS,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,iEAAiE;IACjE,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,mBAAmB,CAoQtB"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/** "2h ago" relative time — mirrors the web dashboard's formatting. */
|
|
2
2
|
export declare function relativeTime(iso: string): string;
|
|
3
3
|
export declare function formatDate(iso: string): string;
|
|
4
|
+
/** "14:32" in the device's locale — shown under a group of messages. */
|
|
5
|
+
export declare function formatTime(iso: string): string;
|
|
6
|
+
export declare function isSameDay(a: string, b: string): boolean;
|
|
7
|
+
/** Date separator label: Today / Yesterday / "Mon, 5 Jan". */
|
|
8
|
+
export declare function dayLabel(iso: string): string;
|
|
4
9
|
/** Dev-mode prop validation with actionable messages. */
|
|
5
10
|
export declare function validateProps(props: {
|
|
6
11
|
appName?: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAehD;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM9C;AAED,yDAAyD;AACzD,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,GAAG,MAAM,GAAG,IAAI,CA8BhB"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAehD;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM9C;AAED,wEAAwE;AACxE,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK9C;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAQvD;AAED,8DAA8D;AAC9D,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAY5C;AAED,yDAAyD;AACzD,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,GAAG,MAAM,GAAG,IAAI,CA8BhB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appsupportkit/support-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "In-app customer support for React Native: feedback, feature requests, and bug reports with two-way threads.",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"module": "./lib/module/index.js",
|
|
@@ -19,13 +19,19 @@
|
|
|
19
19
|
],
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@appsupportkit/design-tokens": "^0.
|
|
22
|
+
"@appsupportkit/design-tokens": "^0.2.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
+
"expo-notifications": ">=0.27.0",
|
|
25
26
|
"react": ">=18.0.0",
|
|
26
27
|
"react-native": ">=0.73.0",
|
|
27
28
|
"react-native-safe-area-context": ">=4.0.0"
|
|
28
29
|
},
|
|
30
|
+
"peerDependenciesMeta": {
|
|
31
|
+
"expo-notifications": {
|
|
32
|
+
"optional": true
|
|
33
|
+
}
|
|
34
|
+
},
|
|
29
35
|
"devDependencies": {
|
|
30
36
|
"@types/react": "^19.0.2",
|
|
31
37
|
"react": "19.0.0",
|
package/src/api.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// Thin client for the Supabase Edge Functions. Every call authenticates with
|
|
2
2
|
// the per-app x-api-key header; no Supabase JS client is needed on-device.
|
|
3
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
PushPermissionStatus,
|
|
5
|
+
QueryType,
|
|
6
|
+
ThreadsResponse,
|
|
7
|
+
} from './types';
|
|
4
8
|
|
|
5
9
|
export interface ApiConfig {
|
|
6
10
|
supabaseUrl: string;
|
|
@@ -72,6 +76,42 @@ export function getThreads(
|
|
|
72
76
|
});
|
|
73
77
|
}
|
|
74
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Badge-only endpoint (~18 bytes) used for idle polling, instead of
|
|
81
|
+
* re-fetching every thread and message just to check for new replies.
|
|
82
|
+
*/
|
|
83
|
+
export function getUnreadCount(
|
|
84
|
+
config: ApiConfig,
|
|
85
|
+
revenuecatId: string,
|
|
86
|
+
): Promise<{ total_unread: number }> {
|
|
87
|
+
const params = new URLSearchParams({ revenuecat_id: revenuecatId });
|
|
88
|
+
return request(config, `get-unread-count?${params.toString()}`, {
|
|
89
|
+
method: 'GET',
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Reports the OS notification permission outcome (including denials). */
|
|
94
|
+
export function registerPush(
|
|
95
|
+
config: ApiConfig,
|
|
96
|
+
input: {
|
|
97
|
+
revenuecatId: string;
|
|
98
|
+
permissionStatus: PushPermissionStatus;
|
|
99
|
+
expoPushToken: string | null;
|
|
100
|
+
asked: boolean;
|
|
101
|
+
},
|
|
102
|
+
): Promise<{ ok: boolean }> {
|
|
103
|
+
return request(config, 'register-push', {
|
|
104
|
+
method: 'POST',
|
|
105
|
+
body: JSON.stringify({
|
|
106
|
+
app_name: config.appName,
|
|
107
|
+
revenuecat_id: input.revenuecatId,
|
|
108
|
+
permission_status: input.permissionStatus,
|
|
109
|
+
expo_push_token: input.expoPushToken,
|
|
110
|
+
asked: input.asked,
|
|
111
|
+
}),
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
75
115
|
export function submitQuery(
|
|
76
116
|
config: ApiConfig,
|
|
77
117
|
input: {
|