@tuturuuu/utils 0.13.0 → 0.15.1
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/CHANGELOG.md +64 -0
- package/biome.json +1 -1
- package/package.json +10 -10
- package/src/__tests__/app-url.test.ts +4 -0
- package/src/calendar-settings-resolver.ts +200 -0
- package/src/internal-domains.ts +32 -0
- package/src/launchable-apps.test.ts +44 -0
- package/src/launchable-apps.ts +52 -39
- package/src/next-config.test.ts +92 -0
- package/src/next-config.ts +23 -0
- package/src/platform-release.test.ts +2 -2
- package/src/platform-release.ts +3 -1
- package/src/portless.ts +3 -0
- package/src/shared-cookie.test.ts +114 -0
- package/src/shared-cookie.ts +235 -0
- package/src/topic-announcements.ts +1 -0
- package/src/user-helper.ts +6 -95
- package/src/workspace-user-link.test.ts +53 -0
- package/src/workspace-user-link.ts +122 -0
- package/src/yjs-helper.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,69 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.15.1](https://github.com/tutur3u/platform/compare/utils-v0.15.0...utils-v0.15.1) (2026-07-13)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **contacts:** restore group post mutations ([fe621e4](https://github.com/tutur3u/platform/commit/fe621e4d7e4126f705082cc3e815aafdeebe535a))
|
|
9
|
+
* **security:** prevent clickjacking across apps ([c8ed36e](https://github.com/tutur3u/platform/commit/c8ed36e708c08ebe3b17ee7f6249513644108c48))
|
|
10
|
+
|
|
11
|
+
## [0.15.0](https://github.com/tutur3u/platform/compare/utils-v0.14.0...utils-v0.15.0) (2026-07-11)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **contacts:** migrate users attendance; add satellite-safe workspace-user link helper ([8f53453](https://github.com/tutur3u/platform/commit/8f534533793af8d25e7c2eca6e0147e459d78bbe))
|
|
17
|
+
* **contacts:** migrate users topic-announcements module ([01e19ab](https://github.com/tutur3u/platform/commit/01e19ab60461ccd94a0374bed74ce6e4d5d38a3b))
|
|
18
|
+
* **contacts:** scaffold contacts.tuturuuu.com satellite shell + monorepo registration ([7e335fc](https://github.com/tutur3u/platform/commit/7e335fc036c4a45ed189095ecd10a43ee002294b))
|
|
19
|
+
* **infrastructure:** add abuse protection controls ([0e09692](https://github.com/tutur3u/platform/commit/0e09692a553cb10fbbb521e921951c2a6863281d))
|
|
20
|
+
* **infrastructure:** add rate-limit appeals ([f1e50e9](https://github.com/tutur3u/platform/commit/f1e50e9fd805dca6c80da8daab60ed24199f24ab))
|
|
21
|
+
* **pay:** scaffold apps/pay satellite (pay.tuturuuu.com, port 7826) ([3d6e45c](https://github.com/tutur3u/platform/commit/3d6e45cca6a315fe67213e438144b73103bae2f5))
|
|
22
|
+
* **tools:** add apps/tools public tools app, remove apps/qr ([204aae8](https://github.com/tutur3u/platform/commit/204aae89a04b4163f2859561f8e832526642e271))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* **auth:** share account preference cookies ([8c1848a](https://github.com/tutur3u/platform/commit/8c1848a941c1b3f91337104c975e4bc0d8f68fc9))
|
|
28
|
+
* **ci:** keep cache components enabled in production ([75e6e2b](https://github.com/tutur3u/platform/commit/75e6e2bbbf6fa432bc496ee95b75ade5f8847f9f))
|
|
29
|
+
* **cli:** preserve markdown tables in task descriptions ([9faf8ba](https://github.com/tutur3u/platform/commit/9faf8ba44b92565a9dfc2949c496654fc1fea9b3))
|
|
30
|
+
* **infrastructure:** default docker web to native builds ([7d89f00](https://github.com/tutur3u/platform/commit/7d89f004f75ab12eddc3cb92df5a1e6a7255fe0d))
|
|
31
|
+
* **infrastructure:** restore canonical auth host access ([9f6715f](https://github.com/tutur3u/platform/commit/9f6715fb1c5a89598556cba33b16938b76995fc6))
|
|
32
|
+
* restore apps launcher categories ([5c5b571](https://github.com/tutur3u/platform/commit/5c5b571ce920013bcfa5f327c4bb208ea9fbf23e))
|
|
33
|
+
* **satellite:** widen apps launcher grid ([90e3106](https://github.com/tutur3u/platform/commit/90e31066830f535a7fdd0f7bc249e5bc8b273cfc))
|
|
34
|
+
* **security:** limit auth recovery code attempts ([72d454c](https://github.com/tutur3u/platform/commit/72d454c507b0d4b7e69c7b38ad2099dbb83193b2))
|
|
35
|
+
* **tasks:** route native personal task moves normally ([5bbba3c](https://github.com/tutur3u/platform/commit/5bbba3c3f193e722cc87cdfe2eb2734f61442cd0))
|
|
36
|
+
* update launchable app catalog ([cb31207](https://github.com/tutur3u/platform/commit/cb312076aee227de9a8f99105d681911d14a63ac))
|
|
37
|
+
* **web:** fail open without redis ([74bfcc7](https://github.com/tutur3u/platform/commit/74bfcc7ea5f188a56f49802c6a48bde0b109e02d))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Performance Improvements
|
|
41
|
+
|
|
42
|
+
* **ci:** enable repository-wide remote caching ([6250f91](https://github.com/tutur3u/platform/commit/6250f91d745ef987a4fc86c797aedf41542f421b))
|
|
43
|
+
|
|
44
|
+
## [0.14.0](https://github.com/tutur3u/platform/compare/utils-v0.13.0...utils-v0.14.0) (2026-07-11)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### Features
|
|
48
|
+
|
|
49
|
+
* **contacts:** migrate users attendance; add satellite-safe workspace-user link helper ([8f53453](https://github.com/tutur3u/platform/commit/8f534533793af8d25e7c2eca6e0147e459d78bbe))
|
|
50
|
+
* **contacts:** migrate users topic-announcements module ([01e19ab](https://github.com/tutur3u/platform/commit/01e19ab60461ccd94a0374bed74ce6e4d5d38a3b))
|
|
51
|
+
* **contacts:** scaffold contacts.tuturuuu.com satellite shell + monorepo registration ([7e335fc](https://github.com/tutur3u/platform/commit/7e335fc036c4a45ed189095ecd10a43ee002294b))
|
|
52
|
+
* **pay:** scaffold apps/pay satellite (pay.tuturuuu.com, port 7826) ([3d6e45c](https://github.com/tutur3u/platform/commit/3d6e45cca6a315fe67213e438144b73103bae2f5))
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### Bug Fixes
|
|
56
|
+
|
|
57
|
+
* **auth:** share account preference cookies ([8c1848a](https://github.com/tutur3u/platform/commit/8c1848a941c1b3f91337104c975e4bc0d8f68fc9))
|
|
58
|
+
* restore apps launcher categories ([5c5b571](https://github.com/tutur3u/platform/commit/5c5b571ce920013bcfa5f327c4bb208ea9fbf23e))
|
|
59
|
+
* **satellite:** widen apps launcher grid ([90e3106](https://github.com/tutur3u/platform/commit/90e31066830f535a7fdd0f7bc249e5bc8b273cfc))
|
|
60
|
+
* update launchable app catalog ([cb31207](https://github.com/tutur3u/platform/commit/cb312076aee227de9a8f99105d681911d14a63ac))
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
### Performance Improvements
|
|
64
|
+
|
|
65
|
+
* **ci:** enable repository-wide remote caching ([6250f91](https://github.com/tutur3u/platform/commit/6250f91d745ef987a4fc86c797aedf41542f421b))
|
|
66
|
+
|
|
3
67
|
## [0.13.0](https://github.com/tutur3u/platform/compare/utils-v0.12.1...utils-v0.13.0) (2026-07-05)
|
|
4
68
|
|
|
5
69
|
|
package/biome.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuturuuu/utils",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.15.1",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/tutur3u/platform",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"@noble/ciphers": "^2.2.0",
|
|
21
21
|
"@noble/hashes": "^2.2.0",
|
|
22
22
|
"@tanstack/react-query": "^5.101.2",
|
|
23
|
-
"@tiptap/core": "3.27.
|
|
24
|
-
"@tiptap/react": "3.27.
|
|
23
|
+
"@tiptap/core": "3.27.3",
|
|
24
|
+
"@tiptap/react": "3.27.3",
|
|
25
25
|
"@tuturuuu/google": "0.0.3",
|
|
26
26
|
"@tuturuuu/icons": "0.0.6",
|
|
27
|
-
"@tuturuuu/internal-api": "0.
|
|
27
|
+
"@tuturuuu/internal-api": "0.18.0",
|
|
28
28
|
"@tuturuuu/supabase": "0.4.0",
|
|
29
29
|
"@upstash/ratelimit": "^2.0.8",
|
|
30
30
|
"@upstash/redis": "^1.38.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"effect": "^3.21.4",
|
|
36
36
|
"moment": "^2.30.1",
|
|
37
37
|
"next": "^16.3.0-preview.5",
|
|
38
|
-
"prosemirror-model": "^1.25.
|
|
38
|
+
"prosemirror-model": "^1.25.11",
|
|
39
39
|
"react": "^19.2.7",
|
|
40
40
|
"react-dom": "^19.2.7",
|
|
41
41
|
"tailwind-merge": "^3.6.0",
|
|
@@ -45,15 +45,15 @@
|
|
|
45
45
|
"zod": "^4.4.3"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@tuturuuu/types": "0.
|
|
48
|
+
"@tuturuuu/types": "0.17.0",
|
|
49
49
|
"@tuturuuu/typescript-config": "0.1.1",
|
|
50
50
|
"@types/diff": "^8.0.0",
|
|
51
|
-
"@types/node": "^26.
|
|
51
|
+
"@types/node": "^26.1.1",
|
|
52
52
|
"@types/react": "^19.2.17",
|
|
53
53
|
"@vitejs/plugin-react": "^6.0.3",
|
|
54
|
-
"typescript": "7.0.
|
|
55
|
-
"vite": "^8.1.
|
|
56
|
-
"vitest": "^4.1.
|
|
54
|
+
"typescript": "7.0.2",
|
|
55
|
+
"vite": "^8.1.4",
|
|
56
|
+
"vitest": "^4.1.10"
|
|
57
57
|
},
|
|
58
58
|
"exports": {
|
|
59
59
|
"./timezones": "./src/timezones.json",
|
|
@@ -231,6 +231,7 @@ describe('getLocalInternalAppUrl', () => {
|
|
|
231
231
|
['cms', 'https://cms.tuturuuu.localhost'],
|
|
232
232
|
['calendar', 'https://calendar.tuturuuu.localhost'],
|
|
233
233
|
['chat', 'https://chat.tuturuuu.localhost'],
|
|
234
|
+
['docs', 'https://docs.tuturuuu.localhost'],
|
|
234
235
|
['drive', 'https://drive.tuturuuu.localhost'],
|
|
235
236
|
['qr', 'https://qr.tuturuuu.localhost'],
|
|
236
237
|
['tools', 'https://tools.tuturuuu.localhost'],
|
|
@@ -290,6 +291,8 @@ describe('Portless app origin registry', () => {
|
|
|
290
291
|
'https://calendar.tuturuuu.localhost',
|
|
291
292
|
'https://chat.tuturuuu.localhost',
|
|
292
293
|
'https://cms.tuturuuu.localhost',
|
|
294
|
+
'https://contacts.tuturuuu.localhost',
|
|
295
|
+
'https://docs.tuturuuu.localhost',
|
|
293
296
|
'https://drive.tuturuuu.localhost',
|
|
294
297
|
'https://external.tuturuuu.localhost',
|
|
295
298
|
'https://finance.tuturuuu.localhost',
|
|
@@ -302,6 +305,7 @@ describe('Portless app origin registry', () => {
|
|
|
302
305
|
'https://meet.tuturuuu.localhost',
|
|
303
306
|
'https://mind.tuturuuu.localhost',
|
|
304
307
|
'https://nova.tuturuuu.localhost',
|
|
308
|
+
'https://pay.tuturuuu.localhost',
|
|
305
309
|
'https://tuturuuu.localhost',
|
|
306
310
|
'https://playground.tuturuuu.localhost',
|
|
307
311
|
'https://qr.tuturuuu.localhost',
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calendar Settings Resolver
|
|
3
|
+
*
|
|
4
|
+
* Implements priority system for calendar preferences:
|
|
5
|
+
* User settings > Workspace settings > Auto-detection
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
type FirstDayOfWeek = 'auto' | 'sunday' | 'monday' | 'saturday';
|
|
9
|
+
|
|
10
|
+
interface CalendarSettings {
|
|
11
|
+
timezone: string;
|
|
12
|
+
firstDayOfWeek: FirstDayOfWeek;
|
|
13
|
+
timeFormat: '12h' | '24h';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface CalendarUserSettings {
|
|
17
|
+
timezone?: string | null;
|
|
18
|
+
first_day_of_week?: string | null;
|
|
19
|
+
time_format?: string | null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface CalendarWorkspaceSettings {
|
|
23
|
+
timezone?: string | null;
|
|
24
|
+
first_day_of_week?: string | null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Detects the system timezone using Intl API
|
|
29
|
+
*/
|
|
30
|
+
export function detectSystemTimezone(): string {
|
|
31
|
+
try {
|
|
32
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
33
|
+
} catch {
|
|
34
|
+
// Fallback to UTC if detection fails
|
|
35
|
+
return 'UTC';
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Detects the first day of week based on locale
|
|
41
|
+
* Vietnamese: Monday
|
|
42
|
+
* US/Canada: Sunday
|
|
43
|
+
* Middle East: Saturday
|
|
44
|
+
*/
|
|
45
|
+
export function detectLocaleFirstDay(locale?: string): FirstDayOfWeek {
|
|
46
|
+
const userLocale =
|
|
47
|
+
locale || (typeof navigator !== 'undefined' ? navigator.language : 'en-US');
|
|
48
|
+
|
|
49
|
+
// Vietnamese locale uses Monday as first day
|
|
50
|
+
if (userLocale.startsWith('vi')) {
|
|
51
|
+
return 'monday';
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// US, Canada, and some other countries use Sunday
|
|
55
|
+
if (userLocale.startsWith('en-US') || userLocale.startsWith('en-CA')) {
|
|
56
|
+
return 'sunday';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Middle Eastern countries typically use Saturday
|
|
60
|
+
if (userLocale.startsWith('ar') || userLocale.startsWith('he')) {
|
|
61
|
+
return 'saturday';
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Most European and other countries use Monday
|
|
65
|
+
return 'monday';
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Detects the preferred time format based on locale
|
|
70
|
+
* Uses Intl.DateTimeFormat to determine if the locale uses 12h or 24h format
|
|
71
|
+
*/
|
|
72
|
+
export function detectLocaleTimeFormat(locale?: string): '12h' | '24h' {
|
|
73
|
+
const userLocale =
|
|
74
|
+
locale || (typeof navigator !== 'undefined' ? navigator.language : 'en-US');
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
// Use Intl.DateTimeFormat to detect the locale's preferred format
|
|
78
|
+
const formatter = new Intl.DateTimeFormat(userLocale, { hour: 'numeric' });
|
|
79
|
+
const parts = formatter.formatToParts(new Date(2000, 0, 1, 13, 0));
|
|
80
|
+
const hourPart = parts.find((p) => p.type === 'hour');
|
|
81
|
+
|
|
82
|
+
// If hour is "1" instead of "13", it's 12-hour format
|
|
83
|
+
return hourPart?.value === '1' ? '12h' : '24h';
|
|
84
|
+
} catch {
|
|
85
|
+
// Fallback to 12h for English locales, 24h for others
|
|
86
|
+
return userLocale.startsWith('en') ? '12h' : '24h';
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Resolves the effective time format based on user setting
|
|
92
|
+
*/
|
|
93
|
+
export function resolveTimeFormat(
|
|
94
|
+
user?: Pick<CalendarUserSettings, 'time_format'> | null,
|
|
95
|
+
locale?: string
|
|
96
|
+
): '12h' | '24h' {
|
|
97
|
+
// User setting takes priority
|
|
98
|
+
if (user?.time_format && user.time_format !== 'auto') {
|
|
99
|
+
return user.time_format as '12h' | '24h';
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Auto-detection based on locale
|
|
103
|
+
return detectLocaleTimeFormat(locale);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Resolves the effective timezone based on priority system
|
|
108
|
+
*/
|
|
109
|
+
export function resolveTimezone(
|
|
110
|
+
user?: Pick<CalendarUserSettings, 'timezone'> | null,
|
|
111
|
+
workspace?: Pick<CalendarWorkspaceSettings, 'timezone'> | null
|
|
112
|
+
): string {
|
|
113
|
+
// Priority 1: User setting
|
|
114
|
+
if (user?.timezone && user.timezone !== 'auto') {
|
|
115
|
+
return user.timezone;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Priority 2: Workspace setting
|
|
119
|
+
if (workspace?.timezone && workspace.timezone !== 'auto') {
|
|
120
|
+
return workspace.timezone;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Priority 3: Auto-detection
|
|
124
|
+
return detectSystemTimezone();
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Resolves the effective first day of week based on priority system
|
|
129
|
+
*/
|
|
130
|
+
export function resolveFirstDayOfWeek(
|
|
131
|
+
user?: Pick<CalendarUserSettings, 'first_day_of_week'> | null,
|
|
132
|
+
workspace?: Pick<CalendarWorkspaceSettings, 'first_day_of_week'> | null,
|
|
133
|
+
locale?: string
|
|
134
|
+
): FirstDayOfWeek {
|
|
135
|
+
// Priority 1: User setting
|
|
136
|
+
if (user?.first_day_of_week && user.first_day_of_week !== 'auto') {
|
|
137
|
+
return user.first_day_of_week as FirstDayOfWeek;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Priority 2: Workspace setting
|
|
141
|
+
if (workspace?.first_day_of_week && workspace.first_day_of_week !== 'auto') {
|
|
142
|
+
return workspace.first_day_of_week as FirstDayOfWeek;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Priority 3: Auto-detection based on locale
|
|
146
|
+
return detectLocaleFirstDay(locale);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Resolves all calendar settings at once
|
|
151
|
+
*/
|
|
152
|
+
export function resolveCalendarSettings(
|
|
153
|
+
user?: CalendarUserSettings | null,
|
|
154
|
+
workspace?: CalendarWorkspaceSettings | null,
|
|
155
|
+
locale?: string
|
|
156
|
+
): CalendarSettings {
|
|
157
|
+
return {
|
|
158
|
+
timezone: resolveTimezone(user, workspace),
|
|
159
|
+
firstDayOfWeek: resolveFirstDayOfWeek(user, workspace, locale),
|
|
160
|
+
timeFormat: resolveTimeFormat(user, locale),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Converts first day of week string to number (for Date compatibility)
|
|
166
|
+
* 0 = Sunday, 1 = Monday, 6 = Saturday
|
|
167
|
+
*/
|
|
168
|
+
export function firstDayToNumber(day: FirstDayOfWeek, locale?: string): number {
|
|
169
|
+
if (day === 'auto') {
|
|
170
|
+
day = detectLocaleFirstDay(locale);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
switch (day) {
|
|
174
|
+
case 'sunday':
|
|
175
|
+
return 0;
|
|
176
|
+
case 'monday':
|
|
177
|
+
return 1;
|
|
178
|
+
case 'saturday':
|
|
179
|
+
return 6;
|
|
180
|
+
default:
|
|
181
|
+
return 1; // Default to Monday
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Converts number to first day of week string
|
|
187
|
+
* 0 = Sunday, 1 = Monday, 6 = Saturday
|
|
188
|
+
*/
|
|
189
|
+
export function numberToFirstDay(num: number): FirstDayOfWeek {
|
|
190
|
+
switch (num) {
|
|
191
|
+
case 0:
|
|
192
|
+
return 'sunday';
|
|
193
|
+
case 1:
|
|
194
|
+
return 'monday';
|
|
195
|
+
case 6:
|
|
196
|
+
return 'saturday';
|
|
197
|
+
default:
|
|
198
|
+
return 'monday'; // Default to Monday
|
|
199
|
+
}
|
|
200
|
+
}
|
package/src/internal-domains.ts
CHANGED
|
@@ -16,6 +16,10 @@ export const PRODUCTION_INTERNAL_APP_DOMAINS = [
|
|
|
16
16
|
name: 'cms',
|
|
17
17
|
url: 'https://cms.tuturuuu.com',
|
|
18
18
|
},
|
|
19
|
+
{
|
|
20
|
+
name: 'docs',
|
|
21
|
+
url: 'https://docs.tuturuuu.com',
|
|
22
|
+
},
|
|
19
23
|
{
|
|
20
24
|
name: 'calendar',
|
|
21
25
|
url: 'https://calendar.tuturuuu.com',
|
|
@@ -96,6 +100,14 @@ export const PRODUCTION_INTERNAL_APP_DOMAINS = [
|
|
|
96
100
|
name: 'teach',
|
|
97
101
|
url: 'https://teach.tuturuuu.com',
|
|
98
102
|
},
|
|
103
|
+
{
|
|
104
|
+
name: 'pay',
|
|
105
|
+
url: 'https://pay.tuturuuu.com',
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'contacts',
|
|
109
|
+
url: 'https://contacts.tuturuuu.com',
|
|
110
|
+
},
|
|
99
111
|
{
|
|
100
112
|
name: 'hive',
|
|
101
113
|
url: 'https://hive.tuturuuu.com',
|
|
@@ -119,6 +131,10 @@ export const PORTLESS_INTERNAL_APP_DOMAINS = [
|
|
|
119
131
|
name: 'cms',
|
|
120
132
|
url: getTuturuuuPortlessAppOrigin('cms'),
|
|
121
133
|
},
|
|
134
|
+
{
|
|
135
|
+
name: 'docs',
|
|
136
|
+
url: getTuturuuuPortlessAppOrigin('docs'),
|
|
137
|
+
},
|
|
122
138
|
{
|
|
123
139
|
name: 'calendar',
|
|
124
140
|
url: getTuturuuuPortlessAppOrigin('calendar'),
|
|
@@ -191,6 +207,14 @@ export const PORTLESS_INTERNAL_APP_DOMAINS = [
|
|
|
191
207
|
name: 'teach',
|
|
192
208
|
url: getTuturuuuPortlessAppOrigin('teach'),
|
|
193
209
|
},
|
|
210
|
+
{
|
|
211
|
+
name: 'pay',
|
|
212
|
+
url: getTuturuuuPortlessAppOrigin('pay'),
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
name: 'contacts',
|
|
216
|
+
url: getTuturuuuPortlessAppOrigin('contacts'),
|
|
217
|
+
},
|
|
194
218
|
{
|
|
195
219
|
name: 'hive',
|
|
196
220
|
url: getTuturuuuPortlessAppOrigin('hive'),
|
|
@@ -286,6 +310,14 @@ export const LOCALHOST_INTERNAL_APP_DOMAINS = [
|
|
|
286
310
|
name: 'teach',
|
|
287
311
|
url: 'http://localhost:7813',
|
|
288
312
|
},
|
|
313
|
+
{
|
|
314
|
+
name: 'pay',
|
|
315
|
+
url: 'http://localhost:7826',
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
name: 'contacts',
|
|
319
|
+
url: 'http://localhost:7827',
|
|
320
|
+
},
|
|
289
321
|
{
|
|
290
322
|
name: 'hive',
|
|
291
323
|
url: 'http://localhost:7814',
|
|
@@ -3,6 +3,8 @@ import {
|
|
|
3
3
|
getLaunchableApp,
|
|
4
4
|
getLaunchableAppByTitle,
|
|
5
5
|
getLaunchableAppOrigin,
|
|
6
|
+
LAUNCHABLE_APP_CATEGORIES,
|
|
7
|
+
LAUNCHABLE_APPS,
|
|
6
8
|
type LaunchableWorkspace,
|
|
7
9
|
resolveLaunchableAppPath,
|
|
8
10
|
resolveLaunchableAppUrl,
|
|
@@ -27,6 +29,39 @@ describe('launchable apps', () => {
|
|
|
27
29
|
expect(getLaunchableAppByTitle('apps gateway')?.slug).toBe('apps');
|
|
28
30
|
});
|
|
29
31
|
|
|
32
|
+
it('keeps retired apps out of the catalog and pins category overrides', () => {
|
|
33
|
+
expect(LAUNCHABLE_APPS.map((app) => app.slug)).not.toContain('external');
|
|
34
|
+
expect(LAUNCHABLE_APPS.map((app) => app.slug)).not.toContain('playground');
|
|
35
|
+
expect(LAUNCHABLE_APP_CATEGORIES).not.toContain('core');
|
|
36
|
+
expect(LAUNCHABLE_APP_CATEGORIES).not.toContain('content');
|
|
37
|
+
expect(LAUNCHABLE_APP_CATEGORIES).not.toContain('developer');
|
|
38
|
+
expect(LAUNCHABLE_APP_CATEGORIES).toContain('miscellaneous');
|
|
39
|
+
expect(getLaunchableApp('external')).toBeNull();
|
|
40
|
+
expect(getLaunchableApp('playground')).toBeNull();
|
|
41
|
+
expect(getLaunchableApp('platform')?.category).toBe('productivity');
|
|
42
|
+
expect(getLaunchableApp('apps')?.category).toBe('miscellaneous');
|
|
43
|
+
expect(getLaunchableApp('cms')?.category).toBe('operations');
|
|
44
|
+
expect(getLaunchableApp('rewise')?.category).toBe('ai');
|
|
45
|
+
expect(getLaunchableApp('docs')?.category).toBe('miscellaneous');
|
|
46
|
+
expect(getLaunchableApp('tools')?.category).toBe('miscellaneous');
|
|
47
|
+
expect(getLaunchableApp('shortener')?.category).toBe('miscellaneous');
|
|
48
|
+
expect(
|
|
49
|
+
LAUNCHABLE_APPS.filter((app) => app.category === 'productivity').map(
|
|
50
|
+
(app) => app.slug
|
|
51
|
+
)[0]
|
|
52
|
+
).toBe('platform');
|
|
53
|
+
expect(
|
|
54
|
+
LAUNCHABLE_APPS.filter((app) => app.category === 'operations').map(
|
|
55
|
+
(app) => app.slug
|
|
56
|
+
)
|
|
57
|
+
).not.toContain('apps');
|
|
58
|
+
expect(
|
|
59
|
+
LAUNCHABLE_APPS.filter((app) => app.category === 'miscellaneous').map(
|
|
60
|
+
(app) => app.slug
|
|
61
|
+
)[0]
|
|
62
|
+
).toBe('apps');
|
|
63
|
+
});
|
|
64
|
+
|
|
30
65
|
it('resolves production, Portless, and local origins', () => {
|
|
31
66
|
const app = getLaunchableApp('calendar');
|
|
32
67
|
|
|
@@ -46,6 +81,15 @@ describe('launchable apps', () => {
|
|
|
46
81
|
expect(getLaunchableAppOrigin(meet!, { environment: 'production' })).toBe(
|
|
47
82
|
'https://meet.tuturuuu.com'
|
|
48
83
|
);
|
|
84
|
+
|
|
85
|
+
const docs = getLaunchableApp('docs');
|
|
86
|
+
expect(docs).not.toBeNull();
|
|
87
|
+
expect(getLaunchableAppOrigin(docs!, { environment: 'production' })).toBe(
|
|
88
|
+
'https://docs.tuturuuu.com'
|
|
89
|
+
);
|
|
90
|
+
expect(getLaunchableAppOrigin(docs!, { environment: 'portless' })).toBe(
|
|
91
|
+
'https://docs.tuturuuu.localhost'
|
|
92
|
+
);
|
|
49
93
|
});
|
|
50
94
|
|
|
51
95
|
it('detects Portless dev from the current origin', () => {
|
package/src/launchable-apps.ts
CHANGED
|
@@ -2,13 +2,11 @@ import { toWorkspaceSlug } from './constants';
|
|
|
2
2
|
import { getTuturuuuPortlessAppOrigin } from './portless';
|
|
3
3
|
|
|
4
4
|
export const LAUNCHABLE_APP_CATEGORIES = [
|
|
5
|
-
'core',
|
|
6
5
|
'productivity',
|
|
7
|
-
'content',
|
|
8
6
|
'operations',
|
|
9
7
|
'learning',
|
|
10
|
-
'developer',
|
|
11
8
|
'ai',
|
|
9
|
+
'miscellaneous',
|
|
12
10
|
] as const;
|
|
13
11
|
|
|
14
12
|
export type LaunchableAppCategory = (typeof LAUNCHABLE_APP_CATEGORIES)[number];
|
|
@@ -53,7 +51,7 @@ export const LAUNCHABLE_APPS = [
|
|
|
53
51
|
{
|
|
54
52
|
aliases: ['Tuturuuu', 'Dashboard', 'Workspace'],
|
|
55
53
|
appRoot: 'apps/web',
|
|
56
|
-
category: '
|
|
54
|
+
category: 'productivity',
|
|
57
55
|
defaultPath: '/',
|
|
58
56
|
localhostOrigin: 'http://localhost:7803',
|
|
59
57
|
packageName: '@tuturuuu/web',
|
|
@@ -63,18 +61,6 @@ export const LAUNCHABLE_APPS = [
|
|
|
63
61
|
title: 'Platform',
|
|
64
62
|
workspacePathResolver: workspaceRootPath,
|
|
65
63
|
},
|
|
66
|
-
{
|
|
67
|
-
aliases: ['App Launcher', 'Gateway', 'Apps Gateway'],
|
|
68
|
-
appRoot: 'apps/apps',
|
|
69
|
-
category: 'core',
|
|
70
|
-
defaultPath: '/',
|
|
71
|
-
localhostOrigin: 'http://localhost:7818',
|
|
72
|
-
packageName: '@tuturuuu/apps',
|
|
73
|
-
portlessApp: 'apps',
|
|
74
|
-
productionUrl: 'https://apps.tuturuuu.com',
|
|
75
|
-
slug: 'apps',
|
|
76
|
-
title: 'Apps',
|
|
77
|
-
},
|
|
78
64
|
{
|
|
79
65
|
aliases: ['Schedule', 'Events'],
|
|
80
66
|
appRoot: 'apps/calendar',
|
|
@@ -104,7 +90,7 @@ export const LAUNCHABLE_APPS = [
|
|
|
104
90
|
{
|
|
105
91
|
aliases: ['Content', 'CMS'],
|
|
106
92
|
appRoot: 'apps/cms',
|
|
107
|
-
category: '
|
|
93
|
+
category: 'operations',
|
|
108
94
|
defaultPath: '/personal',
|
|
109
95
|
localhostOrigin: 'http://localhost:7811',
|
|
110
96
|
packageName: '@tuturuuu/cms',
|
|
@@ -128,15 +114,27 @@ export const LAUNCHABLE_APPS = [
|
|
|
128
114
|
workspacePathResolver: workspaceRootPath,
|
|
129
115
|
},
|
|
130
116
|
{
|
|
131
|
-
aliases: ['
|
|
132
|
-
appRoot: 'apps/
|
|
133
|
-
category: '
|
|
117
|
+
aliases: ['App Launcher', 'Gateway', 'Apps Gateway'],
|
|
118
|
+
appRoot: 'apps/apps',
|
|
119
|
+
category: 'miscellaneous',
|
|
134
120
|
defaultPath: '/',
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
121
|
+
localhostOrigin: 'http://localhost:7818',
|
|
122
|
+
packageName: '@tuturuuu/apps',
|
|
123
|
+
portlessApp: 'apps',
|
|
124
|
+
productionUrl: 'https://apps.tuturuuu.com',
|
|
125
|
+
slug: 'apps',
|
|
126
|
+
title: 'Apps',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
aliases: ['Documentation', 'Guides', 'Reference'],
|
|
130
|
+
appRoot: 'apps/docs',
|
|
131
|
+
category: 'miscellaneous',
|
|
132
|
+
defaultPath: '/',
|
|
133
|
+
packageName: 'apps/docs',
|
|
134
|
+
portlessApp: 'docs',
|
|
135
|
+
productionUrl: 'https://docs.tuturuuu.com',
|
|
136
|
+
slug: 'docs',
|
|
137
|
+
title: 'Docs',
|
|
140
138
|
},
|
|
141
139
|
{
|
|
142
140
|
aliases: ['Money', 'Wallets', 'Invoices'],
|
|
@@ -251,21 +249,10 @@ export const LAUNCHABLE_APPS = [
|
|
|
251
249
|
slug: 'nova',
|
|
252
250
|
title: 'Nova',
|
|
253
251
|
},
|
|
254
|
-
{
|
|
255
|
-
aliases: ['Labs', 'Sandbox'],
|
|
256
|
-
appRoot: 'apps/playground',
|
|
257
|
-
category: 'developer',
|
|
258
|
-
defaultPath: '/',
|
|
259
|
-
packageName: '@tuturuuu/playground',
|
|
260
|
-
portlessApp: 'playground',
|
|
261
|
-
productionUrl: 'https://playground.tuturuuu.com',
|
|
262
|
-
slug: 'playground',
|
|
263
|
-
title: 'Playground',
|
|
264
|
-
},
|
|
265
252
|
{
|
|
266
253
|
aliases: ['QR Code', 'Generator', 'Password', 'Random', 'UUID', 'Token'],
|
|
267
254
|
appRoot: 'apps/tools',
|
|
268
|
-
category: '
|
|
255
|
+
category: 'miscellaneous',
|
|
269
256
|
defaultPath: '/',
|
|
270
257
|
localhostOrigin: 'http://localhost:7825',
|
|
271
258
|
packageName: '@tuturuuu/tools',
|
|
@@ -277,7 +264,7 @@ export const LAUNCHABLE_APPS = [
|
|
|
277
264
|
{
|
|
278
265
|
aliases: ['Review', 'Flashcards'],
|
|
279
266
|
appRoot: 'apps/rewise',
|
|
280
|
-
category: '
|
|
267
|
+
category: 'ai',
|
|
281
268
|
defaultPath: '/',
|
|
282
269
|
localhostOrigin: 'http://localhost:7804',
|
|
283
270
|
packageName: '@tuturuuu/rewise',
|
|
@@ -289,7 +276,7 @@ export const LAUNCHABLE_APPS = [
|
|
|
289
276
|
{
|
|
290
277
|
aliases: ['Links', 'URL Shortener'],
|
|
291
278
|
appRoot: 'apps/shortener',
|
|
292
|
-
category: '
|
|
279
|
+
category: 'miscellaneous',
|
|
293
280
|
defaultPath: '/',
|
|
294
281
|
packageName: '@tuturuuu/shortener',
|
|
295
282
|
portlessApp: 'shortener',
|
|
@@ -323,6 +310,32 @@ export const LAUNCHABLE_APPS = [
|
|
|
323
310
|
title: 'Teach',
|
|
324
311
|
workspacePathResolver: workspaceRootPath,
|
|
325
312
|
},
|
|
313
|
+
{
|
|
314
|
+
aliases: ['Billing', 'Subscriptions', 'Payments'],
|
|
315
|
+
appRoot: 'apps/pay',
|
|
316
|
+
category: 'operations',
|
|
317
|
+
defaultPath: '/personal',
|
|
318
|
+
localhostOrigin: 'http://localhost:7826',
|
|
319
|
+
packageName: '@tuturuuu/pay',
|
|
320
|
+
portlessApp: 'pay',
|
|
321
|
+
productionUrl: 'https://pay.tuturuuu.com',
|
|
322
|
+
slug: 'pay',
|
|
323
|
+
title: 'Pay',
|
|
324
|
+
workspacePathResolver: workspaceRootPath,
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
aliases: ['CRM', 'Users', 'Members', 'Customers', 'Leads'],
|
|
328
|
+
appRoot: 'apps/contacts',
|
|
329
|
+
category: 'operations',
|
|
330
|
+
defaultPath: '/personal',
|
|
331
|
+
localhostOrigin: 'http://localhost:7827',
|
|
332
|
+
packageName: '@tuturuuu/contacts',
|
|
333
|
+
portlessApp: 'contacts',
|
|
334
|
+
productionUrl: 'https://contacts.tuturuuu.com',
|
|
335
|
+
slug: 'contacts',
|
|
336
|
+
title: 'Contacts',
|
|
337
|
+
workspacePathResolver: workspaceRootPath,
|
|
338
|
+
},
|
|
326
339
|
{
|
|
327
340
|
aliases: ['Time Tracking', 'Timer'],
|
|
328
341
|
appRoot: 'apps/track',
|