@appsupportkit/support-sdk 0.2.0 → 0.4.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 +61 -12
- package/lib/commonjs/api.js.map +1 -1
- package/lib/commonjs/components/BottomSheet.js +1 -1
- package/lib/commonjs/components/BottomSheet.js.map +1 -1
- package/lib/commonjs/components/LauncherButton.js +4 -4
- package/lib/commonjs/components/LauncherButton.js.map +1 -1
- package/lib/commonjs/components/SupportButton.js +192 -66
- package/lib/commonjs/components/SupportButton.js.map +1 -1
- package/lib/commonjs/components/icons.js +117 -110
- package/lib/commonjs/components/icons.js.map +1 -1
- package/lib/commonjs/components/primitives.js +3 -154
- package/lib/commonjs/components/primitives.js.map +1 -1
- package/lib/commonjs/components/screens/ChatScreen.js +487 -0
- package/lib/commonjs/components/screens/ChatScreen.js.map +1 -0
- package/lib/commonjs/components/screens/LanguageScreen.js +150 -0
- package/lib/commonjs/components/screens/LanguageScreen.js.map +1 -0
- package/lib/commonjs/i18n/index.js +101 -0
- package/lib/commonjs/i18n/index.js.map +1 -0
- package/lib/commonjs/i18n/languages.js +95 -0
- package/lib/commonjs/i18n/languages.js.map +1 -0
- package/lib/commonjs/i18n/strings/de.js +75 -0
- package/lib/commonjs/i18n/strings/de.js.map +1 -0
- package/lib/commonjs/i18n/strings/en.js +91 -0
- package/lib/commonjs/i18n/strings/en.js.map +1 -0
- package/lib/commonjs/i18n/strings/es.js +75 -0
- package/lib/commonjs/i18n/strings/es.js.map +1 -0
- package/lib/commonjs/i18n/strings/fr.js +75 -0
- package/lib/commonjs/i18n/strings/fr.js.map +1 -0
- package/lib/commonjs/i18n/strings/hi.js +75 -0
- package/lib/commonjs/i18n/strings/hi.js.map +1 -0
- package/lib/commonjs/i18n/strings/it.js +75 -0
- package/lib/commonjs/i18n/strings/it.js.map +1 -0
- package/lib/commonjs/i18n/strings/ja.js +75 -0
- package/lib/commonjs/i18n/strings/ja.js.map +1 -0
- package/lib/commonjs/i18n/strings/ko.js +75 -0
- package/lib/commonjs/i18n/strings/ko.js.map +1 -0
- package/lib/commonjs/i18n/strings/nl.js +75 -0
- package/lib/commonjs/i18n/strings/nl.js.map +1 -0
- package/lib/commonjs/i18n/strings/pl.js +75 -0
- package/lib/commonjs/i18n/strings/pl.js.map +1 -0
- package/lib/commonjs/i18n/strings/pt.js +75 -0
- package/lib/commonjs/i18n/strings/pt.js.map +1 -0
- package/lib/commonjs/i18n/strings/ru.js +75 -0
- package/lib/commonjs/i18n/strings/ru.js.map +1 -0
- package/lib/commonjs/i18n/strings/tr.js +75 -0
- package/lib/commonjs/i18n/strings/tr.js.map +1 -0
- package/lib/commonjs/i18n/strings/zh.js +75 -0
- package/lib/commonjs/i18n/strings/zh.js.map +1 -0
- package/lib/commonjs/index.js +38 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/push.js +78 -3
- package/lib/commonjs/push.js.map +1 -1
- package/lib/commonjs/review.js +54 -0
- package/lib/commonjs/review.js.map +1 -0
- package/lib/commonjs/theme.js +142 -23
- package/lib/commonjs/theme.js.map +1 -1
- package/lib/commonjs/types.js +32 -3
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/useSupportThreads.js +41 -24
- package/lib/commonjs/useSupportThreads.js.map +1 -1
- package/lib/commonjs/utils.js +25 -30
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/version.js +13 -0
- package/lib/commonjs/version.js.map +1 -0
- package/lib/module/api.js +57 -10
- package/lib/module/api.js.map +1 -1
- package/lib/module/components/BottomSheet.js +1 -1
- package/lib/module/components/BottomSheet.js.map +1 -1
- package/lib/module/components/LauncherButton.js +5 -5
- package/lib/module/components/LauncherButton.js.map +1 -1
- package/lib/module/components/SupportButton.js +199 -73
- package/lib/module/components/SupportButton.js.map +1 -1
- package/lib/module/components/icons.js +115 -107
- package/lib/module/components/icons.js.map +1 -1
- package/lib/module/components/primitives.js +5 -147
- package/lib/module/components/primitives.js.map +1 -1
- package/lib/module/components/screens/ChatScreen.js +485 -0
- package/lib/module/components/screens/ChatScreen.js.map +1 -0
- package/lib/module/components/screens/LanguageScreen.js +147 -0
- package/lib/module/components/screens/LanguageScreen.js.map +1 -0
- package/lib/module/i18n/index.js +56 -0
- package/lib/module/i18n/index.js.map +1 -0
- package/lib/module/i18n/languages.js +88 -0
- package/lib/module/i18n/languages.js.map +1 -0
- package/lib/module/i18n/strings/de.js +71 -0
- package/lib/module/i18n/strings/de.js.map +1 -0
- package/lib/module/i18n/strings/en.js +87 -0
- package/lib/module/i18n/strings/en.js.map +1 -0
- package/lib/module/i18n/strings/es.js +71 -0
- package/lib/module/i18n/strings/es.js.map +1 -0
- package/lib/module/i18n/strings/fr.js +71 -0
- package/lib/module/i18n/strings/fr.js.map +1 -0
- package/lib/module/i18n/strings/hi.js +71 -0
- package/lib/module/i18n/strings/hi.js.map +1 -0
- package/lib/module/i18n/strings/it.js +71 -0
- package/lib/module/i18n/strings/it.js.map +1 -0
- package/lib/module/i18n/strings/ja.js +71 -0
- package/lib/module/i18n/strings/ja.js.map +1 -0
- package/lib/module/i18n/strings/ko.js +71 -0
- package/lib/module/i18n/strings/ko.js.map +1 -0
- package/lib/module/i18n/strings/nl.js +71 -0
- package/lib/module/i18n/strings/nl.js.map +1 -0
- package/lib/module/i18n/strings/pl.js +71 -0
- package/lib/module/i18n/strings/pl.js.map +1 -0
- package/lib/module/i18n/strings/pt.js +71 -0
- package/lib/module/i18n/strings/pt.js.map +1 -0
- package/lib/module/i18n/strings/ru.js +71 -0
- package/lib/module/i18n/strings/ru.js.map +1 -0
- package/lib/module/i18n/strings/tr.js +71 -0
- package/lib/module/i18n/strings/tr.js.map +1 -0
- package/lib/module/i18n/strings/zh.js +71 -0
- package/lib/module/i18n/strings/zh.js.map +1 -0
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/push.js +77 -3
- package/lib/module/push.js.map +1 -1
- package/lib/module/review.js +48 -0
- package/lib/module/review.js.map +1 -0
- package/lib/module/theme.js +141 -23
- package/lib/module/theme.js.map +1 -1
- package/lib/module/types.js +32 -3
- package/lib/module/types.js.map +1 -1
- package/lib/module/useSupportThreads.js +41 -24
- package/lib/module/useSupportThreads.js.map +1 -1
- package/lib/module/utils.js +24 -29
- package/lib/module/utils.js.map +1 -1
- package/lib/module/version.js +9 -0
- package/lib/module/version.js.map +1 -0
- package/lib/typescript/api.d.ts +40 -10
- package/lib/typescript/api.d.ts.map +1 -1
- package/lib/typescript/components/SupportButton.d.ts +2 -2
- package/lib/typescript/components/SupportButton.d.ts.map +1 -1
- package/lib/typescript/components/icons.d.ts +10 -14
- package/lib/typescript/components/icons.d.ts.map +1 -1
- package/lib/typescript/components/primitives.d.ts +3 -30
- package/lib/typescript/components/primitives.d.ts.map +1 -1
- package/lib/typescript/components/screens/ChatScreen.d.ts +21 -0
- package/lib/typescript/components/screens/ChatScreen.d.ts.map +1 -0
- package/lib/typescript/components/screens/LanguageScreen.d.ts +30 -0
- package/lib/typescript/components/screens/LanguageScreen.d.ts.map +1 -0
- package/lib/typescript/i18n/index.d.ts +15 -0
- package/lib/typescript/i18n/index.d.ts.map +1 -0
- package/lib/typescript/i18n/languages.d.ts +36 -0
- package/lib/typescript/i18n/languages.d.ts.map +1 -0
- package/lib/typescript/i18n/strings/de.d.ts +3 -0
- package/lib/typescript/i18n/strings/de.d.ts.map +1 -0
- package/lib/typescript/i18n/strings/en.d.ts +86 -0
- package/lib/typescript/i18n/strings/en.d.ts.map +1 -0
- package/lib/typescript/i18n/strings/es.d.ts +3 -0
- package/lib/typescript/i18n/strings/es.d.ts.map +1 -0
- package/lib/typescript/i18n/strings/fr.d.ts +3 -0
- package/lib/typescript/i18n/strings/fr.d.ts.map +1 -0
- package/lib/typescript/i18n/strings/hi.d.ts +3 -0
- package/lib/typescript/i18n/strings/hi.d.ts.map +1 -0
- package/lib/typescript/i18n/strings/it.d.ts +3 -0
- package/lib/typescript/i18n/strings/it.d.ts.map +1 -0
- package/lib/typescript/i18n/strings/ja.d.ts +3 -0
- package/lib/typescript/i18n/strings/ja.d.ts.map +1 -0
- package/lib/typescript/i18n/strings/ko.d.ts +3 -0
- package/lib/typescript/i18n/strings/ko.d.ts.map +1 -0
- package/lib/typescript/i18n/strings/nl.d.ts +3 -0
- package/lib/typescript/i18n/strings/nl.d.ts.map +1 -0
- package/lib/typescript/i18n/strings/pl.d.ts +3 -0
- package/lib/typescript/i18n/strings/pl.d.ts.map +1 -0
- package/lib/typescript/i18n/strings/pt.d.ts +3 -0
- package/lib/typescript/i18n/strings/pt.d.ts.map +1 -0
- package/lib/typescript/i18n/strings/ru.d.ts +3 -0
- package/lib/typescript/i18n/strings/ru.d.ts.map +1 -0
- package/lib/typescript/i18n/strings/tr.d.ts +3 -0
- package/lib/typescript/i18n/strings/tr.d.ts.map +1 -0
- package/lib/typescript/i18n/strings/zh.d.ts +3 -0
- package/lib/typescript/i18n/strings/zh.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +4 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/push.d.ts +14 -2
- package/lib/typescript/push.d.ts.map +1 -1
- package/lib/typescript/review.d.ts +15 -0
- package/lib/typescript/review.d.ts.map +1 -0
- package/lib/typescript/theme.d.ts +23 -5
- package/lib/typescript/theme.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +86 -13
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/useSupportThreads.d.ts +20 -4
- package/lib/typescript/useSupportThreads.d.ts.map +1 -1
- package/lib/typescript/utils.d.ts +8 -6
- package/lib/typescript/utils.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +7 -0
- package/lib/typescript/version.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/api.ts +75 -23
- package/src/components/BottomSheet.tsx +1 -1
- package/src/components/LauncherButton.tsx +4 -4
- package/src/components/SupportButton.tsx +244 -86
- package/src/components/icons.tsx +96 -101
- package/src/components/primitives.tsx +9 -161
- package/src/components/screens/ChatScreen.tsx +541 -0
- package/src/components/screens/LanguageScreen.tsx +172 -0
- package/src/i18n/index.ts +81 -0
- package/src/i18n/languages.ts +106 -0
- package/src/i18n/strings/de.ts +81 -0
- package/src/i18n/strings/en.ts +97 -0
- package/src/i18n/strings/es.ts +80 -0
- package/src/i18n/strings/fr.ts +81 -0
- package/src/i18n/strings/hi.ts +80 -0
- package/src/i18n/strings/it.ts +80 -0
- package/src/i18n/strings/ja.ts +80 -0
- package/src/i18n/strings/ko.ts +79 -0
- package/src/i18n/strings/nl.ts +80 -0
- package/src/i18n/strings/pl.ts +80 -0
- package/src/i18n/strings/pt.ts +80 -0
- package/src/i18n/strings/ru.ts +80 -0
- package/src/i18n/strings/tr.ts +80 -0
- package/src/i18n/strings/zh.ts +78 -0
- package/src/index.tsx +13 -0
- package/src/push.ts +100 -2
- package/src/review.ts +54 -0
- package/src/theme.ts +182 -28
- package/src/types.ts +85 -13
- package/src/useSupportThreads.ts +61 -28
- package/src/utils.ts +27 -29
- package/src/version.ts +6 -0
- package/lib/commonjs/components/screens/ComposeScreen.js +0 -228
- package/lib/commonjs/components/screens/ComposeScreen.js.map +0 -1
- package/lib/commonjs/components/screens/HomeScreen.js +0 -286
- package/lib/commonjs/components/screens/HomeScreen.js.map +0 -1
- package/lib/commonjs/components/screens/ThreadScreen.js +0 -327
- package/lib/commonjs/components/screens/ThreadScreen.js.map +0 -1
- package/lib/module/components/screens/ComposeScreen.js +0 -224
- package/lib/module/components/screens/ComposeScreen.js.map +0 -1
- package/lib/module/components/screens/HomeScreen.js +0 -282
- package/lib/module/components/screens/HomeScreen.js.map +0 -1
- package/lib/module/components/screens/ThreadScreen.js +0 -325
- package/lib/module/components/screens/ThreadScreen.js.map +0 -1
- package/lib/typescript/components/screens/ComposeScreen.d.ts +0 -10
- package/lib/typescript/components/screens/ComposeScreen.d.ts.map +0 -1
- package/lib/typescript/components/screens/HomeScreen.d.ts +0 -14
- package/lib/typescript/components/screens/HomeScreen.d.ts.map +0 -1
- package/lib/typescript/components/screens/ThreadScreen.d.ts +0 -10
- package/lib/typescript/components/screens/ThreadScreen.d.ts.map +0 -1
- package/src/components/screens/ComposeScreen.tsx +0 -233
- package/src/components/screens/HomeScreen.tsx +0 -287
- package/src/components/screens/ThreadScreen.tsx +0 -397
package/lib/commonjs/api.js
CHANGED
|
@@ -7,9 +7,12 @@ exports.SupportApiError = void 0;
|
|
|
7
7
|
exports.getThreads = getThreads;
|
|
8
8
|
exports.getUnreadCount = getUnreadCount;
|
|
9
9
|
exports.markRead = markRead;
|
|
10
|
-
exports.postMessage = postMessage;
|
|
11
10
|
exports.registerPush = registerPush;
|
|
12
|
-
exports.
|
|
11
|
+
exports.registerUser = registerUser;
|
|
12
|
+
exports.reviewOpened = reviewOpened;
|
|
13
|
+
exports.sendMessage = sendMessage;
|
|
14
|
+
exports.setLanguage = setLanguage;
|
|
15
|
+
var _version = require("./version");
|
|
13
16
|
// Thin client for the Supabase Edge Functions. Every call authenticates with
|
|
14
17
|
// the per-app x-api-key header; no Supabase JS client is needed on-device.
|
|
15
18
|
|
|
@@ -33,6 +36,8 @@ async function request(config, path, init) {
|
|
|
33
36
|
headers: {
|
|
34
37
|
'Content-Type': 'application/json',
|
|
35
38
|
'x-api-key': config.apiKey,
|
|
39
|
+
// Tells the backend this build speaks the single support chat.
|
|
40
|
+
'x-sdk-version': _version.SDK_VERSION,
|
|
36
41
|
...init.headers
|
|
37
42
|
}
|
|
38
43
|
});
|
|
@@ -86,27 +91,71 @@ function registerPush(config, input) {
|
|
|
86
91
|
})
|
|
87
92
|
});
|
|
88
93
|
}
|
|
89
|
-
|
|
90
|
-
|
|
94
|
+
|
|
95
|
+
/** Records the language the user reads and writes support messages in. */
|
|
96
|
+
function setLanguage(config, input) {
|
|
97
|
+
return request(config, 'set-language', {
|
|
98
|
+
method: 'POST',
|
|
99
|
+
body: JSON.stringify({
|
|
100
|
+
revenuecat_id: input.revenuecatId,
|
|
101
|
+
language: input.language
|
|
102
|
+
})
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** What the backend is told about the current user. */
|
|
107
|
+
|
|
108
|
+
function reportedUser(user) {
|
|
109
|
+
return {
|
|
110
|
+
name: user.name,
|
|
111
|
+
plan: user.plan,
|
|
112
|
+
app_version: user.appVersion,
|
|
113
|
+
platform: user.platform
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Sends one chat message. The server appends it to the user's open
|
|
119
|
+
* conversation, or starts one if none is open (a first message, or the first
|
|
120
|
+
* after a resolve).
|
|
121
|
+
*/
|
|
122
|
+
function sendMessage(config, input) {
|
|
123
|
+
return request(config, 'send-message', {
|
|
91
124
|
method: 'POST',
|
|
92
125
|
body: JSON.stringify({
|
|
93
126
|
app_name: config.appName,
|
|
94
|
-
|
|
127
|
+
revenuecat_id: input.revenuecatId,
|
|
95
128
|
message: input.message,
|
|
96
|
-
|
|
97
|
-
|
|
129
|
+
// Sent on every write so a lost set-language call self-heals.
|
|
130
|
+
language: input.language,
|
|
131
|
+
user: reportedUser(input.user)
|
|
132
|
+
})
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Records the user in the app's directory, so the team can find and message
|
|
138
|
+
* them before they ever open support. Called on every load.
|
|
139
|
+
*/
|
|
140
|
+
function registerUser(config, input) {
|
|
141
|
+
return request(config, 'register-user', {
|
|
142
|
+
method: 'POST',
|
|
143
|
+
body: JSON.stringify({
|
|
144
|
+
app_name: config.appName,
|
|
98
145
|
revenuecat_id: input.revenuecatId,
|
|
99
|
-
|
|
146
|
+
user: reportedUser(input.user)
|
|
100
147
|
})
|
|
101
148
|
});
|
|
102
149
|
}
|
|
103
|
-
|
|
104
|
-
|
|
150
|
+
|
|
151
|
+
/** Records a tap on a review request's store button, for the dashboard. */
|
|
152
|
+
function reviewOpened(config, input) {
|
|
153
|
+
return request(config, 'review-opened', {
|
|
105
154
|
method: 'POST',
|
|
106
155
|
body: JSON.stringify({
|
|
107
|
-
|
|
156
|
+
app_name: config.appName,
|
|
108
157
|
revenuecat_id: input.revenuecatId,
|
|
109
|
-
|
|
158
|
+
message_id: input.messageId
|
|
110
159
|
})
|
|
111
160
|
});
|
|
112
161
|
}
|
package/lib/commonjs/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SupportApiError","Error","constructor","message","status","offline","name","exports","request","config","path","init","url","supabaseUrl","replace","response","fetch","headers","apiKey","payload","json","ok","error","getThreads","revenuecatId","params","URLSearchParams","revenuecat_id","toString","method","getUnreadCount","registerPush","input","body","JSON","stringify","app_name","appName","permission_status","permissionStatus","expo_push_token","expoPushToken","asked","
|
|
1
|
+
{"version":3,"names":["_version","require","SupportApiError","Error","constructor","message","status","offline","name","exports","request","config","path","init","url","supabaseUrl","replace","response","fetch","headers","apiKey","SDK_VERSION","payload","json","ok","error","getThreads","revenuecatId","params","URLSearchParams","revenuecat_id","toString","method","getUnreadCount","registerPush","input","body","JSON","stringify","app_name","appName","permission_status","permissionStatus","expo_push_token","expoPushToken","asked","setLanguage","language","reportedUser","user","plan","app_version","appVersion","platform","sendMessage","registerUser","reviewOpened","message_id","messageId","markRead","query_id","queryId"],"sourceRoot":"../../src","sources":["api.ts"],"mappings":";;;;;;;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;;AAUO,MAAMC,eAAe,SAASC,KAAK,CAAC;EAEzC;;EAGAC,WAAWA,CAACC,OAAe,EAAEC,MAAqB,EAAEC,OAAO,GAAG,KAAK,EAAE;IACnE,KAAK,CAACF,OAAO,CAAC;IACd,IAAI,CAACG,IAAI,GAAG,iBAAiB;IAC7B,IAAI,CAACF,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,OAAO,GAAGA,OAAO;EACxB;AACF;AAACE,OAAA,CAAAP,eAAA,GAAAA,eAAA;AAED,eAAeQ,OAAOA,CACpBC,MAAiB,EACjBC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QA,CACtBhD,MAAiB,EACjBwB,KAAgD,EACtB;EAC1B,OAAOzB,OAAO,CAACC,MAAM,EAAE,WAAW,EAAE;IAClCqB,MAAM,EAAE,MAAM;IACdI,IAAI,EAAEC,IAAI,CAACC,SAAS,CAAC;MACnBsB,QAAQ,EAAEzB,KAAK,CAAC0B,OAAO;MACvB/B,aAAa,EAAEK,KAAK,CAACR;IACvB,CAAC;EACH,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -136,7 +136,7 @@ function BottomSheet({
|
|
|
136
136
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Animated.View, {
|
|
137
137
|
style: {
|
|
138
138
|
height: sheetHeight,
|
|
139
|
-
backgroundColor: theme.colors.
|
|
139
|
+
backgroundColor: theme.colors.sheet,
|
|
140
140
|
borderTopLeftRadius: theme.radii.sheet,
|
|
141
141
|
borderTopRightRadius: theme.radii.sheet,
|
|
142
142
|
borderWidth: 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","_reactNativeSafeAreaContext","_jsxRuntime","SLIDE_MS","FADE_MS","BottomSheet","visible","onClose","theme","children","height","windowHeight","useWindowDimensions","sheetHeight","Math","min","rendered","setRendered","useState","translateY","useRef","Animated","Value","current","backdrop","shown","useEffect","setValue","parallel","timing","toValue","duration","easing","Easing","bezier","useNativeDriver","out","cubic","start","motion","slow","in","finished","requestClose","useCallback","panResponder","PanResponder","create","onStartShouldSetPanResponder","onMoveShouldSetPanResponder","_e","g","abs","dy","onPanResponderMove","onPanResponderRelease","vy","jsx","Modal","transparent","animationType","onRequestClose","statusBarTranslucent","SafeAreaProvider","jsxs","View","style","flex","justifyContent","position","top","right","bottom","left","backgroundColor","opacity","Pressable","onPress","accessibilityLabel","colors","
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_reactNativeSafeAreaContext","_jsxRuntime","SLIDE_MS","FADE_MS","BottomSheet","visible","onClose","theme","children","height","windowHeight","useWindowDimensions","sheetHeight","Math","min","rendered","setRendered","useState","translateY","useRef","Animated","Value","current","backdrop","shown","useEffect","setValue","parallel","timing","toValue","duration","easing","Easing","bezier","useNativeDriver","out","cubic","start","motion","slow","in","finished","requestClose","useCallback","panResponder","PanResponder","create","onStartShouldSetPanResponder","onMoveShouldSetPanResponder","_e","g","abs","dy","onPanResponderMove","onPanResponderRelease","vy","jsx","Modal","transparent","animationType","onRequestClose","statusBarTranslucent","SafeAreaProvider","jsxs","View","style","flex","justifyContent","position","top","right","bottom","left","backgroundColor","opacity","Pressable","onPress","accessibilityLabel","colors","sheet","borderTopLeftRadius","radii","borderTopRightRadius","borderWidth","borderBottomWidth","borderColor","border","overflow","transform","shadows","panHandlers","alignItems","paddingTop","paddingBottom","width","borderRadius","borderStrong","SafeAreaView","edges"],"sourceRoot":"../../../src","sources":["components/BottomSheet.tsx"],"mappings":";;;;;;AAWA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AASA,IAAAE,2BAAA,GAAAF,OAAA;AAAgF,IAAAG,WAAA,GAAAH,OAAA;AArBhF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcA,MAAMI,QAAQ,GAAG,GAAG;AACpB,MAAMC,OAAO,GAAG,GAAG;AAEZ,SAASC,WAAWA,CAAC;EAC1BC,OAAO;EACPC,OAAO;EACPC,KAAK;EACLC;AAMF,CAAC,EAAE;EACD,MAAM;IAAEC,MAAM,EAAEC;EAAa,CAAC,GAAG,IAAAC,gCAAmB,EAAC,CAAC;EACtD,MAAMC,WAAW,GAAGC,IAAI,CAACC,GAAG,CAACJ,YAAY,GAAG,IAAI,EAAE,GAAG,CAAC;EAEtD,MAAM,CAACK,QAAQ,EAAEC,WAAW,CAAC,GAAG,IAAAC,eAAQ,EAAC,KAAK,CAAC;EAC/C,MAAMC,UAAU,GAAG,IAAAC,aAAM,EAAC,IAAIC,qBAAQ,CAACC,KAAK,CAACT,WAAW,CAAC,CAA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,GAAA,EAACxD,2BAAA,CAAAiG,YAAY;YAACC,KAAK,EAAE,CAAC,QAAQ,CAAE;YAACjC,KAAK,EAAE;cAAEC,IAAI,EAAE;YAAE,CAAE;YAAA1D,QAAA,EACjDA;UAAQ,CACG,CAAC;QAAA,CACF,CAAC;MAAA,CACZ;IAAC,CACS;EAAC,CACd,CAAC;AAEZ","ignoreList":[]}
|
|
@@ -62,7 +62,7 @@ function LauncherButton({
|
|
|
62
62
|
const soft = variant === 'soft';
|
|
63
63
|
const fill = solid ? theme.colors.accent : soft ? theme.colors.surface : 'transparent';
|
|
64
64
|
const markColor = solid ? theme.colors.accentForeground : soft ? theme.colors.accent : theme.launcher.minimalMark;
|
|
65
|
-
//
|
|
65
|
+
// The gap between the bubbles is cut in whatever sits behind the mark —
|
|
66
66
|
// the button's own fill, or the app background when there isn't one.
|
|
67
67
|
const markHoleColor = solid ? theme.colors.accent : soft ? theme.colors.surface : theme.colors.bg;
|
|
68
68
|
// Dark: a hairline separates the fill from a near-black app background.
|
|
@@ -81,7 +81,7 @@ function LauncherButton({
|
|
|
81
81
|
const badgeBg = solid ? theme.colors.accentForeground : theme.colors.accent;
|
|
82
82
|
const badgeFg = solid ? theme.colors.accent : theme.colors.accentForeground;
|
|
83
83
|
const height = label ? Math.max(44, size * 0.84) : size;
|
|
84
|
-
const markSize = Math.round(size * (label ? 0.
|
|
84
|
+
const markSize = Math.round(size * (label ? 0.4 : 0.46));
|
|
85
85
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Animated.View, {
|
|
86
86
|
style: [{
|
|
87
87
|
transform: [{
|
|
@@ -133,9 +133,9 @@ function LauncherButton({
|
|
|
133
133
|
...border,
|
|
134
134
|
...(variant === 'minimal' ? null : theme.shadows.launcher)
|
|
135
135
|
},
|
|
136
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.
|
|
136
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ConversationMark, {
|
|
137
137
|
color: markColor,
|
|
138
|
-
|
|
138
|
+
holeColor: markHoleColor,
|
|
139
139
|
size: markSize
|
|
140
140
|
}), label !== undefined && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
141
141
|
style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","_icons","_jsxRuntime","PRESS_SCALE","badgeLabel","unread","String","LauncherButton","theme","variant","size","label","style","onPress","scale","useRef","Animated","Value","current","pulse","previousUnread","useEffect","setValue","animation","loop","timing","toValue","duration","easing","Easing","out","ease","useNativeDriver","iterations","start","stop","undefined","press","to","motion","base","fast","cubic","solid","soft","fill","colors","accent","surface","markColor","accentForeground","launcher","minimalMark","markHoleColor","bg","border","borderWidth","borderColor","solidRing","badgeBg","badgeFg","height","Math","max","markSize","round","jsxs","View","transform","pointerEvents","children","jsx","position","top","left","width","right","borderRadius","radii","pill","backgroundColor","opacity","interpolate","inputRange","outputRange","Pressable","onPressIn","onPressOut","hitSlop","accessibilityRole","accessibilityLabel","paddingHorizontal","flexDirection","alignItems","justifyContent","gap","shadows","
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_icons","_jsxRuntime","PRESS_SCALE","badgeLabel","unread","String","LauncherButton","theme","variant","size","label","style","onPress","scale","useRef","Animated","Value","current","pulse","previousUnread","useEffect","setValue","animation","loop","timing","toValue","duration","easing","Easing","out","ease","useNativeDriver","iterations","start","stop","undefined","press","to","motion","base","fast","cubic","solid","soft","fill","colors","accent","surface","markColor","accentForeground","launcher","minimalMark","markHoleColor","bg","border","borderWidth","borderColor","solidRing","badgeBg","badgeFg","height","Math","max","markSize","round","jsxs","View","transform","pointerEvents","children","jsx","position","top","left","width","right","borderRadius","radii","pill","backgroundColor","opacity","interpolate","inputRange","outputRange","Pressable","onPressIn","onPressOut","hitSlop","accessibilityRole","accessibilityLabel","paddingHorizontal","flexDirection","alignItems","justifyContent","gap","shadows","ConversationMark","color","holeColor","Text","fontSize","fontWeight","letterSpacing","textPrimary","minWidth","badge","lineHeight","fontVariant"],"sourceRoot":"../../../src","sources":["components/LauncherButton.tsx"],"mappings":";;;;;;AAIA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAWA,IAAAE,MAAA,GAAAF,OAAA;AAA2C,IAAAG,WAAA,GAAAH,OAAA;AAhB3C;AACA;AACA;AACA;;AAeA,MAAMI,WAAW,GAAG,IAAI;;AAExB;AACA,SAASC,UAAUA,CAACC,MAAc,EAAU;EAC1C,OAAOA,MAAM,GAAG,EAAE,GAAG,KAAK,GAAGC,MAAM,CAACD,MAAM,CAAC;AAC7C;AAEO,SAASE,cAAcA,CAAC;EAC7BC,KAAK;EACLH,MAAM;EACNI,OAAO,GAAG,OAAO;EACjBC,IAAI,GAAG,EAAE;EACTC,KAAK;EACLC,KAAK;EACLC;AAUF,CAAC,EAAE;EACD,MAAMC,KAAK,GAAG,IAAAC,aAAM,EAAC,IAAIC,qBAAQ,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC,CAACC,OAAO;EACnD,MAAMC,KAAK,GAAG,IAAAJ,aAAM,EAAC,IAAIC,qBAAQ,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC,CAACC,OAAO;EACnD,MAAME,cAAc,GAAG,IAAAL,aAAM,EAACV,MAAM,CAAC;;EAErC;EACA;EACA,IAAAgB,gBAAS,EAAC,MAAM;IACd,IAAIhB,MAAM,GAAGe,cAAc,CAACF,OAAO,EAAE;MACnCC,KAAK,CAACG,QAAQ,CAAC,CAAC,CAAC;MACjB,MAAMC,SAAS,GAAGP,qBAAQ,CAACQ,IAAI,CAC7BR,qBAAQ,CAACS,MAAM,CAACN,KAAK,EAAE;QACrBO,OAAO,EAAE,CAAC;QACVC,QAAQ,EAAE,IAAI;QACdC,MAAM,EAAEC,mBAAM,CAACC,GAAG,CAACD,mBAAM,CAACE,IAAI,CAAC;QAC/BC,eAAe,EAAE;MACnB,CAAC,CAAC,EACF;QAAEC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O,CAACU;MACnB,CAAE;MAAApC,QAAA,eAEF,IAAApE,WAAA,CAAAqE,GAAA,EAACvE,YAAA,CAAAoG,IAAI;QACHxF,KAAK,EAAE;UACLyF,QAAQ,EAAE,EAAE;UACZM,UAAU,EAAE,EAAE;UACdL,UAAU,EAAE,KAAK;UACjBJ,KAAK,EAAEtC,OAAO;UACdgD,WAAW,EAAE,CAAC,cAAc;QAC9B,CAAE;QAAAtC,QAAA,EAEDlE,UAAU,CAACC,MAAM;MAAC,CACf;IAAC,CACH,CACP;EAAA,CACY,CAAC;AAEpB","ignoreList":[]}
|
|
@@ -7,39 +7,57 @@ exports.SupportButton = SupportButton;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _api = require("../api");
|
|
10
|
+
var _i18n = require("../i18n");
|
|
11
|
+
var _languages = require("../i18n/languages");
|
|
10
12
|
var _push = require("../push");
|
|
13
|
+
var _review = require("../review");
|
|
11
14
|
var _theme = require("../theme");
|
|
12
15
|
var _useSupportThreads = require("../useSupportThreads");
|
|
13
16
|
var _utils = require("../utils");
|
|
14
17
|
var _BottomSheet = require("./BottomSheet");
|
|
15
18
|
var _LauncherButton = require("./LauncherButton");
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var _ThreadScreen = require("./screens/ThreadScreen");
|
|
19
|
+
var _ChatScreen = require("./screens/ChatScreen");
|
|
20
|
+
var _LanguageScreen = require("./screens/LanguageScreen");
|
|
19
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
22
|
/**
|
|
21
23
|
* The single entry point of the SDK: a launcher with an unread badge that
|
|
22
|
-
* opens the support bottom sheet.
|
|
23
|
-
* handled by useSupportThreads.
|
|
24
|
+
* opens the support chat in a bottom sheet. Conversations, polling, and read
|
|
25
|
+
* receipts are handled by useSupportThreads.
|
|
24
26
|
*/
|
|
25
27
|
function SupportButton(props) {
|
|
26
28
|
const validationError = (0, _utils.validateProps)(props);
|
|
27
|
-
|
|
29
|
+
|
|
30
|
+
// "system" (the default) follows the host app's appearance and re-renders
|
|
31
|
+
// when it changes.
|
|
32
|
+
const colorScheme = (0, _reactNative.useColorScheme)();
|
|
33
|
+
const themeName = props.theme === 'light' || props.theme === 'dark' ? props.theme : colorScheme === 'dark' ? 'dark' : 'light';
|
|
34
|
+
// Picked down to one string first, so an inline `{ light, dark }` object
|
|
35
|
+
// doesn't rebuild the theme on every render.
|
|
36
|
+
const perModeAccent = typeof props.accentColor === 'object' && props.accentColor !== null;
|
|
37
|
+
const accent = perModeAccent ? props.accentColor[themeName] : props.accentColor;
|
|
38
|
+
const theme = (0, _react.useMemo)(() => (0, _theme.themeFor)(themeName, accent, !perModeAccent), [themeName, accent, perModeAccent]);
|
|
28
39
|
const config = (0, _react.useMemo)(() => ({
|
|
29
40
|
supabaseUrl: props.supabaseUrl,
|
|
30
41
|
apiKey: props.apiKey,
|
|
31
42
|
appName: props.appName
|
|
32
43
|
}), [props.supabaseUrl, props.apiKey, props.appName]);
|
|
33
44
|
const [sheetOpen, setSheetOpen] = (0, _react.useState)(false);
|
|
34
|
-
const [screen, setScreen] = (0, _react.useState)(
|
|
35
|
-
|
|
36
|
-
|
|
45
|
+
const [screen, setScreen] = (0, _react.useState)('chat');
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* What the user picked, once they have picked. Until then the sheet is
|
|
49
|
+
* rendered in the host app's hint or the device's language, which is a
|
|
50
|
+
* guess — hence `chosen`, which is what decides whether to ask.
|
|
51
|
+
*/
|
|
52
|
+
const [chosen, setChosen] = (0, _react.useState)(null);
|
|
37
53
|
const {
|
|
38
54
|
threads,
|
|
39
55
|
totalUnread,
|
|
40
56
|
loading,
|
|
41
|
-
|
|
42
|
-
|
|
57
|
+
errorKey,
|
|
58
|
+
serverLanguage,
|
|
59
|
+
languageLoaded,
|
|
60
|
+
store,
|
|
43
61
|
refresh,
|
|
44
62
|
reload
|
|
45
63
|
} = (0, _useSupportThreads.useSupportThreads)({
|
|
@@ -47,9 +65,31 @@ function SupportButton(props) {
|
|
|
47
65
|
revenuecatId: props.user.revenuecatId,
|
|
48
66
|
enabled: validationError === null,
|
|
49
67
|
sheetOpen,
|
|
50
|
-
|
|
68
|
+
// Not while the first-run language prompt covers it: nothing behind
|
|
69
|
+
// the prompt has been seen, so nothing may be marked read.
|
|
70
|
+
chatVisible: sheetOpen && screen === 'chat' && chosen !== null,
|
|
51
71
|
idlePollMs: props.pollIntervalMs ?? _useSupportThreads.IDLE_POLL_MS
|
|
52
72
|
});
|
|
73
|
+
const [draftLanguage, setDraftLanguage] = (0, _react.useState)(null);
|
|
74
|
+
const [savingLanguage, setSavingLanguage] = (0, _react.useState)(false);
|
|
75
|
+
const [languageError, setLanguageError] = (0, _react.useState)(null);
|
|
76
|
+
|
|
77
|
+
// A preference saved on another device (or an earlier install) wins over
|
|
78
|
+
// any local guess, and answers the "have they chosen?" question for free.
|
|
79
|
+
(0, _react.useEffect)(() => {
|
|
80
|
+
const stored = (0, _languages.asLanguage)(serverLanguage);
|
|
81
|
+
if (stored !== null) setChosen(stored);
|
|
82
|
+
}, [serverLanguage]);
|
|
83
|
+
const fallbackLanguage = props.defaultLanguage ?? (0, _languages.deviceLanguage)() ?? _languages.DEFAULT_LANGUAGE;
|
|
84
|
+
const language = chosen ?? fallbackLanguage;
|
|
85
|
+
const strings = (0, _react.useMemo)(() => (0, _i18n.createTranslator)(draftLanguage ?? language), [draftLanguage, language]);
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Ask once, on first open — but only once the server has told us whether
|
|
89
|
+
* this user already answered. Asking before then would show the picker to
|
|
90
|
+
* someone who chose months ago on another device.
|
|
91
|
+
*/
|
|
92
|
+
const mustChooseLanguage = languageLoaded && chosen === null;
|
|
53
93
|
|
|
54
94
|
/**
|
|
55
95
|
* Asks for notification permission the moment the sheet opens, then
|
|
@@ -71,10 +111,60 @@ function SupportButton(props) {
|
|
|
71
111
|
// Push is an enhancement — never surfaced to the user as an error.
|
|
72
112
|
}
|
|
73
113
|
}, [config, props.user.revenuecatId, props.expoProjectId, validationError]);
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
114
|
+
const {
|
|
115
|
+
name: userName,
|
|
116
|
+
revenuecatId,
|
|
117
|
+
appVersion
|
|
118
|
+
} = props.user;
|
|
119
|
+
const plan = (0, _utils.userPlan)(props.user);
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Reports the user on load, and whenever who they are changes, so the team
|
|
123
|
+
* can find and message them before they ever open support. Refreshes the
|
|
124
|
+
* push token too when permission was already granted — never prompting:
|
|
125
|
+
* the OS prompt only appears once the user opens support.
|
|
126
|
+
*/
|
|
127
|
+
(0, _react.useEffect)(() => {
|
|
128
|
+
if (validationError !== null) return;
|
|
129
|
+
(0, _api.registerUser)(config, {
|
|
130
|
+
revenuecatId,
|
|
131
|
+
user: {
|
|
132
|
+
name: userName,
|
|
133
|
+
plan,
|
|
134
|
+
appVersion,
|
|
135
|
+
platform: (0, _review.storePlatform)()
|
|
136
|
+
}
|
|
137
|
+
}).catch(() => {
|
|
138
|
+
// Best effort; the next load reports again.
|
|
139
|
+
});
|
|
140
|
+
if (!_push.isPushAvailable) return;
|
|
141
|
+
void (async () => {
|
|
142
|
+
const registration = await (0, _push.ensurePushPermission)(props.expoProjectId, {
|
|
143
|
+
prompt: false
|
|
144
|
+
});
|
|
145
|
+
if (registration.status !== 'granted') return;
|
|
146
|
+
await (0, _api.registerPush)(config, {
|
|
147
|
+
revenuecatId,
|
|
148
|
+
permissionStatus: registration.status,
|
|
149
|
+
expoPushToken: registration.token,
|
|
150
|
+
asked: false
|
|
151
|
+
});
|
|
152
|
+
})().catch(() => {});
|
|
153
|
+
}, [config, validationError, revenuecatId, userName, plan, appVersion, props.expoProjectId]);
|
|
154
|
+
|
|
155
|
+
// A tapped support-reply notification opens the chat. If the threads
|
|
156
|
+
// haven't loaded yet (cold start), it fills in as soon as they do.
|
|
157
|
+
(0, _react.useEffect)(() => {
|
|
158
|
+
if (validationError !== null) return;
|
|
159
|
+
return (0, _push.onSupportNotificationTap)(() => {
|
|
160
|
+
setDraftLanguage(null);
|
|
161
|
+
setLanguageError(null);
|
|
162
|
+
setScreen('chat');
|
|
163
|
+
setSheetOpen(true);
|
|
77
164
|
});
|
|
165
|
+
}, [validationError]);
|
|
166
|
+
function openSheet() {
|
|
167
|
+
setScreen('chat');
|
|
78
168
|
setSheetOpen(true);
|
|
79
169
|
// The OS prompt appears right as the sheet opens; if the user declines,
|
|
80
170
|
// everything below carries on exactly as before.
|
|
@@ -82,9 +172,9 @@ function SupportButton(props) {
|
|
|
82
172
|
}
|
|
83
173
|
function closeSheet() {
|
|
84
174
|
setSheetOpen(false);
|
|
85
|
-
setScreen(
|
|
86
|
-
|
|
87
|
-
|
|
175
|
+
setScreen('chat');
|
|
176
|
+
setDraftLanguage(null);
|
|
177
|
+
setLanguageError(null);
|
|
88
178
|
}
|
|
89
179
|
if (validationError !== null) {
|
|
90
180
|
// Dev-mode: loud and actionable. Production: render nothing rather than
|
|
@@ -111,33 +201,52 @@ function SupportButton(props) {
|
|
|
111
201
|
}
|
|
112
202
|
function writeErrorMessage(e) {
|
|
113
203
|
if (e instanceof _api.SupportApiError) {
|
|
114
|
-
if (e.status === 429) return '
|
|
115
|
-
if (e.offline) return
|
|
204
|
+
if (e.status === 429) return strings.t('error.rateLimited');
|
|
205
|
+
if (e.offline) return strings.t('error.offline');
|
|
116
206
|
}
|
|
117
|
-
return
|
|
207
|
+
return strings.t('error.sendFailed');
|
|
118
208
|
}
|
|
119
|
-
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Persists the picked language and leaves the picker.
|
|
212
|
+
*
|
|
213
|
+
* A failed save keeps the user on the screen with a retry: getting this
|
|
214
|
+
* wrong means every message they write is translated from the wrong
|
|
215
|
+
* language, which is worse than one more tap.
|
|
216
|
+
*/
|
|
217
|
+
async function confirmLanguage() {
|
|
218
|
+
const next = draftLanguage ?? language;
|
|
219
|
+
setSavingLanguage(true);
|
|
220
|
+
setLanguageError(null);
|
|
120
221
|
try {
|
|
121
|
-
await (0, _api.
|
|
122
|
-
queryType: type,
|
|
123
|
-
message,
|
|
124
|
-
userName: props.user.name,
|
|
125
|
-
isPaid: props.user.isPaid,
|
|
222
|
+
await (0, _api.setLanguage)(config, {
|
|
126
223
|
revenuecatId: props.user.revenuecatId,
|
|
127
|
-
|
|
224
|
+
language: next
|
|
128
225
|
});
|
|
226
|
+
setChosen(next);
|
|
227
|
+
setDraftLanguage(null);
|
|
228
|
+
setScreen('chat');
|
|
229
|
+
// On a change, the server re-queues existing replies for translation
|
|
230
|
+
// into the new language; they arrive over the next poll or two.
|
|
129
231
|
void reload();
|
|
130
|
-
return null;
|
|
131
232
|
} catch (e) {
|
|
132
|
-
|
|
233
|
+
setLanguageError(e instanceof _api.SupportApiError && e.offline ? strings.t('error.offline') : strings.t('lang.saveFailed'));
|
|
234
|
+
} finally {
|
|
235
|
+
setSavingLanguage(false);
|
|
133
236
|
}
|
|
134
237
|
}
|
|
135
|
-
async function handleSend(
|
|
238
|
+
async function handleSend(message) {
|
|
136
239
|
try {
|
|
137
|
-
await (0, _api.
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
240
|
+
await (0, _api.sendMessage)(config, {
|
|
241
|
+
revenuecatId,
|
|
242
|
+
message,
|
|
243
|
+
language,
|
|
244
|
+
user: {
|
|
245
|
+
name: userName,
|
|
246
|
+
plan,
|
|
247
|
+
appVersion,
|
|
248
|
+
platform: (0, _review.storePlatform)()
|
|
249
|
+
}
|
|
141
250
|
});
|
|
142
251
|
await reload();
|
|
143
252
|
return null;
|
|
@@ -145,23 +254,37 @@ function SupportButton(props) {
|
|
|
145
254
|
return writeErrorMessage(e);
|
|
146
255
|
}
|
|
147
256
|
}
|
|
148
|
-
const
|
|
149
|
-
const
|
|
257
|
+
const reviewLinks = (0, _review.storeLinks)(store);
|
|
258
|
+
const reviewLabel = reviewLinks === null ? null : strings.t(_reactNative.Platform.OS === 'ios' ? 'review.appStore' : 'review.playStore');
|
|
259
|
+
|
|
260
|
+
/** Opens the store's review page and lets the team know it was tapped. */
|
|
261
|
+
function openReview(messageId) {
|
|
262
|
+
if (reviewLinks === null) return;
|
|
263
|
+
void (0, _review.openStoreReview)(reviewLinks);
|
|
264
|
+
(0, _api.reviewOpened)(config, {
|
|
265
|
+
revenuecatId,
|
|
266
|
+
messageId
|
|
267
|
+
}).catch(() => {
|
|
268
|
+
// The receipt is for the dashboard; the user already has the store.
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
const languagePicker = /*#__PURE__*/(0, _jsxRuntime.jsx)(_LanguageScreen.LanguageScreen, {
|
|
150
272
|
theme: theme,
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
273
|
+
strings: strings,
|
|
274
|
+
selected: draftLanguage ?? language,
|
|
275
|
+
onSelect: setDraftLanguage,
|
|
276
|
+
onConfirm: () => void confirmLanguage()
|
|
277
|
+
// No way back on first run: there is nothing behind it yet, so the
|
|
278
|
+
// only exit is choosing — or closing the sheet, which asks again.
|
|
279
|
+
,
|
|
280
|
+
onBack: mustChooseLanguage ? undefined : () => {
|
|
281
|
+
setDraftLanguage(null);
|
|
282
|
+
setLanguageError(null);
|
|
283
|
+
setScreen('chat');
|
|
284
|
+
},
|
|
285
|
+
onDismiss: mustChooseLanguage ? closeSheet : undefined,
|
|
286
|
+
saving: savingLanguage,
|
|
287
|
+
error: languageError
|
|
165
288
|
});
|
|
166
289
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
167
290
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_LauncherButton.LauncherButton, {
|
|
@@ -172,25 +295,28 @@ function SupportButton(props) {
|
|
|
172
295
|
label: props.label,
|
|
173
296
|
style: props.style,
|
|
174
297
|
onPress: openSheet
|
|
175
|
-
}), /*#__PURE__*/(0, _jsxRuntime.
|
|
298
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_BottomSheet.BottomSheet, {
|
|
176
299
|
visible: sheetOpen,
|
|
177
300
|
onClose: closeSheet,
|
|
178
301
|
theme: theme,
|
|
179
|
-
children:
|
|
302
|
+
children: mustChooseLanguage || screen === 'language' ? languagePicker : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChatScreen.ChatScreen, {
|
|
180
303
|
theme: theme,
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
304
|
+
strings: strings,
|
|
305
|
+
language: language,
|
|
306
|
+
threads: threads,
|
|
307
|
+
loading: loading,
|
|
308
|
+
error: errorKey === null ? null : strings.t(errorKey),
|
|
309
|
+
onRetry: refresh,
|
|
310
|
+
onSend: handleSend,
|
|
311
|
+
onChangeLanguage: () => {
|
|
312
|
+
setDraftLanguage(language);
|
|
313
|
+
setLanguageError(null);
|
|
314
|
+
setScreen('language');
|
|
315
|
+
},
|
|
316
|
+
onClose: closeSheet,
|
|
317
|
+
reviewLabel: reviewLabel,
|
|
318
|
+
onOpenReview: openReview
|
|
319
|
+
})
|
|
194
320
|
})]
|
|
195
321
|
});
|
|
196
322
|
}
|