@africanies/angular-web-sdk 0.1.6 → 0.1.8
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/.nx/cache/{17491371155400585077 → 13466509747676776487}/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs +139 -51
- package/.nx/cache/13466509747676776487/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +1 -0
- package/.nx/cache/{17491371155400585077 → 13466509747676776487}/dist/libs/africanies-core/types/africanies-africanies-core.d.ts +14 -11
- package/.nx/cache/{17499961385238663835 → 14995846848874973576}/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +83 -63
- package/.nx/cache/14995846848874973576/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +1 -0
- package/.nx/cache/{17499961385238663835 → 14995846848874973576}/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +22 -19
- package/.nx/cache/{12276756491762927325 → 15302120112746851896}/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs +34 -6
- package/.nx/cache/15302120112746851896/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +1 -0
- package/.nx/cache/{12276756491762927325 → 15302120112746851896}/dist/libs/africanies-theme/tailwind-preset.cjs +104 -19
- package/.nx/cache/{12276756491762927325 → 15302120112746851896}/dist/libs/africanies-theme/types/africanies-africanies-theme.d.ts +21 -2
- package/.nx/cache/18393832731522001121/dist/libs/africanies-core/README.md +85 -0
- package/.nx/cache/18393832731522001121/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs +4634 -0
- package/.nx/cache/18393832731522001121/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +1 -0
- package/.nx/cache/18393832731522001121/dist/libs/africanies-core/package.json +31 -0
- package/.nx/cache/18393832731522001121/dist/libs/africanies-core/types/africanies-africanies-core.d.ts +2743 -0
- package/.nx/cache/5151121439688073678/dist/libs/africanies-icons/README.md +69 -0
- package/.nx/cache/5151121439688073678/dist/libs/africanies-icons/assets/icons.sprite.svg +1851 -0
- package/.nx/cache/5151121439688073678/dist/libs/africanies-icons/fesm2022/africanies-africanies-icons.mjs +833 -0
- package/.nx/cache/5151121439688073678/dist/libs/africanies-icons/fesm2022/africanies-africanies-icons.mjs.map +1 -0
- package/.nx/cache/5151121439688073678/dist/libs/africanies-icons/package.json +30 -0
- package/.nx/cache/5151121439688073678/dist/libs/africanies-icons/types/africanies-africanies-icons.d.ts +108 -0
- package/.nx/cache/{4082520855419352840 → 6673686859704879504}/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs +12 -2
- package/.nx/cache/6673686859704879504/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +1 -0
- package/.nx/cache/{4082520855419352840 → 6673686859704879504}/dist/libs/africanies-theme/tailwind-preset.cjs +16 -7
- package/.nx/cache/{4082520855419352840 → 6673686859704879504}/dist/libs/africanies-theme/types/africanies-africanies-theme.d.ts +11 -3
- package/.nx/cache/877026836685850193/dist/libs/africanies-models/README.md +60 -0
- package/.nx/cache/877026836685850193/dist/libs/africanies-models/fesm2022/africanies-africanies-models.mjs +613 -0
- package/.nx/cache/877026836685850193/dist/libs/africanies-models/fesm2022/africanies-africanies-models.mjs.map +1 -0
- package/.nx/cache/877026836685850193/dist/libs/africanies-models/package.json +23 -0
- package/.nx/cache/877026836685850193/dist/libs/africanies-models/types/africanies-africanies-models.d.ts +1452 -0
- package/.nx/cache/{3314955264390318442 → 9406544675747598148}/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +866 -632
- package/.nx/cache/9406544675747598148/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +1 -0
- package/.nx/cache/{3314955264390318442 → 9406544675747598148}/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +170 -130
- package/.nx/cache/run.json +42 -42
- package/.nx/cache/terminalOutputs/{17491371155400585077 → 13466509747676776487} +1 -1
- package/.nx/cache/terminalOutputs/14995846848874973576 +21 -0
- package/.nx/cache/terminalOutputs/{3017748574492080228 → 15149466893522345489} +16 -7
- package/.nx/cache/terminalOutputs/{4082520855419352840 → 15302120112746851896} +1 -1
- package/.nx/cache/terminalOutputs/{8648260256613557249 → 15835338512221847842} +18 -8
- package/.nx/cache/terminalOutputs/17960163310445607219 +6 -0
- package/.nx/cache/terminalOutputs/18393832731522001121 +21 -0
- package/.nx/cache/terminalOutputs/{3314955264390318442 → 5151121439688073678} +6 -6
- package/.nx/cache/terminalOutputs/{12276756491762927325 → 6673686859704879504} +2 -2
- package/.nx/cache/terminalOutputs/7462873189468732296 +17 -0
- package/.nx/cache/terminalOutputs/8032148447904822353 +185 -0
- package/.nx/cache/terminalOutputs/877026836685850193 +21 -0
- package/.nx/cache/terminalOutputs/9406544675747598148 +21 -0
- package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db +0 -0
- package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db-shm +0 -0
- package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db-wal +0 -0
- package/.nx/workspace-data/d/daemon.log +3962 -0
- package/.nx/workspace-data/d/server-process.json +2 -2
- package/.nx/workspace-data/file-map.json +3102 -3036
- package/.nx/workspace-data/nx_files.nxt +0 -0
- package/.nx/workspace-data/project-graph.json +7 -2
- package/apps/playground/src/app/pages/button-page.ts +5 -3
- package/apps/playground/src/app/pages/feedback-page.ts +1 -1
- package/apps/playground/src/app/pages/home-page.ts +1 -1
- package/apps/playground/src/app/pages/icons-page.ts +3 -3
- package/apps/playground/src/app/pages/lecture-page.ts +3 -3
- package/apps/playground/src/app/pages/models-page.ts +1 -1
- package/apps/playground/src/app/pages/overlay-demos.ts +1 -1
- package/apps/playground/src/app/pages/tokens-page.ts +29 -11
- package/apps/playground/src/app/pages/usecases/onboarding-login.page.ts +1 -1
- package/apps/playground/src/app/pages/usecases/onboarding-reset-password.page.ts +1 -1
- package/apps/playground/src/app/pages/usecases/shipment-detail.page.ts +1 -1
- package/apps/playground/src/app/pages/viewport-preview.component.ts +1 -1
- package/apps/playground/src/app/snippets/button.snippets.ts +4 -3
- package/apps/playground/src/app/snippets/filters.snippets.ts +10 -0
- package/apps/playground/src/index.html +6 -0
- package/apps/playground/src/styles.css +4 -5
- package/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs +131 -8
- package/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +1 -1
- package/dist/libs/africanies-core/types/africanies-africanies-core.d.ts +8 -6
- package/dist/libs/africanies-icons/assets/icons.sprite.svg +7 -0
- package/dist/libs/africanies-icons/fesm2022/africanies-africanies-icons.mjs +1 -0
- package/dist/libs/africanies-icons/fesm2022/africanies-africanies-icons.mjs.map +1 -1
- package/dist/libs/africanies-icons/types/africanies-africanies-icons.d.ts +2 -2
- package/dist/libs/africanies-models/fesm2022/africanies-africanies-models.mjs +22 -8
- package/dist/libs/africanies-models/fesm2022/africanies-africanies-models.mjs.map +1 -1
- package/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs +30 -8
- package/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +1 -1
- package/dist/libs/africanies-theme/tailwind-preset.cjs +89 -12
- package/dist/libs/africanies-theme/types/africanies-africanies-theme.d.ts +14 -4
- package/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +765 -615
- package/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +1 -1
- package/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +148 -115
- package/libs/africanies-core/src/index.ts +1 -0
- package/libs/africanies-core/src/lib/notification/index.ts +1 -1
- package/libs/africanies-core/src/lib/notification/notification-link.spec.ts +40 -7
- package/libs/africanies-core/src/lib/notification/notification-link.ts +143 -7
- package/libs/africanies-icons/src/assets/icons.sprite.svg +7 -0
- package/libs/africanies-icons/src/lib/icon-name.ts +1 -0
- package/libs/africanies-models/src/lib/filters/configs/seed-configs.ts +22 -8
- package/libs/africanies-theme/src/lib/mode-color.safelist.ts +20 -2
- package/libs/africanies-theme/src/lib/mode-color.service.spec.ts +55 -0
- package/libs/africanies-theme/src/lib/mode-color.service.ts +23 -7
- package/libs/africanies-theme/tailwind-preset.cjs +89 -12
- package/libs/africanies-ui/src/lib/action-menu/action-menu.component.ts +3 -3
- package/libs/africanies-ui/src/lib/alert/alert.component.ts +4 -4
- package/libs/africanies-ui/src/lib/avatar/avatar-menu.component.ts +2 -2
- package/libs/africanies-ui/src/lib/button/button.component.spec.ts +7 -7
- package/libs/africanies-ui/src/lib/button/button.component.ts +10 -6
- package/libs/africanies-ui/src/lib/chip/chip.component.ts +4 -4
- package/libs/africanies-ui/src/lib/content-stack/content-stack.component.ts +1 -1
- package/libs/africanies-ui/src/lib/feedback/empty-state.component.ts +1 -1
- package/libs/africanies-ui/src/lib/feedback/error-indicator.component.ts +3 -3
- package/libs/africanies-ui/src/lib/feedback/error-state.component.ts +3 -3
- package/libs/africanies-ui/src/lib/filters/filter-drawer.panel.ts +44 -27
- package/libs/africanies-ui/src/lib/forms/checkbox/checkbox.component.ts +2 -1
- package/libs/africanies-ui/src/lib/forms/file-upload/file-preview.dialog.ts +2 -2
- package/libs/africanies-ui/src/lib/forms/file-upload/file-upload.component.ts +5 -5
- package/libs/africanies-ui/src/lib/forms/form-field.classes.ts +37 -7
- package/libs/africanies-ui/src/lib/forms/otp-input/otp-input.component.ts +2 -1
- package/libs/africanies-ui/src/lib/forms/radio/radio.component.ts +2 -1
- package/libs/africanies-ui/src/lib/forms/select/select.component.ts +2 -2
- package/libs/africanies-ui/src/lib/forms/toggle/toggle.component.ts +1 -1
- package/libs/africanies-ui/src/lib/image/image.component.ts +1 -1
- package/libs/africanies-ui/src/lib/info-popover/info-popover.component.ts +2 -2
- package/libs/africanies-ui/src/lib/layout/app-shell-content-header.component.ts +1 -1
- package/libs/africanies-ui/src/lib/layout/app-shell-header.component.ts +6 -6
- package/libs/africanies-ui/src/lib/layout/app-shell.component.html +2 -2
- package/libs/africanies-ui/src/lib/layout/app-shell.component.ts +5 -5
- package/libs/africanies-ui/src/lib/navigation/shipping-mode-switch/shipping-mode-switch.component.ts +4 -4
- package/libs/africanies-ui/src/lib/navigation/side-nav/africanies-side-nav.component.html +21 -13
- package/libs/africanies-ui/src/lib/navigation/side-nav/africanies-side-nav.component.ts +23 -13
- package/libs/africanies-ui/src/lib/notifications/notification-drawer.panel.ts +27 -14
- package/libs/africanies-ui/src/lib/overlay/confirm-dialog.component.ts +2 -2
- package/libs/africanies-ui/src/lib/overlay/drawer.service.ts +3 -3
- package/libs/africanies-ui/src/lib/overlay/modal.service.ts +4 -4
- package/libs/africanies-ui/src/lib/overlay/overlay-frame.component.ts +1 -1
- package/libs/africanies-ui/src/lib/pagination/pagination.component.ts +4 -4
- package/libs/africanies-ui/src/lib/stepper/stepper.component.ts +7 -7
- package/libs/africanies-ui/src/lib/table/table-column.ts +9 -0
- package/libs/africanies-ui/src/lib/table/table.component.spec.ts +99 -0
- package/libs/africanies-ui/src/lib/table/table.component.ts +75 -33
- package/libs/africanies-ui/src/lib/toast/toast-host.component.ts +4 -4
- package/libs/africanies-ui/src/lib/toast/toast-item.component.ts +7 -7
- package/package.json +1 -1
- package/svg/hand-coins.svg +9 -0
- package/.nx/cache/12276756491762927325/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +0 -1
- package/.nx/cache/17491371155400585077/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +0 -1
- package/.nx/cache/17499961385238663835/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +0 -1
- package/.nx/cache/3314955264390318442/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +0 -1
- package/.nx/cache/4082520855419352840/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +0 -1
- package/.nx/cache/terminalOutputs/17499961385238663835 +0 -21
- /package/.nx/cache/{17491371155400585077 → 13466509747676776487}/dist/libs/africanies-core/README.md +0 -0
- /package/.nx/cache/{17491371155400585077 → 13466509747676776487}/dist/libs/africanies-core/package.json +0 -0
- /package/.nx/cache/{17499961385238663835 → 14995846848874973576}/dist/libs/africanies-ui/README.md +0 -0
- /package/.nx/cache/{17499961385238663835 → 14995846848874973576}/dist/libs/africanies-ui/assets/brand/africanies-logo-mini.png +0 -0
- /package/.nx/cache/{17499961385238663835 → 14995846848874973576}/dist/libs/africanies-ui/assets/brand/africanies-logo.png +0 -0
- /package/.nx/cache/{17499961385238663835 → 14995846848874973576}/dist/libs/africanies-ui/assets/brand/africanies-logo.svg +0 -0
- /package/.nx/cache/{17499961385238663835 → 14995846848874973576}/dist/libs/africanies-ui/assets/carriers/dhl.svg +0 -0
- /package/.nx/cache/{17499961385238663835 → 14995846848874973576}/dist/libs/africanies-ui/package.json +0 -0
- /package/.nx/cache/{12276756491762927325 → 15302120112746851896}/dist/libs/africanies-theme/README.md +0 -0
- /package/.nx/cache/{12276756491762927325 → 15302120112746851896}/dist/libs/africanies-theme/package.json +0 -0
- /package/.nx/cache/{4082520855419352840 → 6673686859704879504}/dist/libs/africanies-theme/README.md +0 -0
- /package/.nx/cache/{4082520855419352840 → 6673686859704879504}/dist/libs/africanies-theme/package.json +0 -0
- /package/.nx/cache/{3314955264390318442 → 9406544675747598148}/dist/libs/africanies-ui/README.md +0 -0
- /package/.nx/cache/{3314955264390318442 → 9406544675747598148}/dist/libs/africanies-ui/assets/brand/africanies-logo-mini.png +0 -0
- /package/.nx/cache/{3314955264390318442 → 9406544675747598148}/dist/libs/africanies-ui/assets/brand/africanies-logo.png +0 -0
- /package/.nx/cache/{3314955264390318442 → 9406544675747598148}/dist/libs/africanies-ui/assets/brand/africanies-logo.svg +0 -0
- /package/.nx/cache/{3314955264390318442 → 9406544675747598148}/dist/libs/africanies-ui/assets/carriers/dhl.svg +0 -0
- /package/.nx/cache/{3314955264390318442 → 9406544675747598148}/dist/libs/africanies-ui/package.json +0 -0
- /package/.nx/cache/terminalOutputs/{16279119293212733518 → 14005735098959303198} +0 -0
- /package/.nx/cache/terminalOutputs/{7126777490381568487 → 1446890025183346611} +0 -0
- /package/.nx/cache/terminalOutputs/{9408529484792607601 → 6337357866566791975} +0 -0
|
@@ -7,4 +7,4 @@ export {
|
|
|
7
7
|
NOTIFICATION_UPDATE_PATH,
|
|
8
8
|
} from './notification.mapper';
|
|
9
9
|
export { NotificationService } from './notification.service';
|
|
10
|
-
export { resolveNotificationLinkForMode } from './notification-link';
|
|
10
|
+
export { isNotificationExternalLink, resolveNotificationLinkForMode } from './notification-link';
|
|
@@ -1,25 +1,58 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
isNotificationExternalLink,
|
|
3
|
+
resolveNotificationLinkForMode,
|
|
4
|
+
} from './notification-link';
|
|
2
5
|
|
|
3
6
|
describe('resolveNotificationLinkForMode', () => {
|
|
4
7
|
const exportLink =
|
|
5
8
|
'https://test-admin-export.africaniestest.com/portal/customer/deliveries?page=1&shipment_app=shipfromnaija';
|
|
6
9
|
|
|
7
|
-
it('
|
|
10
|
+
it('preserves shipment_app and strips legacy host to a relative portal path', () => {
|
|
8
11
|
expect(resolveNotificationLinkForMode(exportLink, 'stn')).toBe(
|
|
9
|
-
'
|
|
12
|
+
'/portal/customer/deliveries?page=1&shipment_app=shipfromnaija',
|
|
10
13
|
);
|
|
11
14
|
});
|
|
12
15
|
|
|
13
|
-
it('
|
|
16
|
+
it('preserves shipment_app on import portal links', () => {
|
|
14
17
|
const importLink =
|
|
15
18
|
'https://test-customer-import.africaniestest.com/portal/shipment/track-shipment/items/90?shipment_app=shiptonaija';
|
|
16
19
|
|
|
17
20
|
expect(resolveNotificationLinkForMode(importLink, 'sfn')).toBe(
|
|
18
|
-
'
|
|
21
|
+
'/portal/shipment/track-shipment/items/90?shipment_app=shiptonaija',
|
|
22
|
+
);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('leaves relative portal links with shipment_app unchanged', () => {
|
|
26
|
+
expect(resolveNotificationLinkForMode(exportLink, 'sfn')).toBe(
|
|
27
|
+
'/portal/customer/deliveries?page=1&shipment_app=shipfromnaija',
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('strips shipment_app from S3 export links', () => {
|
|
32
|
+
const url =
|
|
33
|
+
'https://africanies-staging-test.s3.amazonaws.com/var/www/html/storage/tmp/payouts.xlsx?X-Amz-Signature=abc&shipment_app=shipfromnaija';
|
|
34
|
+
|
|
35
|
+
expect(resolveNotificationLinkForMode(url, 'sfn')).toBe(
|
|
36
|
+
'https://africanies-staging-test.s3.amazonaws.com/var/www/html/storage/tmp/payouts.xlsx?X-Amz-Signature=abc',
|
|
19
37
|
);
|
|
20
38
|
});
|
|
21
39
|
|
|
22
|
-
it('
|
|
23
|
-
|
|
40
|
+
it('adds shipment_app when missing on absolute portal URLs', () => {
|
|
41
|
+
const link =
|
|
42
|
+
'https://test-admin-export.africaniestest.com/portal/customer/deliveries?page=1';
|
|
43
|
+
|
|
44
|
+
expect(resolveNotificationLinkForMode(link, 'stn')).toBe(
|
|
45
|
+
'https://test-admin-import.africaniestest.com/portal/customer/deliveries?page=1&shipment_app=shiptonaija',
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
describe('isNotificationExternalLink', () => {
|
|
51
|
+
it('treats S3 spreadsheet exports as external', () => {
|
|
52
|
+
expect(
|
|
53
|
+
isNotificationExternalLink(
|
|
54
|
+
'https://africanies-staging-test.s3.amazonaws.com/tmp/export.xlsx?X-Amz-Signature=abc',
|
|
55
|
+
),
|
|
56
|
+
).toBe(true);
|
|
24
57
|
});
|
|
25
58
|
});
|
|
@@ -7,26 +7,68 @@ const SHIPMENT_APP_BY_MODE: Record<ShippingMode, string> = {
|
|
|
7
7
|
sfn: 'shipfromnaija',
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
+
const QUERY_SHIPMENT_APP = 'shipment_app';
|
|
11
|
+
|
|
12
|
+
const LEGACY_PORTAL_HOST =
|
|
13
|
+
/^(?:test-)?(?:admin|customer)-(?:export|import)\.africaniestest\.com$/i;
|
|
14
|
+
|
|
15
|
+
/** Signed export downloads and other hosts that must not be rewritten in-app. */
|
|
16
|
+
export function isNotificationExternalLink(link: string): boolean {
|
|
17
|
+
const trimmed = decodeNotificationLink(link).trim();
|
|
18
|
+
if (!trimmed) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
const url = new URL(trimmed);
|
|
23
|
+
if (/\.(xlsx|xls|csv)(\?|$)/i.test(url.pathname)) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
if (/\.amazonaws\.com$/i.test(url.hostname)) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
return !isLegacyPortalHost(url.hostname);
|
|
30
|
+
} catch {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
10
35
|
/**
|
|
11
|
-
* Rewrite a notification
|
|
36
|
+
* Rewrite a notification href for the active {@link ShippingMode}.
|
|
12
37
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
38
|
+
* - Export / download URLs (S3, spreadsheets) pass through unchanged (no `shipment_app`).
|
|
39
|
+
* - Legacy portal hosts become relative `/portal/...` paths with query preserved.
|
|
40
|
+
* - When the notification already includes `shipment_app`, it is kept as-is.
|
|
41
|
+
* - Otherwise classic host / `shipment_app` rewriting applies for portal URLs.
|
|
17
42
|
*/
|
|
18
43
|
export function resolveNotificationLinkForMode(
|
|
19
44
|
link: string | null | undefined,
|
|
20
45
|
mode: ShippingMode,
|
|
21
46
|
): string {
|
|
22
|
-
const trimmed = asString(link).trim();
|
|
47
|
+
const trimmed = decodeNotificationLink(asString(link)).trim();
|
|
23
48
|
if (!trimmed) {
|
|
24
49
|
return trimmed;
|
|
25
50
|
}
|
|
26
51
|
|
|
52
|
+
if (isNotificationExternalLink(trimmed)) {
|
|
53
|
+
return stripShipmentAppFromLink(trimmed);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const relativePortal = toRelativePortalNotificationLink(trimmed);
|
|
57
|
+
if (relativePortal && hasShipmentAppQuery(relativePortal)) {
|
|
58
|
+
return relativePortal;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const relative = normalizeRelativePortalLink(trimmed);
|
|
62
|
+
if (relative && hasShipmentAppQuery(relative)) {
|
|
63
|
+
return relative;
|
|
64
|
+
}
|
|
65
|
+
|
|
27
66
|
try {
|
|
28
67
|
const url = new URL(trimmed);
|
|
29
|
-
url.searchParams.
|
|
68
|
+
if (url.searchParams.has(QUERY_SHIPMENT_APP)) {
|
|
69
|
+
return trimmed;
|
|
70
|
+
}
|
|
71
|
+
url.searchParams.set(QUERY_SHIPMENT_APP, SHIPMENT_APP_BY_MODE[mode]);
|
|
30
72
|
url.hostname = rewriteNotificationHostForMode(url.hostname, mode);
|
|
31
73
|
return url.toString();
|
|
32
74
|
} catch {
|
|
@@ -48,6 +90,10 @@ function rewriteNotificationLinkFallback(
|
|
|
48
90
|
link: string,
|
|
49
91
|
mode: ShippingMode,
|
|
50
92
|
): string {
|
|
93
|
+
if (hasShipmentAppQuery(link)) {
|
|
94
|
+
return link;
|
|
95
|
+
}
|
|
96
|
+
|
|
51
97
|
let out = link.replace(
|
|
52
98
|
/shipment_app=(?:shipfromnaija|shiptonaija)/gi,
|
|
53
99
|
`shipment_app=${SHIPMENT_APP_BY_MODE[mode]}`,
|
|
@@ -63,3 +109,93 @@ function rewriteNotificationLinkFallback(
|
|
|
63
109
|
}
|
|
64
110
|
return out.replace(/-import/gi, '-export');
|
|
65
111
|
}
|
|
112
|
+
|
|
113
|
+
function toRelativePortalNotificationLink(link: string): string | null {
|
|
114
|
+
try {
|
|
115
|
+
const url = new URL(link);
|
|
116
|
+
if (!isLegacyPortalHost(url.hostname)) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
let path = url.pathname.replace(/^\/+/, '');
|
|
121
|
+
if (path.startsWith('ng/portal/')) {
|
|
122
|
+
path = path.slice('ng/'.length);
|
|
123
|
+
}
|
|
124
|
+
if (!path.startsWith('portal/') && path !== 'portal') {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const query = url.searchParams.toString();
|
|
129
|
+
return `/${path}${query ? `?${query}` : ''}`;
|
|
130
|
+
} catch {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function normalizeRelativePortalLink(link: string): string | null {
|
|
136
|
+
let path = link.split('?')[0]?.split('#')[0] ?? '';
|
|
137
|
+
const query = link.includes('?') ? link.slice(link.indexOf('?')) : '';
|
|
138
|
+
path = path.replace(/^\/+/, '');
|
|
139
|
+
if (path.startsWith('ng/portal/')) {
|
|
140
|
+
path = path.slice('ng/'.length);
|
|
141
|
+
}
|
|
142
|
+
if (!path.startsWith('portal/') && path !== 'portal') {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
return `/${path}${query}`;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function stripShipmentAppFromLink(link: string): string {
|
|
149
|
+
const trimmed = link.trim();
|
|
150
|
+
if (!trimmed) {
|
|
151
|
+
return trimmed;
|
|
152
|
+
}
|
|
153
|
+
try {
|
|
154
|
+
const url = new URL(trimmed);
|
|
155
|
+
if (!url.searchParams.has(QUERY_SHIPMENT_APP)) {
|
|
156
|
+
return trimmed;
|
|
157
|
+
}
|
|
158
|
+
url.searchParams.delete(QUERY_SHIPMENT_APP);
|
|
159
|
+
return url.toString();
|
|
160
|
+
} catch {
|
|
161
|
+
const params = new URLSearchParams(
|
|
162
|
+
trimmed.includes('?') ? trimmed.slice(trimmed.indexOf('?') + 1) : '',
|
|
163
|
+
);
|
|
164
|
+
if (!params.has(QUERY_SHIPMENT_APP)) {
|
|
165
|
+
return trimmed;
|
|
166
|
+
}
|
|
167
|
+
params.delete(QUERY_SHIPMENT_APP);
|
|
168
|
+
const query = params.toString();
|
|
169
|
+
const base = trimmed.split('?')[0] ?? trimmed;
|
|
170
|
+
return query ? `${base}?${query}` : base;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function hasShipmentAppQuery(link: string): boolean {
|
|
175
|
+
try {
|
|
176
|
+
const query = link.includes('?') ? link.slice(link.indexOf('?') + 1) : '';
|
|
177
|
+
return new URLSearchParams(query).has(QUERY_SHIPMENT_APP);
|
|
178
|
+
} catch {
|
|
179
|
+
return /(?:^|[?&])shipment_app=/i.test(link);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function decodeNotificationLink(link: string): string {
|
|
184
|
+
let value = (link ?? '').trim();
|
|
185
|
+
if (!value.includes('%')) {
|
|
186
|
+
return value;
|
|
187
|
+
}
|
|
188
|
+
try {
|
|
189
|
+
const decoded = decodeURIComponent(value);
|
|
190
|
+
if (decoded !== value) {
|
|
191
|
+
value = decoded;
|
|
192
|
+
}
|
|
193
|
+
} catch {
|
|
194
|
+
// Keep original when not valid URI encoding.
|
|
195
|
+
}
|
|
196
|
+
return value;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function isLegacyPortalHost(hostname: string): boolean {
|
|
200
|
+
return LEGACY_PORTAL_HOST.test(hostname);
|
|
201
|
+
}
|
|
@@ -744,6 +744,13 @@
|
|
|
744
744
|
<path d="M14 8H10C9.5 8 9 8.5 9 9V13C9 13.5 9.5 14 10 14V20H14V14C14.5 14 15 13.5 15 13V9C15 8.5 14.5 8 14 8Z" fill="currentColor"/></symbol>
|
|
745
745
|
<symbol id="hammer" viewBox="0 0 24 24"><path d="M9.99707 6L16.9971 13L19.9971 10L15.5171 5.52C15.5171 5.52 12.5471 6.55 10.9971 5L9.99707 6Z" fill="currentColor"/>
|
|
746
746
|
<path d="M12.797 9.79004L4.267 18.31C4.102 18.488 4 18.727 4 18.99C4 19.253 4.101 19.492 4.267 19.671C4.448 19.854 4.7 19.968 4.978 19.968C5.231 19.968 5.462 19.874 5.638 19.72L14.207 11.201L12.797 9.79004Z" fill="currentColor"/></symbol>
|
|
747
|
+
<symbol id="hand-coins" viewBox="0 0 16 15"><path
|
|
748
|
+
fill-rule="evenodd"
|
|
749
|
+
clip-rule="evenodd"
|
|
750
|
+
d="M0.142433 5.8125C0.142433 6.8115 0.394433 7.74975 0.836933 8.5695C0.62996 8.65739 0.447722 8.79474 0.30621 8.96949C0.164697 9.14424 0.0682364 9.35105 0.0252912 9.57178C-0.0176541 9.7925 -0.00577094 10.0204 0.0598977 10.2354C0.125566 10.4505 0.243013 10.6462 0.401933 10.8053L3.64643 14.049C3.95198 14.3546 4.32385 14.5858 4.73318 14.7244C5.14251 14.8631 5.57829 14.9055 6.00668 14.8485L10.4924 14.25H12.8924V15H15.5174V13.875H14.0174V8.25H15.5174V7.125H12.8924V7.875H11.3909C11.7249 6.99496 11.8402 6.04697 11.7269 5.11253C11.6135 4.17809 11.2749 3.28516 10.7402 2.51051C10.2054 1.73585 9.49058 1.10266 8.65704 0.665352C7.8235 0.228047 6.89622 -0.00028052 5.95493 2.58646e-07C4.41336 2.58646e-07 2.93493 0.612387 1.84488 1.70244C0.75482 2.7925 0.142433 4.27093 0.142433 5.8125ZM5.95493 1.125C5.0719 1.12517 4.20686 1.37472 3.45942 1.84492C2.71198 2.31512 2.11253 2.98685 1.73009 3.78277C1.34765 4.57869 1.19776 5.46644 1.29769 6.3438C1.39762 7.22116 1.7433 8.05247 2.29493 8.742L4.64768 9.7995C4.6685 9.54613 4.74629 9.30073 4.87525 9.08164C5.00421 8.86255 5.18101 8.67542 5.39243 8.53425V8.25H4.64243V7.125H6.14243C6.24189 7.125 6.33727 7.08549 6.4076 7.01517C6.47792 6.94484 6.51743 6.84946 6.51743 6.75C6.51743 6.65054 6.47792 6.55516 6.4076 6.48483C6.33727 6.41451 6.24189 6.375 6.14243 6.375H5.76743C5.40208 6.37536 5.04916 6.24237 4.77491 6.00099C4.50066 5.7596 4.32393 5.42642 4.2779 5.06398C4.23187 4.70155 4.3197 4.33477 4.52491 4.03249C4.73012 3.73022 5.03859 3.51323 5.39243 3.42225V2.625H6.51743V3.375H7.26743V4.5H5.76743C5.66798 4.5 5.57259 4.53951 5.50227 4.60984C5.43194 4.68016 5.39243 4.77554 5.39243 4.875C5.39243 4.97446 5.43194 5.06984 5.50227 5.14017C5.57259 5.21049 5.66798 5.25 5.76743 5.25H6.14243C6.50778 5.24964 6.8607 5.38263 7.13496 5.62402C7.40921 5.8654 7.58593 6.19858 7.63196 6.56102C7.67799 6.92345 7.59016 7.29023 7.38495 7.59251C7.17975 7.89478 6.87127 8.11177 6.51743 8.20275V8.25H9.23843L10.1249 7.9545C10.4921 7.23989 10.6693 6.44291 10.6398 5.64006C10.6102 4.8372 10.3748 4.05542 9.95615 3.36973C9.53748 2.68405 8.94961 2.11748 8.24894 1.72439C7.54827 1.33131 6.75833 1.12491 5.95493 1.125ZM5.62343 11.4705L1.47593 9.60675C1.42279 9.58303 1.36303 9.57868 1.30701 9.59444C1.25099 9.6102 1.20227 9.64509 1.16929 9.69304C1.13632 9.74098 1.12118 9.79897 1.1265 9.85691C1.13182 9.91486 1.15727 9.96911 1.19843 10.0103L4.44143 13.2533C4.6248 13.4368 4.84801 13.5756 5.09372 13.6588C5.33943 13.7421 5.60103 13.7675 5.85818 13.7333L10.4182 13.125H12.8924V9H10.5464L9.42143 9.375H6.32993C6.18075 9.375 6.03767 9.43426 5.93219 9.53975C5.8267 9.64524 5.76743 9.78832 5.76743 9.9375C5.76743 10.0867 5.8267 10.2298 5.93219 10.3352C6.03767 10.4407 6.18075 10.5 6.32993 10.5H9.56243L10.4774 11.415L9.68243 12.21L9.09743 11.625H6.32993C6.07793 11.625 5.83793 11.5695 5.62343 11.4705Z"
|
|
751
|
+
fill="currentColor"
|
|
752
|
+
|
|
753
|
+
/></symbol>
|
|
747
754
|
<symbol id="hand" viewBox="0 0 24 24"><path d="M17.4612 6.45C17.0612 6.05 16.4612 5.95 15.9612 6.15C15.9612 5.85 15.8612 5.55 15.5612 5.25C15.3612 5.05 14.9612 4.85 14.4612 4.85C14.1612 4.85 13.9612 4.95 13.7612 4.95C13.7612 4.75 13.6612 4.65 13.5612 4.45C13.0612 3.85 12.0612 3.85 11.5612 4.45C11.3612 4.65 11.1612 4.85 11.1612 5.05C10.9612 5.05 10.7612 4.95 10.5612 4.95C10.0612 4.95 9.76122 5.15 9.46122 5.45C8.96122 5.95 8.96122 6.75 8.96122 6.75V10.55C8.66122 10.25 8.16122 9.75 7.46122 9.75C7.26122 9.75 6.96122 9.85 6.76122 9.95C6.36122 10.15 6.16122 10.45 6.06122 10.85C5.76122 11.85 6.66122 13.25 6.66122 13.35C6.76122 13.45 7.86122 16.05 8.86122 17.15C9.86122 18.35 10.9612 19.05 13.7612 19.05C16.6612 19.05 17.9612 17.45 17.9612 13.95V8.45C17.9612 8.35 18.0612 7.15 17.4612 6.45ZM11.9612 6.05C11.9612 5.75 11.8612 5.05 12.4612 5.05C12.9612 5.05 12.9612 5.55 12.9612 6.05V10.05C12.9612 10.35 13.1612 10.55 13.4612 10.55C13.7612 10.55 13.9612 10.35 13.9612 10.05V6.25C13.9612 6.25 13.9612 5.85 14.4612 5.85C15.0612 5.85 14.9612 6.75 14.9612 6.75V10.05C14.9612 10.35 15.1612 10.55 15.4612 10.55C15.7612 10.55 15.9612 10.35 15.9612 10.05V7.65C15.9612 7.55 15.9612 7.05 16.4612 7.05C16.9612 7.05 16.9612 8.05 16.9612 8.05V13.95C16.9612 17.35 15.6612 18.05 13.7612 18.05C11.3612 18.05 10.4612 17.55 9.66122 16.45C8.76122 15.45 7.56122 12.85 7.56122 12.75C7.26122 12.45 6.86122 11.55 6.96122 11.15C6.96122 11.05 7.06122 10.95 7.16122 10.85C7.26122 10.85 7.36122 10.75 7.36122 10.75C7.76122 10.75 8.16122 11.25 8.26122 11.45L8.86122 12.35C8.96122 12.55 9.26122 12.65 9.46122 12.55C9.86122 12.55 9.96122 12.35 9.96122 12.15V6.95C9.96122 6.55 9.96122 5.95 10.4612 5.95C10.8612 5.95 10.9612 6.25 10.9612 6.75V10.05C10.9612 10.35 11.1612 10.55 11.4612 10.55C11.7612 10.55 11.9612 10.35 11.9612 10.05V6.05Z" fill="currentColor"/></symbol>
|
|
748
755
|
<symbol id="handle-corner" viewBox="0 0 24 24"><path d="M8.4 17.7L17.7 8.4V7L7 17.7H8.4Z" fill="currentColor"/>
|
|
749
756
|
<path d="M11.4 17.7L17.7 11.4V10L10 17.7H11.4Z" fill="currentColor"/>
|
|
@@ -122,7 +122,7 @@ export const updateShipmentsFilterConfig: ModuleFilterConfigModel = {
|
|
|
122
122
|
},
|
|
123
123
|
{
|
|
124
124
|
key: 'shipment_method_id',
|
|
125
|
-
label: 'Shipment
|
|
125
|
+
label: 'Shipment Methods',
|
|
126
126
|
type: 'select',
|
|
127
127
|
optionsSource: 'shipmentMethods',
|
|
128
128
|
placeholder: 'Shipment Methods',
|
|
@@ -133,6 +133,7 @@ export const updateShipmentsFilterConfig: ModuleFilterConfigModel = {
|
|
|
133
133
|
type: 'select',
|
|
134
134
|
optionsSource: 'static',
|
|
135
135
|
options: [
|
|
136
|
+
{ value: '', label: 'None' },
|
|
136
137
|
{ value: 'individual', label: 'Individual' },
|
|
137
138
|
{ value: 'business', label: 'Business' },
|
|
138
139
|
],
|
|
@@ -148,17 +149,20 @@ export const updateShipmentsFilterConfig: ModuleFilterConfigModel = {
|
|
|
148
149
|
{
|
|
149
150
|
key: 'shipment_manifest_id',
|
|
150
151
|
label: 'Shipment Manifest',
|
|
151
|
-
type: '
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
type: 'enum',
|
|
153
|
+
exclusive: true,
|
|
154
|
+
options: [
|
|
155
|
+
{ value: 'not_null', label: 'Manifest Added', color: '#25945c' },
|
|
156
|
+
{ value: 'null', label: 'Manifest Not Added', color: '#667185' },
|
|
157
|
+
],
|
|
154
158
|
},
|
|
155
159
|
{
|
|
156
160
|
key: 'api_request',
|
|
157
161
|
label: 'API Request',
|
|
158
162
|
type: 'boolean',
|
|
159
163
|
options: [
|
|
160
|
-
{ value: '1', label: 'Yes' },
|
|
161
|
-
{ value: '0', label: 'No' },
|
|
164
|
+
{ value: '1', label: 'Yes', color: '#25945c' },
|
|
165
|
+
{ value: '0', label: 'No', color: '#FF001C' },
|
|
162
166
|
],
|
|
163
167
|
},
|
|
164
168
|
{
|
|
@@ -166,8 +170,18 @@ export const updateShipmentsFilterConfig: ModuleFilterConfigModel = {
|
|
|
166
170
|
label: 'Insured',
|
|
167
171
|
type: 'boolean',
|
|
168
172
|
options: [
|
|
169
|
-
{ value: '1', label: 'Yes' },
|
|
170
|
-
{ value: '0', label: 'No' },
|
|
173
|
+
{ value: '1', label: 'Yes', color: '#3B82F6' },
|
|
174
|
+
{ value: '0', label: 'No', color: '#f48220' },
|
|
175
|
+
],
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
key: 'pay_later',
|
|
179
|
+
label: 'Pay Later',
|
|
180
|
+
type: 'enum',
|
|
181
|
+
exclusive: true,
|
|
182
|
+
options: [
|
|
183
|
+
{ value: 'credit', label: 'Credit', color: '#25945c' },
|
|
184
|
+
{ value: 'debit', label: 'Debit', color: '#667185' },
|
|
171
185
|
],
|
|
172
186
|
},
|
|
173
187
|
],
|
|
@@ -9,34 +9,52 @@
|
|
|
9
9
|
* Do not rename these strings without updating ModeColorService and THEME.md.
|
|
10
10
|
*
|
|
11
11
|
* SFN (export / green):
|
|
12
|
+
* text-export-strong bg-export-strong hover:bg-export-hover border-export-strong
|
|
12
13
|
* text-export bg-export bg-export-subtle bg-export-light border-export
|
|
13
14
|
* hover:bg-export-light hover:bg-export-subtle dark:bg-export/15 dark:hover:bg-export/15
|
|
14
|
-
* dark:bg-[color-mix(in_srgb,#1cbd5d_15%,#212529)]
|
|
15
|
+
* dark:bg-[color-mix(in_srgb,#1cbd5d_15%,#212529)] dark:bg-export dark:text-export dark:border-export
|
|
15
16
|
*
|
|
16
17
|
* STN (import / orange):
|
|
18
|
+
* text-import-strong bg-import-strong hover:bg-import-hover border-import-strong
|
|
17
19
|
* text-import bg-import bg-import-subtle bg-import-light border-import
|
|
18
20
|
* hover:bg-import-light hover:bg-import-subtle dark:bg-import/15 dark:hover:bg-import/15
|
|
19
|
-
* dark:bg-[color-mix(in_srgb,#f08829_15%,#212529)]
|
|
21
|
+
* dark:bg-[color-mix(in_srgb,#f08829_15%,#212529)] dark:bg-import dark:text-import dark:border-import
|
|
20
22
|
*/
|
|
21
23
|
export const MODE_COLOR_SAFELIST = [
|
|
22
24
|
'text-export',
|
|
25
|
+
'text-export-strong',
|
|
23
26
|
'bg-export',
|
|
27
|
+
'bg-export-strong',
|
|
24
28
|
'bg-export-subtle',
|
|
25
29
|
'bg-export-light',
|
|
26
30
|
'border-export',
|
|
31
|
+
'border-export-strong',
|
|
32
|
+
'hover:bg-export-hover',
|
|
27
33
|
'hover:bg-export-light',
|
|
28
34
|
'hover:bg-export-subtle',
|
|
29
35
|
'dark:bg-export/15',
|
|
30
36
|
'dark:hover:bg-export/15',
|
|
37
|
+
'dark:hover:bg-export-light',
|
|
31
38
|
'dark:bg-[color-mix(in_srgb,#1cbd5d_15%,#212529)]',
|
|
39
|
+
'dark:bg-export',
|
|
40
|
+
'dark:text-export',
|
|
41
|
+
'dark:border-export',
|
|
32
42
|
'text-import',
|
|
43
|
+
'text-import-strong',
|
|
33
44
|
'bg-import',
|
|
45
|
+
'bg-import-strong',
|
|
34
46
|
'bg-import-subtle',
|
|
35
47
|
'bg-import-light',
|
|
36
48
|
'border-import',
|
|
49
|
+
'border-import-strong',
|
|
50
|
+
'hover:bg-import-hover',
|
|
37
51
|
'hover:bg-import-light',
|
|
38
52
|
'hover:bg-import-subtle',
|
|
39
53
|
'dark:bg-import/15',
|
|
40
54
|
'dark:hover:bg-import/15',
|
|
55
|
+
'dark:hover:bg-import-light',
|
|
41
56
|
'dark:bg-[color-mix(in_srgb,#f08829_15%,#212529)]',
|
|
57
|
+
'dark:bg-import',
|
|
58
|
+
'dark:text-import',
|
|
59
|
+
'dark:border-import',
|
|
42
60
|
] as const;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { signal } from '@angular/core';
|
|
2
|
+
import { TestBed } from '@angular/core/testing';
|
|
3
|
+
|
|
4
|
+
import { ShippingModeService } from '@africanies/africanies-core';
|
|
5
|
+
import type { ShippingMode } from '@africanies/africanies-models';
|
|
6
|
+
|
|
7
|
+
import { ModeColorService } from './mode-color.service';
|
|
8
|
+
|
|
9
|
+
describe('ModeColorService', () => {
|
|
10
|
+
let mode: ReturnType<typeof signal<ShippingMode>>;
|
|
11
|
+
let service: ModeColorService;
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
mode = signal<ShippingMode>('sfn');
|
|
15
|
+
TestBed.configureTestingModule({
|
|
16
|
+
providers: [
|
|
17
|
+
ModeColorService,
|
|
18
|
+
{
|
|
19
|
+
provide: ShippingModeService,
|
|
20
|
+
useValue: {
|
|
21
|
+
mode: mode.asReadonly(),
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
});
|
|
26
|
+
service = TestBed.inject(ModeColorService);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('uses accessible export-strong fills and text in SFN light mode', () => {
|
|
30
|
+
const classes = service.classes();
|
|
31
|
+
expect(classes.text).toContain('text-export-strong');
|
|
32
|
+
expect(classes.primary).toContain('bg-export-strong');
|
|
33
|
+
expect(classes.ghostPrimary).toContain('text-export-strong');
|
|
34
|
+
expect(classes.activeFill).toContain('bg-export-strong');
|
|
35
|
+
expect(classes.stroked).toContain('text-export-strong');
|
|
36
|
+
expect(classes.stroked).toContain('border-export-strong');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('keeps bright export accents for dark-mode companions in SFN', () => {
|
|
40
|
+
const classes = service.classes();
|
|
41
|
+
expect(classes.primary).toContain('dark:bg-export');
|
|
42
|
+
expect(classes.ghostPrimary).toContain('dark:text-export');
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('uses accessible import-strong fills and text in STN light mode', () => {
|
|
46
|
+
mode.set('stn');
|
|
47
|
+
const classes = service.classes();
|
|
48
|
+
expect(classes.text).toContain('text-import-strong');
|
|
49
|
+
expect(classes.primary).toContain('bg-import-strong');
|
|
50
|
+
expect(classes.ghostPrimary).toContain('text-import-strong');
|
|
51
|
+
expect(classes.activeFill).toContain('bg-import-strong');
|
|
52
|
+
expect(classes.stroked).toContain('text-import-strong');
|
|
53
|
+
expect(classes.primary).not.toContain('bg-export-strong');
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -9,7 +9,7 @@ import { ShippingModeService } from '@africanies/africanies-core';
|
|
|
9
9
|
* and accent text. Semantic colors (danger / warning) stay mode-independent.
|
|
10
10
|
*/
|
|
11
11
|
export interface ModeColorClasses {
|
|
12
|
-
/**
|
|
12
|
+
/** Accessible accent text — `text-export-strong` in light, `text-export` in dark. */
|
|
13
13
|
text: string;
|
|
14
14
|
/** Solid background utility, e.g. `bg-export`. */
|
|
15
15
|
bg: string;
|
|
@@ -42,6 +42,14 @@ export interface ModeColorClasses {
|
|
|
42
42
|
* Soft hover highlight for menus and lists.
|
|
43
43
|
*/
|
|
44
44
|
softHover: string;
|
|
45
|
+
/**
|
|
46
|
+
* Active nav leaf / collapsed rail — solid mode fill + white text.
|
|
47
|
+
*/
|
|
48
|
+
activeFill: string;
|
|
49
|
+
/**
|
|
50
|
+
* Stroked secondary CTA — white fill, mode border + text (portal `.btn-stroked`).
|
|
51
|
+
*/
|
|
52
|
+
stroked: string;
|
|
45
53
|
}
|
|
46
54
|
|
|
47
55
|
/**
|
|
@@ -72,33 +80,41 @@ export class ModeColorService {
|
|
|
72
80
|
// Literal strings required for Tailwind content detection — do not interpolate.
|
|
73
81
|
if (this.shippingMode.mode() === 'sfn') {
|
|
74
82
|
return {
|
|
75
|
-
text: 'text-export',
|
|
83
|
+
text: 'text-export-strong dark:text-export',
|
|
76
84
|
bg: 'bg-export',
|
|
77
85
|
bgSubtle: 'bg-export-subtle',
|
|
78
86
|
border: 'border-export',
|
|
79
87
|
primary:
|
|
80
|
-
'bg-export text-white border-transparent hover:bg-export-light',
|
|
88
|
+
'bg-export-strong text-white border-transparent hover:bg-export-hover dark:bg-export dark:hover:bg-export-light',
|
|
81
89
|
ghostPrimary:
|
|
82
|
-
'bg-transparent text-export border-transparent hover:bg-export-subtle dark:hover:bg-export/15',
|
|
90
|
+
'bg-transparent text-export-strong border-transparent hover:bg-export-subtle dark:text-export dark:hover:bg-export/15',
|
|
83
91
|
soft: 'bg-export-subtle dark:bg-export/15',
|
|
84
92
|
softSolid:
|
|
85
93
|
'bg-export-subtle dark:bg-[color-mix(in_srgb,#1cbd5d_15%,#212529)]',
|
|
86
94
|
softHover: 'hover:bg-export-subtle dark:hover:bg-export/15',
|
|
95
|
+
activeFill:
|
|
96
|
+
'bg-export-strong text-white border-transparent hover:bg-export-hover dark:bg-export dark:text-white dark:hover:bg-export-light',
|
|
97
|
+
stroked:
|
|
98
|
+
'bg-surface text-export-strong border-export-strong hover:bg-export-subtle dark:bg-ink-950 dark:text-export dark:border-export dark:hover:bg-export/15',
|
|
87
99
|
};
|
|
88
100
|
}
|
|
89
101
|
return {
|
|
90
|
-
text: 'text-import',
|
|
102
|
+
text: 'text-import-strong dark:text-import',
|
|
91
103
|
bg: 'bg-import',
|
|
92
104
|
bgSubtle: 'bg-import-subtle',
|
|
93
105
|
border: 'border-import',
|
|
94
106
|
primary:
|
|
95
|
-
'bg-import text-white border-transparent hover:bg-import-light',
|
|
107
|
+
'bg-import-strong text-white border-transparent hover:bg-import-hover dark:bg-import dark:hover:bg-import-light',
|
|
96
108
|
ghostPrimary:
|
|
97
|
-
'bg-transparent text-import border-transparent hover:bg-import-subtle dark:hover:bg-import/15',
|
|
109
|
+
'bg-transparent text-import-strong border-transparent hover:bg-import-subtle dark:text-import dark:hover:bg-import/15',
|
|
98
110
|
soft: 'bg-import-subtle dark:bg-import/15',
|
|
99
111
|
softSolid:
|
|
100
112
|
'bg-import-subtle dark:bg-[color-mix(in_srgb,#f08829_15%,#212529)]',
|
|
101
113
|
softHover: 'hover:bg-import-subtle dark:hover:bg-import/15',
|
|
114
|
+
activeFill:
|
|
115
|
+
'bg-import-strong text-white border-transparent hover:bg-import-hover dark:bg-import dark:text-white dark:hover:bg-import-light',
|
|
116
|
+
stroked:
|
|
117
|
+
'bg-surface text-import-strong border-import-strong hover:bg-import-subtle dark:bg-ink-950 dark:text-import dark:border-import dark:hover:bg-import/15',
|
|
102
118
|
};
|
|
103
119
|
});
|
|
104
120
|
}
|