corpushub-design-system 0.0.10 → 0.0.12

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.
@@ -34,6 +34,12 @@ export declare function resolveBrandLogoShort(options?: {
34
34
  brandId?: string;
35
35
  origin?: string;
36
36
  }): string;
37
+ /**
38
+ * Brand YouTube channel URL for shell CTAs (Help modal, etc.).
39
+ */
40
+ export declare function resolveBrandYoutube(options?: {
41
+ brandId?: string;
42
+ }): string;
37
43
  /**
38
44
  * Resolve platform branding for a front-end app.
39
45
  * Pass `options` from Vite plugins (Node) where `import.meta.env` may be unavailable.
@@ -35,11 +35,11 @@ export function brandAssetBase(brandId, originRaw) {
35
35
  return `${origin}/brands/${brandId}`;
36
36
  }
37
37
  function resolveBrandId(raw) {
38
- return raw?.toLowerCase() === 'corpushub' ? 'corpushub' : 'tycho';
38
+ return raw?.toLowerCase() === 'tycho' ? 'tycho' : 'corpushub';
39
39
  }
40
40
  function readEnvBrandId() {
41
41
  try {
42
- return import.meta.env?.VITE_APP_BRAND;
42
+ return import.meta.env.VITE_APP_BRAND;
43
43
  }
44
44
  catch {
45
45
  return undefined;
@@ -47,7 +47,7 @@ function readEnvBrandId() {
47
47
  }
48
48
  function readEnvOrigin() {
49
49
  try {
50
- return import.meta.env?.VITE_APP_ORIGIN;
50
+ return import.meta.env.VITE_APP_ORIGIN;
51
51
  }
52
52
  catch {
53
53
  return undefined;
@@ -71,6 +71,13 @@ export function resolveBrandLogoShort(options) {
71
71
  const origin = options?.origin ?? readEnvOrigin();
72
72
  return `${brandAssetBase(id, origin)}/logo-short.png`;
73
73
  }
74
+ /**
75
+ * Brand YouTube channel URL for shell CTAs (Help modal, etc.).
76
+ */
77
+ export function resolveBrandYoutube(options) {
78
+ const id = resolveBrandId(options?.brandId ?? readEnvBrandId());
79
+ return YOUTUBE_BY_BRAND[id];
80
+ }
74
81
  /**
75
82
  * Resolve platform branding for a front-end app.
76
83
  * Pass `options` from Vite plugins (Node) where `import.meta.env` may be unavailable.
@@ -9,7 +9,7 @@ export type { TokenAuthResponse } from './auth/authApi';
9
9
  export { commonLocalization, commonResources, featureResources, mergeResources, } from './Localization';
10
10
  export { applyAuthErrorHandling, createApiClient, dispatchAccessDeniedError, dispatchApiError, dispatchClientError, dispatchServerApiError, isAccessDeniedApiError, isHandledApiError, isHandledAuthError, markApiErrorHandled, markAuthErrorHandled, parserApiBase, lexiconApiBase, platformApi, resolveAccessDeniedMessage, } from './api';
11
11
  export type { ApiErrorHandled, ApplyAuthErrorHandlingOptions, AuthErrorHandled, AuthErrorHandling, CreateApiClientOptions, ServerErrorHandling, } from './api';
12
- export { brandAssetBase, brandFromEnv, createBrand, resolveBrandLogo, resolveBrandLogoShort, } from './brand';
12
+ export { brandAssetBase, brandFromEnv, createBrand, resolveBrandLogo, resolveBrandLogoShort, resolveBrandYoutube, } from './brand';
13
13
  export type { AppCode, BrandConfig, BrandId } from './brand';
14
14
  export { default as ProfileService } from './services/ProfileService';
15
15
  export { getCommonDispatch, registerCommonDispatch, } from './store/commonDispatchBridge';
@@ -7,7 +7,7 @@ export { buildCrossAppRedirectUrl, clearLocalhostJwtHandoff, isLocalDevHost, per
7
7
  export { installAuthRefreshInterceptor } from './auth/installAuthRefreshInterceptor';
8
8
  export { commonLocalization, commonResources, featureResources, mergeResources, } from './Localization';
9
9
  export { applyAuthErrorHandling, createApiClient, dispatchAccessDeniedError, dispatchApiError, dispatchClientError, dispatchServerApiError, isAccessDeniedApiError, isHandledApiError, isHandledAuthError, markApiErrorHandled, markAuthErrorHandled, parserApiBase, lexiconApiBase, platformApi, resolveAccessDeniedMessage, } from './api';
10
- export { brandAssetBase, brandFromEnv, createBrand, resolveBrandLogo, resolveBrandLogoShort, } from './brand';
10
+ export { brandAssetBase, brandFromEnv, createBrand, resolveBrandLogo, resolveBrandLogoShort, resolveBrandYoutube, } from './brand';
11
11
  export { default as ProfileService } from './services/ProfileService';
12
12
  export { getCommonDispatch, registerCommonDispatch, } from './store/commonDispatchBridge';
13
13
  export { TOUR_FALLBACK_LOCALE, TOUR_LOCALES, buildAnchorMap, buildDriveSteps, createTourDriver, defaultMatchPathnames, flattenWorkflowSteps, getWorkflowsForPath, hasMatchingWorkflow, loadKnowledgeBase, localizeKnowledgeBase, pickLocalizedString, resolveAnchor, resolveAnchorById, resolveTourLocale, useDriverTour, waitForSelector, } from './tour';
@@ -7,12 +7,15 @@ export declare const HelpTexts: {
7
7
  'title.autoOpen': string;
8
8
  'title.resources': string;
9
9
  'title.feedback': string;
10
+ 'title.youtube': string;
10
11
  'button.tour': string;
11
12
  'button.tour.stop': string;
12
13
  'button.updateLiveTourPreference': string;
14
+ 'button.youtube': string;
13
15
  'description.tutorials': string;
14
16
  'description.tour': string;
15
17
  'description.feedback': string;
18
+ 'description.youtube': string;
16
19
  'tour.step.1': string;
17
20
  'tour.step.2': string;
18
21
  'tour.step.3': string;
@@ -30,12 +33,15 @@ export declare const HelpTexts: {
30
33
  'title.autoOpen': string;
31
34
  'title.resources': string;
32
35
  'title.feedback': string;
36
+ 'title.youtube': string;
33
37
  'button.tour': string;
34
38
  'button.tour.stop': string;
35
39
  'button.updateLiveTourPreference': string;
40
+ 'button.youtube': string;
36
41
  'description.tutorials': string;
37
42
  'description.tour': string;
38
43
  'description.feedback': string;
44
+ 'description.youtube': string;
39
45
  'tour.step.1': string;
40
46
  'tour.step.2': string;
41
47
  'tour.step.3': string;
@@ -53,12 +59,15 @@ export declare const HelpTexts: {
53
59
  'title.autoOpen': string;
54
60
  'title.resources': string;
55
61
  'title.feedback': string;
62
+ 'title.youtube': string;
56
63
  'button.tour': string;
57
64
  'button.tour.stop': string;
58
65
  'button.updateLiveTourPreference': string;
66
+ 'button.youtube': string;
59
67
  'description.tutorials': string;
60
68
  'description.tour': string;
61
69
  'description.feedback': string;
70
+ 'description.youtube': string;
62
71
  'tour.step.1': string;
63
72
  'tour.step.2': string;
64
73
  'tour.step.3': string;
@@ -7,12 +7,15 @@ export const HelpTexts = {
7
7
  'title.autoOpen': 'Enable Auto-Open',
8
8
  'title.resources': 'Resources',
9
9
  'title.feedback': 'Send feedback',
10
+ 'title.youtube': 'Watch on YouTube',
10
11
  'button.tour': 'Start Live Tour',
11
12
  'button.tour.stop': 'Stop Live Tour',
12
13
  'button.updateLiveTourPreference': 'Update preference',
14
+ 'button.youtube': 'Open channel',
13
15
  'description.tutorials': 'Access our comprehensive tutorials and documentation',
14
16
  'description.tour': 'Walk through the main areas of this page with an interactive guided tour.',
15
17
  'description.feedback': 'Comments, bugs, ideas — we read every message and include page context automatically.',
18
+ 'description.youtube': 'Short walkthroughs, tips, and product updates — jump into the channel.',
16
19
  'tour.step.1': 'Highlights key controls on the current page',
17
20
  'tour.step.2': 'Explains what each area is for',
18
21
  'tour.step.3': 'Takes only a couple of minutes',
@@ -30,12 +33,15 @@ export const HelpTexts = {
30
33
  'title.autoOpen': 'Ativar Abertura Automática',
31
34
  'title.resources': 'Recursos',
32
35
  'title.feedback': 'Enviar feedback',
36
+ 'title.youtube': 'Assista no YouTube',
33
37
  'button.tour': 'Iniciar Tour ao Vivo',
34
38
  'button.tour.stop': 'Parar Tour ao Vivo',
35
39
  'button.updateLiveTourPreference': 'Atualizar preferência',
40
+ 'button.youtube': 'Abrir canal',
36
41
  'description.tutorials': 'Acesse nossos tutoriais abrangentes e documentação',
37
42
  'description.tour': 'Percorra as áreas principais desta página com um tour guiado interativo.',
38
43
  'description.feedback': 'Comentários, bugs, ideias — lemos cada mensagem e incluímos o contexto da página automaticamente.',
44
+ 'description.youtube': 'Tutoriais curtos, dicas e novidades do produto — confira o canal.',
39
45
  'tour.step.1': 'Destaca os controles principais da página atual',
40
46
  'tour.step.2': 'Explica para que serve cada área',
41
47
  'tour.step.3': 'Leva só alguns minutos',
@@ -53,12 +59,15 @@ export const HelpTexts = {
53
59
  'title.autoOpen': 'Abilita Apertura Automatica',
54
60
  'title.resources': 'Risorse',
55
61
  'title.feedback': 'Invia feedback',
62
+ 'title.youtube': 'Guarda su YouTube',
56
63
  'button.tour': 'Avvia Tour Interattivo',
57
64
  'button.tour.stop': 'Ferma Tour Interattivo',
58
65
  'button.updateLiveTourPreference': 'Aggiorna la preferenza',
66
+ 'button.youtube': 'Apri il canale',
59
67
  'description.tutorials': 'Accedi ai nostri tutorial completi e alla documentazione',
60
68
  'description.tour': 'Esplora le aree principali di questa pagina con un tour guidato interattivo.',
61
69
  'description.feedback': 'Commenti, bug, idee — leggiamo ogni messaggio e includiamo automaticamente il contesto della pagina.',
70
+ 'description.youtube': 'Tutorial brevi, consigli e novità sul prodotto — apri il canale.',
62
71
  'tour.step.1': 'Evidenzia i controlli chiave della pagina corrente',
63
72
  'tour.step.2': 'Spiega a cosa serve ciascuna area',
64
73
  'tour.step.3': 'Richiede solo un paio di minuti',
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Best-effort tab screenshot for error reports.
3
- * Hides the report modal during capture so it is not in the image.
3
+ * Skips open MUI modals (incl. Help Center) and toasts so the page underneath is captured.
4
4
  */
