@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["zh"],"sourceRoot":"../../../../src","sources":["i18n/strings/zh.ts"],"mappings":";;AAEA,OAAO,MAAMA,EAAe,GAAG;EAC7B,YAAY,EAAE,MAAM;EACpB,eAAe,EAAE,sBAAsB;EACvC,YAAY,EAAE,MAAM;EACpB,WAAW,EAAE,KAAK;EAClB,eAAe,EAAE,KAAK;EACtB,YAAY,EAAE,OAAO;EACrB,gBAAgB,EAAE,6BAA6B;EAC/C,iBAAiB,EAAE,OAAO;EAC1B,UAAU,EAAE,GAAG;EACf,iBAAiB,EAAE,WAAW;EAC9B,uBAAuB,EAAE,uBAAuB;EAChD,cAAc,EAAE,WAAW;EAC3B,eAAe,EAAE,IAAI;EAErB,eAAe,EAAE,IAAI;EACrB,sBAAsB,EAAE,MAAM;EAC9B,iBAAiB,EAAE,MAAM;EACzB,eAAe,EAAE,UAAU;EAC3B,sBAAsB,EAAE,UAAU;EAClC,iBAAiB,EAAE,WAAW;EAC9B,iBAAiB,EAAE,aAAa;EAChC,wBAAwB,EAAE,UAAU;EACpC,mBAAmB,EAAE,kBAAkB;EACvC,cAAc,EAAE,eAAe;EAC/B,qBAAqB,EAAE,aAAa;EACpC,gBAAgB,EAAE,sBAAsB;EAExC,cAAc,EAAE,QAAQ;EACxB,cAAc,EAAE,KAAK;EACrB,kBAAkB,EAChB,qCAAqC;EACvC,cAAc,EAAE,IAAI;EACpB,cAAc,EAAE,IAAI;EACpB,iBAAiB,EAAE,MAAM;EACzB,kBAAkB,EAAE,kBAAkB;EAEtC,gBAAgB,EAAE,MAAM;EACxB,YAAY,EAAE,KAAK;EACnB,mBAAmB,EAAE,cAAc;EACnC,iBAAiB,EAAE,aAAa;EAChC,oBAAoB,EAAE,OAAO;EAC7B,kBAAkB,EAAE,OAAO;EAC3B,iBAAiB,EAAE,gBAAgB;EACnC,kBAAkB,EAAE,kBAAkB;EACtC,iBAAiB,EAAE,MAAM;EACzB,oBAAoB,EAAE,KAAK;EAC3B,oBAAoB,EAAE,MAAM;EAE5B,aAAa,EAAE,KAAK;EACpB,iBAAiB,EAAE,KAAK;EAExB,gBAAgB,EAAE,IAAI;EACtB,mBAAmB,EAAE,iBAAiB;EACtC,eAAe,EAAE,iBAAiB;EAClC,kBAAkB,EAAE,aAAa;EACjC,kBAAkB,EAAE,UAAU;EAC9B,mBAAmB,EAAE,WAAW;EAChC,uBAAuB,EAAE,mBAAmB;EAE5C,YAAY,EAAE,QAAQ;EACtB,eAAe,EAAE,8BAA8B;EAC/C,eAAe,EAAE,IAAI;EACrB,aAAa,EAAE,MAAM;EACrB,iBAAiB,EAAE,aAAa;EAEhC,cAAc,EAAE,IAAI;EACpB,cAAc,EAAE,aAAa;EAC7B,YAAY,EAAE,aAAa;EAC3B,WAAW,EAAE,YAAY;EACzB,YAAY,EAAE,YAAY;EAC1B,aAAa,EAAE,aAAa;EAC5B,YAAY,EAAE,YAAY;EAC1B,YAAY,EAAE,IAAI;EAClB,gBAAgB,EAAE;AACpB,CAAC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
export { SupportButton } from './components/SupportButton';
|
|
4
4
|
export { supportDarkTheme, supportLightTheme, resolveTheme } from './theme';
|
|
5
5
|
export { SupportApiError } from './api';
|
|
6
|
+
export { SDK_VERSION } from './version';
|
|
6
7
|
export { isPushAvailable } from './push';
|
|
8
|
+
export { DEFAULT_LANGUAGE, deviceLanguage, isSupportedLanguage, LANGUAGE_LABELS, SUPPORTED_LANGUAGES } from './i18n/languages';
|
|
7
9
|
export { QUERY_TYPE_LABEL, USER_MESSAGE_MAX, USER_MESSAGE_MIN } from './types';
|
|
8
10
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SupportButton","supportDarkTheme","supportLightTheme","resolveTheme","SupportApiError","isPushAvailable","QUERY_TYPE_LABEL","USER_MESSAGE_MAX","USER_MESSAGE_MIN"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,4BAA4B;AAC1D,SACEC,gBAAgB,EAChBC,iBAAiB,EACjBC,YAAY,
|
|
1
|
+
{"version":3,"names":["SupportButton","supportDarkTheme","supportLightTheme","resolveTheme","SupportApiError","SDK_VERSION","isPushAvailable","DEFAULT_LANGUAGE","deviceLanguage","isSupportedLanguage","LANGUAGE_LABELS","SUPPORTED_LANGUAGES","QUERY_TYPE_LABEL","USER_MESSAGE_MAX","USER_MESSAGE_MIN"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,4BAA4B;AAC1D,SACEC,gBAAgB,EAChBC,iBAAiB,EACjBC,YAAY,QAGP,SAAS;AAChB,SAASC,eAAe,QAAQ,OAAO;AACvC,SAASC,WAAW,QAAQ,WAAW;AACvC,SAASC,eAAe,QAAQ,QAAQ;AACxC,SACEC,gBAAgB,EAChBC,cAAc,EACdC,mBAAmB,EACnBC,eAAe,EACfC,mBAAmB,QAEd,kBAAkB;AAiBzB,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,gBAAgB,QACX,SAAS","ignoreList":[]}
|
package/lib/module/push.js
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
// badges. The status is reported purely so the dashboard can show whether
|
|
13
13
|
// the user is reachable.
|
|
14
14
|
|
|
15
|
+
/** The slice of a NotificationResponse that tap handling reads. */
|
|
16
|
+
|
|
15
17
|
/** The slice of expo-notifications this SDK uses. */
|
|
16
18
|
|
|
17
19
|
function loadNotifications() {
|
|
@@ -35,12 +37,16 @@ function normalizeStatus(status) {
|
|
|
35
37
|
|
|
36
38
|
/**
|
|
37
39
|
* Ensures notification permission has been requested, and returns the
|
|
38
|
-
* outcome plus an Expo push token when one is obtainable.
|
|
40
|
+
* outcome plus an Expo push token when one is obtainable. With
|
|
41
|
+
* `prompt: false` it only reads the current state — for refreshing the token
|
|
42
|
+
* at launch without ever showing the OS prompt outside the support sheet.
|
|
39
43
|
*
|
|
40
44
|
* Never throws: any failure resolves to an 'undetermined' registration so
|
|
41
45
|
* callers can report it and move on.
|
|
42
46
|
*/
|
|
43
|
-
export async function ensurePushPermission(expoProjectId
|
|
47
|
+
export async function ensurePushPermission(expoProjectId, {
|
|
48
|
+
prompt = true
|
|
49
|
+
} = {}) {
|
|
44
50
|
if (!notifications) {
|
|
45
51
|
return {
|
|
46
52
|
status: 'undetermined',
|
|
@@ -55,7 +61,7 @@ export async function ensurePushPermission(expoProjectId) {
|
|
|
55
61
|
|
|
56
62
|
// Only prompt when the OS will actually show something. Re-prompting a
|
|
57
63
|
// user who already decided is impossible on iOS and annoying on Android.
|
|
58
|
-
if (status === 'undetermined' && current.canAskAgain) {
|
|
64
|
+
if (prompt && status === 'undetermined' && current.canAskAgain) {
|
|
59
65
|
const requested = await notifications.requestPermissionsAsync();
|
|
60
66
|
status = normalizeStatus(requested.status);
|
|
61
67
|
asked = true;
|
|
@@ -95,4 +101,72 @@ export async function ensurePushPermission(expoProjectId) {
|
|
|
95
101
|
};
|
|
96
102
|
}
|
|
97
103
|
}
|
|
104
|
+
|
|
105
|
+
// ---------- opening the thread from a tapped notification ----------
|
|
106
|
+
//
|
|
107
|
+
// send-push tags every support reply with `{ type: 'support_reply',
|
|
108
|
+
// query_id }`. Tapping one should land the user in that thread, not wherever
|
|
109
|
+
// the host app happens to open.
|
|
110
|
+
//
|
|
111
|
+
// The observer starts when this module loads rather than when a launcher
|
|
112
|
+
// mounts, for two reasons: a cold start's tap is only reported once, early,
|
|
113
|
+
// and a host app may mount the launcher later (behind auth, on a settings
|
|
114
|
+
// screen). A tap seen before any launcher is listening is held for
|
|
115
|
+
// PENDING_TAP_TTL_MS and then dropped — opening the sheet minutes after the
|
|
116
|
+
// tap, the first time the user wanders onto that screen, would be a surprise.
|
|
117
|
+
|
|
118
|
+
const PENDING_TAP_TTL_MS = 60_000;
|
|
119
|
+
const tapListeners = [];
|
|
120
|
+
let pendingTap = null;
|
|
121
|
+
// Both the listener and getLastNotificationResponseAsync can report the same
|
|
122
|
+
// cold-start tap, and the latter keeps reporting it for the life of the
|
|
123
|
+
// process. Each tap is handled once.
|
|
124
|
+
const handledTaps = new Set();
|
|
125
|
+
function supportReplyThreadId(response) {
|
|
126
|
+
const defaultAction = notifications?.DEFAULT_ACTION_IDENTIFIER;
|
|
127
|
+
if (defaultAction && response.actionIdentifier !== defaultAction) return null;
|
|
128
|
+
const data = response.notification?.request?.content?.data;
|
|
129
|
+
if (data?.type !== 'support_reply') return null;
|
|
130
|
+
return typeof data.query_id === 'string' ? data.query_id : null;
|
|
131
|
+
}
|
|
132
|
+
function handleResponse(response) {
|
|
133
|
+
if (!response) return;
|
|
134
|
+
const threadId = supportReplyThreadId(response);
|
|
135
|
+
const tapId = response.notification?.request?.identifier;
|
|
136
|
+
if (threadId === null || !tapId || handledTaps.has(tapId)) return;
|
|
137
|
+
handledTaps.add(tapId);
|
|
138
|
+
|
|
139
|
+
// One sheet, not one per mounted launcher: the newest launcher takes it.
|
|
140
|
+
const listener = tapListeners[tapListeners.length - 1];
|
|
141
|
+
if (listener) listener(threadId);else pendingTap = {
|
|
142
|
+
threadId,
|
|
143
|
+
at: Date.now()
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
if (notifications) {
|
|
147
|
+
try {
|
|
148
|
+
notifications.addNotificationResponseReceivedListener(handleResponse);
|
|
149
|
+
notifications.getLastNotificationResponseAsync().then(handleResponse).catch(() => {});
|
|
150
|
+
} catch {
|
|
151
|
+
// Same contract as the rest of this file: push never breaks support.
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Calls `listener` with the thread id whenever the user taps a support-reply
|
|
157
|
+
* notification — including, once, a tap from the last minute that arrived
|
|
158
|
+
* before anything was listening. Returns an unsubscribe function.
|
|
159
|
+
*/
|
|
160
|
+
export function onSupportNotificationTap(listener) {
|
|
161
|
+
tapListeners.push(listener);
|
|
162
|
+
const pending = pendingTap;
|
|
163
|
+
pendingTap = null;
|
|
164
|
+
if (pending && Date.now() - pending.at < PENDING_TAP_TTL_MS) {
|
|
165
|
+
listener(pending.threadId);
|
|
166
|
+
}
|
|
167
|
+
return () => {
|
|
168
|
+
const index = tapListeners.lastIndexOf(listener);
|
|
169
|
+
if (index !== -1) tapListeners.splice(index, 1);
|
|
170
|
+
};
|
|
171
|
+
}
|
|
98
172
|
//# sourceMappingURL=push.js.map
|
package/lib/module/push.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["loadNotifications","mod","require","getPermissionsAsync","notifications","isPushAvailable","normalizeStatus","status","ensurePushPermission","expoProjectId","asked","token","current","canAskAgain","requested","requestPermissionsAsync","getExpoPushTokenAsync","projectId","undefined","data"],"sourceRoot":"../../src","sources":["push.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;;
|
|
1
|
+
{"version":3,"names":["loadNotifications","mod","require","getPermissionsAsync","notifications","isPushAvailable","normalizeStatus","status","ensurePushPermission","expoProjectId","prompt","asked","token","current","canAskAgain","requested","requestPermissionsAsync","getExpoPushTokenAsync","projectId","undefined","data","PENDING_TAP_TTL_MS","tapListeners","pendingTap","handledTaps","Set","supportReplyThreadId","response","defaultAction","DEFAULT_ACTION_IDENTIFIER","actionIdentifier","notification","request","content","type","query_id","handleResponse","threadId","tapId","identifier","has","add","listener","length","at","Date","now","addNotificationResponseReceivedListener","getLastNotificationResponseAsync","then","catch","onSupportNotificationTap","push","pending","index","lastIndexOf","splice"],"sourceRoot":"../../src","sources":["push.ts"],"m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,MAAMiB,KAAK,GAAGhC,YAAY,CAACiC,WAAW,CAACb,QAAQ,CAAC;IAChD,IAAIY,KAAK,KAAK,CAAC,CAAC,EAAEhC,YAAY,CAACkC,MAAM,CAACF,KAAK,EAAE,CAAC,CAAC;EACjD,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Review requests: a support reply with a "Rate on the App Store / Google
|
|
4
|
+
// Play" button. The button opens the store's write-a-review page — the store
|
|
5
|
+
// app where there is one, its website otherwise. It is a link, not a prompt:
|
|
6
|
+
// Apple's guidelines reserve in-app rating prompts for SKStoreReviewController,
|
|
7
|
+
// and linking to the review page is what they document for everything else.
|
|
8
|
+
|
|
9
|
+
import { Linking, Platform } from 'react-native';
|
|
10
|
+
/** Links for this device's store, or null when the team hasn't set one up. */
|
|
11
|
+
export function storeLinks(store) {
|
|
12
|
+
if (Platform.OS === 'ios' && store?.app_store_id) {
|
|
13
|
+
const id = encodeURIComponent(store.app_store_id);
|
|
14
|
+
return {
|
|
15
|
+
app: `itms-apps://apps.apple.com/app/id${id}?action=write-review`,
|
|
16
|
+
web: `https://apps.apple.com/app/id${id}?action=write-review`
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
if (Platform.OS === 'android' && store?.play_store_package) {
|
|
20
|
+
const pkg = encodeURIComponent(store.play_store_package);
|
|
21
|
+
return {
|
|
22
|
+
app: `market://details?id=${pkg}&showAllReviews=true`,
|
|
23
|
+
web: `https://play.google.com/store/apps/details?id=${pkg}&showAllReviews=true`
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Opens the review page; resolves false if neither link would open. */
|
|
30
|
+
export async function openStoreReview(links) {
|
|
31
|
+
try {
|
|
32
|
+
await Linking.openURL(links.app);
|
|
33
|
+
return true;
|
|
34
|
+
} catch {
|
|
35
|
+
try {
|
|
36
|
+
await Linking.openURL(links.web);
|
|
37
|
+
return true;
|
|
38
|
+
} catch {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** The platform the backend should know this user by, if it's a store one. */
|
|
45
|
+
export function storePlatform() {
|
|
46
|
+
return Platform.OS === 'ios' || Platform.OS === 'android' ? Platform.OS : undefined;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=review.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Linking","Platform","storeLinks","store","OS","app_store_id","id","encodeURIComponent","app","web","play_store_package","pkg","openStoreReview","links","openURL","storePlatform","undefined"],"sourceRoot":"../../src","sources":["review.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,EAAEC,QAAQ,QAAQ,cAAc;AAUhD;AACA,OAAO,SAASC,UAAUA,CAACC,KAAsC,EAAqB;EACpF,IAAIF,QAAQ,CAACG,EAAE,KAAK,KAAK,IAAID,KAAK,EAAEE,YAAY,EAAE;IAChD,MAAMC,EAAE,GAAGC,kBAAkB,CAACJ,KAAK,CAACE,YAAY,CAAC;IACjD,OAAO;MACLG,GAAG,EAAE,oCAAoCF,EAAE,sBAAsB;MACjEG,GAAG,EAAE,gCAAgCH,EAAE;IACzC,CAAC;EACH;EACA,IAAIL,QAAQ,CAACG,EAAE,KAAK,SAAS,IAAID,KAAK,EAAEO,kBAAkB,EAAE;IAC1D,MAAMC,GAAG,GAAGJ,kBAAkB,CAACJ,KAAK,CAACO,kBAAkB,CAAC;IACxD,OAAO;MACLF,GAAG,EAAE,uBAAuBG,GAAG,sBAAsB;MACrDF,GAAG,EAAE,iDAAiDE,GAAG;IAC3D,CAAC;EACH;EACA,OAAO,IAAI;AACb;;AAEA;AACA,OAAO,eAAeC,eAAeA,CAACC,KAAiB,EAAoB;EACzE,IAAI;IACF,MAAMb,OAAO,CAACc,OAAO,CAACD,KAAK,CAACL,GAAG,CAAC;IAChC,OAAO,IAAI;EACb,CAAC,CAAC,MAAM;IACN,IAAI;MACF,MAAMR,OAAO,CAACc,OAAO,CAACD,KAAK,CAACJ,GAAG,CAAC;MAChC,OAAO,IAAI;IACb,CAAC,CAAC,MAAM;MACN,OAAO,KAAK;IACd;EACF;AACF;;AAEA;AACA,OAAO,SAASM,aAAaA,CAAA,EAAkC;EAC7D,OAAOd,QAAQ,CAACG,EAAE,KAAK,KAAK,IAAIH,QAAQ,CAACG,EAAE,KAAK,SAAS,GAAGH,QAAQ,CAACG,EAAE,GAAGY,SAAS;AACrF","ignoreList":[]}
|
package/lib/module/theme.js
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
// The SDK consumes the same design tokens as the admin dashboard, so both
|
|
4
4
|
// surfaces look like one product. On top of those it adds the few values
|
|
5
|
-
// that only exist on mobile: sheet/bubble radii
|
|
6
|
-
//
|
|
5
|
+
// that only exist on mobile: sheet/bubble radii, the elevation used by the
|
|
6
|
+
// launcher and the sheet (the web side gets those from CSS), and a re-cut of
|
|
7
|
+
// the surfaces and text ramp for a sheet held at arm's length (see
|
|
8
|
+
// SHEET_OVERRIDES).
|
|
7
9
|
import { darkColors, lightColors, motion, radii, spacing } from '@appsupportkit/design-tokens';
|
|
8
10
|
/** Rounder than the dashboard: touch targets read better with more radius. */
|
|
9
11
|
export const supportRadii = {
|
|
@@ -30,7 +32,12 @@ export const supportRadii = {
|
|
|
30
32
|
// Color helpers come first: the themes below are built at module load, so
|
|
31
33
|
// anything they reach for has to already be initialized. (A `const` used
|
|
32
34
|
// before its definition survives tsc but lands as `undefined` on Hermes.)
|
|
35
|
+
|
|
33
36
|
const HEX = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
37
|
+
const WHITE = [255, 255, 255];
|
|
38
|
+
/** Foreground for light accents — the dashboard's near-black, not pure black. */
|
|
39
|
+
const INK = '#111113';
|
|
40
|
+
const INK_RGB = [17, 17, 19];
|
|
34
41
|
function parseHex(color) {
|
|
35
42
|
const match = HEX.exec(color.trim());
|
|
36
43
|
const digits = match?.[1];
|
|
@@ -38,10 +45,83 @@ function parseHex(color) {
|
|
|
38
45
|
const hex = digits.length === 3 ? digits.split('').map(c => c + c).join('') : digits;
|
|
39
46
|
return [parseInt(hex.slice(0, 2), 16), parseInt(hex.slice(2, 4), 16), parseInt(hex.slice(4, 6), 16)];
|
|
40
47
|
}
|
|
41
|
-
function
|
|
48
|
+
function toHex(rgb) {
|
|
49
|
+
return `#${rgb.map(c => c.toString(16).padStart(2, '0')).join('').toUpperCase()}`;
|
|
50
|
+
}
|
|
51
|
+
function mixRgb([r, g, b], target, amount) {
|
|
42
52
|
const channel = c => Math.round(c + (target - c) * amount);
|
|
43
|
-
return
|
|
53
|
+
return [channel(r), channel(g), channel(b)];
|
|
54
|
+
}
|
|
55
|
+
function mix(rgb, target, amount) {
|
|
56
|
+
return toHex(mixRgb(rgb, target, amount));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** WCAG relative luminance. */
|
|
60
|
+
function luminance(rgb) {
|
|
61
|
+
const [r, g, b] = rgb.map(c => {
|
|
62
|
+
const s = c / 255;
|
|
63
|
+
return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
|
|
64
|
+
});
|
|
65
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** WCAG contrast ratio, 1–21. */
|
|
69
|
+
function contrast(a, b) {
|
|
70
|
+
const [hi, lo] = [luminance(a), luminance(b)].sort((x, y) => y - x);
|
|
71
|
+
return (hi + 0.05) / (lo + 0.05);
|
|
44
72
|
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Nudges `color` toward white (dark theme) or black (light theme) in 5%
|
|
76
|
+
* steps until it reaches `ratio` against every background. The smallest
|
|
77
|
+
* step that works wins, so a brand color stays recognizably itself.
|
|
78
|
+
*/
|
|
79
|
+
function legible(color, backgrounds, ratio, name) {
|
|
80
|
+
const rgb = parseHex(color);
|
|
81
|
+
if (rgb === null) return color;
|
|
82
|
+
const against = backgrounds.map(parseHex).filter(c => c !== null);
|
|
83
|
+
const target = name === 'dark' ? 255 : 0;
|
|
84
|
+
for (let step = 0; step <= 20; step += 1) {
|
|
85
|
+
const candidate = mixRgb(rgb, target, step * 0.05);
|
|
86
|
+
if (against.every(bg => contrast(candidate, bg) >= ratio)) {
|
|
87
|
+
return toHex(candidate);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return name === 'dark' ? '#FFFFFF' : '#000000';
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Where the SDK departs from the dashboard tokens.
|
|
95
|
+
*
|
|
96
|
+
* Dark: the sheet floats over the host app, so it takes an elevated gray the
|
|
97
|
+
* way iOS sheets do, and the cards and bubbles on it step lighter again. On
|
|
98
|
+
* the dashboard's near-black base, cards sat 1.05:1 from the background and
|
|
99
|
+
* the layering disappeared.
|
|
100
|
+
*
|
|
101
|
+
* Both: the text ramp is re-cut so every step clears WCAG AA (4.5:1) on the
|
|
102
|
+
* sheet and on the cards over it. Tertiary carries timestamps and labels at
|
|
103
|
+
* 11–12px and was 3.1:1 (dark) and 2.5:1 (light); secondary moves too, so
|
|
104
|
+
* the two stay a visible step apart.
|
|
105
|
+
*/
|
|
106
|
+
const SHEET_OVERRIDES = {
|
|
107
|
+
dark: {
|
|
108
|
+
sheet: '#161618',
|
|
109
|
+
surface: '#1F1F23',
|
|
110
|
+
surfaceHover: '#26262B',
|
|
111
|
+
surfaceActive: '#2D2D33',
|
|
112
|
+
border: '#2E2E35',
|
|
113
|
+
borderStrong: '#3C3C44',
|
|
114
|
+
textSecondary: '#A3A3AB',
|
|
115
|
+
// 6.5:1 on surface
|
|
116
|
+
textTertiary: '#87878F' // 4.6:1 on surface, 5.1:1 on sheet
|
|
117
|
+
},
|
|
118
|
+
light: {
|
|
119
|
+
sheet: lightColors.bg,
|
|
120
|
+
textSecondary: '#5A5A62',
|
|
121
|
+
// 6.5:1 on sheet
|
|
122
|
+
textTertiary: '#717179' // 4.6:1 on sheet, 4.8:1 on surface
|
|
123
|
+
}
|
|
124
|
+
};
|
|
45
125
|
function shadowsFor(name, accent) {
|
|
46
126
|
const dark = name === 'dark';
|
|
47
127
|
return {
|
|
@@ -88,7 +168,21 @@ function launcherFor(name, accent) {
|
|
|
88
168
|
minimalMark: name === 'dark' && rgb !== null ? mix(rgb, 255, 0.35) : accent
|
|
89
169
|
};
|
|
90
170
|
}
|
|
91
|
-
function buildTheme(name,
|
|
171
|
+
function buildTheme(name, tokens) {
|
|
172
|
+
const base = {
|
|
173
|
+
...tokens,
|
|
174
|
+
...SHEET_OVERRIDES[name]
|
|
175
|
+
};
|
|
176
|
+
// Status tones double as 12px labels, so they get the text bar too.
|
|
177
|
+
const onSheet = [base.sheet, base.surface];
|
|
178
|
+
const colors = {
|
|
179
|
+
...base,
|
|
180
|
+
statusOpen: legible(base.statusOpen, onSheet, 4.5, name),
|
|
181
|
+
statusProgress: legible(base.statusProgress, onSheet, 4.5, name),
|
|
182
|
+
statusResolved: legible(base.statusResolved, onSheet, 4.5, name),
|
|
183
|
+
statusDanger: legible(base.statusDanger, onSheet, 4.5, name),
|
|
184
|
+
accentText: legible(base.accent, onSheet, 4.5, name)
|
|
185
|
+
};
|
|
92
186
|
return {
|
|
93
187
|
name,
|
|
94
188
|
colors,
|
|
@@ -104,39 +198,63 @@ export const supportLightTheme = buildTheme('light', lightColors);
|
|
|
104
198
|
|
|
105
199
|
/**
|
|
106
200
|
* Derives the accent family from a single brand color: a pressed shade, the
|
|
107
|
-
* 12% wash used behind chips
|
|
108
|
-
*
|
|
201
|
+
* 12% wash used behind chips, a text-safe variant, and whichever of white or
|
|
202
|
+
* ink reads better on top of it.
|
|
203
|
+
*
|
|
204
|
+
* `adapt` is for a color that has to serve both themes: it is lifted just
|
|
205
|
+
* far enough to read as a fill (3:1, the WCAG bar for UI components) on this
|
|
206
|
+
* theme's sheet — a navy brand would otherwise vanish in dark mode. A color
|
|
207
|
+
* given for this mode specifically is used as is.
|
|
109
208
|
*/
|
|
110
|
-
function withAccent(theme, accent) {
|
|
111
|
-
|
|
112
|
-
|
|
209
|
+
function withAccent(theme, accent, adapt) {
|
|
210
|
+
if (parseHex(accent) === null) return theme;
|
|
211
|
+
const {
|
|
212
|
+
name
|
|
213
|
+
} = theme;
|
|
214
|
+
const fill = adapt ? legible(accent, [theme.colors.sheet], 3, name) : toHex(parseHex(accent));
|
|
215
|
+
const rgb = parseHex(fill);
|
|
113
216
|
const [r, g, b] = rgb;
|
|
114
|
-
|
|
115
|
-
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
217
|
+
const accentText = legible(fill, [theme.colors.sheet, theme.colors.surface], 4.5, name);
|
|
116
218
|
const colors = {
|
|
117
219
|
...theme.colors,
|
|
118
|
-
accent,
|
|
119
|
-
accentHover: mix(rgb,
|
|
220
|
+
accent: fill,
|
|
221
|
+
accentHover: mix(rgb, name === 'dark' ? 255 : 0, 0.12),
|
|
120
222
|
accentMuted: `rgba(${r}, ${g}, ${b}, 0.12)`,
|
|
121
|
-
accentForeground:
|
|
122
|
-
|
|
223
|
+
accentForeground: contrast(rgb, WHITE) >= contrast(rgb, INK_RGB) ? '#FFFFFF' : INK,
|
|
224
|
+
accentText,
|
|
225
|
+
statusOpen: accentText,
|
|
123
226
|
statusOpenBg: `rgba(${r}, ${g}, ${b}, 0.10)`,
|
|
124
|
-
focusRing:
|
|
227
|
+
focusRing: fill
|
|
125
228
|
};
|
|
126
229
|
return {
|
|
127
230
|
...theme,
|
|
128
231
|
colors,
|
|
129
|
-
shadows: shadowsFor(
|
|
130
|
-
launcher: launcherFor(
|
|
232
|
+
shadows: shadowsFor(name, fill),
|
|
233
|
+
launcher: launcherFor(name, fill)
|
|
131
234
|
};
|
|
132
235
|
}
|
|
133
236
|
|
|
134
237
|
/**
|
|
135
|
-
*
|
|
136
|
-
*
|
|
238
|
+
* The theme for one resolved mode. `accent` is the color for this mode
|
|
239
|
+
* (already picked from a light/dark pair), and `adapt` says whether it was a
|
|
240
|
+
* single color that has to be made to work here.
|
|
137
241
|
*/
|
|
138
|
-
export function
|
|
242
|
+
export function themeFor(name, accent, adapt) {
|
|
139
243
|
const base = name === 'light' ? supportLightTheme : supportDarkTheme;
|
|
140
|
-
return
|
|
244
|
+
return accent ? withAccent(base, accent, adapt) : base;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* @param name "light" | "dark" (default dark). SupportButton resolves its
|
|
249
|
+
* "system" default before calling this.
|
|
250
|
+
* @param accentColor Optional brand color: one hex for both modes (adjusted
|
|
251
|
+
* per mode where needed), or a `{ light, dark }` pair used as given.
|
|
252
|
+
*/
|
|
253
|
+
export function resolveTheme(name, accentColor) {
|
|
254
|
+
const mode = name === 'light' ? 'light' : 'dark';
|
|
255
|
+
if (typeof accentColor === 'object' && accentColor !== null) {
|
|
256
|
+
return themeFor(mode, accentColor[mode], false);
|
|
257
|
+
}
|
|
258
|
+
return themeFor(mode, accentColor, true);
|
|
141
259
|
}
|
|
142
260
|
//# sourceMappingURL=theme.js.map
|
package/lib/module/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["darkColors","lightColors","motion","radii","spacing","supportRadii","control","card","cardLg","bubble","bubbleTail","sheet","pill","HEX","parseHex","color","match","exec","trim","digits","undefined","hex","length","split","map","c","join","parseInt","slice","
|
|
1
|
+
{"version":3,"names":["darkColors","lightColors","motion","radii","spacing","supportRadii","control","card","cardLg","bubble","bubbleTail","sheet","pill","HEX","WHITE","INK","INK_RGB","parseHex","color","match","exec","trim","digits","undefined","hex","length","split","map","c","join","parseInt","slice","toHex","rgb","toString","padStart","toUpperCase","mixRgb","r","g","b","target","amount","channel","Math","round","mix","luminance","s","contrast","a","hi","lo","sort","x","y","legible","backgrounds","ratio","name","against","filter","step","candidate","every","bg","SHEET_OVERRIDES","dark","surface","surfaceHover","surfaceActive","border","borderStrong","textSecondary","textTertiary","light","shadowsFor","accent","launcher","shadowColor","shadowOpacity","shadowRadius","shadowOffset","width","height","elevation","badge","launcherFor","solidRing","minimalMark","buildTheme","tokens","base","onSheet","colors","statusOpen","statusProgress","statusResolved","statusDanger","accentText","shadows","supportDarkTheme","supportLightTheme","withAccent","theme","adapt","fill","accentHover","accentMuted","accentForeground","statusOpenBg","focusRing","themeFor","resolveTheme","accentColor","mode"],"sourceRoot":"../../src","sources":["theme.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA,SACEA,UAAU,EACVC,WAAW,EACXC,MAAM,EACNC,KAAK,EACLC,OAAO,QAEF,8BAA8B;AAIrC;AACA,OAAO,MAAMC,YAAY,GAAG;EAC1B,GAAGF,KAAK;EACRG,OAAO,EAAE,EAAE;EACXC,IAAI,EAAE,EAAE;EACRC,MAAM,EAAE,EAAE;EACV;EACAC,MAAM,EAAE,EAAE;EACV;EACAC,UAAU,EAAE,CAAC;EACbC,KAAK,EAAE,EAAE;EACTC,IAAI,EAAE;AACR,CAAU;;AAsBV;AACA;AACA;AACA;AACA;AACA;AACA;;AAkBA;AACA;AACA;;AAGA,MAAMC,GAAG,GAAG,gCAAgC;AAC5C,MAAMC,KAAU,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;AAClC;AACA,MAAMC,GAAG,GAAG,SAAS;AACrB,MAAMC,OAAY,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;AAEjC,SAASC,QAAQA,CAACC,KAAa,EAAc;EAC3C,MAAMC,KAAK,GAAGN,GAAG,CAACO,IAAI,CAACF,KAAK,CAACG,IAAI,CAAC,CAAC,CAAC;EACpC,MAAMC,MAAM,GAAGH,KAAK,GAAG,CAAC,CAAC;EACzB,IAAIG,MAAM,KAAKC,SAAS,EAAE,OAAO,IAAI;EACrC,MAAMC,GAAG,GACPF,MAAM,CAACG,MAAM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,WAAyB,EACX;EACd,MAAMC,IAAe,GAAGxD,IAAI,KAAK,OAAO,GAAG,OAAO,GAAG,MAAM;EAC3D,IAAI,OAAOuD,WAAW,KAAK,QAAQ,IAAIA,WAAW,KAAK,IAAI,EAAE;IAC3D,OAAOF,QAAQ,CAACG,IAAI,EAAED,WAAW,CAACC,IAAI,CAAC,EAAE,KAAK,CAAC;EACjD;EACA,OAAOH,QAAQ,CAACG,IAAI,EAAED,WAAW,EAAE,IAAI,CAAC;AAC1C","ignoreList":[]}
|
package/lib/module/types.js
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* 'support' is the single chat (0.4+). The other three are the typed requests
|
|
5
|
+
* older builds file; their conversations still show in the chat.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** Shown to the support team, which can filter and message users by it. */
|
|
9
|
+
|
|
10
|
+
/** What the host app asks for. "system" follows the app's light/dark appearance. */
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A brand color: one hex for both modes, or a pair. A single color is
|
|
14
|
+
* lightened in dark mode (darkened in light) only as far as it takes to
|
|
15
|
+
* stay visible; a pair is used exactly as given.
|
|
16
|
+
*/
|
|
17
|
+
|
|
3
18
|
/**
|
|
4
19
|
* How the launcher renders:
|
|
5
20
|
* solid — accent fill, elevated. The floating action button.
|
|
@@ -7,11 +22,25 @@
|
|
|
7
22
|
* minimal — bare mark, no fill or border. Sits in a nav bar.
|
|
8
23
|
*/
|
|
9
24
|
|
|
25
|
+
/** Where a review request's button points; set per app in the dashboard. */
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Note the absence of any admin identity: end users see one support team,
|
|
29
|
+
* not the people staffing it, so the names never leave the server. The
|
|
30
|
+
* dashboard still shows who wrote and who resolved what.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* English labels, kept for host apps that render their own entry points.
|
|
35
|
+
* Inside the sheet the labels come from the string table instead, so they
|
|
36
|
+
* follow the user's language.
|
|
37
|
+
*/
|
|
10
38
|
export const QUERY_TYPE_LABEL = {
|
|
11
39
|
feedback: 'Feedback',
|
|
12
40
|
feature_request: 'Feature request',
|
|
13
|
-
bug_report: 'Bug report'
|
|
41
|
+
bug_report: 'Bug report',
|
|
42
|
+
support: 'Support'
|
|
14
43
|
};
|
|
15
|
-
export const USER_MESSAGE_MIN =
|
|
16
|
-
export const USER_MESSAGE_MAX =
|
|
44
|
+
export const USER_MESSAGE_MIN = 1;
|
|
45
|
+
export const USER_MESSAGE_MAX = 1000;
|
|
17
46
|
//# sourceMappingURL=types.js.map
|
package/lib/module/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["QUERY_TYPE_LABEL","feedback","feature_request","bug_report","USER_MESSAGE_MIN","USER_MESSAGE_MAX"],"sourceRoot":"../../src","sources":["types.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"names":["QUERY_TYPE_LABEL","feedback","feature_request","bug_report","support","USER_MESSAGE_MIN","USER_MESSAGE_MAX"],"sourceRoot":"../../src","sources":["types.ts"],"mappings":";;AAGA;AACA;AACA;AACA;;AAEA;;AAKA;;AAEA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;;AA2GA;;AAMA;AACA;AACA;AACA;AACA;;AA0BA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,gBAA2C,GAAG;EACzDC,QAAQ,EAAE,UAAU;EACpBC,eAAe,EAAE,iBAAiB;EAClCC,UAAU,EAAE,YAAY;EACxBC,OAAO,EAAE;AACX,CAAC;AAED,OAAO,MAAMC,gBAAgB,GAAG,CAAC;AACjC,OAAO,MAAMC,gBAAgB,GAAG,IAAI","ignoreList":[]}
|