@africanies/angular-web-sdk 0.1.5 → 0.1.7
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/{13524438527920092277 → 13466509747676776487}/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs +140 -52
- package/.nx/cache/13466509747676776487/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +1 -0
- package/.nx/cache/{13524438527920092277 → 13466509747676776487}/dist/libs/africanies-core/package.json +3 -3
- package/.nx/cache/{13524438527920092277 → 13466509747676776487}/dist/libs/africanies-core/types/africanies-africanies-core.d.ts +14 -11
- package/.nx/cache/{18132311043100376919 → 14995846848874973576}/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +539 -232
- package/.nx/cache/14995846848874973576/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +1 -0
- package/.nx/cache/{18132311043100376919 → 14995846848874973576}/dist/libs/africanies-ui/package.json +5 -5
- package/.nx/cache/{5741611231803799383 → 14995846848874973576}/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +111 -28
- package/.nx/cache/{1275815545780424169 → 6673686859704879504}/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs +16 -0
- package/.nx/cache/6673686859704879504/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +1 -0
- package/.nx/cache/{14153928176747262656 → 6673686859704879504}/dist/libs/africanies-theme/package.json +3 -3
- package/.nx/cache/{1275815545780424169 → 6673686859704879504}/dist/libs/africanies-theme/tailwind-preset.cjs +31 -14
- package/.nx/cache/{14153928176747262656 → 6673686859704879504}/dist/libs/africanies-theme/types/africanies-africanies-theme.d.ts +18 -1
- package/.nx/cache/run.json +18 -18
- package/.nx/cache/terminalOutputs/{4011892767661954819 → 13466509747676776487} +1 -1
- package/.nx/cache/terminalOutputs/1446890025183346611 +32 -0
- package/.nx/cache/terminalOutputs/{3064561615116090625 → 14995846848874973576} +7 -7
- package/.nx/cache/terminalOutputs/6337357866566791975 +6 -0
- package/.nx/cache/terminalOutputs/{1275815545780424169 → 6673686859704879504} +1 -1
- package/.nx/cache/terminalOutputs/{12148417737220755248 → 8032148447904822353} +182 -174
- 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 +2461 -0
- package/.nx/workspace-data/d/server-process.json +2 -2
- package/.nx/workspace-data/file-map.json +2747 -2747
- package/.nx/workspace-data/nx_files.nxt +0 -0
- package/.nx/workspace-data/project-graph.json +2 -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 +17 -3
- 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/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-theme/fesm2022/africanies-africanies-theme.mjs +12 -2
- package/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +1 -1
- package/dist/libs/africanies-theme/tailwind-preset.cjs +16 -7
- package/dist/libs/africanies-theme/types/africanies-africanies-theme.d.ts +11 -3
- package/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +83 -63
- package/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +1 -1
- package/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +11 -8
- 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-theme/src/lib/mode-color.safelist.ts +8 -2
- package/libs/africanies-theme/src/lib/mode-color.service.ts +16 -0
- package/libs/africanies-theme/tailwind-preset.cjs +16 -7
- package/libs/africanies-ui/src/lib/button/button.component.ts +5 -1
- package/libs/africanies-ui/src/lib/feedback/empty-state.component.ts +1 -1
- package/libs/africanies-ui/src/lib/feedback/error-state.component.ts +1 -1
- package/libs/africanies-ui/src/lib/forms/file-upload/file-preview.dialog.ts +1 -1
- package/libs/africanies-ui/src/lib/forms/file-upload/file-upload.component.ts +4 -4
- package/libs/africanies-ui/src/lib/forms/form-field.classes.ts +2 -2
- package/libs/africanies-ui/src/lib/forms/select/select.component.ts +1 -1
- package/libs/africanies-ui/src/lib/layout/app-shell-header.component.ts +1 -1
- package/libs/africanies-ui/src/lib/layout/app-shell.component.ts +2 -2
- package/libs/africanies-ui/src/lib/navigation/shipping-mode-switch/shipping-mode-switch.component.ts +2 -2
- package/libs/africanies-ui/src/lib/navigation/side-nav/africanies-side-nav.component.html +2 -2
- package/libs/africanies-ui/src/lib/navigation/side-nav/africanies-side-nav.component.ts +10 -6
- package/libs/africanies-ui/src/lib/notifications/notification-drawer.panel.ts +21 -8
- package/libs/africanies-ui/src/lib/overlay/drawer.service.ts +1 -1
- package/libs/africanies-ui/src/lib/overlay/modal.service.ts +1 -1
- package/libs/africanies-ui/src/lib/pagination/pagination.component.ts +3 -3
- package/libs/africanies-ui/src/lib/table/table.component.ts +5 -5
- package/libs/africanies-ui/src/lib/toast/toast-host.component.ts +4 -4
- package/libs/africanies-ui/src/lib/toast/toast-item.component.ts +1 -1
- package/package.json +1 -1
- package/.nx/cache/1275815545780424169/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +0 -1
- package/.nx/cache/1275815545780424169/dist/libs/africanies-theme/package.json +0 -36
- package/.nx/cache/1275815545780424169/dist/libs/africanies-theme/types/africanies-africanies-theme.d.ts +0 -157
- package/.nx/cache/13524438527920092277/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +0 -1
- package/.nx/cache/14153928176747262656/dist/libs/africanies-theme/README.md +0 -46
- package/.nx/cache/14153928176747262656/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs +0 -215
- package/.nx/cache/14153928176747262656/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +0 -1
- package/.nx/cache/14153928176747262656/dist/libs/africanies-theme/tailwind-preset.cjs +0 -245
- package/.nx/cache/18132311043100376919/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +0 -1
- package/.nx/cache/18132311043100376919/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +0 -5410
- package/.nx/cache/2782605790118376385/dist/libs/africanies-icons/README.md +0 -69
- package/.nx/cache/2782605790118376385/dist/libs/africanies-icons/assets/icons.sprite.svg +0 -1844
- package/.nx/cache/2782605790118376385/dist/libs/africanies-icons/fesm2022/africanies-africanies-icons.mjs +0 -832
- package/.nx/cache/2782605790118376385/dist/libs/africanies-icons/fesm2022/africanies-africanies-icons.mjs.map +0 -1
- package/.nx/cache/2782605790118376385/dist/libs/africanies-icons/package.json +0 -31
- package/.nx/cache/2782605790118376385/dist/libs/africanies-icons/types/africanies-africanies-icons.d.ts +0 -108
- package/.nx/cache/3064561615116090625/dist/libs/africanies-storage/README.md +0 -31
- package/.nx/cache/3064561615116090625/dist/libs/africanies-storage/fesm2022/africanies-africanies-storage.mjs +0 -243
- package/.nx/cache/3064561615116090625/dist/libs/africanies-storage/fesm2022/africanies-africanies-storage.mjs.map +0 -1
- package/.nx/cache/3064561615116090625/dist/libs/africanies-storage/package.json +0 -27
- package/.nx/cache/3064561615116090625/dist/libs/africanies-storage/types/africanies-africanies-storage.d.ts +0 -210
- package/.nx/cache/4011892767661954819/dist/libs/africanies-core/README.md +0 -85
- package/.nx/cache/4011892767661954819/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs +0 -4546
- package/.nx/cache/4011892767661954819/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +0 -1
- package/.nx/cache/4011892767661954819/dist/libs/africanies-core/package.json +0 -32
- package/.nx/cache/4011892767661954819/dist/libs/africanies-core/types/africanies-africanies-core.d.ts +0 -2740
- package/.nx/cache/5741611231803799383/dist/libs/africanies-ui/README.md +0 -68
- package/.nx/cache/5741611231803799383/dist/libs/africanies-ui/assets/brand/africanies-logo-mini.png +0 -0
- package/.nx/cache/5741611231803799383/dist/libs/africanies-ui/assets/brand/africanies-logo.png +0 -0
- package/.nx/cache/5741611231803799383/dist/libs/africanies-ui/assets/brand/africanies-logo.svg +0 -5
- package/.nx/cache/5741611231803799383/dist/libs/africanies-ui/assets/carriers/dhl.svg +0 -7
- package/.nx/cache/5741611231803799383/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +0 -19088
- package/.nx/cache/5741611231803799383/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +0 -1
- package/.nx/cache/5741611231803799383/dist/libs/africanies-ui/package.json +0 -36
- package/.nx/cache/6372470950255467653/dist/libs/africanies-models/README.md +0 -60
- package/.nx/cache/6372470950255467653/dist/libs/africanies-models/fesm2022/africanies-africanies-models.mjs +0 -599
- package/.nx/cache/6372470950255467653/dist/libs/africanies-models/fesm2022/africanies-africanies-models.mjs.map +0 -1
- package/.nx/cache/6372470950255467653/dist/libs/africanies-models/package.json +0 -24
- package/.nx/cache/6372470950255467653/dist/libs/africanies-models/types/africanies-africanies-models.d.ts +0 -1452
- package/.nx/cache/terminalOutputs/11768036696192889608 +0 -8
- package/.nx/cache/terminalOutputs/1227201614544602906 +0 -23
- package/.nx/cache/terminalOutputs/12538607787148205787 +0 -19
- package/.nx/cache/terminalOutputs/13524438527920092277 +0 -196
- package/.nx/cache/terminalOutputs/14153928176747262656 +0 -45
- package/.nx/cache/terminalOutputs/17404566492103808557 +0 -8
- package/.nx/cache/terminalOutputs/18132311043100376919 +0 -315
- package/.nx/cache/terminalOutputs/2436781291243085315 +0 -8
- package/.nx/cache/terminalOutputs/2782605790118376385 +0 -21
- package/.nx/cache/terminalOutputs/3681975492957101833 +0 -8
- package/.nx/cache/terminalOutputs/5741611231803799383 +0 -21
- package/.nx/cache/terminalOutputs/6037166070823946880 +0 -8
- package/.nx/cache/terminalOutputs/6372470950255467653 +0 -21
- package/.nx/cache/terminalOutputs/665190206482526466 +0 -175
- package/.nx/cache/terminalOutputs/7756595539965457927 +0 -23
- package/.nx/cache/terminalOutputs/9200013119269230075 +0 -8
- /package/.nx/cache/{13524438527920092277 → 13466509747676776487}/dist/libs/africanies-core/README.md +0 -0
- /package/.nx/cache/{18132311043100376919 → 14995846848874973576}/dist/libs/africanies-ui/README.md +0 -0
- /package/.nx/cache/{18132311043100376919 → 14995846848874973576}/dist/libs/africanies-ui/assets/brand/africanies-logo-mini.png +0 -0
- /package/.nx/cache/{18132311043100376919 → 14995846848874973576}/dist/libs/africanies-ui/assets/brand/africanies-logo.png +0 -0
- /package/.nx/cache/{18132311043100376919 → 14995846848874973576}/dist/libs/africanies-ui/assets/brand/africanies-logo.svg +0 -0
- /package/.nx/cache/{18132311043100376919 → 14995846848874973576}/dist/libs/africanies-ui/assets/carriers/dhl.svg +0 -0
- /package/.nx/cache/{1275815545780424169 → 6673686859704879504}/dist/libs/africanies-theme/README.md +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { InjectionToken, inject, Injector, signal, Injectable, makeEnvironmentProviders, provideAppInitializer } from '@angular/core';
|
|
3
3
|
import { SessionStorageService, AFRICANIES_SHIPPING_MODE_KEY, STORAGE_TOKEN, AFRICANIES_MODE_CONFIG_KEY, provideLocalStorage, AFRICANIES_ACCESS_TOKEN_KEY } from '@africanies/africanies-storage';
|
|
4
|
-
import { of,
|
|
4
|
+
import { of, timeout, throwError, map as map$1, tap as tap$1, catchError, finalize, firstValueFrom, forkJoin } from 'rxjs';
|
|
5
5
|
import { HttpErrorResponse, HttpContextToken, HttpContext, HttpClient, HttpHeaders, HttpParams, provideHttpClient, withInterceptors } from '@angular/common/http';
|
|
6
6
|
import { DEFAULT_PAGE_SIZE, NOTIFICATION_PAGE_SIZE } from '@africanies/africanies-models';
|
|
7
7
|
import { take, tap, map } from 'rxjs/operators';
|
|
@@ -687,31 +687,6 @@ class HttpResponseCache {
|
|
|
687
687
|
}
|
|
688
688
|
}
|
|
689
689
|
|
|
690
|
-
/**
|
|
691
|
-
* Whether a failed GET should be retried by {@link ApiClient}.
|
|
692
|
-
*
|
|
693
|
-
* Retries transient failures only (network blips, timeouts, 408/429, 5xx).
|
|
694
|
-
* Auth and other 4xx errors fail fast — retrying 401 does not help and causes
|
|
695
|
-
* duplicate requests + toasts.
|
|
696
|
-
* @param err
|
|
697
|
-
*/
|
|
698
|
-
function isRetryableGetError(err) {
|
|
699
|
-
if (err instanceof HttpErrorResponse) {
|
|
700
|
-
if (err.status === 0) {
|
|
701
|
-
return true;
|
|
702
|
-
}
|
|
703
|
-
if (err.status === 408 || err.status === 429) {
|
|
704
|
-
return true;
|
|
705
|
-
}
|
|
706
|
-
if (err.status >= 500) {
|
|
707
|
-
return true;
|
|
708
|
-
}
|
|
709
|
-
return false;
|
|
710
|
-
}
|
|
711
|
-
// Non-HTTP failures (e.g. timeout operator) may still be transient.
|
|
712
|
-
return true;
|
|
713
|
-
}
|
|
714
|
-
|
|
715
690
|
/**
|
|
716
691
|
* Per-request shipping-mode override for {@link shipmentModeInterceptor}.
|
|
717
692
|
*
|
|
@@ -979,7 +954,8 @@ function mapResourcePayload(id, raw, mapOne, mapMany) {
|
|
|
979
954
|
* - HTTP failures rethrown as `Error` whose `.message` is already
|
|
980
955
|
* user-facing ({@link formatApiErrorMessage}) — consumers do not need to
|
|
981
956
|
* parse `HttpErrorResponse` bodies
|
|
982
|
-
* -
|
|
957
|
+
* - **No automatic retry** — fail fast so UIs can show Select / table /
|
|
958
|
+
* error-state Retry instead of a stuck loading spinner
|
|
983
959
|
* - Optional per-GET TTL cache via `cacheTtlMs`
|
|
984
960
|
*
|
|
985
961
|
* @example
|
|
@@ -1121,18 +1097,8 @@ class ApiClient {
|
|
|
1121
1097
|
req$ = this.http.delete(url, hasBody ? { ...httpOpts, body } : httpOpts);
|
|
1122
1098
|
break;
|
|
1123
1099
|
}
|
|
1124
|
-
//
|
|
1125
|
-
|
|
1126
|
-
req$ = req$.pipe(retry({
|
|
1127
|
-
count: 1,
|
|
1128
|
-
delay: (err, retryCount) => {
|
|
1129
|
-
if (!isRetryableGetError(err)) {
|
|
1130
|
-
return throwError(() => err);
|
|
1131
|
-
}
|
|
1132
|
-
return timer(2 ** (retryCount - 1) * 1000);
|
|
1133
|
-
},
|
|
1134
|
-
}));
|
|
1135
|
-
}
|
|
1100
|
+
// No automatic GET retry — admin shells own Retry via UI
|
|
1101
|
+
// (`africanies-select` showRetry, table error→refreshClick, error-state).
|
|
1136
1102
|
if (this.config.timeout != null) {
|
|
1137
1103
|
req$ = req$.pipe(timeout({
|
|
1138
1104
|
each: this.config.timeout,
|
|
@@ -1808,8 +1774,8 @@ function listFetchKind(options) {
|
|
|
1808
1774
|
* (no caret/tilde): TanStack marks the Angular adapter experimental and
|
|
1809
1775
|
* breaking changes land without major bumps.
|
|
1810
1776
|
*
|
|
1811
|
-
*
|
|
1812
|
-
*
|
|
1777
|
+
* Query retries default to **0** to match {@link ApiClient} (fail fast;
|
|
1778
|
+
* screens use manual Retry). Apps can override per `QueryClient` if needed.
|
|
1813
1779
|
*/
|
|
1814
1780
|
/**
|
|
1815
1781
|
* Factory for TanStack `QueryClient` `defaultOptions`.
|
|
@@ -1859,8 +1825,7 @@ function createAfricaniesQueryClientDefaults() {
|
|
|
1859
1825
|
queries: {
|
|
1860
1826
|
staleTime: 60_000,
|
|
1861
1827
|
gcTime: 5 * 60_000,
|
|
1862
|
-
retry:
|
|
1863
|
-
// attemptIndex is 0-based in TanStack; match 1s, 2s, 4s style backoff.
|
|
1828
|
+
retry: 0,
|
|
1864
1829
|
retryDelay: (attemptIndex) => Math.min(1000 * 2 ** attemptIndex, 30_000),
|
|
1865
1830
|
},
|
|
1866
1831
|
mutations: {
|
|
@@ -2725,7 +2690,7 @@ function mapPaymentMethod(raw) {
|
|
|
2725
2690
|
deleted_at: asNullableString(record['deleted_at'] ?? record['deletedAt']),
|
|
2726
2691
|
created_at: asNullableString(record['created_at'] ?? record['createdAt']),
|
|
2727
2692
|
updated_at: asNullableString(record['updated_at'] ?? record['updatedAt']),
|
|
2728
|
-
currencies:
|
|
2693
|
+
currencies: mapList(record['currencies'], mapPaymentMethodCurrency),
|
|
2729
2694
|
};
|
|
2730
2695
|
}
|
|
2731
2696
|
/**
|
|
@@ -3800,22 +3765,58 @@ const SHIPMENT_APP_BY_MODE = {
|
|
|
3800
3765
|
stn: 'shiptonaija',
|
|
3801
3766
|
sfn: 'shipfromnaija',
|
|
3802
3767
|
};
|
|
3768
|
+
const QUERY_SHIPMENT_APP = 'shipment_app';
|
|
3769
|
+
const LEGACY_PORTAL_HOST = /^(?:test-)?(?:admin|customer)-(?:export|import)\.africaniestest\.com$/i;
|
|
3770
|
+
/** Signed export downloads and other hosts that must not be rewritten in-app. */
|
|
3771
|
+
function isNotificationExternalLink(link) {
|
|
3772
|
+
const trimmed = decodeNotificationLink(link).trim();
|
|
3773
|
+
if (!trimmed) {
|
|
3774
|
+
return false;
|
|
3775
|
+
}
|
|
3776
|
+
try {
|
|
3777
|
+
const url = new URL(trimmed);
|
|
3778
|
+
if (/\.(xlsx|xls|csv)(\?|$)/i.test(url.pathname)) {
|
|
3779
|
+
return true;
|
|
3780
|
+
}
|
|
3781
|
+
if (/\.amazonaws\.com$/i.test(url.hostname)) {
|
|
3782
|
+
return true;
|
|
3783
|
+
}
|
|
3784
|
+
return !isLegacyPortalHost(url.hostname);
|
|
3785
|
+
}
|
|
3786
|
+
catch {
|
|
3787
|
+
return false;
|
|
3788
|
+
}
|
|
3789
|
+
}
|
|
3803
3790
|
/**
|
|
3804
|
-
* Rewrite a notification
|
|
3791
|
+
* Rewrite a notification href for the active {@link ShippingMode}.
|
|
3805
3792
|
*
|
|
3806
|
-
*
|
|
3807
|
-
*
|
|
3808
|
-
*
|
|
3809
|
-
*
|
|
3793
|
+
* - Export / download URLs (S3, spreadsheets) pass through unchanged (no `shipment_app`).
|
|
3794
|
+
* - Legacy portal hosts become relative `/portal/...` paths with query preserved.
|
|
3795
|
+
* - When the notification already includes `shipment_app`, it is kept as-is.
|
|
3796
|
+
* - Otherwise classic host / `shipment_app` rewriting applies for portal URLs.
|
|
3810
3797
|
*/
|
|
3811
3798
|
function resolveNotificationLinkForMode(link, mode) {
|
|
3812
|
-
const trimmed = asString(link).trim();
|
|
3799
|
+
const trimmed = decodeNotificationLink(asString(link)).trim();
|
|
3813
3800
|
if (!trimmed) {
|
|
3814
3801
|
return trimmed;
|
|
3815
3802
|
}
|
|
3803
|
+
if (isNotificationExternalLink(trimmed)) {
|
|
3804
|
+
return stripShipmentAppFromLink(trimmed);
|
|
3805
|
+
}
|
|
3806
|
+
const relativePortal = toRelativePortalNotificationLink(trimmed);
|
|
3807
|
+
if (relativePortal && hasShipmentAppQuery(relativePortal)) {
|
|
3808
|
+
return relativePortal;
|
|
3809
|
+
}
|
|
3810
|
+
const relative = normalizeRelativePortalLink(trimmed);
|
|
3811
|
+
if (relative && hasShipmentAppQuery(relative)) {
|
|
3812
|
+
return relative;
|
|
3813
|
+
}
|
|
3816
3814
|
try {
|
|
3817
3815
|
const url = new URL(trimmed);
|
|
3818
|
-
url.searchParams.
|
|
3816
|
+
if (url.searchParams.has(QUERY_SHIPMENT_APP)) {
|
|
3817
|
+
return trimmed;
|
|
3818
|
+
}
|
|
3819
|
+
url.searchParams.set(QUERY_SHIPMENT_APP, SHIPMENT_APP_BY_MODE[mode]);
|
|
3819
3820
|
url.hostname = rewriteNotificationHostForMode(url.hostname, mode);
|
|
3820
3821
|
return url.toString();
|
|
3821
3822
|
}
|
|
@@ -3830,6 +3831,9 @@ function rewriteNotificationHostForMode(hostname, mode) {
|
|
|
3830
3831
|
return hostname.replace(/-import/i, '-export');
|
|
3831
3832
|
}
|
|
3832
3833
|
function rewriteNotificationLinkFallback(link, mode) {
|
|
3834
|
+
if (hasShipmentAppQuery(link)) {
|
|
3835
|
+
return link;
|
|
3836
|
+
}
|
|
3833
3837
|
let out = link.replace(/shipment_app=(?:shipfromnaija|shiptonaija)/gi, `shipment_app=${SHIPMENT_APP_BY_MODE[mode]}`);
|
|
3834
3838
|
if (!/shipment_app=/i.test(out)) {
|
|
3835
3839
|
const joiner = out.includes('?') ? '&' : '?';
|
|
@@ -3840,6 +3844,90 @@ function rewriteNotificationLinkFallback(link, mode) {
|
|
|
3840
3844
|
}
|
|
3841
3845
|
return out.replace(/-import/gi, '-export');
|
|
3842
3846
|
}
|
|
3847
|
+
function toRelativePortalNotificationLink(link) {
|
|
3848
|
+
try {
|
|
3849
|
+
const url = new URL(link);
|
|
3850
|
+
if (!isLegacyPortalHost(url.hostname)) {
|
|
3851
|
+
return null;
|
|
3852
|
+
}
|
|
3853
|
+
let path = url.pathname.replace(/^\/+/, '');
|
|
3854
|
+
if (path.startsWith('ng/portal/')) {
|
|
3855
|
+
path = path.slice('ng/'.length);
|
|
3856
|
+
}
|
|
3857
|
+
if (!path.startsWith('portal/') && path !== 'portal') {
|
|
3858
|
+
return null;
|
|
3859
|
+
}
|
|
3860
|
+
const query = url.searchParams.toString();
|
|
3861
|
+
return `/${path}${query ? `?${query}` : ''}`;
|
|
3862
|
+
}
|
|
3863
|
+
catch {
|
|
3864
|
+
return null;
|
|
3865
|
+
}
|
|
3866
|
+
}
|
|
3867
|
+
function normalizeRelativePortalLink(link) {
|
|
3868
|
+
let path = link.split('?')[0]?.split('#')[0] ?? '';
|
|
3869
|
+
const query = link.includes('?') ? link.slice(link.indexOf('?')) : '';
|
|
3870
|
+
path = path.replace(/^\/+/, '');
|
|
3871
|
+
if (path.startsWith('ng/portal/')) {
|
|
3872
|
+
path = path.slice('ng/'.length);
|
|
3873
|
+
}
|
|
3874
|
+
if (!path.startsWith('portal/') && path !== 'portal') {
|
|
3875
|
+
return null;
|
|
3876
|
+
}
|
|
3877
|
+
return `/${path}${query}`;
|
|
3878
|
+
}
|
|
3879
|
+
function stripShipmentAppFromLink(link) {
|
|
3880
|
+
const trimmed = link.trim();
|
|
3881
|
+
if (!trimmed) {
|
|
3882
|
+
return trimmed;
|
|
3883
|
+
}
|
|
3884
|
+
try {
|
|
3885
|
+
const url = new URL(trimmed);
|
|
3886
|
+
if (!url.searchParams.has(QUERY_SHIPMENT_APP)) {
|
|
3887
|
+
return trimmed;
|
|
3888
|
+
}
|
|
3889
|
+
url.searchParams.delete(QUERY_SHIPMENT_APP);
|
|
3890
|
+
return url.toString();
|
|
3891
|
+
}
|
|
3892
|
+
catch {
|
|
3893
|
+
const params = new URLSearchParams(trimmed.includes('?') ? trimmed.slice(trimmed.indexOf('?') + 1) : '');
|
|
3894
|
+
if (!params.has(QUERY_SHIPMENT_APP)) {
|
|
3895
|
+
return trimmed;
|
|
3896
|
+
}
|
|
3897
|
+
params.delete(QUERY_SHIPMENT_APP);
|
|
3898
|
+
const query = params.toString();
|
|
3899
|
+
const base = trimmed.split('?')[0] ?? trimmed;
|
|
3900
|
+
return query ? `${base}?${query}` : base;
|
|
3901
|
+
}
|
|
3902
|
+
}
|
|
3903
|
+
function hasShipmentAppQuery(link) {
|
|
3904
|
+
try {
|
|
3905
|
+
const query = link.includes('?') ? link.slice(link.indexOf('?') + 1) : '';
|
|
3906
|
+
return new URLSearchParams(query).has(QUERY_SHIPMENT_APP);
|
|
3907
|
+
}
|
|
3908
|
+
catch {
|
|
3909
|
+
return /(?:^|[?&])shipment_app=/i.test(link);
|
|
3910
|
+
}
|
|
3911
|
+
}
|
|
3912
|
+
function decodeNotificationLink(link) {
|
|
3913
|
+
let value = (link ?? '').trim();
|
|
3914
|
+
if (!value.includes('%')) {
|
|
3915
|
+
return value;
|
|
3916
|
+
}
|
|
3917
|
+
try {
|
|
3918
|
+
const decoded = decodeURIComponent(value);
|
|
3919
|
+
if (decoded !== value) {
|
|
3920
|
+
value = decoded;
|
|
3921
|
+
}
|
|
3922
|
+
}
|
|
3923
|
+
catch {
|
|
3924
|
+
// Keep original when not valid URI encoding.
|
|
3925
|
+
}
|
|
3926
|
+
return value;
|
|
3927
|
+
}
|
|
3928
|
+
function isLegacyPortalHost(hostname) {
|
|
3929
|
+
return LEGACY_PORTAL_HOST.test(hostname);
|
|
3930
|
+
}
|
|
3843
3931
|
|
|
3844
3932
|
/**
|
|
3845
3933
|
* File utility reads (`POST /file/read`).
|
|
@@ -4542,5 +4630,5 @@ function downloadCsv(options) {
|
|
|
4542
4630
|
* Generated bundle index. Do not edit.
|
|
4543
4631
|
*/
|
|
4544
4632
|
|
|
4545
|
-
export { AFRICANIES_HTTP_TOAST, AFRICANIES_SDK_CONFIG, AUTH_FORGOT_PASSWORD_PATH, ApiClient, AuthService, AuthTokenService, COUNTRY_FLAG_CDN_BASE, COUNTRY_READ_PATH, CURRENCY_CREATE_PATH, CURRENCY_DELETE_PATH, CURRENCY_READ_PATH, CURRENCY_UPDATE_PATH, CountryService, CurrencyService, DOCUMENT_READ_PATH, DRAWER_SERVICE, DocumentService, FILE_READ_MULTIPLE_PARAM, FILE_READ_PATH, FileService, FilterOptionsResolver, HttpResponseCache, MODAL_SERVICE, MODE_CONFIG_PATH, ModeConfigService, NOTIFICATION_READ_PATH, NOTIFICATION_UPDATE_PATH, NotificationService, OVERLAY_ROUTE_CONFIGS, PAYMENT_METHOD_READ_PATH, PAYMENT_METHOD_UPDATE_PATH, PLAN_READ_PATH, PRODUCT_READ_PATH, PaymentMethodService, PlanService, ProductService, RouteOverlayService, SERVICE_READ_PATH, SHIPMENT_METHOD_READ_PATH, SHIPPING_MODE_OVERRIDE, ServiceService, ShipmentMethodService, ShippingModeService, TOAST_HTTP_OPTIONS, USER_CHANGE_PASSWORD_PATH, USER_LOGOUT_FROM_ALL_SESSIONS_PATH, USER_PATH, UserService, WAREHOUSE_READ_PATH, WarehouseService, ZONE_READ_PATH, ZoneService, asArray, asBoolean, asNullableBoolean, asNullableFlag01, asNullableNumber, asNullableString, asNumber, asRecord, asShippingMode$1 as asShippingMode, asString, authInterceptor, buildResourcePath, buildResourceQueryParams, collectFilterOptionsSources, collectResolvableSelectFields, copyToClipboard, countryFlagUrl, createAfricaniesQueryClientDefaults, csvCell, downloadCsv, fieldErrorsMap, formatApiErrorMessage, httpToastInterceptor, isLaravelValidationBag, isValidEmail, joinApiErrorMessages, listFetchKind, mapApiJsonList, mapApiJsonValue, mapArray, mapCountry, mapCountryList, mapCountrySelectOptions, mapCountryState, mapCurrency, mapCurrencyList, mapCurrencyPaymentMethod, mapCurrencyPaymentMethodPivot, mapDocument, mapDocumentList, mapFileRead, mapFileReadList, mapLaravelValidationBag, mapList, mapModeConfigData, mapNotification, mapNotificationInboxItem, mapNotificationList, mapNotificationPayload, mapPaymentMethod, mapPaymentMethodCurrency, mapPaymentMethodList, mapPlan, mapPlanList, mapPlanPackage, mapProduct, mapProductList, mapResourcePayload, mapService, mapServiceList, mapShipmentMethod, mapShipmentMethodFilterOptions, mapShipmentMethodList, mapShipmentMethodZoneLink, mapShipmentMethodZonePage, mapShipmentZone, mapUser, mapUserAccountManager, mapUserBusinessAccount, mapUserCountry, mapUserCountryState, mapUserGatewayPayload, mapUserPaymentPayload, mapUserPlan, mapUserPlanPackage, mapUserStateLabel, mapUserSubscription, mapWarehouse, mapWarehouseCountry, mapWarehouseFilterOptions, mapWarehouseList, mapWarehouseState, mapZone, mapZoneList, mergeFilterOptionLists, normalize, normalizePagination, provideAfricaniesHttpClient, provideAfricaniesQueryDefaults, provideAfricaniesSdk, provideModeConfig, provideOverlayRoutes, resolveModeRegionConfig, resolveNotificationLinkForMode, resourceCacheTtlMs, shipmentModeInterceptor, toCsvString, toCurrencyCreateBody, toCurrencyDeleteBody, toCurrencyFlag01, toCurrencyUpdateBody, toFlag01, toPaymentMethodFlag01, toPaymentMethodUpdateBody, unwrapLaravelPaginator, withShippingMode, withToast };
|
|
4633
|
+
export { AFRICANIES_HTTP_TOAST, AFRICANIES_SDK_CONFIG, AUTH_FORGOT_PASSWORD_PATH, ApiClient, AuthService, AuthTokenService, COUNTRY_FLAG_CDN_BASE, COUNTRY_READ_PATH, CURRENCY_CREATE_PATH, CURRENCY_DELETE_PATH, CURRENCY_READ_PATH, CURRENCY_UPDATE_PATH, CountryService, CurrencyService, DOCUMENT_READ_PATH, DRAWER_SERVICE, DocumentService, FILE_READ_MULTIPLE_PARAM, FILE_READ_PATH, FileService, FilterOptionsResolver, HttpResponseCache, MODAL_SERVICE, MODE_CONFIG_PATH, ModeConfigService, NOTIFICATION_READ_PATH, NOTIFICATION_UPDATE_PATH, NotificationService, OVERLAY_ROUTE_CONFIGS, PAYMENT_METHOD_READ_PATH, PAYMENT_METHOD_UPDATE_PATH, PLAN_READ_PATH, PRODUCT_READ_PATH, PaymentMethodService, PlanService, ProductService, RouteOverlayService, SERVICE_READ_PATH, SHIPMENT_METHOD_READ_PATH, SHIPPING_MODE_OVERRIDE, ServiceService, ShipmentMethodService, ShippingModeService, TOAST_HTTP_OPTIONS, USER_CHANGE_PASSWORD_PATH, USER_LOGOUT_FROM_ALL_SESSIONS_PATH, USER_PATH, UserService, WAREHOUSE_READ_PATH, WarehouseService, ZONE_READ_PATH, ZoneService, asArray, asBoolean, asNullableBoolean, asNullableFlag01, asNullableNumber, asNullableString, asNumber, asRecord, asShippingMode$1 as asShippingMode, asString, authInterceptor, buildResourcePath, buildResourceQueryParams, collectFilterOptionsSources, collectResolvableSelectFields, copyToClipboard, countryFlagUrl, createAfricaniesQueryClientDefaults, csvCell, downloadCsv, fieldErrorsMap, formatApiErrorMessage, httpToastInterceptor, isLaravelValidationBag, isNotificationExternalLink, isValidEmail, joinApiErrorMessages, listFetchKind, mapApiJsonList, mapApiJsonValue, mapArray, mapCountry, mapCountryList, mapCountrySelectOptions, mapCountryState, mapCurrency, mapCurrencyList, mapCurrencyPaymentMethod, mapCurrencyPaymentMethodPivot, mapDocument, mapDocumentList, mapFileRead, mapFileReadList, mapLaravelValidationBag, mapList, mapModeConfigData, mapNotification, mapNotificationInboxItem, mapNotificationList, mapNotificationPayload, mapPaymentMethod, mapPaymentMethodCurrency, mapPaymentMethodList, mapPlan, mapPlanList, mapPlanPackage, mapProduct, mapProductList, mapResourcePayload, mapService, mapServiceList, mapShipmentMethod, mapShipmentMethodFilterOptions, mapShipmentMethodList, mapShipmentMethodZoneLink, mapShipmentMethodZonePage, mapShipmentZone, mapUser, mapUserAccountManager, mapUserBusinessAccount, mapUserCountry, mapUserCountryState, mapUserGatewayPayload, mapUserPaymentPayload, mapUserPlan, mapUserPlanPackage, mapUserStateLabel, mapUserSubscription, mapWarehouse, mapWarehouseCountry, mapWarehouseFilterOptions, mapWarehouseList, mapWarehouseState, mapZone, mapZoneList, mergeFilterOptionLists, normalize, normalizePagination, provideAfricaniesHttpClient, provideAfricaniesQueryDefaults, provideAfricaniesSdk, provideModeConfig, provideOverlayRoutes, resolveModeRegionConfig, resolveNotificationLinkForMode, resourceCacheTtlMs, shipmentModeInterceptor, toCsvString, toCurrencyCreateBody, toCurrencyDeleteBody, toCurrencyFlag01, toCurrencyUpdateBody, toFlag01, toPaymentMethodFlag01, toPaymentMethodUpdateBody, unwrapLaravelPaginator, withShippingMode, withToast };
|
|
4546
4634
|
//# sourceMappingURL=africanies-africanies-core.mjs.map
|