5
5
  export declare function captureTabScreenshot(): Promise<string | null>;
@@ -1,21 +1,9 @@
1
1
  import html2canvas from 'html2canvas';
2
2
  const MAX_WIDTH = 1600;
3
3
  const JPEG_QUALITY = 0.85;
4
- function hideReportUi() {
5
- const hidden = [];
6
- const modal = document.querySelector('.server-error-report-modal');
7
- const root = modal?.closest('.MuiModal-root') ||
8
- modal;
9
- if (root) {
10
- hidden.push({ el: root, display: root.style.display });
11
- root.style.display = 'none';
12
- }
13
- return hidden;
14
- }
15
- function restoreHidden(hidden) {
16
- hidden.forEach(({ el, display }) => {
17
- el.style.display = display;
18
- });
4
+ function shouldIgnoreElement(el) {
5
+ return (el.classList.contains('MuiModal-root') ||
6
+ el.classList.contains('Toastify'));
19
7
  }
20
8
  function toJpegDataUrl(canvas) {
21
9
  let out = canvas;
@@ -33,24 +21,21 @@ function toJpegDataUrl(canvas) {
33
21
  }
34
22
  /**
35
23
  * Best-effort tab screenshot for error reports.
36
- * Hides the report modal during capture so it is not in the image.
24
+ * Skips open MUI modals (incl. Help Center) and toasts so the page underneath is captured.
37
25
  */
38
26
  export async function captureTabScreenshot() {
39
27
  if (typeof document === 'undefined' || !document.body) {
40
28
  return null;
41
29
  }
42
- const hidden = hideReportUi();
43
30
  try {
44
31
  const canvas = await html2canvas(document.body, {
45
32
  logging: false,
46
33
  useCORS: true,
34
+ ignoreElements: shouldIgnoreElement,
47
35
  });
48
36
  return toJpegDataUrl(canvas);
49
37
  }
50
38
  catch {
51
39
  return null;
52
40
  }
53
- finally {
54
- restoreHidden(hidden);
55
- }
56
41
  }
@@ -42,7 +42,7 @@ export default function AsyncSelectField({ className, attr, label, createdForm,
42
42
  }
43
43
  }, []);
44
44
  const hasError = () => !!createdForm.formState.errors[attr];
45
- const getClassNames = cx('ds-select-text', className, {
45
+ const getClassNames = cx('ds-async-select-text', className, {
46
46
  disabled: disabled,
47
47
  });
48
48
  useEffect(() => {
@@ -95,7 +95,7 @@ export default function AsyncSelectField({ className, attr, label, createdForm,
95
95
  field.onChange(trimmed);
96
96
  onChange?.(attr, trimmed);
97
97
  };
98
- return (_jsxs("div", { className: getClassNames, children: [_jsxs("div", { className: "ds-select-text__autofill-trap", "aria-hidden": "true", children: [_jsx("input", { type: "text", tabIndex: -1, autoComplete: "username", name: `${autoCompleteToken}-username`, defaultValue: "" }), _jsx("input", { type: "password", tabIndex: -1, autoComplete: "new-password", name: `${autoCompleteToken}-password`, defaultValue: "" })] }), _jsx(Controller, { name: fieldName, control: createdForm.control, render: ({ field }) => (_jsxs(ThemeProvider, { theme: selectAutocompleteTheme(outerTheme, {
98
+ return (_jsxs("div", { className: getClassNames, children: [_jsxs("div", { className: "ds-async-select-text__autofill-trap", "aria-hidden": "true", children: [_jsx("input", { type: "text", tabIndex: -1, autoComplete: "username", name: `${autoCompleteToken}-username`, defaultValue: "" }), _jsx("input", { type: "password", tabIndex: -1, autoComplete: "new-password", name: `${autoCompleteToken}-password`, defaultValue: "" })] }), _jsx(Controller, { name: fieldName, control: createdForm.control, render: ({ field }) => (_jsxs(ThemeProvider, { theme: selectAutocompleteTheme(outerTheme, {
99
99
  hasLabel: !!label,
100
100
  }), children: [_jsx(FormControl, { fullWidth: true, variant: "filled", disabled: disabled, children: _jsx(Autocomplete, { multiple: multiple, freeSolo: freeSolo, disableCloseOnSelect: multiple, value: field.value ?? (multiple ? [] : null), onChange: (_event, newValue) => {
101
101
  field.onChange(newValue);
@@ -1,32 +1,32 @@
1
- .ds-select-text {
2
- width: 100%;
3
- position: relative;
4
-
5
- &.disabled {
6
- color: var(--text-on-disabled);
7
- cursor: not-allowed;
8
-
9
- input {
10
- cursor: not-allowed;
11
- }
12
- }
13
-
14
- &__autofill-trap {
15
- position: absolute;
16
- width: 0;
17
- height: 0;
18
- overflow: hidden;
19
- opacity: 0;
20
- pointer-events: none;
21
- }
22
- }
23
-
24
- .validation-message {
25
- @include helper-small-1;
26
- margin-top: 4px;
27
-
28
- &.error {
29
- color: var(--text-error);
30
- }
31
- }
1
+ .ds-async-select-text {
2
+ width: 100%;
3
+ position: relative;
4
+
5
+ &.disabled {
6
+ color: var(--text-on-disabled);
7
+ cursor: not-allowed;
8
+
9
+ input {
10
+ cursor: not-allowed;
11
+ }
12
+ }
13
+
14
+ &__autofill-trap {
15
+ position: absolute;
16
+ width: 0;
17
+ height: 0;
18
+ overflow: hidden;
19
+ opacity: 0;
20
+ pointer-events: none;
21
+ }
22
+ }
23
+
24
+ .validation-message {
25
+ @include helper-small-1;
26
+ margin-top: 4px;
27
+
28
+ &.error {
29
+ color: var(--text-error);
30
+ }
31
+ }
32
32
 
@@ -1,11 +1,18 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useTranslation } from 'react-i18next';
3
+ import { resolveBrandYoutube } from '../../../configs/brand';
3
4
  import { Button } from '../../../primitives';
5
+ import youtubeMark from '../HeaderApps/youtube.png';
4
6
  export default function HelpModalSideColumn({ helpActions, onClose }) {
5
7
  const { t } = useTranslation('help');
8
+ const youtubeUrl = resolveBrandYoutube();
6
9
  const handleCustomAction = (item) => {
7
10
  item.action();
8
11
  onClose();
9
12
  };
10
- return (_jsx("div", { className: "help-modal__side", children: helpActions.length > 0 ? (_jsxs("section", { className: "help-modal__resources", "aria-labelledby": "help-resources-title", children: [_jsx("h2", { id: "help-resources-title", className: "help-modal__section-title", children: t('title.resources') }), _jsx("ul", { className: "help-modal__action-list", children: helpActions.map((item, idx) => (_jsxs("li", { className: "help-modal__action-item", children: [_jsxs("div", { className: "help-modal__action-copy", children: [_jsx("div", { className: "help-modal__action-title", children: item.title }), _jsx("div", { className: "help-modal__action-desc", children: item.desc })] }), _jsx(Button, { text: t('button.open'), size: "x-small", mode: "outlined", icon: "keyboard_arrow_right", onClick: () => handleCustomAction(item) })] }, idx))) })] })) : (_jsxs("section", { className: "help-modal__resources help-modal__resources--empty", children: [_jsx("h2", { className: "help-modal__section-title", children: t('title.resources') }), _jsx("p", { className: "help-modal__section-desc", children: t('resources.empty') })] })) }));
13
+ const handleYoutubeOpen = () => {
14
+ window.open(youtubeUrl, '_blank', 'noopener,noreferrer');
15
+ onClose();
16
+ };
17
+ return (_jsxs("div", { className: "help-modal__side", children: [helpActions.length > 0 ? (_jsxs("section", { className: "help-modal__resources", "aria-labelledby": "help-resources-title", children: [_jsx("h2", { id: "help-resources-title", className: "help-modal__section-title", children: t('title.resources') }), _jsx("ul", { className: "help-modal__action-list", children: helpActions.map((item, idx) => (_jsxs("li", { className: "help-modal__action-item", children: [_jsxs("div", { className: "help-modal__action-copy", children: [_jsx("div", { className: "help-modal__action-title", children: item.title }), _jsx("div", { className: "help-modal__action-desc", children: item.desc })] }), _jsx(Button, { text: t('button.open'), size: "x-small", mode: "outlined", icon: "keyboard_arrow_right", onClick: () => handleCustomAction(item) })] }, idx))) })] })) : (_jsxs("section", { className: "help-modal__resources help-modal__resources--empty", children: [_jsx("h2", { className: "help-modal__section-title", children: t('title.resources') }), _jsx("p", { className: "help-modal__section-desc", children: t('resources.empty') })] })), youtubeUrl && (_jsxs("section", { className: "help-modal__youtube", "aria-labelledby": "help-youtube-title", children: [_jsxs("div", { className: "help-modal__youtube-copy", children: [_jsx("h2", { id: "help-youtube-title", className: "help-modal__youtube-title", children: t('title.youtube') }), _jsx("p", { className: "help-modal__youtube-desc", children: t('description.youtube') }), _jsx(Button, { text: t('button.youtube'), size: "small", icon: "open_in_new", onClick: handleYoutubeOpen })] }), _jsx("div", { className: "help-modal__youtube-media", children: _jsx("img", { src: youtubeMark, alt: "", className: "help-modal__youtube-mark" }) })] }))] }));
11
18
  }
@@ -109,10 +109,85 @@
109
109
  &__side {
110
110
  display: flex;
111
111
  flex-direction: column;
112
+ gap: var(--spacing-200);
112
113
  min-height: 0;
113
114
  overflow-y: auto;
114
115
  }
115
116
 
117
+ &__youtube {
118
+ display: grid;
119
+ grid-template-columns: minmax(0, 1fr) auto;
120
+ gap: var(--spacing-200);
121
+ align-items: center;
122
+ padding: 16px;
123
+ border: 1px solid rgba(255, 255, 255, 0.08);
124
+ border-radius: var(--radius-200);
125
+ background:
126
+ radial-gradient(
127
+ 120% 140% at 100% 0%,
128
+ rgba(255, 0, 0, 0.28) 0%,
129
+ transparent 55%
130
+ ),
131
+ linear-gradient(145deg, #1a1c22 0%, #111318 100%);
132
+ color: #f5f6f8;
133
+ overflow: hidden;
134
+ animation: help-youtube-rise 320ms ease-out;
135
+ }
136
+
137
+ &__youtube-copy {
138
+ display: flex;
139
+ flex-direction: column;
140
+ gap: var(--spacing-100);
141
+ min-width: 0;
142
+ }
143
+
144
+ &__youtube-title {
145
+ margin: 0;
146
+ @include subtitle-medium-2;
147
+ color: #ffffff;
148
+ }
149
+
150
+ &__youtube-desc {
151
+ margin: 0;
152
+ @include body-medium-1;
153
+ color: rgba(245, 246, 248, 0.78);
154
+ }
155
+
156
+ &__youtube-media {
157
+ display: flex;
158
+ align-items: center;
159
+ justify-content: center;
160
+ flex-shrink: 0;
161
+ }
162
+
163
+ &__youtube-mark {
164
+ display: block;
165
+ width: 56px;
166
+ height: 56px;
167
+ object-fit: contain;
168
+ filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
169
+ transition: transform 180ms ease, filter 180ms ease;
170
+ }
171
+
172
+ &__youtube:hover &__youtube-mark {
173
+ transform: translateY(-2px) scale(1.04);
174
+ filter: drop-shadow(0 10px 18px rgba(255, 0, 0, 0.28));
175
+ }
176
+
177
+ &__youtube .ds-button.filled {
178
+ align-self: flex-start;
179
+ margin-top: var(--spacing-050);
180
+ background: #ff0000;
181
+ border: 1px solid #ff0000;
182
+ color: #ffffff;
183
+
184
+ &:hover {
185
+ background: #e60000;
186
+ border-color: #e60000;
187
+ color: #ffffff;
188
+ }
189
+ }
190
+
116
191
  &__resources,
117
192
  &__feedback {
118
193
  display: flex;
@@ -206,6 +281,17 @@
206
281
  }
207
282
  }
208
283
 
284
+ @keyframes help-youtube-rise {
285
+ from {
286
+ opacity: 0;
287
+ transform: translateY(8px);
288
+ }
289
+ to {
290
+ opacity: 1;
291
+ transform: translateY(0);
292
+ }
293
+ }
294
+
209
295
  @media (max-width: 1366px) {
210
296
  .help-modal {
211
297
  &__tour-body {
@@ -252,10 +338,19 @@
252
338
 
253
339
  &__tour,
254
340
  &__resources,
255
- &__feedback {
341
+ &__feedback,
342
+ &__youtube {
256
343
  padding: var(--spacing-200);
257
344
  }
258
345
 
346
+ &__youtube {
347
+ grid-template-columns: 1fr;
348
+ }
349
+
350
+ &__youtube-media {
351
+ justify-content: flex-start;
352
+ }
353
+
259
354
  &__tour-image {
260
355
  max-width: 200px;
261
356
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "corpushub-design-system",
3
3
  "private": false,
4
- "version": "0.0.10",
4
+ "version": "0.0.12",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {