@micha.bigler/ui-core-micha 3.14.3 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/README.md +7 -0
- package/dist/auth/UserMenu.js +1 -1
- package/dist/auth/apiClient.js +7 -6
- package/dist/chat/ChatList.js +1 -1
- package/dist/chat/ChatThread.js +2 -1
- package/dist/chat/ChatWorkspace.js +1 -1
- package/dist/chat/ModelPicker.js +2 -5
- package/dist/chat/kitSxRegistry.js +9 -0
- package/dist/chat/useChatSocket.js +1 -1
- package/dist/components/LoginForm.js +1 -1
- package/dist/components/SecurityComponent.js +1 -1
- package/dist/components/UserListComponent.js +2 -8
- package/dist/components/charts/ChartFrame.js +1 -1
- package/dist/components/charts/ScatterChart.js +2 -1
- package/dist/components/charts/kitSxRegistry.js +6 -0
- package/dist/entries/charts.js +6 -0
- package/dist/entries/chat.js +8 -0
- package/dist/entries/markdown.js +1 -0
- package/dist/index.js +0 -14
- package/dist/layout/SectionNav.js +1 -1
- package/dist/messaging/AttachmentList.js +2 -2
- package/dist/messaging/Composer.js +2 -1
- package/dist/messaging/ConversationLaunchers.js +1 -4
- package/dist/messaging/ConversationList.js +1 -1
- package/dist/messaging/DirectMessageLauncher.js +1 -1
- package/dist/messaging/MessagingProvider.js +0 -0
- package/dist/messaging/PollCard.js +7 -5
- package/dist/messaging/ReadTicks.js +2 -2
- package/dist/messaging/Thread.js +5 -3
- package/dist/notifications/NotificationBell.js +4 -7
- package/dist/notifications/NotificationSettings.js +1 -1
- package/dist/onboarding/OnboardingProvider.js +3 -6
- package/dist/pages/AccountPage.js +1 -2
- package/dist/pages/LoginPage.js +2 -3
- package/dist/pages/PasswordChangePage.js +2 -3
- package/dist/pages/PasswordInvitePage.js +2 -3
- package/dist/pages/PasswordResetRequestPage.js +2 -3
- package/dist/pages/SignUpPage.js +2 -3
- package/dist/pages/SignupConfirmPage.js +2 -3
- package/dist/theme/createAppTheme.js +5 -4
- package/dist/theme/kitSxEntry.js +11 -0
- package/dist/theme/kitSxRegistry.js +2 -15
- package/dist/theme/themeCompleteness.js +3 -12
- package/dist/utils/auth-errors.js +4 -3
- package/package.json +41 -16
- package/.github/workflows/publish.yml +0 -126
- package/DESIGN.md +0 -60
- package/WORK_ORDERS.md +0 -148
- package/dev/entries.jsx +0 -721
- package/dev/fixtures.js +0 -26
- package/dev/main.jsx +0 -75
- package/dev/mockTransport.jsx +0 -128
- package/docs/CHART-LAYOUT.md +0 -157
- package/docs/DARK-TOKENS.md +0 -140
- package/docs/TYPE-SCALE.md +0 -111
- package/docs/messaging-deviations.md +0 -118
- package/index.html +0 -12
- package/renovate.json +0 -10
- package/scripts/chart-api-census.mjs +0 -415
- package/src/auth/AuthContext.jsx +0 -158
- package/src/auth/ReauthModal.jsx +0 -82
- package/src/auth/UserMenu.jsx +0 -121
- package/src/auth/apiClient.jsx +0 -232
- package/src/auth/authApi.jsx +0 -539
- package/src/auth/authConfig.jsx +0 -34
- package/src/auth/reauth.js +0 -47
- package/src/chat/ChatComposer.jsx +0 -36
- package/src/chat/ChatList.jsx +0 -87
- package/src/chat/ChatThread.jsx +0 -128
- package/src/chat/ChatWorkspace.jsx +0 -244
- package/src/chat/MarkdownReply.jsx +0 -22
- package/src/chat/ModelPicker.jsx +0 -85
- package/src/chat/api.js +0 -18
- package/src/chat/useChatSocket.js +0 -32
- package/src/chat/wire.js +0 -7
- package/src/components/AccessCodeManager.jsx +0 -288
- package/src/components/AccessCodeSingleUseToggle.jsx +0 -92
- package/src/components/AllowedEmailDomainsManager.jsx +0 -92
- package/src/components/AuthFactorRequirementCard.jsx +0 -95
- package/src/components/BulkInviteCsvTab.jsx +0 -198
- package/src/components/EmptyState.jsx +0 -38
- package/src/components/LoginForm.jsx +0 -159
- package/src/components/MFAComponent.jsx +0 -350
- package/src/components/MfaLoginComponent.jsx +0 -252
- package/src/components/MobileBottomNav.jsx +0 -82
- package/src/components/PasskeysComponent.jsx +0 -252
- package/src/components/PasswordChangeForm.jsx +0 -87
- package/src/components/PasswordResetRequestForm.jsx +0 -43
- package/src/components/PasswordSetForm.jsx +0 -97
- package/src/components/ProfileComponent.jsx +0 -348
- package/src/components/QrSignupManager.jsx +0 -404
- package/src/components/QrSignupValidityManager.jsx +0 -106
- package/src/components/RegistrationMethodsManager.jsx +0 -150
- package/src/components/SecurityComponent.jsx +0 -141
- package/src/components/SocialLoginButtons.jsx +0 -83
- package/src/components/SoftChip.jsx +0 -93
- package/src/components/StatTile.jsx +0 -39
- package/src/components/SupportRecoveryRequestsTab.jsx +0 -482
- package/src/components/TurnstileWidget.jsx +0 -99
- package/src/components/UserInviteComponent.jsx +0 -76
- package/src/components/UserListComponent.jsx +0 -618
- package/src/components/charts/BarChart.jsx +0 -102
- package/src/components/charts/ChartFrame.jsx +0 -214
- package/src/components/charts/LineChart.jsx +0 -126
- package/src/components/charts/ScatterChart.jsx +0 -299
- package/src/components/charts/TimeSeriesChart.jsx +0 -300
- package/src/components/charts/chartDefaults.js +0 -644
- package/src/components/charts/chartLabels.js +0 -36
- package/src/components/charts/exportChart.js +0 -258
- package/src/components/charts/formatters.js +0 -39
- package/src/components/charts/palette.js +0 -33
- package/src/components/charts/yearTickInterval.js +0 -7
- package/src/i18n/authTranslations.ts +0 -2651
- package/src/i18n/chartsTranslations.ts +0 -91
- package/src/i18n/chatTranslations.ts +0 -55
- package/src/i18n/messagingTranslations.ts +0 -120
- package/src/i18n/notificationsTranslations.ts +0 -32
- package/src/i18n/onboardingTranslations.ts +0 -29
- package/src/i18n/sectionNavTranslations.ts +0 -20
- package/src/i18n/uiCoreTranslations.js +0 -29
- package/src/i18n/userMenuTranslations.ts +0 -5
- package/src/index.js +0 -158
- package/src/layout/PageLayout.jsx +0 -36
- package/src/layout/SectionNav.jsx +0 -320
- package/src/messaging/AttachmentList.jsx +0 -145
- package/src/messaging/Composer.jsx +0 -197
- package/src/messaging/ConversationLaunchers.jsx +0 -51
- package/src/messaging/ConversationList.jsx +0 -109
- package/src/messaging/DirectMessageLauncher.jsx +0 -112
- package/src/messaging/MessageBubble.jsx +0 -183
- package/src/messaging/MessagingProvider.jsx +0 -0
- package/src/messaging/MessagingScopeConfig.jsx +0 -24
- package/src/messaging/PollCard.jsx +0 -163
- package/src/messaging/ReactionBar.jsx +0 -43
- package/src/messaging/ReadTicks.jsx +0 -82
- package/src/messaging/Thread.jsx +0 -195
- package/src/messaging/api.js +0 -48
- package/src/messaging/composerImageCompression.js +0 -35
- package/src/messaging/linkifyText.jsx +0 -37
- package/src/notifications/NotificationBell.jsx +0 -84
- package/src/notifications/NotificationSettings.jsx +0 -330
- package/src/notifications/NotificationsProvider.jsx +0 -224
- package/src/notifications/PopupSurface.jsx +0 -105
- package/src/notifications/api.js +0 -55
- package/src/notifications/feedApi.js +0 -18
- package/src/notifications/realtime.jsx +0 -138
- package/src/notifications/serviceWorker/sw.js +0 -50
- package/src/onboarding/OnboardingProvider.jsx +0 -326
- package/src/onboarding/OnboardingWizard.jsx +0 -61
- package/src/onboarding/WizardDialogShell.jsx +0 -51
- package/src/onboarding/api.js +0 -13
- package/src/onboarding/stepSelection.js +0 -16
- package/src/onboarding/steps/BrowserPushStep.jsx +0 -121
- package/src/onboarding/steps/CompleteNameStep.jsx +0 -46
- package/src/onboarding/steps/CookieConsentStep.jsx +0 -133
- package/src/onboarding/steps/PwaInstallStep.jsx +0 -47
- package/src/pages/AccountPage.jsx +0 -394
- package/src/pages/LoginPage.jsx +0 -343
- package/src/pages/PasswordChangePage.jsx +0 -62
- package/src/pages/PasswordInvitePage.jsx +0 -177
- package/src/pages/PasswordResetRequestPage.jsx +0 -68
- package/src/pages/SignUpPage.jsx +0 -268
- package/src/pages/SignupConfirmPage.jsx +0 -155
- package/src/testing/checkKitIntegration.js +0 -233
- package/src/theme/createAppTheme.js +0 -423
- package/src/theme/fonts.js +0 -3
- package/src/theme/index.js +0 -21
- package/src/theme/kitSxRegistry.js +0 -285
- package/src/theme/themeCompleteness.js +0 -1045
- package/src/theme/tokens.js +0 -478
- package/src/utils/auth-errors.js +0 -76
- package/src/utils/authService.js +0 -223
- package/src/utils/resolveErrorText.js +0 -28
- package/src/utils/webauthn.js +0 -51
- package/tests/AccountPage.profileStatements.test.jsx +0 -162
- package/tests/AccountPage.test.jsx +0 -200
- package/tests/AuthContext.test.jsx +0 -129
- package/tests/BarChart.test.jsx +0 -112
- package/tests/BrowserPushStep.test.jsx +0 -110
- package/tests/ChartFrame.test.jsx +0 -336
- package/tests/ConversationList.test.jsx +0 -144
- package/tests/CookieConsentStep.test.jsx +0 -69
- package/tests/EmptyState.test.jsx +0 -62
- package/tests/LineChart.test.jsx +0 -80
- package/tests/MessagingProvider.test.jsx +0 -50
- package/tests/MobileBottomNav.test.jsx +0 -319
- package/tests/NotificationBell.test.jsx +0 -60
- package/tests/NotificationSettings.test.jsx +0 -276
- package/tests/NotificationsProvider.test.jsx +0 -240
- package/tests/OnboardingProvider.test.jsx +0 -294
- package/tests/OnboardingWizard.test.jsx +0 -143
- package/tests/PasswordChangeForm.test.jsx +0 -70
- package/tests/PasswordInvitePage.test.jsx +0 -142
- package/tests/PasswordSetForm.test.jsx +0 -70
- package/tests/PopupSurface.test.jsx +0 -142
- package/tests/ProfileComponent.refresh.test.jsx +0 -194
- package/tests/QrSignupManager.registrationContext.test.jsx +0 -106
- package/tests/QrSignupManagerInfoBox.test.jsx +0 -49
- package/tests/ScatterChart.test.jsx +0 -270
- package/tests/SectionNav.test.jsx +0 -363
- package/tests/SignUpPage.test.jsx +0 -208
- package/tests/SoftChip.test.jsx +0 -105
- package/tests/StatTile.test.jsx +0 -57
- package/tests/Thread.test.jsx +0 -151
- package/tests/TimeSeriesChart.test.jsx +0 -367
- package/tests/UserListComponent.test.jsx +0 -192
- package/tests/UserMenu.test.jsx +0 -171
- package/tests/apiClientLanguage.test.js +0 -33
- package/tests/apiClientPublicPaths.test.js +0 -178
- package/tests/authApiLogin.test.js +0 -42
- package/tests/authApiRegistration.test.js +0 -31
- package/tests/authErrorCodeRendering.test.jsx +0 -77
- package/tests/authErrors.test.js +0 -74
- package/tests/authTranslations.test.js +0 -74
- package/tests/chart-api-census.test.js +0 -366
- package/tests/chartAxisTickBand.test.jsx +0 -95
- package/tests/chartDefaults.test.js +0 -902
- package/tests/chartLabels.test.js +0 -50
- package/tests/chartsPalette.test.js +0 -99
- package/tests/chatApi.test.js +0 -48
- package/tests/chatDriverNames.test.jsx +0 -71
- package/tests/chatExports.test.js +0 -3
- package/tests/chatList.test.jsx +0 -84
- package/tests/chatPicker.test.jsx +0 -82
- package/tests/chatSocket.test.jsx +0 -26
- package/tests/chatThread.test.jsx +0 -116
- package/tests/chatTranslations.test.js +0 -47
- package/tests/chatWorkspace.test.jsx +0 -234
- package/tests/checkKitIntegration.test.jsx +0 -219
- package/tests/createAppTheme.test.js +0 -132
- package/tests/createAppThemeDark.test.js +0 -127
- package/tests/createAppThemeLightGuard.test.js +0 -40
- package/tests/createAppThemePageContrast.test.js +0 -108
- package/tests/createAppThemeTypography.test.js +0 -53
- package/tests/errorCallSiteGuard.test.js +0 -32
- package/tests/exportChart.test.js +0 -313
- package/tests/feedApi.test.js +0 -46
- package/tests/fixtures/light-theme-baseline.json +0 -2234
- package/tests/i18nAggregate.test.js +0 -120
- package/tests/i18nGermanVariant.test.js +0 -65
- package/tests/loginPageErrorResolution.test.jsx +0 -102
- package/tests/messagingApi.test.js +0 -32
- package/tests/messagingChunk6.test.jsx +0 -116
- package/tests/messagingCompactBubble.test.jsx +0 -64
- package/tests/messagingComposer.test.jsx +0 -136
- package/tests/messagingComposerChunk5.test.jsx +0 -113
- package/tests/messagingContractConformance.test.js +0 -69
- package/tests/messagingDirectMessageLauncher.test.jsx +0 -151
- package/tests/messagingExports.test.js +0 -21
- package/tests/messagingInteractions.test.jsx +0 -136
- package/tests/messagingLastMessagePreview.test.jsx +0 -93
- package/tests/messagingLinkify.test.jsx +0 -51
- package/tests/messagingMessageActions.test.jsx +0 -163
- package/tests/messagingMsg6.test.jsx +0 -105
- package/tests/messagingMsg6f.test.jsx +0 -155
- package/tests/messagingMsg6g.test.jsx +0 -166
- package/tests/messagingMsg6h.test.jsx +0 -136
- package/tests/messagingMsg6i.test.jsx +0 -129
- package/tests/messagingPollRendering.test.jsx +0 -142
- package/tests/messagingReactionMerge.test.jsx +0 -77
- package/tests/messagingReadTicksTooltip.test.jsx +0 -36
- package/tests/messagingThreadReceipts.test.jsx +0 -178
- package/tests/messagingThreadingQuoting.test.jsx +0 -87
- package/tests/messagingUnreadLifecycle.test.jsx +0 -78
- package/tests/notificationsApi.test.js +0 -41
- package/tests/notificationsExports.test.js +0 -34
- package/tests/onboardingDescriptors.test.js +0 -132
- package/tests/packageTreeShaking.test.js +0 -126
- package/tests/realtime.test.jsx +0 -219
- package/tests/resolveErrorText.test.js +0 -72
- package/tests/stepSelection.test.js +0 -53
- package/tests/themeCompleteness.test.js +0 -626
- package/tests/timeSeriesLegend.test.js +0 -99
- package/tests/userScreenTranslations.test.jsx +0 -218
- package/tsconfig.build.json +0 -18
- package/vite.config.mjs +0 -6
- package/work-orders/AUTH-1.md +0 -74
- package/work-orders/AUTH-2.md +0 -74
- package/work-orders/AUTH-4.md +0 -183
- package/work-orders/AUTH-5.md +0 -154
- package/work-orders/AUTH-7.md +0 -181
- package/work-orders/AUTH-8.md +0 -184
- package/work-orders/CHART-1.md +0 -285
- package/work-orders/CHART-2.md +0 -222
- package/work-orders/CHART-3.md +0 -163
- package/work-orders/CHART-4.md +0 -203
- package/work-orders/CHART-5.md +0 -226
- package/work-orders/CHART-6.md +0 -428
- package/work-orders/CHART-7.md +0 -175
- package/work-orders/DX-1.md +0 -169
- package/work-orders/DX-2.md +0 -188
- package/work-orders/DX-3.md +0 -195
- package/work-orders/I18N-1.md +0 -254
- package/work-orders/I18N-3.md +0 -207
- package/work-orders/MSG-3.md +0 -375
- package/work-orders/MSG-3b.md +0 -1002
- package/work-orders/MSG-3c.md +0 -378
- package/work-orders/MSG-3d.md +0 -268
- package/work-orders/MSG-3e.md +0 -164
- package/work-orders/MSG-3f.md +0 -391
- package/work-orders/MSG-6e.md +0 -308
- package/work-orders/MSG-6f.md +0 -214
- package/work-orders/MSG-6g.md +0 -244
- package/work-orders/MSG-6h.md +0 -238
- package/work-orders/MSG-6i.md +0 -271
- package/work-orders/MSG-6j.md +0 -117
- package/work-orders/NOTIF-12.md +0 -214
- package/work-orders/NOTIF-13.md +0 -142
- package/work-orders/NOTIF-14.md +0 -151
- package/work-orders/PRIM-1.md +0 -177
- package/work-orders/SHELL-1.md +0 -255
- package/work-orders/SHELL-2.md +0 -197
- package/work-orders/SHELL-3.md +0 -359
- package/work-orders/SHELL-4.md +0 -351
- package/work-orders/SHELL-5.md +0 -345
- package/work-orders/SHELL-6.md +0 -210
- package/work-orders/THEME-1.md +0 -587
- package/work-orders/THEME-10.md +0 -303
- package/work-orders/THEME-11.md +0 -208
- package/work-orders/THEME-2.md +0 -339
- package/work-orders/THEME-3.md +0 -210
- package/work-orders/THEME-4.md +0 -271
- package/work-orders/THEME-5.md +0 -341
- package/work-orders/THEME-6.md +0 -247
- package/work-orders/THEME-7.md +0 -82
- package/work-orders/THEME-8.md +0 -211
- package/work-orders/THEME-9.md +0 -194
- package/work-orders/UCM-AUTH-10.md +0 -490
- package/work-orders/UCM-AUTH-11.md +0 -185
- package/work-orders/UCM-AUTH-12.md +0 -98
- package/work-orders/UCM-AUTH-13.md +0 -47
- package/work-orders/UCM-AUTH-9.md +0 -207
- package/work-orders/UCM-CHART-10.md +0 -150
- package/work-orders/UCM-CHART-11.md +0 -132
- package/work-orders/UCM-CHART-12.md +0 -348
- package/work-orders/UCM-CHART-13.md +0 -122
- package/work-orders/UCM-CHART-14.md +0 -198
- package/work-orders/UCM-CHART-15.md +0 -187
- package/work-orders/UCM-CHART-16.md +0 -169
- package/work-orders/UCM-CHART-17.md +0 -195
- package/work-orders/UCM-CHART-18.md +0 -200
- package/work-orders/UCM-CHART-8.md +0 -147
- package/work-orders/UCM-CHART-9.md +0 -265
- package/work-orders/UCM-CHAT-1.md +0 -190
- package/work-orders/UCM-CHAT-2.md +0 -75
- package/work-orders/UCM-DEP-1.md +0 -63
- package/work-orders/UCM-I18N-4.md +0 -226
- package/work-orders/UCM-I18N-5.md +0 -211
- package/work-orders/UCM-MSG-20.md +0 -192
- package/work-orders/UCM-PRIM-2.md +0 -114
- package/work-orders/UCM-SHELL-7.md +0 -134
- package/work-orders/UCM-SHELL-8.md +0 -125
- package/work-orders/UCM-TEST-1.md +0 -304
- package/work-orders/UCM-THEME-13.md +0 -69
- package/work-orders/UCM-THEME-14.md +0 -312
- package/work-orders/UCM-THEME-15.md +0 -356
- package/work-orders/UCM-THEME-16.md +0 -80
- package/work-orders/UCM-THEME-17.md +0 -111
- package/work-orders/UCM-THEME-18.md +0 -184
- package/work-orders/assets/AUTH-4-user-list-card.html +0 -407
- package/work-orders/assets/PRIM-1-dashboard-primitives.html +0 -624
- package/work-orders/assets/SHELL-2-account-navigation.html +0 -1159
- package/work-orders/assets/THEME-1-baseline-reference-sheet.html +0 -1352
- package/work-orders/assets/UCM-CHAT-1-ai-chat.html +0 -447
- package/work-orders/assets/UCM-THEME-13-dark-prototype.html +0 -390
- package/work-orders/assets/UCM-THEME-17-type-scale.html +0 -391
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { cp, mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
|
|
2
|
-
import { tmpdir } from 'node:os';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import { gzipSync } from 'node:zlib';
|
|
6
|
-
|
|
7
|
-
import { build } from 'vite';
|
|
8
|
-
import { afterAll, expect, test } from 'vitest';
|
|
9
|
-
|
|
10
|
-
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
11
|
-
const packageManifest = JSON.parse(
|
|
12
|
-
await readFile(path.join(packageRoot, 'package.json'), 'utf8'),
|
|
13
|
-
);
|
|
14
|
-
const packageName = packageManifest.name;
|
|
15
|
-
let temporaryRoot;
|
|
16
|
-
|
|
17
|
-
async function bundlePackageExport({ caseName, exportName, manifestField }) {
|
|
18
|
-
temporaryRoot ||= await mkdtemp(path.join(tmpdir(), 'ui-core-tree-shaking-'));
|
|
19
|
-
const consumerRoot = path.join(temporaryRoot, caseName);
|
|
20
|
-
const installedPackageRoot = path.join(
|
|
21
|
-
consumerRoot,
|
|
22
|
-
'node_modules',
|
|
23
|
-
...packageName.split('/'),
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
await mkdir(installedPackageRoot, { recursive: true });
|
|
27
|
-
await cp(
|
|
28
|
-
path.join(packageRoot, 'dist'),
|
|
29
|
-
path.join(installedPackageRoot, 'dist'),
|
|
30
|
-
{ recursive: true },
|
|
31
|
-
);
|
|
32
|
-
const installedFontRoot = path.join(
|
|
33
|
-
consumerRoot,
|
|
34
|
-
'node_modules',
|
|
35
|
-
'@fontsource',
|
|
36
|
-
'dm-sans',
|
|
37
|
-
);
|
|
38
|
-
await mkdir(path.dirname(installedFontRoot), { recursive: true });
|
|
39
|
-
await cp(
|
|
40
|
-
path.join(packageRoot, 'node_modules', '@fontsource', 'dm-sans'),
|
|
41
|
-
installedFontRoot,
|
|
42
|
-
{ recursive: true },
|
|
43
|
-
);
|
|
44
|
-
await writeFile(
|
|
45
|
-
path.join(installedPackageRoot, 'package.json'),
|
|
46
|
-
JSON.stringify({
|
|
47
|
-
name: packageName,
|
|
48
|
-
version: packageManifest.version,
|
|
49
|
-
[manifestField]: packageManifest[manifestField],
|
|
50
|
-
sideEffects: packageManifest.sideEffects,
|
|
51
|
-
}),
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
const entryPath = path.join(consumerRoot, 'entry.js');
|
|
55
|
-
await writeFile(entryPath, `export { ${exportName} } from '${packageName}';\n`);
|
|
56
|
-
|
|
57
|
-
const result = await build({
|
|
58
|
-
configFile: false,
|
|
59
|
-
logLevel: 'silent',
|
|
60
|
-
root: consumerRoot,
|
|
61
|
-
build: {
|
|
62
|
-
minify: true,
|
|
63
|
-
rollupOptions: {
|
|
64
|
-
input: entryPath,
|
|
65
|
-
preserveEntrySignatures: 'strict',
|
|
66
|
-
external: (id) => (
|
|
67
|
-
id !== packageName
|
|
68
|
-
&& !id.startsWith('@fontsource/dm-sans')
|
|
69
|
-
&& !id.startsWith('.')
|
|
70
|
-
&& !path.isAbsolute(id)
|
|
71
|
-
),
|
|
72
|
-
output: {
|
|
73
|
-
format: 'es',
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
write: false,
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
const outputs = Array.isArray(result)
|
|
80
|
-
? result.flatMap((buildResult) => buildResult.output)
|
|
81
|
-
: result.output;
|
|
82
|
-
const entryChunk = outputs.find((output) => output.type === 'chunk' && output.isEntry);
|
|
83
|
-
|
|
84
|
-
expect(entryChunk, `${manifestField} entry should produce a bundle`).toBeDefined();
|
|
85
|
-
return {
|
|
86
|
-
code: entryChunk.code,
|
|
87
|
-
css: outputs
|
|
88
|
-
.filter((output) => output.type === 'asset' && output.fileName.endsWith('.css'))
|
|
89
|
-
.map((output) => output.source.toString())
|
|
90
|
-
.join('\n'),
|
|
91
|
-
rawBytes: Buffer.byteLength(entryChunk.code),
|
|
92
|
-
gzipBytes: gzipSync(entryChunk.code).byteLength,
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
afterAll(async () => {
|
|
97
|
-
if (temporaryRoot) await rm(temporaryRoot, { recursive: true, force: true });
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
test('built package entries resolve and unused translation bundles tree-shake', async () => {
|
|
101
|
-
const authOnly = await bundlePackageExport({
|
|
102
|
-
caseName: 'auth-main',
|
|
103
|
-
exportName: 'authTranslations',
|
|
104
|
-
manifestField: 'main',
|
|
105
|
-
});
|
|
106
|
-
const aggregate = await bundlePackageExport({
|
|
107
|
-
caseName: 'aggregate-module',
|
|
108
|
-
exportName: 'uiCoreTranslations',
|
|
109
|
-
manifestField: 'module',
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
expect(authOnly.code).toContain('Auth.LOGIN');
|
|
113
|
-
expect(authOnly.code).not.toContain('ChartFrame.LOADING');
|
|
114
|
-
expect(authOnly.css).toContain('DM Sans');
|
|
115
|
-
expect(aggregate.code).toContain('ChartFrame.LOADING');
|
|
116
|
-
expect(aggregate.rawBytes).toBeGreaterThan(authOnly.rawBytes);
|
|
117
|
-
expect(aggregate.gzipBytes).toBeGreaterThan(authOnly.gzipBytes);
|
|
118
|
-
|
|
119
|
-
const rawDelta = aggregate.rawBytes - authOnly.rawBytes;
|
|
120
|
-
const gzipDelta = aggregate.gzipBytes - authOnly.gzipBytes;
|
|
121
|
-
console.info(
|
|
122
|
-
`tree-shaking measurement: auth=${authOnly.rawBytes} B raw/${authOnly.gzipBytes} B gzip; `
|
|
123
|
-
+ `aggregate=${aggregate.rawBytes} B raw/${aggregate.gzipBytes} B gzip; `
|
|
124
|
-
+ `delta=+${rawDelta} B raw/+${gzipDelta} B gzip`,
|
|
125
|
-
);
|
|
126
|
-
}, 15_000);
|
package/tests/realtime.test.jsx
DELETED
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
// @vitest-environment jsdom
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
4
|
-
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
5
|
-
|
|
6
|
-
const feedApi = vi.hoisted(() => ({
|
|
7
|
-
getNotificationFeed: vi.fn(),
|
|
8
|
-
getUnreadCount: vi.fn(),
|
|
9
|
-
markNotifications: vi.fn(),
|
|
10
|
-
}));
|
|
11
|
-
|
|
12
|
-
vi.mock('../src/notifications/feedApi', () => feedApi);
|
|
13
|
-
|
|
14
|
-
import { AuthContext } from '../src/auth/AuthContext';
|
|
15
|
-
import { NotificationsProvider, useNotifications } from '../src/notifications/NotificationsProvider';
|
|
16
|
-
import { useRealtime } from '../src/notifications/realtime';
|
|
17
|
-
|
|
18
|
-
class MockWebSocket {
|
|
19
|
-
static instances = [];
|
|
20
|
-
|
|
21
|
-
constructor(url) {
|
|
22
|
-
this.url = url;
|
|
23
|
-
this.close = vi.fn(() => this.onclose?.());
|
|
24
|
-
MockWebSocket.instances.push(this);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function StreamConsumer({ envelope, testId }) {
|
|
29
|
-
const { subscribe } = useRealtime();
|
|
30
|
-
const [received, setReceived] = React.useState([]);
|
|
31
|
-
|
|
32
|
-
React.useEffect(
|
|
33
|
-
() => subscribe(envelope, (data) => setReceived((prev) => [...prev, data])),
|
|
34
|
-
[subscribe, envelope],
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
return <output data-testid={testId}>{JSON.stringify(received)}</output>;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function ReconnectConsumer() {
|
|
41
|
-
const { onReconnect } = useRealtime();
|
|
42
|
-
const [count, setCount] = React.useState(0);
|
|
43
|
-
React.useEffect(() => onReconnect(() => setCount((current) => current + 1)), [onReconnect]);
|
|
44
|
-
return <output data-testid="reconnect-count">{count}</output>;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function NotificationsConsumer() {
|
|
48
|
-
const notifications = useNotifications();
|
|
49
|
-
return (
|
|
50
|
-
<>
|
|
51
|
-
<output data-testid="notifications">{JSON.stringify(notifications.notifications)}</output>
|
|
52
|
-
<output data-testid="unread-count">{notifications.unreadCount}</output>
|
|
53
|
-
<output data-testid="context-keys">{JSON.stringify(Object.keys(notifications).sort())}</output>
|
|
54
|
-
</>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function renderWithStreams({ streams = [], user = { id: 4 } } = {}) {
|
|
59
|
-
return render(
|
|
60
|
-
<AuthContext.Provider value={{ user }}>
|
|
61
|
-
<NotificationsProvider>
|
|
62
|
-
<NotificationsConsumer />
|
|
63
|
-
{streams.map(({ envelope, testId }) => (
|
|
64
|
-
<StreamConsumer key={testId} envelope={envelope} testId={testId} />
|
|
65
|
-
))}
|
|
66
|
-
</NotificationsProvider>
|
|
67
|
-
</AuthContext.Provider>,
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function received(testId) {
|
|
72
|
-
return JSON.parse(screen.getByTestId(testId).textContent);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
describe('realtime primitive (NOTIF-13)', () => {
|
|
76
|
-
afterEach(() => {
|
|
77
|
-
cleanup();
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
beforeEach(() => {
|
|
81
|
-
vi.clearAllMocks();
|
|
82
|
-
MockWebSocket.instances = [];
|
|
83
|
-
vi.stubGlobal('WebSocket', MockWebSocket);
|
|
84
|
-
feedApi.getNotificationFeed.mockResolvedValue({ results: [] });
|
|
85
|
-
feedApi.getUnreadCount.mockResolvedValue({ count: 0 });
|
|
86
|
-
feedApi.markNotifications.mockResolvedValue({ updated: 1 });
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('ignores an unknown/unsubscribed envelope type — feed and unreadCount untouched', async () => {
|
|
90
|
-
renderWithStreams();
|
|
91
|
-
await waitFor(() => expect(MockWebSocket.instances).toHaveLength(1));
|
|
92
|
-
|
|
93
|
-
MockWebSocket.instances[0].onmessage({ data: JSON.stringify({
|
|
94
|
-
envelope: 'message',
|
|
95
|
-
type: 'chat.new',
|
|
96
|
-
body: 'hello',
|
|
97
|
-
}) });
|
|
98
|
-
|
|
99
|
-
expect(screen.getByTestId('unread-count').textContent).toBe('0');
|
|
100
|
-
expect(currentNotificationsAreEmpty()).toBe(true);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
function currentNotificationsAreEmpty() {
|
|
104
|
-
return JSON.parse(screen.getByTestId('notifications').textContent).length === 0;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
it('routes two subscribers on distinct envelope types from one socket, each seeing only their own', async () => {
|
|
108
|
-
renderWithStreams({ streams: [
|
|
109
|
-
{ envelope: 'message', testId: 'message-stream' },
|
|
110
|
-
{ envelope: 'other', testId: 'other-stream' },
|
|
111
|
-
] });
|
|
112
|
-
await waitFor(() => expect(MockWebSocket.instances).toHaveLength(1));
|
|
113
|
-
|
|
114
|
-
MockWebSocket.instances[0].onmessage({ data: JSON.stringify({ envelope: 'message', body: 'a' }) });
|
|
115
|
-
MockWebSocket.instances[0].onmessage({ data: JSON.stringify({ envelope: 'other', body: 'b' }) });
|
|
116
|
-
|
|
117
|
-
await waitFor(() => expect(received('message-stream')).toHaveLength(1));
|
|
118
|
-
expect(received('message-stream')[0]).toEqual(expect.objectContaining({ body: 'a' }));
|
|
119
|
-
expect(received('other-stream')).toHaveLength(1);
|
|
120
|
-
expect(received('other-stream')[0]).toEqual(expect.objectContaining({ body: 'b' }));
|
|
121
|
-
expect(MockWebSocket.instances).toHaveLength(1);
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
it('unsubscribe stops delivery for that subscriber without affecting others', async () => {
|
|
125
|
-
function Harness() {
|
|
126
|
-
const { subscribe } = useRealtime();
|
|
127
|
-
const [messageReceived, setMessageReceived] = React.useState([]);
|
|
128
|
-
const [otherReceived, setOtherReceived] = React.useState([]);
|
|
129
|
-
const [messageSubscribed, setMessageSubscribed] = React.useState(true);
|
|
130
|
-
|
|
131
|
-
React.useEffect(() => {
|
|
132
|
-
if (!messageSubscribed) return undefined;
|
|
133
|
-
return subscribe('message', (data) => setMessageReceived((prev) => [...prev, data]));
|
|
134
|
-
}, [subscribe, messageSubscribed]);
|
|
135
|
-
|
|
136
|
-
React.useEffect(
|
|
137
|
-
() => subscribe('other', (data) => setOtherReceived((prev) => [...prev, data])),
|
|
138
|
-
[subscribe],
|
|
139
|
-
);
|
|
140
|
-
|
|
141
|
-
return (
|
|
142
|
-
<>
|
|
143
|
-
<output data-testid="message-received">{JSON.stringify(messageReceived)}</output>
|
|
144
|
-
<output data-testid="other-received">{JSON.stringify(otherReceived)}</output>
|
|
145
|
-
<button onClick={() => setMessageSubscribed(false)}>unsubscribe-message</button>
|
|
146
|
-
</>
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
const { unmount } = render(
|
|
151
|
-
<AuthContext.Provider value={{ user: { id: 4 } }}>
|
|
152
|
-
<NotificationsProvider>
|
|
153
|
-
<Harness />
|
|
154
|
-
</NotificationsProvider>
|
|
155
|
-
</AuthContext.Provider>,
|
|
156
|
-
);
|
|
157
|
-
await waitFor(() => expect(MockWebSocket.instances).toHaveLength(1));
|
|
158
|
-
|
|
159
|
-
fireEvent.click(screen.getByRole('button', { name: 'unsubscribe-message' }));
|
|
160
|
-
|
|
161
|
-
MockWebSocket.instances[0].onmessage({ data: JSON.stringify({ envelope: 'message', body: 'after-unsub' }) });
|
|
162
|
-
MockWebSocket.instances[0].onmessage({ data: JSON.stringify({ envelope: 'other', body: 'still-alive' }) });
|
|
163
|
-
|
|
164
|
-
await waitFor(() => expect(received('other-received')).toHaveLength(1));
|
|
165
|
-
expect(received('message-received')).toHaveLength(0);
|
|
166
|
-
expect(received('other-received')[0]).toEqual(expect.objectContaining({ body: 'still-alive' }));
|
|
167
|
-
|
|
168
|
-
unmount();
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
it('keeps a subscriber registered across a close/backoff/reopen cycle with no re-registration', async () => {
|
|
172
|
-
vi.useFakeTimers();
|
|
173
|
-
try {
|
|
174
|
-
renderWithStreams({ streams: [{ envelope: 'message', testId: 'message-stream' }] });
|
|
175
|
-
await vi.waitFor(() => expect(MockWebSocket.instances).toHaveLength(1));
|
|
176
|
-
|
|
177
|
-
const firstSocket = MockWebSocket.instances[0];
|
|
178
|
-
firstSocket.onclose();
|
|
179
|
-
await vi.advanceTimersByTimeAsync(1_000);
|
|
180
|
-
|
|
181
|
-
expect(MockWebSocket.instances).toHaveLength(2);
|
|
182
|
-
MockWebSocket.instances[1].onmessage({ data: JSON.stringify({ envelope: 'message', body: 'after-reopen' }) });
|
|
183
|
-
|
|
184
|
-
await vi.waitFor(() => expect(received('message-stream')).toHaveLength(1));
|
|
185
|
-
expect(received('message-stream')[0]).toEqual(expect.objectContaining({ body: 'after-reopen' }));
|
|
186
|
-
} finally {
|
|
187
|
-
vi.useRealTimers();
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
it('additively signals consumers when a closed connection re-establishes', async () => {
|
|
192
|
-
vi.useFakeTimers();
|
|
193
|
-
try {
|
|
194
|
-
render(
|
|
195
|
-
<AuthContext.Provider value={{ user: { id: 4 } }}>
|
|
196
|
-
<NotificationsProvider><ReconnectConsumer /></NotificationsProvider>
|
|
197
|
-
</AuthContext.Provider>,
|
|
198
|
-
);
|
|
199
|
-
await vi.waitFor(() => expect(MockWebSocket.instances).toHaveLength(1));
|
|
200
|
-
MockWebSocket.instances[0].onopen();
|
|
201
|
-
expect(screen.getByTestId('reconnect-count').textContent).toBe('0');
|
|
202
|
-
MockWebSocket.instances[0].onclose();
|
|
203
|
-
await vi.advanceTimersByTimeAsync(1_000);
|
|
204
|
-
MockWebSocket.instances[1].onopen();
|
|
205
|
-
await vi.waitFor(() => expect(screen.getByTestId('reconnect-count').textContent).toBe('1'));
|
|
206
|
-
} finally {
|
|
207
|
-
vi.useRealTimers();
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
it("NotificationsProvider's public context value is unchanged", async () => {
|
|
212
|
-
renderWithStreams();
|
|
213
|
-
await waitFor(() => expect(MockWebSocket.instances).toHaveLength(1));
|
|
214
|
-
|
|
215
|
-
expect(JSON.parse(screen.getByTestId('context-keys').textContent)).toEqual(
|
|
216
|
-
['markDismissed', 'markDone', 'markSeen', 'notifications', 'refresh', 'unreadCount'].sort(),
|
|
217
|
-
);
|
|
218
|
-
});
|
|
219
|
-
});
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { resolveErrorText } from '../src/utils/resolveErrorText';
|
|
3
|
-
|
|
4
|
-
function makeI18n(values) {
|
|
5
|
-
return {
|
|
6
|
-
exists: (key) => Object.hasOwn(values, key),
|
|
7
|
-
t: (key) => values[key] ?? `missing:${key}`,
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
describe('resolveErrorText', () => {
|
|
12
|
-
it('prefers an explicit backend i18nKey over every lower-priority source', () => {
|
|
13
|
-
const i18n = makeI18n({
|
|
14
|
-
'Auth.explicit': 'Explicit text',
|
|
15
|
-
'Auth.field.email.invalid': 'Field text',
|
|
16
|
-
invalid: 'Code text',
|
|
17
|
-
'Auth.DEFAULT': 'Default text',
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
expect(resolveErrorText(i18n, {
|
|
21
|
-
i18nKey: 'Auth.explicit',
|
|
22
|
-
field: 'email',
|
|
23
|
-
code: 'invalid',
|
|
24
|
-
backendMessage: 'Backend text',
|
|
25
|
-
}, 'Auth.DEFAULT')).toBe('Explicit text');
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('uses the allauth param as a field-specific key before the code', () => {
|
|
29
|
-
const i18n = makeI18n({
|
|
30
|
-
'Auth.field.email.invalid': 'Field text',
|
|
31
|
-
invalid: 'Code text',
|
|
32
|
-
'Auth.DEFAULT': 'Default text',
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
expect(resolveErrorText(i18n, {
|
|
36
|
-
field: 'email',
|
|
37
|
-
code: 'invalid',
|
|
38
|
-
backendMessage: 'Backend text',
|
|
39
|
-
}, 'Auth.DEFAULT')).toBe('Field text');
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('uses the code catalogue entry when no field entry exists', () => {
|
|
43
|
-
const i18n = makeI18n({
|
|
44
|
-
email_password_mismatch: 'Code text',
|
|
45
|
-
'Auth.DEFAULT': 'Default text',
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
expect(resolveErrorText(i18n, {
|
|
49
|
-
field: 'email',
|
|
50
|
-
code: 'email_password_mismatch',
|
|
51
|
-
backendMessage: 'Backend text',
|
|
52
|
-
}, 'Auth.DEFAULT')).toBe('Code text');
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('uses the backend message before the caller default', () => {
|
|
56
|
-
const i18n = makeI18n({ 'Auth.DEFAULT': 'Default text' });
|
|
57
|
-
|
|
58
|
-
expect(resolveErrorText(i18n, {
|
|
59
|
-
code: 'unknown_backend_code',
|
|
60
|
-
backendMessage: 'Backend text',
|
|
61
|
-
}, 'Auth.DEFAULT')).toBe('Backend text');
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('uses the caller default instead of ever returning an unknown raw code', () => {
|
|
65
|
-
const i18n = makeI18n({ 'Auth.DEFAULT': 'Default text' });
|
|
66
|
-
|
|
67
|
-
expect(resolveErrorText(i18n, {
|
|
68
|
-
code: 'unknown_backend_code',
|
|
69
|
-
}, 'Auth.DEFAULT')).toBe('Default text');
|
|
70
|
-
expect(resolveErrorText(i18n, null, 'Auth.DEFAULT')).toBe('Default text');
|
|
71
|
-
});
|
|
72
|
-
});
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { selectActiveSteps } from '../src/onboarding/stepSelection';
|
|
3
|
-
|
|
4
|
-
const context = {
|
|
5
|
-
user: { first_name: 'Ada', last_name: 'Lovelace', accepted_convenience_cookies: true },
|
|
6
|
-
pushState: { supported: true, subscribed: false },
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const step = (id, condition, options = {}) => ({
|
|
10
|
-
id,
|
|
11
|
-
condition,
|
|
12
|
-
persistDismissed: options.persistDismissed ?? false,
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
describe('selectActiveSteps', () => {
|
|
16
|
-
it('excludes a config-disabled universal step', () => {
|
|
17
|
-
const result = selectActiveSteps([step('cookie_consent', () => true)], { cookie_consent: false }, context);
|
|
18
|
-
expect(result).toEqual([]);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('excludes a persistently dismissed browser push step', () => {
|
|
22
|
-
const result = selectActiveSteps(
|
|
23
|
-
[step('browser_push', () => true, { persistDismissed: true })],
|
|
24
|
-
{ browser_push: true },
|
|
25
|
-
context,
|
|
26
|
-
new Set(['browser_push']),
|
|
27
|
-
);
|
|
28
|
-
expect(result).toEqual([]);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('filters steps whose condition is not met', () => {
|
|
32
|
-
const result = selectActiveSteps(
|
|
33
|
-
[step('complete_name', (ctx) => !ctx.user.first_name)],
|
|
34
|
-
{ complete_name: true },
|
|
35
|
-
context,
|
|
36
|
-
);
|
|
37
|
-
expect(result).toEqual([]);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('preserves descriptor order for active universal steps', () => {
|
|
41
|
-
const steps = [
|
|
42
|
-
step('cookie_consent', () => true),
|
|
43
|
-
step('complete_name', () => true),
|
|
44
|
-
step('browser_push', () => true, { persistDismissed: true }),
|
|
45
|
-
];
|
|
46
|
-
const result = selectActiveSteps(steps, {
|
|
47
|
-
cookie_consent: true,
|
|
48
|
-
complete_name: true,
|
|
49
|
-
browser_push: true,
|
|
50
|
-
}, context);
|
|
51
|
-
expect(result.map((item) => item.id)).toEqual(['cookie_consent', 'complete_name', 'browser_push']);
|
|
52
|
-
});
|
|
53
|
-
});
|